From 2bb6b1859a6ae7918d1e2a9bcf770939ced60b37 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Tue, 23 Jan 2007 14:02:28 +0000 Subject: [PATCH 001/718] Create a branch for 3.0.0. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4303 7894878c-1315-0410-8ee3-d5d059ff63e0 From c5ffa7b63592ba8bb66804372bcc6086de26eeb6 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Tue, 3 Apr 2007 12:55:30 +0000 Subject: [PATCH 002/718] Merge from trunk (4303:4355) out to 3.0.0 branch. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4357 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 54 ++++ Makefile | 2 +- README | 4 +- doc/busses/i2c-piix4 | 2 +- doc/busses/i2c-viapro | 9 +- doc/chips/SUMMARY | 2 + doc/chips/lm90 | 2 +- doc/chips/max6650 | 16 +- doc/chips/smsc47m1 | 10 +- doc/useful_addresses.html | 7 +- etc/sensors.conf.eg | 67 +++++ kernel/busses/i2c-ali1563.c | 56 ++-- kernel/busses/i2c-amd8111.c | 26 +- kernel/busses/i2c-nforce2.c | 2 - kernel/busses/i2c-piix4.c | 10 +- kernel/busses/i2c-viapro.c | 19 +- kernel/chips/adm1024.c | 3 +- kernel/chips/adm1025.c | 3 +- kernel/chips/adm1026.c | 1 - kernel/chips/bmcsensors.c | 5 +- kernel/chips/fscher.c | 3 +- kernel/chips/fscpos.c | 3 +- kernel/chips/fscscy.c | 3 +- kernel/chips/it87.c | 3 +- kernel/chips/lm78.c | 3 +- kernel/chips/lm85.c | 1 - kernel/chips/lm90.c | 2 +- kernel/chips/maxilife.c | 3 +- kernel/chips/mic74.c | 3 +- kernel/chips/sis5595.c | 3 +- kernel/chips/smsc47m1.c | 223 ++++++++++----- kernel/chips/w83627hf.c | 3 +- kernel/chips/w83781d.c | 3 +- lib/Module.mk | 2 +- lib/chips.c | 135 ++++++++- lib/chips.h | 34 +++ lib/proc.c | 16 +- lib/sysfs.c | 24 +- lm_sensors.lsm | 2 +- mkpatch/mkpatch.pl | 12 +- prog/detect/i2cdetect.8 | 3 + prog/detect/i2cdetect.c | 2 + prog/detect/sensors-detect | 497 +++++++++++++++++--------------- prog/dump/i2cdump.c | 25 +- prog/dump/isadump.c | 17 +- prog/pwm/fancontrol.pl | 8 +- prog/sensors/chips.c | 555 +++++++++--------------------------- prog/sensors/chips.h | 3 +- prog/sensors/main.c | 17 +- version.h | 4 +- 50 files changed, 1024 insertions(+), 888 deletions(-) diff --git a/CHANGES b/CHANGES index d80b4f36..b5e1c5ba 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,60 @@ lm_sensors CHANGES file ----------------------- SVN HEAD + File sensors.conf.eg: Add a dme1737 section + Library: Clean up pwm symbol names translation + Add dme1737 support + Program isadump: Detect when address bit 7 is a busy flag + Program sensors: Drop ddcmon and eeprom support + Add dme1737 support + Program sensors-detect: Stop Super-I/O probe after first family success + Fix SMSC DME1737 detection + + +2.10.3 (20070319) + Library: Do not skip i2c adapters with only a class device and no + physical device. This change is required to survive the + planned struct class_dev removal from future 2.6 kernels. + Add support for the SMSC LPC47M292 fans (prefix smsc47m2) + Recognize i2c-isa-based devices as such even after class_dev + is gone + Compile with -D_REENTRANT + Fix support of Linux 2.6's max6650 driver + Fix max1619 support + Man page i2cdetect.8: Scanning range can be restricted + Module bmcsensors: Fix debugging messages + Module i2c-ali1563: Improve the status messages (2.6 backport) + Fix device initialization (2.6 backport) + Module i2c-amd8111: Cleanups (2.6 backport) + Fix initialization race (2.6 backport) + Module i2c-nforce2: Drop unused reference to pci_dev (2.6 backport) + Module i2c-piix4: Add ATI SB600 support (2.6 backport) + Module i2c-viapro: Add CX700 support (2.6 backport) + Module smsc47m1: Add SMSC LPC47M292 support + Get rid of a useless semaphore (2.6 backport) + Programs i2cdetect, i2cdump, isadump: Flush output in real time + Program i2cdump: Cleaner output in SMBus block read mode + Program fancontrol.pl: Fix pwmN_enable access (#2190) + Program sensors: Add smsc47m2 support (fans) + Fix -A option (hide adapter name) on error + Program sensors-detect: Only probe relevant I2C addresses + Drop ARP-capable device detection + Add Maxim MAX6655/MAX6656 detection + (Olexiy Avramchenko) + Add Maxim MAX1668, MAX1805, MAX1989 detection + Add VIA CX700 detection + Drop legacy W83627HF ISA detection + Don't bufferize stdout during probes + Speed up the LM75 and LM77 detection + Clean up the EEPROM detection + Add Dallas DS75 detection + Add SMSC LPC47M292 detection + Add nVidia MCP61 and MCP65 detection + Fix ADM1028 detection + Add Nat. Semi. PC8347L Super-I/O detection + Add SMSC SCH5504 Super-I/O detection (no sensors) + Make the LM78 and W83781D detection safer + 2.10.2 (20070115) RPM: Obsolete, removed diff --git a/Makefile b/Makefile index 66ee504d..65665e9d 100644 --- a/Makefile +++ b/Makefile @@ -279,7 +279,7 @@ LIBCPPFLAGS := $(ALL_CPPFLAGS) ifdef SYSFS_SUPPORT LIBCPPFLAGS := $(LIBCPPFLAGS) -DSYSFS_SUPPORT endif -LIBCFLAGS := -fpic $(ALL_CFLAGS) +LIBCFLAGS := -fpic -D_REENTRANT $(ALL_CFLAGS) .PHONY: all user clean install user_install uninstall user_uninstall version package diff --git a/README b/README index 7d7c262f..c8fc488b 100644 --- a/README +++ b/README @@ -47,7 +47,7 @@ At least the following I2C/SMBus adapters are supported: AMD 756, 766, 768 and 8111 AMD 8111 SMBus 2.0 Apple Hydra (used on some PPC machines) - ATI IXP200, IXP300, IXP400 + ATI IXP200, IXP300, IXP400, SB600 DEC 21272/21274 (Tsunami/Typhoon - on Alpha boards) Intel ICH/ICH0/ICH2/ICH3/ICH4/ICH5/ICH6/ICH7/ICH8/ICH9 (82801xx) Intel 6300ESB, 631xESB/632xESB (ESB2) @@ -60,7 +60,7 @@ At least the following I2C/SMBus adapters are supported: SMSC Victory66 3Dfx Voodoo 3 and Banshee VIA Technologies VT82C586B, VT82C596A/B, VT82C686A/B, VT8231, - VT8233, VT8233A, VT8235, VT8237R/A and VT8251 + VT8233, VT8233A, VT8235, VT8237R/A, VT8251, CX700 At least the following hardware sensor chips are supported: diff --git a/doc/busses/i2c-piix4 b/doc/busses/i2c-piix4 index bf3e29ff..d7cce66e 100644 --- a/doc/busses/i2c-piix4 +++ b/doc/busses/i2c-piix4 @@ -9,7 +9,7 @@ Supported adapters: Datasheet: Publicly available at the Intel website * ServerWorks OSB4, CSB5, CSB6 and HT-1000 southbridges Datasheet: Only available via NDA from ServerWorks - * ATI IXP southbridges IXP200, IXP300, IXP400 + * ATI IXP200, IXP300, IXP400 and SB600 southbridges Datasheet: Not publicly available * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge Datasheet: Publicly available at the SMSC website http://www.smsc.com diff --git a/doc/busses/i2c-viapro b/doc/busses/i2c-viapro index f3491804..375d305d 100644 --- a/doc/busses/i2c-viapro +++ b/doc/busses/i2c-viapro @@ -10,7 +10,10 @@ Supported adapters: Datasheet: Sometimes available at the VIA website * VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237R/A, VT8251 - Datasheet: available on request from Via + Datasheet: available on request and under NDA from VIA + + * VIA Technologies, Inc. CX700 + Datasheet: available on request and under NDA from VIA Authors: Kyösti Mälkki @@ -45,6 +48,7 @@ Your /proc/pci or lspci -n listing must show one of these : device 1106:3227 (VT8237R) device 1106:3337 (VT8237A) device 1106:3287 (VT8251) + device 1106:8324 (CX700) If none of these show up, you should look in the BIOS for settings like enable ACPI / SMBus or even USB. @@ -52,3 +56,6 @@ enable ACPI / SMBus or even USB. Except for the oldest chips (VT82C596A/B, VT82C686A and most probably VT8231), this driver supports I2C block transactions. Such transactions are mainly useful to read from and write to EEPROMs. + +The CX700 additionally appears to support SMBus PEC, although this driver +doesn't implement it. diff --git a/doc/chips/SUMMARY b/doc/chips/SUMMARY index cc05196e..ca5afe4e 100644 --- a/doc/chips/SUMMARY +++ b/doc/chips/SUMMARY @@ -220,6 +220,8 @@ smsc47m1 smsc47m15x - - 2 2 no yes (LPC) smsc47m192 - - 2 2 no yes (LPC) smsc47m997 - - 2 2 no yes (LPC) + (reported as a "smsc47m2") + smsc47m292 - - 3 3 no yes (LPC) thmc50 adm1022 3 2 - 1 dac yes no diff --git a/doc/chips/lm90 b/doc/chips/lm90 index ffa58cc5..75a174aa 100644 --- a/doc/chips/lm90 +++ b/doc/chips/lm90 @@ -176,7 +176,7 @@ SMBus Read Byte, and PEC will work properly. Additionally, the ADM1032 doesn't support SMBus Send Byte with PEC. Instead, it will try to write the PEC value to the register (because the SMBus Send Byte transaction with PEC is similar to a Write Byte transaction -without PEC), which is not what we want. Thus, PEC is explicitely disabled +without PEC), which is not what we want. Thus, PEC is explicitly disabled on SMBus Send Byte transactions in the lm90 driver. PEC on byte data transactions represents a significant increase in bandwidth diff --git a/doc/chips/max6650 b/doc/chips/max6650 index a2564021..bbd63d6c 100644 --- a/doc/chips/max6650 +++ b/doc/chips/max6650 @@ -4,7 +4,7 @@ Sensors chip driver for MAXIM MAX6650 / MAX6651 fan controllers Chip notes ---------- -The MAX6551 is a fan controller. It has two distinct functions: +The MAX6651 is a fan controller. It has two distinct functions: 1) Speed control, with feedback, for a single fan. The code can write to a register requesting that the fan run at a certain speed, and the @@ -14,7 +14,7 @@ The MAX6551 is a fan controller. It has two distinct functions: 2) Speed measurement (tachometers) for up to four fans, including the controlled one. -The MAX6550 is similar but only has one measurement tachometer. +The MAX6650 is similar but only has one measurement tachometer. Both chips have a few general purpose i/o pins, some of which can be configured to have special functions. At the time of writing an overview @@ -22,7 +22,7 @@ of the chip, with links to the datasheet, can be seen at: http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2296/ln/en -If that has moved searching for MAX6550 from Maxim's home page should +If that has moved searching for MAX6650 from Maxim's home page should work. Driver state @@ -79,9 +79,9 @@ Bugs configuration dynamically instead of assuming that some other code has done it. - o It does not differentiate between a MAX6550 and a MAX6551, as I can - see no obvious way to do this. It has only been tested with a MAX6551 - so if anyone gets a board with a MAX6550 to test with maybe something + o It does not differentiate between a MAX6650 and a MAX6651, as I can + see no obvious way to do this. It has only been tested with a MAX6651 + so if anyone gets a board with a MAX6650 to test with maybe something will be revealed, such as the three missing tachometer registers returning all ones or something. (OK, so maybe I should have called this driver max6651, and ignored the max6650 totally...) @@ -96,13 +96,13 @@ The module will autodetect the presence of a max6650 or max6651 at any of the four possible I2C addresses for these devices. There is no ID register, but there are several registers with all zero bits at the high end. The driver checks that all of these are in fact zero before -declaring the chip to be a MAX6550/1. +declaring the chip to be a MAX6650/1. sensors-detect -------------- Support for MAX6650/1 has been added to sensors-detect. It has been -tested as correctly detecting a MAX6551 at I2C address 0x1B. Like the +tested as correctly detecting a MAX6651 at I2C address 0x1B. Like the driver, it cannot yet distinguish a MAX6650 and MAX6651. prog/sensors diff --git a/doc/chips/smsc47m1 b/doc/chips/smsc47m1 index 0863e57c..6c1c35ae 100644 --- a/doc/chips/smsc47m1 +++ b/doc/chips/smsc47m1 @@ -16,6 +16,10 @@ Supported chips: http://www.smsc.com/main/datasheets/47m14x.pdf http://www.smsc.com/main/tools/discontinued/47m15x.pdf http://www.smsc.com/main/datasheets/47m192.pdf + * SMSC LPC47M292 + Prefix: 'smsc47m2' + Addresses scanned: none, address read from Super I/O config space + Datasheet: Not public * SMSC LPC47M997 Addresses scanned: none, address read from Super I/O config space Prefix: 'smsc47m1' @@ -41,9 +45,9 @@ Description The Standard Microsystems Corporation (SMSC) 47M1xx Super I/O chips contain monitoring and PWM control circuitry for two fans. -The 47M15x and 47M192 chips contain a full 'hardware monitoring block' -in addition to the fan monitoring and control. The hardware monitoring -block is not supported by the driver. +The LPC47M15x, LPC47M192 and LPC47M292 chips contain a full 'hardware +monitoring block' in addition to the fan monitoring and control. The +hardware monitoring block is not supported by the driver. No documentation is available for the 47M997, but it has the same device ID as the 47M15x and 47M192 chips and seems to be compatible therewith. diff --git a/doc/useful_addresses.html b/doc/useful_addresses.html index 2bd20574..073ea0a1 100644 --- a/doc/useful_addresses.html +++ b/doc/useful_addresses.html @@ -156,8 +156,11 @@ implementations. Please report any other references you have found!

As far we know only one motherboard manufacturer provides sensors.conf files:

Personal collections:

diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index a958989b..ff89cfd7 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -2813,3 +2813,70 @@ chip "k8temp-*" label temp2 "Core0 Temp" label temp3 "Core1 Temp" label temp4 "Core1 Temp" + + +# +# Sample configuration for the SMSC DME1737 and ASUS A8000 +# +chip "dme1737-*" + +# Voltage inputs + label in0 "V5stby" + label in1 "Vccp" + label in2 "V3.3" + label in3 "V5" + label in4 "V12" + label in5 "V3.3stby" + label in6 "Vbat" + +# Temperature inputs + label temp1 "RD1 Temp" + label temp2 "Int Temp" + label temp3 "CPU Temp" + +# Fan inputs + label fan1 "CPU_Fan" + label fan2 "Fan2" + label fan3 "Fan3" + label fan4 "Fan4" + label fan5 "Fan5" + label fan6 "Fan6" + +# PWM Outputs + label pwm1 "CPU_PWM" + label pwm2 "Fan2_PWM" + label pwm3 "Fan3_PWM" + label pwm5 "Fan5_PWM" + label pwm6 "Fan6_PWM" + +# Set voltage limits +# set in0_min 5.0 * 0.95 +# set in0_max 5.0 * 1.05 +# set in1_min 1.4 * 0.95 +# set in1_max 1.4 * 1.05 +# set in2_min 3.3 * 0.95 +# set in2_max 3.3 * 1.05 +# set in3_min 5.0 * 0.95 +# set in3_max 5.0 * 1.05 +# set in4_min 12.0 * 0.95 +# set in4_max 12.0 * 1.05 +# set in5_min 3.3 * 0.95 +# set in5_max 3.3 * 1.05 +# set in6_min 3.0 * 0.95 +# set in6_max 3.0 * 1.05 + +# Set Temp Limits +# set temp1_min 10 +# set temp1_max 75 +# set temp2_min 10 +# set temp2_max 75 +# set temp3_min 10 +# set temp3_max 75 + +# Set Fan limits +# set fan1_min 1000 +# set fan2_min 1000 +# set fan3_min 1000 +# set fan4_min 1000 +# set fan5_min 1000 +# set fan6_min 1000 diff --git a/kernel/busses/i2c-ali1563.c b/kernel/busses/i2c-ali1563.c index 50bb9c9a..87cc2d2c 100644 --- a/kernel/busses/i2c-ali1563.c +++ b/kernel/busses/i2c-ali1563.c @@ -326,35 +326,11 @@ static u32 ali1563_func(struct i2c_adapter * a) } -static void ali1563_enable(struct pci_dev * dev) -{ - u16 ctrl; - - pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); - ctrl |= 0x7; - pci_write_config_word(dev,ALI1563_SMBBA,ctrl); -} - static int __devinit ali1563_setup(struct pci_dev * dev) { u16 ctrl; pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); - printk(KERN_DEBUG "ali1563: SMBus control = %04x\n",ctrl); - - /* Check if device is even enabled first */ - if (!(ctrl & ALI1563_SMB_IOEN)) { - printk(KERN_WARNING "ali1563: I/O space not enabled, trying manually\n"); - ali1563_enable(dev); - } - if (!(ctrl & ALI1563_SMB_IOEN)) { - printk(KERN_WARNING "ali1563: I/O space still not enabled, giving up\n"); - goto Err; - } - if (!(ctrl & ALI1563_SMB_HOSTEN)) { - printk(KERN_WARNING "ali1563: Host Controller not enabled\n"); - goto Err; - } /* SMB I/O Base in high 12 bits and must be aligned with the * size of the I/O space. */ @@ -363,11 +339,32 @@ static int __devinit ali1563_setup(struct pci_dev * dev) printk(KERN_WARNING "ali1563: ali1563_smba Uninitialized\n"); goto Err; } - if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, - ali1563_pci_driver.name)) { - printk(KERN_WARNING "ali1563: Could not allocate I/O space"); + + /* Check if device is enabled */ + if (!(ctrl & ALI1563_SMB_HOSTEN)) { + printk(KERN_WARNING "ali1563: Host Controller not enabled\n"); goto Err; } + if (!(ctrl & ALI1563_SMB_IOEN)) { + printk(KERN_WARNING "I/O space not enabled, trying manually\n"); + pci_write_config_word(dev, ALI1563_SMBBA, + ctrl | ALI1563_SMB_IOEN); + pci_read_config_word(dev, ALI1563_SMBBA, &ctrl); + if (!(ctrl & ALI1563_SMB_IOEN)) { + printk(KERN_WARNING "I/O space still not enabled, " + "giving up\n"); + goto Err; + } + } + + if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, + ali1563_pci_driver.name)) { + printk(KERN_WARNING "ali1563: Could not allocate I/O space " + "at 0x%04x\n", ali1563_smba); + goto Err; + } + printk(KERN_INFO "ali1563: Found ALi1563 SMBus at 0x%04x\n", + ali1563_smba); return 0; Err: @@ -411,14 +408,15 @@ static int __devinit ali1563_probe(struct pci_dev * dev, { int error; - if ((error = ali1563_setup(dev))){ + if ((error = ali1563_setup(dev))) { + printk(KERN_WARNING "ali1563: ALi1563 SMBus probe failed " + "(%d)\n", error); return error; } sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", ali1563_smba); if ((error = i2c_add_adapter(&ali1563_adapter))) ali1563_shutdown(dev); - printk(KERN_DEBUG "%s: Returning %d\n",__FUNCTION__,error); return error; } diff --git a/kernel/busses/i2c-amd8111.c b/kernel/busses/i2c-amd8111.c index 50517ec7..a6bc973a 100644 --- a/kernel/busses/i2c-amd8111.c +++ b/kernel/busses/i2c-amd8111.c @@ -215,7 +215,7 @@ s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, case I2C_SMBUS_WORD_DATA: amd_ec_write(smbus, AMD_SMB_CMD, command); if (read_write == I2C_SMBUS_WRITE) { - amd_ec_write(smbus, AMD_SMB_DATA, data->word); + amd_ec_write(smbus, AMD_SMB_DATA, data->word & 0xff); amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); } protocol |= AMD_SMB_PRTCL_WORD_DATA | pec; @@ -224,7 +224,7 @@ s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, case I2C_SMBUS_BLOCK_DATA: amd_ec_write(smbus, AMD_SMB_CMD, command); if (read_write == I2C_SMBUS_WRITE) { - len = min_t(u8, data->block[0], 32); + len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX); amd_ec_write(smbus, AMD_SMB_BCNT, len); for (i = 0; i < len; i++) amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); @@ -233,7 +233,7 @@ s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, break; case I2C_SMBUS_I2C_BLOCK_DATA: - len = min_t(u8, data->block[0], 32); + len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX); amd_ec_write(smbus, AMD_SMB_CMD, command); amd_ec_write(smbus, AMD_SMB_BCNT, len); if (read_write == I2C_SMBUS_WRITE) @@ -244,14 +244,14 @@ s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, case I2C_SMBUS_PROC_CALL: amd_ec_write(smbus, AMD_SMB_CMD, command); - amd_ec_write(smbus, AMD_SMB_DATA, data->word); + amd_ec_write(smbus, AMD_SMB_DATA, data->word & 0xff); amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); protocol = AMD_SMB_PRTCL_PROC_CALL | pec; read_write = I2C_SMBUS_READ; break; case I2C_SMBUS_BLOCK_PROC_CALL: - len = min_t(u8, data->block[0], 31); + len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX - 1); amd_ec_write(smbus, AMD_SMB_CMD, command); amd_ec_write(smbus, AMD_SMB_BCNT, len); for (i = 0; i < len; i++) @@ -303,7 +303,7 @@ s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_PROC_CALL: amd_ec_read(smbus, AMD_SMB_BCNT, &len); - len = min_t(u8, len, 32); + len = min_t(u8, len, I2C_SMBUS_BLOCK_MAX); case I2C_SMBUS_I2C_BLOCK_DATA: for (i = 0; i < len; i++) amd_ec_read(smbus, AMD_SMB_DATA + i, data->block + i + 1); @@ -354,11 +354,11 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ struct amd_smbus *smbus; int error; - if (~pci_resource_flags(dev, 0) & IORESOURCE_IO) - return -1; + if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO)) + return -ENODEV; if (!(smbus = kmalloc(sizeof(struct amd_smbus), GFP_KERNEL))) - return -1; + return -ENOMEM; memset(smbus, 0, sizeof(struct amd_smbus)); pci_set_drvdata(dev, smbus); @@ -368,7 +368,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) { kfree(smbus); - return -1; + return -EBUSY; } sprintf(smbus->adapter.name, "SMBus2 AMD8111 adapter at %04x", smbus->base); @@ -378,16 +378,16 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ smbus->adapter.inc_use = amd8111_inc; smbus->adapter.dec_use = amd8111_dec; + pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0); + error = i2c_add_adapter(&smbus->adapter); if (error) { printk(KERN_WARNING "i2c-amd8111.c: Failed to register adapter.\n"); release_region(smbus->base, smbus->size); kfree(smbus); - return -1; + return error; } - pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0); - printk(KERN_INFO "i2c-amd8111.c: AMD8111 SMBus 2.0 adapter at %#x\n", smbus->base); return 0; } diff --git a/kernel/busses/i2c-nforce2.c b/kernel/busses/i2c-nforce2.c index 4f976fba..b8ed6cf0 100644 --- a/kernel/busses/i2c-nforce2.c +++ b/kernel/busses/i2c-nforce2.c @@ -82,7 +82,6 @@ MODULE_DESCRIPTION("nForce2 SMBus driver"); struct nforce2_smbus { - struct pci_dev *dev; struct i2c_adapter adapter; int base; int size; @@ -336,7 +335,6 @@ static int __devinit nforce2_probe_smb(struct pci_dev *dev, int bar, smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; smbus->size = 8; } - smbus->dev = dev; if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { printk (KERN_ERR "i2c-nforce2.o: Error requesting region %02x .. %02X for %s\n", smbus->base, smbus->base+smbus->size-1, name); diff --git a/kernel/busses/i2c-piix4.c b/kernel/busses/i2c-piix4.c index 90309ffa..94a4c301 100644 --- a/kernel/busses/i2c-piix4.c +++ b/kernel/busses/i2c-piix4.c @@ -23,7 +23,7 @@ Supports: Intel PIIX4, 440MX Serverworks OSB4, CSB5, CSB6, HT-1000 - ATI IXP200, IXP300, IXP400 + ATI IXP200, IXP300, IXP400, SB600 SMSC Victory66 Note: we assume there can only be one device, with one SMBus interface. @@ -438,6 +438,7 @@ static struct i2c_adapter piix4_adapter = { #define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353 #define PCI_DEVICE_ID_ATI_IXP300_SMBUS 0x4363 #define PCI_DEVICE_ID_ATI_IXP400_SMBUS 0x4372 +#define PCI_DEVICE_ID_ATI_IXP600_SMBUS 0x4385 #ifndef PCI_DEVICE_ID_SERVERWORKS_CSB6 #define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 @@ -474,6 +475,13 @@ static struct pci_device_id piix4_ids[] __devinitdata = { .subdevice = PCI_ANY_ID, .driver_data = 0, }, + { + .vendor = PCI_VENDOR_ID_ATI, + .device = PCI_DEVICE_ID_ATI_IXP600_SMBUS, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .driver_data = 0, + }, { .vendor = PCI_VENDOR_ID_SERVERWORKS, .device = PCI_DEVICE_ID_SERVERWORKS_OSB4, diff --git a/kernel/busses/i2c-viapro.c b/kernel/busses/i2c-viapro.c index ac0536b7..3a6d70f2 100644 --- a/kernel/busses/i2c-viapro.c +++ b/kernel/busses/i2c-viapro.c @@ -4,7 +4,7 @@ Copyright (c) 1998 - 2002 Frodo Looijaard , Philip Edelbrock , Kyösti Mälkki , Mark D. Studebaker - Copyright (C) 2005 Jean Delvare + Copyright (C) 2005 - 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ VT8237R 0x3227 yes VT8237A 0x3337 yes VT8251 0x3287 yes + CX700 0x8324 yes Note: we assume there can only be one device, with one SMBus interface. */ @@ -63,14 +64,18 @@ #ifndef PCI_DEVICE_ID_VIA_8237 #define PCI_DEVICE_ID_VIA_8237 0x3227 #endif -/* 8237A is undefined as for the kernel 2.4.33 */ +/* 8237A is undefined */ #ifndef PCI_DEVICE_ID_VIA_8237A #define PCI_DEVICE_ID_VIA_8237A 0x3337 #endif -/* 8251 is undefined as for the kernel 2.4.33 */ +/* 8251 is undefined */ #ifndef PCI_DEVICE_ID_VIA_8251 #define PCI_DEVICE_ID_VIA_8251 0x3287 #endif +/* CX700 is undefined */ +#ifndef PCI_DEVICE_ID_VIA_CX700 +#define PCI_DEVICE_ID_VIA_CX700 0x8324 +#endif #define SMBBA1 0x90 #define SMBBA2 0x80 @@ -418,6 +423,7 @@ found: dev_dbg(pdev, "VT596_smba = 0x%X\n", vt596_smba); switch (id->device) { + case PCI_DEVICE_ID_VIA_CX700: case PCI_DEVICE_ID_VIA_8251: case PCI_DEVICE_ID_VIA_8237: case PCI_DEVICE_ID_VIA_8237A: @@ -516,6 +522,13 @@ static struct pci_device_id vt596_ids[] __initdata = { .subdevice = PCI_ANY_ID, .driver_data = SMBBA3 }, + { + .vendor = PCI_VENDOR_ID_VIA, + .device = PCI_DEVICE_ID_VIA_CX700, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .driver_data = SMBBA3 + }, { 0, } }; diff --git a/kernel/chips/adm1024.c b/kernel/chips/adm1024.c index e93ca127..18ff22c7 100644 --- a/kernel/chips/adm1024.c +++ b/kernel/chips/adm1024.c @@ -143,8 +143,7 @@ static inline u8 FAN_TO_REG(long rpm, int div) #define VID_FROM_REG(val) ((val)==0x1f?0:(val)>=0x10?510-(val)*10:\ 205-(val)*5) -/* For each registered ADM1024, we need to keep some data in memory. That - data is pointed to by adm1024_list[NR]->data. The structure itself is +/* For each registered ADM1024, we need to keep some data in memory. It is dynamically allocated, at the same time when a new adm1024 client is allocated. */ struct adm1024_data { diff --git a/kernel/chips/adm1025.c b/kernel/chips/adm1025.c index 8a19bfba..22151e12 100644 --- a/kernel/chips/adm1025.c +++ b/kernel/chips/adm1025.c @@ -112,8 +112,7 @@ SENSORS_INSMOD_2(adm1025, ne1619); #define ALARMS_FROM_REG(val) (val) -/* For each registered ADM1025, we need to keep some data in memory. That - data is pointed to by adm1025_list[NR]->data. The structure itself is +/* For each registered ADM1025, we need to keep some data in memory. It is dynamically allocated, at the same time when a new adm1025 client is allocated. */ struct adm1025_data { diff --git a/kernel/chips/adm1026.c b/kernel/chips/adm1026.c index 27b38e4b..6fd62d29 100644 --- a/kernel/chips/adm1026.c +++ b/kernel/chips/adm1026.c @@ -298,7 +298,6 @@ static int adm1026_scaling[] = { /* .001 Volts */ struct adm1026_data { struct i2c_client client; - struct semaphore lock; int sysctl_id; enum chips type; diff --git a/kernel/chips/bmcsensors.c b/kernel/chips/bmcsensors.c index 16b963d7..00077e15 100644 --- a/kernel/chips/bmcsensors.c +++ b/kernel/chips/bmcsensors.c @@ -38,7 +38,6 @@ */ struct bmcsensors_data { - struct semaphore lock; int sysctl_id; struct semaphore update_lock; @@ -880,7 +879,7 @@ static void bmcsensors_update_client(struct i2c_client *client) if(state != STATE_READING) { state = STATE_READING; #ifdef DEBUG - printk(KERN_DEBUG "bmcsensors.o: starting update\n", j); + printk(KERN_DEBUG "bmcsensors.o: starting update\n"); #endif bmcsensors_get_reading(client, 0); } @@ -888,7 +887,7 @@ static void bmcsensors_update_client(struct i2c_client *client) while(state == STATE_READING && j++ < 100) bmc_do_pause(HZ / 25); #ifdef DEBUG - printk("bmcsensors.o: update complete; j = %d\n", j); + printk(KERN_DEBUG "bmcsensors.o: update complete; j = %d\n", j); #endif data->last_updated = jiffies; data->valid = 1; diff --git a/kernel/chips/fscher.c b/kernel/chips/fscher.c index a7b082e0..8fd77ada 100644 --- a/kernel/chips/fscher.c +++ b/kernel/chips/fscher.c @@ -103,8 +103,7 @@ SENSORS_INSMOD_1(fscher); /* Initial limits */ -/* For each registered FSCHER, we need to keep some data in memory. That - data is pointed to by fscher_list[NR]->data. The structure itself is +/* For each registered FSCHER, we need to keep some data in memory. It is dynamically allocated, at the same time when a new fscher client is allocated. */ struct fscher_data { diff --git a/kernel/chips/fscpos.c b/kernel/chips/fscpos.c index 55d20074..0bb4858e 100644 --- a/kernel/chips/fscpos.c +++ b/kernel/chips/fscpos.c @@ -107,8 +107,7 @@ SENSORS_INSMOD_1(fscpos); /* Initial limits */ -/* For each registered FSCPOS, we need to keep some data in memory. That - data is pointed to by fscpos_list[NR]->data. The structure itself is +/* For each registered FSCPOS, we need to keep some data in memory. It is dynamically allocated, at the same time when a new fscpos client is allocated. */ struct fscpos_data { diff --git a/kernel/chips/fscscy.c b/kernel/chips/fscscy.c index 7679f4c3..559a106b 100644 --- a/kernel/chips/fscscy.c +++ b/kernel/chips/fscscy.c @@ -151,8 +151,7 @@ SENSORS_INSMOD_1(fscscy); /* Initial limits */ -/* For each registered FSCSCY, we need to keep some data in memory. That - data is pointed to by fscscy_list[NR]->data. The structure itself is +/* For each registered FSCSCY, we need to keep some data in memory. It is dynamically allocated, at the same time when a new fscscy client is allocated. */ struct fscscy_data { diff --git a/kernel/chips/it87.c b/kernel/chips/it87.c index 88a5a9d8..01286a7e 100644 --- a/kernel/chips/it87.c +++ b/kernel/chips/it87.c @@ -215,8 +215,7 @@ extern inline u8 DIV_TO_REG(long val) } #define DIV_FROM_REG(val) (1 << (val)) -/* For each registered IT87, we need to keep some data in memory. That - data is pointed to by it87_list[NR]->data. The structure itself is +/* For each registered IT87, we need to keep some data in memory. It is dynamically allocated, at the same time when a new it87 client is allocated. */ struct it87_data { diff --git a/kernel/chips/lm78.c b/kernel/chips/lm78.c index 0b08e973..6598170a 100644 --- a/kernel/chips/lm78.c +++ b/kernel/chips/lm78.c @@ -111,8 +111,7 @@ static inline u8 FAN_TO_REG(long rpm, int div) bad. Quite a lot of bookkeeping is done. A real driver can often cut some corners. */ -/* For each registered LM78, we need to keep some data in memory. That - data is pointed to by lm78_list[NR]->data. The structure itself is +/* For each registered LM78, we need to keep some data in memory. It is dynamically allocated, at the same time when a new lm78 client is allocated. */ struct lm78_data { diff --git a/kernel/chips/lm85.c b/kernel/chips/lm85.c index 15ec9ac9..4f45e892 100644 --- a/kernel/chips/lm85.c +++ b/kernel/chips/lm85.c @@ -373,7 +373,6 @@ struct lm85_autofan { struct lm85_data { struct i2c_client client; - struct semaphore lock; int sysctl_id; enum chips type; diff --git a/kernel/chips/lm90.c b/kernel/chips/lm90.c index c6e4f3c0..9e5e38d1 100644 --- a/kernel/chips/lm90.c +++ b/kernel/chips/lm90.c @@ -302,7 +302,7 @@ static ctl_table adm1032_dir_table_template[] = */ /* The ADM1032 supports PEC but not on write byte transactions, so we need - to explicitely ask for a transaction without PEC. */ + to explicitly ask for a transaction without PEC. */ static inline s32 adm1032_write_byte(struct i2c_client *client, u8 value) { return i2c_smbus_xfer(client->adapter, client->addr, diff --git a/kernel/chips/maxilife.c b/kernel/chips/maxilife.c index 2b630391..7eab4be5 100644 --- a/kernel/chips/maxilife.c +++ b/kernel/chips/maxilife.c @@ -233,8 +233,7 @@ enum maxi_type { cristal, cognac, ashaki, nba }; enum sensor_type { fan, temp, vid, pll, lcd, alarm }; /* For each registered MaxiLife controller, we need to keep some data in - memory. That data is pointed to by maxi_list[NR]->data. The structure - itself is dynamically allocated, at the same time when a new MaxiLife + memory. It is dynamically allocated, at the same time when a new MaxiLife client is allocated. We assume MaxiLife will only be present on the SMBus and not on the ISA bus. */ struct maxi_data { diff --git a/kernel/chips/mic74.c b/kernel/chips/mic74.c index 080a38ed..b04a6bbe 100644 --- a/kernel/chips/mic74.c +++ b/kernel/chips/mic74.c @@ -54,8 +54,7 @@ SENSORS_INSMOD_1(mic74); /* Initial values */ /* All registers are 0, except for MIC74_REG_DATA which is 0xFF */ -/* For each registered MIC74, we need to keep some data in memory. That - data is pointed to by mic74_list[NR]->data. The structure itself is +/* For each registered MIC74, we need to keep some data in memory. It is dynamically allocated, at the same time when a new mic74 client is allocated. */ struct mic74_data { diff --git a/kernel/chips/sis5595.c b/kernel/chips/sis5595.c index 20de1540..6c2e58ec 100644 --- a/kernel/chips/sis5595.c +++ b/kernel/chips/sis5595.c @@ -161,8 +161,7 @@ static inline u8 FAN_TO_REG(long rpm, int div) #define DIV_FROM_REG(val) (1 << (val)) #define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) -/* For the SIS5595, we need to keep some data in memory. That - data is pointed to by sis5595_list[NR]->data. The structure itself is +/* For the SIS5595, we need to keep some data in memory. It is dynamically allocated, at the time when the new sis5595 client is allocated. */ struct sis5595_data { diff --git a/kernel/chips/smsc47m1.c b/kernel/chips/smsc47m1.c index 2e82615e..e464e9c9 100644 --- a/kernel/chips/smsc47m1.c +++ b/kernel/chips/smsc47m1.c @@ -38,7 +38,8 @@ static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; static unsigned int normal_isa[] = { 0x0000, SENSORS_ISA_END }; static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; -SENSORS_INSMOD_1(smsc47m1); +SENSORS_INSMOD_2(smsc47m1, smsc47m2); +static u8 devid; /* modified from kernel/include/traps.c */ #define REG 0x2e /* The register to read/write */ @@ -87,8 +88,13 @@ superio_exit(void) * can do much more besides (device id 0x60). * The LPC47M997 is undocumented, but seems to be compatible with * the LPC47M192, and has the same device id. + * The LPC47M292 (device id 0x6B) is somewhat compatible, but it + * supports a 3rd fan, and the pin configuration registers are + * unfortunately different. */ -#define SMSC_DEVID_MATCH(id) ((id) == 0x51 || (id) == 0x59 || (id) == 0x5F || (id) == 0x60) +#define SMSC_DEVID_MATCH(id) ((id) == 0x51 || (id) == 0x59 || \ + (id) == 0x5F || (id) == 0x60 || \ + (id) == 0x6B) #define SMSC_ACT_REG 0x30 #define SMSC_BASE_REG 0x60 @@ -99,10 +105,17 @@ superio_exit(void) #define SMSC47M1_REG_TPIN2 0x33 #define SMSC47M1_REG_TPIN1 0x34 #define SMSC47M1_REG_PPIN(nr) (0x37 - (nr)) -#define SMSC47M1_REG_PWM(nr) (0x55 + (nr)) #define SMSC47M1_REG_FANDIV 0x58 -#define SMSC47M1_REG_FAN(nr) (0x58 + (nr)) -#define SMSC47M1_REG_FAN_MIN(nr) (0x5a + (nr)) + +static const u8 SMSC47M1_REG_PWM[3] = { 0x56, 0x57, 0x69 }; +static const u8 SMSC47M1_REG_FAN[3] = { 0x59, 0x5a, 0x6b }; +static const u8 SMSC47M1_REG_FAN_MIN[3] = { 0x5b, 0x5c, 0x6c }; + +#define SMSC47M2_REG_ALARM6 0x09 +#define SMSC47M2_REG_TPIN3 0x2d +#define SMSC47M2_REG_TPIN2 0x37 +#define SMSC47M2_REG_TPIN1 0x38 +#define SMSC47M2_REG_FANDIV3 0x6a static inline u8 MIN_TO_REG(long rpm, int div) { @@ -125,18 +138,18 @@ static inline u8 MIN_TO_REG(long rpm, int div) struct smsc47m1_data { struct i2c_client client; - struct semaphore lock; int sysctl_id; + enum chips type; struct semaphore update_lock; char valid; /* !=0 if following fields are valid */ unsigned long last_updated; /* In jiffies */ - u8 fan[2]; /* Register value */ - u8 fan_min[2]; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ + u8 fan[3]; /* Register value */ + u8 fan_min[3]; /* Register value */ + u8 fan_div[3]; /* Register encoding, shifted right */ u8 alarms; /* Register encoding */ - u8 pwm[2]; /* Register value (bit 0 is disable) */ + u8 pwm[3]; /* Register value (bit 0 is disable) */ }; @@ -144,10 +157,6 @@ static int smsc47m1_attach_adapter(struct i2c_adapter *adapter); static int smsc47m1_detect(struct i2c_adapter *adapter, int address, unsigned short flags, int kind); static int smsc47m1_detach_client(struct i2c_client *client); - -static int smsc47m1_read_value(struct i2c_client *client, u8 register); -static int smsc47m1_write_value(struct i2c_client *client, u8 register, - u8 value); static void smsc47m1_update_client(struct i2c_client *client); static void smsc47m1_init_client(struct i2c_client *client); @@ -172,13 +181,16 @@ static struct i2c_driver smsc47m1_driver = { /* -- SENSORS SYSCTL START -- */ #define SMSC47M1_SYSCTL_FAN1 1101 /* Rotations/min */ #define SMSC47M1_SYSCTL_FAN2 1102 +#define SMSC47M1_SYSCTL_FAN3 1103 #define SMSC47M1_SYSCTL_PWM1 1401 #define SMSC47M1_SYSCTL_PWM2 1402 +#define SMSC47M1_SYSCTL_PWM3 1403 #define SMSC47M1_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ #define SMSC47M1_SYSCTL_ALARMS 2004 /* bitvector */ #define SMSC47M1_ALARM_FAN1 0x0001 #define SMSC47M1_ALARM_FAN2 0x0002 +#define SMSC47M1_ALARM_FAN3 0x0004 /* -- SENSORS SYSCTL END -- */ @@ -198,6 +210,26 @@ static ctl_table smsc47m1_dir_table_template[] = { {0} }; +static ctl_table smsc47m2_dir_table_template[] = { + {SMSC47M1_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &smsc47m1_fan}, + {SMSC47M1_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &smsc47m1_fan}, + {SMSC47M1_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &smsc47m1_fan}, + {SMSC47M1_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &smsc47m1_fan_div}, + {SMSC47M1_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &smsc47m1_alarms}, + {SMSC47M1_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &smsc47m1_pwm}, + {SMSC47M1_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &smsc47m1_pwm}, + {SMSC47M1_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &smsc47m1_pwm}, + {0} +}; + static int smsc47m1_attach_adapter(struct i2c_adapter *adapter) { return i2c_detect(adapter, &addr_data, smsc47m1_detect); @@ -208,8 +240,8 @@ static int __init smsc47m1_find(int *address) u16 val; superio_enter(); - val= superio_inb(DEVID); - if (!SMSC_DEVID_MATCH(val)) { + devid = superio_inb(DEVID); + if (!SMSC_DEVID_MATCH(devid)) { superio_exit(); return -ENODEV; } @@ -237,8 +269,8 @@ int smsc47m1_detect(struct i2c_adapter *adapter, int address, struct i2c_client *new_client; struct smsc47m1_data *data; int err = 0; - const char *type_name = "smsc47m1"; - const char *client_name = "47M1xx chip"; + const char *type_name; + const char *client_name; if (!i2c_is_isa_adapter(adapter)) { return 0; @@ -263,9 +295,35 @@ int smsc47m1_detect(struct i2c_adapter *adapter, int address, return -ENOMEM; } + switch (devid) { + case 0x51: + kind = smsc47m1; + type_name = "smsc47m1"; + client_name = "LPC47B27x chip"; + break; + case 0x5F: + kind = smsc47m1; + type_name = "smsc47m1"; + client_name = "LPC47M14x chip"; + break; + case 0x60: + kind = smsc47m1; + type_name = "smsc47m1"; + client_name = "LPC47M192 chip"; + break; + case 0x6B: + kind = smsc47m2; + type_name = "smsc47m2"; + client_name = "LPC47M292 chip"; + break; + default: + kind = smsc47m1; + type_name = "smsc47m1"; + client_name = "LPC47M1xx chip"; + } + new_client = &data->client; new_client->addr = address; - init_MUTEX(&data->lock); new_client->data = data; new_client->adapter = adapter; new_client->driver = &smsc47m1_driver; @@ -273,6 +331,7 @@ int smsc47m1_detect(struct i2c_adapter *adapter, int address, request_region(address, SMSC_EXTENT, "smsc47m1-fans"); strcpy(new_client->name, client_name); + data->type = kind; data->valid = 0; init_MUTEX(&data->update_lock); @@ -281,7 +340,9 @@ int smsc47m1_detect(struct i2c_adapter *adapter, int address, if ((i = i2c_register_entry((struct i2c_client *) new_client, type_name, - smsc47m1_dir_table_template, + kind == smsc47m2 ? + smsc47m2_dir_table_template : + smsc47m1_dir_table_template, THIS_MODULE)) < 0) { err = i; goto ERROR4; @@ -318,47 +379,64 @@ static int smsc47m1_detach_client(struct i2c_client *client) return 0; } -static int smsc47m1_read_value(struct i2c_client *client, u8 reg) +static inline int smsc47m1_read_value(struct i2c_client *client, u8 reg) { - int res; - - down(&(((struct smsc47m1_data *) (client->data))->lock)); - res = inb_p(client->addr + reg); - up(&(((struct smsc47m1_data *) (client->data))->lock)); - return res; + return inb_p(client->addr + reg); } -static int smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value) +static inline void smsc47m1_write_value(struct i2c_client *client, u8 reg, + u8 value) { - down(&(((struct smsc47m1_data *) (client->data))->lock)); outb_p(value, client->addr + reg); - up(&(((struct smsc47m1_data *) (client->data))->lock)); - return 0; } static void smsc47m1_init_client(struct i2c_client *client) { - /* configure pins for tach function */ - smsc47m1_write_value(client, SMSC47M1_REG_TPIN1, 0x05); - smsc47m1_write_value(client, SMSC47M1_REG_TPIN2, 0x05); + struct smsc47m1_data *data = client->data; + u8 reg; + + switch (data->type) { + case smsc47m2: + /* For the new LPC47M292 chip, I prefer to play it safe and + only report the pin configuration */ + reg = smsc47m1_read_value(client, SMSC47M2_REG_TPIN1); + if ((reg & 0x0d) != 0x09) + printk(KERN_NOTICE "smsc47m1: GP35 not configured for " + "fan input, ignore fan1 values\n"); + reg = smsc47m1_read_value(client, SMSC47M2_REG_TPIN2); + if ((reg & 0x0d) != 0x09) + printk(KERN_NOTICE "smsc47m1: GP34 not configured for " + "fan input, ignore fan2 values\n"); + reg = smsc47m1_read_value(client, SMSC47M2_REG_TPIN3); + if ((reg & 0x0d) != 0x0d) + printk(KERN_NOTICE "smsc47m1: GP33 not configured for " + "fan input, ignore fan3 values\n"); + break; + default: + /* configure pins for tach function */ + smsc47m1_write_value(client, SMSC47M1_REG_TPIN1, 0x05); + smsc47m1_write_value(client, SMSC47M1_REG_TPIN2, 0x05); + } } static void smsc47m1_update_client(struct i2c_client *client) { struct smsc47m1_data *data = client->data; - int i; down(&data->update_lock); if ((jiffies - data->last_updated > HZ + HZ / 2) || (jiffies < data->last_updated) || !data->valid) { - for (i = 1; i <= 2; i++) { - data->fan[i - 1] = - smsc47m1_read_value(client, SMSC47M1_REG_FAN(i)); - data->fan_min[i - 1] = - smsc47m1_read_value(client, SMSC47M1_REG_FAN_MIN(i)); - data->pwm[i - 1] = - smsc47m1_read_value(client, SMSC47M1_REG_PWM(i)); + int i, fan_nr; + fan_nr = data->type == smsc47m2 ? 3 : 2; + + for (i = 0; i < fan_nr; i++) { + data->fan[i] = + smsc47m1_read_value(client, SMSC47M1_REG_FAN[i]); + data->fan_min[i] = + smsc47m1_read_value(client, SMSC47M1_REG_FAN_MIN[i]); + data->pwm[i] = + smsc47m1_read_value(client, SMSC47M1_REG_PWM[i]); } i = smsc47m1_read_value(client, SMSC47M1_REG_FANDIV); @@ -368,6 +446,18 @@ static void smsc47m1_update_client(struct i2c_client *client) smsc47m1_read_value(client, SMSC47M1_REG_ALARM1) >> 6; if(data->alarms) smsc47m1_write_value(client, SMSC47M1_REG_ALARM1, 0xc0); + + if (fan_nr >= 3) { + data->fan_div[2] = (smsc47m1_read_value(client, + SMSC47M2_REG_FANDIV3) >> 4) & 0x03; + data->alarms |= (smsc47m1_read_value(client, + SMSC47M2_REG_ALARM6) & 0x40) >> 4; + if (data->alarms & 0x04) + smsc47m1_write_value(client, + SMSC47M2_REG_ALARM6, + 0x40); + } + data->last_updated = jiffies; data->valid = 1; } @@ -380,26 +470,24 @@ void smsc47m1_fan(struct i2c_client *client, int operation, int ctl_name, int *nrels_mag, long *results) { struct smsc47m1_data *data = client->data; - int nr = ctl_name - SMSC47M1_SYSCTL_FAN1 + 1; + int nr = ctl_name - SMSC47M1_SYSCTL_FAN1; if (operation == SENSORS_PROC_REAL_INFO) *nrels_mag = 0; else if (operation == SENSORS_PROC_REAL_READ) { smsc47m1_update_client(client); - results[0] = MIN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - results[1] = FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1]), - data->fan_min[nr - 1]); + results[0] = MIN_FROM_REG(data->fan_min[nr], + DIV_FROM_REG(data->fan_div[nr])); + results[1] = FAN_FROM_REG(data->fan[nr], + DIV_FROM_REG(data->fan_div[nr]), + data->fan_min[nr]); *nrels_mag = 2; } else if (operation == SENSORS_PROC_REAL_WRITE) { if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = MIN_TO_REG(results[0], - DIV_FROM_REG - (data-> - fan_div[nr-1])); - smsc47m1_write_value(client, SMSC47M1_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); + data->fan_min[nr] = MIN_TO_REG(results[0], + DIV_FROM_REG(data->fan_div[nr])); + smsc47m1_write_value(client, SMSC47M1_REG_FAN_MIN[nr], + data->fan_min[nr]); } } } @@ -433,6 +521,13 @@ void smsc47m1_fan_div(struct i2c_client *client, int operation, *nrels_mag = 2; } else if (operation == SENSORS_PROC_REAL_WRITE) { old = smsc47m1_read_value(client, SMSC47M1_REG_FANDIV); + if (*nrels_mag >= 3 && data->type == smsc47m2) { + data->fan_div[2] = DIV_TO_REG(results[2]); + smsc47m1_write_value(client, SMSC47M2_REG_FANDIV3, + (smsc47m1_read_value(client, + SMSC47M2_REG_FANDIV3) & 0xcf) + | (data->fan_div[2] << 4)); + } if (*nrels_mag >= 2) { data->fan_div[1] = DIV_TO_REG(results[1]); old = (old & 0x3f) | (data->fan_div[1] << 6); @@ -449,31 +544,31 @@ void smsc47m1_pwm(struct i2c_client *client, int operation, int ctl_name, int *nrels_mag, long *results) { struct smsc47m1_data *data = client->data; - int nr = 1 + ctl_name - SMSC47M1_SYSCTL_PWM1; + int nr = ctl_name - SMSC47M1_SYSCTL_PWM1; if (operation == SENSORS_PROC_REAL_INFO) *nrels_mag = 0; else if (operation == SENSORS_PROC_REAL_READ) { smsc47m1_update_client(client); - results[0] = PWM_FROM_REG(data->pwm[nr - 1]); - results[1] = !(data->pwm[nr - 1] & 0x01); + results[0] = PWM_FROM_REG(data->pwm[nr]); + results[1] = !(data->pwm[nr] & 0x01); *nrels_mag = 2; } else if (operation == SENSORS_PROC_REAL_WRITE) { if (*nrels_mag >= 1) { - data->pwm[nr - 1] = smsc47m1_read_value(client, - SMSC47M1_REG_PWM(nr)) & 0x81; - data->pwm[nr - 1] |= PWM_TO_REG(results[0]); + data->pwm[nr] = smsc47m1_read_value(client, + SMSC47M1_REG_PWM[nr]) & 0x81; + data->pwm[nr] |= PWM_TO_REG(results[0]); if (*nrels_mag >= 2) { if (results[1]) { /* enable PWM */ - data->pwm[nr - 1] &= 0xfe; + data->pwm[nr] &= 0xfe; } else { /* disable PWM */ - data->pwm[nr - 1] |= 0x01; + data->pwm[nr] |= 0x01; } } - smsc47m1_write_value(client, SMSC47M1_REG_PWM(nr), - data->pwm[nr - 1]); + smsc47m1_write_value(client, SMSC47M1_REG_PWM[nr], + data->pwm[nr]); } } } diff --git a/kernel/chips/w83627hf.c b/kernel/chips/w83627hf.c index 4c69ded4..f4054615 100644 --- a/kernel/chips/w83627hf.c +++ b/kernel/chips/w83627hf.c @@ -281,8 +281,7 @@ static inline u8 DIV_TO_REG(long val) return ((u8) i); } -/* For each registered chip, we need to keep some data in memory. That - data is pointed to by w83627hf_list[NR]->data. The structure itself is +/* For each registered chip, we need to keep some data in memory. It is dynamically allocated, at the same time when a new client is allocated. */ struct w83627hf_data { struct i2c_client client; diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index 2f3d124e..73ceec28 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -246,8 +246,7 @@ static inline u8 DIV_TO_REG(long val, enum chips type) bad. Quite a lot of bookkeeping is done. A real driver can often cut some corners. */ -/* For each registered W83781D, we need to keep some data in memory. That - data is pointed to by w83781d_list[NR]->data. The structure itself is +/* For each registered W83781D, we need to keep some data in memory. It is dynamically allocated, at the same time when a new w83781d client is allocated. */ struct w83781d_data { diff --git a/lib/Module.mk b/lib/Module.mk index b053b385..dc51fb0a 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -33,7 +33,7 @@ LIBMAN5FILES := $(MODULE_DIR)/sensors.conf.5 # the public header files - in this case they are error.h, sensors.h, # chips.h. LIBMAINVER := 3 -LIBMINORVER := 1.2 +LIBMINORVER := 1.3 LIBVER := $(LIBMAINVER).$(LIBMINORVER) # The static lib name, the shared lib name, and the internal ('so') name of diff --git a/lib/chips.c b/lib/chips.c index 0d68c89e..8d78b28d 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -4664,6 +4664,34 @@ static sensors_chip_feature smsc47m1_features[] = { { 0 }, 0 } }; +static sensors_chip_feature smsc47m2_features[] = + { + { { SENSORS_SMSC47M1_FAN1, "fan1", NOMAP, NOMAP, R }, + SMSC47M1_SYSCTL_FAN1, VALUE(2), 0 }, + { { SENSORS_SMSC47M1_FAN2, "fan2", NOMAP, NOMAP, R }, + SMSC47M1_SYSCTL_FAN2, VALUE(2), 0 }, + { { SENSORS_SMSC47M1_FAN3, "fan3", NOMAP, NOMAP, R }, + SMSC47M1_SYSCTL_FAN3, VALUE(2), 0 }, + { { SENSORS_SMSC47M1_FAN1_MIN, "fan1_min", SENSORS_SMSC47M1_FAN1, + SENSORS_SMSC47M1_FAN1, RW }, + SMSC47M1_SYSCTL_FAN1, VALUE(1), 0 }, + { { SENSORS_SMSC47M1_FAN2_MIN, "fan2_min", SENSORS_SMSC47M1_FAN2, + SENSORS_SMSC47M1_FAN2, RW }, + SMSC47M1_SYSCTL_FAN2, VALUE(1), 0 }, + { { SENSORS_SMSC47M1_FAN3_MIN, "fan3_min", SENSORS_SMSC47M1_FAN3, + SENSORS_SMSC47M1_FAN3, RW }, + SMSC47M1_SYSCTL_FAN3, VALUE(1), 0 }, + { { SENSORS_SMSC47M1_FAN1_DIV, "fan1_div", SENSORS_SMSC47M1_FAN1, NOMAP, RW }, + SMSC47M1_SYSCTL_FAN_DIV, VALUE(1), 0 }, + { { SENSORS_SMSC47M1_FAN2_DIV, "fan2_div", SENSORS_SMSC47M1_FAN2, NOMAP, RW }, + SMSC47M1_SYSCTL_FAN_DIV, VALUE(2), 0 }, + { { SENSORS_SMSC47M1_FAN3_DIV, "fan3_div", SENSORS_SMSC47M1_FAN3, NOMAP, RW }, + SMSC47M1_SYSCTL_FAN_DIV, VALUE(3), 0 }, + { { SENSORS_SMSC47M1_ALARMS, "alarms", NOMAP, NOMAP, R }, + SMSC47M1_SYSCTL_ALARMS, VALUE(1), 0 }, + { { 0 }, 0 } + }; + static sensors_chip_feature smsc47m192_features[] = { { { SENSORS_SMSC47M192_IN(0), "in0", NOMAP, NOMAP, R }, @@ -5638,13 +5666,17 @@ static sensors_chip_feature max1619_features[] = MAX1619_SYSCTL_LOCAL_TEMP, VALUE(1), 0 }, { { SENSORS_MAX1619_REMOTE_TEMP, "temp2", NOMAP, NOMAP, R }, MAX1619_SYSCTL_REMOTE_TEMP, VALUE(3), 0 }, - { { SENSORS_MAX1619_REMOTE_HIGH, "temp2_min", NOMAP, NOMAP, RW }, - MAX1619_SYSCTL_REMOTE_TEMP, VALUE(2), 0 }, - { { SENSORS_MAX1619_REMOTE_LOW, "temp2_max", NOMAP, NOMAP, RW }, - MAX1619_SYSCTL_REMOTE_TEMP, VALUE(1), 0 }, - { { SENSORS_MAX1619_REMOTE_MAX, "temp2_crit", NOMAP, NOMAP, RW }, + { { SENSORS_MAX1619_REMOTE_LOW, "temp2_min", SENSORS_MAX1619_REMOTE_TEMP, + SENSORS_MAX1619_REMOTE_TEMP, RW }, + MAX1619_SYSCTL_REMOTE_TEMP, VALUE(2), 0 }, + { { SENSORS_MAX1619_REMOTE_HIGH, "temp2_max", SENSORS_MAX1619_REMOTE_TEMP, + SENSORS_MAX1619_REMOTE_TEMP, RW }, + MAX1619_SYSCTL_REMOTE_TEMP, VALUE(1), 0 }, + { { SENSORS_MAX1619_REMOTE_MAX, "temp2_crit", SENSORS_MAX1619_REMOTE_TEMP, + SENSORS_MAX1619_REMOTE_TEMP, RW }, MAX1619_SYSCTL_REMOTE_CRIT, VALUE(1), 0 }, - { { SENSORS_MAX1619_REMOTE_HYST, "temp2_hyst", NOMAP, NOMAP, RW }, + { { SENSORS_MAX1619_REMOTE_HYST, "temp2_hyst", SENSORS_MAX1619_REMOTE_TEMP, + SENSORS_MAX1619_REMOTE_TEMP, RW }, MAX1619_SYSCTL_REMOTE_CRIT, VALUE(2), 0, "temp2_crit_hyst", 3 }, { { SENSORS_MAX1619_ALARMS, "alarms", NOMAP, NOMAP, R }, @@ -5662,8 +5694,10 @@ static sensors_chip_feature max6650_features[] = MAX6650_SYSCTL_FAN3, VALUE(1), 0 }, { { SENSORS_MAX6650_FAN4_TACH, "fan4", NOMAP, NOMAP, R }, MAX6650_SYSCTL_FAN4, VALUE(1), 0 }, - { { SENSORS_MAX6650_SPEED, "speed", NOMAP, NOMAP, RW }, - MAX6650_SYSCTL_SPEED, VALUE(1), 0 }, + { { SENSORS_MAX6650_SPEED, "speed", SENSORS_MAX6650_FAN1_TACH, + SENSORS_MAX6650_FAN1_TACH, RW }, + MAX6650_SYSCTL_SPEED, VALUE(1), 0, + "fan1_target", 0 }, { { 0 }, 0 } }; @@ -5931,6 +5965,89 @@ static sensors_chip_feature coretemp_features[] = { { 0 }, 0 } }; +#define SENSORS_DME1737_IN_FEATURES(nr) \ + { { SENSORS_DME1737_IN(nr), "in" #nr, \ + NOMAP, NOMAP, R }, \ + NOSYSCTL, VALUE(3), 3 }, \ + { { SENSORS_DME1737_IN_MIN(nr), "in" #nr "_min", \ + SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \ + NOSYSCTL, VALUE(1), 3 }, \ + { { SENSORS_DME1737_IN_MAX(nr), "in" #nr "_max", \ + SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \ + NOSYSCTL, VALUE(2), 3 }, \ + { { SENSORS_DME1737_IN_ALARM(nr), "in" #nr "_alarm", \ + SENSORS_DME1737_IN(nr), NOMAP, R }, \ + NOSYSCTL, VALUE(1), 0 } + +#define SENSORS_DME1737_TEMP_FEATURES(nr) \ + { { SENSORS_DME1737_TEMP(nr), "temp" #nr, \ + NOMAP, NOMAP, R }, \ + NOSYSCTL, VALUE(3), 3 }, \ + { { SENSORS_DME1737_TEMP_MIN(nr), "temp" #nr "_min", \ + SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \ + NOSYSCTL, VALUE(2), 3 }, \ + { { SENSORS_DME1737_TEMP_MAX(nr), "temp" #nr "_max", \ + SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \ + NOSYSCTL, VALUE(1), 3 }, \ + { { SENSORS_DME1737_TEMP_ALARM(nr), "temp" #nr "_alarm", \ + SENSORS_DME1737_TEMP(nr), NOMAP, R }, \ + NOSYSCTL, VALUE(1), 0 }, \ + { { SENSORS_DME1737_TEMP_FAULT(nr), "temp" #nr "_fault", \ + SENSORS_DME1737_TEMP(nr), NOMAP, R }, \ + NOSYSCTL, VALUE(2), 0 } + +#define SENSORS_DME1737_FAN_FEATURES(nr) \ + { { SENSORS_DME1737_FAN(nr), "fan" #nr, \ + NOMAP, NOMAP, R }, \ + NOSYSCTL, VALUE(2), 0 }, \ + { { SENSORS_DME1737_FAN_MIN(nr), "fan" #nr "_min", \ + SENSORS_DME1737_FAN(nr), SENSORS_DME1737_FAN(nr), RW }, \ + NOSYSCTL, VALUE(1), 0 }, \ + { { SENSORS_DME1737_FAN_ALARM(nr), "fan" #nr "_alarm", \ + SENSORS_DME1737_FAN(nr), NOMAP, R }, \ + NOSYSCTL, VALUE(1), 0 } + +#define SENSORS_DME1737_PWM_FEATURES(nr) \ + { { SENSORS_DME1737_PWM(nr), "pwm" #nr, \ + NOMAP, NOMAP, RW }, \ + NOSYSCTL, VALUE(1), 0 }, \ + { { SENSORS_DME1737_PWM_ENABLE(nr), "pwm" #nr "_enable", \ + SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \ + NOSYSCTL, VALUE(2), 0 }, \ + { { SENSORS_DME1737_PWM_FREQ(nr), "pwm" #nr "_freq", \ + SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \ + NOSYSCTL, VALUE(3), 0 } + +static sensors_chip_feature dme1737_features[] = +{ + SENSORS_DME1737_IN_FEATURES(0), + SENSORS_DME1737_IN_FEATURES(1), + SENSORS_DME1737_IN_FEATURES(2), + SENSORS_DME1737_IN_FEATURES(3), + SENSORS_DME1737_IN_FEATURES(4), + SENSORS_DME1737_IN_FEATURES(5), + SENSORS_DME1737_IN_FEATURES(6), + SENSORS_DME1737_TEMP_FEATURES(1), + SENSORS_DME1737_TEMP_FEATURES(2), + SENSORS_DME1737_TEMP_FEATURES(3), + SENSORS_DME1737_FAN_FEATURES(1), + SENSORS_DME1737_FAN_FEATURES(2), + SENSORS_DME1737_FAN_FEATURES(3), + SENSORS_DME1737_FAN_FEATURES(4), + SENSORS_DME1737_FAN_FEATURES(5), + SENSORS_DME1737_FAN_FEATURES(6), + SENSORS_DME1737_PWM_FEATURES(1), + SENSORS_DME1737_PWM_FEATURES(2), + SENSORS_DME1737_PWM_FEATURES(3), + SENSORS_DME1737_PWM_FEATURES(5), + SENSORS_DME1737_PWM_FEATURES(6), + { { SENSORS_DME1737_VID, "cpu0_vid", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_DME1737_VRM, "vrm", NOMAP, NOMAP, RW }, + NOSYSCTL, VALUE(1), 1 }, + { { 0 }, 0 } +}; + sensors_chip_features sensors_chip_features_list[] = { { SENSORS_LM78_PREFIX, lm78_features }, @@ -6005,6 +6122,7 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_VT1211_PREFIX, vt1211_features }, { SENSORS_SMSC47M192_PREFIX, smsc47m192_features }, { SENSORS_SMSC47M1_PREFIX, smsc47m1_features }, + { SENSORS_SMSC47M2_PREFIX, smsc47m2_features }, { SENSORS_PC87360_PREFIX, pc87360_features }, { SENSORS_PC87363_PREFIX, pc87360_features }, { SENSORS_PC87364_PREFIX, pc87360_features }, @@ -6042,5 +6160,6 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_ABITUGURU_PREFIX, abituguru_features }, { SENSORS_K8TEMP_PREFIX, k8temp_features }, { SENSORS_CORETEMP_PREFIX, coretemp_features }, + { SENSORS_DME1737_PREFIX, dme1737_features }, { 0 } }; diff --git a/lib/chips.h b/lib/chips.h index 123753d4..e2d5cff1 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -1834,13 +1834,17 @@ #define SENSORS_VT1211_UCH 84 /* RW */ #define SENSORS_SMSC47M1_PREFIX "smsc47m1" +#define SENSORS_SMSC47M2_PREFIX "smsc47m2" #define SENSORS_SMSC47M1_FAN1 31 /* R */ #define SENSORS_SMSC47M1_FAN2 32 /* R */ +#define SENSORS_SMSC47M1_FAN3 33 /* R */ #define SENSORS_SMSC47M1_FAN1_MIN 41 /* RW */ #define SENSORS_SMSC47M1_FAN2_MIN 42 /* RW */ +#define SENSORS_SMSC47M1_FAN3_MIN 43 /* RW */ #define SENSORS_SMSC47M1_FAN1_DIV 75 /* RW */ #define SENSORS_SMSC47M1_FAN2_DIV 76 /* RW */ +#define SENSORS_SMSC47M1_FAN3_DIV 77 /* RW */ #define SENSORS_SMSC47M1_ALARMS 81 /* R */ #define SENSORS_SMSC47M192_PREFIX "smsc47m192" @@ -2258,4 +2262,34 @@ #define SENSORS_CORETEMP_TEMP1_CRIT 0x02 /* R */ #define SENSORS_CORETEMP_TEMP1_CRIT_ALARM 0x03 /* R */ +/* DME1737 */ + +#define SENSORS_DME1737_PREFIX "dme1737" + +/* in n from 0 to 6 */ +#define SENSORS_DME1737_IN(n) (0x01 + (n)) /* R */ +#define SENSORS_DME1737_IN_MIN(n) (0x11 + (n)) /* RW */ +#define SENSORS_DME1737_IN_MAX(n) (0x21 + (n)) /* RW */ +#define SENSORS_DME1737_IN_ALARM(n) (0x31 + (n)) /* R */ + +/* temp n from 1 to 3*/ +#define SENSORS_DME1737_TEMP(n) (0x41 + (n)) /* R */ +#define SENSORS_DME1737_TEMP_MIN(n) (0x51 + (n)) /* RW */ +#define SENSORS_DME1737_TEMP_MAX(n) (0x61 + (n)) /* RW */ +#define SENSORS_DME1737_TEMP_ALARM(n) (0x71 + (n)) /* R */ +#define SENSORS_DME1737_TEMP_FAULT(n) (0x81 + (n)) /* R */ + +/* fan n from 1 to 6 */ +#define SENSORS_DME1737_FAN(n) (0x91 + (n)) /* R */ +#define SENSORS_DME1737_FAN_MIN(n) (0xa1 + (n)) /* RW */ +#define SENSORS_DME1737_FAN_ALARM(n) (0xb1 + (n)) /* R */ + +/* pwm n from 1 to 3 and 5 to 6 */ +#define SENSORS_DME1737_PWM(n) (0xc1 + (n)) /* RW */ +#define SENSORS_DME1737_PWM_ENABLE(n) (0xd1 + (n)) /* RW */ +#define SENSORS_DME1737_PWM_FREQ(n) (0xe1 + (n)) /* RW */ + +#define SENSORS_DME1737_VID (0xf0) /* R */ +#define SENSORS_DME1737_VRM (0xf1) /* RW */ + #endif /* def LIB_SENSORS_CHIPS_H */ diff --git a/lib/proc.c b/lib/proc.c index a100fac4..3b1253ec 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -247,7 +247,7 @@ struct match { static const struct match matches[] = { { "beeps", "beep_mask", 0 }, - { "pwm", "fan1_pwm", 0 }, + { "pwm", "pwm1", 0, "fan1_pwm" }, { "vid", "cpu0_vid", INMAG, "in0_ref" }, { "remote_temp", "temp2_input", TEMPMAG }, { "remote_temp_hyst", "temp2_max_hyst", TEMPMAG }, @@ -259,14 +259,6 @@ static const struct match matches[] = { { "temp_over", "temp1_max", TEMPMAG }, { "temp_high", "temp1_max", TEMPMAG }, { "temp_crit", "temp1_crit", TEMPMAG }, - { "pwm1", "pwm1", 0, "fan1_pwm" }, - { "pwm2", "pwm2", 0, "fan2_pwm" }, - { "pwm3", "pwm3", 0, "fan3_pwm" }, - { "pwm4", "pwm4", 0, "fan4_pwm" }, - { "pwm1_enable", "pwm1_enable", 0, "fan1_pwm_enable" }, - { "pwm2_enable", "pwm2_enable", 0, "fan2_pwm_enable" }, - { "pwm3_enable", "pwm3_enable", 0, "fan3_pwm_enable" }, - { "pwm4_enable", "pwm4_enable", 0, "fan4_pwm_enable" }, { NULL, NULL } }; @@ -357,13 +349,15 @@ static int getsysname(const sensors_chip_feature *feature, char *sysname, return 0; } if(sscanf(name, "pwm%d%c", &num, &check) == 1) { - sprintf(sysname, "fan%d_pwm", num); + strcpy(sysname, name); *sysmag = 0; + sprintf(altsysname, "fan%d_pwm", num); return 0; } if(sscanf(name, "pwm%d_enabl%c%c", &num, &last, &check) == 2 && last == 'e') { - sprintf(sysname, "fan%d_pwm_enable", num); + strcpy(sysname, name); *sysmag = 0; + sprintf(altsysname, "fan%d_pwm_enable", num); return 0; } diff --git a/lib/sysfs.c b/lib/sysfs.c index b2d06683..bbb2b735 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -75,18 +75,23 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) if (sscanf(dev->name, "%d-%x", &entry.name.bus, &entry.name.addr) == 2) { /* find out if legacy ISA or not */ - snprintf(bus_path, sizeof(bus_path), + if (entry.name.bus == 9191) + entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; + else { + snprintf(bus_path, sizeof(bus_path), "%s/class/i2c-adapter/i2c-%d/device/name", sensors_sysfs_mount, entry.name.bus); - if ((bus_attr = sysfs_open_attribute(bus_path))) { - if (sysfs_read_attribute(bus_attr)) - return -SENSORS_ERR_PARSE; + if ((bus_attr = sysfs_open_attribute(bus_path))) { + if (sysfs_read_attribute(bus_attr)) + return -SENSORS_ERR_PARSE; - if (bus_attr->value && !strncmp(bus_attr->value, "ISA ", 4)) - entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; + if (bus_attr->value + && !strncmp(bus_attr->value, "ISA ", 4)) + entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; - sysfs_close_attribute(bus_attr); + sysfs_close_attribute(bus_attr); + } } } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &entry.name.addr) == 1) { /* must be new ISA (platform driver) */ @@ -195,13 +200,12 @@ int sensors_read_sysfs_bus(void) struct sysfs_device *dev; struct sysfs_attribute *attr; - if (!(dev = sysfs_get_classdev_device(clsdev))) - continue; /* Get the adapter name from the classdev "name" attribute * (Linux 2.6.20 and later). If it fails, fall back to * the device "name" attribute (for older kernels). */ if (!(attr = sysfs_get_classdev_attr(clsdev, "name")) - && !(attr = sysfs_get_device_attr(dev, "name"))) + && !((dev = sysfs_get_classdev_device(clsdev)) && + (attr = sysfs_get_device_attr(dev, "name")))) continue; /* NB: attr->value[attr->len-1] == '\n'; chop that off */ diff --git a/lm_sensors.lsm b/lm_sensors.lsm index d5fefc3d..13d37e4c 100644 --- a/lm_sensors.lsm +++ b/lm_sensors.lsm @@ -1,6 +1,6 @@ Begin3 Title: lm_sensors -Version: 2.10.2 +Version: 2.10.3 Entered-date: 29DEC98 Description: Hardware health monitoring package for Linux. It consists of kernel modules to access sensor chips and SMBus hardware, diff --git a/mkpatch/mkpatch.pl b/mkpatch/mkpatch.pl index adaf4cad..2ab14c71 100755 --- a/mkpatch/mkpatch.pl +++ b/mkpatch/mkpatch.pl @@ -224,9 +224,11 @@ Intel 82371AB PIIX4(E), ServerWorks OSB4, CSB5, CSB6, HT-1000 CONFIG_I2C_PIIX4 If you say yes to this option, support will be included for the Intel PIIX4, PIIX4E, 443MX, Serverworks OSB4, CSB5, CSB6 and - HT-1000, ATI IXP200, IXP300 and IXP400, and SMSC Victory66 mainboard - I2C interfaces. This can also be built as a module which can be - inserted and removed while the kernel is running. + HT-1000, ATI IXP200, IXP300, IXP400 and SB600, and SMSC Victory66 + mainboard SMBus interfaces. + + This can also be built as a module which can be inserted and removed + while the kernel is running. Nvidia Nforce2/3/4 based Mainboard CONFIG_I2C_NFORCE2 @@ -264,7 +266,7 @@ CONFIG_I2C_VIA be built as a module which can be inserted and removed while the kernel is running. -VIA Technologies, Inc. VT82C596, 596B, 686A/B, 8233, 8235, 8237R/A, 8251 +VIA Technologies, Inc. VT82C596/82C686/82xx and CX700 CONFIG_I2C_VIAPRO If you say yes to this option, support will be included for the VIA Technologies I2C adapter on these chips. For integrated sensors on the @@ -985,7 +987,7 @@ sub gen_drivers_i2c_Config_in dep_tristate ' SiS 645/961,645DX/961,735' CONFIG_I2C_SIS645 $CONFIG_I2C $CONFIG_HOTPLUG dep_tristate ' Savage 4' CONFIG_I2C_SAVAGE4 $CONFIG_I2C_ALGOBIT dep_tristate ' VIA Technologies, Inc. VT82C586B' CONFIG_I2C_VIA $CONFIG_I2C_ALGOBIT - dep_tristate ' VIA Technologies, Inc. VT596A/B, 686A/B, 8231, 8233, 8233A, 8235, 8237R/A, 8251' CONFIG_I2C_VIAPRO $CONFIG_I2C + dep_tristate ' VIA Technologies, Inc. VT82C596/82C686/82xx and CX700' CONFIG_I2C_VIAPRO $CONFIG_I2C dep_tristate ' Voodoo3 I2C interface' CONFIG_I2C_VOODOO3 $CONFIG_I2C_ALGOBIT dep_tristate ' Pseudo ISA adapter (for some hardware sensors)' CONFIG_I2C_ISA $CONFIG_I2C fi diff --git a/prog/detect/i2cdetect.8 b/prog/detect/i2cdetect.8 index c9a7ce43..806f4a3f 100644 --- a/prog/detect/i2cdetect.8 +++ b/prog/detect/i2cdetect.8 @@ -8,6 +8,7 @@ i2cdetect \- detect I2C chips .RI [ -a ] .RI [ -q | -r ] .I i2cbus +.RI [ "first last" ] .br .B i2cdetect .I -F @@ -24,6 +25,8 @@ i2cdetect is a userspace program to scan an I2C bus for devices. It outputs a table with the list of detected devices on the specified bus. \fIi2cbus\fR indicates the number of the I2C bus to be scanned, and should correspond to one of the busses listed by \fIi2cdetect -l\fR. +The optional parameters \fIfirst\fR and \fIlast\fR restrict the scanning +range (default: from 0x03 to 0x77). .PP i2cdetect can also be used to query the functionalities of an I2C bus (see option \fB-F\fP.) diff --git a/prog/detect/i2cdetect.c b/prog/detect/i2cdetect.c index c5e33e72..7bae2f8e 100644 --- a/prog/detect/i2cdetect.c +++ b/prog/detect/i2cdetect.c @@ -61,6 +61,8 @@ int scan_i2c_bus(int file, const int mode, const int first, const int last) for (i = 0; i < 128; i += 16) { printf("%02x: ", i); for(j = 0; j < 16; j++) { + fflush(stdout); + /* Skip unwanted addresses */ if (i+j < first || i+j > last) { printf(" "); diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 440ee6e3..9add80d7 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -47,7 +47,8 @@ $ENV{PATH} = '/usr/local/sbin:'.$ENV{PATH} # CONSTANT DECLARATIONS # ######################### -use vars qw(@pci_adapters @chip_ids @superio_ids @cpu_ids $revision); +use vars qw(@pci_adapters @chip_ids $i2c_addresses_to_scan @superio_ids + @cpu_ids $revision); $revision = '$Revision$ ($Date$)'; $revision =~ s/\$\w+: (.*?) \$/$1/g; @@ -245,6 +246,13 @@ $revision =~ s/ \([^()]*\)//; driver => "i2c-viapro", match => qr/^SMBus V(IA|ia) Pro adapter at/, } , + { + vendid => 0x1106, + devid => 0x8324, + procid => "VIA Technologies CX700 South Bridge", + driver => "i2c-viapro", + match => qr/^SMBus V(IA|ia) Pro adapter at/, + }, { vendid => 0x1039, devid => 0x5597, @@ -529,14 +537,14 @@ $revision =~ s/ \([^()]*\)//; vendid => 0x10de, devid => 0x03eb, procid => "nVidia Corporation nForce4 SMBus (MCP61)", - driver => "to-be-tested", + driver => "i2c-nforce2", match => qr/^SMBus nForce2 adapter at /, }, { vendid => 0x10de, devid => 0x0446, procid => "nVidia Corporation nForce4 SMBus (MCP65)", - driver => "to-be-tested", + driver => "i2c-nforce2", match => qr/^SMBus nForce2 adapter at /, }, { @@ -811,8 +819,14 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); name => "National Semiconductor LM75", driver => "lm75", i2c_addrs => [0x48..0x4f], - i2c_detect => sub { lm75_detect(@_); }, - } , + i2c_detect => sub { lm75_detect(0, @_); }, + }, + { + name => "Dallas Semiconductor DS75", + driver => "lm75", + i2c_addrs => [0x48..0x4f], + i2c_detect => sub { lm75_detect(1, @_); }, + }, { name => "National Semiconductor LM77", driver => "lm77", @@ -967,13 +981,10 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); }, { name => "Winbond W83627HF", - driver => "w83781d", - i2c_addrs => [0x20..0x2f], + driver => "use-isa-instead", + i2c_addrs => [0x28..0x2f], i2c_detect => sub { w83781d_detect(3, @_); }, - isa_addrs => [0x290], - isa_detect => sub { w83781d_isa_detect(3, @_); }, - alias_detect => sub { w83781d_alias_detect(3, @_); }, - } , + }, { name => "Winbond W83627EHF", driver => "use-isa-instead", @@ -1136,12 +1147,36 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], i2c_detect => sub { adm1021_detect(3, @_); }, }, + { + name => "Maxim MAX1668", + driver => "max1668", + i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], + i2c_detect => sub { max1668_detect(0, @_); }, + }, + { + name => "Maxim MAX1805", + driver => "max1668", + i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], + i2c_detect => sub { max1668_detect(1, @_); }, + }, + { + name => "Maxim MAX1989", + driver => "max1668", + i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], + i2c_detect => sub { max1668_detect(2, @_); }, + }, { name => "Maxim MAX6650/MAX6651", driver => "max6650", i2c_addrs => [0x1b,0x1f,0x48,0x4b], i2c_detect => sub { max6650_detect(0, @_); }, }, + { + name => "Maxim MAX6655/MAX6656", + driver => "max6655", + i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], + i2c_detect => sub { max6655_detect(0, @_); }, + }, { name => "TI THMC10", driver => "adm1021", @@ -1352,13 +1387,6 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x57], i2c_detect => sub { eeprom_detect(1, @_); }, }, -# Disabled by default (potentially dangerous) -# { -# name => "SPD EEPROM with Software Write-Protect", -# driver => "eeprom", -# i2c_addrs => [0x50..0x57], -# i2c_detect => sub { eeprom_detect(2, @_); }, -# }, { name => "EDID EEPROM", driver => "eeprom", @@ -1390,14 +1418,14 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_detect => sub { m5879_detect(@_); }, }, { - name => "SMSC LPC47M15x, LPC47M192 or LPC47M997", + name => "SMSC LPC47M15x/192/292/997", driver => "smsc47m192", i2c_addrs => [0x2c..0x2d], i2c_detect => sub { smsc47m192_detect(@_); }, }, { name => "SMSC DME1737", - driver => "to-be-written", + driver => "dme1737", i2c_addrs => [0x2c..0x2e], i2c_detect => sub { dme1737_detect(@_); }, }, @@ -1469,16 +1497,10 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); }, { name => "Maxim MAX6900", - driver => "to-be-written", + driver => "not-a-sensor", i2c_addrs => [0x50], i2c_detect => sub { max6900_detect(@_); }, }, - { - name => "SMBus 2.0 ARP-Capable Device", - driver => "not-a-sensor", - i2c_addrs => [0x61], - i2c_detect => sub { arp_detect(@_); }, - }, { name => "IPMI BMC KCS", driver => "bmcsensors", @@ -1536,6 +1558,8 @@ $chip_kern26_w83791d = { # Put in "not-a-sensor" if the chip doesn't have hardware monitoring # capabilities (listing such chips here removes the need of manual # lookup when people report them). +# Put in exactly "via-smbus-only" if this is a Super-I/O chip whose +# hardware monitoring registers can only be accessed via the SMBus. # devid: The device ID(s) we have to match (base device) # devid_mask (optional): Bitmask to apply before checking the device ID # logdev: The logical device containing the sensors @@ -1549,50 +1573,10 @@ $chip_kern26_w83791d = { # generic probing if we fail to recognize the chip. # enter: The password sequence to write to the address register # chips: Array of chips +# The order of families matters, because we stop as soon as one family +# succeeds. So we have to list families with shorter password sequences +# first. @superio_ids = ( - { - family => "ITE", - guess => 0x290, - enter => - { - 0x2e => [0x87, 0x01, 0x55, 0x55], - 0x4e => [0x87, 0x01, 0x55, 0xaa], - }, - chips => - [ - { - name => "ITE IT8702F Super IO Sensors", - driver => "to-be-written", - devid => 0x8702, - logdev => 0x04, - }, - { - name => "ITE IT8705F Super IO Sensors", - driver => "it87", - devid => 0x8705, - logdev => 0x04, - }, - { - name => "ITE IT8712F Super IO Sensors", - driver => "it87", - devid => 0x8712, - logdev => 0x04, - alias_detect => sub { ite_alias_detect(0, @_); }, - }, - { - name => "ITE IT8716F Super IO Sensors", - driver => "it87", - devid => 0x8716, - logdev => 0x04, - }, - { - name => "ITE IT8718F Super IO Sensors", - driver => "it87", - devid => 0x8718, - logdev => 0x04, - }, - ], - }, { family => "National Semiconductor", enter => @@ -1602,6 +1586,12 @@ $chip_kern26_w83791d = { }, chips => [ + { + name => "Nat. Semi. PC8374L Super IO Sensors", + driver => "to-be-written", + devid => 0xf1, + logdev => 0x08, + }, { name => "Nat. Semi. PC87351 Super IO Fan Sensors", driver => "to-be-written", @@ -1747,6 +1737,12 @@ $chip_kern26_w83791d = { devid => 0x60, logdev => 0x0a, }, + { + name => "SMSC LPC47M292 Super IO Fan Sensors", + driver => "smsc47m1", + devid => 0x6b, + logdev => 0x0a, + }, { name => "SMSC LPC47S42x Super IO Fan Sensors", driver => "to-be-written", @@ -1783,6 +1779,12 @@ $chip_kern26_w83791d = { devid => 0x81, logdev => 0x08, }, + { + name => "SMSC SCH5504-NS Super IO", + # No datasheet + driver => "not-a-sensor", + devid => 0x79, + }, { name => "SMSC LPC47M584-NC Super IO", # No datasheet @@ -1791,9 +1793,17 @@ $chip_kern26_w83791d = { { name => "SMSC DME1737 Super IO", # Hardware monitoring features are accessed on the SMBus - driver => "not-a-sensor", + driver => "via-smbus-only", devid => 0x78, }, + { + name => "SMSC DME1737 Super IO", + # The DME1737 shows up twice in this list because it can return either + # 0x78 or 0x77 as its device ID. + # Hardware monitoring features are accessed on the SMBus + driver => "via-smbus-only", + devid => 0x77, + }, ], }, { @@ -1818,6 +1828,7 @@ $chip_kern26_w83791d = { driver => "w83627hf", devid => 0x52, logdev => 0x0b, + alias_detect => sub { w83781d_alias_detect(3, @_); }, }, { name => "Winbond W83627THF Super IO Sensors", @@ -1903,6 +1914,49 @@ $chip_kern26_w83791d = { }, ], }, + { + family => "ITE", + guess => 0x290, + enter => + { + 0x2e => [0x87, 0x01, 0x55, 0x55], + 0x4e => [0x87, 0x01, 0x55, 0xaa], + }, + chips => + [ + { + name => "ITE IT8702F Super IO Sensors", + driver => "to-be-written", + devid => 0x8702, + logdev => 0x04, + }, + { + name => "ITE IT8705F Super IO Sensors", + driver => "it87", + devid => 0x8705, + logdev => 0x04, + }, + { + name => "ITE IT8712F Super IO Sensors", + driver => "it87", + devid => 0x8712, + logdev => 0x04, + alias_detect => sub { ite_alias_detect(0, @_); }, + }, + { + name => "ITE IT8716F Super IO Sensors", + driver => "it87", + devid => 0x8716, + logdev => 0x04, + }, + { + name => "ITE IT8718F Super IO Sensors", + driver => "it87", + devid => 0x8718, + logdev => 0x04, + }, + ], + }, ); # Drivers for CPU embedded sensors @@ -2477,6 +2531,7 @@ sub i2c_get_funcs($) sub i2c_set_slave_addr { my ($file,$addr) = @_; + $addr += 0; # Make sure it's a number not a string ioctl $file, IOCTL_I2C_SLAVE, $addr or return 0; return 1; } @@ -2819,6 +2874,30 @@ sub add_isa_to_chips_detected } } +# From the list of known I2C/SMBus devices, build a list of I2C addresses +# which are worth probing. There's no point in probing an address for which +# we don't know a single device, and probing some addresses has caused +# random trouble in the past. +sub i2c_addresses_to_scan() +{ + my @used; + my @addresses; + my $addr; + + foreach my $chip (@chip_ids) { + next unless defined $chip->{'i2c_addrs'}; + next if $chip->{'driver'} eq 'not-a-sensor'; + foreach $addr (@{$chip->{'i2c_addrs'}}) { + $used[$addr]++; + } + } + + for ($addr = 0x03; $addr <= 0x77; $addr++) { + push @addresses, $addr if $used[$addr]; + } + return \@addresses; +} + # $_[0]: The number of the adapter to scan # $_[1]: The name of the adapter, as appearing in /proc/bus/i2c # $_[2]: The driver of the adapter @@ -2851,7 +2930,7 @@ sub scan_adapter } # Now scan each address in turn - foreach $addr (0x03..0x77) { + foreach $addr (@{$i2c_addresses_to_scan}) { # As the not_to_scan list is sorted, we can check it fast if (@not_to_scan and $not_to_scan[0] == $addr) { shift @not_to_scan; @@ -2900,6 +2979,7 @@ sub scan_adapter next unless i2c_probe(\*FILE, $addr, $funcs); printf "Client found at address 0x%02x\n",$addr; + $| = 1; foreach $chip (@chip_ids) { if (exists $chip->{i2c_addrs} and contains $addr, @{$chip->{i2c_addrs}}) { printf("\%-60s", sprintf("Probing for `\%s'... ", $chip->{name})); @@ -2931,12 +3011,14 @@ sub scan_adapter } } } + $| = 0; } } sub scan_isa_bus { my ($chip,$addr,$conf); + $| = 1; foreach $chip (@chip_ids) { next if not exists $chip->{isa_addrs} or not exists $chip->{isa_detect}; foreach $addr (@{$chip->{isa_addrs}}) { @@ -2958,6 +3040,7 @@ sub scan_isa_bus } } } + $| = 0; } use vars qw(%superio); @@ -3037,6 +3120,10 @@ sub probe_superio($$$) print "\n (no hardware monitoring capabilities)\n"; return; } + if ($chip->{driver} eq "via-smbus-only") { + print "\n (hardware monitoring capabilities accessible via SMBus only)\n"; + return; + } # Switch to the sensor logical device outb($addrreg, $superio{logdevreg}); @@ -3076,6 +3163,9 @@ sub scan_superio printf("Probing for Super-I/O at 0x\%x/0x\%x\n", $addrreg, $datareg); + $| = 1; +# reset state to avoid false positives + exit_superio($addrreg, $datareg); FAMILY: foreach my $family (@superio_ids) { printf("\%-60s", "Trying family `$family->{family}'... "); @@ -3099,7 +3189,7 @@ sub scan_superio if (($chip->{devid} > 0xff && ($val & ($chip->{devid_mask} || 0xffff)) == $chip->{devid}) || ($chip->{devid} <= 0xff && ($val >> 8) == $chip->{devid})) { probe_superio($addrreg, $datareg, $chip); - $found++; + $found++; } } @@ -3111,7 +3201,9 @@ sub scan_superio } exit_superio($addrreg, $datareg); + last FAMILY; } + $| = 0; } @@ -3170,7 +3262,6 @@ sub chip_special_cases # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, (7) if detected. # Registers used: 0x58 @@ -3183,7 +3274,6 @@ sub mtp008_detect # $_[0]: Chip to detect (0 = LM78, 1 = LM78-J, 2 = LM79) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, (6) if detected. # Registers used: @@ -3216,8 +3306,8 @@ sub lm78_isa_detect return if inb ($addr + 2) != $val or inb ($addr + 3) != $val or inb ($addr + 7) != $val; - $val = inb($addr + 5) & 0x7f; - outb($addr + 5, ~$val & 0xff); + $val = inb($addr + 5); + outb($addr + 5, ~$val & 0x7f); if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) { outb($addr+5,$val); return; @@ -3229,11 +3319,11 @@ sub lm78_isa_detect ($chip == 1 and $reg == 0x40) or ($chip == 2 and ($reg & 0xfe) == 0xc0); - # Explicitely prevent misdetection of Winbond chips + # Explicitly prevent misdetection of Winbond chips $reg = &$readproc(0x4f); return if $reg == 0xa3 || $reg == 0x5c; - # Explicitely prevent misdetection of ITE chips + # Explicitly prevent misdetection of ITE chips $reg = &$readproc(0x58); return if $reg == 0x90; @@ -3257,9 +3347,9 @@ sub lm78_alias_detect return 1; } -# $_[0]: A reference to the file descriptor to access this chip. -# We assume an i2c_set_slave_addr was already done. -# $_[1]: Address +# $_[0]: Chip to detect (0 = LM75, 1 = DS75) +# $_[1]: A reference to the file descriptor to access this chip. +# $_[2]: Address (unused) # Returns: undef if not detected, 3 or 6 if detected; # 6 means that the temperatures make sense; # 3 means that the temperatures look strange; @@ -3275,52 +3365,45 @@ sub lm78_alias_detect # real registers and will always return the last returned value. This isn't # documented. # Note that register 0x00 may change, so we can't use the modulo trick on it. +# The DS75 is a bit different, it doesn't cycle over 8-byte boundaries, and +# all register addresses from 0x04 to 0x0f behave like 0x04-0x07 do for +# the LM75. sub lm75_detect { my $i; - my ($file,$addr) = @_; + my ($chip, $file, $addr) = @_; my $cur = i2c_smbus_read_word_data($file,0x00); - my $cur_varies = 0; my $conf = i2c_smbus_read_byte_data($file,0x01); my $hyst = i2c_smbus_read_word_data($file,0x02); - return if i2c_smbus_read_word_data($file,0x04) != $hyst; - return if i2c_smbus_read_word_data($file,0x05) != $hyst; - return if i2c_smbus_read_word_data($file,0x06) != $hyst; - return if i2c_smbus_read_word_data($file,0x07) != $hyst; + my $maxreg = $chip == 1 ? 0x0f : 0x07; + for $i (0x04 .. $maxreg) { + return if i2c_smbus_read_word_data($file, $i) != $hyst; + } my $os = i2c_smbus_read_word_data($file,0x03); - return if i2c_smbus_read_word_data($file,0x04) != $os; - return if i2c_smbus_read_word_data($file,0x05) != $os; - return if i2c_smbus_read_word_data($file,0x06) != $os; - return if i2c_smbus_read_word_data($file,0x07) != $os; + for $i (0x04 .. $maxreg) { + return if i2c_smbus_read_word_data($file, $i) != $os; + } - for ($i = 0x00; $i < 0xff; $i += 8) { - return if i2c_smbus_read_byte_data($file, $i + 0x01) != $conf; - return if i2c_smbus_read_word_data($file, $i + 0x02) != $hyst; - return if i2c_smbus_read_word_data($file, $i + 0x04) != $hyst; - return if i2c_smbus_read_word_data($file, $i + 0x05) != $hyst; - return if i2c_smbus_read_word_data($file, $i + 0x06) != $hyst; - return if i2c_smbus_read_word_data($file, $i + 0x07) != $hyst; - return if i2c_smbus_read_word_data($file, $i + 0x03) != $os; - return if i2c_smbus_read_word_data($file, $i + 0x04) != $os; - return if i2c_smbus_read_word_data($file, $i + 0x05) != $os; - return if i2c_smbus_read_word_data($file, $i + 0x06) != $os; - return if i2c_smbus_read_word_data($file, $i + 0x07) != $os; - $cur_varies = 1 - if (! $cur_varies) and - i2c_smbus_read_word_data($file, $i) != $cur; + if ($chip == 0) { + for ($i = 8; $i <= 248; $i += 40) { + return if i2c_smbus_read_byte_data($file, $i + 0x01) != $conf + or i2c_smbus_read_word_data($file, $i + 0x02) != $hyst + or i2c_smbus_read_word_data($file, $i + 0x03) != $os; + } } # All registers hold the same value, obviously a misdetection - return if (! $cur_varies) and $conf == ($cur & 0xff) and $cur == $hyst + return if $conf == ($cur & 0xff) and $cur == $hyst and $cur == $os; $cur = swap_bytes($cur); $hyst = swap_bytes($hyst); $os = swap_bytes($os); # Unused bits - return if ($conf & 0xe0); + return if $chip == 0 and ($conf & 0xe0); + return if $chip == 1 and ($conf & 0x80); $cur = $cur >> 8; $hyst = $hyst >> 8; @@ -3332,7 +3415,6 @@ sub lm75_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, 3 or 6 if detected; # 6 means that the temperatures make sense; @@ -3356,7 +3438,6 @@ sub lm77_detect my $i; my ($file,$addr) = @_; my $cur = i2c_smbus_read_word_data($file,0x00); - my $cur_varies = 0; my $conf = i2c_smbus_read_byte_data($file,0x01); my $hyst = i2c_smbus_read_word_data($file,0x02); my $os = i2c_smbus_read_word_data($file,0x03); @@ -3369,23 +3450,16 @@ sub lm77_detect return if i2c_smbus_read_word_data($file,0x06) != $high; return if i2c_smbus_read_word_data($file,0x07) != $high; - for ($i = 0x00; $i < 0xff; $i += 8) { + for ($i = 8; $i <= 248; $i += 40) { return if i2c_smbus_read_byte_data($file, $i + 0x01) != $conf; return if i2c_smbus_read_word_data($file, $i + 0x02) != $hyst; return if i2c_smbus_read_word_data($file, $i + 0x03) != $os; return if i2c_smbus_read_word_data($file, $i + 0x04) != $low; - return if i2c_smbus_read_word_data($file, $i + 0x06) != $low; - return if i2c_smbus_read_word_data($file, $i + 0x07) != $low; return if i2c_smbus_read_word_data($file, $i + 0x05) != $high; - return if i2c_smbus_read_word_data($file, $i + 0x06) != $high; - return if i2c_smbus_read_word_data($file, $i + 0x07) != $high; - $cur_varies = 1 - if (! $cur_varies) and - i2c_smbus_read_word_data($file, $i) != $cur; } # All registers hold the same value, obviously a misdetection - return if (! $cur_varies) and $conf == ($cur & 0xff) and $cur == $hyst + return if $conf == ($cur & 0xff) and $cur == $hyst and $cur == $os and $cur == $low and $cur == $high; $cur = swap_bytes($cur); @@ -3415,7 +3489,6 @@ sub lm77_detect # $_[0]: Chip to detect (0 = LM92, 1 = LM76, 2 = MAX6633/MAX6634/MAX6635) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, 2 or 4 if detected; # Registers used: @@ -3465,7 +3538,6 @@ sub lm92_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, 3 if detected # Registers used: @@ -3492,7 +3564,6 @@ sub ds1621_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, 1 to 3 if detected. # Registers used: @@ -3555,7 +3626,6 @@ sub lm80_detect # $_[0]: Chip to detect # (0 = LM82/LM83) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, 4 to 8 if detected. # Registers used: @@ -3597,7 +3667,6 @@ sub lm83_detect # (0 = LM90, 1=LM89/LM99, 2=LM86, 3=ADM1032, 4=MAX6657/MAX6658/MAX6659, # 5 = ADT7461, 6 = MAX6648/MAX6692) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, 4, 6 or 8 if detected. # The Maxim chips have a low confidence value (4) @@ -3670,7 +3739,6 @@ sub lm90_detect # $_[0]: Chip to detect # (1 = LM63, 2 = F75363SG) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address (unused) # Returns: undef if not detected, 8 if detected. # Registers used: @@ -3751,7 +3819,6 @@ sub adm1029_detect # $_[0]: Chip to detect # (0 = ADM1030, 1=ADM1031) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, 3 to 7 (ADM1031) or 9 (ADM1030) # if detected. @@ -3837,7 +3904,6 @@ sub adm1034_detect # (0 = ADT7467/ADT7468, 1 = ADT7476, 2 = ADT7462, 3 = ADT7466, # 4 = ADT7470) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, 5 or 7 if detected. # Registers used: @@ -4005,7 +4071,6 @@ sub lm85_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, (7) if detected. # Registers used: 0x3E, 0x3F @@ -4023,7 +4088,6 @@ sub lm87_detect # 5 = AS99127F (rev.2), 6 = ASB100, 7 = W83791D, # 8 = W83792D, 9 = W83627EHF 10 = W83627DHG) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, (8,addr1,addr2) if detected, but only # if the LM75 chip emulation is enabled. @@ -4122,7 +4186,6 @@ sub w83793_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, 3 if detected # Registers used: @@ -4196,7 +4259,7 @@ sub w83781d_alias_detect return 1; } -# $_[0]: Chip to detect (0 = W83781D, 1 = W83782D, 3 = W83627HF) +# $_[0]: Chip to detect (0 = W83781D, 1 = W83782D) # $_[1]: Address # Returns: undef if not detected, (8) if detected. sub w83781d_isa_detect @@ -4207,8 +4270,8 @@ sub w83781d_isa_detect return if inb ($addr + 2) != $val or inb ($addr + 3) != $val or inb ($addr + 7) != $val; - $val = inb($addr + 5) & 0x7f; - outb($addr+5, ~$val & 0xff); + $val = inb($addr + 5); + outb($addr+5, ~$val & 0x7f); if ((inb ($addr+5) & 0x7f) != (~ $val & 0x7f)) { outb($addr+5,$val); return; @@ -4223,14 +4286,12 @@ sub w83781d_isa_detect $reg1 = &$read_proc(0x58); return if $chip == 0 and ($reg1 & 0xfe) != 0x10; return if $chip == 1 and ($reg1 & 0xfe) != 0x30; - return if $chip == 3 and ($reg1 & 0xfe) != 0x20; return 8; } # $_[0]: Chip to detect (0 = Revision 0x00, 1 = Revision 0x80) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, (6) if detected. # Registers used: @@ -4251,7 +4312,6 @@ sub gl518sm_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, (5) if detected. # Registers used: @@ -4270,7 +4330,6 @@ sub gl520sm_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, (5) if detected. # Registers used: @@ -4285,7 +4344,6 @@ sub gl525sm_detect # $_[0]: Chip to detect (0 = ADM9240, 1 = DS1780, 2 = LM81) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, (7) if detected. # Registers used: @@ -4309,7 +4367,6 @@ sub adm9240_detect # $_[0]: Chip to detect (0 = ADM1022, 1 = THMC50, 2 = ADM1028) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, (8) if detected. # Registers used: @@ -4326,16 +4383,15 @@ sub adm1022_detect ($chip == 1 and $reg == 0x49) or ($chip == 2 and $reg == 0x41); return unless (i2c_smbus_read_byte_data($file,0x40) & 0x80) == 0x00; - $reg = i2c_smbus_read_byte_data($file, 0x3f); - return unless ($reg & 0xc0) == 0xc0; - return if $chip == 0 and ($reg & 0xc0) != 0xc0; - return if $chip == 2 and ($reg & 0xc0) == 0xc0; + $reg = i2c_smbus_read_byte_data($file, 0x3f) & 0xf0; + return unless ($chip == 0 and $reg == 0xc0) or + ($chip == 1 and $reg == 0xc0) or + ($chip == 2 and $reg == 0xd0); return (8); } # $_[0]: Chip to detect (0 = ADM1025, 1 = NE1619) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, (8) if detected. # Registers used: @@ -4364,7 +4420,6 @@ sub adm1025_detect # $_[0]: Chip to detect (0 = ADM1026) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, (8) if detected. # Registers used: @@ -4382,7 +4437,6 @@ sub adm1026_detect # $_[0]: Chip to detect (0 = ADM1024) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, (8) if detected. # Registers used: @@ -4404,7 +4458,6 @@ sub adm1024_detect # (0 = ADM1021, 1 = ADM1021A/ADM1023, 2 = MAX1617, 3 = MAX1617A, 4 = THMC10, # 5 = LM84, 6 = GL523, 7 = 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 # Returns: undef if not detected, 3 if simply detected, 5 if detected and # manufacturer ID matches, 7 if detected and manufacturer ID and @@ -4489,7 +4542,7 @@ sub adm1021_detect } # $_[0]: Chip to detect -# (0 = MAX1619) +# (0 = MAX1668, 1 = MAX1805, 2 = MAX1989) # $_[1]: A reference to the file descriptor to access this chip. # We may assume an i2c_set_slave_addr was already done. # $_[2]: Address @@ -4497,6 +4550,28 @@ sub adm1021_detect # Registers used: # 0xfe: Company ID # 0xff: Device ID +sub max1668_detect +{ + my ($chip, $file, $addr) = @_; + my $man_id = i2c_smbus_read_byte_data($file, 0xfe); + my $dev_id = i2c_smbus_read_byte_data($file, 0xff); + + return if $man_id != 0x4d; + return if $chip == 0 and $dev_id != 0x03; + return if $chip == 1 and $dev_id != 0x05; + return if $chip == 2 and $dev_id != 0x0b; + + return 7; +} + +# $_[0]: Chip to detect +# (0 = MAX1619) +# $_[1]: A reference to the file descriptor to access this chip. +# $_[2]: Address +# Returns: undef if not detected, 7 if detected +# Registers used: +# 0xfe: Company ID +# 0xff: Device ID # 0x02: Status # 0x03: Configuration # 0x04: Conversion rate @@ -4540,7 +4615,6 @@ sub ite_overclock_detect # $_[0]: Chip to detect (0 = IT8712F) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, 7 or 8 if detected (tops LM78). # Registers used: @@ -4578,13 +4652,11 @@ sub ite_alias_detect return 1; } -# $_[0]: Chip to detect (0 = SPD EEPROM, 1 = Sony Vaio EEPROM, -# 2 = SPD EEPROM with Software Write Protect) +# $_[0]: Chip to detect (0 = SPD EEPROM, 1 = Sony Vaio EEPROM) # $_[1]: A reference to the file descriptor to access this chip # $_[2]: Address -# Returns: 8 for a memory eeprom (9 if write-protect register found), -# 4 to 9 for a Sony Vaio eeprom, -# 1 for an unknown eeprom (2 if write-protect register found) +# Returns: 8 for a memory eeprom +# 4 to 9 for a Sony Vaio eeprom # Registers used: # 0-63: SPD Data and Checksum # 0x80-0x83: Sony Vaio Data ("PCG-") @@ -4598,34 +4670,14 @@ sub eeprom_detect my $checksum = 0; # Check the checksum for validity (works for most DIMMs and RIMMs) - if ($chip != 1) { - for (my $i = 0; $i <= 62; $i ++) { - $checksum += i2c_smbus_read_byte_data($file,$i); - } - $checksum &= 255; - $checksum -= i2c_smbus_read_byte_data($file,63); - } if ($chip == 0) { - if($checksum == 0) { - return 8; - } else { - return 1; + for (my $i = 0; $i <= 62; $i++) { + $checksum += i2c_smbus_read_byte_data($file, $i); } - } - if ($chip == 2) { - # check for 'shadow' write-protect register at 0x30-0x37 - # could be dangerous - i2c_set_slave_addr($file,$addr - 0x20); - if(i2c_smbus_write_quick($file, SMBUS_WRITE) >= 0 && - i2c_smbus_read_byte_data($file,0x80) == -1) { - i2c_set_slave_addr($file,$addr); - if($checksum == 0) { - return (9, $addr - 0x20); - } else { - return (2, $addr - 0x20); - } - } - i2c_set_slave_addr($file,$addr); + $checksum &= 255; + + return 8 + if $checksum == i2c_smbus_read_byte_data($file, 63); return; } @@ -4656,17 +4708,13 @@ sub eeprom_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address -# Returns: undef if not detected, (1) if detected. +# Returns: undef if not detected, 8 if detected. # Registers used: # 0x00..0x07: DDC signature -# 0x08..0x7E: checksumed area -# 0x7F: checksum sub ddcmonitor_detect { my ($file,$addr) = @_; - my $i; return unless i2c_smbus_read_byte_data($file,0x00) == 0x00 and @@ -4678,21 +4726,10 @@ sub ddcmonitor_detect i2c_smbus_read_byte_data($file,0x06) == 0xFF and i2c_smbus_read_byte_data($file,0x07) == 0x00; - # Check the checksum for validity. - my $checksum = 0; - for ($i = 0; $i <= 127; $i = $i + 1) { - $checksum = $checksum + i2c_smbus_read_byte_data($file,$i); - } - $checksum=$checksum & 255; - if ($checksum != 0) { - # I have one such monitor... - return (2,$addr+1,$addr+2,$addr+3,$addr+4,$addr+5,$addr+6,$addr+7); - } return (8,$addr+1,$addr+2,$addr+3,$addr+4,$addr+5,$addr+6,$addr+7); } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, (8) if detected. # Registers used: @@ -4714,7 +4751,6 @@ sub fscpos_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, (8) if detected. # Registers used: @@ -4736,7 +4772,6 @@ sub fscscy_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, (8) if detected. # Registers used: @@ -4758,7 +4793,6 @@ sub fscher_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We assume an i2c_set_slave_addr was already done. # $_[1]: Address (unused) # Returns: undef if not detected, 5 if detected. # Registers used: @@ -4773,7 +4807,6 @@ sub lm93_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, (7) if detected. # Registers used: @@ -4803,7 +4836,6 @@ sub m5879_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, 5 or 6 if detected. # Registers used: @@ -4822,23 +4854,20 @@ sub smsc47m192_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, 5 or 6 if detected. # Registers used: # 0x3E: Manufacturer ID # 0x3F: Version/Stepping -# 0x40: Configuration (2 reserved bits) -# 0x42: Interrupt Status 2 (1 reserved bit) -# 0x43: VID (2 reserved bits) +# 0x73: Read-only test register (4 test bits) +# 0x8A: Read-only test register (7 test bits) sub dme1737_detect { my ($file, $addr) = @_; - return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x55 + return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x5c and (i2c_smbus_read_byte_data($file, 0x3F) & 0xF8) == 0x88 - and (i2c_smbus_read_byte_data($file, 0x40) & 0xC4) == 0x04 - and (i2c_smbus_read_byte_data($file, 0x42) & 0x02) == 0x00 - and (i2c_smbus_read_byte_data($file, 0x43) & 0xC0) == 0x00; + and (i2c_smbus_read_byte_data($file, 0x73) & 0x0F) == 0x09 + and (i2c_smbus_read_byte_data($file, 0x8A) & 0x7F) == 0x4D; return ($addr == 0x2e ? 6 : 5); } @@ -4847,7 +4876,6 @@ sub dme1737_detect # 4 = F75375S/SP, 5 = F75387SG/RG, 6 = F75383M/S/F75384M/S, # 7 = custom power control IC) # $_[1]: A reference to the file descriptor to access this chip. -# We assume an i2c_set_slave_addr was already done. # $_[2]: Address (unused) # Returns: undef if not detected, 7 if detected. # Registers used: @@ -4884,7 +4912,6 @@ sub fintek_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, 4 or 7 if detected # Detection is based on the fact that the SAA1064 has only one readable @@ -4907,7 +4934,6 @@ sub saa1064_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, 1 if detected # Detection is rather difficult, since the PCA9540 has a single register. @@ -4926,7 +4952,6 @@ sub pca9540_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We assume an i2c_set_slave_addr was already done. # $_[1]: Address (unused) # Returns: undef if not detected, 1 if detected # Detection is rather difficult, since the PCA9556 only has 4 registers @@ -4955,7 +4980,6 @@ sub pca9556_detect } # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: undef if not detected, 3 if detected sub max6900_detect @@ -5021,23 +5045,10 @@ sub max6900_detect return 3; } -# $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. -# $_[1]: Address -# Returns: 1 -# This is a placeholder so we get a report if any device responds -# to the SMBus Device Default Address (0x61), which is used for -# ARP in SMBus 2.0. -sub arp_detect -{ - return (1); -} - # This checks for non-FFFF values for SpecInfo and Status. # The address (0x09) is specified by the SMBus standard so it's likely # that this really is a smart battery charger. # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: 5 sub smartbatt_chgr_detect @@ -5057,7 +5068,6 @@ sub smartbatt_chgr_detect # The address (0x0a) is specified by the SMBus standard so it's likely # that this really is a smart battery manager/selector. # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: 5 sub smartbatt_mgr_detect @@ -5077,7 +5087,6 @@ sub smartbatt_mgr_detect # The address (0x0b) is specified by the SMBus standard so it's likely # that this really is a smart battery. # $_[0]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[1]: Address # Returns: 5 sub smartbatt_detect @@ -5152,7 +5161,6 @@ sub w83l784r_detect # $_[0]: Chip to detect (0 = W83L785TS-S) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, 8 if detected # Registers used: @@ -5171,7 +5179,6 @@ sub w83l785ts_detect # $_[0]: Chip to detect. Always zero for now, but available for future use # if somebody finds a way to distinguish MAX6650 and MAX6651. # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # Returns: undef if not detected, 4 if detected. # @@ -5203,9 +5210,30 @@ sub max6650_detect return 4; } +# $_[0]: Chip to detect. Always zero. +# $_[1]: A reference to the file descriptor to access this chip. +# $_[2]: Address. +# +# Returns: undef if not detected, 6 if detected. +sub max6655_detect +{ + my ($chip, $file, $addr) = @_; + + # checking RDID (Device ID) + return unless i2c_smbus_read_byte_data($file, 0xfe) == 0x0a; + # checking RDRV (Manufacturer ID) + return unless i2c_smbus_read_byte_data($file, 0xff) == 0x4d; + # checking unused bits (conversion rate, extended temperature) + return unless i2c_smbus_read_byte_data($file, 0x04) & 0xf8; + return unless i2c_smbus_read_byte_data($file, 0x10) & 0x1f; + return unless i2c_smbus_read_byte_data($file, 0x11) & 0x1f; + return unless i2c_smbus_read_byte_data($file, 0x12) & 0x1f; + + return 6; +} + # $_[0]: Chip to detect (0 = VT1211) # $_[1]: A reference to the file descriptor to access this chip. -# We may assume an i2c_set_slave_addr was already done. # $_[2]: Address # # This isn't very good detection. @@ -5581,6 +5609,7 @@ sub main # Before looking for chips, make sure any special case chips are # added to the chip_ids list chip_special_cases(); + $i2c_addresses_to_scan = i2c_addresses_to_scan(); print "We are now going to do the I2C/SMBus adapter probings. Some chips may\n", "be double detected; we choose the one with the highest confidence\n", @@ -5641,9 +5670,11 @@ sub main print "Some CPUs or memory controllers may also contain embedded sensors.\n"; print "Do you want to scan for them? (YES/no): "; unless ( =~ /^\s*n/i) { + $| = 1; foreach my $entry (@cpu_ids) { scan_cpu($entry); } + $| = 0; } print "\n"; diff --git a/prog/dump/i2cdump.c b/prog/dump/i2cdump.c index e46943c2..ddcb65cd 100644 --- a/prog/dump/i2cdump.c +++ b/prog/dump/i2cdump.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) int bank = 0, bankreg = 0x4E, old_bank = 0; char filename[20]; unsigned long funcs; - int block[256]; + int block[256], s_length = 0; int pec = 0, even = 0; int flags = 0; int yes = 0, version = 0; @@ -310,6 +310,9 @@ int main(int argc, char *argv[]) if (size == I2C_SMBUS_BLOCK_DATA) { res = i2c_smbus_read_block_data(file, bank, cblock); + /* Remember returned block length for a nicer + display later */ + s_length = res; } else { for (res = 0; res < 256; res += i) { i = i2c_smbus_read_i2c_block_data(file, @@ -327,8 +330,9 @@ int main(int argc, char *argv[]) res = 256; for (i = 0; i < res; i++) block[i] = cblock[i]; - for (i = res; i < 256; i++) - block[i] = -1; + if (size != I2C_SMBUS_BLOCK_DATA) + for (i = res; i < 256; i++) + block[i] = -1; } if (size == I2C_SMBUS_BYTE) { @@ -343,8 +347,11 @@ int main(int argc, char *argv[]) printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f" " 0123456789abcdef\n"); for (i = 0; i < 256; i+=16) { + if (size == I2C_SMBUS_BLOCK_DATA && i >= s_length) + break; printf("%02x: ", i); for (j = 0; j < 16; j++) { + fflush(stdout); if (size == I2C_SMBUS_BYTE_DATA) { block[i+j] = res = i2c_smbus_read_byte_data(file, i+j); @@ -364,7 +371,10 @@ int main(int argc, char *argv[]) } else res = block[i+j]; - if (res < 0) { + if (size == I2C_SMBUS_BLOCK_DATA + && i+j >= s_length) { + printf(" "); + } else if (res < 0) { printf("XX "); if (size == I2C_SMBUS_WORD_DATA) printf("XX "); @@ -377,7 +387,12 @@ int main(int argc, char *argv[]) j++; } printf(" "); + for (j = 0; j < 16; j++) { + if (size == I2C_SMBUS_BLOCK_DATA + && i+j >= s_length) + break; + res = block[i+j]; if (res < 0) printf("X"); @@ -393,8 +408,6 @@ int main(int argc, char *argv[]) printf("%c", res & 0xff); } printf("\n"); - if (size == I2C_SMBUS_BLOCK_DATA && i == 16) - break; } } else { printf(" 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f\n"); diff --git a/prog/dump/isadump.c b/prog/dump/isadump.c index 7a89abe6..5031e783 100644 --- a/prog/dump/isadump.c +++ b/prog/dump/isadump.c @@ -47,16 +47,6 @@ unsigned long isa_io_base = 0; /* XXX for now */ #endif /* __powerpc__ */ -char hexchar(int i) -{ - if ((i >= 0) && (i <= 9)) - return '0' + i; - else if (i <= 15) - return 'a' - 10 + i; - else - return 'X'; -} - void help(void) { fprintf(stderr, @@ -298,13 +288,18 @@ int main(int argc, char *argv[]) superio_write_key(addrreg, enter_key); for (j = 0; j < 16; j++) { + fflush(stdout); if (flat) { res = inb(addrreg + i + j); } else { outb(i+j, addrreg); + if (i+j == 0 && (inb(addrreg) & 0x80)) { + /* Bit 7 appears to be a busy flag */ + range = 128; + } res = inb(datareg); } - printf("%c%c ", hexchar(res/16), hexchar(res%16)); + printf("%02x ", res); } printf("\n"); } diff --git a/prog/pwm/fancontrol.pl b/prog/pwm/fancontrol.pl index 83c2a920..cb7327bc 100755 --- a/prog/pwm/fancontrol.pl +++ b/prog/pwm/fancontrol.pl @@ -234,7 +234,7 @@ sub pwmdisable($) else { die("$dir/$p : $!"); } - my $enable = "$dir/$p/pwm/pwm_enable"; + my $enable = "$dir/${p}_enable"; if (-f $enable) { if (open(F, ">$enable")) @@ -243,7 +243,7 @@ sub pwmdisable($) close(F); } else - { die("$dir/$p/pwm/pwm_enable : $!"); } + { die("$enable : $!"); } } } else @@ -267,7 +267,7 @@ sub pwmenable($) if ($sysfs == 1) { - my $enable = "$dir/$p/pwm/pwm_enable"; + my $enable = "$dir/${p}_enable"; if (-f $enable) { if (open(F, ">$enable")) @@ -276,7 +276,7 @@ sub pwmenable($) close(F); } else - { die("$dir/$p : $!\n"); } + { die("$enable : $!\n"); } } } else diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 09ca593f..9f3eefdb 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -2896,7 +2896,7 @@ void print_w83627ehf(const sensors_chip_name *name) { char *label; int i, valid, num_in; - double cur, min, div, max, alarm, over, hyst; + double cur, min, fdiv, max, alarm, over, hyst; if (!strcmp(name->prefix, "w83627dhg")) num_in = 9; @@ -2929,8 +2929,8 @@ void print_w83627ehf(const sensors_chip_name *name) if (valid) { print_label(label,10); printf("%4.0f RPM (min = %4.0f RPM", cur, min); - if (!sensors_get_feature(*name, SENSORS_W83627EHF_FAN1_DIV+i, &div)) - printf(", div = %1.0f", div); + if (!sensors_get_feature(*name, SENSORS_W83627EHF_FAN1_DIV+i, &fdiv)) + printf(", div = %1.0f", fdiv); printf(")"); if (!sensors_get_feature(*name, SENSORS_W83627EHF_FAN1_ALARM+i, &alarm) && alarm) @@ -3216,417 +3216,6 @@ void print_maxilife(const sensors_chip_name *name) free(label); } -void print_ddcmon(const sensors_chip_name *name) -{ - char *label; - double a, b, c; - int valid, i; - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_MAN_ID, &label, &valid) - && !sensors_get_feature(*name, SENSORS_DDCMON_MAN_ID, &a)) { - if (valid) { - i = (int) a; - print_label(label, 24); - printf("%c%c%c\n", - ((i >> 10) & 0x1f) + 'A' - 1, ((i >> 5) & 0x1f) + 'A' - 1, - (i & 0x1f) + 'A' - 1); - } - } else - printf("ERROR: data 1\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_PROD_ID, &label, &valid) - && !sensors_get_feature(*name, SENSORS_DDCMON_PROD_ID, &a)) { - if (valid) { - i = (int) a; - print_label(label, 24); - printf("0x%04X\n", i); - } - } else - printf("ERROR: data 2\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_SERIAL, &label,&valid) && - !sensors_get_feature(*name, SENSORS_DDCMON_SERIAL, &a)) { - if (valid) { - print_label(label, 24); - printf("%d\n", (int) a); - } - } else - printf("ERROR: data 3\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_YEAR, &label, &valid) - && !sensors_get_feature(*name, SENSORS_DDCMON_YEAR, &a) - && !sensors_get_feature(*name, SENSORS_DDCMON_WEEK, &b)) { - if (valid) { - print_label(label, 24); - printf("%d-W%d\n", (int) a, (int) b); - } - } else - printf("ERROR: data 4\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_EDID_VER, &label, &valid) - && !sensors_get_feature(*name, SENSORS_DDCMON_EDID_VER, &a) - && !sensors_get_feature(*name, SENSORS_DDCMON_EDID_REV, &b)) { - if (valid) { - print_label(label, 24); - printf("%d.%d\n", (int) a, (int) b); - } - } else - printf("ERROR: data 5\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_VERSIZE, &label,&valid) && - !sensors_get_feature(*name, SENSORS_DDCMON_VERSIZE, &a) && - !sensors_get_feature(*name, SENSORS_DDCMON_HORSIZE, &b)) { - if (valid) { - print_label(label, 24); - printf("%dx%d\n", (int) a, (int) b); - } - } else - printf("ERROR: data 6\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_GAMMA, &label, &valid) - && !sensors_get_feature(*name, SENSORS_DDCMON_GAMMA, &a)) { - if (valid) { - print_label(label, 24); - printf("%.02f\n", a); - } - } else - printf("ERROR: data 7\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_DPMS, &label, &valid) - && !sensors_get_feature(*name, SENSORS_DDCMON_DPMS, &a)) { - if (valid) { - i = (int) a; - print_label(label, 24); - if (i & 0xe0) { - printf("%s%s%s%s%s\n", - i & 0x20 ? "Active Off" : "", - (i & 0x40) && (i & 0x20) ? ", ": "", - i & 0x40 ? "Suspend" : "", - (i & 0x80) && (i & 0x60) ? ", ": "", - i & 0x80 ? "Standby" : ""); - } else { - printf("None supported\n"); - } - } - } else - printf("ERROR: data 8\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_TIMINGS, &label,&valid) && - !sensors_get_feature(*name, SENSORS_DDCMON_TIMINGS, &a)) { - if (valid) { - i = (int) a; - if (i & 0x03) { /* 720x400 */ - print_label(label, 24); - printf("720x400 @ %s%s%s Hz\n", - i & 0x01 ? "70" : "", - (i & 0x02) && (i & 0x01) ? "/" : "", - i & 0x02 ? "88" : ""); - } - if (i & 0x3c) { /* 640x480 */ - print_label(label, 24); - printf("640x480 @ %s%s%s%s%s%s%s Hz\n", - i & 0x04 ? "60" : "", - (i & 0x08) && (i & 0x04) ? "/" : "", - i & 0x08 ? "67" : "", - (i & 0x10) && (i & 0x0c) ? "/" : "", - i & 0x10 ? "72" : "", - (i & 0x20) && (i & 0x1c) ? "/" : "", - i & 0x20 ? "75" : ""); - } - i >>= 6; - if (i & 0x0f) { /* 800x600 */ - print_label(label, 24); - printf("800x600 @ %s%s%s%s%s%s%s Hz\n", - i & 0x01 ? "56" : "", - (i & 0x02) && (i & 0x01) ? "/" : "", - i & 0x02 ? "60" : "", - (i & 0x04) && (i & 0x03) ? "/" : "", - i & 0x04 ? "72" : "", - (i & 0x08) && (i & 0x07) ? "/" : "", - i & 0x08 ? "75" : ""); - } - if (i & 0x10) { /* 832x624 */ - print_label(label, 24); - printf("832x624 @ 75 Hz\n"); - } - i >>= 5; - if (i & 0x0f) { /* 1024x768 */ - print_label(label, 24); - printf("1024x768 @ %s%s%s%s%s%s%s Hz\n", - i & 0x01 ? "87i" : "", - (i & 0x02) && (i & 0x01) ? "/" : "", - i & 0x02 ? "60" : "", - (i & 0x04) && (i & 0x03) ? "/" : "", - i & 0x04 ? "70" : "", - (i & 0x08) && (i & 0x07) ? "/" : "", - i & 0x08 ? "75" : ""); - } - if (i & 0x100) { /* 1152x870 */ - print_label(label, 24); - printf("1152x870 @ 75 Hz\n"); - } - if (i & 0x10) { /* 1280x1024 */ - print_label(label, 24); - printf("1280x1024 @ 75 Hz\n"); - } - } - } else - printf("ERROR: data 9\n"); - free(label); - - for(i = 0; i < 8; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_TIMING1_HOR + i * 3, &label, &valid) - && !sensors_get_feature(*name, SENSORS_DDCMON_TIMING1_HOR + i * 3, &a) - && !sensors_get_feature(*name, SENSORS_DDCMON_TIMING1_VER + i * 3, &b) - && !sensors_get_feature(*name, SENSORS_DDCMON_TIMING1_REF + i * 3, &c)) { - if (valid && ((int) a) != 0) { - print_label(label, 24); - printf("%dx%d @ %d Hz\n", (int) a, (int) b, (int) c); - } - } else - printf("ERROR: data 10-%d\n", i+1); - free(label); - } - - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_VERSYNCMIN, &label,&valid) && - !sensors_get_feature(*name, SENSORS_DDCMON_VERSYNCMIN, &a) && - !sensors_get_feature(*name, SENSORS_DDCMON_VERSYNCMAX, &b)) { - if (valid && ((int) a) != 0) { - print_label(label, 24); - printf("%d-%d\n", (int) a, (int) b); - } - } else - printf("ERROR: data 11\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_HORSYNCMIN, &label,&valid) && - !sensors_get_feature(*name, SENSORS_DDCMON_HORSYNCMIN, &a) && - !sensors_get_feature(*name, SENSORS_DDCMON_HORSYNCMAX, &b)) { - if (valid && ((int) a) != 0) { - print_label(label, 24); - printf("%d-%d\n", (int) a, (int) b); - } - } else - printf("ERROR: data 12\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_DDCMON_MAXCLOCK, &label, &valid) - && !sensors_get_feature(*name, SENSORS_DDCMON_MAXCLOCK, &a)) { - if (valid && ((int) a) != 0) { - print_label(label, 24); - printf("%d\n", (int) a); - } - } else - printf("ERROR: data 13\n"); - free(label); - - printf("Note that the ddcmon driver is deprecated and will be deleted soon.\n"); - printf("Please use the eeprom driver and the ddcmon and/or decode-edid.pl\n" - "scripts instead.\n"); -} - -/* - * (Khali, 2003-07-17) Almost entierly rewritten. Reindented for clarity, - * simplified at some places, added support for EDID EEPROMs (well, - * redirection more than support). - * (Khali, 2003-08-09) Rewrote Sony Vaio EEPROMs detection, and move it - * to the top. This should prevent such EEPROMs from being accidentally - * detected as valid memory modules. - * (Khali, 2004-02-23) Add support for Shuttle EEPROMs, which contain - * MAC ethernet addresses. - */ -void print_eeprom(const sensors_chip_name *name) -{ - char *label; - double a, b, c, d; - int valid, i, type; - - /* handle Sony Vaio EEPROMs first */ - if (name->addr == 0x57) { - char buffer[33]; - - /* first make sure it is a Sony Vaio EEPROM */ - if (!sensors_get_label_and_valid(*name, SENSORS_EEPROM_VAIO_NAME, &label, &valid) - && valid) { - for (i = 0; i < 4; i++) - if (!sensors_get_feature(*name, SENSORS_EEPROM_VAIO_NAME+i, &a)) - buffer[i] = (char) a; - if (strncmp(buffer, "PCG-", 4) == 0 - || strncmp(buffer, "VGN-", 4) == 0) { - /* must be a real Sony Vaio EEPROM */ - memset(buffer + 4, '\0', 29); - for (a = 1; i < 32 && a != 0; i++) /* stop at first zero */ - if (!sensors_get_feature(*name, SENSORS_EEPROM_VAIO_NAME+i, &a) - && a != 0) - buffer[i] = (char) a; - print_label(label, 24); - printf("%s\n", buffer); - free(label); - - memset(buffer, '\0', i); - if (!sensors_get_label_and_valid(*name, SENSORS_EEPROM_VAIO_SERIAL, &label, &valid) - && valid) { - for (i = 0, a = 1; i < 32 && a != 0; i++) /* stop at first zero */ - if (!sensors_get_feature(*name, SENSORS_EEPROM_VAIO_SERIAL+i, &a) - && a != 0) - buffer[i] = (char) a; - print_label(label, 24); - printf("%s\n", buffer); - } else - printf("ERROR: data Vaio 3\n"); - free(label); - - printf("Note that eeprom support will be dropped from " - "libsensors soon.\nPlease use the decode-vaio.pl " - "script instead.\n"); - return; - } - } else - printf("ERROR: data Vaio 2\n"); - free(label); - } - - /* then Shuttle EEPROMs */ - if (name->addr == 0x53) { - unsigned char buffer[6]; - - /* first make sure it is a Shuttle EEPROM */ - if (!sensors_get_label_and_valid(*name, SENSORS_EEPROM_SHUTTLE, &label, &valid) - && valid) { - for (i = 0; i < 3; i++) - if (!sensors_get_feature(*name, SENSORS_EEPROM_SHUTTLE+i, &a)) - buffer[i] = (unsigned char) a; - if (buffer[0] == 0x00 - && buffer[1] == 0x30 - && buffer[2] == 0x1b) - { - /* must be a real Shuttle EEPROM */ - for (i = 4; i < 6; i++) - if (!sensors_get_feature(*name, SENSORS_EEPROM_SHUTTLE+i, &a)) - buffer[i] = (unsigned char) a; - - print_label(label, 24); - printf("%02X:%02X:%02X:%02X:%02X:%02X\n", buffer[0], - buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); - free(label); - - return; - } - } else - printf("ERROR: data Shuttle\n"); - free(label); - } - - if (!sensors_get_label_and_valid(*name, SENSORS_EEPROM_TYPE, &label, &valid) - && !sensors_get_feature(*name, SENSORS_EEPROM_TYPE, &a)) { - if (valid) { - type = (int) a; - switch (type) { - case 1: - print_label(label, 24); - printf("DRDRAM RIMM\n"); - break; - case 2: - print_label(label, 24); - printf("EDO\n"); - break; - case 4: - print_label(label, 24); - printf("SDR SDRAM DIMM\n"); - break; - case 7: - print_label(label, 24); - printf("DDR SDRAM DIMM\n"); - break; - case 8: - print_label(label, 24); - printf("DDR2 SDRAM DIMM\n"); - break; - case 17: - print_label(label, 24); - printf("RAMBUS RIMM\n"); - break; - case 255: /* EDID EEPROM? */ - break; - default: - printf("Unknown EEPROM type (%d)\n", type); - free(label); - return; - } - } else { - free(label); - return; - } - } else { - free(label); - printf("Memory type: Unavailable\n"); - return; - } - free(label); - - if (type == 255) { /* EDID EEPROM */ - /* make sure it is an EDID EEPROM */ - if (!sensors_get_feature(*name, SENSORS_EEPROM_ROWADDR, &a) - && !sensors_get_feature(*name, SENSORS_EEPROM_COLADDR, &b) - && !sensors_get_feature(*name, SENSORS_EEPROM_NUMROWS, &c) - && !sensors_get_feature(*name, SENSORS_EEPROM_EDID_HEADER, &d)) { - if (((int) a) != 255 || ((int) b) != 255 || ((int) c) != 255 - || ((int) d) != 0) - printf("Unknown EEPROM type (255).\n"); - else if (name->addr == 0x50) - /* must be an EDID EEPROM */ - printf("Use the ddcmon and/or decode-edid.pl scripts.\n"); - } else - printf("ERROR: data EDID\n"); - return; - } - - /* regular memory chips */ - if (!sensors_get_label_and_valid(*name, SENSORS_EEPROM_ROWADDR, &label, &valid) - && !sensors_get_feature(*name, SENSORS_EEPROM_ROWADDR, &a) - && !sensors_get_feature(*name, SENSORS_EEPROM_COLADDR, &b) - && !sensors_get_feature(*name, SENSORS_EEPROM_NUMROWS, &c) - && !sensors_get_feature(*name, SENSORS_EEPROM_BANKS, &d) - && valid) { - int k = 0; /* multiplier, 0 if invalid */ - print_label(label, 24); - if (type == 17) { /* RAMBUS */ - i = (((int) a) & 0x0f) + (((int) a) >> 4) + (((int) c) & 0x07) - 13; - k = 1; - } else if (type == 1) { /* DRDRAM */ - i = (((int) b) & 0x0f) + (((int) b) >> 4) + (((int) c) & 0x07) - 13; - k = 1; - } else if (type == 8) { /* DDR2 */ - i = (((int) a) & 0x0f) + (((int) b) & 0x0f) - 17; - k = ((((int) c) & 0x7) + 1) * ((int) d); - } else { /* SDRAM */ - i = (((int) a) & 0x0f) + (((int) b) & 0x0f) - 17; - if (((int) c) <= 8 && ((int) d) <= 8) - k = ((int) c) * ((int) d); - } - if(i > 0 && i <= 12 && k > 0) - printf("%d\n", (1 << i) * k); - else - printf("invalid (%d %d %d %d)\n", - (int) a, (int) b, (int) c, (int) d); - } else - printf("ERROR: data 2\n"); - free(label); - - printf("Note that eeprom support will be dropped from " - "libsensors soon.\nPlease use the decode-dimms.pl " - "script instead.\n"); -} - void print_it87(const sensors_chip_name *name) { char *label; @@ -4593,8 +4182,9 @@ void print_vt1211(const sensors_chip_name *name) void print_smsc47m1(const sensors_chip_name *name) { char *label; - double cur, min, div; + double cur, min, fdiv; int alarms, valid, i; + int is_m2 = !strcmp(name->prefix, "smsc47m2"); if (!sensors_get_feature(*name,SENSORS_SMSC47M1_ALARMS,&cur)) alarms = cur + 0.5; @@ -4603,15 +4193,15 @@ void print_smsc47m1(const sensors_chip_name *name) alarms = 0; } - for (i=0; i<2; i++) { /* 2 fans */ + for (i = 0; i < (is_m2 ? 3 : 2); i++) { /* 2 or 3 fans */ if (!sensors_get_label_and_valid(*name, SENSORS_SMSC47M1_FAN1+i, &label, &valid) && !sensors_get_feature(*name, SENSORS_SMSC47M1_FAN1+i, &cur) - && !sensors_get_feature(*name, SENSORS_SMSC47M1_FAN1_DIV+i, &div) + && !sensors_get_feature(*name, SENSORS_SMSC47M1_FAN1_DIV+i, &fdiv) && !sensors_get_feature(*name, SENSORS_SMSC47M1_FAN1_MIN+i, &min)) { if (valid) { print_label(label, 10); printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur, min, div, alarms&(SMSC47M1_ALARM_FAN1<prefix, 7); @@ -5558,10 +5148,10 @@ void print_adm1031(const sensors_chip_name *name) &label, &valid) && !sensors_get_feature(*name, SENSORS_ADM1031_FAN1+i*10, &cur) && !sensors_get_feature(*name, SENSORS_ADM1031_FAN1_MIN+i*10, &low) - && !sensors_get_feature(*name, SENSORS_ADM1031_FAN1_DIV+i*10, &div)) { + && !sensors_get_feature(*name, SENSORS_ADM1031_FAN1_DIV+i*10, &fdiv)) { if (valid) { print_label(label, 10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f)", cur, low, div); + printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f)", cur, low, fdiv); printf(" %s\n", alarms&(ADM1031_ALARM_FAN1_FLT<<(i*8))?"FAULT": alarms&(ADM1031_ALARM_FAN1_MIN<<(i*8))?"ALARM":""); @@ -5740,7 +5330,7 @@ void print_max6650(const sensors_chip_name *name) static const struct { int tag; - char *name; + const char *name; } tach_list[] = { @@ -5817,17 +5407,17 @@ static void print_asb100_fan(const sensors_chip_name *name, int alarm, int fan, int fan_div, int fan_min) { char *label; - double cur, div, min; + double cur, fdiv, min; int valid; if (!sensors_get_label_and_valid(*name,fan,&label,&valid) && !sensors_get_feature(*name,fan,&cur) && - !sensors_get_feature(*name,fan_div,&div) && + !sensors_get_feature(*name,fan_div, &fdiv) && !sensors_get_feature(*name,fan_min,&min)) { if (valid) { print_label(label,10); printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur, min, div, alarm ? "ALARM" : ""); + cur, min, fdiv, alarm ? "ALARM" : ""); } } else printf("ERROR: Can't get FAN data! (0x%04x)\n", fan); @@ -6336,6 +5926,121 @@ void print_coretemp(const sensors_chip_name *name) free(label); } +static void print_dme1737_in(const sensors_chip_name *name, int i) +{ + char *label; + double cur, min, max, alarm; + int valid; + + if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_IN(i), &label, + &valid) && + !sensors_get_feature(*name, SENSORS_DME1737_IN(i), &cur) && + !sensors_get_feature(*name, SENSORS_DME1737_IN_MIN(i), &min) && + !sensors_get_feature(*name, SENSORS_DME1737_IN_MAX(i), &max) && + !sensors_get_feature(*name, SENSORS_DME1737_IN_ALARM(i), &alarm)) { + if (valid) { + print_label(label, 10); + printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + cur, min, max, alarm ? "ALARM" : ""); + } + } else { + printf("ERROR: Can't get in%d data!\n", i); + } + free(label); +} + +static void print_dme1737_temp(const sensors_chip_name *name, int i) +{ + char *label; + double cur, min, max, alarm, fault; + int valid; + + if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_TEMP(i), &label, + &valid) && + !sensors_get_feature(*name, SENSORS_DME1737_TEMP(i), &cur) && + !sensors_get_feature(*name, SENSORS_DME1737_TEMP_MIN(i), &min) && + !sensors_get_feature(*name, SENSORS_DME1737_TEMP_MAX(i), &max) && + !sensors_get_feature(*name, SENSORS_DME1737_TEMP_ALARM(i), &alarm) && + !sensors_get_feature(*name, SENSORS_DME1737_TEMP_FAULT(i), &fault)) { + if (valid) { + print_label(label, 10); + print_temp_info(cur, max, min, MINMAX, 0, 0); + printf("%s %s\n", fault ? "FAULT" : "", alarm ? "ALARM" : ""); + } + } else { + printf("ERROR: Can't get temp%d data!\n", i); + } + free(label); +} + +static void print_dme1737_fan(const sensors_chip_name *name, int i) +{ + char *label; + double cur, min, alarm; + int valid; + + if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_FAN(i), &label, + &valid) && + !sensors_get_feature(*name, SENSORS_DME1737_FAN(i), &cur) && + !sensors_get_feature(*name, SENSORS_DME1737_FAN_MIN(i), &min) && + !sensors_get_feature(*name, SENSORS_DME1737_FAN_ALARM(i), &alarm)) { + if (valid) { + print_label(label, 10); + printf("%4.0f RPM (min = %4.0f RPM) %s\n", + cur, min, alarm ? "ALARM" : ""); + } + } else { + printf("ERROR: Can't get fan%d data!\n", i); + } + free(label); +} + +static void print_dme1737_pwm(const sensors_chip_name *name, int i) +{ + char *label; + double cur, enable, freq; + int valid; + + if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_PWM(i), &label, + &valid) && + !sensors_get_feature(*name, SENSORS_DME1737_PWM(i), &cur) && + !sensors_get_feature(*name, SENSORS_DME1737_PWM_ENABLE(i), &enable) && + !sensors_get_feature(*name, SENSORS_DME1737_PWM_FREQ(i), &freq)) { + if (valid) { + print_label(label, 10); + printf("%4.0f (enable = %1.0f, freq = %6.0f Hz)\n", cur, enable, freq); + } + } else { + printf("ERROR: Can't get pwm%d data!\n", i); + } + free(label); +} + +void print_dme1737(const sensors_chip_name *name) +{ + int i; + + for (i = 0; i < 7; i++) { + print_dme1737_in(name, i); + } + + for (i = 1; i < 4; i++) { + print_dme1737_temp(name, i); + } + + for (i = 1; i < 7; i++) { + print_dme1737_fan(name, i); + } + + for (i = 1; i < 7; i++) { + if (i == 4) + continue; + print_dme1737_pwm(name, i); + } + + print_vid_info(name, SENSORS_DME1737_VID, SENSORS_DME1737_VRM); +} + void print_unknown_chip(const sensors_chip_name *name) { int a,b,valid; diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index 88341745..d2cac286 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -46,8 +46,6 @@ extern void print_w83793(const sensors_chip_name *name); extern void print_w83l785ts(const sensors_chip_name *name); extern void print_w83627ehf(const sensors_chip_name *name); extern void print_maxilife(const sensors_chip_name *name); -extern void print_ddcmon(const sensors_chip_name *name); -extern void print_eeprom(const sensors_chip_name *name); extern void print_lm87(const sensors_chip_name *name); extern void print_it87(const sensors_chip_name *name); extern void print_fscpos(const sensors_chip_name *name); @@ -78,5 +76,6 @@ extern void print_f71805f(const sensors_chip_name *name); extern void print_abituguru(const sensors_chip_name *name); extern void print_k8temp(const sensors_chip_name *name); extern void print_coretemp(const sensors_chip_name *name); +extern void print_dme1737(const sensors_chip_name *name); #endif /* def PROG_SENSORS_CHIPS_H */ diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 15678382..e2fa91b9 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -382,8 +382,6 @@ struct match matches[] = { { "it8712", print_it87 }, { "it8716", print_it87 }, { "it8718", print_it87 }, - { "ddcmon", print_ddcmon }, - { "eeprom", print_eeprom }, { "fscpos", print_fscpos }, { "fscscy", print_fscscy }, { "fscher", print_fscher }, @@ -391,6 +389,7 @@ struct match matches[] = { { "vt1211", print_vt1211 }, { "smsc47m192", print_smsc47m192 }, { "smsc47m1", print_smsc47m1 }, + { "smsc47m2", print_smsc47m1 }, { "pc87360", print_pc87360 }, { "pc87363", print_pc87360 }, { "pc87364", print_pc87364 }, @@ -422,12 +421,12 @@ struct match matches[] = { { "abituguru", print_abituguru }, { "k8temp", print_k8temp }, { "coretemp", print_coretemp }, + { "dme1737", print_dme1737 }, { NULL, NULL } }; void do_a_print(sensors_chip_name name) { - const char *adap; struct match *m; /* do we know how to display it? */ @@ -439,11 +438,13 @@ void do_a_print(sensors_chip_name name) return; printf("%s\n",sprintf_chip_name(name)); - adap = sensors_get_adapter_name(name.bus); - if (adap && !hide_adapter) - printf("Adapter: %s\n",adap); - if (!adap) - fprintf(stderr, "Can't get adapter name for bus %d\n", name.bus); + if (!hide_adapter) { + const char *adap = sensors_get_adapter_name(name.bus); + if (adap) + printf("Adapter: %s\n", adap); + else + fprintf(stderr, "Can't get adapter name for bus %d\n", name.bus); + } if (do_unknown) print_unknown_chip(&name); else { diff --git a/version.h b/version.h index a3319392..13bc5cd7 100644 --- a/version.h +++ b/version.h @@ -1,2 +1,2 @@ -#define LM_DATE "2007????" -#define LM_VERSION "2.10.2-SVN" +#define LM_DATE "20070319" +#define LM_VERSION "2.10.3" From 666fe95cdbe63e61f6fc7234c9c1cc20103ac6b0 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Apr 2007 14:09:21 +0000 Subject: [PATCH 003/718] dynamicly generate a sensors_chip_features_list entry for unknown chips based on their sysfs entries, by Bob Schlarmann and Luuk Kleiweg git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4359 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/chips.c | 3 ++ lib/data.h | 3 ++ lib/sysfs.c | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 158 insertions(+), 1 deletion(-) diff --git a/lib/chips.c b/lib/chips.c index 8d78b28d..8d4e5090 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -22,6 +22,8 @@ #include "sensors.h" #include "kernel/include/sensors.h" +#define PLACEHOLDER_ELEMENTS {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} + /* For each chip, a list of features; For each feature, the number, its name, the logical mapping (for example, fan1_div belongs to fan1), the compute mapping, an access field, the @@ -6161,5 +6163,6 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_K8TEMP_PREFIX, k8temp_features }, { SENSORS_CORETEMP_PREFIX, coretemp_features }, { SENSORS_DME1737_PREFIX, dme1737_features }, + PLACEHOLDER_ELEMENTS, { 0 } }; diff --git a/lib/data.h b/lib/data.h index 8cb0ba73..af6017c3 100644 --- a/lib/data.h +++ b/lib/data.h @@ -191,4 +191,7 @@ extern int sensors_proc_bus_max; extern sensors_chip_features sensors_chip_features_list[]; +/* this should match the total number of elements in PLACEHOLDER_ELEMENTS */ +#define N_PLACEHOLDER_ELEMENTS 10 + #endif /* def LIB_SENSORS_DATA_H */ diff --git a/lib/sysfs.c b/lib/sysfs.c index bbb2b735..dadcb203 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "data.h" #include "error.h" #include "access.h" @@ -34,6 +35,137 @@ int sensors_found_sysfs = 0; char sensors_sysfs_mount[NAME_MAX]; +#define DYNAMIC_CHIP_REGEX "\\([[:alpha:]]\\{1,\\}[[:digit:]]\\{0,\\}\\)\\(\\_[[:alpha:]]\\{1,\\}\\)\\{0,1\\}" + +static int sensors_read_dynamic_chip_check_mapping( + sensors_chip_feature *minor, + sensors_chip_feature *major, + regmatch_t *pmatch) +{ + if (pmatch[1].rm_so == -1 || pmatch[2].rm_so == -1 || + strncmp(minor->data.name, major->data.name, + pmatch[1].rm_eo - pmatch[1].rm_so)) { + return 0; + } else { + minor->data.mapping = + minor->data.compute_mapping = + major->data.number; + + return 1; + } +} + +static +sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) +{ + int fnum = 1, i, last_major = -1; + struct sysfs_attribute *attr; + struct dlist *attrs; + sensors_chip_features ret = {0, 0}; + sensors_chip_feature features[256], *dyn_features; + regex_t preg; + regmatch_t pmatch[3]; + char *name; + + attrs = sysfs_get_device_attributes(sysdir); + + if (attrs == NULL) + return ret; + + regcomp(&preg, DYNAMIC_CHIP_REGEX, 0); + + dlist_for_each_data(attrs, attr, struct sysfs_attribute) { + sensors_chip_feature feature = { { 0, }, 0, }; + name = attr->name; + + if (!strcmp(name, "name")) { + ret.prefix = strndup(attr->value, strlen(attr->value) - 1); + continue; + } else if (regexec(&preg, name, 3, pmatch, 0) != 0) { + continue; + } + + feature.data.number = fnum; + feature.data.mode = (attr->method & (SYSFS_METHOD_SHOW|SYSFS_METHOD_STORE)) == + (SYSFS_METHOD_SHOW|SYSFS_METHOD_STORE) ? + SENSORS_MODE_RW : + (attr->method & SYSFS_METHOD_SHOW) ? SENSORS_MODE_R : + (attr->method & SYSFS_METHOD_STORE) ? SENSORS_MODE_W : + SENSORS_MODE_NO_RW; + feature.data.mapping = SENSORS_NO_MAPPING; + feature.data.compute_mapping = SENSORS_NO_MAPPING; + + if (pmatch[2].rm_so != -1) { + if (!strncmp(name + pmatch[2].rm_so, "_input", + pmatch[2].rm_eo - pmatch[2].rm_so)) { + int last_match; + + /* copy only the part before the _ */ + feature.data.name = strndup(name, + pmatch[1].rm_eo - pmatch[1].rm_so); + + /* check if the features previously read are sub devices of this major + and update their mapping accordingly */ + last_match = fnum - 1; + for(i = fnum - 2; i >= 0; i--) { + if (regexec(&preg, features[i].data.name, 3, pmatch, 0) == -1 || + !sensors_read_dynamic_chip_check_mapping(&features[i], + &feature, pmatch)) { + break; + } else { + last_match = i; + } + } + + /* if so the major should be in the list before any minor feature, + so swap with the oldest read */ + if (last_match < fnum - 1) { + sensors_chip_feature tmp = features[last_match]; + features[last_match] = feature; + features[fnum - 1] = tmp; + + last_major = last_match; + + goto NEXT_NUM; /* NOTE: goto used */ + } else { + last_major = fnum - 1; + } + + } else { + feature.data.name = strdup(name); + + if (last_major != -1 && + !sensors_read_dynamic_chip_check_mapping(&feature, + &features[last_major], pmatch)) { + last_major = -1; /* no more features for current major */ + } + } + } else { + feature.data.name = strdup(name); + } + + features[fnum - 1] = feature; +NEXT_NUM: + fnum++; + } + + regfree(&preg); + + dyn_features = malloc(sizeof(sensors_chip_feature) * fnum); + if (dyn_features == NULL) { + sensors_fatal_error(__FUNCTION__,"Out of memory"); + } + + for(i = 0; i < fnum - 1; i++) { + dyn_features[i] = features[i]; + } + dyn_features[fnum - 1].data.name = 0; + + ret.feature = dyn_features; + + return ret; +} + /* returns !0 if sysfs filesystem was found, 0 otherwise */ int sensors_init_sysfs(void) { @@ -46,7 +178,8 @@ int sensors_init_sysfs(void) /* returns: 0 if successful, !0 otherwise */ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) { - int domain, bus, slot, fn; + static int total_dynamic = 0; + int domain, bus, slot, fn, i; struct sysfs_attribute *attr, *bus_attr; char bus_path[SYSFS_PATH_MAX]; sensors_proc_chips_entry entry; @@ -102,7 +235,25 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) entry.name.bus = SENSORS_CHIP_NAME_BUS_PCI; } else return -SENSORS_ERR_PARSE; + + /* check whether this chip is known in the static list */ + for (i = 0; sensors_chip_features_list[i].prefix; i++) + if (!strcasecmp(sensors_chip_features_list[i].prefix, entry.name.prefix)) + break; + /* if no chip definition matches */ + if (!sensors_chip_features_list[i].prefix && + total_dynamic < N_PLACEHOLDER_ELEMENTS) { + sensors_chip_features n_entry = sensors_read_dynamic_chip(dev); + + /* skip to end of list */ + for(i = 0; sensors_chip_features_list[i].prefix; i++); + + sensors_chip_features_list[i] = n_entry; + + total_dynamic++; + } + sensors_add_proc_chips(&entry); return 0; From 05087736f89db4267b6efd0bac97be65a652d1d6 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Apr 2007 14:40:05 +0000 Subject: [PATCH 004/718] add sensors_feature_get_type method, by Bob Schlarmann and Luuk Kleiweg git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4360 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/sensors.h | 32 ++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/lib/access.c b/lib/access.c index 0a67d6a2..a0ca6175 100644 --- a/lib/access.c +++ b/lib/access.c @@ -496,3 +496,67 @@ int sensors_do_all_sets(void) }; return sensors_do_chip_sets(name); } + +/* Return the feature type based on the feature name */ +sensors_feature_type sensors_feature_get_type( + const sensors_feature_data *feature) +{ + const char *name; + + /* this will only work when the sensors_chip_feature is obtained through + sensors_get_all_features */ + if (((const struct sensors_chip_feature *)feature)->sysname) + name = ((const struct sensors_chip_feature *)feature)->sysname; + else + name = feature->name; + + if (strstr(name, "temp")) { + if (strlen(name) == 5) + return SENSORS_FEATURE_TEMP; + + if (strstr(name, "hyst")) + return SENSORS_FEATURE_TEMP_HYST; + + if (strstr(name, "over")) + return SENSORS_FEATURE_TEMP_OVER; + + if (strstr(name, "max")) + return SENSORS_FEATURE_TEMP_MAX; + + if (strstr(name, "min")) + return SENSORS_FEATURE_TEMP_MIN; + + if (strstr(name, "low")) + return SENSORS_FEATURE_TEMP_LOW; + + if (strstr(name, "crit")) + return SENSORS_FEATURE_TEMP_CRIT; + } else if (strstr(name, "in") && name[0] != 'f') { + if (strlen(name) == 3 || strstr(name, "input")) + return SENSORS_FEATURE_IN; + + if (strstr(name, "max")) + return SENSORS_FEATURE_IN_MAX; + + if (strstr(name, "min")) + return SENSORS_FEATURE_IN_MIN; + + if (strstr(name, "alarm")) + return SENSORS_FEATURE_IN_ALARM; + } else if (strstr(name, "fan")) { + if (strlen(name) == 4) + return SENSORS_FEATURE_FAN; + + if (strstr(name, "min")) + return SENSORS_FEATURE_FAN_MIN; + + if (strstr(name, "div")) + return SENSORS_FEATURE_FAN_DIV; + } else if (!strcmp(name, "vrm")) { + return SENSORS_FEATURE_VRM; + } else if (strstr(name, "vid")) { + return SENSORS_FEATURE_VID; + } + + return SENSORS_FEATURE_UNKNOWN; +} diff --git a/lib/sensors.h b/lib/sensors.h index bb694a07..eeaca583 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -146,6 +146,38 @@ typedef struct sensors_feature_data { extern const sensors_feature_data *sensors_get_all_features (sensors_chip_name name, int *nr1,int *nr2); +typedef enum sensors_feature_type { + SENSORS_FEATURE_TEMP = 0, + SENSORS_FEATURE_TEMP_ALARM, + SENSORS_FEATURE_TEMP_HYST, + SENSORS_FEATURE_TEMP_OVER, + SENSORS_FEATURE_TEMP_MAX, + SENSORS_FEATURE_TEMP_MIN, + SENSORS_FEATURE_TEMP_HIGH, + SENSORS_FEATURE_TEMP_LOW, + SENSORS_FEATURE_TEMP_LIM, + SENSORS_FEATURE_TEMP_CRIT, + + SENSORS_FEATURE_IN, + SENSORS_FEATURE_IN_ALARM, + SENSORS_FEATURE_IN_MIN, + SENSORS_FEATURE_IN_MAX, + SENSORS_FEATURE_IN_MIN_ALARM, + SENSORS_FEATURE_IN_MAX_ALARM, + + SENSORS_FEATURE_FAN, + SENSORS_FEATURE_FAN_ALARM, + SENSORS_FEATURE_FAN_MIN, + SENSORS_FEATURE_FAN_DIV, + + SENSORS_FEATURE_VID, + SENSORS_FEATURE_VRM, + + SENSORS_FEATURE_UNKNOWN +} sensors_feature_type; + +sensors_feature_type sensors_feature_get_type( + const sensors_feature_data *feature); #ifdef __cplusplus } #endif /* __cplusplus */ From 99c2d0194c55a2daca0881aff6a8b13423d92895 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Apr 2007 14:41:52 +0000 Subject: [PATCH 005/718] generic in/temp/fan printing routines for sensors prog, by Bob Schlarmann and Luuk Kleiweg git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4361 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 34 +++++++++++++++++++++++----------- prog/sensors/chips.h | 17 +++++++++++++++++ 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 9f3eefdb..c72ba660 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -29,7 +29,7 @@ #include "lib/error.h" #include "kernel/include/sensors.h" -static void print_label(const char *label, int space); +void print_label(const char *label, int space); static void print_temp_info(float, float, float, int, int, int); static inline float deg_ctof( float ); @@ -41,16 +41,11 @@ inline float deg_ctof( float cel ) return ( cel * ( 9.0F / 5.0F ) + 32.0F ); } -#define HYST 0 -#define MINMAX 1 -#define MAXONLY 2 -#define CRIT 3 -#define SINGLE 4 -#define HYSTONLY 5 /* minmax = 0 for limit/hysteresis, 1 for max/min, 2 for max only; curprec and limitprec are # of digits after decimal point - for the current temp and the limits */ -void print_temp_info(float n_cur, float n_over, float n_hyst, + for the current temp and the limits + note: symbolic constants defined in chips.h */ +void print_temp_info_real(float n_cur, float n_over, float n_hyst, float n_lim, int minmax, int curprec, int limitprec) { if (fahrenheit) { @@ -86,10 +81,22 @@ void print_temp_info(float n_cur, float n_over, float n_hyst, printf( "%+6.*f%s (hyst = %+5.*f%s) ", curprec, n_cur, degstr, limitprec, n_over, degstr); + else if(minmax == LIM) + printf("%+6.*f%s (low = %+5.*f%s, high = %+5.*f%s, lim = %+5.*f%s) ", + curprec, n_cur, degstr, + limitprec, n_hyst, degstr, + limitprec, n_over, degstr, + limitprec, n_lim, degstr); else printf("Unknown temperature mode!"); } +void print_temp_info(float n_cur, float n_over, float n_hyst, + int minmax, int curprec, int limitprec) +{ + print_temp_info_real(n_cur, n_over, n_hyst, 0, minmax, curprec, limitprec); +} + void print_label(const char *label, int space) { int len=strlen(label)+1; @@ -113,7 +120,7 @@ int sensors_get_label_and_valid(sensors_chip_name name, int feature, char **labe return err; } -void print_vid_info(const sensors_chip_name *name, int f_vid, int f_vrm) +void print_vid_info_real(const sensors_chip_name *name, int f_vid, int f_vrm, int label_size) { char *label; int valid; @@ -122,7 +129,7 @@ void print_vid_info(const sensors_chip_name *name, int f_vid, int f_vrm) if (!sensors_get_label_and_valid(*name,f_vid,&label,&valid) && !sensors_get_feature(*name,f_vid,&vid) ) { if (valid) { - print_label(label,10); + print_label(label, label_size); if(!sensors_get_feature(*name,f_vrm,&vrm)) printf("%+6.3f V (VRM Version %.1f)\n",vid,vrm); else @@ -132,6 +139,11 @@ void print_vid_info(const sensors_chip_name *name, int f_vid, int f_vrm) free(label); } +void print_vid_info(const sensors_chip_name *name, int f_vid, int f_vrm) +{ + print_vid_info_real(name, f_vid, f_vrm, 10); +} + /* Chip-specific print routines start here */ void print_ds1621(const sensors_chip_name *name) diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index d2cac286..82e525b0 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -78,4 +78,21 @@ extern void print_k8temp(const sensors_chip_name *name); extern void print_coretemp(const sensors_chip_name *name); extern void print_dme1737(const sensors_chip_name *name); +/* some functions used by chips_generic.c */ +#define HYST 0 +#define MINMAX 1 +#define MAXONLY 2 +#define CRIT 3 +#define SINGLE 4 +#define HYSTONLY 5 +#define LIM 6 +void print_temp_info_real(float n_cur, float n_over, float n_hyst, float n_lim, + int minmax, int curprec, int limitprec); + +void print_vid_info_real(const sensors_chip_name *name, int f_vid, int f_vrm, int label_size); + +void print_label(const char *label, int space); + +int sensors_get_label_and_valid(sensors_chip_name name, int feature, char **label, + int *valid); #endif /* def PROG_SENSORS_CHIPS_H */ From d871e17ccf79bbab23d9f11f5b9471070db7481f Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Apr 2007 14:43:29 +0000 Subject: [PATCH 006/718] generic chip printing routine for sensors prog, by Bob Schlarmann and Luuk Kleiweg git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4362 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/Module.mk | 2 +- prog/sensors/main.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/prog/sensors/Module.mk b/prog/sensors/Module.mk index 6a117625..a758b1d1 100644 --- a/prog/sensors/Module.mk +++ b/prog/sensors/Module.mk @@ -27,7 +27,7 @@ PROGSENSORSMAN1FILES := $(MODULE_DIR)/sensors.1 # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... PROGSENSORSTARGETS := $(MODULE_DIR)/sensors -PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c +PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c $(MODULE_DIR)/chips_generic.c # Include all dependency files. We use '.rd' to indicate this will create # executables. diff --git a/prog/sensors/main.c b/prog/sensors/main.c index e2fa91b9..ca0f2f82 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -34,6 +34,7 @@ #include "lib/error.h" #include "chips.h" #include "version.h" +#include "chips_generic.h" #define PROGRAM "sensors" #define VERSION LM_VERSION @@ -54,7 +55,7 @@ static const char *sprintf_chip_name(sensors_chip_name name); #define CHIPS_MAX 20 sensors_chip_name chips[CHIPS_MAX]; int chips_count=0; -int do_sets, do_unknown, fahrenheit, hide_adapter, hide_unknown; +int do_sets, do_unknown, fahrenheit, hide_adapter, hide_unknown, do_generic; char degstr[5]; /* store the correct string to print degrees */ @@ -74,6 +75,7 @@ void print_long_help(void) printf(" -U, --no-unknown Do not show unknown chips\n"); printf(" -u, --unknown Treat chips as unknown ones (testing only)\n"); printf(" -v, --version Display the program version\n"); + printf(" -g, --generic Use generic printing routine for all chips (testing only)\n"); printf("\n"); printf("Use `-' after `-c' to read the config file from stdin.\n"); printf("If no chips are specified, all chip info will be printed.\n"); @@ -161,6 +163,7 @@ int main (int argc, char *argv[]) { "unknown", no_argument, NULL, 'u' }, /* next option accepted for compatibility, but otherwise ignored */ { "algorithm", no_argument, NULL, 'a' }, + { "generic", no_argument, NULL, 'g'}, { 0,0,0,0 } }; @@ -170,8 +173,9 @@ int main (int argc, char *argv[]) do_sets = 0; hide_adapter = 0; hide_unknown = 0; + do_generic = 0; while (1) { - c = getopt_long(argc,argv,"hsvfaAUc:u",long_opts,NULL); + c = getopt_long(argc,argv,"hsvfaAUc:ug",long_opts,NULL); if (c == EOF) break; switch(c) { @@ -206,6 +210,9 @@ int main (int argc, char *argv[]) case 'a': /* Ignore for compatibility */ break; + case 'g': + do_generic = 1; + break; default: fprintf(stderr,"Internal error while parsing options!\n"); exit(1); @@ -447,9 +454,11 @@ void do_a_print(sensors_chip_name name) } if (do_unknown) print_unknown_chip(&name); + else if(do_generic) + print_generic_chip(&name); else { if(m->prefix == NULL) - print_unknown_chip(&name); + print_generic_chip(&name); else m->fn(&name); } From be3ec092a5f090d37912a4861f414b147007aa09 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Apr 2007 14:43:57 +0000 Subject: [PATCH 007/718] generic chip printing routine for sensors prog, by Bob Schlarmann and Luuk Kleiweg git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4363 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 375 +++++++++++++++++++++++++++++++++++ prog/sensors/chips_generic.h | 29 +++ 2 files changed, 404 insertions(+) create mode 100644 prog/sensors/chips_generic.c create mode 100644 prog/sensors/chips_generic.h diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c new file mode 100644 index 00000000..4b4f5101 --- /dev/null +++ b/prog/sensors/chips_generic.c @@ -0,0 +1,375 @@ +/* + chips_generic.c - Part of sensors, a user-space program for hardware monitoring + Copyright (c) 1998-2003 Frodo Looijaard + and Mark D. Studebaker + Copyright (c) 2003-2006 The lm_sensors team + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include + +#include "chips_generic.h" +#include "chips.h" + +#define PRINT_SENSORS_LABEL_SIZE 12 + +static int get_feature_value(const sensors_chip_name *name, + const sensors_feature_data *feature, + double *val) +{ + return sensors_get_feature(*name, feature->number, val); +} + +static const sensors_feature_data* +sensors_get_sub_feature_by_type(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int j, + enum sensors_feature_type type) +{ + const sensors_feature_data *iter; + + while((iter = sensors_get_all_features(*name, &i, &j)) && + iter->mapping != SENSORS_NO_MAPPING && + iter->mapping == feature->number) { + if (sensors_feature_get_type(iter) == type) + return iter; + } + + return NULL; +} + +static void sensors_get_available_features(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int j, + short *has_features, + double *feature_vals, + int size, + int first_val) +{ + const sensors_feature_data *iter; + + while((iter = sensors_get_all_features(*name, &i, &j)) && + iter->mapping != SENSORS_NO_MAPPING && + iter->mapping == feature->number) { + sensors_feature_type type = sensors_feature_get_type(iter); + unsigned int index; + + if (type == SENSORS_FEATURE_UNKNOWN) + continue; + + index = type - first_val - 1; + if (index >= size) { + printf("ERROR: Bug in sensors: index out of bound"); + return; + } + + if (get_feature_value(name, iter, &feature_vals[index])) + printf("ERROR: Can't get %s data!\n", iter->name); + + /* some chips don't have all the features they claim to have */ + /* has_features[index] = (feature_vals[index] != 127); */ + has_features[index] = 1; + } +} + +#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] +#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] +static void print_generic_chip_temp(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int j) +{ + double val, max, min, lim = 0.0; + char *label; + int valid, type; + const int size = SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP; + short has_features[SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP] = {0, }; + double feature_vals[SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP] = {0.0, }; + + if (sensors_get_label_and_valid(*name, feature->number, &label, &valid)) { + free(label); + printf("ERROR: Can't get temperature data!\n"); + return; + } else if (!valid) { + free(label); + return; /* ignored */ + } + + if (get_feature_value(name, feature, &val)) { + free(label); + printf("ERROR: Can't get temperature data!\n"); + return; + } + + sensors_get_available_features(name, feature, i, j, has_features, + feature_vals, size, SENSORS_FEATURE_TEMP); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { + max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_LIM)) { + lim = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_LIM); + type = LIM; + } else { + type = MINMAX; + } + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + type = CRIT; + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HYST)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HYST); + type = HYST; + } else { + min = 0; + type = MAXONLY; + } + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HYST)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HYST); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_OVER)) { + max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_OVER); + type = HYST; + } else { + max = min; + max = 0; + type = HYSTONLY; + } + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_LOW)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_LOW); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HIGH)) { + max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HIGH); + } else { /* TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_OVER) */ + max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_OVER); + } + + type = MINMAX; + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_OVER)) { + max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_OVER); + min = 0; + type = MAXONLY; + } else { + min = max = 0; + type = SINGLE; + } + + print_label(label, PRINT_SENSORS_LABEL_SIZE); + free(label); + + if (type == LIM) { + print_temp_info_real(val, max, min, lim, type, 1, 1); + } else { + print_temp_info_real(val, max, min, 0.0, type, 1, 1); + } + + /* TODO: check for FAULT */ + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM)) { + printf(" ALARM"); + } + printf("\n"); + + if (type == MINMAX && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) + { + const sensors_feature_data *subfeature; + max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HYST)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HYST); + type = HYSTONLY; + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX) && + !TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + type = HYSTONLY; + } else { + type = SINGLE; + min = 0.0; + } + + subfeature = sensors_get_sub_feature_by_type(name, feature, i, j, + SENSORS_FEATURE_TEMP_CRIT); + if (subfeature) { + sensors_get_label_and_valid(*name, subfeature->number, &label, &valid); + + if (valid) { + print_label(label, PRINT_SENSORS_LABEL_SIZE); + free(label); + print_temp_info_real(max, min, 0, 0.0, type, 1, 0); + printf("\n"); + } + } + } +} + +#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] +#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] +static void print_generic_chip_in(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int j) +{ + const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; + int valid; + short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0, }; + double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0.0, }; + double val, alarm_max, alarm_min; + char *label; + + if (sensors_get_label_and_valid(*name, feature->number, &label, &valid)) { + free(label); + printf("ERROR: Can't get in data!\n"); + return; + } else if (!valid) { + free(label); + return; /* ignored */ + } + + if (get_feature_value(name, feature, &val)) { + printf("ERROR: Can't get %s data!\n", label); + return; + } + + sensors_get_available_features(name, feature, i, j, has_features, feature_vals, + size, SENSORS_FEATURE_IN); + + print_label(label, PRINT_SENSORS_LABEL_SIZE); + free(label); + printf("%+6.2f V", val); + + if (IN_FEATURE(SENSORS_FEATURE_IN_MAX)) { + printf(" (min = %+6.2f V, max = %+6.2f V)", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN), + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); + + if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM) && + IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { + alarm_max = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX_ALARM); + alarm_min = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN_ALARM); + + if (alarm_min || alarm_max) { + printf(" ALARM ("); + + if (alarm_min) + printf("MIN"); + if (alarm_max) + printf("%sMAX", (alarm_min) ? "," : ""); + + printf(")"); + } + } else if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { + printf(" %s", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_ALARM) > 0.5 ? "ALARM" : ""); + } + } + + printf("\n"); +} + +#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] +#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] +static void print_generic_chip_fan(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int j) +{ + char *label; + int valid; + const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; + short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = {0, }; + double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = {0.0, }; + double val; + + if (sensors_get_label_and_valid(*name, feature->number, &label, &valid)) { + printf("ERROR: Can't get fan data!\n"); + free(label); + return; + } else if (!valid) { + free(label); + return; /* ignored */ + } + + if (get_feature_value(name, feature, &val)) + { + printf("ERROR: Can't get %s data!\n", label); + free(label); + return; + } + + print_label(label, PRINT_SENSORS_LABEL_SIZE); + free(label); + printf("%4.0f RPM", val); + + sensors_get_available_features(name, feature, i, j, has_features, feature_vals, + size, SENSORS_FEATURE_FAN); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) { + printf(" (min = %4.0f RPM", FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN)); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) { + printf(", div = %1.0f", FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); + } + + printf(")"); + } + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM) && + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_ALARM)) { + printf(" ALARM"); + } + + printf("\n"); +} + +static void print_generic_chip_vid(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int j) +{ + const sensors_feature_data *vrm_feature; + + while((vrm_feature = sensors_get_all_features(*name, &i, &j))) { + if (sensors_feature_get_type(vrm_feature) == SENSORS_FEATURE_VRM) + break; + } + + if (vrm_feature != NULL) + print_vid_info_real(name, feature->number, vrm_feature->number, PRINT_SENSORS_LABEL_SIZE); + else + print_vid_info_real(name, feature->number, -1, PRINT_SENSORS_LABEL_SIZE); +} + +void print_generic_chip(const sensors_chip_name *name) +{ + const sensors_feature_data *feature; + int i,j; + + i = j = 0; + while((feature = sensors_get_all_features(*name, &i, &j))) { + if (feature->mapping != SENSORS_NO_MAPPING) + continue; + + switch(sensors_feature_get_type(feature)) { + case SENSORS_FEATURE_TEMP: + print_generic_chip_temp(name, feature, i, j); break; + case SENSORS_FEATURE_IN: + print_generic_chip_in(name, feature, i, j); break; + case SENSORS_FEATURE_FAN: + print_generic_chip_fan(name, feature, i, j); break; + case SENSORS_FEATURE_VID: + print_generic_chip_vid(name, feature, i, j); break; + default: continue; + } + } +} diff --git a/prog/sensors/chips_generic.h b/prog/sensors/chips_generic.h new file mode 100644 index 00000000..96eceb9d --- /dev/null +++ b/prog/sensors/chips_generic.h @@ -0,0 +1,29 @@ +/* + chips_generic.h - Part of sensors, a user-space program for hardware monitoring + Copyright (c) 1998-2003 Frodo Looijaard + and Mark D. Studebaker + Copyright (c) 2003-2006 The lm_sensors team + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef PROG_SENSORS_CHIPS_GENERIC_H +#define PROG_SENSORS_CHIPS_GENERIC_H + +#include "lib/sensors.h" + +void print_generic_chip(const sensors_chip_name *name); + +#endif From 78a521b1a83a66d066f75c93c7315038ae141234 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Apr 2007 14:52:28 +0000 Subject: [PATCH 008/718] Some fixes for problems with the dyn chip support / generic printing routines which showed up while testing with the abituguru driver git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4364 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 6 ++++++ prog/sensors/chips_generic.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/access.c b/lib/access.c index a0ca6175..57fe0784 100644 --- a/lib/access.c +++ b/lib/access.c @@ -535,9 +535,15 @@ sensors_feature_type sensors_feature_get_type( if (strlen(name) == 3 || strstr(name, "input")) return SENSORS_FEATURE_IN; + if (strstr(name, "max_alarm")) + return SENSORS_FEATURE_IN_MAX_ALARM; + if (strstr(name, "max")) return SENSORS_FEATURE_IN_MAX; + if (strstr(name, "min_alarm")) + return SENSORS_FEATURE_IN_MIN_ALARM; + if (strstr(name, "min")) return SENSORS_FEATURE_IN_MIN; diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 4b4f5101..f3287833 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -95,7 +95,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, char *label; int valid, type; const int size = SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP; - short has_features[SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP] = {0, }; + short has_features[SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP] = {0, 0, 0, 0, 0, 0, 0, 0, 0 }; double feature_vals[SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP] = {0.0, }; if (sensors_get_label_and_valid(*name, feature->number, &label, &valid)) { @@ -224,7 +224,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, { const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; int valid; - short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0, }; + short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0, 0, 0, 0, 0 }; double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0.0, }; double val, alarm_max, alarm_min; char *label; From 1b65a9674459e9721808a3e71e34b6b7ad5a5aeb Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Apr 2007 14:54:05 +0000 Subject: [PATCH 009/718] Dynamicly determine the maximum used label length in the generic chip printing routine git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4365 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 52 ++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index f3287833..27d65aba 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -20,12 +20,11 @@ */ #include +#include #include "chips_generic.h" #include "chips.h" -#define PRINT_SENSORS_LABEL_SIZE 12 - static int get_feature_value(const sensors_chip_name *name, const sensors_feature_data *feature, double *val) @@ -85,11 +84,28 @@ static void sensors_get_available_features(const sensors_chip_name *name, } } +static int sensors_get_label_size(const sensors_chip_name *name) +{ + int i, j, valid; + const sensors_feature_data *iter; + char *label; + int max_size = 11; /* Initialised to 11 as minumum label-width */ + + i = j = 0; + while((iter = sensors_get_all_features(*name, &i, &j))) { + if (!sensors_get_label_and_valid(*name, iter->number, &label, &valid) && + valid && strlen(label) > max_size) + max_size = strlen(label); + free(label); + } + return max_size + 1; +} + #define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] #define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] static void print_generic_chip_temp(const sensors_chip_name *name, const sensors_feature_data *feature, - int i, int j) + int i, int j, int label_size) { double val, max, min, lim = 0.0; char *label; @@ -168,7 +184,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, type = SINGLE; } - print_label(label, PRINT_SENSORS_LABEL_SIZE); + print_label(label, label_size); free(label); if (type == LIM) { @@ -207,7 +223,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, sensors_get_label_and_valid(*name, subfeature->number, &label, &valid); if (valid) { - print_label(label, PRINT_SENSORS_LABEL_SIZE); + print_label(label, label_size); free(label); print_temp_info_real(max, min, 0, 0.0, type, 1, 0); printf("\n"); @@ -220,7 +236,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, #define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] static void print_generic_chip_in(const sensors_chip_name *name, const sensors_feature_data *feature, - int i, int j) + int i, int j, int label_size) { const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; int valid; @@ -246,7 +262,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, sensors_get_available_features(name, feature, i, j, has_features, feature_vals, size, SENSORS_FEATURE_IN); - print_label(label, PRINT_SENSORS_LABEL_SIZE); + print_label(label, label_size); free(label); printf("%+6.2f V", val); @@ -283,7 +299,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, #define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] static void print_generic_chip_fan(const sensors_chip_name *name, const sensors_feature_data *feature, - int i, int j) + int i, int j, int label_size) { char *label; int valid; @@ -308,7 +324,7 @@ static void print_generic_chip_fan(const sensors_chip_name *name, return; } - print_label(label, PRINT_SENSORS_LABEL_SIZE); + print_label(label, label_size); free(label); printf("%4.0f RPM", val); @@ -335,7 +351,7 @@ static void print_generic_chip_fan(const sensors_chip_name *name, static void print_generic_chip_vid(const sensors_chip_name *name, const sensors_feature_data *feature, - int i, int j) + int i, int j, int label_size) { const sensors_feature_data *vrm_feature; @@ -345,15 +361,17 @@ static void print_generic_chip_vid(const sensors_chip_name *name, } if (vrm_feature != NULL) - print_vid_info_real(name, feature->number, vrm_feature->number, PRINT_SENSORS_LABEL_SIZE); + print_vid_info_real(name, feature->number, vrm_feature->number, label_size); else - print_vid_info_real(name, feature->number, -1, PRINT_SENSORS_LABEL_SIZE); + print_vid_info_real(name, feature->number, -1, label_size); } void print_generic_chip(const sensors_chip_name *name) { const sensors_feature_data *feature; - int i,j; + int i,j, label_size; + + label_size = sensors_get_label_size(name); i = j = 0; while((feature = sensors_get_all_features(*name, &i, &j))) { @@ -362,13 +380,13 @@ void print_generic_chip(const sensors_chip_name *name) switch(sensors_feature_get_type(feature)) { case SENSORS_FEATURE_TEMP: - print_generic_chip_temp(name, feature, i, j); break; + print_generic_chip_temp(name, feature, i, j, label_size); break; case SENSORS_FEATURE_IN: - print_generic_chip_in(name, feature, i, j); break; + print_generic_chip_in(name, feature, i, j, label_size); break; case SENSORS_FEATURE_FAN: - print_generic_chip_fan(name, feature, i, j); break; + print_generic_chip_fan(name, feature, i, j, label_size); break; case SENSORS_FEATURE_VID: - print_generic_chip_vid(name, feature, i, j); break; + print_generic_chip_vid(name, feature, i, j, label_size); break; default: continue; } } From ba5140b3d873fe9c90af2fb1c49579b7846c8493 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Apr 2007 17:48:57 +0000 Subject: [PATCH 010/718] Generic chip support / get featuretype fixes just received from Bob Schlarmann, as the version I committed wasn't the latest version git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4366 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 153 ++++++++++++++++++++++------------- lib/sensors.h | 19 +++-- prog/sensors/chips_generic.c | 20 ++++- 3 files changed, 124 insertions(+), 68 deletions(-) diff --git a/lib/access.c b/lib/access.c index 57fe0784..d92b4db3 100644 --- a/lib/access.c +++ b/lib/access.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "access.h" #include "sensors.h" #include "data.h" @@ -27,6 +28,13 @@ #include "proc.h" #include "general.h" +#define GET_TYPE_REGEX "\\([[:alpha:]]\\{1,\\}\\)[[:digit:]]\\{0,\\}\\(_\\([[:alpha:]]\\{1,\\}\\)\\)\\{0,1\\}" + +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (const char *)__mptr - offsetof(type,member) );}) + static int sensors_do_this_chip_sets(sensors_chip_name name); /* Compare two chips name descriptions, to see whether they could match. @@ -497,72 +505,101 @@ int sensors_do_all_sets(void) return sensors_do_chip_sets(name); } +/* Static mappings for use by sensors_feature_get_type() */ +struct feature_type_match +{ + const char *name; + sensors_feature_type type; + + struct feature_type_match *submatches; +}; + +static struct feature_type_match temp_matches[] = { + { "max", SENSORS_FEATURE_TEMP_MAX }, + { "min", SENSORS_FEATURE_TEMP_MIN }, + { "type", SENSORS_FEATURE_TEMP_SENS }, + { "hyst", SENSORS_FEATURE_TEMP_HYST }, + { "over", SENSORS_FEATURE_TEMP_OVER }, + { "max", SENSORS_FEATURE_TEMP_MAX }, + { "min", SENSORS_FEATURE_TEMP_MIN }, + { "low", SENSORS_FEATURE_TEMP_LOW }, + { "crit", SENSORS_FEATURE_TEMP_CRIT }, + { "fault", SENSORS_FEATURE_TEMP_FAULT }, + { "alarm", SENSORS_FEATURE_TEMP_ALARM }, + { "type", SENSORS_FEATURE_TEMP_SENS }, + { 0 } +}; + +static struct feature_type_match in_matches[] = { + { "max", SENSORS_FEATURE_IN_MAX }, + { "max_alarm", SENSORS_FEATURE_IN_MAX_ALARM }, + { "min", SENSORS_FEATURE_IN_MIN }, + { "min_alarm", SENSORS_FEATURE_IN_MIN_ALARM }, + { "alarm", SENSORS_FEATURE_IN_ALARM }, + { 0 } +}; + +static struct feature_type_match fan_matches[] = { + { "min", SENSORS_FEATURE_FAN_MIN }, + { "div", SENSORS_FEATURE_FAN_DIV }, + { "alarm", SENSORS_FEATURE_FAN_ALARM }, + { "fault", SENSORS_FEATURE_FAN_FAULT }, + { 0 } +}; + +static struct feature_type_match matches[] = { + { "temp", SENSORS_FEATURE_TEMP, temp_matches }, + { "in", SENSORS_FEATURE_IN, in_matches }, + { "fan", SENSORS_FEATURE_FAN, fan_matches }, + { "vrm", SENSORS_FEATURE_VRM, 0 }, + { "vid", SENSORS_FEATURE_VID, 0 }, + { "sensor", SENSORS_FEATURE_TEMP_SENS, 0 }, + { 0 } +}; + /* Return the feature type based on the feature name */ sensors_feature_type sensors_feature_get_type( const sensors_feature_data *feature) { - const char *name; + const char *name; + regex_t preg; + regmatch_t pmatch[4]; + int size_first, size_second, retval, i; + struct feature_type_match *submatches; - /* this will only work when the sensors_chip_feature is obtained through - sensors_get_all_features */ - if (((const struct sensors_chip_feature *)feature)->sysname) - name = ((const struct sensors_chip_feature *)feature)->sysname; + /* use sysname if exists */ + if (container_of(feature, const struct sensors_chip_feature, data)->sysname) + name = container_of(feature, const struct sensors_chip_feature, data)->sysname; else name = feature->name; - if (strstr(name, "temp")) { - if (strlen(name) == 5) - return SENSORS_FEATURE_TEMP; - - if (strstr(name, "hyst")) - return SENSORS_FEATURE_TEMP_HYST; - - if (strstr(name, "over")) - return SENSORS_FEATURE_TEMP_OVER; - - if (strstr(name, "max")) - return SENSORS_FEATURE_TEMP_MAX; - - if (strstr(name, "min")) - return SENSORS_FEATURE_TEMP_MIN; - - if (strstr(name, "low")) - return SENSORS_FEATURE_TEMP_LOW; - - if (strstr(name, "crit")) - return SENSORS_FEATURE_TEMP_CRIT; - } else if (strstr(name, "in") && name[0] != 'f') { - if (strlen(name) == 3 || strstr(name, "input")) - return SENSORS_FEATURE_IN; - - if (strstr(name, "max_alarm")) - return SENSORS_FEATURE_IN_MAX_ALARM; - - if (strstr(name, "max")) - return SENSORS_FEATURE_IN_MAX; - - if (strstr(name, "min_alarm")) - return SENSORS_FEATURE_IN_MIN_ALARM; - - if (strstr(name, "min")) - return SENSORS_FEATURE_IN_MIN; - - if (strstr(name, "alarm")) - return SENSORS_FEATURE_IN_ALARM; - } else if (strstr(name, "fan")) { - if (strlen(name) == 4) - return SENSORS_FEATURE_FAN; - - if (strstr(name, "min")) - return SENSORS_FEATURE_FAN_MIN; - - if (strstr(name, "div")) - return SENSORS_FEATURE_FAN_DIV; - } else if (!strcmp(name, "vrm")) { - return SENSORS_FEATURE_VRM; - } else if (strstr(name, "vid")) { - return SENSORS_FEATURE_VID; - } + regcomp(&preg, GET_TYPE_REGEX, 0); + + retval = regexec(&preg, name, 4, pmatch, 0); + + regfree(&preg); + + if (retval == -1) + return SENSORS_FEATURE_UNKNOWN; + + size_first = pmatch[1].rm_eo - pmatch[1].rm_so; + size_second = pmatch[3].rm_eo - pmatch[3].rm_so; + + for(i = 0; matches[i].name != 0; i++) + if (!strncmp(name, matches[i].name, size_first)) + break; + + if (matches[i].name == NULL) /* no match */ + return SENSORS_FEATURE_UNKNOWN; + else if (size_second == 0) /* single type */ + return matches[i].type; + else if (matches[i].submatches == NULL) /* not single type, but no submatches */ + return SENSORS_FEATURE_UNKNOWN; + + submatches = matches[i].submatches; + for(i = 0; submatches[i].name != 0; i++) + if (!strncmp(name + pmatch[3].rm_so, submatches[i].name, size_second)) + return submatches[i].type; return SENSORS_FEATURE_UNKNOWN; } diff --git a/lib/sensors.h b/lib/sensors.h index eeaca583..8e50482b 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -21,6 +21,7 @@ #define LIB_SENSORS_SENSORS_H #include +#include /* Publicly accessible library functions */ @@ -147,8 +148,10 @@ extern const sensors_feature_data *sensors_get_all_features (sensors_chip_name name, int *nr1,int *nr2); typedef enum sensors_feature_type { - SENSORS_FEATURE_TEMP = 0, + SENSORS_FEATURE_TEMP = 0x0, SENSORS_FEATURE_TEMP_ALARM, + SENSORS_FEATURE_TEMP_FAULT, + SENSORS_FEATURE_TEMP_SENS, SENSORS_FEATURE_TEMP_HYST, SENSORS_FEATURE_TEMP_OVER, SENSORS_FEATURE_TEMP_MAX, @@ -158,26 +161,28 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_TEMP_LIM, SENSORS_FEATURE_TEMP_CRIT, - SENSORS_FEATURE_IN, + SENSORS_FEATURE_IN = 0x100, SENSORS_FEATURE_IN_ALARM, SENSORS_FEATURE_IN_MIN, SENSORS_FEATURE_IN_MAX, SENSORS_FEATURE_IN_MIN_ALARM, SENSORS_FEATURE_IN_MAX_ALARM, - SENSORS_FEATURE_FAN, + SENSORS_FEATURE_FAN = 0x200, SENSORS_FEATURE_FAN_ALARM, + SENSORS_FEATURE_FAN_FAULT, SENSORS_FEATURE_FAN_MIN, SENSORS_FEATURE_FAN_DIV, - SENSORS_FEATURE_VID, + SENSORS_FEATURE_VID = 0x300, SENSORS_FEATURE_VRM, - SENSORS_FEATURE_UNKNOWN + SENSORS_FEATURE_UNKNOWN = INT_MAX } sensors_feature_type; -sensors_feature_type sensors_feature_get_type( - const sensors_feature_data *feature); +sensors_feature_type sensors_feature_get_type + (const sensors_feature_data *feature); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 27d65aba..b2bfb2f8 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -193,9 +193,23 @@ static void print_generic_chip_temp(const sensors_chip_name *name, print_temp_info_real(val, max, min, 0.0, type, 1, 1); } - /* TODO: check for FAULT */ - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM)) { + /* print out temperature sensor info */ + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { + int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_SENS); + printf("sensor = %s ", sens == 0 ? "disabled" : + sens == 1 ? "diode" : + sens == 2 ? "transistor" : + sens == 3 ? "thermal diode" : + sens == 4 ? "thermistor" : + "unkown"); + } + + /* ALARM and FAULT features */ + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT) > 0.5) { + printf(" FAULT"); + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) { printf(" ALARM"); } printf("\n"); From 16408d86652edac4b7c013d523490c2edcc6ccdc Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Apr 2007 18:07:07 +0000 Subject: [PATCH 011/718] -comment abituguru entry in lib/chips.c and prog/sensors/main.c, as the abituguru seems to work well with the new dynamic chip support and generic chip printroutines. note: the abituguru code should be completly removed in the future. -comment k8temp entry in lib/chips.c and prog/sensors/main.c, as the k8temp seems to work well with the new dynamic chip support and generic chip printroutines. note: the k8temp code should be completly removed in the future. -make the match for the subtype exact instead of a strncmp, otherwise an alarm_enable flag gets classified as an alarm, leading to all sensors who have their alarm enabled getting an alarm reported, as the alarm_enabled gets read as alarm. -and do the same for the _input match to check if this is a main or subfeature git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4367 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 2 +- lib/chips.c | 4 ++-- lib/sysfs.c | 3 +-- prog/sensors/main.c | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/access.c b/lib/access.c index d92b4db3..ce951e39 100644 --- a/lib/access.c +++ b/lib/access.c @@ -598,7 +598,7 @@ sensors_feature_type sensors_feature_get_type( submatches = matches[i].submatches; for(i = 0; submatches[i].name != 0; i++) - if (!strncmp(name + pmatch[3].rm_so, submatches[i].name, size_second)) + if (!strcmp(name + pmatch[3].rm_so, submatches[i].name)) return submatches[i].type; return SENSORS_FEATURE_UNKNOWN; diff --git a/lib/chips.c b/lib/chips.c index 8d4e5090..b9f6f214 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -6159,8 +6159,8 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_SMSC47B397_PREFIX, smsc47b397_features }, { SENSORS_F71805F_PREFIX, f71805f_features }, { SENSORS_F71872F_PREFIX, f71805f_features }, - { SENSORS_ABITUGURU_PREFIX, abituguru_features }, - { SENSORS_K8TEMP_PREFIX, k8temp_features }, +// { SENSORS_ABITUGURU_PREFIX, abituguru_features }, +// { SENSORS_K8TEMP_PREFIX, k8temp_features }, { SENSORS_CORETEMP_PREFIX, coretemp_features }, { SENSORS_DME1737_PREFIX, dme1737_features }, PLACEHOLDER_ELEMENTS, diff --git a/lib/sysfs.c b/lib/sysfs.c index dadcb203..52880b44 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -96,8 +96,7 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) feature.data.compute_mapping = SENSORS_NO_MAPPING; if (pmatch[2].rm_so != -1) { - if (!strncmp(name + pmatch[2].rm_so, "_input", - pmatch[2].rm_eo - pmatch[2].rm_so)) { + if (!strcmp(name + pmatch[2].rm_so, "_input")) { int last_match; /* copy only the part before the _ */ diff --git a/prog/sensors/main.c b/prog/sensors/main.c index ca0f2f82..df18e8aa 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -425,8 +425,8 @@ struct match matches[] = { { "smsc47b397", print_smsc47b397 }, { "f71805f", print_f71805f }, { "f71872f", print_f71805f }, - { "abituguru", print_abituguru }, - { "k8temp", print_k8temp }, +// { "abituguru", print_abituguru }, +// { "k8temp", print_k8temp }, { "coretemp", print_coretemp }, { "dme1737", print_dme1737 }, { NULL, NULL } From bd74aa23900d701044e0b84acbb1b8aaae686f22 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 10 Apr 2007 11:51:07 +0000 Subject: [PATCH 012/718] -rewrite dyn chip code, it now uses sensors_feature_get_type() to identify sysfs entries. Reasons for this rewrite / bugs fixed: -Don't give features like alarms / sensor type / fault flag a compute mapping only a normal mapping -Don't generate features for sysfs entries like uvent, modalias, etc. instead only generate features for features known by sensors_feature_get_type() -Sort the list of found features logically instead of sorted in alphabet order of the sysfs entry. So now it starts with all in entries, then all fan and then all temp. Just like the order of most entries in lib/chips.c. Also this means that it now contains in0 - in10 in that order and not in0, in10, in1 - in9 git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4368 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 23 ++--- lib/sensors.h | 44 ++++---- lib/sysfs.c | 192 ++++++++++++++++++----------------- prog/sensors/chips_generic.c | 8 +- 4 files changed, 140 insertions(+), 127 deletions(-) diff --git a/lib/access.c b/lib/access.c index ce951e39..3285468d 100644 --- a/lib/access.c +++ b/lib/access.c @@ -515,27 +515,24 @@ struct feature_type_match }; static struct feature_type_match temp_matches[] = { - { "max", SENSORS_FEATURE_TEMP_MAX }, - { "min", SENSORS_FEATURE_TEMP_MIN }, - { "type", SENSORS_FEATURE_TEMP_SENS }, { "hyst", SENSORS_FEATURE_TEMP_HYST }, { "over", SENSORS_FEATURE_TEMP_OVER }, { "max", SENSORS_FEATURE_TEMP_MAX }, { "min", SENSORS_FEATURE_TEMP_MIN }, { "low", SENSORS_FEATURE_TEMP_LOW }, { "crit", SENSORS_FEATURE_TEMP_CRIT }, - { "fault", SENSORS_FEATURE_TEMP_FAULT }, { "alarm", SENSORS_FEATURE_TEMP_ALARM }, + { "fault", SENSORS_FEATURE_TEMP_FAULT }, { "type", SENSORS_FEATURE_TEMP_SENS }, { 0 } }; static struct feature_type_match in_matches[] = { - { "max", SENSORS_FEATURE_IN_MAX }, - { "max_alarm", SENSORS_FEATURE_IN_MAX_ALARM }, { "min", SENSORS_FEATURE_IN_MIN }, - { "min_alarm", SENSORS_FEATURE_IN_MIN_ALARM }, + { "max", SENSORS_FEATURE_IN_MAX }, { "alarm", SENSORS_FEATURE_IN_ALARM }, + { "min_alarm", SENSORS_FEATURE_IN_MIN_ALARM }, + { "max_alarm", SENSORS_FEATURE_IN_MAX_ALARM }, { 0 } }; @@ -562,10 +559,11 @@ sensors_feature_type sensors_feature_get_type( const sensors_feature_data *feature) { const char *name; - regex_t preg; regmatch_t pmatch[4]; int size_first, size_second, retval, i; struct feature_type_match *submatches; + static regex_t reg; + static regex_t *preg = NULL; /* use sysname if exists */ if (container_of(feature, const struct sensors_chip_feature, data)->sysname) @@ -573,11 +571,12 @@ sensors_feature_type sensors_feature_get_type( else name = feature->name; - regcomp(&preg, GET_TYPE_REGEX, 0); + if (!preg) { + regcomp(®, GET_TYPE_REGEX, 0); + preg = ® + } - retval = regexec(&preg, name, 4, pmatch, 0); - - regfree(&preg); + retval = regexec(preg, name, 4, pmatch, 0); if (retval == -1) return SENSORS_FEATURE_UNKNOWN; diff --git a/lib/sensors.h b/lib/sensors.h index 8e50482b..29c560cb 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -147,11 +147,25 @@ typedef struct sensors_feature_data { extern const sensors_feature_data *sensors_get_all_features (sensors_chip_name name, int *nr1,int *nr2); +/* This enum contains some "magic" used by sensors_read_dynamic_chip() from + lib/sysfs.c . All the sensor-types (in, fan, temp, misc) are a multiple of + 0x100 apart, and sensor features which should not have a compute_mapping to + the _input feature start at 0x?10. */ typedef enum sensors_feature_type { - SENSORS_FEATURE_TEMP = 0x0, - SENSORS_FEATURE_TEMP_ALARM, - SENSORS_FEATURE_TEMP_FAULT, - SENSORS_FEATURE_TEMP_SENS, + SENSORS_FEATURE_IN = 0x000, + SENSORS_FEATURE_IN_MIN, + SENSORS_FEATURE_IN_MAX, + SENSORS_FEATURE_IN_ALARM = 0x010, + SENSORS_FEATURE_IN_MIN_ALARM, + SENSORS_FEATURE_IN_MAX_ALARM, + + SENSORS_FEATURE_FAN = 0x100, + SENSORS_FEATURE_FAN_MIN, + SENSORS_FEATURE_FAN_ALARM = 0x110, + SENSORS_FEATURE_FAN_FAULT, + SENSORS_FEATURE_FAN_DIV, + + SENSORS_FEATURE_TEMP = 0x200, SENSORS_FEATURE_TEMP_HYST, SENSORS_FEATURE_TEMP_OVER, SENSORS_FEATURE_TEMP_MAX, @@ -160,24 +174,18 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_TEMP_LOW, SENSORS_FEATURE_TEMP_LIM, SENSORS_FEATURE_TEMP_CRIT, - - SENSORS_FEATURE_IN = 0x100, - SENSORS_FEATURE_IN_ALARM, - SENSORS_FEATURE_IN_MIN, - SENSORS_FEATURE_IN_MAX, - SENSORS_FEATURE_IN_MIN_ALARM, - SENSORS_FEATURE_IN_MAX_ALARM, - - SENSORS_FEATURE_FAN = 0x200, - SENSORS_FEATURE_FAN_ALARM, - SENSORS_FEATURE_FAN_FAULT, - SENSORS_FEATURE_FAN_MIN, - SENSORS_FEATURE_FAN_DIV, + SENSORS_FEATURE_TEMP_ALARM = 0x210, + SENSORS_FEATURE_TEMP_FAULT, + SENSORS_FEATURE_TEMP_SENS, SENSORS_FEATURE_VID = 0x300, SENSORS_FEATURE_VRM, - SENSORS_FEATURE_UNKNOWN = INT_MAX + SENSORS_FEATURE_UNKNOWN = INT_MAX, + + /* special the largest number of subfeatures used, iow the + highest ## from all the 0x?## above + 1*/ + SENSORS_FEATURE_MAX_SUB_FEATURES = 19 } sensors_feature_type; sensors_feature_type sensors_feature_get_type diff --git a/lib/sysfs.c b/lib/sysfs.c index 52880b44..ce9c109f 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -21,10 +21,10 @@ #define _GNU_SOURCE #include +#include #include #include #include -#include #include "data.h" #include "error.h" #include "access.h" @@ -35,130 +35,136 @@ int sensors_found_sysfs = 0; char sensors_sysfs_mount[NAME_MAX]; -#define DYNAMIC_CHIP_REGEX "\\([[:alpha:]]\\{1,\\}[[:digit:]]\\{0,\\}\\)\\(\\_[[:alpha:]]\\{1,\\}\\)\\{0,1\\}" - -static int sensors_read_dynamic_chip_check_mapping( - sensors_chip_feature *minor, - sensors_chip_feature *major, - regmatch_t *pmatch) -{ - if (pmatch[1].rm_so == -1 || pmatch[2].rm_so == -1 || - strncmp(minor->data.name, major->data.name, - pmatch[1].rm_eo - pmatch[1].rm_so)) { - return 0; - } else { - minor->data.mapping = - minor->data.compute_mapping = - major->data.number; - - return 1; - } -} +#define MAX_SENSORS_PER_TYPE 16 static sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) { - int fnum = 1, i, last_major = -1; + int i, type, fnum = 1; struct sysfs_attribute *attr; struct dlist *attrs; sensors_chip_features ret = {0, 0}; - sensors_chip_feature features[256], *dyn_features; - regex_t preg; - regmatch_t pmatch[3]; + /* room for all 3 (in, fan, temp) types, with all their subfeatures + + misc features. We use a large sparse table at first to store all + found features, so that we can store them sorted at type and index + and then later create a dense sorted table */ + sensors_chip_feature features[MAX_SENSORS_PER_TYPE * + SENSORS_FEATURE_MAX_SUB_FEATURES * 3 + + SENSORS_FEATURE_MAX_SUB_FEATURES]; + sensors_chip_feature *dyn_features; char *name; attrs = sysfs_get_device_attributes(sysdir); if (attrs == NULL) return ret; - - regcomp(&preg, DYNAMIC_CHIP_REGEX, 0); + memset(features, 0, sizeof(features)); + dlist_for_each_data(attrs, attr, struct sysfs_attribute) { - sensors_chip_feature feature = { { 0, }, 0, }; + sensors_chip_feature feature = { { 0, }, 0, }; name = attr->name; if (!strcmp(name, "name")) { ret.prefix = strndup(attr->value, strlen(attr->value) - 1); continue; - } else if (regexec(&preg, name, 3, pmatch, 0) != 0) { + } + + /* check for _input extension and remove */ + i = strlen(name); + if (i > 6 && !strcmp(name + i - 6, "_input")) + feature.data.name = strndup(name, i-6); + else + feature.data.name = strdup(name); + + type = sensors_feature_get_type(&feature.data); + if (type == SENSORS_FEATURE_UNKNOWN) { + free((char *)feature.data.name); + continue; + } + + /* Get N as in this is the N-th in / fan / temp sensor */ + switch (type & 0xFF00) { + case SENSORS_FEATURE_IN: + i = strtol(name + 2, NULL, 10); + break; + case SENSORS_FEATURE_FAN: + i = strtol(name + 3, NULL, 10); + if (i) i--; + break; + case SENSORS_FEATURE_TEMP: + i = strtol(name + 4, NULL, 10); + if (i) i--; + break; + case SENSORS_FEATURE_VID: /* first misc feature */ + i = 0; + break; + } + + if (i >= MAX_SENSORS_PER_TYPE) { + fprintf(stderr, "libsensors error, more sensors of one" + " type then MAX_SENSORS_PER_TYPE, ignoring " + "feature: %s\n", name); + free((char *)feature.data.name); continue; } - feature.data.number = fnum; - feature.data.mode = (attr->method & (SYSFS_METHOD_SHOW|SYSFS_METHOD_STORE)) == - (SYSFS_METHOD_SHOW|SYSFS_METHOD_STORE) ? - SENSORS_MODE_RW : - (attr->method & SYSFS_METHOD_SHOW) ? SENSORS_MODE_R : - (attr->method & SYSFS_METHOD_STORE) ? SENSORS_MODE_W : - SENSORS_MODE_NO_RW; - feature.data.mapping = SENSORS_NO_MAPPING; - feature.data.compute_mapping = SENSORS_NO_MAPPING; - - if (pmatch[2].rm_so != -1) { - if (!strcmp(name + pmatch[2].rm_so, "_input")) { - int last_match; - - /* copy only the part before the _ */ - feature.data.name = strndup(name, - pmatch[1].rm_eo - pmatch[1].rm_so); - - /* check if the features previously read are sub devices of this major - and update their mapping accordingly */ - last_match = fnum - 1; - for(i = fnum - 2; i >= 0; i--) { - if (regexec(&preg, features[i].data.name, 3, pmatch, 0) == -1 || - !sensors_read_dynamic_chip_check_mapping(&features[i], - &feature, pmatch)) { - break; - } else { - last_match = i; - } - } - - /* if so the major should be in the list before any minor feature, - so swap with the oldest read */ - if (last_match < fnum - 1) { - sensors_chip_feature tmp = features[last_match]; - features[last_match] = feature; - features[fnum - 1] = tmp; - - last_major = last_match; - - goto NEXT_NUM; /* NOTE: goto used */ - } else { - last_major = fnum - 1; - } - - } else { - feature.data.name = strdup(name); - - if (last_major != -1 && - !sensors_read_dynamic_chip_check_mapping(&feature, - &features[last_major], pmatch)) { - last_major = -1; /* no more features for current major */ - } - } - } else { - feature.data.name = strdup(name); + /* "calculate" a place to store the feature in our sparse, + sorted table */ + i = (type >> 8) * MAX_SENSORS_PER_TYPE * + SENSORS_FEATURE_MAX_SUB_FEATURES + + i * SENSORS_FEATURE_MAX_SUB_FEATURES + (type & 0xFF); + + if (features[i].data.name) { + fprintf(stderr, "libsensors error, trying to add dupli" + "cate feature: %s to dynamic feature table\n", + name); + free((char *)feature.data.name); + continue; } + + /* fill in the other feature members */ + feature.data.number = i + 1; - features[fnum - 1] = feature; -NEXT_NUM: + if ( (type & 0xFF00) == SENSORS_FEATURE_VID || + (type & 0x00FF) == 0) { + /* misc sensor or main feature */ + feature.data.mapping = SENSORS_NO_MAPPING; + feature.data.compute_mapping = SENSORS_NO_MAPPING; + } else if (type & 0x10) { + /* sub feature without compute mapping */ + feature.data.mapping = i - + i % SENSORS_FEATURE_MAX_SUB_FEATURES + 1; + feature.data.compute_mapping = SENSORS_NO_MAPPING; + } else { + feature.data.mapping = i - + i % SENSORS_FEATURE_MAX_SUB_FEATURES + 1; + feature.data.compute_mapping = feature.data.mapping; + } + + feature.data.mode = + (attr->method & (SYSFS_METHOD_SHOW|SYSFS_METHOD_STORE)) + == (SYSFS_METHOD_SHOW|SYSFS_METHOD_STORE) ? + SENSORS_MODE_RW : (attr->method & SYSFS_METHOD_SHOW) ? + SENSORS_MODE_R : (attr->method & SYSFS_METHOD_STORE) ? + SENSORS_MODE_W : SENSORS_MODE_NO_RW; + + features[i] = feature; fnum++; } - - regfree(&preg); - - dyn_features = malloc(sizeof(sensors_chip_feature) * fnum); + + dyn_features = calloc(fnum, sizeof(sensors_chip_feature)); if (dyn_features == NULL) { sensors_fatal_error(__FUNCTION__,"Out of memory"); } - for(i = 0; i < fnum - 1; i++) { - dyn_features[i] = features[i]; + fnum = 0; + for(i = 0; i < sizeof(features)/sizeof(sensors_chip_feature); i++) { + if (features[i].data.name) { + dyn_features[fnum] = features[i]; + fnum++; + } } - dyn_features[fnum - 1].data.name = 0; ret.feature = dyn_features; diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index b2bfb2f8..fed9cf6c 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -110,9 +110,9 @@ static void print_generic_chip_temp(const sensors_chip_name *name, double val, max, min, lim = 0.0; char *label; int valid, type; - const int size = SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP; - short has_features[SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP] = {0, 0, 0, 0, 0, 0, 0, 0, 0 }; - double feature_vals[SENSORS_FEATURE_TEMP_CRIT - SENSORS_FEATURE_TEMP] = {0.0, }; + const int size = SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP; + short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0, }; + double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0.0, }; if (sensors_get_label_and_valid(*name, feature->number, &label, &valid)) { free(label); @@ -254,7 +254,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, { const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; int valid; - short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0, 0, 0, 0, 0 }; + short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0, }; double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0.0, }; double val, alarm_max, alarm_min; char *label; From 0aa21043416211327edc341163972b0cdab78d95 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 20 Apr 2007 05:47:23 +0000 Subject: [PATCH 013/718] sens_update_rrd: Drop support for 2.4 kernels, add support for hwmon class devices (kernels >= 2.6.14). Original patch by Jeff Kosowsky. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4371 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/rrd/sens_update_rrd | 128 +++++++++++++-------------------------- 2 files changed, 44 insertions(+), 85 deletions(-) diff --git a/CHANGES b/CHANGES index b5e1c5ba..32367431 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ SVN HEAD Library: Clean up pwm symbol names translation Add dme1737 support Program isadump: Detect when address bit 7 is a busy flag + Program sens_update_rrd: Support only hwmon class devices Program sensors: Drop ddcmon and eeprom support Add dme1737 support Program sensors-detect: Stop Super-I/O probe after first family success diff --git a/prog/rrd/sens_update_rrd b/prog/rrd/sens_update_rrd index e8b28b6b..65920531 100755 --- a/prog/rrd/sens_update_rrd +++ b/prog/rrd/sens_update_rrd @@ -2,9 +2,9 @@ # sens_update_rrd - # Update a sensors rrd database. # Sample usage: -# sens_update_rrd /var/lib/database.rrd w83781d-isa-0290 +# sens_update_rrd /var/lib/database.rrd hwmon0 # Sample cron entry: -# */5 * * * * /usr/local/bin/sens_update_rrd /var/lib/sensors-rrd/sensors.rrd w83781d-isa-0290 +# */5 * * * * /usr/local/bin/sens_update_rrd /var/lib/sensors-rrd/sensors.rrd hwmon0 # ################################################################# # @@ -26,102 +26,60 @@ # ################################################################# # -if [ $# -ne 2 ] +if [ $# -lt 1 -o $# -gt 2 ] then - echo "usage: $0 database.rrd sensor" - echo " sensor example: w83781d-isa-0290 (2.4) or 0-0290 (2.6)" + echo "usage: $0 database.rrd [hwmonN]" exit 1 +elif [ $# -eq 2 ] +then + HWMON=$2 +else + HWMON=hwmon0 fi # RRDPATH=/usr/local/rrdtool/bin RRDB=$1 -SENSDIR=/proc/sys/dev/sensors -SDIR=/sys/bus/i2c/devices -if [ ! -d $SENSDIR ] -then - if [ ! -d $SDIR ] - then - echo $0: 'No sensors found! (modprobe sensor modules?)' - exit 1 - else - SYSFS=1 - SENSDIR=$SDIR - fi -fi +SENSDIR=/sys/class/hwmon +SENS=$SENSDIR/$HWMON/device -SENSDEV=$2 -SENS=$SENSDIR/$SENSDEV -if [ ! -r $SENS ] +if [ ! -d $SENS ] then - echo $0: 'No sensors found! (modprobe sensor modules?)' + echo "No sensors found in: $SENS" + echo "(modprobe sensor modules?)" exit 1 fi STRING=N -if [ "$SYSFS" = "1" ] -then - # - # Get the value from these sensor files (/sys) - # - SENSORS="fan1 fan2 fan3" - for i in $SENSORS - do - V="`cat $SENSDIR/$SENSDEV/${i}_input 2> /dev/null`" - if [ $? -ne 0 ] - then - STRING="${STRING}:U" - else - STRING="${STRING}:${V}" - fi - done - # - # Get the value from these sensor files (/sys) and divide by 1000 - # - SENSORS="temp1 temp2 temp3 in0 in1 in2 in3 in4 in5 in6" - for i in $SENSORS - do - V="`cat $SENSDIR/$SENSDEV/${i}_input 2> /dev/null`" - if [ $? -ne 0 ] - then - STRING="${STRING}:U" - else - V=`echo "3k0 ${V/-/_} 1000/p"|dc` - STRING="${STRING}:${V}" - fi - done -else - # - # Get the second value from these sensor files (/proc) - # - SENSORS="fan1 fan2 fan3" - for i in $SENSORS - do - V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" - if [ $? -ne 0 ] - then - STRING="${STRING}:U" - else - V="`echo $V | cut -d ' ' -f 2`" - STRING="${STRING}:${V}" - fi - done - # - # Get the third value from these sensor files (/proc) - # - SENSORS="temp1 temp2 temp3 in0 in1 in2 in3 in4 in5 in6" - for i in $SENSORS - do - V="`cat $SENSDIR/$SENSDEV/$i 2> /dev/null`" - if [ $? -ne 0 ] - then - STRING="${STRING}:U" - else - V="`echo $V | cut -d ' ' -f 3`" - STRING="${STRING}:${V}" - fi - done -fi +# +# Get the value from these sensor files (/sys) +# +SENSORS="fan1 fan2 fan3" +for i in $SENSORS +do + V="`cat $SENS/${i}_input 2> /dev/null`" + if [ $? -ne 0 ] + then + STRING="${STRING}:U" + else + STRING="${STRING}:${V}" + fi +done +# +# Get the value from these sensor files (/sys) and divide by 1000 +# +SENSORS="temp1 temp2 temp3 in0 in1 in2 in3 in4 in5 in6" +for i in $SENSORS +do + V="`cat $SENS/${i}_input 2> /dev/null`" + if [ $? -ne 0 ] + then + STRING="${STRING}:U" + else + V=`echo "3k0 ${V/-/_} 1000/p"|dc` + STRING="${STRING}:${V}" + fi +done # # Get the first value from these /proc files From ba7cb8eeca12ab23d5599ea499172f206ea8aaf0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 20 Apr 2007 13:09:41 +0000 Subject: [PATCH 014/718] rrd: Misc updates * More hwmon class changes * Look for rrd in /usr/bin by default * Add missing shell declarations * Update URI git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4372 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 5 ++++- prog/rrd/Makefile | 10 +++------- prog/rrd/README | 13 +++++-------- prog/rrd/sens_create_rrd | 3 ++- prog/rrd/sens_day.in | 5 ++--- prog/rrd/sens_update_rrd | 3 ++- prog/rrd/sens_week.in | 5 ++--- prog/rrd/summ_week.in | 5 ++--- 8 files changed, 22 insertions(+), 27 deletions(-) diff --git a/CHANGES b/CHANGES index 32367431..c5c02af6 100644 --- a/CHANGES +++ b/CHANGES @@ -6,7 +6,10 @@ SVN HEAD Library: Clean up pwm symbol names translation Add dme1737 support Program isadump: Detect when address bit 7 is a busy flag - Program sens_update_rrd: Support only hwmon class devices + Program rrd: Support only hwmon class devices + Look for rrd in /usr/bin by default + Add missing shell declarations + Update URI Program sensors: Drop ddcmon and eeprom support Add dme1737 support Program sensors-detect: Stop Super-I/O probe after first family success diff --git a/prog/rrd/Makefile b/prog/rrd/Makefile index 0190418a..87554293 100644 --- a/prog/rrd/Makefile +++ b/prog/rrd/Makefile @@ -4,18 +4,14 @@ USER=apache # CRONTAB not used #CRONTAB=/var/spool/cron/tabs/$(USER) -RRDPATH=/usr/local/rrdtool/bin +RRDPATH=/usr/bin BINPATH=/usr/local/bin RRDDIR=/var/lib/sensors-rrd APACHE=/var/www/html APACHDIR=$(APACHE)/senspix MACH=`uname -n` -# 2.4 kernels -#SENSDEV=w83781d-isa-0290 -#SENSDIR=/proc/sys/dev/sensors/$(SENSDEV) -# 2.6 kernels -SENSDEV=0-0290 -SENSDIR=/sys/bus/i2c/devices/$(SENSDEV) +SENSDEV=hwmon0 +SENSDIR=/sys/class/hwmon/$(SENSDEV)/device ################################################ # Everything below here should be fine # diff --git a/prog/rrd/README b/prog/rrd/README index b9cb0433..89ab85c4 100644 --- a/prog/rrd/README +++ b/prog/rrd/README @@ -6,7 +6,7 @@ graphs of sensor data. The RRD (Round Robin Database) package is REQUIRED. Get this package from - http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/ + http://oss.oetiker.ch/rrdtool/ A web server with CGI support is required. @@ -26,7 +26,7 @@ following advantages: If you are looking for something a little simpler, that does not require RRD, try ../tellerstats. -The RRD scripts read /proc entries and do not use libsensors. +The RRD scripts read /sys entries and do not use libsensors. Therefore the scale factors in /etc/sensors.conf are not used, and you may have to change the scale factors in the cgi scripts. @@ -45,15 +45,13 @@ INSTALLATION INSTRUCTIONS - Make and install lm_sensors. Get it working (run 'sensors') before you try this! - Get RRD, make and install it - - cd /usr/local; ln -s rrdtool-x.y.z rrdtool - - cd back to here - Edit the top of the Makefile. Do NOT skip this step. The defaults will probably not work for you. Here are the defaults: Cron user USER=httpd Path to rrdtool and rrdcgi - RRDPATH=/usr/local/rrdtool/bin + RRDPATH=/usr/bin Place to install sens_update_rrd script BINPATH=/usr/local/bin Place to store the database @@ -63,8 +61,7 @@ INSTALLATION INSTRUCTIONS APACHDIR=$(APACHE)/senspix The sensor device in your system (isa recommended over i2c if both are available) - SENSDEV=w83781d-isa-0290 (2.4 kernel - look in /proc/sys/dev/sensors) - SENSDEV=0-0290 (2.6 kernel - look in /sys/i2c/bus/devices) + SENSDEV=hwmon0 (look in /sys/class/hwmon) - make - (as root) make install, which does the following. If you don't want it to do this, install by hand!!! @@ -74,7 +71,7 @@ INSTALLATION INSTRUCTIONS - Manually add the following line to the crontab for the user specified above, which will call the data gathering script every 5 minutes (adjust paths as necessary) - */5 * * * * /usr/local/bin/sens_update_rrd /var/lib/sensors-rrd/sensors.rrd w83781d-isa-0290 + */5 * * * * /usr/local/bin/sens_update_rrd /var/lib/sensors-rrd/sensors.rrd hwmon0 - Load http://localhost/senspix/sens_day.cgi in your web browser to test diff --git a/prog/rrd/sens_create_rrd b/prog/rrd/sens_create_rrd index df0fc6c2..0b2a8574 100755 --- a/prog/rrd/sens_create_rrd +++ b/prog/rrd/sens_create_rrd @@ -1,3 +1,4 @@ +#!/bin/sh # # sens_create_rrd - # Create a sensors rrd database of 14 sensor readings @@ -19,7 +20,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -RRDPATH=/usr/local/rrdtool/bin +RRDPATH=/usr/bin RRDB=$1 #Heartbeat 15 minutes HB=900 diff --git a/prog/rrd/sens_day.in b/prog/rrd/sens_day.in index a564632f..75dc13bd 100644 --- a/prog/rrd/sens_day.in +++ b/prog/rrd/sens_day.in @@ -5,7 +5,6 @@ One Day Hardware Statistics for %%MACH%% -

ONE DAY VIEW

See also:
One Week View
@@ -218,10 +217,10 @@ See also:

This page generated with data and scripts from -The lm_sensors drivers; +the lm_sensors project; the data are stored in a Round Robin Database and the graphs are generated by - + RRD. diff --git a/prog/rrd/sens_update_rrd b/prog/rrd/sens_update_rrd index 65920531..2d7fa967 100755 --- a/prog/rrd/sens_update_rrd +++ b/prog/rrd/sens_update_rrd @@ -1,3 +1,4 @@ +#!/bin/sh # # sens_update_rrd - # Update a sensors rrd database. @@ -37,7 +38,7 @@ else HWMON=hwmon0 fi # -RRDPATH=/usr/local/rrdtool/bin +RRDPATH=/usr/bin RRDB=$1 SENSDIR=/sys/class/hwmon diff --git a/prog/rrd/sens_week.in b/prog/rrd/sens_week.in index c240ff66..cce50555 100644 --- a/prog/rrd/sens_week.in +++ b/prog/rrd/sens_week.in @@ -5,7 +5,6 @@ One Week Hardware Statistics for %%MACH%% -

ONE WEEK VIEW

See also:
One Day View
@@ -218,10 +217,10 @@ See also:

This page generated with data and scripts from -The lm_sensors drivers; +the lm_sensors project; the data are stored in a Round Robin Database and the graphs are generated by - + RRD. diff --git a/prog/rrd/summ_week.in b/prog/rrd/summ_week.in index 7acd55bb..713197dc 100644 --- a/prog/rrd/summ_week.in +++ b/prog/rrd/summ_week.in @@ -5,7 +5,6 @@ One Week Summary Hardware Statistics for %%MACH%% -

ONE WEEK SUMMARY VIEW

See also:
One Day View
@@ -90,10 +89,10 @@ See also:

This page generated with data and scripts from -The lm_sensors drivers; +the lm_sensors project; the data are stored in a Round Robin Database and the graphs are generated by - + RRD. From e8861069b2f83f21d3d8e945e3aa27895cb0d32f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 20 Apr 2007 13:36:43 +0000 Subject: [PATCH 015/718] sensors.conf.8: Update the chip statement section. * Drop outdated reference to /proc/sys/dev/sensors * Bus type can be pci * Make the examples more realistic git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4374 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/sensors.conf.5 | 42 +++++++++++++++++++----------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/CHANGES b/CHANGES index c5c02af6..441024ef 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ SVN HEAD File sensors.conf.eg: Add a dme1737 section Library: Clean up pwm symbol names translation Add dme1737 support + Man page sensors.conf.5: Update the chip statement section Program isadump: Detect when address bit 7 is a busy flag Program rrd: Support only hwmon class devices Look for rrd in /usr/bin by default diff --git a/lib/sensors.conf.5 b/lib/sensors.conf.5 index be2c7a7f..a6d996fc 100644 --- a/lib/sensors.conf.5 +++ b/lib/sensors.conf.5 @@ -23,7 +23,7 @@ .\" .\" References consulted: .\" sensors.conf.eg by Frodo Looijaard -.TH sensors.conf 5 "October 2006" "" "Linux Programmer's Manual" +.TH sensors.conf 5 "April 2007" "" "Linux Programmer's Manual" .SH NAME sensors.conf \- libsensors configuration file @@ -168,7 +168,7 @@ in the source distribution can help you generate these lines. .SS CHIP STATEMENT .RS -chip "lm78\-*" "*\-isa\-*" "*\-i2c\-3" +chip "lm78\-*" "lm79\-*" .RE The @@ -191,12 +191,7 @@ statement. A chip description is built from a couple of elements, separated by dashes. To complicate matters, sometimes an element can also contain dashes. This complicates the parsing algorithm, but is not too confusing -for humans (we hope!). The chip descriptions are equal to those -appearing in -.IR /proc/sys/dev/sensors , -but may contain the -.I * -wildcard. +for humans (we hope!). The first element is the name of the chip type. Sometimes a single driver implements several chip types, with several names. The driver documentation @@ -205,7 +200,8 @@ should tell you. You may substitute the wildcard operator for this element. The second element is the name of the bus. This is either -.I isa +.IR isa , +.I pci or .IR i2c-N , with @@ -215,10 +211,10 @@ being any number as binded with a statement. You may substitute the wildcard operator .I * for this element, or only for the number of the I2C bus -(which means 'any non-ISA bus'). +(which means 'any I2C bus'). -The third element is the hexadecimal address. This is a number between 0 and -ffff for the ISA bus, and between 0 and 7f for an I2C bus. You may substitute +The third element is the hexadecimal address of the chip. The valid range +depends on the bus type. You may substitute the wildcard operator .I * for this element. @@ -227,34 +223,34 @@ There are some folding rules for wildcards to make things easier for humans to read. Also, you can't specify the address if you wildcard the complete second element. The following are all valid chip type specification based on -.I lm78\-i2c\-10\-5e +.I lm78\-i2c\-1\-2d or -.IR lm78\-isa\-10dd : +.IR lm78\-isa\-0290 : .RS -lm78\-i2c\-10\-5e +lm78\-i2c\-1\-2d .sp 0 -lm78\-i2c\-10\-* +lm78\-i2c\-1\-* .sp 0 -lm78\-i2c\-*\-5e +lm78\-i2c\-*\-2d .sp 0 -lm78\-i2c\-*\-* +lm78\-i2c\-*\-* .sp 0 -lm78\-isa\-10dd +lm78\-isa\-0290 .sp 0 lm78\-isa\-* .sp 0 lm78\-* .sp 0 -*\-i2c\-10\-5e +*\-i2c\-1\-2d .sp 0 -*\-i2c\-10\-* +*\-i2c\-1\-* .sp 0 -*\-i2c\-*\-5e +*\-i2c\-*\-2d .sp 0 *\-i2c-*\-* .sp 0 -*\-isa\-10dd +*\-isa\-0290 .sp 0 *\-isa\-* .sp 0 From 6642539697c32cbad33eda268e6e0b7c52989759 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 20 Apr 2007 13:38:59 +0000 Subject: [PATCH 016/718] sensors-detect: Add /usr/sbin to the PATH. i2cdetect might be there instead of in /usr/local/sbin. Many users have been complaining and several distribtions were (rightly) modifying sensors-detect because of this. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4375 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 441024ef..e2b94337 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ SVN HEAD Add dme1737 support Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection + Add /usr/sbin to the PATH (#2199) 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 9add80d7..3457014b 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -4,7 +4,7 @@ # sensors-detect - Detect PCI bus and chips # Copyright (C) 1998 - 2002 Frodo Looijaard # Copyright (C) 2000 - 2004 The lm_sensors team -# Copyright (C) 2005 - 2006 Jean Delvare +# Copyright (C) 2005 - 2007 Jean Delvare # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,14 +34,12 @@ use Fcntl; use POSIX; use File::Basename; -# Just in case a root user doesn't have /sbin in his/her path for some reason -# (was seen once) -$ENV{PATH} = '/sbin:'.$ENV{PATH} - unless $ENV{PATH} =~ m,(^|:)/sbin/?(:|$),; -# Same for /usr/local/sbin since we need i2cdetect which is installed there -# by default (reported by Lennard Klein) -$ENV{PATH} = '/usr/local/sbin:'.$ENV{PATH} - unless $ENV{PATH} =~ m,(^|:)/usr/local/sbin/?(:|$),; +# We will call modprobe and i2cdetect, which typically live in either /sbin, +# /usr/sbin or /usr/local/bin. So make sure these are all in the PATH. +foreach ('/usr/sbin', '/usr/local/sbin', '/sbin') { + $ENV{PATH} = "$_:".$ENV{PATH} + unless $ENV{PATH} =~ m/(^|:)$_\/?(:|$)/; +} ######################### # CONSTANT DECLARATIONS # From 0f479b535cac728426827554633c8a1cd9a6ac8c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 26 Apr 2007 08:54:39 +0000 Subject: [PATCH 017/718] Fix alignment of lm85 voltages. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4376 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index c72ba660..a1c7e35b 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -1641,7 +1641,7 @@ void print_lm85(const sensors_chip_name *name) !sensors_get_feature(*name,SENSORS_LM85_IN3_MAX,&max)) { if (valid) { print_label(label,10); - printf("%+6.*f V (min = %+6.2f V, max = %+6.2f V) %s", + printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s", (is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN3?"ALARM":""); if (is1027) { printf(alarm_mask&LM85_ALARM_IN3?" MASKED":""); } putchar( '\n' ); @@ -1655,7 +1655,7 @@ void print_lm85(const sensors_chip_name *name) !sensors_get_feature(*name,SENSORS_LM85_IN4_MAX,&max)) { if (valid) { print_label(label,10); - printf("%+6.*f V (min = %+6.2f V, max = %+6.2f V) %s", + printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s", (is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN4?"ALARM":""); if (is1027) { printf(alarm_mask&LM85_ALARM_IN4?" MASKED":""); } putchar( '\n' ); @@ -1671,7 +1671,7 @@ void print_lm85(const sensors_chip_name *name) !sensors_get_feature(*name,SENSORS_LM85_IN5_MAX,&max)) { if (valid) { print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + printf("%+7.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", cur,min,max,alarms&LM85_ALARM_IN5?"ALARM":""); } } else @@ -1683,7 +1683,7 @@ void print_lm85(const sensors_chip_name *name) !sensors_get_feature(*name,SENSORS_LM85_IN6_MAX,&max)) { if (valid) { print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + printf("%+7.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", cur,min,max,alarms&LM85_ALARM_IN6?"ALARM":""); } } else @@ -1695,7 +1695,7 @@ void print_lm85(const sensors_chip_name *name) !sensors_get_feature(*name,SENSORS_LM85_IN7_MAX,&max)) { if (valid) { print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + printf("%+7.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", cur,min,max,alarms&LM85_ALARM_IN7?"ALARM":""); } } else From e893292b185e94f17d624911962c40a8943c2bb8 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 27 Apr 2007 12:34:17 +0000 Subject: [PATCH 018/718] init scripts: * Delete sample lm_sensors.sysconfig file, it is now generated by sensors-detect. * Fix several occurences of the configuration file name. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4379 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/init/README | 11 +++++----- prog/init/lm_sensors.init | 6 +++--- prog/init/lm_sensors.init.suse | 6 +++--- prog/init/lm_sensors.sysconfig | 38 ---------------------------------- 5 files changed, 12 insertions(+), 50 deletions(-) diff --git a/CHANGES b/CHANGES index e2b94337..67765c3b 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ lm_sensors CHANGES file SVN HEAD File sensors.conf.eg: Add a dme1737 section + File lm_sensors.sysconfig: Delete, now generated by sensors-detect Library: Clean up pwm symbol names translation Add dme1737 support Man page sensors.conf.5: Update the chip statement section diff --git a/prog/init/README b/prog/init/README index ab8dcdb2..f3392f00 100644 --- a/prog/init/README +++ b/prog/init/README @@ -12,14 +12,13 @@ mechanism (i.e. SVR4-based), as opposed to the everything-in-one-script (/etc/rc or /etc/rc.local) like the BSD-based systems do. The lm_sensors.init file should be copied to /etc/rc.d/init.d/lm_sensors. For more information see the top of the file. -It requires the /etc/sysconfig/sensors file, which identifies +It requires the /etc/sysconfig/lm_sensors file, which identifies the correct modules. -The /etc/sysconfig/lm_sensors file is only a list of modules, -as would be determined by running sensors-detect. -The lm_sensors.sysconfig file contains the MODULE_# variable definitions; -it should be modified for your setup and then -copied to /etc/sysconfig/lm_sensors. +The /etc/sysconfig/lm_sensors file is generated by running sensors-detect. +Once the script is done detecting the hardware monitoring devices, it will +list all the required modules in that file, so that they can be loaded +automatically at boot time. SuSE users will want to use lm_sensors.init.suse instead, which is more specifically designed for this distribution. Changes were contributed diff --git a/prog/init/lm_sensors.init b/prog/init/lm_sensors.init index 65dfb13c..e9454359 100755 --- a/prog/init/lm_sensors.init +++ b/prog/init/lm_sensors.init @@ -2,7 +2,7 @@ # # chkconfig: 2345 26 74 # description: sensors is used for monitoring motherboard sensor values. -# config: /etc/sysconfig/sensors +# config: /etc/sysconfig/lm_sensors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,8 +21,8 @@ # See also the lm_sensors homepage at: # http://www.lm-sensors.org -# It uses a config file /etc/sysconfig/sensors that contains the modules to -# be loaded/unloaded. That file is sourced into this one. +# It uses a config file /etc/sysconfig/lm_sensors that contains the modules +# to be loaded/unloaded. That file is sourced into this one. # The format of that file a shell script that simply defines the modules # in order as normal shell variables with the special names: diff --git a/prog/init/lm_sensors.init.suse b/prog/init/lm_sensors.init.suse index e807160c..60058c6e 100755 --- a/prog/init/lm_sensors.init.suse +++ b/prog/init/lm_sensors.init.suse @@ -13,7 +13,7 @@ ### END INIT INFO # chkconfig: 2345 26 74 # description: sensors is used for monitoring motherboard sensor values. -# config: /etc/sysconfig/sensors +# config: /etc/sysconfig/lm_sensors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,8 +32,8 @@ # See also the lm_sensors homepage at: # http://www.lm-sensors.org -# It uses a config file /etc/sysconfig/sensors that contains the modules to -# be loaded/unloaded. That file is sourced into this one. +# It uses a config file /etc/sysconfig/lm_sensors that contains the modules +# to be loaded/unloaded. That file is sourced into this one. # The format of that file a shell script that simply defines the modules # in order as normal shell variables with the special names: diff --git a/prog/init/lm_sensors.sysconfig b/prog/init/lm_sensors.sysconfig index 0174874a..e69de29b 100755 --- a/prog/init/lm_sensors.sysconfig +++ b/prog/init/lm_sensors.sysconfig @@ -1,38 +0,0 @@ -# This is /etc/sysconfig/lm_sensors. -# -# sensors is used for monitoring motherboard sensor values. -# -# See also the lm_sensors homepage at: -# http://www.lm-sensors.org -# -# This file is used by /etc/rc.d/init.d/lm_sensors and defines the modules to be -# loaded/unloaded. This file is sourced into /etc/rc.d/init.d/lm_sensors. - -# The format of this file is a shell script that simply defines the modules -# in order as normal variables with the special names: -# MODULE_1, MODULE_2, MODULE_3, etc. - -# -# List the modules that are to be loaded for your system -# Adapted from results of running /usr/sbin/sensors-detect -# -# Mine said (I have an ASUS K7M motherboard): -# -# #----cut here---- -# # I2C adapter drivers -# modprobe i2c-matroxfb -# # modprobe unknown adapter MAVEN:fb0 on i2c-matroxfb using Bit-shift algorithm -# # modprobe unknown adapter MAVEN:fb0 on i2c-matroxfb using Bit-shift algorithm -# modprobe i2c-isa -# # I2C chip drivers -# modprobe ddcmon -# modprobe w83781d -# modprobe via686a -# #----cut here---- -# -# Here is my module list -MODULE_0=i2c-matroxfb -MODULE_1=i2c-isa -MODULE_2=ddcmon -MODULE_3=w83781d -MODULE_4=via686a From d10c5f218bc9981e6e61ed58dc2f50688be176b0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 27 Apr 2007 13:41:32 +0000 Subject: [PATCH 019/718] pwmconfig: Use smaller steps for low PWM values. Inspired from a patch from the openSuse sensors package. This is a good idea because the PWM/speed relation isn't linear, and it is frequent that the speed changes are concentrated in the low PWM range. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4381 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/pwm/pwmconfig | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 67765c3b..93ac19ee 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ SVN HEAD Add dme1737 support Man page sensors.conf.5: Update the chip statement section Program isadump: Detect when address bit 7 is a busy flag + Program pwmconfig: Use smaller steps for low PWM values Program rrd: Support only hwmon class devices Look for rrd in /usr/bin by default Add missing shell declarations diff --git a/prog/pwm/pwmconfig b/prog/pwm/pwmconfig index 6217d594..c9140713 100755 --- a/prog/pwm/pwmconfig +++ b/prog/pwm/pwmconfig @@ -248,6 +248,10 @@ echo PLOTTER=gnuplot STEP=15 PDELAY=2 +# Use a smaller step for low PWM values as this is typically where the +# more important fan speed changes are happening. +STEP2=2 +STEP2_BELOW=31 function pwmdetail() { @@ -315,7 +319,12 @@ function pwmdetail() fi break fi - let pwm=$pwm-$STEP + if [ $pwm -lt $STEP2_BELOW ] + then + let pwm=$pwm-$STEP2 + else + let pwm=$pwm-$STEP + fi done pwmdisable $P if [ "$PLOT" = "y" ] From 1d4796cfbc7169777845ba5287d30cb372d9f354 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 27 Apr 2007 20:27:58 +0000 Subject: [PATCH 020/718] Really delete lm_sensors.sysconfig. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4382 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/init/lm_sensors.sysconfig | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 prog/init/lm_sensors.sysconfig diff --git a/prog/init/lm_sensors.sysconfig b/prog/init/lm_sensors.sysconfig deleted file mode 100755 index e69de29b..00000000 From 95996b46388fa2555a2abd1e581dc2c94711a527 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 2 May 2007 10:35:14 +0000 Subject: [PATCH 021/718] Delete mkpatch and all references thereto. The kernel modules will soon be removed from the tree so there won't be anything left to generate a patch from. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4383 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + INSTALL | 115 +--- Makefile | 1 - README.directories | 2 - doc/developers/new_drivers | 27 +- doc/mkpatch | 82 --- kernel/busses/Module.mk | 2 - kernel/chips/Module.mk | 2 - mkpatch/Config.in | 69 -- mkpatch/FILES | 72 -- mkpatch/INCLUDES | 2 - mkpatch/Module.mk | 26 - mkpatch/mkpatch.pl | 1341 ------------------------------------ 13 files changed, 13 insertions(+), 1729 deletions(-) delete mode 100644 doc/mkpatch delete mode 100644 mkpatch/Config.in delete mode 100644 mkpatch/FILES delete mode 100644 mkpatch/INCLUDES delete mode 100644 mkpatch/Module.mk delete mode 100755 mkpatch/mkpatch.pl diff --git a/CHANGES b/CHANGES index 93ac19ee..b2b48d61 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ SVN HEAD Add dme1737 support Man page sensors.conf.5: Update the chip statement section Program isadump: Detect when address bit 7 is a busy flag + Program mkpatch: Delete Program pwmconfig: Use smaller steps for low PWM values Program rrd: Support only hwmon class devices Look for rrd in /usr/bin by default diff --git a/INSTALL b/INSTALL index 7bf043ae..db1199f4 100644 --- a/INSTALL +++ b/INSTALL @@ -18,34 +18,11 @@ FOR 2.5/2.6 KERNELS, do not attempt to compile the modules in this package. ============================================================================= These are the installation instruction for the lm_sensors package. -There are two ways in which you can compile and install this package. -Option 1 is much easier and is recommended. - - 1. Complete separate from kernel compilation - (only for 2.4 kernels 2.4.10 or later) - This will generate a set of modules which can be inserted and removed - as needed; nothing will be written into the kernel tree; - - 2. Patching of the kernel - (only for 2.4 kernels 2.4.13 or later) - This will patch your kernel source tree. You must recompile your kernel - to take advantage of this. But it makes it possible to compile drivers - into the kernel itself, instead of having to add them as modules. - ** AFTER YOU COMPILED AND INSTALLED YOUR KERNEL, YOU WILL STILL HAVE TO - ** COMPILE THIS PACKAGE TO GET THE USERLAND UTILITIES! - ** NOT ALL MODULES ARE PATCHED INTO THE KERNEL. SEE BELOW. - - - -Each of these ways will be described below in detail. - NOTE: MAKE SURE YOU HAVE THE I2C-ALGO-BIT DRIVER (PART OF THE I2C PACKAGE) COMPILED INTO YOUR KERNEL OR AVAILABLE AS A MODULE; SOME I2C/SMBUS MASTER DRIVERS DEPEND ON IT! -NOTE: IN EACH CASE, YOU WILL HAVE TO GET AND INSTALL THE I2C PACKAGE FIRST! - SET COMPILE_KERNEL TO 0 IN THE MAIN MAKEFILE FOR OPTION 2, UNLESS - YOU NEED ALPHA OR BETA DRIVERS (SEE BELOW) +NOTE: YOU WILL HAVE TO GET AND INSTALL THE I2C PACKAGE FIRST! NOTE: PLEASE READ THE DOCUMENTATION IN THE DOC SUBDIRECTORY IF YOU GET STUCK! @@ -58,24 +35,7 @@ any 2.4 kernel (and will never be). Therefore, you must download and install the i2c package with the same version number or higher as this lm_sensors package. -All i2c components are distributed in -a separate package. There are install instructions in that package. If -you want to use compilation option 2 (patching the kernel) for lm_sensors, -you will have to use compilation option 3 (patching the kernel) for i2c -too. If you want to use compilation option 1 (compiling as modules) for -lm_sensors, you may use either compilation option 1 or 2 (compiling as -modules) or compilation option 3 (patching the kernel for i2c). See the -table below. - - LM_SENSORS -I2C | option 1 (modules) option 2 (patch kernel) --------------------------+------------------------------------------------ -option 1 (modules) | YES NO -option 2 (modules) | YES YES -option 3 (patch kernel) | YES YES - - -If you use compilation option 1 (compiling as modules) for lm_sensors, you +You will have to make very sure the correct i2c header files are found. If you get weird compilation errors, this is almost certainly going wrong. The i2c header files are in a i2c subdirectory of either /usr/local/include @@ -84,12 +44,9 @@ options 2 and 3). Especially if you have in the past placed the header files in /usr/local/include, this will probably go wrong. See below on how to fix this. -NOTE: option 3 only works with 2.4 kernels 2.4.13 or later; - options 1 and 2 only work with 2.4 kernels 2.4.10 or later. - -Mixing old and new, and using beta drivers (compilation option 1) -================================================================= +Mixing old and new, and using beta drivers +========================================== It is possible that you are running a previously patched kernel, or a very new kernel which already has limited or full i2c or lm_sensors @@ -109,20 +66,14 @@ On the other hand, if you know what you are doing, compilation will be smart. Drivers that are compiled right into your kernel will not be compiled as a module again. You could do nothing with them anyway. -Sometimes, you want to patch your kernel, but find that certain alpha -or beta drivers are not included in the patch. This is on purpose: we -do not want to polute the kernel tree with things of which we are not -confident they work. In this case, patch the kernel, compile it, and -then compile lm_sensors with COMPILE_KERNEL set to 1. - -Having a proper kernel tree (compilation option 1) -================================================== +Having a proper kernel tree +=========================== Usually, if you compile a user-space application, you can get away with having a different version of the kernel running than the version of the kernel header files against which you compiled it. But a perfect match -is needed for the first two compilation options above. +is needed here. Let's say you want to use the lm_sensors modules with the kernel 2.4.32 you are running now. What you need, is the original tree in which you @@ -149,8 +100,8 @@ as distributed on ftp://ftp.kernel/org/pub/linux/kernel, and not one patched by your distribution. -Separate from kernel compilation (compilation option 1) -======================================================= +Compilation +=========== This will compile and install the complete lm_sensors package. Though nothing is written to your kernel tree, a proper tree is still needed @@ -176,8 +127,8 @@ information, which is regenerated on the spot. Please continue reading this file before you start compiling. -Makefile configuration variables (compilation option 1) -============================================================== +Makefile configuration variables +================================ SHELL (default: /bin/sh) You may have to specify the full path to Bash here, if /bin/sh is some @@ -187,16 +138,6 @@ KERNELVERSION The version of the currently running kernel. LINUX (default: /lib/modules/$(KERNELVERSION)/build) The location of your kernel tree. -COMPILE_KERNEL - Determine whether you want to consider the kernel modules for compilation - at all. By default, compilation option 1 will only compile and install - those modules which are not built into the kernel. - If some modules are built into your kernel, and this package is much - newer, you may find you can not insert the newly compiled modules. - Sorry. - You may want to set this to 0 if you have just patched and compiled - your kernel using the same version of this package, and just want to - compile the user-space tools. I2C_HEADERS (default: /usr/local/include) This lists where the i2c headers are found. If you used compilation option 1 for the i2c package, the default will be right. If you used @@ -245,40 +186,6 @@ MANGRP (default: root) Group of manual pages. -Patching the kernel (compilation option 2) -========================================== - -There is a special script which should be able to generate diffs against -any 2.4 kernel (2.4.10 or later). Please report any problems to our -mailing list. It *is* safe to run it if your kernel already has the -lm_sensors drivers. It will only work if you applied the i2c patches first. - -** Only a subset of the modules in lm_sensors are patched into the ** -** kernel by the script. See the file mkpatch/FILES to see if the ** -** modules you need are included. If a module you need is NOT listed ** -** in mkpatch/FILES, it will not be patched, and you MUST use option 1. ** -** If you are not sure what modules you need, run `sensors-detect' first. ** - -The kernel diffs are generated by the program `mkpatch.pl' in the mkpatch -subdirectory. It needs two arguments: the first one is the root of the -lm_sensors package, the second one is the root of the kernel tree against -which the diffs will be generated. For example: - cd /tmp/lm_sensors-2.10.0 - mkpatch/mkpatch.pl . /usr/src/linux > /tmp/sensors-2.10.0.patch -You can apply the diffs as usual: - cd /usr/src/linux - patch -p1 -E < /tmp/sensors-2.10.0.patch -Generation and application can easily be done in one step: - mkpatch/mkpatch.pl . /usr/src/linux | patch -p1 -E -d /usr/src/linux -The generated diffs are of course only valid for the kernel version -against which mkpatch.pl was run. - -Once you have applied the patches, you can configure and compile your -kernel as usual. You will see the sensors configuration screen under the -`Character Devices' menu in menuconfig, but it will only be available -if you selected base I2C support. - - Using the sensors package ========================= diff --git a/Makefile b/Makefile index 65665e9d..0f82fe1e 100644 --- a/Makefile +++ b/Makefile @@ -176,7 +176,6 @@ ifneq ($(MAKECMDGOALS),user_uninstall) ifneq ($(MAKECMDGOALS),package) ifneq ($(MAKECMDGOALS),userpackage) ifneq ($(MAKECMDGOALS),manhtml) -SRCDIRS += mkpatch SRCDIRS += kernel kernel/busses kernel/chips endif endif diff --git a/README.directories b/README.directories index a2b996ec..00adce1a 100644 --- a/README.directories +++ b/README.directories @@ -8,8 +8,6 @@ The directories within this package: The kernel modules: I2C/SMBus master drivers, and sensor chip drivers. * lib The user-space sensors support library code. -* mkpatch - A script for creating a kernel patch. * prog Several supporting programs. Includes programs for detecting installed hardware and recommending specific modules to install. diff --git a/doc/developers/new_drivers b/doc/developers/new_drivers index 014b5447..db28421e 100644 --- a/doc/developers/new_drivers +++ b/doc/developers/new_drivers @@ -58,8 +58,7 @@ steps apply. * Add the driver to the Module.mk (the makefile). Usually, you can just add it to KERNEL{CHIPS,DRIVERS}TARGETS in the - Module.mk file in the directory itself. Put it at the beginning, - where the comment says to put drivers NOT included in mkpatch. + Module.mk file in the directory itself. * Make sure it compiles cleanly. Check compilation with 'make DEBUG=1' if you use debugging @@ -143,24 +142,6 @@ Checklist for us to do on the webpage: * Update entry on 'new drivers' page ---------------------------------------------------------------------- -Checklist for mkpatch support, after the driver is tested and stable: - -* Add .c file to mkpatch/FILES. - -* Add makefile entry in mkpatch/mkpatch.pl (2 places - old and new formats). - (don't bother with old format, obsolete) - -* Add config help to mkpatch/mkpatch.pl. - -* Add config entry to mkpatch/Config.in (chip drivers only) - -* Add config entry in mkpatch/mkpatch.pl (bus drivers only) - -* Move .o reference in kernel/[chips,busses]/Module.mk - from first to second section. - - --------------------------------------------------------------------- Checklist for _adding_ support for a chip to an _existing_ driver: @@ -173,12 +154,6 @@ Checklist for _adding_ support for a chip to an _existing_ driver: * Add entries for the new prefix to etc/sensors.conf.eg (chip drivers only). -* Update config help in mkpatch/mkpatch.pl. - -* Update config entry in mkpatch/Config.in (chip drivers only) - -* Update config entry in mkpatch/mkpatch.pl (bus drivers only) - * Update doc/[chips,busses]/xxx file * Update doc/chips/SUMMARY file (chip drivers only) diff --git a/doc/mkpatch b/doc/mkpatch deleted file mode 100644 index c5664e4d..00000000 --- a/doc/mkpatch +++ /dev/null @@ -1,82 +0,0 @@ -This file documents how the `mkpatch' program works. ------------------------------------------------------------- - -QUICKSTART ----------- - mkpatch/mkpatch.pl . /usr/src/linux > /tmp/patch - cd /usr/src/linux - patch -p1 < /tmp/patch - - -USAGE ------ - -mkpatch compares the newest lm_sensors sources with what is found in a kernel, -and generates a set of diffs. These diffs can be applied to that kernel, -after which the kernel is synchronized with the current lm_sensors sources. - -You should generally run mkpatch against a kernel tree that has been patched -with the newest I2C sources. Check the lm_sensors "Download" page for -information on dependencies between lm_sensors and i2c versions. - -mkpatch needs two arguments. The first is the root of the lm_sensors package, -the second is the root of Linux kernel tree. For example: - cd /tmp/lm_sensors-2.4.0 - mkpatch/mkpatch . /usr/src/linux - -The patch file is written to stdout; any errors are written to stderr. -So you will want to capture the output: - mkpatch/mkpatch . /usr/src/linux > /tmp/lm_sensors-diffs - -Later on, you will want to apply the diffs: - cd /usr/src/linux - patch -p1 -E < /tmp/lm_sensors-diffs - -Of course, this can be combined: - mkpatch/mkpatch . /usr/src/linux | patch -d /usr/src/linux -p1 -E - - -IMPLEMENTATION DETAILS ----------------------- - -mkpatch uses several files in the mkpatch subdirectory. The location of -these files is hardcoded in the program, but all other files used are -specified in these files, and can easily be changed. Used files are: - FILES - A list of files that will be considered by mkpatch. Each line contains - two filenames, separated by whitespace. The first is the name and - location (relative to the lm_sensors package root) of the lm_sensors - file, the second is the name and location (relative to the kernel root) of - the kernel file. A diff will be created between these two files. - INCLUDES - A list of include file changes. Each line contains two strings that - can be found after a `#include' statement. All occurences of the - first string will be changed to the second, for all lm_sensors files in - FILES, before the normal diff is generated. This allow us to use - `#include "sensors.h"' when compiling in the package tree, and - `#include ' in the kernel tree. - Makefile, Config.in - These files are new and will be copied to the appropriate place as - specified in FILES. - -mkpatch does several things: - * For each file pair as specified in FILES, it creates a diff between - them, but before that is done, it changes `#include' lines in the - lm_sensors file as specified in INCLUDES - * It handles several special files, that have to be scanned explicitly - to generate diffs to for them - -The generated diffs have specific headers. It will seem as if the old -kernel was contained in the `linux-old' directory, and the new patched -kernel in the `linux' directory, regardless of where the kernel was -actually located. - -Most intricate are the special files that are handled. These special -files were already present in the kernel, but had to be patched. Because -they can change between kernel versions, I had to scan them by hand to -find where the new code should be inserted. Each file has documented -what actually happens. - - ------------- -This file is Copyright (c) 1999 by Frodo Looijaard diff --git a/kernel/busses/Module.mk b/kernel/busses/Module.mk index 39e8d139..4b6fc1ff 100644 --- a/kernel/busses/Module.mk +++ b/kernel/busses/Module.mk @@ -23,7 +23,6 @@ KERNELBUSSESDIR := $(MODULE_DIR) # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... -# These targets are NOT included in 'mkpatch' ... KERNELBUSSESTARGETS := ifeq ($(shell if grep -q '^CONFIG_IPMI_HANDLER=' $(LINUX)/.config; then echo 1; fi),1) #doesn't work yet @@ -31,7 +30,6 @@ ifeq ($(shell if grep -q '^CONFIG_IPMI_HANDLER=' $(LINUX)/.config; then echo 1; KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-ipmi.o endif -# These targets ARE included in 'mkpatch' ... ifneq ($(shell if grep -q '^CONFIG_I2C_ALI1535=y' $(LINUX)/.config; then echo 1; fi),1) KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-ali1535.o endif diff --git a/kernel/chips/Module.mk b/kernel/chips/Module.mk index f8a7485a..0173a406 100644 --- a/kernel/chips/Module.mk +++ b/kernel/chips/Module.mk @@ -24,7 +24,6 @@ KERNELCHIPSDIR := $(MODULE_DIR) # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... -# These targets are NOT included in 'mkpatch' KERNELCHIPSTARGETS := ifeq ($(shell if grep -q '^CONFIG_IPMI_HANDLER=' $(LINUX)/.config; then echo 1; fi),1) KERNELCHIPSTARGETS += $(MODULE_DIR)/bmcsensors.o @@ -37,7 +36,6 @@ KERNELCHIPSTARGETS += $(MODULE_DIR)/smartbatt.o KERNELCHIPSTARGETS += $(MODULE_DIR)/smbus-arp.o -# These targets ARE included in 'mkpatch' ifneq ($(shell if grep -q '^CONFIG_SENSORS_ADM1021=y' $(LINUX)/.config; then echo 1; fi),1) KERNELCHIPSTARGETS += $(MODULE_DIR)/adm1021.o endif diff --git a/mkpatch/Config.in b/mkpatch/Config.in deleted file mode 100644 index 3f11a043..00000000 --- a/mkpatch/Config.in +++ /dev/null @@ -1,69 +0,0 @@ -# -# Sensor device configuration -# All depend on CONFIG_I2C_PROC. -# ISA-only devices depend on CONFIG_I2C_ISA also. -# - -if [ "$CONFIG_I2C" = "m" -o "$CONFIG_I2C" = "y" ] ; then -if [ "$CONFIG_I2C_PROC" = "m" -o "$CONFIG_I2C_PROC" = "y" ] ; then - mainmenu_option next_comment - comment 'Hardware sensors support' - - dep_mbool 'Hardware sensors support' CONFIG_SENSORS $CONFIG_I2C $CONFIG_I2C_PROC - - if [ "$CONFIG_SENSORS" != "n" ]; then - dep_tristate ' Analog Devices ADM1021 and compatibles' CONFIG_SENSORS_ADM1021 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Analog Devices ADM1024' CONFIG_SENSORS_ADM1024 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Analog Devices ADM1025' CONFIG_SENSORS_ADM1025 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Analog Devices ADM1026' CONFIG_SENSORS_ADM1026 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Analog Devices ADM1030, ADM1031' CONFIG_SENSORS_ADM1031 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Analog Devices ADM9240 and compatibles' CONFIG_SENSORS_ADM9240 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Asus ASB100' CONFIG_SENSORS_ASB100 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Dallas DS1621 and DS1625' CONFIG_SENSORS_DS1621 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Fintek F71805F' CONFIG_SENSORS_F71805F $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Fujitsu-Siemens Hermes' CONFIG_SENSORS_FSCHER $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Fujitsu-Siemens Poseidon' CONFIG_SENSORS_FSCPOS $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Fujitsu-Siemens Scylla' CONFIG_SENSORS_FSCSCY $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Genesys Logic GL518SM' CONFIG_SENSORS_GL518SM $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Genesys Logic GL520SM' CONFIG_SENSORS_GL520SM $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' HP Maxilife' CONFIG_SENSORS_MAXILIFE $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Intel Xeon Thermal Sensor' CONFIG_SENSORS_XEONTEMP $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' ITE 8705/8712, SiS950' CONFIG_SENSORS_IT87 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Maxim MAX1619' CONFIG_SENSORS_MAX1619 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Maxim MAX6650, MAX6651' CONFIG_SENSORS_MAX6650 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Myson MTP008' CONFIG_SENSORS_MTP008 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM63' CONFIG_SENSORS_LM63 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM75 and compatibles' CONFIG_SENSORS_LM75 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM78' CONFIG_SENSORS_LM78 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM80' CONFIG_SENSORS_LM80 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM83 and compatibles' CONFIG_SENSORS_LM83 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM85, Analog Devices ADM1027' CONFIG_SENSORS_LM85 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM87' CONFIG_SENSORS_LM87 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM90 and compatibles' CONFIG_SENSORS_LM90 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM92' CONFIG_SENSORS_LM92 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor LM93' CONFIG_SENSORS_LM93 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' National Semiconductor PC8736x Sensors' CONFIG_SENSORS_PC87360 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Silicon Integrated Systems Corp. SiS5595' CONFIG_SENSORS_SIS5595 $CONFIG_I2C $CONFIG_I2C_PROC $CONFIG_I2C_ISA - dep_tristate ' SMSC47M1xx Integrated Sensors' CONFIG_SENSORS_SMSC47M1 $CONFIG_I2C $CONFIG_I2C_PROC $CONFIG_I2C_ISA - dep_tristate ' Texas Instruments THMC50 and compatibles' CONFIG_SENSORS_THMC50 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' VIA 686a Integrated Hardware Monitor' CONFIG_SENSORS_VIA686A $CONFIG_I2C $CONFIG_I2C_PROC $CONFIG_I2C_ISA - dep_tristate ' VIA VT1211 Integrated Sensors' CONFIG_SENSORS_VT1211 $CONFIG_I2C $CONFIG_I2C_PROC $CONFIG_I2C_ISA - 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, 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 - dep_tristate ' Brooktree BT869 Video Modulator' CONFIG_SENSORS_BT869 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' DDC Monitor EDID EEPROM' CONFIG_SENSORS_DDCMON $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' EEprom (DIMM) reader ' CONFIG_SENSORS_EEPROM $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Matrix-Orbital LCD Displays' CONFIG_SENSORS_MATORB $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Philips PCF8574 Parallel I/O' CONFIG_SENSORS_PCF8574 $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Philips PCF8591 D/A and A/D' CONFIG_SENSORS_PCF8591 $CONFIG_I2C $CONFIG_I2C_PROC - fi - fi - endmenu -fi -fi - diff --git a/mkpatch/FILES b/mkpatch/FILES deleted file mode 100644 index 73fff819..00000000 --- a/mkpatch/FILES +++ /dev/null @@ -1,72 +0,0 @@ -kernel/busses/i2c-ali1535.c drivers/i2c/i2c-ali1535.c -kernel/busses/i2c-ali15x3.c drivers/i2c/i2c-ali15x3.c -kernel/busses/i2c-ali1563.c drivers/i2c/i2c-ali1563.c -kernel/busses/i2c-amd756.c drivers/i2c/i2c-amd756.c -kernel/busses/i2c-amd756-s4882.c drivers/i2c/i2c-amd756-s4882.c -kernel/busses/i2c-amd8111.c drivers/i2c/i2c-amd8111.c -kernel/busses/i2c-hydra.c drivers/i2c/i2c-hydra.c -kernel/busses/i2c-i801.c drivers/i2c/i2c-i801.c -kernel/busses/i2c-i810.c drivers/i2c/i2c-i810.c -kernel/busses/i2c-isa.c drivers/i2c/i2c-isa.c -kernel/busses/i2c-nforce2.c drivers/i2c/i2c-nforce2.c -kernel/busses/i2c-piix4.c drivers/i2c/i2c-piix4.c -kernel/busses/i2c-savage4.c drivers/i2c/i2c-savage4.c -kernel/busses/i2c-sis5595.c drivers/i2c/i2c-sis5595.c -kernel/busses/i2c-tsunami.c drivers/i2c/i2c-tsunami.c -kernel/busses/i2c-via.c drivers/i2c/i2c-via.c -kernel/busses/i2c-viapro.c drivers/i2c/i2c-viapro.c -kernel/busses/i2c-voodoo3.c drivers/i2c/i2c-voodoo3.c -kernel/busses/i2c-sis630.c drivers/i2c/i2c-sis630.c -kernel/busses/i2c-sis645.c drivers/i2c/i2c-sis645.c -kernel/chips/adm1021.c drivers/sensors/adm1021.c -kernel/chips/adm1024.c drivers/sensors/adm1024.c -kernel/chips/adm1025.c drivers/sensors/adm1025.c -kernel/chips/adm1026.c drivers/sensors/adm1026.c -kernel/chips/adm1031.c drivers/sensors/adm1031.c -kernel/chips/adm9240.c drivers/sensors/adm9240.c -kernel/chips/asb100.c drivers/sensors/asb100.c -kernel/chips/bt869.c drivers/sensors/bt869.c -kernel/chips/ddcmon.c drivers/sensors/ddcmon.c -kernel/chips/ds1621.c drivers/sensors/ds1621.c -kernel/chips/eeprom.c drivers/sensors/eeprom.c -kernel/chips/f71805f.c drivers/sensors/f71805f.c -kernel/chips/fscher.c drivers/sensors/fscher.c -kernel/chips/fscpos.c drivers/sensors/fscpos.c -kernel/chips/fscscy.c drivers/sensors/fscscy.c -kernel/chips/gl518sm.c drivers/sensors/gl518sm.c -kernel/chips/gl520sm.c drivers/sensors/gl520sm.c -kernel/chips/it87.c drivers/sensors/it87.c -kernel/chips/lm63.c drivers/sensors/lm63.c -kernel/chips/lm75.h drivers/sensors/lm75.h -kernel/chips/lm75.c drivers/sensors/lm75.c -kernel/chips/lm78.c drivers/sensors/lm78.c -kernel/chips/lm80.c drivers/sensors/lm80.c -kernel/chips/lm83.c drivers/sensors/lm83.c -kernel/chips/lm85.c drivers/sensors/lm85.c -kernel/chips/lm87.c drivers/sensors/lm87.c -kernel/chips/lm90.c drivers/sensors/lm90.c -kernel/chips/lm92.c drivers/sensors/lm92.c -kernel/chips/lm93.c drivers/sensors/lm93.c -kernel/chips/lm93.h drivers/sensors/lm93.h -kernel/chips/matorb.c drivers/sensors/matorb.c -kernel/chips/max1619.c drivers/sensors/max1619.c -kernel/chips/max6650.c drivers/sensors/max6650.c -kernel/chips/maxilife.c drivers/sensors/maxilife.c -kernel/chips/mtp008.c drivers/sensors/mtp008.c -kernel/chips/pc87360.c drivers/sensors/pc87360.c -kernel/chips/pcf8574.c drivers/sensors/pcf8574.c -kernel/chips/pcf8591.c drivers/sensors/pcf8591.c -kernel/chips/sis5595.c drivers/sensors/sis5595.c -kernel/chips/smsc47m1.c drivers/sensors/smsc47m1.c -kernel/chips/thmc50.c drivers/sensors/thmc50.c -kernel/chips/via686a.c drivers/sensors/via686a.c -kernel/chips/vt1211.c drivers/sensors/vt1211.c -kernel/chips/vt8231.c drivers/sensors/vt8231.c -kernel/chips/w83781d.c drivers/sensors/w83781d.c -kernel/chips/w83792d.c drivers/sensors/w83792d.c -kernel/chips/w83627hf.c drivers/sensors/w83627hf.c -kernel/chips/w83l785ts.c drivers/sensors/w83l785ts.c -kernel/chips/xeontemp.c drivers/sensors/xeontemp.c -kernel/include/sensors_compat.h include/linux/sensors_compat.h -kernel/include/sensors_vid.h include/linux/sensors_vid.h -mkpatch/Config.in drivers/sensors/Config.in diff --git a/mkpatch/INCLUDES b/mkpatch/INCLUDES deleted file mode 100644 index 81932f14..00000000 --- a/mkpatch/INCLUDES +++ /dev/null @@ -1,2 +0,0 @@ -"sensors_compat.h" -"sensors_vid.h" diff --git a/mkpatch/Module.mk b/mkpatch/Module.mk deleted file mode 100644 index 3b3cc8e8..00000000 --- a/mkpatch/Module.mk +++ /dev/null @@ -1,26 +0,0 @@ -# Module.mk - Makefile for a Linux module for reading sensor data. -# Copyright (c) 1998, 1999 Frodo Looijaard -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -# Note that MODULE_DIR (the directory in which this file resides) is a -# 'simply expanded variable'. That means that its value is substituted -# verbatim in the rules, until it is redefined. -MODULE_DIR := mkpatch -MKPATCHDIR := $(MODULE_DIR) - -clean-mkpatch: - $(RM) $(MKPATCHDIR)/.temp -clean :: clean-mkpatch diff --git a/mkpatch/mkpatch.pl b/mkpatch/mkpatch.pl deleted file mode 100755 index 2ab14c71..00000000 --- a/mkpatch/mkpatch.pl +++ /dev/null @@ -1,1341 +0,0 @@ -#!/usr/bin/perl -w - -# mkpatch - Create patches against the Linux kernel -# Copyright (C) 1999 Frodo Looijaard -# Copyright (C) 2005 Jean Delvare -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -use strict; - -use vars qw($temp); -$temp = "mkpatch/.temp"; - -# Generate a diff between the old kernel file and the new lm_sensors file. We -# arrange the headers to tell us the old tree was under directory -# `linux-old', and the new tree under `linux'. -# $_[0]: sensors package root (like /tmp/sensors) -# $_[1]: Linux kernel tree (like /usr/src/linux) -# $_[2]: Name of the kernel file -# $_[3]: Name of the patched file -sub print_diff -{ - my ($package_root,$kernel_root,$kernel_file,$package_file) = @_; - my ($diff_command,$package_mtime,$kernel_mtime); - - $diff_command = "diff -u"; - if ( -e "$kernel_root/$kernel_file") { - $diff_command .= " $kernel_root/$kernel_file"; - $kernel_mtime = (stat("$kernel_root/$kernel_file"))[9]; - } else { - $diff_command .= " /dev/null"; - $kernel_mtime = 0; - } - if ( -e "$package_root/$package_file") { - $diff_command .= " $package_root/$package_file"; - $package_mtime = (stat("$package_root/$package_file"))[9]; - } else { - $diff_command .= " /dev/null"; - $package_mtime = 0; - } - open INPUT, "$diff_command|" or die "Can't execute `$diff_command'"; - if () { - ; - print "--- linux-old/$kernel_file\t".gmtime($kernel_mtime)."\n". - "+++ linux/$kernel_file\t".gmtime($package_mtime)."\n"; - - print while ; - } - close INPUT; -} - -# This generates diffs for kernel file Documentation/Configure.help. This -# file contains the help texts that can be displayed during `make *config' -# for the kernel. -# The new texts are put at the end of the file, or just before the -# lm_sensors texts. -# Of course, care is taken old lines are removed. -# $_[0]: i2c package root (like /tmp/i2c) -# $_[1]: Linux kernel tree (like /usr/src/linux) -sub gen_Documentation_Configure_help -{ - my ($package_root,$kernel_root) = @_; - my $kernel_file = "Documentation/Configure.help"; - my $package_file = $temp; - - open INPUT,"$kernel_root/$kernel_file" - or die "Can't open `$kernel_root/$kernel_file'"; - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - MAIN: while() { - if (m@I2C mainboard interfaces@ or - m@Acer Labs ALI 1535@ or - m@Acer Labs ALI 1533 and 1543C@ or - m@Acer Labs ALI 1563@ or - m@AMD 756/766/768/8111@ or - m@SMBus multiplexing on the Tyan S4882@ or - m@AMD 8111 SMBus 2.0@ or - m@Apple Hydra Mac I/O@ or - m@Intel I801@ or - m@Intel I810/I815 based Mainboard@ or - m@Intel 82371AB PIIX4\(E\)@ or - m@Nvidia Nforce2@ or - m@Silicon Integrated Systems Corp. SiS5595 based Mainboard@ or - m@VIA Technologies, Inc. VT82C586B@ or - m@VIA Technologies, Inc. VT82C596, 596B, 686A/B, 8233@ or - m@3DFX Banshee / Voodoo3@ or - m@DEC Tsunami 21272@ or - m@Pseudo ISA adapter \(for hardware sensors modules\)@ or - m@Analog Devices ADM1021 and compatibles@ or - m@Analog Devices ADM1024@ or - m@Analog Devices ADM1025@ or - m@Analog Devices ADM1026@ or - m@Analog Devices ADM1030, ADM1031@ or - m@Analog Devices ADM9240 and compatibles@ or - m@Asus ASB100@ or - m@Dallas DS1621 and DS1625@ or - m@Fintek F71805F@ or - m@Fujitsu-Siemens Hermes@ or - m@Fujitsu-Siemens Poseidon@ or - m@Fujitsu-Siemens Scylla@ or - m@Genesys Logic GL518SM@ or - m@Genesys Logic GL520SM@ or - m@HP Maxilife@ or - m@Intel Xeon Thermal Sensor@ or - m@ITE 8705, 8712, Sis950@ or - m@Maxim MAX1619@ or - m@Maxim MAX6650, MAX6651@ or - m@Myson MTP008@ or - m@National Semiconductor LM63@ or - m@National Semiconductor LM75 and compatibles@ or - m@National Semiconductor LM78@ or - m@National Semiconductor LM80@ or - m@National Semiconductor LM83@ or - m@National Semiconductor LM85@ or - m@National Semiconductor LM87@ or - m@National Semiconductor LM90@ or - m@National Semiconductor LM92@ or - m@National Semiconductor LM93@ or - m@National Semiconductor PC8736x@ or - m@Silicon Integrated Systems Corp. SiS5595 Sensor@ or - m@Texas Instruments THMC50 / Analog Devices ADM1022@ or - m@Via VT82C686A/B@ or - m@Winbond W83781D, W83782D, W83783S@ or - m@Winbond W83792D@ or - m@Winbond W83627HF, W83627THF@ or - m@Winbond W83L785TS-S@ or - m@EEprom \(DIMM\) reader@) { - $_ = ; - $_ = ; - $_ = while not m@^\S@ and not eof(INPUT); - redo MAIN; - } - if (eof(INPUT)) { - print OUTPUT <<'EOF' -I2C mainboard interfaces -CONFIG_I2C_MAINBOARD - Many modern mainboards have some kind of I2C interface integrated. This - is often in the form of a SMBus, or System Management Bus, which is - basically the same as I2C but which uses only a subset of the I2C - protocol. - - You will also want the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Acer Labs ALI 1535 -CONFIG_I2C_ALI1535 - If you say yes to this option, support will be included for the Acer - Labs ALI 1535 mainboard I2C interface. This can also be - built as a module. - -Acer Labs ALI 1533 and 1543C -CONFIG_I2C_ALI15X3 - If you say yes to this option, support will be included for the Acer - Labs ALI 1533 and 1543C mainboard I2C interfaces. This can also be - built as a module which can be inserted and removed while the kernel - is running. - -Acer Labs ALI 1563 -CONFIG_I2C_ALI1563 - If you say yes to this option, support will be included for the Acer - Labs ALI M1563 mainboard SMBus interface. This can also be built as a - module. - -AMD 756/766/768/8111 and nVidia nForce -CONFIG_I2C_AMD756 - If you say yes to this option, support will be included for the AMD - 756/766/768/8111 and nVidia nForce mainboard I2C interfaces. This can - also be built as a module which can be inserted and removed while the - kernel is running. - -SMBus multiplexing on the Tyan S4882 -CONFIG_I2C_AMD756_S4882 - Enabling this option will add specific SMBus support for the Tyan - S4882 motherboard. On this 4-CPU board, the SMBus is multiplexed - over 8 different channels, where the various memory module EEPROMs - and temperature sensors live. Saying yes here will give you access - to these in addition to the trunk. - -AMD 8111 SMBus 2.0 -CONFIG_I2C_AMD8111 - If you say yes to this option, support will be included for the AMD - 8111 mainboard SMBus 2.0 interface. This can also be - built as a module which can be inserted and removed while the kernel - is running. - -Apple Hydra Mac I/O -CONFIG_I2C_HYDRA - If you say yes to this option, support will be included for the - Hydra mainboard I2C interface. This can also be built as a module - which can be inserted and removed while the kernel is running. - -Intel I801 -CONFIG_I2C_I801 - If you say yes to this option, support will be included for the - Intel I801 mainboard I2C interfaces. "I810" mainboard sensor chips are - generally located on the I801's I2C bus. This can also be - built as a module which can be inserted and removed while the kernel - is running. - -Intel I810/I815 based Mainboard -CONFIG_I2C_I810 - If you say yes to this option, support will be included for the - Intel I810/I810E/I815/I845G mainboard I2C interfaces. The I2C busses - of these chips are generally used only for video devices. For "810" - mainboard sensor chips, use the I801 I2C driver instead. - - This can also be built as a module which can be inserted and removed - while the kernel is running. - -Intel 82371AB PIIX4(E), ServerWorks OSB4, CSB5, CSB6, HT-1000 -CONFIG_I2C_PIIX4 - If you say yes to this option, support will be included for the - Intel PIIX4, PIIX4E, 443MX, Serverworks OSB4, CSB5, CSB6 and - HT-1000, ATI IXP200, IXP300, IXP400 and SB600, and SMSC Victory66 - mainboard SMBus interfaces. - - This can also be built as a module which can be inserted and removed - while the kernel is running. - -Nvidia Nforce2/3/4 based Mainboard -CONFIG_I2C_NFORCE2 - If you say yes to this option, support will be included for the - Nvidia Nforce2, Nforce3 and Nforce4 families of mainboard SMBus - interfaces. - - This can also be built as a module which can be inserted and removed - while the kernel is running. - -Silicon Integrated Systems Corp. SiS5595 based Mainboard -CONFIG_I2C_SIS5595 - If you say yes to this option, support will be included for the - SiS5595 mainboard I2C interfaces. For integrated sensors on the - Sis5595, use CONFIG_SENSORS_SIS5595. This can also be - built as a module which can be inserted and removed while the kernel - is running. - -Silicon Integrated Systems Corp. SiS630/730 based Mainboard -CONFIG_I2C_SIS630 - If you say yes to this option, support will be included for the SiS 630 - and 730 mainboard I2C interfaces. This can also be built as a module - which can be inserted and removed while the kernel is running. - -Silicon Integrated Systems Corp. SiS645/961,645DX/961,735 based Mainboard -CONFIG_I2C_SIS645 - If you say yes to this option, support will be included for the SiS 645/961, - 645DX/961 and 735 mainboard I2C interfaces. This can also be built as a module - which can be inserted and removed while the kernel is running. - -VIA Technologies, Inc. VT82C586B -CONFIG_I2C_VIA - If you say yes to this option, support will be included for the VIA - Technologies I2C adapter found on some motherboards. This can also - be built as a module which can be inserted and removed while the - kernel is running. - -VIA Technologies, Inc. VT82C596/82C686/82xx and CX700 -CONFIG_I2C_VIAPRO - If you say yes to this option, support will be included for the VIA - Technologies I2C adapter on these chips. For integrated sensors on the - Via 686A/B, use CONFIG_SENSORS_VIA686A. This can also be - be built as a module which can be inserted and removed while the - kernel is running. - -3DFX Banshee / Voodoo3 -CONFIG_I2C_VOODOO3 - If you say yes to this option, support will be included for the - 3DFX Banshee and Voodoo3 I2C interfaces. The I2C busses on the these - chips are generally used only for video devices. - This can also be - built as a module which can be inserted and removed while the kernel - is running. - -DEC Tsunami 21272 -CONFIG_I2C_TSUNAMI - If you say yes to this option, support will be included for the DEC - Tsunami chipset I2C adapter. Requires the Alpha architecture; - do not enable otherwise. This can also be built as a module which - can be inserted and removed while the kernel is running. - -Pseudo ISA adapter (for hardware sensors modules) -CONFIG_I2C_ISA - This provides support for accessing some hardware sensor chips over - the ISA bus rather than the I2C or SMBus. If you want to do this, - say yes here. This feature 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 - http://www.lm-sensors.org/ - -Analog Devices ADM1021 and compatibles -CONFIG_SENSORS_ADM1021 - If you say yes here you get support for Analog Devices ADM1021 - and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A, - Genesys Logic GL523SM, National Semi LM84, TI THMC10 and Onsemi - MC1066. 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 - http://www.lm-sensors.org/ - -Analog Devices ADM1024 -CONFIG_SENSORS_ADM1024 - If you say yes here you get support for Analog Devices ADM1024 sensor - chips. This can also be built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Analog Devices ADM1025 -CONFIG_SENSORS_ADM1025 - If you say yes here you get support for Analog Devices ADM1025 sensor - chips. 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 - http://www.lm-sensors.org/ - -Analog Devices ADM1026 -CONFIG_SENSORS_ADM1026 - If you say yes here you get support for Analog Devices ADM1026 sensor - chips. 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 - http://www.lm-sensors.org/ - -Analog Devices ADM1030, ADM1031 -CONFIG_SENSORS_ADM1031 - If you say yes here you get support for Analog Devices ADM1030 and - ADM1031 sensor chips. 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 - http://www.lm-sensors.org/ - -Analog Devices ADM9240 and compatibles -CONFIG_SENSORS_ADM9240 - If you say yes here you get support for Analog Devices ADM9240 - sensor chips and clones: the Dallas Semiconductor DS1780 and - the National Semiconductor LM81. 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 - http://www.lm-sensors.org/ - -Asus ASB100 -CONFIG_SENSORS_ASB100 - If you say yes here you get support for the Asus ASB100 (aka - "Bach") sensor chip. This can also be built as a module. - - You will also need the latest user-space utilities: you can find - them in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Dallas DS1621 and DS1625 -CONFIG_SENSORS_DS1621 - If you say yes here you get support for the Dallas DS1621 and DS1625x - sensor chips. This can also be built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Fintek F71805F -CONFIG_SENSORS_F71805F - If you say yes here you get support for the hardware monitoring - features of the Fintek F71805F/FG Super-I/O chip. This can also be - built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Fujitsu-Siemens Hermes -CONFIG_SENSORS_FSCHER - If you say yes here you get support for the Fujitsu-Siemens Hermes - sensor chip. This can also be built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Fujitsu-Siemens Poseidon -CONFIG_SENSORS_FSCPOS - If you say yes here you get support for the Fujitsu-Siemens Poseidon - sensor chip. This can also be built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Fujitsu-Siemens Scylla -CONFIG_SENSORS_FSCSCY - If you say yes here you get support for the Fujitsu-Siemens Scylla - sensor chip. This can also be built as a module. This driver may/should - also work with the following Fujitsu-Siemens chips: "Poseidon", - "Poseidon II" and "Hydra". You may have to force loading of the module - for motherboards in these cases. Be careful - those motherboards have - not been tested with this driver. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Genesys Logic GL518SM -CONFIG_SENSORS_GL518SM - If you say yes here you get support for Genesys Logic GL518SM sensor - chips. 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 - http://www.lm-sensors.org/ - -Genesys Logic GL520SM -CONFIG_SENSORS_GL520SM - If you say yes here you get support for Genesys Logic GL518SM sensor - chips. 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 - http://www.lm-sensors.org/ - -HP Maxilife -CONFIG_SENSORS_MAXILIFE - If you say yes here you get support for the HP Maxilife - sensor chip. This can also be built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Intel Xeon Thermal Sensor -CONFIG_SENSORS_XEONTEMP - If you say yes here you get support for the Intel Xeon processor - built-in thermal sensor. 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 - http://www.lm-sensors.org/ - -ITE 8705, 8712, Sis950 -CONFIG_SENSORS_IT87 - If you say yes here you get support for the ITE 8705 and 8712 and - SiS950 sensor chips. This can also be built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Maxim MAX1619 -CONFIG_SENSORS_MAX1619 - If you say yes here you get support for the Maxim MAX1619 sensor - chips. This can also be built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Maxim MAX6650, MAX6651 -CONFIG_SENSORS_MAX6650 - If you say yes here you get support for the Maxim MAX6650 and - MAX6651 sensor chips. This can also be built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -Myson MTP008 -CONFIG_SENSORS_MTP008 - If you say yes here you get support for the Myson MTP008 - sensor chip. This can also be built as a module. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -National Semiconductor LM63 -CONFIG_SENSORS_LM63 - If you say yes here you get support for National Semiconductor LM63 - sensor chips. 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 - http://www.lm-sensors.org/ - -National Semiconductor LM75 and compatibles -CONFIG_SENSORS_LM75 - If you say yes here you get support for National Semiconductor LM75 - sensor chips and clones: Dallas Semiconductor DS75 and DS1775 (in - 9-bit precision mode), and TelCom (now Microchip) TCN75. 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 - http://www.lm-sensors.org/ - -National Semiconductor LM78 -CONFIG_SENSORS_LM78 - If you say yes here you get support for National Semiconductor LM78 - sensor chips family: the LM78-J and LM79. Many clone chips will - also work at least somewhat with this driver. 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 - http://www.lm-sensors.org/ - -National Semiconductor LM80 -CONFIG_SENSORS_LM80 - If you say yes here you get support for National Semiconductor LM80 - sensor chips. 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 - http://www.lm-sensors.org/ - -National Semiconductor LM83 and compatibles -CONFIG_SENSORS_LM83 - If you say yes here you get support for the National Semiconductor - LM82 and LM83 sensor chips. This can also be built as a module. - - You will also need the latest user-space utilities: you can find - them in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -National Semiconductor LM85 -CONFIG_SENSORS_LM85 - If you say yes here you get support for National Semiconductor LM85 - sensor chips and compatibles. Compatible chips include the Analog - Devices ADM1027 and ADT7463 and SMSC EMC6D100 and EMC6D101. 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 - http://www.lm-sensors.org/ - -National Semiconductor LM87 -CONFIG_SENSORS_LM87 - If you say yes here you get support for National Semiconductor LM87 - sensor chips. 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 - http://www.lm-sensors.org/ - -National Semiconductor LM90 -CONFIG_SENSORS_LM90 - If you say yes here you get support for the National Semiconductor - LM90, LM89 and LM99, Analog Devices ADM1032 and ADT7461, and Maxim - MAX6657 and MAX6658 sensor chips. This can also be built as a module. - - You will also need the latest user-space utilities: you can find - them in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -National Semiconductor LM92 -CONFIG_SENSORS_LM92 - If you say yes here you get support for National Semiconductor LM92 - sensor chips. 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 - http://www.lm-sensors.org/ - -National Semiconductor LM93 -CONFIG_SENSORS_LM93 - If you say yes here you get support for National Semiconductor LM93 - sensor chips. 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 - http://www.lm-sensors.org/ - -National Semiconductor PC8736x Sensors -CONFIG_SENSORS_PC87360 - If you say yes here you get support for the integrated hardware - monitoring in the National Semicoductor PC87360, PC87363, PC87364, - PC87365 and PC87366 Super I/O chips. 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 - http://www.lm-sensors.org/ - -Philips PCF8574 -CONFIG_SENSORS_PCF8574 - If you say yes here you get support for the Philips PCF8574 - I2C 8-bit Parallel I/O device. - 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 - http://www.lm-sensors.org/ - -Philips PCF8591 -CONFIG_SENSORS_PCF8591 - If you say yes here you get support for the Philips PCF8591 - I2C Quad D/A + Single A/D I/O device. - 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 - http://www.lm-sensors.org/ - -Silicon Integrated Systems Corp. SiS5595 Sensor -CONFIG_SENSORS_SIS5595 - If you say yes here you get support for the integrated sensors in - SiS5595 South Bridges. 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 - http://www.lm-sensors.org/ - -SMSC47M1xx Super I/O Fan Support -CONFIG_SENSORS_SMSC47M1 - If you say yes here you get support for the integrated fan - monitoring and control in the SMSC 47M1xx Super I/O chips. - 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 - http://www.lm-sensors.org/ - -Texas Instruments THMC50 / Analog Devices ADM1022 -CONFIG_SENSORS_THMC50 - If you say yes here you get support for Texas Instruments THMC50 - sensor chips and clones: the Analog Devices ADM1022. - 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 - http://www.lm-sensors.org/ - -Via VT82C686A/B -CONFIG_SENSORS_VIA686A - If you say yes here you get support for the integrated sensors in - Via 686A/B South Bridges. 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 - http://www.lm-sensors.org/ - -Via VT1211 Sensors -CONFIG_SENSORS_VT1211 - If you say yes here you get support for the integrated sensors in - the Via VT1211 Super I/O device. 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 - http://www.lm-sensors.org/ - -Via VT8231 Sensors -CONFIG_SENSORS_VT8231 - If you say yes here you get support for the integrated sensors in - the Via VT8231 device. 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 - http://www.lm-sensors.org/ - -Winbond W83781D, W83782D, W83783S, W83627HF, AS99127F -CONFIG_SENSORS_W83781D - If you say yes here you get support for the Winbond W8378x series - of sensor chips: the W83781D, W83782D, W83783S and W83627HF, - and the similar Asus AS99127F. 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 - http://www.lm-sensors.org/ - -Winbond W83792D -CONFIG_SENSORS_W83792D - If you say yes here you get support for the Winbond W83792D - sensor chips. - - You will also need the latest user-space utilities: you can find them - in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -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, 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 - http://www.lm-sensors.org/ - -Winbond W83L785TS-S -CONFIG_SENSORS_W83L785TS - If you say yes here you get support for the Winbond W83L785TS-S - sensor chip. This can also be built as a module. - - You will also need the latest user-space utilities: you can find - them in the lm_sensors package, which you can download at - http://www.lm-sensors.org/ - -EEprom (DIMM) reader -CONFIG_SENSORS_EEPROM - If you say yes here you get read-only access to the EEPROM data - available on modern memory DIMMs, and which could theoretically - also be available on other devices. 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 - http://www.lm-sensors.org/ - -EOF - } - print OUTPUT; - } - close INPUT; - close OUTPUT; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; -} - - -# This generates diffs for the main Linux Makefile. -# Three lines which add drivers/sensors/sensors.a to the DRIVERS list are -# put just before the place where the architecture Makefile is included. -# Of course, care is taken old lines are removed. -# $_[0]: sensors package root (like /tmp/sensors) -# $_[1]: Linux kernel tree (like /usr/src/linux) -sub gen_Makefile -{ - my ($package_root,$kernel_root) = @_; - my $kernel_file = "Makefile"; - my $package_file = $temp; - my $type = 0; - my $pr1 = 0; - - open INPUT,"$kernel_root/$kernel_file" - or die "Can't open `$kernel_root/$kernel_file'"; - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - `grep -q -s 'i2c\.o' "$kernel_root/$kernel_file"`; - $type = 2 if ! $?; - MAIN: while() { - $type = 1 if !$type and (m@^DRIVERS-\$@); - if (m@DRIVERS-\$\(CONFIG_SENSORS\)@) { - $_ = ; - redo MAIN; - } elsif (m@CONFIG_SENSORS@) { - $_ = while not m@endif@; - $_ = ; - $_ = if m@^$@; - redo MAIN; - } - if ($type == 1 and m@^DRIVERS \+= \$\(DRIVERS-y\)@) { - print OUTPUT <<'EOF'; -DRIVERS-$(CONFIG_SENSORS) += drivers/sensors/sensors.a -EOF - $pr1 = 1; - } - if ($type == 2 and m@^DRIVERS .*= \$\(DRIVERS-y\)@) { - print OUTPUT <<'EOF'; -DRIVERS-$(CONFIG_SENSORS) += drivers/sensors/sensor.o -EOF - $pr1 = 1; - } - if ($type == 0 and m@include arch/\$\(ARCH\)/Makefile@) { - print OUTPUT <<'EOF'; -ifeq ($(CONFIG_SENSORS),y) -DRIVERS := $(DRIVERS) drivers/sensors/sensors.a -endif - -EOF - $pr1 = 1; - } - print OUTPUT; - } - close INPUT; - close OUTPUT; - die "Automatic patch generation for main `Makefile' failed.\n". - "See our home page http://www.lm-sensors.org/ for assistance!" if $pr1 == 0; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; -} - -# This generates diffs for drivers/Makefile -# First, `sensors' is added to the ALL_SUB_DIRS list. Next, a couple of lines -# to add sensors to the SUB_DIRS and/or MOD_SUB_DIRS lists is put right before -# Rules.make is included. -# Of course, care is taken old lines are removed. -# $_[0]: sensors package root (like /tmp/sensors) -# $_[1]: Linux kernel tree (like /usr/src/linux) -sub gen_drivers_Makefile -{ - my ($package_root,$kernel_root) = @_; - my $kernel_file = "drivers/Makefile"; - my $package_file = $temp; - my $sensors_present; - my $pr1 = 0; - my $pr2 = 0; - my $new_style = 0; - - open INPUT,"$kernel_root/$kernel_file" - or die "Can't open `$kernel_root/$kernel_file'"; - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - MAIN: while() { - if (m@^mod-subdirs\s*:=@) { - $new_style = 1; - } - if ((! $new_style and m@^ALL_SUB_DIRS\s*:=@) or m@^mod-subdirs\s*:=@) { - $pr1 = 1; - $sensors_present = 0; - while (m@\\$@) { - $sensors_present = 1 if m@sensors@; - print OUTPUT; - $_ = ; - } - $sensors_present = 1 if m@sensors@; - s@$@ sensors@ if (not $sensors_present); - print OUTPUT; - $_ = ; - redo MAIN; - } - if (m@^ifeq.*CONFIG_SENSORS@) { - $_ = while not m@^endif@; - $_ = ; - $_ = if m@^$@; - redo MAIN; - } - if (m@^subdir.*CONFIG_SENSORS@) { - $_ = ; - redo MAIN; - } - if (!$pr2 and (m@^include \$\(TOPDIR\)/Rules.make$@ or m@^subdir-\$\(CONFIG_ACPI@)) { - $pr2 = 1; - if ($new_style) { - print OUTPUT <<'EOF'; -subdir-$(CONFIG_SENSORS) += sensors -EOF - } else { - print OUTPUT <<'EOF'; -ifeq ($(CONFIG_SENSORS),y) -SUB_DIRS += sensors -MOD_SUB_DIRS += sensors -else - ifeq ($(CONFIG_SENSORS),m) - MOD_SUB_DIRS += sensors - endif -endif - -EOF - } - } - print OUTPUT; - } - close INPUT; - close OUTPUT; - die "Automatic patch generation for `drivers/Makefile' failed.\n". - "See our home page http://www.lm-sensors.org/ for assistance!" if $pr1 == 0 or $pr2 == 0; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; -} - -# This generates diffs for drivers/char/Config.in -# It adds a line just before CONFIG_APM or main_menu_option lines to include -# the sensors Config.in. -# Of course, care is taken old lines are removed. -# $_[0]: sensors package root (like /tmp/sensors) -# $_[1]: Linux kernel tree (like /usr/src/linux) -sub gen_drivers_char_Config_in -{ - my ($package_root,$kernel_root) = @_; - my $kernel_file = "drivers/char/Config.in"; - my $package_file = $temp; - my $pr1 = 0; - - open INPUT,"$kernel_root/$kernel_file" - or die "Can't open `$kernel_root/$kernel_file'"; - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - MAIN: while() { - if (m@source drivers/i2c/Config.in@) { - $pr1 = 1; - print OUTPUT; - print OUTPUT "\nsource drivers/sensors/Config.in\n"; - $_ = ; - redo MAIN; - } - if (m@sensors@) { - $_ = ; - $_ = if m@^$@; - redo MAIN; - } - print OUTPUT; - } - close INPUT; - close OUTPUT; - die "Automatic patch generation for `drivers/char/Config.in' failed.\n". - "See our home page http://www.lm-sensors.org/ for assistance!" if $pr1 == 0; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; -} - -# This generates diffs for drivers/i2c/Config.in -# Several adapter drivers that are included in the lm_sensors package are -# added at the first and onlu sensors marker. -# Of course, care is taken old lines are removed. -# $_[0]: sensors package root (like /tmp/sensors) -# $_[1]: Linux kernel tree (like /usr/src/linux) -sub gen_drivers_i2c_Config_in -{ - my ($package_root,$kernel_root) = @_; - my $kernel_file = "drivers/i2c/Config.in"; - my $package_file = "$temp"; - my $pr1 = 0; - - open INPUT,"$kernel_root/$kernel_file" - or die "Can't open `$kernel_root/$kernel_file'"; - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - while() { - if (m@sensors code starts here@) { - $pr1++; - print OUTPUT; - while () { - last if m@sensors code ends here@; - } - print OUTPUT << 'EOF'; - bool 'I2C mainboard interfaces' CONFIG_I2C_MAINBOARD - if [ "$CONFIG_I2C_MAINBOARD" = "y" ]; then - dep_tristate ' Acer Labs ALI 1535' CONFIG_I2C_ALI1535 $CONFIG_I2C - dep_tristate ' Acer Labs ALI 1533 and 1543C' CONFIG_I2C_ALI15X3 $CONFIG_I2C - dep_tristate ' Acer Labs ALI 1563' CONFIG_I2C_ALI1563 $CONFIG_I2C - dep_tristate ' Apple Hydra Mac I/O' CONFIG_I2C_HYDRA $CONFIG_I2C_ALGOBIT - dep_tristate ' AMD 756/766/768/8111 and nVidia nForce' CONFIG_I2C_AMD756 $CONFIG_I2C - if [ "$CONFIG_I2C_AMD756" != "n" ]; then - dep_tristate ' SMBus multiplexing on the Tyan S4882' CONFIG_I2C_AMD756_S4882 $CONFIG_I2C_AMD756 - fi - dep_tristate ' AMD 8111 SMBus 2.0' CONFIG_I2C_AMD8111 $CONFIG_I2C - if [ "$CONFIG_ALPHA" = "y" ]; then - dep_tristate ' DEC Tsunami I2C interface' CONFIG_I2C_TSUNAMI $CONFIG_I2C_ALGOBIT - fi - dep_tristate ' Intel 82801 (ICH) and ESB' CONFIG_I2C_I801 $CONFIG_I2C - dep_tristate ' Intel i810AA/AB/E and i815' CONFIG_I2C_I810 $CONFIG_I2C_ALGOBIT - dep_tristate ' Intel 82371AB PIIX4(E), 443MX, ServerWorks OSB4/CSB5, SMSC Victory66' CONFIG_I2C_PIIX4 $CONFIG_I2C - dep_tristate ' Nvidia Nforce2/3/4' CONFIG_I2C_NFORCE2 $CONFIG_I2C - dep_tristate ' SiS 5595' CONFIG_I2C_SIS5595 $CONFIG_I2C - dep_tristate ' SiS 630/730' CONFIG_I2C_SIS630 $CONFIG_I2C - dep_tristate ' SiS 645/961,645DX/961,735' CONFIG_I2C_SIS645 $CONFIG_I2C $CONFIG_HOTPLUG - dep_tristate ' Savage 4' CONFIG_I2C_SAVAGE4 $CONFIG_I2C_ALGOBIT - dep_tristate ' VIA Technologies, Inc. VT82C586B' CONFIG_I2C_VIA $CONFIG_I2C_ALGOBIT - dep_tristate ' VIA Technologies, Inc. VT82C596/82C686/82xx and CX700' CONFIG_I2C_VIAPRO $CONFIG_I2C - dep_tristate ' Voodoo3 I2C interface' CONFIG_I2C_VOODOO3 $CONFIG_I2C_ALGOBIT - dep_tristate ' Pseudo ISA adapter (for some hardware sensors)' CONFIG_I2C_ISA $CONFIG_I2C - fi - -EOF - } - print OUTPUT; - } - close INPUT; - close OUTPUT; - die "Automatic patch generation for `drivers/i2c/Config.in' failed.\n". - "See our home page http://www.lm-sensors.org/ for assistance!" if $pr1 != 1; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; -} - -sub gen_drivers_sensors_Makefile -{ - my ($package_root,$kernel_root) = @_; - my $kernel_file = "drivers/sensors/Makefile"; - my $package_file = $temp; - - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - print OUTPUT <<'EOF'; -# -# Makefile for the kernel hardware sensors drivers. -# - -MOD_LIST_NAME := SENSORS_MODULES -O_TARGET := sensor.o - -obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o -obj-$(CONFIG_SENSORS_ADM1024) += adm1024.o -obj-$(CONFIG_SENSORS_ADM1025) += adm1025.o -obj-$(CONFIG_SENSORS_ADM1026) += adm1026.o -obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o -obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o -obj-$(CONFIG_SENSORS_ASB100) += asb100.o -obj-$(CONFIG_SENSORS_BT869) += bt869.o -obj-$(CONFIG_SENSORS_DDCMON) += ddcmon.o -obj-$(CONFIG_SENSORS_DS1621) += ds1621.o -obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o -obj-$(CONFIG_SENSORS_F71805F) += f71805f.o -obj-$(CONFIG_SENSORS_FSCHER) += fscher.o -obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o -obj-$(CONFIG_SENSORS_FSCSCY) += fscscy.o -obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o -obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o -obj-$(CONFIG_SENSORS_IT87) += it87.o -obj-$(CONFIG_SENSORS_LM63) += lm63.o -obj-$(CONFIG_SENSORS_LM75) += lm75.o -obj-$(CONFIG_SENSORS_LM78) += lm78.o -obj-$(CONFIG_SENSORS_LM80) += lm80.o -obj-$(CONFIG_SENSORS_LM83) += lm83.o -obj-$(CONFIG_SENSORS_LM85) += lm85.o -obj-$(CONFIG_SENSORS_LM87) += lm87.o -obj-$(CONFIG_SENSORS_LM90) += lm90.o -obj-$(CONFIG_SENSORS_LM92) += lm92.o -obj-$(CONFIG_SENSORS_LM93) += lm93.o -obj-$(CONFIG_SENSORS_MAX1619) += max1619.o -obj-$(CONFIG_SENSORS_MAX6650) += max6650.o -obj-$(CONFIG_SENSORS_MAXILIFE) += maxilife.o -obj-$(CONFIG_SENSORS_MTP008) += mtp008.o -obj-$(CONFIG_SENSORS_PC87360) += pc87360.o -obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o -obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o -obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o -obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o -obj-$(CONFIG_SENSORS_THMC50) += thmc50.o -obj-$(CONFIG_SENSORS_VIA686A) += via686a.o -obj-$(CONFIG_SENSORS_VT1211) += vt1211.o -obj-$(CONFIG_SENSORS_VT8231) += vt8231.o -obj-$(CONFIG_SENSORS_W83781D) += w83781d.o -obj-$(CONFIG_SENSORS_W83792D) += w83792d.o -obj-$(CONFIG_SENSORS_W83627HF) += w83627hf.o -obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o -obj-$(CONFIG_SENSORS_XEONTEMP) += xeontemp.o - -include $(TOPDIR)/Rules.make - -EOF - close OUTPUT; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; -} - -# This generates diffs for drivers/i2c/Makefile. -# Lines to add correct files to M_OBJS and/or L_OBJS are added just before -# Rules.make is included -# Of course, care is taken old lines are removed. -# $_[0]: sensors package root (like /tmp/sensors) -# $_[1]: Linux kernel tree (like /usr/src/linux) -sub gen_drivers_i2c_Makefile -{ - my ($package_root,$kernel_root) = @_; - my $kernel_file = "drivers/i2c/Makefile"; - my $package_file = $temp; - my $pr1 = 0; - - open INPUT,"$kernel_root/$kernel_file" - or die "Can't open `$kernel_root/$kernel_file'"; - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - while() { - if (m@sensors code starts here@) { - $pr1 ++; - print OUTPUT; - while () { - last if m@sensors code ends here@; - } - print OUTPUT <<'EOF'; -export-objs += i2c-amd756.o - -obj-$(CONFIG_I2C_ALI1535) += i2c-ali1535.o -obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o -obj-$(CONFIG_I2C_ALI1563) += i2c-ali1563.o -obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o -obj-$(CONFIG_I2C_AMD756_S4882) += i2c-amd756-s4882.o -obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o -obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o -obj-$(CONFIG_I2C_I801) += i2c-i801.o -obj-$(CONFIG_I2C_I810) += i2c-i810.o -obj-$(CONFIG_I2C_ISA) += i2c-isa.o -obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o -obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o -obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o -obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o -obj-$(CONFIG_I2C_SIS645) += i2c-sis645.o -obj-$(CONFIG_I2C_SAVAGE4) += i2c-savage4.o -obj-$(CONFIG_I2C_TSUNAMI) += i2c-tsunami.o -obj-$(CONFIG_I2C_VIA) += i2c-via.o -obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o -obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o -EOF - } - print OUTPUT; - } - close INPUT; - close OUTPUT; - die "Automatic patch generation for `drivers/i2c/Makefile' failed.\n". - "See our home page http://www.lm-sensors.org/ for assistance!" if $pr1 != 1; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; -} - -# Generate the diffs for the list of MAINTAINERS -# $_[0]: i2c package root (like /tmp/i2c) -# $_[1]: Linux kernel tree (like /usr/src/linux) -sub gen_MAINTAINERS -{ - my ($package_root,$kernel_root) = @_; - my $kernel_file = "MAINTAINERS"; - my $package_file = $temp; - my $done = 0; - - open INPUT,"$kernel_root/$kernel_file" - or die "Can't open `$kernel_root/$kernel_file'"; - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - MAIN: while() { - if (m@SENSORS DRIVERS@) { - $_= while not m@^$@; - $_=; - redo MAIN; - } - if (not $done and (m@SGI VISUAL WORKSTATION 320 AND 540@)) { - print OUTPUT <<'EOF'; -SENSORS DRIVERS -L: lm-sensors@lm-sensors.org -W: http://www.lm-sensors.org/ -S: Maintained - -EOF - $done = 1; - } - print OUTPUT; - } - close INPUT; - close OUTPUT; - die "Automatic patch generation for `MAINTAINERS' failed.\n". - "See our home page http://www.lm-sensors.org/ for assistance!" if $done == 0; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; -} - -# Generate the diffs for dmi_scan.c and i386_ksyms.c -# $_[0]: i2c package root (like /tmp/i2c) -# $_[1]: Linux kernel tree (like /usr/src/linux) -sub gen_dmi_scan -{ - my ($package_root,$kernel_root) = @_; - my $kernel_file = "arch/i386/kernel/dmi_scan.c"; - my $package_file = $temp; - my $done = 0; - - open INPUT,"$kernel_root/$kernel_file" - or die "Can't open `$kernel_root/$kernel_file'"; - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - MAIN: while() { - if ($done == 0 && m/^\s*int is_sony_vaio_laptop;\s*$/) { - print OUTPUT <<'EOF'; -int is_unsafe_smbus; -EOF - $done++; - } - if ($done == 1 && m/^\s*\* Check for a Sony Vaio system\s*$/) { - print OUTPUT <<'EOF'; - * Don't access SMBus on IBM systems which get corrupted eeproms - */ - -static __init int disable_smbus(struct dmi_blacklist *d) -{ - if (is_unsafe_smbus == 0) { - is_unsafe_smbus = 1; - printk(KERN_INFO "%s machine detected. Disabling SMBus accesses.\n", d->ident); - } - return 0; -} - -/* -EOF - $done++; - } - if ($done == 2 && m/^\s*\{ sony_vaio_laptop, "Sony Vaio", \{ \/\* This is a Sony Vaio laptop \*\/\s*$/) { - print OUTPUT <<'EOF'; - { disable_smbus, "IBM", { - MATCH(DMI_SYS_VENDOR, "IBM"), - NO_MATCH, NO_MATCH, NO_MATCH - } }, -EOF - $done++; - } - print OUTPUT; - } - close INPUT; - close OUTPUT; - die "Automatic patch generation for `$kernel_file' failed.\n". - "See our home page http://www.lm-sensors.org/ for assistance!" if $done != 3; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; - - $kernel_file = "arch/i386/kernel/i386_ksyms.c"; - $done = 0; - - open INPUT,"$kernel_root/$kernel_file" - or die "Can't open `$kernel_root/$kernel_file'"; - open OUTPUT,">$package_root/$package_file" - or die "Can't open $package_root/$package_file"; - MAIN: while() { - if ($done == 0 && m/^\s*extern int is_sony_vaio_laptop;\s*$/) { - print OUTPUT <<'EOF'; -extern int is_unsafe_smbus; -EXPORT_SYMBOL(is_unsafe_smbus); - -EOF - $done++; - } - print OUTPUT; - } - close INPUT; - close OUTPUT; - die "Automatic patch generation for `$kernel_file' failed.\n". - "See our home page http://www.lm-sensors.org/ for assistance!" if $done != 1; - print_diff $package_root,$kernel_root,$kernel_file,$package_file; -} - - -sub usage -{ - print "Usage: $0 package_root kernel_root\n"; - exit 1; -} - -# Main function -sub main -{ - my ($package_root,$kernel_root,%files,%includes,$package_file,$kernel_file); - my ($diff_command,$dummy,$data0,$data1,$sedscript,$version_string); - - # --> Read the command-line - $package_root = $ARGV[0]; - usage() unless defined $package_root; - die "Package root `$package_root' is not found\n" - unless -d "$package_root/mkpatch"; - $kernel_root = $ARGV[1]; - usage() unless defined $kernel_root; - die "Kernel root `$kernel_root' is not found\n" - unless -f "$kernel_root/Rules.make"; - - # --> Read FILES - open INPUT, "$package_root/mkpatch/FILES" - or die "Can't open `$package_root/mkpatch/FILES'"; - while () { - ($data0,$data1) = /(\S+)\s+(\S+)/; - $files{$data0} = $data1; - } - close INPUT; - - # --> Read INCLUDES - open INPUT, "$package_root/mkpatch/INCLUDES" - or die "Can't open `$package_root/mkpatch/INCLUDES'"; - while () { - ($data0,$data1) = /(\S+)\s+(\S+)/; - $includes{$data0} = $data1; - $sedscript .= 's,(#\s*include\s*)'.$data0.'(\s*),$1'."$data1".'$2, ; '; - } - close INPUT; - - die "First apply the i2c patches to `$kernel_root'!" - if ! -d "$kernel_root/drivers/i2c"; - - # --> Read "version.h" - open INPUT, "$package_root/version.h" - or die "Can't open `$package_root/version.h'"; - $version_string .= $_ while ; - close INPUT; - - # --> Start generating - foreach $package_file (sort keys %files) { - open INPUT,"$package_root/$package_file" - or die "Can't open `$package_root/$package_file'"; - open OUTPUT,">$package_root/$temp" - or die "Can't open `$package_root/$temp'"; - while () { - eval $sedscript; - if (m@#\s*include\s*"version.h"@) { - print OUTPUT $version_string; - } else { - print OUTPUT; - } - } - close INPUT; - close OUTPUT; - - $kernel_file = $files{$package_file}; - print_diff $package_root,$kernel_root,$kernel_file,$temp; - } - - gen_Makefile $package_root, $kernel_root; - gen_drivers_Makefile $package_root, $kernel_root; - gen_drivers_sensors_Makefile $package_root, $kernel_root; - gen_drivers_char_Config_in $package_root, $kernel_root; - gen_drivers_i2c_Config_in $package_root, $kernel_root; - gen_drivers_i2c_Makefile $package_root, $kernel_root; - gen_Documentation_Configure_help $package_root, $kernel_root; - gen_MAINTAINERS $package_root, $kernel_root; - gen_dmi_scan $package_root, $kernel_root; - - # Clear temporary file - unlink("$package_root/$temp"); -} - -main; - From a34b480cfe84c8ae0bec1689aacbb83c6f4656c5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 5 May 2007 09:47:54 +0000 Subject: [PATCH 022/718] README.patches: Delete, obsolete. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4384 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + README.patches | 30 ------------------------------ 2 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 README.patches diff --git a/CHANGES b/CHANGES index b2b48d61..1f21cbcf 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm_sensors CHANGES file SVN HEAD File sensors.conf.eg: Add a dme1737 section File lm_sensors.sysconfig: Delete, now generated by sensors-detect + File README.patches: Delete, obsolete Library: Clean up pwm symbol names translation Add dme1737 support Man page sensors.conf.5: Update the chip statement section diff --git a/README.patches b/README.patches deleted file mode 100644 index 70c2888e..00000000 --- a/README.patches +++ /dev/null @@ -1,30 +0,0 @@ -These patches were pre-made using the i2c and lm_sensors packages. - -In this document, the example version used of this patch is -lm_sensors-2.4.0-i2c-kernel-2.2.12. Your actual version may be -newer than this. - -To use: - -* Download a virgin kernel distribution of the exact version as - this patch distribution. - -* Unpackage and install the kernel source, but do not configure - or 'make' it yet. - -* Apply the I2C patch, for example: - -# patch -d /usr/src/linux -p1 < lm_sensors-2.4.0-i2c-kernel-2.2.12.patch - -* Apply the Lm_sensors patch, for example: - -# patch -d /usr/src/linux -p1 < lm_sensors-2.4.0-lm-kernel-2.2.12.patch - - -The patches must be applied in this order: i2c then lm_sensors - - -Enjoy! - - --- The Lm_sensors Development Team From adb328263c3114a1ed16371070f9e1553d1522b8 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 5 May 2007 10:07:36 +0000 Subject: [PATCH 023/718] doc/version-2: Delete, obsolete. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4385 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + doc/version-2 | 23 ----------------------- 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 doc/version-2 diff --git a/CHANGES b/CHANGES index 1f21cbcf..557ed876 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ lm_sensors CHANGES file ----------------------- SVN HEAD + File doc/version-2: Delete, obsolete File sensors.conf.eg: Add a dme1737 section File lm_sensors.sysconfig: Delete, now generated by sensors-detect File README.patches: Delete, obsolete diff --git a/doc/version-2 b/doc/version-2 deleted file mode 100644 index 5da58ea3..00000000 --- a/doc/version-2 +++ /dev/null @@ -1,23 +0,0 @@ -There have been many, many changes between version 1 and version 2 of this -package. Some of the more important ones: - -* Fully modular setup. This makes it much easier to support new hardware, - and consumes less kernel memory. -* Full support for I2C busses. This includes the VIA chipset I2C bus. If it - is supported by Simon Vogl, it is supported by us. -* Many things which were done in kernel space are now done in user space. - The most obvious result is the absence of /proc/sensors. Use instead the - supplied 'sensors' program. -* No more limits on the number of chips. -* All detected chips get their own directory under /proc/sys/dev/sensors -* /proc/bus contains a list of all I2C/SMBus adapters found. -* All applications which want to use sensor data can now access it through - the new libsensors. -* A configuration file which is read by the above mentioned library, which - can (through libsensors) be used by any application, and which describes - how all sensor readings are to be interpreted. -* All code has been completely rewritten. -* Many new drivers - -By now (version 2.3.0) so many things have changed that we do not even try -to keep the above list up-to-date. Just don't use version 1 anymore. From b170e0be99f30b9f7f8332392764b3e374d5d962 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 5 May 2007 12:43:03 +0000 Subject: [PATCH 024/718] Delete all kernel bus drivers, documentation and references. We are moving to a user-space-only package, all the drivers are maintained in the Linux kernel tree itself. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4386 7894878c-1315-0410-8ee3-d5d059ff63e0 --- BUGS | 8 - CHANGES | 1 + Makefile | 4 +- README | 21 - README.directories | 2 +- doc/busses/i2c-ali1535 | 53 -- doc/busses/i2c-ali15x3 | 135 ----- doc/busses/i2c-amd756 | 30 -- doc/busses/i2c-amd8111 | 48 -- doc/busses/i2c-hydra | 35 -- doc/busses/i2c-i801 | 107 ---- doc/busses/i2c-i810 | 66 --- doc/busses/i2c-ipmb | 55 -- doc/busses/i2c-ipmi | 61 --- doc/busses/i2c-nforce2 | 53 -- doc/busses/i2c-piix4 | 100 ---- doc/busses/i2c-savage4 | 42 -- doc/busses/i2c-sis5595 | 56 --- doc/busses/i2c-sis630 | 63 --- doc/busses/i2c-sis645 | 85 ---- doc/busses/i2c-tsunami | 46 -- doc/busses/i2c-via | 50 -- doc/busses/i2c-viapro | 61 --- doc/busses/i2c-virtual | 102 ---- doc/busses/i2c-voodoo3 | 83 --- doc/modules | 11 +- kernel/busses/Module.mk | 127 ----- kernel/busses/dmi_scan.c | 249 --------- kernel/busses/i2c-ali1535.c | 529 ------------------- kernel/busses/i2c-ali1563.c | 464 ----------------- kernel/busses/i2c-ali15x3.c | 548 -------------------- kernel/busses/i2c-amd756-s4882.c | 264 ---------- kernel/busses/i2c-amd756.c | 444 ---------------- kernel/busses/i2c-amd8111.c | 424 ---------------- kernel/busses/i2c-hydra.c | 191 ------- kernel/busses/i2c-i801.c | 737 --------------------------- kernel/busses/i2c-i810.c | 327 ------------ kernel/busses/i2c-ipmb.c | 380 -------------- kernel/busses/i2c-ipmi.c | 251 ---------- kernel/busses/i2c-isa.c | 88 ---- kernel/busses/i2c-keywest.c | 619 ----------------------- kernel/busses/i2c-keywest.h | 113 ----- kernel/busses/i2c-nforce2.c | 430 ---------------- kernel/busses/i2c-piix4.c | 584 --------------------- kernel/busses/i2c-savage4.c | 243 --------- kernel/busses/i2c-sis5595.c | 495 ------------------ kernel/busses/i2c-sis630.c | 544 -------------------- kernel/busses/i2c-sis645.c | 605 ---------------------- kernel/busses/i2c-tsunami.c | 170 ------- kernel/busses/i2c-via.c | 199 -------- kernel/busses/i2c-viapro.c | 564 --------------------- kernel/busses/i2c-virtual.c | 430 ---------------- kernel/busses/i2c-voodoo3.c | 296 ----------- kernel/chips/pca954x.c | 836 ------------------------------- kernel/include/i2c-virtual.h | 71 --- lm_sensors.lsm | 5 +- 56 files changed, 10 insertions(+), 12595 deletions(-) delete mode 100644 doc/busses/i2c-ali1535 delete mode 100644 doc/busses/i2c-ali15x3 delete mode 100644 doc/busses/i2c-amd756 delete mode 100644 doc/busses/i2c-amd8111 delete mode 100644 doc/busses/i2c-hydra delete mode 100644 doc/busses/i2c-i801 delete mode 100644 doc/busses/i2c-i810 delete mode 100644 doc/busses/i2c-ipmb delete mode 100644 doc/busses/i2c-ipmi delete mode 100644 doc/busses/i2c-nforce2 delete mode 100644 doc/busses/i2c-piix4 delete mode 100644 doc/busses/i2c-savage4 delete mode 100644 doc/busses/i2c-sis5595 delete mode 100644 doc/busses/i2c-sis630 delete mode 100644 doc/busses/i2c-sis645 delete mode 100644 doc/busses/i2c-tsunami delete mode 100644 doc/busses/i2c-via delete mode 100644 doc/busses/i2c-viapro delete mode 100644 doc/busses/i2c-virtual delete mode 100644 doc/busses/i2c-voodoo3 delete mode 100644 kernel/busses/Module.mk delete mode 100644 kernel/busses/dmi_scan.c delete mode 100644 kernel/busses/i2c-ali1535.c delete mode 100644 kernel/busses/i2c-ali1563.c delete mode 100644 kernel/busses/i2c-ali15x3.c delete mode 100644 kernel/busses/i2c-amd756-s4882.c delete mode 100644 kernel/busses/i2c-amd756.c delete mode 100644 kernel/busses/i2c-amd8111.c delete mode 100644 kernel/busses/i2c-hydra.c delete mode 100644 kernel/busses/i2c-i801.c delete mode 100644 kernel/busses/i2c-i810.c delete mode 100644 kernel/busses/i2c-ipmb.c delete mode 100644 kernel/busses/i2c-ipmi.c delete mode 100644 kernel/busses/i2c-isa.c delete mode 100644 kernel/busses/i2c-keywest.c delete mode 100644 kernel/busses/i2c-keywest.h delete mode 100644 kernel/busses/i2c-nforce2.c delete mode 100644 kernel/busses/i2c-piix4.c delete mode 100644 kernel/busses/i2c-savage4.c delete mode 100644 kernel/busses/i2c-sis5595.c delete mode 100644 kernel/busses/i2c-sis630.c delete mode 100644 kernel/busses/i2c-sis645.c delete mode 100644 kernel/busses/i2c-tsunami.c delete mode 100644 kernel/busses/i2c-via.c delete mode 100644 kernel/busses/i2c-viapro.c delete mode 100644 kernel/busses/i2c-virtual.c delete mode 100644 kernel/busses/i2c-voodoo3.c delete mode 100644 kernel/chips/pca954x.c delete mode 100644 kernel/include/i2c-virtual.h diff --git a/BUGS b/BUGS index b584ba98..9126dd8c 100644 --- a/BUGS +++ b/BUGS @@ -77,11 +77,3 @@ lock bit for the base address registers. Also, the temperature reading in sis5595 is usually wrong. Different formulas are required for different versions of the chip and different motherboards. - -================================ -bus drivers (all) - -Rmmod'ing a bus driver when the /proc directory for a chip -driver on that bus is in use may cause a kernel oops, because -the chip driver gets removed too. See ticket #331 for details. -Not likely to happen. No obvious way to fix. diff --git a/CHANGES b/CHANGES index 557ed876..065109f0 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ lm_sensors CHANGES file ----------------------- SVN HEAD + All bus modules and documentation: Delete File doc/version-2: Delete, obsolete File sensors.conf.eg: Add a dme1737 section File lm_sensors.sysconfig: Delete, now generated by sensors-detect diff --git a/Makefile b/Makefile index 0f82fe1e..eeb8af9c 100644 --- a/Makefile +++ b/Makefile @@ -176,7 +176,7 @@ ifneq ($(MAKECMDGOALS),user_uninstall) ifneq ($(MAKECMDGOALS),package) ifneq ($(MAKECMDGOALS),userpackage) ifneq ($(MAKECMDGOALS),manhtml) -SRCDIRS += kernel kernel/busses kernel/chips +SRCDIRS += kernel kernel/chips endif endif endif @@ -367,9 +367,7 @@ userpackage: version clean $(KERNELINCLUDEDIR)/sensors.h find $$lmpackage/ -type f | grep -v ^$$lmpackage/$$lmpackage$$ | \ grep -v ^$$lmpackage/$$lmpackage.tar$$ | \ grep -v ^$$lmpackage/doc/chips | \ - grep -v ^$$lmpackage/doc/busses | \ grep -v ^$$lmpackage/kernel/chips | \ - grep -v ^$$lmpackage/kernel/busses | \ grep -v ^$$lmpackage/$$ | \ grep -v /CVS | \ grep -v /\\.# | \ diff --git a/README b/README index c8fc488b..8ba5687d 100644 --- a/README +++ b/README @@ -42,27 +42,6 @@ See the lm_sensors download page for further guidance: ============================================================================= -At least the following I2C/SMBus adapters are supported: - Acer Labs M1533, M1535, M1543C and M1563 - AMD 756, 766, 768 and 8111 - AMD 8111 SMBus 2.0 - Apple Hydra (used on some PPC machines) - ATI IXP200, IXP300, IXP400, SB600 - DEC 21272/21274 (Tsunami/Typhoon - on Alpha boards) - Intel ICH/ICH0/ICH2/ICH3/ICH4/ICH5/ICH6/ICH7/ICH8/ICH9 (82801xx) - Intel 6300ESB, 631xESB/632xESB (ESB2) - Intel PIIX4 (used in many Intel chipsets) - Intel I810/I810E/I815/I845G GMCH - Intel 82443MX (440MX) - NVidia nForce, nForce2, nForce3, nForce4 - ServerWorks OSB4, CSB5, CSB6, HT-1000 - SiS 5595, 630, 645, 655, 730 - SMSC Victory66 - 3Dfx Voodoo 3 and Banshee - VIA Technologies VT82C586B, VT82C596A/B, VT82C686A/B, VT8231, - VT8233, VT8233A, VT8235, VT8237R/A, VT8251, CX700 - - At least the following hardware sensor chips are supported: Analog Devices ADM1021, ADM1021A, ADM1022, ADM1023, ADM1024, ADM1025, ADM1026, ADM1027, ADM1030, ADM1031, diff --git a/README.directories b/README.directories index 00adce1a..37a50074 100644 --- a/README.directories +++ b/README.directories @@ -5,7 +5,7 @@ The directories within this package: * etc A sample configuration file for the 'sensors' program. * kernel - The kernel modules: I2C/SMBus master drivers, and sensor chip drivers. + The kernel modules: sensor chip drivers. * lib The user-space sensors support library code. * prog diff --git a/doc/busses/i2c-ali1535 b/doc/busses/i2c-ali1535 deleted file mode 100644 index 17612e44..00000000 --- a/doc/busses/i2c-ali1535 +++ /dev/null @@ -1,53 +0,0 @@ -Kernel driver `i2c-ali1535.o' - -Status: Beta; block reads/writes untested (not used by any current chip - driver) - -Supported adapters: - * Acer Labs, Inc. ALI 1535 (south bridge) - Datasheet: Available at the Acer Labs website (password may be required) - -Author: Frodo Looijaard , Philip Edelbrock - , Mark D. Studebaker and - Dan Eaton - -License: GPL - - -Module Parameters ------------------ - -(none) - - -Description ------------ - -This is the driver for the SMB Host controller on -Acer Labs Inc. (ALI) M1535 South Bridge. - -The M1535 is a South bridge for portable systems. -It is very similar to the M15x3 South bridges also produced -by Acer Labs Inc. Some of the registers within the part -have moved and some have been redefined slightly. Additionally, -the sequencing of the SMBus transactions has been modified -to be more consistent with the sequencing recommended by -the manufacturer and observed through testing. These -changes are reflected in this driver and can be identified -by comparing this driver to the i2c-ali15x3 driver. -For an overview of these chips see http://www.acerlabs.com - -The SMB controller is part of the 7101 device, which is an -ACPI-compliant Power Management Unit (PMU). - -The whole 7101 device has to be enabled for the SMB to work. -You can't just enable the SMB alone. -The SMB and the ACPI have separate I/O spaces. -We make sure that the SMB is enabled. We leave the ACPI alone. - - -Features --------- - -This driver controls the SMB Host only. -This driver does not use interrupts. diff --git a/doc/busses/i2c-ali15x3 b/doc/busses/i2c-ali15x3 deleted file mode 100644 index e531694f..00000000 --- a/doc/busses/i2c-ali15x3 +++ /dev/null @@ -1,135 +0,0 @@ -Kernel driver `i2c-ali15x3.o' - -Status: Complete and tested; block reads/writes untested (not used by any - current chip driver) - -Supported adapters: - * Acer Labs, Inc. ALI 1533 and 1543C (south bridge) - Datasheet: Available at the Acer Labs website (password required) - -Author: Frodo Looijaard , Philip Edelbrock - , and Mark D. Studebaker - -License: GPL - - -Module Parameters ------------------ - -* force_addr: int - Initialize the base address of the i2c controller - - -Notes ------ - -The force_addr parameter is useful for boards that don't set the address -in the BIOS. Does not do a PCI force; the device must still be present -in lspci. Don't use this unless the driver complains that the -base address is not set. -Example: 'modprobe i2c-ali15x3 force_addr=0xe800' - -SMBus periodically hangs on ASUS P5A motherboards and can only be -cleared by a power cycle. Cause unknown (see Issues below). - - -Description ------------ - -This is the driver for the SMB Host controller on -Acer Labs Inc. (ALI) M1541 and M1543C South Bridges. - -The M1543C is a South bridge for desktop systems. -The M1541 is a South bridge for portable systems. -They are part of the following ALI chipsets: - "Aladdin Pro 2": Includes the M1621 Slot 1 North bridge - with AGP and 100MHz CPU Front Side bus - - "Aladdin V": Includes the M1541 Socket 7 North bridge - with AGP and 100MHz CPU Front Side bus - Some Aladdin V motherboards: - Asus P5A - Atrend ATC-5220 - BCM/GVC VP1541 - Biostar M5ALA - Gigabyte GA-5AX (** Generally doesn't work because the BIOS doesn't - enable the 7101 device! **) - Iwill XA100 Plus - Micronics C200 - Microstar (MSI) MS-5169 - - "Aladdin IV": Includes the M1541 Socket 7 North bridge - with host bus up to 83.3 MHz. - -For an overview of these chips see http://www.acerlabs.com -At this time the full data sheets on the web site are password protected, -however if you contact the ALI office in San Jose -they may give you the password. - -The M1533/M1543C devices appear as FOUR separate devices -on the PCI bus. An output of lspci will show something similar -to the following: - - 00:02.0 USB Controller: Acer Laboratories Inc. M5237 (rev 03) - 00:03.0 Bridge: Acer Laboratories Inc. M7101 <= THIS IS THE ONE WE NEED - 00:07.0 ISA bridge: Acer Laboratories Inc. M1533 (rev c3) - 00:0f.0 IDE interface: Acer Laboratories Inc. M5229 (rev c1) - -** IMPORTANT ** -** If you have a 1533 or 1543C on the board and you get -** "ali15x3.o: Error: Can't detect ali15x3!" -** then run lspci. -** If you see the 1533 and 5229 devices but NOT the 7101 device, -** then you must enable ACPI, the PMU, SMB, or something similar -** in the BIOS. If you can't figure out how to enable the -** 7101 device in the BIOS, you can try one of the "hotplug" modules - -** see below. -** The driver won't work if it can't find the 7101 device. - -The SMB controller is part of the 7101 device, which is an -ACPI-compliant Power Management Unit (PMU). - -The whole 7101 device has to be enabled for the SMB to work. -You can't just enable the SMB alone. -The SMB and the ACPI have separate I/O spaces. -We make sure that the SMB is enabled. We leave the ACPI alone. - - -Features --------- -This driver controls the SMB Host only. -The SMB Slave controller on the M15X3 is not enabled. -This driver does not use interrupts. - - -Issues ------- -This driver requests the I/O space for only the SMB -registers. It doesn't use the ACPI region. - -On the ASUS P5A motherboard, there are several reports that -the SMBus will hang and this can only be resolved by -powering off the computer. It appears to be worse when the board -gets hot, for example under heavy CPU load, or in the summer. -There may be electrical problems on this board. -On the P5A, the W83781D sensor chip is on both the ISA and -SMBus. Therefore the SMBus hangs can generally be avoided -by accessing the W83781D on the ISA bus only. - - -Hot Plug Modules ----------------- - -There are EXPERIMENTAL "hotplug" modules which will enable the -m7101 device if it is not enabled on your motherboard. -Use these at your own risk. Read the README file carefully. - -m7101 Version 0.1 for 2.2 and early 2.3 kernels: - README: http://www.netroedge.com/~lm78/misc/README-m7101.txt - source and README: http://www.netroedge.com/~lm78/misc/m7101-0.1.tar.gz - -m7101 Version 0.2 for 2.4 and later 2.3 kernels: - In the directory prog/hotplug in this package. - Must be built separately. - - diff --git a/doc/busses/i2c-amd756 b/doc/busses/i2c-amd756 deleted file mode 100644 index 77b02350..00000000 --- a/doc/busses/i2c-amd756 +++ /dev/null @@ -1,30 +0,0 @@ -Kernel driver `i2c-amd756.o' - -Status: Complete and somewhat tested - -Supported adapters: - * AMD 756 - * AMD 766 - * AMD 768 - * AMD 8111 - Datasheets: Publicly available on AMD website - - * nVidia nForce - Datasheet: Unavailable - - -Module Parameters ------------------ - -(none) - - -Description ------------ - -This driver supports the AMD 756, 766, 768 and 8111 Peripheral Bus Controllers, and -the nVidia nForce. - -Note that for the 8111, there are two SMBus adapters. The SMBus 1.0 adapter is -supported by this driver, and the SMBus 2.0 adapter is supported -by the i2c-amd8111 driver. diff --git a/doc/busses/i2c-amd8111 b/doc/busses/i2c-amd8111 deleted file mode 100644 index 784883bb..00000000 --- a/doc/busses/i2c-amd8111 +++ /dev/null @@ -1,48 +0,0 @@ -Kernel driver `i2c-adm8111.o' - -Status: Slightly tested. - -Supported adapters: - * AMD-8111 SMBus 2.0 PCI interface - -Datasheets: - AMD datasheet not yet available, but almost everything can be found - in the publicly available ACPI 2.0 specification, which the adapter - follows. - -Author: Vojtech Pavlik - -Module Parameters ------------------ - -None. - -Description ------------ - -If you see something like this: - -00:07.2 SMBus: Advanced Micro Devices [AMD] AMD-8111 SMBus 2.0 (rev 02) - Subsystem: Advanced Micro Devices [AMD] AMD-8111 SMBus 2.0 - Flags: medium devsel, IRQ 19 - I/O ports at d400 [size=32] - -in your 'lspci -v', then this driver is for your chipset. - -Process Call Support --------------------- - -Supported. - -SMBus 2.0 Support ------------------ - -Supported. Both PEC and block process call support is implemented. -Slave mode or host notification are not yet implemented. - -Notes ------ - -Note that for the 8111, there are two SMBus adapters. The SMBus 2.0 adapter is -supported by this driver, and the SMBus 1.0 adapter is supported -by the i2c-amd756 driver. diff --git a/doc/busses/i2c-hydra b/doc/busses/i2c-hydra deleted file mode 100644 index 55bee71e..00000000 --- a/doc/busses/i2c-hydra +++ /dev/null @@ -1,35 +0,0 @@ -Kernel driver `i2c-hydra.o' - -Status: Complete and somewhat tested - -Supported adapters: - * Apple `Hydra' Mac I/O - Datasheet: Was publicly available from the Apple website, now seems to - have disappeared?!? - -Author: Geert Uytterhoeven - - -Module Parameters ------------------ - -(none) - - -Description ------------ - -i2c-hydra is an i2c bus driver for CHRP motherboards with the Apple Hydra Mac -I/O. - -Your /proc/pci or lspci listing must show this : - - Unknown class: Apple Hydra (rev 2) - -To install this driver, simply do - # modprobe i2c-hydra - -This driver uses the i2c-algo-bit module which must be -modprobed and/or enabled in your kernel -(Character Devices -> I2C Support -> I2C Bit-Banging Interfaces). - diff --git a/doc/busses/i2c-i801 b/doc/busses/i2c-i801 deleted file mode 100644 index ec218287..00000000 --- a/doc/busses/i2c-i801 +++ /dev/null @@ -1,107 +0,0 @@ -Kernel driver `i2c-i801.o' - -Status: Tested and stable. - Block reads/writes lightly tested. - HW PEC support Beta. - I2C Block Read support Beta. - -Supported adapters: - * Intel 82801AA and 82801AB (ICH and ICH0 - part of the - '810' and '810E' chipsets) - * Intel 82801BA (ICH2 - part of the '815E' chipset) - * Intel 82801CA/CAM (ICH3) - * Intel 82801DB (ICH4) - * Intel 82801EB/ER (ICH5) - * Intel 6300ESB/ESB2 - * Intel 82801FB/FR/FW/FRW (ICH6) - * Intel ICH7/ICH8/ICH9 - Datasheets: Publicly available at the Intel website - -Authors: Frodo Looijaard , Philip Edelbrock - , and Mark Studebaker - - -Module Parameters ------------------ - -* force_addr: int - Forcibly enable the ICH at the given address. EXTREMELY DANGEROUS! - - -Description ------------ - -The ICH (properly known as the 82801AA), ICH0 (82801AB), -ICH2 (82801BA), ICH3 (82801CA/CAM) and later devices -are Intel chips that are a part of -Intel's '810' chipset for Celeron-based PCs, -'810E' chipset for Pentium-based PCs, '815E' chipset, and others. - -The ICH chips contain at least SEVEN separate PCI functions -in TWO logical PCI devices. -An output of lspci will show something similar to the following: - - 00:1e.0 PCI bridge: Intel Corporation: Unknown device 2418 (rev 01) - 00:1f.0 ISA bridge: Intel Corporation: Unknown device 2410 (rev 01) - 00:1f.1 IDE interface: Intel Corporation: Unknown device 2411 (rev 01) - 00:1f.2 USB Controller: Intel Corporation: Unknown device 2412 (rev 01) - 00:1f.3 Unknown class [0c05]: Intel Corporation: Unknown device 2413 (rev 01) - -The SMBus controller is function 3 in device 1f. -Class 0c05 is SMBus Serial Controller. - -If you do NOT see the 24x3 device at function 3, and you can't -figure out any way in the BIOS to enable it, -(and especially if you have an Asus P4B board), -see prog/hotplug/README.p4b. - -The ICH chips are quite similar to Intel's PIIX4 chip, -at least in the SMBus controller. - -See the file i2c-piix4 for some additional information. - - -Process Call Support --------------------- - -Not supported. - - -I2C Block Read Support ----------------------- - -The ICH4 supports a special 3-byte address (command code -plus 2 more bytes) I2C block read. -The driver and the kernel i2c protocol stack do not -support this. -The ICH5 and higher support a standard 1-byte address (command code) -I2C block read. The driver does support this. - - -SMBus 2.0 Support ------------------ - -The 82801DB (ICH4) and later chips support several SMBus 2.0 features. -Kernel and driver support are as follows: - -Feature Kernel Driver -Slave mode no no -Host notify no no -Block PEC yes yes -Hardware PEC yes yes - - -Other ICH4 and later Features ------------------------------ - -The following additional features are also _not_ supported: - -32 Byte buffer - - -********************** -The lm_sensors project gratefully acknowledges the support of -Texas Instruments in the initial development of this driver. - -The lm_sensors project gratefully acknowledges the support of -Intel in the development of SMBus 2.0 / ICH4 features of this driver. diff --git a/doc/busses/i2c-i810 b/doc/busses/i2c-i810 deleted file mode 100644 index fcc44ffa..00000000 --- a/doc/busses/i2c-i810 +++ /dev/null @@ -1,66 +0,0 @@ -Kernel driver `i2c-i810.o' - -Status: Stable - -Supported adapters: - * Intel 82810, 82810-DC100, 82810E, and 82815 (GMCH) - * Intel 82845G (GMCH) - -Author: Frodo Looijaard , Philip Edelbrock - , - Kyösti Mälkki , - and Mark D. Studebaker - -Main contact: Mark Studebaker - - -Module Parameters ------------------ -(none) - - -Description ------------ -This driver uses the i2c-algo-bit module which must be -modprobed and/or enabled in your kernel -(Character Devices -> I2C Support -> I2C Bit-Banging Interfaces). - -WARNING: If you have an '810' or '815' motherboard, your standard I2C -temperature sensors are most likely on the 801's I2C bus. -You want the i2c-i801.o driver for those, not this driver. - -Now for the i2c-i810... - -The GMCH chip contains two I2C interfaces. - -The first interface is used for DDC (Data Display Channel) -which is a serial channel through the VGA monitor connector -to a DDC-compliant monitor. This interface is defined by the -Video Electronics Standards Association (VESA). The standards -are available for purchase at http://www.vesa.org . - -The second interface is a general-purpose I2C bus. -It may be connected to a TV-out chip such as the BT869 or possibly -to a digital flat-panel display. - -Stability ---------- -Apparently stable. - - -Supported Devices ------------------ -See above. - - -Features --------- -Both busses use the i2c-algo-bit driver for 'bit banging' and support -for specific transactions is provided by i2c-algo-bit. - - -Issues ------- -If you enable bus testing in i2c-algo-bit (insmod i2c-algo-bit bit_test=1), -the test may fail; if so, the i2c-i810 driver won't be inserted. -However, we think this has been fixed. diff --git a/doc/busses/i2c-ipmb b/doc/busses/i2c-ipmb deleted file mode 100644 index 06d3a026..00000000 --- a/doc/busses/i2c-ipmb +++ /dev/null @@ -1,55 +0,0 @@ -Kernel driver `i2c-ipmb.o' - -Status: IN DEVELOPMENT - DOESN'T WORK AT ALL - DON'T BOTHER TRYING IT - -Supported adapters: - * IPMI BMC - -Author: Mark D. Studebaker - - -Module Parameters ------------------ -(none) - - -Description ------------ -This is an adapter which provides access to the IPMB -(Intelligent Platform Management Bus) and other I2C / SMBus busses -behind the BMC (Baseboard Management Controller) via -IPMI (Intelligent Platform Management Interface). - -This provides low-level access to all devices on busses -behind the BMC. For high-level access to sensors known -to the BMC, use the i2c-ipmi and bmcsensors modules. - -This module REQUIRES the IPMI kernel patch by Corey Minyard, -v13 or higher, available at http://openipmi.sourceforge.net . -Other IPMI drivers are not supported. - -See http://www.intel.com/design/servers/ipmi/ for -IPMI standards information. - -You must configure the following features in your kernel -(under Character Devices): - IPMI top-level message handler - IPMI KCS handler -The IPMI device interface and IPMI watchdog handler are not required. - -If the KCS handler (ipmi_kcs_drv) is configured as a module, -you must modprobe it separately, it will not load automatically -when you modprobe i2c-ipmi or ipmi_msghandler (unless you set up -/etc/modules.conf to load ipmi_kcs_drv when ipmi_msghandler is loaded). - -Issues ------- -Only one BMC is supported - shouldn't be a problem. - -Alpha! - - - -********************** -The lm_sensors project gratefully acknowledges the support of -Hewlett Packard (Ft. Collins) in the development of this driver. diff --git a/doc/busses/i2c-ipmi b/doc/busses/i2c-ipmi deleted file mode 100644 index 7832c776..00000000 --- a/doc/busses/i2c-ipmi +++ /dev/null @@ -1,61 +0,0 @@ -Kernel driver `i2c-ipmi.o' - -Status: Alpha - -Supported adapters: - * IPMI BMC - -Author: Mark D. Studebaker - - -Module Parameters ------------------ -(none) - - -Description ------------ -This is a "dummy" adapter which provides access to the -BMC (Baseboard Management Controller) via IPMI (Intelligent Platform -Management Interface). It is used by the bmcsensors module. - -Together with the bmcsensors module, this provides high-level -access to sensors known by the BMC. For low-level access to -IPMB (I2C/SMBus) busses behind the BMC, use the i2c-ipmb module. - -This module REQUIRES the IPMI kernel patch by Corey Minyard, -v13 or higher, available at http://openipmi.sourceforge.net . -Other IPMI drivers are not supported. - -See http://www.intel.com/design/servers/ipmi/ for -IPMI standards information. - -You must configure the following features in your kernel -(under Character Devices): - IPMI top-level message handler - IPMI KCS handler -The IPMI device interface and IPMI watchdog handler are not required. - -If the KCS handler (ipmi_kcs_drv) is configured as a module, -you must modprobe it separately, it will not load automatically -when you modprobe i2c-ipmi or ipmi_msghandler (unless you set up -/etc/modules.conf to load ipmi_kcs_drv when ipmi_msghandler is loaded). - -Issues ------- -Only one BMC is supported - shouldn't be a problem. - -Only one client is supported - to be fixed. - -Libsensors was hacked to support this dummy driver; only -the ISA dummy driver was supported previously. -The library needs further enhancements for full -dummy driver support. - -Alpha! - - - -********************** -The lm_sensors project gratefully acknowledges the support of -Hewlett Packard (Ft. Collins) in the development of this driver. diff --git a/doc/busses/i2c-nforce2 b/doc/busses/i2c-nforce2 deleted file mode 100644 index c9213298..00000000 --- a/doc/busses/i2c-nforce2 +++ /dev/null @@ -1,53 +0,0 @@ -Kernel driver i2c-nforce2 -------------------------- - -Status: Well tested - -Supported adapters: - * nVidia nForce2 SMBus PCI interface - (10de:0064, included in nForce2 MCP, - 10de:0084, included in nForce2 Ultra 400 MCP) - Datasheet: not publicly available, but seems to be similar to the - AMD-8111 SMBus 2.0 adapter. - - * nVidia nForce3 SMBus PCI interface - (10de:00d4, included in nForce3 Pro150 MCP, - 10de:00e4, included in nForce3 250Gb MCP) - Datasheet: same as for nForce2 SMBus PCI interface - - * nVidia nForce4 SMBus PCI interface - (10de:0052, included in nForce4 MCP) - (10de:0034, included in nForce4 MCP-04) - (10de:0264, included in nForce4 MCP51) - (10de:0368, included in nForce4 MCP55) - Datasheet: same as for nForce2 SMBus PCI interface - -Author: Hans-Frieder Vogt - - -Description ------------ - -i2c-nforce2 is a driver for the SMBuses included in the nVidia nForce2, -nForce3 and nForce4 MCP. - -If your 'lspci -v' listing shows something like the following, - -00:01.1 SMBus: nVidia Corporation: Unknown device 0064 (rev a2) - Subsystem: Asustek Computer, Inc.: Unknown device 0c11 - Flags: 66Mhz, fast devsel, IRQ 5 - I/O ports at c000 [size=32] - Capabilities: - -then this driver should support the SMBuses of your motherboard. - - -Notes ------ - -The SMBus adapter in the nForce2/3/4 chipset seems to be very similar to the -SMBus 2.0 adapter in the AMD-8111 southbridge. However, I could only get the -driver to work with direct I/O access, which is different to the EC interface -of the AMD-8111. -Tested on Asus A7N8X. The ACPI DSDT table of the Asus A7N8X lists two SMBuses, -both of which are supported by this driver. diff --git a/doc/busses/i2c-piix4 b/doc/busses/i2c-piix4 deleted file mode 100644 index d7cce66e..00000000 --- a/doc/busses/i2c-piix4 +++ /dev/null @@ -1,100 +0,0 @@ -Kernel driver `i2c-piix4.o' - -Status: Complete and well-tested - except for Victory66 support which is Alpha. - -Supported adapters: - * Intel 82371AB PIIX4 and PIIX4E - * Intel 82443MX (440MX) - Datasheet: Publicly available at the Intel website - * ServerWorks OSB4, CSB5, CSB6 and HT-1000 southbridges - Datasheet: Only available via NDA from ServerWorks - * ATI IXP200, IXP300, IXP400 and SB600 southbridges - Datasheet: Not publicly available - * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge - Datasheet: Publicly available at the SMSC website http://www.smsc.com - -Author: Frodo Looijaard and Philip Edelbrock - - - -Module Parameters ------------------ - -* force: int - Forcibly enable the PIIX4. DANGEROUS! -* force_addr: int - Forcibly enable the PIIX4 at the given address. EXTREMELY DANGEROUS! - - -Description ------------ - -The PIIX4 (properly known as the 82371AB) is an Intel chip with a lot of -functionality. Among other things, it implements the PCI bus. One of its -minor functions is implementing a System Management Bus. This is a true -SMBus - you can not access it on I2C levels. The good news is that it -natively understands SMBus commands and you do not have to worry about -timing problems. The bad news is that non-SMBus devices connected to it -can confuse it mightily. Yes, this is known to happen... - -Cat /proc/pci, and see whether it contains an entry like this: - - Bus 0, device 1, function 3: - Bridge: Intel 82371AB PIIX4 ACPI (rev 1). - Medium devsel. Fast back-to-back capable. - -Bus and device numbers may differ, but the function number must be identical -(like many PCI devices, the PIIX4 incorporates a number of different -'functions', which can be considered as separate devices). If you find such -an entry, you have a PIIX4 SMBus controller. - -On some computers (most notably, some Dells), the SMBus is disabled by -default. If you use the insmod parameter 'force=1', the kernel module - will try to enable it. THIS IS VERY DANGEROUS! If the BIOS did not -set up a correct address for this module, you could get in big trouble -(read: crashes, data corruption, etc.). Try this only as a last resort -(try BIOS updates first, for example), and backup first! An even more -dangerous option is 'force_addr='. This will not only enable the -PIIX4 like 'force' foes, but it will also set a new base I/O port address. -The SMBus parts of the PIIX4 needs a range of 8 of these addresses to -function correctly. If these addresses are already reserved by some other -device, you will get into big trouble! DON'T USE THIS IF YOU ARE NOT VERY -SURE ABOUT WHAT YOU ARE DOING! - -The PIIX4E is just an new version of the PIIX4; it is supported as well. The -PIIX/PIIX3 does not implement an SMBus or I2C bus, so you can't use this -driver on those mainboards. - -The ServerWorks Southbridges, the Intel 440MX, -and the Victory66 are identical to the PIIX4 in I2C/SMBus support. - -If you own Force CPCI735 motherboard or other OSB4 based systems you may need -to change the SMBus Interrupt Select register so the SMBus controller uses -the SMI mode. - -1) Use lspci command and locate the PCI device with the SMBus controller: - 00:0f.0 ISA bridge: ServerWorks OSB4 South Bridge (rev 4f) - The line may vary for different chipsets. Please consult the driver source - for all possible PCI ids (and lspci -n to match them). Lets assume the - device is located at 00:0f.0. -2) Now you just need to change the value in 0xD2 register. Get it first with - command: lspci -xxx -s 00:0f.0 - If the value is 0x3 then you need to change it to 0x1 - setpci -s 00:0f.0 d2.b=1 - -Please note that you don't need to do that in all cases, just when the SMBus is -not working properly. - - -Hardware-specific issues ------------------------- - -This driver will refuse to load on IBM systems with an Intel PIIX4 SMBus. -Some of these machines have an RFID EEPROM (24RF08) connected to the SMBus, -which can easily get corrupted due to a state machine bug. These are mostly -Thinkpad laptops, but desktop systems may also be affected. We have no list -of all affected systems, so the only safe solution was to prevent access to -the SMBus on all IBM systems (detected using DMI data.) - -For additional information, read README.thinkpad. diff --git a/doc/busses/i2c-savage4 b/doc/busses/i2c-savage4 deleted file mode 100644 index bce8110b..00000000 --- a/doc/busses/i2c-savage4 +++ /dev/null @@ -1,42 +0,0 @@ -Kernel driver `i2c-savage4.o' - -Status: Alpha - -Supported adapters: - * Savage4 - * Savage2000 - -Author: Frodo Looijaard , Philip Edelbrock - , Ralph Metzler , - Alexander Wold, and Mark D. Studebaker - -Main contact: Sensors mailing list - - -Module Parameters ------------------ - -(none) - - -Description ------------ - -The Savage4 chips contain two I2C interfaces (aka a I2C 'master' -or 'host'). - -The first interface is used for DDC (Data Display Channel) -which is a serial channel through the VGA monitor connector -to a DDC-compliant monitor. This interface is defined by the -Video Electronics Standards Association (VESA). The standards -are available for purchase at http://www.vesa.org . -The DDC bus is not yet supported because its register is not -directly memory-mapped. - -The second interface is a general-purpose I2C bus. -This is the only interface supported by the driver at the moment. - -This driver uses the i2c-algo-bit module which must be -modprobed and/or enabled in your kernel -(Character Devices -> I2C Support -> I2C Bit-Banging Interfaces). - diff --git a/doc/busses/i2c-sis5595 b/doc/busses/i2c-sis5595 deleted file mode 100644 index 9997d32d..00000000 --- a/doc/busses/i2c-sis5595 +++ /dev/null @@ -1,56 +0,0 @@ -Kernel driver `i2c-sis5595.o' - -Status: Beta - -Supported adapters: - * Silicon Integrated Systems Corp. SiS5595 Southbridge - Datasheet: Publicly available at the Silicon Integrated Systems Corp. site. - -Author: Frodo Looijaard and - Mark D. Studebaker - - Note: all have mfr. ID 0x1039. - SUPPORTED PCI ID - 5595 0008 - - Note: The chips below contain a 0008 device which is incompatible with the - 5595. We recognize these by the presence of the listed - "blacklist" PCI ID and refuse to load. - - NOT SUPPORTED PCI ID BLACKLIST PCI ID - 540 0008 0540 - 550 0008 0550 - 5513 0008 5511 - 5581 0008 5597 - 5582 0008 5597 - 5597 0008 5597 - 5598 0008 5597/5598 - 630 0008 0630 - 645 0008 0645 - 730 0008 0730 - 735 0008 0735 - -Module Parameters ------------------ - -force_addr=0xaddr Set the I/O base address. Useful for boards - that don't set the address in the BIOS. Does not do a - PCI force; the device must still be present in lspci. - Don't use this unless the driver complains that the - base address is not set. - Example: 'modprobe i2c-sis5595 force_addr=0x290' - - -Description ------------ - -i2c-sis5595 is a true SMBus host driver for motherboards with the -SiS5595 southbridges. - -WARNING: If you are trying to access the integrated sensors on the -SiS5595 chip, you want the sis5595.o driver for those, not this driver. -This driver is a BUS driver, not a CHIP driver. -A BUS driver is used by other CHIP drivers to access chips on the bus. - -To install this driver, simply do - # modprobe i2c-sis5595 diff --git a/doc/busses/i2c-sis630 b/doc/busses/i2c-sis630 deleted file mode 100644 index 40a73761..00000000 --- a/doc/busses/i2c-sis630 +++ /dev/null @@ -1,63 +0,0 @@ -Kernel driver `i2c-sis630.o' - -Status: beta - -Supported adapters: - * Silicon Integrated Systems Corp (SiS) - 630 chipset (Datasheet: available at http://amalysh.bei.t-online.de/docs/SIS/) - 730 chipset - * Possible other SiS chipsets ? - -Author: Alexander Malysh - - -License: GPL - - -Module Parameters ------------------ - -force = [1|0] Forcibly enable the SIS630. DANGEROUS! - This can be interesting for chipsets not named - above to check if it works for you chipset, but DANGEROUS! -high_clock = [1|0] Forcibly set Host Master Clock to 56KHz (default,what your BIOS use). - DANGEROUS! This should be a bit faster, but freeze some systems (i.e. - my Laptop). - - -Description ------------ - -This SMBus only driver is known to work on motherboards with the above named -chipsets. - -If you see something like this: - -00:00.0 Host bridge: Silicon Integrated Systems [SiS] 630 Host (rev 31) -00:01.0 ISA bridge: Silicon Integrated Systems [SiS] 85C503/5513 - -or like this: - -00:00.0 Host bridge: Silicon Integrated Systems [SiS] 730 Host (rev 02) -00:01.0 ISA bridge: Silicon Integrated Systems [SiS] 85C503/5513 - -in your 'lspci' output , then this driver is for your chipset. - -Note: kernel versions later than 2.4.18 not tested. - -If anyone owns a board with those chips AND is willing to risk crashing & -burning an otherwise well-behaved kernel in the name of progress... please -contact me at or via the project's mailing list: see -http://www.lm-sensors.org/wiki/AuthorsAndContributors. Please send bug reports -and/or success stories as well. - - -Thank Yous ------------ -Philip Edelbrock -- testing SiS730 support -Mark M. Hoffman -- bug fixes - -To anyone else which I forgot here ;), thanks! - diff --git a/doc/busses/i2c-sis645 b/doc/busses/i2c-sis645 deleted file mode 100644 index 2bdcbfed..00000000 --- a/doc/busses/i2c-sis645 +++ /dev/null @@ -1,85 +0,0 @@ -Kernel driver `i2c-sis645.o' - -Status: Beta - -Supported adapters: - * Silicon Integrated Systems Corp (SiS) - Any combination of these host bridges: - 645, 645DX (aka 646), 648, 650, 651, 655, 735, 745, 746 - and these south bridges: - 961, 962, 963(L) - -Author: Mark M. Hoffman - -License: GPL - - -Module Parameters ------------------ - -(none) - - -Description ------------ - -This SMBus only driver is known to work on motherboards with the above named -chipset combinations. The driver was developed without benefit of a proper -datasheet from SiS. The SMBus registers are assumed compatible with those of -the SiS630, although they are located in a completely different place. Thanks -to Alexander Malysh for providing the SiS630 datasheet (and -driver). - -The command "lspci" as root should produce something like these lines: - -00:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645 -00:02.0 ISA bridge: Silicon Integrated Systems [SiS] 85C503/5513 -00:02.1 SMBus: Silicon Integrated Systems [SiS]: Unknown device 0016 - -or perhaps this... - -00:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645 (rev 02) -00:02.0 ISA bridge: Silicon Integrated Systems [SiS]: Unknown device 0961 -00:02.1 SMBus: Silicon Integrated Systems [SiS]: Unknown device 0016 - -(kernel versions later than 2.4.18 may fill in the "Unknown"s) - -If the SMBus line is missing, then the BIOS on the board has disabled the -device. This driver is capable of enabling it, as long as the kernel has -CONFIG_HOTPLUG enabled. In that case, the SMBus device will appear in "lspci" -after the driver is loaded. Note that you need to rebuild lm_sensors AFTER -running "make config" or equivalent on your kernel, otherwise the i2c-sis645 -driver will not build in this support. - -I suspect that this driver could be made to work for the following SiS chipsets -as well: 635, and 635T. -If anyone owns a board with those chips AND is willing to risk crashing & -burning an otherwise well-behaved kernel in the name of progress... please -contact me at or via the project's mailing list: -see http://www.lm-sensors.org/wiki/AuthorsAndContributors. Please send bug reports -and/or success stories as well. - - -TO DOs ------------ -* The driver does not support SMBus block reads/writes; I may add them if a -scenario is found where they're needed. - - -Thank Yous ------------ -Mark D. Studebaker - - design hints and bug fixes -Alexander Maylsh - - ditto, plus an important datasheet... almost the one I really wanted -Hans-Günter Lütke Uphues - - patch for SiS735 -Robert Zwerus - - testing for SiS645DX -Kianusch Sayah Karadji - - patch for SiS645DX/962 -Ken Healy - - patch for Sis655 - -To anyone else who has written w/ feedback, thanks! - diff --git a/doc/busses/i2c-tsunami b/doc/busses/i2c-tsunami deleted file mode 100644 index 7679ab9c..00000000 --- a/doc/busses/i2c-tsunami +++ /dev/null @@ -1,46 +0,0 @@ -Kernel driver `i2c-tsunami.o' - -Status: Stable - -Supported adapters: - * DEC Tsunami 21272/Typhoon 21274 based boards - -Author: Oleg I. Vdovikin - -Main contact: Oleg I. Vdovikin - - -Module Parameters ------------------ -(none) - - -Description ------------ -The Tsunami/Typhoon chipsets' "Cchip" supports I2C busses via MPD registers -and appropriate open drain pins. This bus is usually used to read -SPD SDRAM DIMMs, however there may be other devices on -the bus also. These chips are used with wide range of 21264A boards. - -This driver uses the i2c-algo-bit module which must be -modprobed and/or enabled in your kernel -(Character Devices -> I2C Support -> I2C Bit-Banging Interfaces). - - -Stability ---------- -Apparently stable. - -Supported Devices ------------------ -This driver was written and tested on the 'API UP2000(+) -boards'. As seems it should work with any Tsunami based system. - -Features --------- -I2C busses use the i2c-algo-bit driver for 'bit banging' and support -for specific transactions is provided by i2c-algo-bit. - -Issues ------- -Not known. diff --git a/doc/busses/i2c-via b/doc/busses/i2c-via deleted file mode 100644 index b484b509..00000000 --- a/doc/busses/i2c-via +++ /dev/null @@ -1,50 +0,0 @@ -Kernel driver `i2c-via.o' - -Status: Complete and well-tested - -Supported adapters: - * VIA Technologies, InC. VT82C586B - Datasheet: Publicly available at the VIA website - -Author: Kyösti Mälkki - - -Module Parameters ------------------ - -(none) - - -Description ------------ - -i2c-via is an i2c bus driver for motherboards with VIA chipset. - -The following VIA pci chipsets are supported: - - MVP3, VP3, VP2/97, VPX/97 - - others with South bridge VT82C586B - -Your /proc/pci or lspci listing must show this : - - Bridge: VIA Technologies, Inc. VT82C586B ACPI (rev 10) - -To install this driver, simply do - # modprobe i2c-via - -This driver uses the i2c-algo-bit module which must be -modprobed and/or enabled in your kernel -(Character Devices -> I2C Support -> I2C Bit-Banging Interfaces). - - Problems? - - Q: You have VT82C586B on the motherboard, but not in the listing. - - A: Go to your BIOS setup, section PCI devices or similar. - Turn USB support on, and try again. - - Q: No error messages, but still i2c doesn't seem to work. - - A: This can happen. This driver uses the pins VIA recommends in their - datasheets, but there are several ways the motherboard manufacturer - can actually wire the lines. - diff --git a/doc/busses/i2c-viapro b/doc/busses/i2c-viapro deleted file mode 100644 index 375d305d..00000000 --- a/doc/busses/i2c-viapro +++ /dev/null @@ -1,61 +0,0 @@ -Kernel driver `i2c-viapro.o' - -Status: Stable - -Supported adapters: - * VIA Technologies, Inc. VT82C596A/B - Datasheet: Sometimes available at the VIA website - - * VIA Technologies, Inc. VT82C686A/B - Datasheet: Sometimes available at the VIA website - - * VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237R/A, VT8251 - Datasheet: available on request and under NDA from VIA - - * VIA Technologies, Inc. CX700 - Datasheet: available on request and under NDA from VIA - -Authors: - Kyösti Mälkki - Mark D. Studebaker - Jean Delvare - - -Module Parameters ------------------ - -* force: int - Forcibly enable the SMBus controller. DANGEROUS! -* force_addr: int - Forcibly enable the SMBus at the given address. EXTREMELY DANGEROUS! - - -Description ------------ - -i2c-viapro is a true SMBus host driver for motherboards with one of the -supported VIA south bridges. - -Your /proc/pci or lspci -n listing must show one of these : - - device 1106:3050 (VT82C596A function 3) - device 1106:3051 (VT82C596B function 3) - device 1106:3057 (VT82C686 function 4) - device 1106:3074 (VT8233) - device 1106:3147 (VT8233A) - device 1106:8235 (VT8231 function 4) - device 1106:3177 (VT8235) - device 1106:3227 (VT8237R) - device 1106:3337 (VT8237A) - device 1106:3287 (VT8251) - device 1106:8324 (CX700) - -If none of these show up, you should look in the BIOS for settings like -enable ACPI / SMBus or even USB. - -Except for the oldest chips (VT82C596A/B, VT82C686A and most probably -VT8231), this driver supports I2C block transactions. Such transactions -are mainly useful to read from and write to EEPROMs. - -The CX700 additionally appears to support SMBus PEC, although this driver -doesn't implement it. diff --git a/doc/busses/i2c-virtual b/doc/busses/i2c-virtual deleted file mode 100644 index 45341505..00000000 --- a/doc/busses/i2c-virtual +++ /dev/null @@ -1,102 +0,0 @@ -Virtual i2c bus -Brian Kuschak - - -I2C devices must have a unique 7 bit address on the bus to which they -are attached. Many I2C chips have one or more input lines which can be -used to configure one or more of their address bits. This allows the -hardware designer to include multiple chips on a single bus by selecting -different addresses for each one. However, some chips have fixed addresses -which present a problem if more than one of them are required on a board. -Also, sometimes there are more devices than there are selectable addresses. - -A common solution is to break the i2c bus into disjoint segments, by using -a multiplexor or i2c bus switch. This electrically isolates the individual -bus segments. Then the devices with duplicate addresses are placed on -separate bus segments, to prevent address conflicts. - -This seems to be a very common approach in certain types of applications, -such as bladed chassis, where many identical 'blades' or cards are inserted -into a common backplane. The I2C bus on each blade is then located behind -a mux or i2c bus switch. This solution works great from the hardware -perspective, but presents some complexities for software. - -The 'virtual i2c adapter' driver is an attempt to provide a flexible software -abstraction to simiplify these issues, while minimizing the impact on -existing code and fitting nicely into the i2c driver framework. - - -What is a 'virtual i2c adapter' -=============================== - -Think of this adapter as a layer above the existing algorithm and adapter -drivers. The virtual i2c adapter is the handle by which you access a -specific multiplexed bus segment. Each disjoint bus segment becomes a new -virtual bus. The virtual adapter is associated with a 'real' adapter and a -set of multiplexor control variables. - -For example: you have an i2c-0 bus with one multiplexor or i2c bus switch, -and the mux has four outputs which can be electrically connected to the -i2c-0 bus. You would register four virtual i2c busses, one for each position -of the mux. As part of the registration, you provide callback functions to -select and deselect the mux as well as the selector values to be passed to -these functions. - - --------- <--------> i2c-1 virtual - | i2c mux | <--------> i2c-2 virtual - i2c-0 <-------> | | <--------> i2c-3 virtual - ibm_ocp | 0x74 | <--------> i2c-4 virtual - --------- - ^ - | - +--- (or externally controlled) - -The mux may be i2c-controlled, in which case the mux_addr is set to the -slave address (0x74) and the mux_val would be the port number to select (0-3). -Alternatively, the mux could be controlled by some fixed memory-mapped register -in which case only the mux_val would be needed. The callback functions -are hardware specific and written by the user. - -Once the virtual busses are registered, you may talk to any devices behind -the mux simply the using the i2c-1, i2c-2, i2c-3, etc. adapters instead of -the i2c-0 adapter. This makes the mux essentially transparent to the -i2c_client. - -The great advantage of course is that all the existing sensor drivers and -other i2c client drivers automatically work, and the mux becomes transparent -to them. - - -Additional capabilities -======================= - -This driver also supports multiple levels of muxing, by allowing the -user to register a virtual bus which has a different virtual bus as its -'real' adapter. In addition, each virtual bus may have different kinds of -multiplexors, with each bus having its own set of callback functions. -This allows you to easily support some very complex topologies. - -In addition to multiplexing, some systems require that you obtain hardware -access to the bus behind the mux before talking on it. (Again, bladed chassis -typically 'fence' other blades off the bus to prevent a crashed blade from -bringing down the whole backplane.) Before talking on this bus, you have to -arbitrate with the other blades to acquire exclusive access to the bus. This -requirement is met by the addition of two new function pointers to the -algorithm drivers, acquire_exclusive() and release_exclusive(). Traditional -adapters will not use these and they can safely be left NULL. If they are -non-null, the virtual bus driver will call the acquire_exclusive() function -before attempting any operations on that virtual bus. This function may block, -and this is done before acquiring the lock on the underlying 'real' bus to -allow transactions on the real bus to continue unimpeded while waiting for -arbitrartion. In addition the ownership is only held for as long as it takes -to complete the transfer. - - -Files -===== - -drivers/i2c/i2c-virtual.c: The 'algorithm' and 'adapter' driver -include/linux/i2c-virtual.h: Header file with the mux control structure - and callback prototypes. - - diff --git a/doc/busses/i2c-voodoo3 b/doc/busses/i2c-voodoo3 deleted file mode 100644 index bc1ca497..00000000 --- a/doc/busses/i2c-voodoo3 +++ /dev/null @@ -1,83 +0,0 @@ -Kernel driver `i2c-voodoo3.o' - -Status: 'Beta' and still under development and testing - -Supported adapters: - * 3dfx Voodoo3 based cards - * Voodoo Banshee based cards - -Author: Frodo Looijaard , Philip Edelbrock - , Ralph Metzler , - and Mark D. Studebaker - -Main contact: Philip Edelbrock - -The code is based upon Ralph's test code (he did the hard stuff ;') - - -Module Parameters ------------------ - -(none) - - -Description ------------ - -The 3dfx Voodoo3 chip contains two I2C interfaces (aka a I2C 'master' -or 'host'). - -The first interface is used for DDC (Data Display Channel) -which is a serial channel through the VGA monitor connector -to a DDC-compliant monitor. This interface is defined by the -Video Electronics Standards Association (VESA). The standards -are available for purchase at http://www.vesa.org . - -The second interface is a general-purpose I2C bus. -The intent by 3dfx was to allow manufacturers to add extra -chips to the video card such as a TV-out chip such as the BT869 or possibly -even I2C based temperature sensors like the ADM1021 or LM75. - -The 'feature' set of this driver is based on the i2c-piix4 (SMBus) -features. I.e., SMBus byte reads and writes, as well as detected faults in -transmission. Quick reads/writes, block transactions, word transactions, -are yet unwritten but are probably not too hard to add. - -This driver uses the i2c-algo-bit module which must be -modprobed and/or enabled in your kernel -(Character Devices -> I2C Support -> I2C Bit-Banging Interfaces). - -Stability ---------- -Seems to be stable on the test machine, but needs more testing on other -machines. - -Simultaneous accesses of the DDC and I2C busses may cause errors. - - -Supported Devices ------------------ -Specifically, this driver was written and tested on the '3dfx Voodoo3 AGP -3000' which has a tv-out feature (s-video or composite). According to the -docs and discussions, this code should work for any Voodoo3 based cards as -well as Voodoo Banshee based cards. The DDC interface has been tested -on a Voodoo Banshee card. - -Features --------- -This driver controls the I2C controller of the Voodoo3 chip. 'byte read' -transactions and 'data_byte write' transactions are supported, but all else -is not (but is probably easy to add if the need arises). - -Issues ------- -Probably many, but it seems to work OK on my system. :') - - -External Device Connection --------------------------- -The digital video input jumpers give availability to the I2C bus. -Specifically, pins 13 and 25 (bottom row middle, and bottom right-end) are -the I2C clock and I2C data lines, respectively. +5V and GND are probably -also easily available making the addition of extra I2C/SMBus devices easy -to implement. diff --git a/doc/modules b/doc/modules index 395743d2..fd685dd1 100644 --- a/doc/modules +++ b/doc/modules @@ -1,15 +1,14 @@ Installing Modules ================== -'make install' will install the kernel modules modules in the -subdirectories /lib/modules/$version/kernel/drivers/i2c and -/lib/modules/$version/kernel/drivers/sensors. This puts the modules -in the same location as a kernel 'make modules_install' does so -that there will be no duplicate modules. +'make install' will install the kernel modules in the +subdirectory /lib/modules/$version/kernel/drivers/i2c/chips. +This puts the modules in the same location as a kernel +'make modules_install' does so that there will be no duplicate modules. If 'make install' fails, particularly on Mandrake kernels, see FAQ #3.8 (fix MODPREF in the Makefile) and #3.9. For details on options that apply to most modules, see doc/chips/MODPARMS. For details on options specific to particular -modules, see the documentation in doc/chips/ and doc/busses/. +modules, see the documentation in doc/chips/. diff --git a/kernel/busses/Module.mk b/kernel/busses/Module.mk deleted file mode 100644 index 4b6fc1ff..00000000 --- a/kernel/busses/Module.mk +++ /dev/null @@ -1,127 +0,0 @@ -# Module.mk - Makefile for a Linux module for reading sensor data. -# Copyright (c) 1998, 1999 Frodo Looijaard -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -# Note that MODULE_DIR (the directory in which this file resides) is a -# 'simply expanded variable'. That means that its value is substituted -# verbatim in the rules, until it is redefined. -MODULE_DIR := kernel/busses -KERNELBUSSESDIR := $(MODULE_DIR) - -# Regrettably, even 'simply expanded variables' will not put their currently -# defined value verbatim into the command-list of rules... -KERNELBUSSESTARGETS := -ifeq ($(shell if grep -q '^CONFIG_IPMI_HANDLER=' $(LINUX)/.config; then echo 1; fi),1) -#doesn't work yet -#KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-ipmb.o -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-ipmi.o -endif - -ifneq ($(shell if grep -q '^CONFIG_I2C_ALI1535=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-ali1535.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_ALI15X3=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-ali15x3.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_ALI1563=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-ali1563.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_AMD756=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-amd756.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_AMD756_S4882=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-amd756-s4882.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_AMD8111=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-amd8111.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_HYDRA=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-hydra.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_I801=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-i801.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_I810=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-i810.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_ISA=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-isa.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_NFORCE2=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-nforce2.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_SIS5595=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-sis5595.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_SIS630=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-sis630.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_SIS645=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-sis645.o -endif -# don't compile dmi_scan unless x86 because it needs isa access -ifneq ($(shell if grep -q '^CONFIG_I2C_PIIX4=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-piix4.o -ifeq ($(shell if grep -q '^CONFIG_X86=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/dmi_scan.o -endif -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_SAVAGE4=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-savage4.o -endif -# don't compile unless alpha because of kernel include-file dependencies -ifeq ($(MACHINE),alpha) -ifneq ($(shell if grep -q '^CONFIG_I2C_TSUNAMI=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-tsunami.o -endif -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_VIA=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-via.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_VIAPRO=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-viapro.o -endif -ifneq ($(shell if grep -q '^CONFIG_I2C_VOODOO3=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-voodoo3.o -endif - -# Include all dependency files -INCLUDEFILES += $(KERNELBUSSESTARGETS:.o=.d) - -all-kernel-busses: $(KERNELBUSSESTARGETS) -all :: all-kernel-busses - -# -# If $MODPREF/kernel exists, we presume the new (2.4.0) /lib/modules/x.y.z directory -# layout, so we install in kernel/drivers/i2c/busses and remove old versions in misc/ -# and kernel/drivers/i2c/ . Otherwise we install in misc/ as before. -# -install-kernel-busses: all-kernel-busses - if [ -n "$(KERNELBUSSESTARGETS)" ] ; then \ - $(MKDIR) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/busses ; \ - $(INSTALL) -m 644 $(KERNELBUSSESTARGETS) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/busses ; \ - for i in $(KERNELBUSSESTARGETS) ; do \ - $(RM) $(DESTDIR)$(MODPREF)/misc/`basename $$i` $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/`basename $$i` \ - $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/`basename $$i`.gz $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/busses/`basename $$i`.gz ; \ - done ; \ - $(RMDIR) $(DESTDIR)$(MODPREF)/misc 2> /dev/null || true ; \ - fi - -install :: install-kernel-busses - -clean-kernel-busses: - $(RM) $(KERNELBUSSESDIR)/*.o $(KERNELBUSSESDIR)/*.d -clean :: clean-kernel-busses diff --git a/kernel/busses/dmi_scan.c b/kernel/busses/dmi_scan.c deleted file mode 100644 index 7d2748c7..00000000 --- a/kernel/busses/dmi_scan.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - Taken from arch/i386/kernel/dmi_scan.c. - Changes dmi_ident to be non-static so we can access. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" - -int is_unsafe_smbus; -EXPORT_SYMBOL(is_unsafe_smbus); - -struct dmi_header -{ - u8 type; - u8 length; - u16 handle; -}; - -enum -{ - DMI_BIOS_VENDOR, - DMI_BIOS_VERSION, - DMI_BIOS_DATE, - DMI_SYS_VENDOR, - DMI_PRODUCT_NAME, - DMI_PRODUCT_VERSION, - DMI_BOARD_VENDOR, - DMI_BOARD_NAME, - DMI_BOARD_VERSION, - DMI_STRING_MAX -}; - -#define dmi_printk(x) -//#define dmi_printk(x) printk x - -static char * __init dmi_string(struct dmi_header *dm, u8 s) -{ - u8 *bp=(u8 *)dm; - bp+=dm->length; - if(!s) - return ""; - s--; - while(s>0 && *bp) - { - bp+=strlen(bp); - bp++; - s--; - } - return bp; -} - -/* - * We have to be cautious here. We have seen BIOSes with DMI pointers - * pointing to completely the wrong place for example - */ - -static int __init dmi_table(u32 base, int len, int num, void (*decode)(struct dmi_header *)) -{ - u8 *buf; - struct dmi_header *dm; - u8 *data; - int i=0; - - buf = ioremap(base, len); - if(buf==NULL) - return -1; - - data = buf; - - /* - * Stop when we see all the items the table claimed to have - * OR we run off the end of the table (also happens) - */ - - while(ilength; - while(data-buf>4, buf[14]&0x0F)); - else - dmi_printk((KERN_INFO "DMI present.\n")); - dmi_printk((KERN_INFO "%d structures occupying %d bytes.\n", - num, len)); - dmi_printk((KERN_INFO "DMI table at 0x%08X.\n", - base)); - if(dmi_table(base,len, num, decode)==0) - return 0; - } - fp+=16; - } - return -1; -} - - -char *dmi_ident[DMI_STRING_MAX]; - -/* - * Save a DMI string - */ - -static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string) -{ - char *d = (char*)dm; - char *p = dmi_string(dm, d[string]); - if(p==NULL || *p == 0) - return; - if (dmi_ident[slot]) - return; - dmi_ident[slot] = kmalloc(strlen(p)+1, GFP_KERNEL); - if(dmi_ident[slot]) - strcpy(dmi_ident[slot], p); - else - printk(KERN_ERR "dmi_save_ident: out of memory.\n"); -} - -/* - * Process a DMI table entry. Right now all we care about are the BIOS - * and machine entries. For 2.5 we should pull the smbus controller info - * out of here. - */ - -static void __init dmi_decode(struct dmi_header *dm) -{ - switch(dm->type) - { - case 0: - dmi_printk(("BIOS Vendor: %s\n", - dmi_string(dm, data[4]))); - dmi_save_ident(dm, DMI_BIOS_VENDOR, 4); - dmi_printk(("BIOS Version: %s\n", - dmi_string(dm, data[5]))); - dmi_save_ident(dm, DMI_BIOS_VERSION, 5); - dmi_printk(("BIOS Release: %s\n", - dmi_string(dm, data[8]))); - dmi_save_ident(dm, DMI_BIOS_DATE, 8); - break; - case 1: - dmi_printk(("System Vendor: %s\n", - dmi_string(dm, data[4]))); - dmi_save_ident(dm, DMI_SYS_VENDOR, 4); - dmi_printk(("Product Name: %s\n", - dmi_string(dm, data[5]))); - dmi_save_ident(dm, DMI_PRODUCT_NAME, 5); - dmi_printk(("Version: %s\n", - dmi_string(dm, data[6]))); - dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6); - dmi_printk(("Serial Number: %s\n", - dmi_string(dm, data[7]))); - break; - case 2: - dmi_printk(("Board Vendor: %s\n", - dmi_string(dm, data[4]))); - dmi_save_ident(dm, DMI_BOARD_VENDOR, 4); - dmi_printk(("Board Name: %s\n", - dmi_string(dm, data[5]))); - dmi_save_ident(dm, DMI_BOARD_NAME, 5); - dmi_printk(("Board Version: %s\n", - dmi_string(dm, data[6]))); - dmi_save_ident(dm, DMI_BOARD_VERSION, 6); - break; - } -} - -int __init dmi_scan_mach(void) -{ - int err; - printk("dmi_scan.o version %s (%s)\n", LM_VERSION, LM_DATE); - err = dmi_iterate(dmi_decode); - if(err) - printk("dmi_scan.o: SM BIOS not found\n"); - else - printk("dmi_scan.o: SM BIOS found\n"); - - if(dmi_ident[DMI_SYS_VENDOR] != NULL - && strncmp(dmi_ident[DMI_SYS_VENDOR], "IBM", 3) == 0) - is_unsafe_smbus = 1; - return 0; -} - -MODULE_DESCRIPTION("SM BIOS DMI Scanner"); -MODULE_LICENSE("GPL"); - -module_init(dmi_scan_mach); diff --git a/kernel/busses/i2c-ali1535.c b/kernel/busses/i2c-ali1535.c deleted file mode 100644 index ca3d15b3..00000000 --- a/kernel/busses/i2c-ali1535.c +++ /dev/null @@ -1,529 +0,0 @@ -/* - i2c-ali1535.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2000 Frodo Looijaard , - Philip Edelbrock , - Mark D. Studebaker , - Dan Eaton and - Stephen Rousset - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - This is the driver for the SMB Host controller on - Acer Labs Inc. (ALI) M1535 South Bridge. - - The M1535 is a South bridge for portable systems. - It is very similar to the M15x3 South bridges also produced - by Acer Labs Inc. Some of the registers within the part - have moved and some have been redefined slightly. Additionally, - the sequencing of the SMBus transactions has been modified - to be more consistent with the sequencing recommended by - the manufacturer and observed through testing. These - changes are reflected in this driver and can be identified - by comparing this driver to the i2c-ali15x3 driver. - For an overview of these chips see http://www.acerlabs.com - - The SMB controller is part of the 7101 device, which is an - ACPI-compliant Power Management Unit (PMU). - - The whole 7101 device has to be enabled for the SMB to work. - You can't just enable the SMB alone. - The SMB and the ACPI have separate I/O spaces. - We make sure that the SMB is enabled. We leave the ACPI alone. - - This driver controls the SMB Host only. - - This driver does not use interrupts. -*/ - - -/* Note: we assume there can only be one ALI1535, with one SMBus interface */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - - -/* ALI1535 SMBus address offsets */ -#define SMBHSTSTS (0 + ali1535_smba) -#define SMBHSTTYP (1 + ali1535_smba) -#define SMBHSTPORT (2 + ali1535_smba) -#define SMBHSTCMD (7 + ali1535_smba) -#define SMBHSTADD (3 + ali1535_smba) -#define SMBHSTDAT0 (4 + ali1535_smba) -#define SMBHSTDAT1 (5 + ali1535_smba) -#define SMBBLKDAT (6 + ali1535_smba) - -/* PCI Address Constants */ -#define SMBCOM 0x004 -#define SMBREV 0x008 -#define SMBCFG 0x0D1 -#define SMBBA 0x0E2 -#define SMBHSTCFG 0x0F0 -#define SMBCLK 0x0F2 - -/* Other settings */ -#define MAX_TIMEOUT 500 /* times 1/100 sec */ -#define ALI1535_SMB_IOSIZE 32 - -/* -*/ -#define ALI1535_SMB_DEFAULTBASE 0x8040 - -/* ALI1535 address lock bits */ -#define ALI1535_LOCK 0x06 < dwe > - -/* ALI1535 command constants */ -#define ALI1535_QUICK 0x00 -#define ALI1535_BYTE 0x10 -#define ALI1535_BYTE_DATA 0x20 -#define ALI1535_WORD_DATA 0x30 -#define ALI1535_BLOCK_DATA 0x40 -#define ALI1535_I2C_READ 0x60 - -#define ALI1535_DEV10B_EN 0x80 /* Enable 10-bit addressing in */ - /* I2C read */ -#define ALI1535_T_OUT 0x08 /* Time-out Command (write) */ -#define ALI1535_A_HIGH_BIT9 0x08 /* Bit 9 of 10-bit address in */ - /* Alert-Response-Address */ - /* (read) */ -#define ALI1535_KILL 0x04 /* Kill Command (write) */ -#define ALI1535_A_HIGH_BIT8 0x04 /* Bit 8 of 10-bit address in */ - /* Alert-Response-Address */ - /* (read) */ - -#define ALI1535_D_HI_MASK 0x03 /* Mask for isolating bits 9-8 */ - /* of 10-bit address in I2C */ - /* Read Command */ - -/* ALI1535 status register bits */ -#define ALI1535_STS_IDLE 0x04 -#define ALI1535_STS_BUSY 0x08 /* host busy */ -#define ALI1535_STS_DONE 0x10 /* transaction complete */ -#define ALI1535_STS_DEV 0x20 /* device error */ -#define ALI1535_STS_BUSERR 0x40 /* bus error */ -#define ALI1535_STS_FAIL 0x80 /* failed bus transaction */ -#define ALI1535_STS_ERR 0xE0 /* all the bad error bits */ - -#define ALI1535_BLOCK_CLR 0x04 /* reset block data index */ - -/* ALI1535 device address register bits */ -#define ALI1535_RD_ADDR 0x01 /* Read/Write Bit in Device */ - /* Address field */ - /* -> Write = 0 */ - /* -> Read = 1 */ -#define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */ - - -static struct pci_driver ali1535_driver; -static unsigned short ali1535_smba = 0; - - -/* Detect whether a ALI1535 can be found, and initialize it, where necessary. - Note the differences between kernels with the old PCI BIOS interface and - newer kernels with the real PCI interface. In compat.h some things are - defined to make the transition easier. */ -int ali1535_setup(struct pci_dev *ALI1535_dev) -{ - int error_return = 0; - unsigned char temp; - -/* Check the following things: - - SMB I/O address is initialized - - Device is enabled - - We can use the addresses -*/ - -/* Determine the address of the SMBus area */ - pci_read_config_word(ALI1535_dev, SMBBA, &ali1535_smba); - ali1535_smba &= (0xffff & ~(ALI1535_SMB_IOSIZE - 1)); - if (ali1535_smba == 0) { - printk - ("i2c-ali1535.o: ALI1535_smb region uninitialized - upgrade BIOS?\n"); - error_return = -ENODEV; - } - - if (error_return == -ENODEV) - goto END; - - if (check_region(ali1535_smba, ALI1535_SMB_IOSIZE)) { - printk - ("i2c-ali1535.o: ALI1535_smb region 0x%x already in use!\n", - ali1535_smba); - error_return = -ENODEV; - } - - if (error_return == -ENODEV) - goto END; - - /* check if whole device is enabled */ - pci_read_config_byte(ALI1535_dev, SMBCFG, &temp); - if ((temp & ALI1535_SMBIO_EN) == 0) { - printk - ("i2c-ali1535.o: SMB device not enabled - upgrade BIOS?\n"); - error_return = -ENODEV; - goto END; - } - -/* Is SMB Host controller enabled? */ - pci_read_config_byte(ALI1535_dev, SMBHSTCFG, &temp); - if ((temp & 1) == 0) { - printk - ("i2c-ali1535.o: SMBus controller not enabled - upgrade BIOS?\n"); - error_return = -ENODEV; - goto END; - } - -/* set SMB clock to 74KHz as recommended in data sheet */ - pci_write_config_byte(ALI1535_dev, SMBCLK, 0x20); - - /* Everything is happy, let's grab the memory and set things up. */ - request_region(ali1535_smba, ALI1535_SMB_IOSIZE, ali1535_driver.name); - -#ifdef DEBUG -/* - The interrupt routing for SMB is set up in register 0x77 in the - 1533 ISA Bridge device, NOT in the 7101 device. - Don't bother with finding the 1533 device and reading the register. - if ((....... & 0x0F) == 1) - printk("i2c-ali1535.o: ALI1535 using Interrupt 9 for SMBus.\n"); -*/ - pci_read_config_byte(ALI1535_dev, SMBREV, &temp); - printk("i2c-ali1535.o: SMBREV = 0x%X\n", temp); - printk("i2c-ali1535.o: ALI1535_smba = 0x%X\n", ali1535_smba); -#endif /* DEBUG */ - - END: - return error_return; -} - - -#define MAX_TIMEOUT_HEROS 100 -#define MAX_TIMEOUT_BLOCK_HEROS 500 -#define MAX_TRY_HEROS 3 - -/* believe it or not this is the delay technique recommended by ALI */ -static void ali1535_delay_loop(void) -{ - int i; - - for(i=0;i<30;i++) - outb_p(0,0xEB); -} - -static int ali1535_wait_for_status(int count,int status) -{ - int i; - int dat; - - for (i = 0; i < count; i++) { - ali1535_delay_loop(); - dat = inb_p(SMBHSTSTS); - if (dat == status) - break; - } - - return i == count ? 1 : 0; -} - -/* Return -1 on error. */ -s32 ali1535_access(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, u8 command, - int size, union i2c_smbus_data * data) -{ - int i, len; - s32 result = 0; - int timeout = 0; - int oldsize = size; - -repeat: - if(timeout++ > MAX_TRY_HEROS) { - result = -1; - goto EXIT; - } - - /* clear status */ - outb_p(0xFF, SMBHSTSTS); - - if (ali1535_wait_for_status(MAX_TIMEOUT_HEROS,ALI1535_STS_IDLE)) - goto repeat; - - outb_p(ALI1535_KILL,SMBHSTTYP); - - if (ali1535_wait_for_status(MAX_TIMEOUT_HEROS,ALI1535_STS_FAIL)) - goto repeat; - - /* clear status */ - outb_p(0xFF, SMBHSTSTS); - - if (ali1535_wait_for_status(MAX_TIMEOUT_HEROS,ALI1535_STS_IDLE)) - goto repeat; - - switch (size) { - case I2C_SMBUS_QUICK: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), SMBHSTADD); - ali1535_delay_loop(); - size = ALI1535_QUICK; - outb_p(size, SMBHSTTYP); /* output command */ - ali1535_delay_loop(); - break; - case I2C_SMBUS_BYTE: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), SMBHSTADD); - ali1535_delay_loop(); - size = ALI1535_BYTE; - outb_p(size, SMBHSTTYP); /* output command */ - ali1535_delay_loop(); - if (read_write == I2C_SMBUS_WRITE) { - outb_p(command, SMBHSTCMD); - ali1535_delay_loop(); - } - break; - case I2C_SMBUS_BYTE_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), SMBHSTADD); - ali1535_delay_loop(); - size = ALI1535_BYTE_DATA; - outb_p(size, SMBHSTTYP); /* output command */ - ali1535_delay_loop(); - outb_p(command, SMBHSTCMD); - ali1535_delay_loop(); - if (read_write == I2C_SMBUS_WRITE) { - outb_p(data->byte, SMBHSTDAT0); - ali1535_delay_loop(); - } - break; - case I2C_SMBUS_WORD_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), SMBHSTADD); - ali1535_delay_loop(); - size = ALI1535_WORD_DATA; - outb_p(size, SMBHSTTYP); /* output command */ - outb_p(command, SMBHSTCMD); - ali1535_delay_loop(); - if (read_write == I2C_SMBUS_WRITE) { - outb_p(data->word & 0xff, SMBHSTDAT0); - ali1535_delay_loop(); - outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); - ali1535_delay_loop(); - } - break; - case I2C_SMBUS_BLOCK_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), SMBHSTADD); - ali1535_delay_loop(); - size = ALI1535_BLOCK_DATA; - outb_p(size, SMBHSTTYP); /* output command */ - outb_p(command, SMBHSTCMD); - ali1535_delay_loop(); - if (read_write == I2C_SMBUS_WRITE) { - len = data->block[0]; - if (len < 0) { - len = 0; - data->block[0] = len; - } - if (len > 32) { - len = 32; - data->block[0] = len; - } - outb_p(len, SMBHSTDAT0); - ali1535_delay_loop(); - { - int val; - - val = inb_p(SMBHSTTYP) | ALI1535_BLOCK_CLR; - ali1535_delay_loop(); - outb_p(val, SMBHSTTYP); /* Reset SMBBLKDAT */ - ali1535_delay_loop(); - } - for (i = 1; i <= len; i++) { - outb_p(data->block[i], SMBBLKDAT); - ali1535_delay_loop(); - } - } - break; - default: - printk - (KERN_WARNING "i2c-ali1535.o: Unsupported transaction %d\n", size); - result = -1; - goto EXIT; - } - - /* start the transaction */ - outb_p(0xFF, SMBHSTPORT); - ali1535_delay_loop(); - - if (ali1535_wait_for_status(size == ALI1535_BLOCK_DATA ? - MAX_TIMEOUT_BLOCK_HEROS : - MAX_TIMEOUT_HEROS , - ALI1535_STS_IDLE | ALI1535_STS_DONE)) { - size = oldsize; - goto repeat; - } - - /* clear status */ - outb_p(0xFF, SMBHSTSTS); - ali1535_delay_loop(); - - if(inb_p(SMBHSTSTS) != ALI1535_STS_IDLE) { - size = oldsize; - goto repeat; - } - - if ((read_write == I2C_SMBUS_WRITE) || (size == ALI1535_QUICK)) { - result = 0; - goto EXIT; - } - - switch (size) { - case ALI1535_BYTE: /* Result put in SMBHSTDAT0 */ - data->byte = inb_p(SMBHSTDAT0); - ali1535_delay_loop(); - break; - case ALI1535_BYTE_DATA: - data->byte = inb_p(SMBHSTDAT0); - ali1535_delay_loop(); - break; - case ALI1535_WORD_DATA: - data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); - ali1535_delay_loop(); - break; - case ALI1535_BLOCK_DATA: - len = inb_p(SMBHSTDAT0); - ali1535_delay_loop(); - if (len > 32) - len = 32; - data->block[0] = len; - { - int val; - - val = inb_p(SMBHSTTYP) | ALI1535_BLOCK_CLR; - ali1535_delay_loop(); - outb_p(val, SMBHSTTYP); /* Reset SMBBLKDAT */ - ali1535_delay_loop(); - } - for (i = 1; i <= data->block[0]; i++) { - data->block[i] = inb_p(SMBBLKDAT); - ali1535_delay_loop(); -#ifdef DEBUG - printk - ("i2c-ali1535.o: Blk: len=%d, i=%d, data=%02x\n", - len, i, data->block[i]); -#endif /* DEBUG */ - } - break; - } -EXIT: - return result; -} - -static void ali1535_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void ali1535_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -u32 ali1535_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA; -} - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-i2c SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = ali1535_access, - .functionality = ali1535_func, -}; - -static struct i2c_adapter ali1535_adapter = { - .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI1535, - .algo = &smbus_algorithm, - .inc_use = ali1535_inc, - .dec_use = ali1535_dec, -}; - - -static struct pci_device_id ali1535_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_AL, - .device = PCI_DEVICE_ID_AL_M7101, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - if (ali1535_setup(dev)) { - printk - ("i2c-ali1535.o: ALI1535 not detected, module not inserted.\n"); - return -ENODEV; - } - - sprintf(ali1535_adapter.name, "SMBus ALI1535 adapter at %04x", - ali1535_smba); - return i2c_add_adapter(&ali1535_adapter); -} - -static void __devexit ali1535_remove(struct pci_dev *dev) -{ - i2c_del_adapter(&ali1535_adapter); - release_region(ali1535_smba, ALI1535_SMB_IOSIZE); -} - - -static struct pci_driver ali1535_driver = { - .name = "ali1535 smbus", - .id_table = ali1535_ids, - .probe = ali1535_probe, - .remove = __devexit_p(ali1535_remove), -}; - -static int __init i2c_ali1535_init(void) -{ - printk("i2c-ali1535.o version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&ali1535_driver); -} - -static void __exit i2c_ali1535_exit(void) -{ - pci_unregister_driver(&ali1535_driver); -} - -MODULE_AUTHOR - ("Frodo Looijaard , Philip Edelbrock , " - "Mark D. Studebaker and Dan Eaton "); -MODULE_DESCRIPTION("ALI1535 SMBus driver"); -MODULE_LICENSE("GPL"); - -module_init(i2c_ali1535_init); -module_exit(i2c_ali1535_exit); diff --git a/kernel/busses/i2c-ali1563.c b/kernel/busses/i2c-ali1563.c deleted file mode 100644 index 87cc2d2c..00000000 --- a/kernel/busses/i2c-ali1563.c +++ /dev/null @@ -1,464 +0,0 @@ -/** - * i2c-ali1563.c - i2c driver for the ALi 1563 Southbridge - * - * Copyright (C) 2004, 2005 Patrick Mochel, Chunhao Huang - * - * The 1563 southbridge is deceptively similar to the 1533, with a - * few notable exceptions. One of those happens to be the fact they - * upgraded the i2c core to be 2.0 compliant, and happens to be almost - * identical to the i2c controller found in the Intel 801 south - * bridges. - * - * This driver is based on a mix of the 15x3, 1535, and i801 drivers, - * with a little help from the ALi 1563 spec. - * - * Chunhao Huang / Winbond - * Backport to linux-2.4 from linux-2.6 on Mar.2005 - * - * This file is released under the GPLv2 - */ - -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - -#ifndef PCI_DEVICE_ID_AL_M1563 -#define PCI_DEVICE_ID_AL_M1563 0x1563 -#endif - -#define ALI1563_MAX_TIMEOUT 500 -#define ALI1563_SMBBA 0x80 -#define ALI1563_SMB_IOEN 1 -#define ALI1563_SMB_HOSTEN 2 -#define ALI1563_SMB_IOSIZE 16 - -#define SMB_HST_STS (ali1563_smba + 0) -#define SMB_HST_CNTL1 (ali1563_smba + 1) -#define SMB_HST_CNTL2 (ali1563_smba + 2) -#define SMB_HST_CMD (ali1563_smba + 3) -#define SMB_HST_ADD (ali1563_smba + 4) -#define SMB_HST_DAT0 (ali1563_smba + 5) -#define SMB_HST_DAT1 (ali1563_smba + 6) -#define SMB_BLK_DAT (ali1563_smba + 7) - -#define HST_STS_BUSY 0x01 -#define HST_STS_INTR 0x02 -#define HST_STS_DEVERR 0x04 -#define HST_STS_BUSERR 0x08 -#define HST_STS_FAIL 0x10 -#define HST_STS_DONE 0x80 -#define HST_STS_BAD 0x1c - - -#define HST_CNTL1_TIMEOUT 0x80 -#define HST_CNTL1_LAST 0x40 - -#define HST_CNTL2_KILL 0x04 -#define HST_CNTL2_START 0x40 -#define HST_CNTL2_QUICK 0x00 -#define HST_CNTL2_BYTE 0x01 -#define HST_CNTL2_BYTE_DATA 0x02 -#define HST_CNTL2_WORD_DATA 0x03 -#define HST_CNTL2_BLOCK 0x05 -#define HST_CNTL2_SIZEMASK 0x38 - -static struct pci_driver ali1563_pci_driver; -static unsigned short ali1563_smba; - -static int ali1563_transaction(struct i2c_adapter * a) -{ - u32 data; - int timeout; - - printk(KERN_DEBUG "ali1563: Transaction (pre): STS=%02x, CNTL1=%02x, " - "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", - inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2), - inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0), - inb_p(SMB_HST_DAT1)); - - data = inb_p(SMB_HST_STS); - if (data & HST_STS_BAD) { - printk(KERN_WARNING "ali1563: Trying to reset busy device\n"); - outb_p(data | HST_STS_BAD,SMB_HST_STS); - data = inb_p(SMB_HST_STS); - if (data & HST_STS_BAD){ - return -EBUSY; - } - } - outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); - - timeout = ALI1563_MAX_TIMEOUT; - do - i2c_delay(1); - while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout); - - printk(KERN_DEBUG "ali1563: Transaction (post): STS=%02x, CNTL1=%02x, " - "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", - inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2), - inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0), - inb_p(SMB_HST_DAT1)); - - if (timeout && !(data & HST_STS_BAD)) { - return 0; - } - - /* modified by Rudolf */ - if (!timeout) { - printk(KERN_ERR "ali1563: Timeout - Trying to KILL transaction!\n"); - /* Issue 'kill' to host controller */ - outb_p(HST_CNTL2_KILL,SMB_HST_CNTL2); - data = inb_p(SMB_HST_STS); - } - - /* device error - probably missing ACK */ - if (data & HST_STS_DEVERR) { - printk(KERN_DEBUG "ali1563: Device error!\n"); - } - - /* bus collision */ - if (data & HST_STS_BUSERR) { - printk(KERN_ERR "ali1563: Bus collision!\n"); - /* Issue timeout, hoping it helps */ - outb_p(HST_CNTL1_TIMEOUT,SMB_HST_CNTL1); - } - - if (data & HST_STS_FAIL) { - printk(KERN_ERR "ali1563: Cleaning fail after KILL!\n"); - outb_p(0x0,SMB_HST_CNTL2); - } - - return -1; -} - -static int ali1563_block_start(struct i2c_adapter * a) -{ - u32 data; - int timeout; - - printk(KERN_DEBUG "ali1563: Block (pre): STS=%02x, CNTL1=%02x, " - "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", - inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2), - inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0), - inb_p(SMB_HST_DAT1)); - - data = inb_p(SMB_HST_STS); - if (data & HST_STS_BAD) { - printk(KERN_WARNING "ali1563: Trying to reset busy device\n"); - outb_p(data | HST_STS_BAD,SMB_HST_STS); - data = inb_p(SMB_HST_STS); - if (data & HST_STS_BAD){ - return -EBUSY; - } - } - - /* Clear byte-ready bit */ - outb_p(data | HST_STS_DONE, SMB_HST_STS); - - /* Start transaction and wait for byte-ready bit to be set */ - outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_START, SMB_HST_CNTL2); - - timeout = ALI1563_MAX_TIMEOUT; - do - i2c_delay(1); - while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout); - - printk(KERN_DEBUG "ali1563: Block (post): STS=%02x, CNTL1=%02x, " - "CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n", - inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2), - inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0), - inb_p(SMB_HST_DAT1)); - - if (timeout && !(data & HST_STS_BAD)){ - return 0; - } - printk(KERN_WARNING "ali1563: SMBus Error: %s%s%s%s%s\n", - timeout ? "Timeout " : "", - data & HST_STS_FAIL ? "Transaction Failed " : "", - data & HST_STS_BUSERR ? "No response or Bus Collision " : "", - data & HST_STS_DEVERR ? "Device Error " : "", - !(data & HST_STS_DONE) ? "Transaction Never Finished " : ""); - return -1; -} - -static int ali1563_block(struct i2c_adapter * a, union i2c_smbus_data * data, u8 rw) -{ - int i, len; - int error = 0; - - /* Do we need this? */ - outb_p(HST_CNTL1_LAST,SMB_HST_CNTL1); - - if (rw == I2C_SMBUS_WRITE) { - len = data->block[0]; - if (len < 1) - len = 1; - else if (len > 32) - len = 32; - outb_p(len,SMB_HST_DAT0); - outb_p(data->block[1],SMB_BLK_DAT); - } else - len = 32; - - outb_p(inb_p(SMB_HST_CNTL2) | HST_CNTL2_BLOCK, SMB_HST_CNTL2); - - for (i = 0; i < len; i++) { - if (rw == I2C_SMBUS_WRITE) { - outb_p(data->block[i + 1], SMB_BLK_DAT); - if ((error = ali1563_block_start(a))) - break; - } else { - if ((error = ali1563_block_start(a))) - break; - if (i == 0) { - len = inb_p(SMB_HST_DAT0); - if (len < 1) - len = 1; - else if (len > 32) - len = 32; - } - data->block[i+1] = inb_p(SMB_BLK_DAT); - } - } - /* Do we need this? */ - outb_p(HST_CNTL1_LAST,SMB_HST_CNTL1); - return error; -} - -static s32 ali1563_access(struct i2c_adapter * a, u16 addr, - unsigned short flags, char rw, u8 cmd, - int size, union i2c_smbus_data * data) -{ - int error = 0; - int timeout; - u32 reg; - - for (timeout = ALI1563_MAX_TIMEOUT; timeout; timeout--) { - if (!(reg = inb_p(SMB_HST_STS) & HST_STS_BUSY)) - break; - } - if (!timeout) - printk(KERN_WARNING "ali1563: SMBus not idle. HST_STS = %02x\n",reg); - outb_p(0xff,SMB_HST_STS); - - /* Map the size to what the chip understands */ - switch (size) { - case I2C_SMBUS_PROC_CALL: - printk(KERN_ERR "ali1563: I2C_SMBUS_PROC_CALL not supported!\n"); - error = -EINVAL; - break; - case I2C_SMBUS_QUICK: - size = HST_CNTL2_QUICK; - break; - case I2C_SMBUS_BYTE: - size = HST_CNTL2_BYTE; - break; - case I2C_SMBUS_BYTE_DATA: - size = HST_CNTL2_BYTE_DATA; - break; - case I2C_SMBUS_WORD_DATA: - size = HST_CNTL2_WORD_DATA; - break; - case I2C_SMBUS_BLOCK_DATA: - size = HST_CNTL2_BLOCK; - break; - } - - outb_p(((addr & 0x7f) << 1) | (rw & 0x01), SMB_HST_ADD); - outb_p( (inb_p(SMB_HST_CNTL2)&~HST_CNTL2_SIZEMASK) | (size << 3), SMB_HST_CNTL2); - - /* Write the command register */ - switch(size) { - case HST_CNTL2_BYTE: - if (rw== I2C_SMBUS_WRITE) - /* outb_p(cmd, SMB_HST_CMD); */ - outb_p(cmd, SMB_HST_DAT0); /* modify by Rudolf */ - break; - case HST_CNTL2_BYTE_DATA: - outb_p(cmd, SMB_HST_CMD); - if (rw == I2C_SMBUS_WRITE) - outb_p(data->byte, SMB_HST_DAT0); - break; - case HST_CNTL2_WORD_DATA: - outb_p(cmd, SMB_HST_CMD); - if (rw == I2C_SMBUS_WRITE) { - outb_p(data->word & 0xff, SMB_HST_DAT0); - outb_p((data->word & 0xff00) >> 8, SMB_HST_DAT1); - } - break; - case HST_CNTL2_BLOCK: - outb_p(cmd, SMB_HST_CMD); - error = ali1563_block(a,data,rw); - goto Done; - } - - if ((error = ali1563_transaction(a))){ - goto Done; - } - - if ((rw == I2C_SMBUS_WRITE) || (size == HST_CNTL2_QUICK)){ - goto Done; - } - - switch (size) { - case HST_CNTL2_BYTE: /* Result put in SMBHSTDAT0 */ - data->byte = inb_p(SMB_HST_DAT0); - break; - case HST_CNTL2_BYTE_DATA: - data->byte = inb_p(SMB_HST_DAT0); - break; - case HST_CNTL2_WORD_DATA: - data->word = inb_p(SMB_HST_DAT0) + (inb_p(SMB_HST_DAT1) << 8); - break; - } -Done: - return error; -} - -static u32 ali1563_func(struct i2c_adapter * a) -{ - return ( I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA ); -} - - -static int __devinit ali1563_setup(struct pci_dev * dev) -{ - u16 ctrl; - - pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); - - /* SMB I/O Base in high 12 bits and must be aligned with the - * size of the I/O space. */ - ali1563_smba = ctrl & ~(ALI1563_SMB_IOSIZE - 1); - if (!ali1563_smba) { - printk(KERN_WARNING "ali1563: ali1563_smba Uninitialized\n"); - goto Err; - } - - /* Check if device is enabled */ - if (!(ctrl & ALI1563_SMB_HOSTEN)) { - printk(KERN_WARNING "ali1563: Host Controller not enabled\n"); - goto Err; - } - if (!(ctrl & ALI1563_SMB_IOEN)) { - printk(KERN_WARNING "I/O space not enabled, trying manually\n"); - pci_write_config_word(dev, ALI1563_SMBBA, - ctrl | ALI1563_SMB_IOEN); - pci_read_config_word(dev, ALI1563_SMBBA, &ctrl); - if (!(ctrl & ALI1563_SMB_IOEN)) { - printk(KERN_WARNING "I/O space still not enabled, " - "giving up\n"); - goto Err; - } - } - - if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, - ali1563_pci_driver.name)) { - printk(KERN_WARNING "ali1563: Could not allocate I/O space " - "at 0x%04x\n", ali1563_smba); - goto Err; - } - printk(KERN_INFO "ali1563: Found ALi1563 SMBus at 0x%04x\n", - ali1563_smba); - - return 0; -Err: - return -ENODEV; -} - -static void ali1563_shutdown(struct pci_dev *dev) -{ - release_region(ali1563_smba,ALI1563_SMB_IOSIZE); -} - -static void ali1563_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void ali1563_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static struct i2c_algorithm ali1563_algorithm = { - .name = "Non-i2c SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = ali1563_access, - .functionality = ali1563_func, -}; - -static struct i2c_adapter ali1563_adapter = { - .algo = &ali1563_algorithm, - .inc_use = ali1563_inc, - .dec_use = ali1563_dec, -}; - -static int __devinit ali1563_probe(struct pci_dev * dev, - const struct pci_device_id * id_table) -{ - int error; - - if ((error = ali1563_setup(dev))) { - printk(KERN_WARNING "ali1563: ALi1563 SMBus probe failed " - "(%d)\n", error); - return error; - } - sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", - ali1563_smba); - if ((error = i2c_add_adapter(&ali1563_adapter))) - ali1563_shutdown(dev); - return error; -} - -static void __devexit ali1563_remove(struct pci_dev * dev) -{ - i2c_del_adapter(&ali1563_adapter); - ali1563_shutdown(dev); -} - -static struct pci_device_id ali1563_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_AL, - .device = PCI_DEVICE_ID_AL_M1563, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static struct pci_driver ali1563_pci_driver = { - .name = "ali1563 smbus", - .id_table = ali1563_ids, - .probe = ali1563_probe, - .remove = __devexit_p(ali1563_remove), -}; - -static int __init ali1563_init(void) -{ - printk("i2c-ali1563.o version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&ali1563_pci_driver); -} - -module_init(ali1563_init); - -static void __exit ali1563_exit(void) -{ - pci_unregister_driver(&ali1563_pci_driver); -} - -module_exit(ali1563_exit); - -MODULE_AUTHOR("Patrick Mochel , Chunhao Huang"); -MODULE_DESCRIPTION("ALi M1563 southbridge driver for linux-2.4, backported by Chunhao Huang from linux-2.6"); -MODULE_LICENSE("GPL"); - diff --git a/kernel/busses/i2c-ali15x3.c b/kernel/busses/i2c-ali15x3.c deleted file mode 100644 index 19c40207..00000000 --- a/kernel/busses/i2c-ali15x3.c +++ /dev/null @@ -1,548 +0,0 @@ -/* - ali15x3.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1999 Frodo Looijaard and - Philip Edelbrock and - Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - This is the driver for the SMB Host controller on - Acer Labs Inc. (ALI) M1541 and M1543C South Bridges. - - The M1543C is a South bridge for desktop systems. - The M1533 is a South bridge for portable systems. - They are part of the following ALI chipsets: - "Aladdin Pro 2": Includes the M1621 Slot 1 North bridge - with AGP and 100MHz CPU Front Side bus - "Aladdin V": Includes the M1541 Socket 7 North bridge - with AGP and 100MHz CPU Front Side bus - "Aladdin IV": Includes the M1541 Socket 7 North bridge - with host bus up to 83.3 MHz. - For an overview of these chips see http://www.acerlabs.com - - The M1533/M1543C devices appear as FOUR separate devices - on the PCI bus. An output of lspci will show something similar - to the following: - - 00:02.0 USB Controller: Acer Laboratories Inc. M5237 - 00:03.0 Bridge: Acer Laboratories Inc. M7101 - 00:07.0 ISA bridge: Acer Laboratories Inc. M1533 - 00:0f.0 IDE interface: Acer Laboratories Inc. M5229 - - The SMB controller is part of the 7101 device, which is an - ACPI-compliant Power Management Unit (PMU). - - The whole 7101 device has to be enabled for the SMB to work. - You can't just enable the SMB alone. - The SMB and the ACPI have separate I/O spaces. - We make sure that the SMB is enabled. We leave the ACPI alone. - - This driver controls the SMB Host only. - The SMB Slave controller on the M15X3 is not enabled. - - This driver does not use interrupts. -*/ - -/* Note: we assume there can only be one ALI15X3, with one SMBus interface */ - -/* #define DEBUG 1 */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - -/* ALI15X3 SMBus address offsets */ -#define SMBHSTSTS (0 + ali15x3_smba) -#define SMBHSTCNT (1 + ali15x3_smba) -#define SMBHSTSTART (2 + ali15x3_smba) -#define SMBHSTCMD (7 + ali15x3_smba) -#define SMBHSTADD (3 + ali15x3_smba) -#define SMBHSTDAT0 (4 + ali15x3_smba) -#define SMBHSTDAT1 (5 + ali15x3_smba) -#define SMBBLKDAT (6 + ali15x3_smba) - -/* PCI Address Constants */ -#define SMBCOM 0x004 -#define SMBBA 0x014 -#define SMBATPC 0x05B /* used to unlock xxxBA registers */ -#define SMBHSTCFG 0x0E0 -#define SMBSLVC 0x0E1 -#define SMBCLK 0x0E2 -#define SMBREV 0x008 - -/* Other settings */ -#define MAX_TIMEOUT 200 /* times 1/100 sec */ -#define ALI15X3_SMB_IOSIZE 32 - -/* this is what the Award 1004 BIOS sets them to on a ASUS P5A MB. - We don't use these here. If the bases aren't set to some value we - tell user to upgrade BIOS and we fail. -*/ -#define ALI15X3_SMB_DEFAULTBASE 0xE800 - -/* ALI15X3 address lock bits */ -#define ALI15X3_LOCK 0x06 - -/* ALI15X3 command constants */ -#define ALI15X3_ABORT 0x02 -#define ALI15X3_T_OUT 0x04 -#define ALI15X3_QUICK 0x00 -#define ALI15X3_BYTE 0x10 -#define ALI15X3_BYTE_DATA 0x20 -#define ALI15X3_WORD_DATA 0x30 -#define ALI15X3_BLOCK_DATA 0x40 -#define ALI15X3_BLOCK_CLR 0x80 - -/* ALI15X3 status register bits */ -#define ALI15X3_STS_IDLE 0x04 -#define ALI15X3_STS_BUSY 0x08 -#define ALI15X3_STS_DONE 0x10 -#define ALI15X3_STS_DEV 0x20 /* device error */ -#define ALI15X3_STS_COLL 0x40 /* collision or no response */ -#define ALI15X3_STS_TERM 0x80 /* terminated by abort */ -#define ALI15X3_STS_ERR 0xE0 /* all the bad error bits */ - - -/* If force_addr is set to anything different from 0, we forcibly enable - the device at the given address. */ -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Initialize the base address of the i2c controller"); - -static struct pci_driver ali15x3_driver; -static unsigned short ali15x3_smba = 0; - -static int ali15x3_setup(struct pci_dev *ALI15X3_dev) -{ - u16 a; - unsigned char temp; - - /* Check the following things: - - SMB I/O address is initialized - - Device is enabled - - We can use the addresses - */ - - /* Unlock the register. - The data sheet says that the address registers are read-only - if the lock bits are 1, but in fact the address registers - are zero unless you clear the lock bits. - */ - pci_read_config_byte(ALI15X3_dev, SMBATPC, &temp); - if (temp & ALI15X3_LOCK) { - temp &= ~ALI15X3_LOCK; - pci_write_config_byte(ALI15X3_dev, SMBATPC, temp); - } - - /* Determine the address of the SMBus area */ - pci_read_config_word(ALI15X3_dev, SMBBA, &ali15x3_smba); - ali15x3_smba &= (0xffff & ~(ALI15X3_SMB_IOSIZE - 1)); - if (ali15x3_smba == 0 && force_addr == 0) { - dev_err(ALI15X3_dev, "ALI15X3_smb region uninitialized " - "- upgrade BIOS or use force_addr=0xaddr\n"); - return -ENODEV; - } - - if(force_addr) - ali15x3_smba = force_addr & ~(ALI15X3_SMB_IOSIZE - 1); - - if (!request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE, - ali15x3_driver.name)) { - dev_err(ALI15X3_dev, - "ALI15X3_smb region 0x%x already in use!\n", - ali15x3_smba); - return -ENODEV; - } - - if(force_addr) { - dev_info(ALI15X3_dev, "forcing ISA address 0x%04X\n", - ali15x3_smba); - if (PCIBIOS_SUCCESSFUL != - pci_write_config_word(ALI15X3_dev, SMBBA, ali15x3_smba)) - return -ENODEV; - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(ALI15X3_dev, SMBBA, &a)) - return -ENODEV; - if ((a & ~(ALI15X3_SMB_IOSIZE - 1)) != ali15x3_smba) { - /* make sure it works */ - dev_err(ALI15X3_dev, - "force address failed - not supported?\n"); - return -ENODEV; - } - } - /* check if whole device is enabled */ - pci_read_config_byte(ALI15X3_dev, SMBCOM, &temp); - if ((temp & 1) == 0) { - dev_info(ALI15X3_dev, "enabling SMBus device\n"); - pci_write_config_byte(ALI15X3_dev, SMBCOM, temp | 0x01); - } - - /* Is SMB Host controller enabled? */ - pci_read_config_byte(ALI15X3_dev, SMBHSTCFG, &temp); - if ((temp & 1) == 0) { - dev_info(ALI15X3_dev, "enabling SMBus controller\n"); - pci_write_config_byte(ALI15X3_dev, SMBHSTCFG, temp | 0x01); - } - - /* set SMB clock to 74KHz as recommended in data sheet */ - pci_write_config_byte(ALI15X3_dev, SMBCLK, 0x20); - - /* - The interrupt routing for SMB is set up in register 0x77 in the - 1533 ISA Bridge device, NOT in the 7101 device. - Don't bother with finding the 1533 device and reading the register. - if ((....... & 0x0F) == 1) - dev_dbg(ALI15X3_dev, "ALI15X3 using Interrupt 9 for SMBus.\n"); - */ - pci_read_config_byte(ALI15X3_dev, SMBREV, &temp); - dev_dbg(ALI15X3_dev, "SMBREV = 0x%X\n", temp); - dev_dbg(ALI15X3_dev, "iALI15X3_smba = 0x%X\n", ali15x3_smba); - - return 0; -} - -/* Another internally used function */ -static int ali15x3_transaction(struct i2c_adapter *adap) -{ - int temp; - int result = 0; - int timeout = 0; - - dev_dbg(adap, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, " - "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTSTS), - inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD), - inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1)); - - /* get status */ - temp = inb_p(SMBHSTSTS); - - /* Make sure the SMBus host is ready to start transmitting */ - /* Check the busy bit first */ - if (temp & ALI15X3_STS_BUSY) { - /* - If the host controller is still busy, it may have timed out in the - previous transaction, resulting in a "SMBus Timeout" Dev. - I've tried the following to reset a stuck busy bit. - 1. Reset the controller with an ABORT command. - (this doesn't seem to clear the controller if an external - device is hung) - 2. Reset the controller and the other SMBus devices with a - T_OUT command. (this clears the host busy bit if an - external device is hung, but it comes back upon a new access - to a device) - 3. Disable and reenable the controller in SMBHSTCFG - Worst case, nothing seems to work except power reset. - */ - /* Abort - reset the host controller */ - /* - Try resetting entire SMB bus, including other devices - - This may not work either - it clears the BUSY bit but - then the BUSY bit may come back on when you try and use the chip again. - If that's the case you are stuck. - */ - dev_info(adap, "Resetting entire SMB Bus to " - "clear busy condition (%02x)\n", temp); - outb_p(ALI15X3_T_OUT, SMBHSTCNT); - temp = inb_p(SMBHSTSTS); - } - - /* now check the error bits and the busy bit */ - if (temp & (ALI15X3_STS_ERR | ALI15X3_STS_BUSY)) { - /* do a clear-on-write */ - outb_p(0xFF, SMBHSTSTS); - if ((temp = inb_p(SMBHSTSTS)) & - (ALI15X3_STS_ERR | ALI15X3_STS_BUSY)) { - /* this is probably going to be correctable only by a power reset - as one of the bits now appears to be stuck */ - /* This may be a bus or device with electrical problems. */ - dev_err(adap, "SMBus reset failed! (0x%02x) - " - "controller or device on bus is probably hung\n", - temp); - return -1; - } - } else { - /* check and clear done bit */ - if (temp & ALI15X3_STS_DONE) { - outb_p(temp, SMBHSTSTS); - } - } - - /* start the transaction by writing anything to the start register */ - outb_p(0xFF, SMBHSTSTART); - - /* We will always wait for a fraction of a second! */ - timeout = 0; - do { - i2c_delay(1); - temp = inb_p(SMBHSTSTS); - } while ((!(temp & (ALI15X3_STS_ERR | ALI15X3_STS_DONE))) - && (timeout++ < MAX_TIMEOUT)); - - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { - result = -1; - dev_err(adap, "SMBus Timeout!\n"); - } - - if (temp & ALI15X3_STS_TERM) { - result = -1; - dev_dbg(adap, "Error: Failed bus transaction\n"); - } - - /* - Unfortunately the ALI SMB controller maps "no response" and "bus - collision" into a single bit. No reponse is the usual case so don't - do a printk. - This means that bus collisions go unreported. - */ - if (temp & ALI15X3_STS_COLL) { - result = -1; - dev_dbg(adap, - "Error: no response or bus collision ADD=%02x\n", - inb_p(SMBHSTADD)); - } - - /* haven't ever seen this */ - if (temp & ALI15X3_STS_DEV) { - result = -1; - dev_err(adap, "Error: device error\n"); - } - dev_dbg(adap, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, " - "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTSTS), - inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD), - inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1)); - return result; -} - -/* Return -1 on error. */ -static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, u8 command, - int size, union i2c_smbus_data * data) -{ - int i, len; - int temp; - int timeout; - - /* clear all the bits (clear-on-write) */ - outb_p(0xFF, SMBHSTSTS); - /* make sure SMBus is idle */ - temp = inb_p(SMBHSTSTS); - for (timeout = 0; - (timeout < MAX_TIMEOUT) && !(temp & ALI15X3_STS_IDLE); - timeout++) { - i2c_delay(1); - temp = inb_p(SMBHSTSTS); - } - if (timeout >= MAX_TIMEOUT) { - dev_err(adap, "Idle wait Timeout! STS=0x%02x\n", temp); - } - - switch (size) { - case I2C_SMBUS_QUICK: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - size = ALI15X3_QUICK; - break; - case I2C_SMBUS_BYTE: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - if (read_write == I2C_SMBUS_WRITE) - outb_p(command, SMBHSTCMD); - size = ALI15X3_BYTE; - break; - case I2C_SMBUS_BYTE_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) - outb_p(data->byte, SMBHSTDAT0); - size = ALI15X3_BYTE_DATA; - break; - case I2C_SMBUS_WORD_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) { - outb_p(data->word & 0xff, SMBHSTDAT0); - outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); - } - size = ALI15X3_WORD_DATA; - break; - case I2C_SMBUS_BLOCK_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) { - len = data->block[0]; - if (len < 0) { - len = 0; - data->block[0] = len; - } - if (len > 32) { - len = 32; - data->block[0] = len; - } - outb_p(len, SMBHSTDAT0); - /* Reset SMBBLKDAT */ - outb_p(inb_p(SMBHSTCNT) | ALI15X3_BLOCK_CLR, SMBHSTCNT); - for (i = 1; i <= len; i++) - outb_p(data->block[i], SMBBLKDAT); - } - size = ALI15X3_BLOCK_DATA; - break; - default: - printk - (KERN_WARNING "i2c-ali15x3.o: Unsupported transaction %d\n", size); - return -1; - } - - outb_p(size, SMBHSTCNT); /* output command */ - - if (ali15x3_transaction(adap)) /* Error in transaction */ - return -1; - - if ((read_write == I2C_SMBUS_WRITE) || (size == ALI15X3_QUICK)) - return 0; - - - switch (size) { - case ALI15X3_BYTE: /* Result put in SMBHSTDAT0 */ - data->byte = inb_p(SMBHSTDAT0); - break; - case ALI15X3_BYTE_DATA: - data->byte = inb_p(SMBHSTDAT0); - break; - case ALI15X3_WORD_DATA: - data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); - break; - case ALI15X3_BLOCK_DATA: - len = inb_p(SMBHSTDAT0); - if (len > 32) - len = 32; - data->block[0] = len; - /* Reset SMBBLKDAT */ - outb_p(inb_p(SMBHSTCNT) | ALI15X3_BLOCK_CLR, SMBHSTCNT); - for (i = 1; i <= data->block[0]; i++) { - data->block[i] = inb_p(SMBBLKDAT); - dev_dbg(adap, "Blk: len=%d, i=%d, data=%02x\n", - len, i, data->block[i]); - } - break; - } - return 0; -} - -static void ali15x3_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void ali15x3_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static u32 ali15x3_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA; -} - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = ali15x3_access, - .functionality = ali15x3_func, -}; - -static struct i2c_adapter ali15x3_adapter = { - .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI15X3, - .algo = &smbus_algorithm, - .inc_use = ali15x3_inc, - .dec_use = ali15x3_dec, -}; - -static struct pci_device_id ali15x3_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_AL, - .device = PCI_DEVICE_ID_AL_M7101, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - if (ali15x3_setup(dev)) { - dev_err(dev, - "ALI15X3 not detected, module not inserted.\n"); - return -ENODEV; - } - - snprintf(ali15x3_adapter.name, 32, - "SMBus ALI15X3 adapter at %04x", ali15x3_smba); - return i2c_add_adapter(&ali15x3_adapter); -} - -static void __devexit ali15x3_remove(struct pci_dev *dev) -{ - i2c_del_adapter(&ali15x3_adapter); - release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE); -} - -static struct pci_driver ali15x3_driver = { - .name = "ali15x3 smbus", - .id_table = ali15x3_ids, - .probe = ali15x3_probe, - .remove = __devexit_p(ali15x3_remove), -}; - -static int __init i2c_ali15x3_init(void) -{ - printk("i2c-ali15x3.o version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&ali15x3_driver); -} - -static void __exit i2c_ali15x3_exit(void) -{ - pci_unregister_driver(&ali15x3_driver); -} - -MODULE_AUTHOR ("Frodo Looijaard , " - "Philip Edelbrock , " - "and Mark D. Studebaker "); -MODULE_DESCRIPTION("ALI15X3 SMBus driver"); -MODULE_LICENSE("GPL"); - -module_init(i2c_ali15x3_init); -module_exit(i2c_ali15x3_exit); diff --git a/kernel/busses/i2c-amd756-s4882.c b/kernel/busses/i2c-amd756-s4882.c deleted file mode 100644 index 0707c1dc..00000000 --- a/kernel/busses/i2c-amd756-s4882.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * i2c-amd756-s4882.c - i2c-amd756 extras for the Tyan S4882 motherboard - * - * Copyright (C) 2004 Jean Delvare - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * We select the channels by sending commands to the Philips - * PCA9556 chip at I2C address 0x18. The main adapter is used for - * the non-multiplexed part of the bus, and 4 virtual adapters - * are defined for the multiplexed addresses: 0x50-0x53 (memory - * module EEPROM) located on channels 1-4, and 0x4c (LM63) - * located on multiplexed channels 0 and 5-7. We define one - * virtual adapter per CPU, which corresponds to two multiplexed - * channels: - * CPU0: virtual adapter 1, channels 1 and 0 - * CPU1: virtual adapter 2, channels 2 and 5 - * CPU2: virtual adapter 3, channels 3 and 6 - * CPU3: virtual adapter 4, channels 4 and 7 - */ - -#include -#include -#include -#include -#include -#include - -#define DRV_NAME "i2c-amd756-s4882" - -extern struct i2c_adapter amd756_smbus; - -static struct i2c_adapter *s4882_adapter; -static struct i2c_algorithm *s4882_algo; - -/* Wrapper access functions for multiplexed SMBus */ -static DECLARE_MUTEX(amd756_lock); - -static s32 amd756_access_virt0(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, - union i2c_smbus_data * data) -{ - int error; - - /* We exclude the multiplexed addresses */ - if (addr == 0x4c || (addr & 0xfc) == 0x50 || (addr & 0xfc) == 0x30 - || addr == 0x18) - return -1; - - down(&amd756_lock); - - error = amd756_smbus.algo->smbus_xfer(adap, addr, flags, read_write, - command, size, data); - - up(&amd756_lock); - - return error; -} - -/* We remember the last used channels combination so as to only switch - channels when it is really needed. This greatly reduces the SMBus - overhead, but also assumes that nobody will be writing to the PCA9556 - in our back. */ -static u8 last_channels; - -static inline s32 amd756_access_channel(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, - union i2c_smbus_data * data, - u8 channels) -{ - int error; - - /* We exclude the non-multiplexed addresses */ - if (addr != 0x4c && (addr & 0xfc) != 0x50 && (addr & 0xfc) != 0x30) - return -1; - - down(&amd756_lock); - - if (last_channels != channels) { - union i2c_smbus_data mplxdata; - mplxdata.byte = channels; - - error = amd756_smbus.algo->smbus_xfer(adap, 0x18, 0, - I2C_SMBUS_WRITE, 0x01, - I2C_SMBUS_BYTE_DATA, - &mplxdata); - if (error) - goto UNLOCK; - last_channels = channels; - } - error = amd756_smbus.algo->smbus_xfer(adap, addr, flags, read_write, - command, size, data); - -UNLOCK: - up(&amd756_lock); - return error; -} - -static s32 amd756_access_virt1(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, - union i2c_smbus_data * data) -{ - /* CPU0: channels 1 and 0 enabled */ - return amd756_access_channel(adap, addr, flags, read_write, command, - size, data, 0x03); -} - -static s32 amd756_access_virt2(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, - union i2c_smbus_data * data) -{ - /* CPU1: channels 2 and 5 enabled */ - return amd756_access_channel(adap, addr, flags, read_write, command, - size, data, 0x24); -} - -static s32 amd756_access_virt3(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, - union i2c_smbus_data * data) -{ - /* CPU2: channels 3 and 6 enabled */ - return amd756_access_channel(adap, addr, flags, read_write, command, - size, data, 0x48); -} - -static s32 amd756_access_virt4(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, - union i2c_smbus_data * data) -{ - /* CPU3: channels 4 and 7 enabled */ - return amd756_access_channel(adap, addr, flags, read_write, command, - size, data, 0x90); -} - -static int __init amd756_s4882_init(void) -{ - int i, error; - union i2c_smbus_data ioconfig; - - /* Unregister physical bus */ - error = i2c_del_adapter(&amd756_smbus); - if (error) { - if (error != -ENODEV) - printk(KERN_ERR DRV_NAME ": Physical bus removal " - "failed\n"); - goto ERROR0; - } - - printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n"); - - /* Define the 5 virtual adapters and algorithms structures */ - if (!(s4882_adapter = kmalloc(5 * sizeof(struct i2c_adapter), - GFP_KERNEL))) { - error = -ENOMEM; - goto ERROR1; - } - if (!(s4882_algo = kmalloc(5 * sizeof(struct i2c_algorithm), - GFP_KERNEL))) { - error = -ENOMEM; - goto ERROR2; - } - - /* Fill in the new structures */ - s4882_algo[0] = *(amd756_smbus.algo); - s4882_algo[0].smbus_xfer = amd756_access_virt0; - s4882_adapter[0] = amd756_smbus; - s4882_adapter[0].algo = s4882_algo; - for (i = 1; i < 5; i++) { - s4882_algo[i] = *(amd756_smbus.algo); - s4882_adapter[i] = amd756_smbus; - sprintf(s4882_adapter[i].name, - "SMBus 8111 adapter (CPU%d)", i-1); - s4882_adapter[i].algo = s4882_algo+i; - } - s4882_algo[1].smbus_xfer = amd756_access_virt1; - s4882_algo[2].smbus_xfer = amd756_access_virt2; - s4882_algo[3].smbus_xfer = amd756_access_virt3; - s4882_algo[4].smbus_xfer = amd756_access_virt4; - - /* Configure the PCA9556 multiplexer */ - ioconfig.byte = 0x00; /* All I/O to output mode */ - error = amd756_smbus.algo->smbus_xfer(&amd756_smbus, 0x18, 0, - I2C_SMBUS_WRITE, 0x03, - I2C_SMBUS_BYTE_DATA, &ioconfig); - if (error) { - printk(KERN_ERR DRV_NAME ": PCA9556 configuration failed\n"); - error = -EIO; - goto ERROR3; - } - - /* Register virtual adapters */ - for (i = 0; i < 5; i++) { - error = i2c_add_adapter(s4882_adapter+i); - if (error) { - printk(KERN_ERR DRV_NAME - ": Virtual adapter %d registration " - "failed, module not inserted\n", i); - for (i--; i >= 0; i--) - i2c_del_adapter(s4882_adapter+i); - goto ERROR3; - } - } - - return 0; - -ERROR3: - kfree(s4882_algo); - s4882_algo = NULL; -ERROR2: - kfree(s4882_adapter); - s4882_adapter = NULL; -ERROR1: - i2c_del_adapter(&amd756_smbus); -ERROR0: - return error; -} - -static void __exit amd756_s4882_exit(void) -{ - if (s4882_adapter) { - int i; - - for (i = 0; i < 5; i++) - i2c_del_adapter(s4882_adapter+i); - kfree(s4882_adapter); - s4882_adapter = NULL; - } - if (s4882_algo) { - kfree(s4882_algo); - s4882_algo = NULL; - } - - /* Restore physical bus */ - if (i2c_add_adapter(&amd756_smbus)) - printk(KERN_ERR DRV_NAME ": Physical bus restoration " - "failed\n"); -} - -MODULE_AUTHOR("Jean Delvare "); -MODULE_DESCRIPTION("S4882 SMBus multiplexing"); -MODULE_LICENSE("GPL"); - -module_init(amd756_s4882_init); -module_exit(amd756_s4882_exit); diff --git a/kernel/busses/i2c-amd756.c b/kernel/busses/i2c-amd756.c deleted file mode 100644 index 5f93255b..00000000 --- a/kernel/busses/i2c-amd756.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - amd756.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - - Copyright (c) 1999-2002 Merlin Hughes - - Shamelessly ripped from i2c-piix4.c: - - Copyright (c) 1998, 1999 Frodo Looijaard and - Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - 2002-04-08: Added nForce support. (Csaba Halasz) - 2002-10-03: Fixed nForce PnP I/O port. (Michael Steil) - 2002-12-28: Rewritten into something that resembles a Linux driver (hch) - 2003-11-29: Added back AMD8111 removed by the previous rewrite. - (Philip Pokorny) - 2004-02-15: Don't register driver to avoid driver conflicts. - (Daniel Rune Jensen) -*/ - -/* - Supports AMD756, AMD766, AMD768, AMD8111 and nVidia nForce - Note: we assume there can only be one device, with one SMBus interface. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" - -#define DRV_NAME "i2c-amd756" - -/* AMD756 SMBus address offsets */ -#define SMB_ADDR_OFFSET 0xE0 -#define SMB_IOSIZE 16 -#define SMB_GLOBAL_STATUS (0x0 + amd756_ioport) -#define SMB_GLOBAL_ENABLE (0x2 + amd756_ioport) -#define SMB_HOST_ADDRESS (0x4 + amd756_ioport) -#define SMB_HOST_DATA (0x6 + amd756_ioport) -#define SMB_HOST_COMMAND (0x8 + amd756_ioport) -#define SMB_HOST_BLOCK_DATA (0x9 + amd756_ioport) -#define SMB_HAS_DATA (0xA + amd756_ioport) -#define SMB_HAS_DEVICE_ADDRESS (0xC + amd756_ioport) -#define SMB_HAS_HOST_ADDRESS (0xE + amd756_ioport) -#define SMB_SNOOP_ADDRESS (0xF + amd756_ioport) - -/* PCI Address Constants */ - -/* address of I/O space */ -#define SMBBA 0x058 /* mh */ -#define SMBBANFORCE 0x014 - -/* general configuration */ -#define SMBGCFG 0x041 /* mh */ - -/* silicon revision code */ -#define SMBREV 0x008 - -/* Other settings */ -#define MAX_TIMEOUT 500 - -/* AMD756 constants */ -#define AMD756_QUICK 0x00 -#define AMD756_BYTE 0x01 -#define AMD756_BYTE_DATA 0x02 -#define AMD756_WORD_DATA 0x03 -#define AMD756_PROCESS_CALL 0x04 -#define AMD756_BLOCK_DATA 0x05 - - -static unsigned short amd756_ioport = 0; - -/* - SMBUS event = I/O 28-29 bit 11 - see E0 for the status bits and enabled in E2 - -*/ - -#define GS_ABRT_STS (1 << 0) -#define GS_COL_STS (1 << 1) -#define GS_PRERR_STS (1 << 2) -#define GS_HST_STS (1 << 3) -#define GS_HCYC_STS (1 << 4) -#define GS_TO_STS (1 << 5) -#define GS_SMB_STS (1 << 11) - -#define GS_CLEAR_STS (GS_ABRT_STS | GS_COL_STS | GS_PRERR_STS | \ - GS_HCYC_STS | GS_TO_STS ) - -#define GE_CYC_TYPE_MASK (7) -#define GE_HOST_STC (1 << 3) -#define GE_ABORT (1 << 5) - - -static int amd756_transaction(void) -{ - int temp; - int result = 0; - int timeout = 0; - - pr_debug(DRV_NAME - ": Transaction (pre): GS=%04x, GE=%04x, ADD=%04x, DAT=%04x\n", - inw_p(SMB_GLOBAL_STATUS), inw_p(SMB_GLOBAL_ENABLE), - inw_p(SMB_HOST_ADDRESS), inb_p(SMB_HOST_DATA)); - - /* Make sure the SMBus host is ready to start transmitting */ - if ((temp = inw_p(SMB_GLOBAL_STATUS)) & (GS_HST_STS | GS_SMB_STS)) { - pr_debug(DRV_NAME ": SMBus busy (%04x). Waiting...\n", temp); - do { - i2c_delay(1); - temp = inw_p(SMB_GLOBAL_STATUS); - } while ((temp & (GS_HST_STS | GS_SMB_STS)) && - (timeout++ < MAX_TIMEOUT)); - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { - pr_debug(DRV_NAME ": Busy wait timeout (%04x)\n", temp); - goto abort; - } - timeout = 0; - } - - /* start the transaction by setting the start bit */ - outw_p(inw(SMB_GLOBAL_ENABLE) | GE_HOST_STC, SMB_GLOBAL_ENABLE); - - /* We will always wait for a fraction of a second! */ - do { - i2c_delay(1); - temp = inw_p(SMB_GLOBAL_STATUS); - } while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT)); - - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { - pr_debug(DRV_NAME ": Completion timeout!\n"); - goto abort; - } - - if (temp & GS_PRERR_STS) { - result = -1; - pr_debug(DRV_NAME ": SMBus Protocol error (no response)!\n"); - } - - if (temp & GS_COL_STS) { - result = -1; - printk(KERN_WARNING DRV_NAME ": SMBus collision!\n"); - } - - if (temp & GS_TO_STS) { - result = -1; - pr_debug(DRV_NAME ": SMBus protocol timeout!\n"); - } - - if (temp & GS_HCYC_STS) - pr_debug(DRV_NAME ": SMBus protocol success!\n"); - - outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS); - -#ifdef DEBUG - if (((temp = inw_p(SMB_GLOBAL_STATUS)) & GS_CLEAR_STS) != 0x00) { - pr_debug(DRV_NAME - ": Failed reset at end of transaction (%04x)\n", temp); - } - - pr_debug(DRV_NAME - ": Transaction (post): GS=%04x, GE=%04x, ADD=%04x, DAT=%04x\n", - inw_p(SMB_GLOBAL_STATUS), inw_p(SMB_GLOBAL_ENABLE), - inw_p(SMB_HOST_ADDRESS), inb_p(SMB_HOST_DATA)); -#endif - - return result; - - abort: - printk(KERN_WARNING DRV_NAME ": Sending abort.\n"); - outw_p(inw(SMB_GLOBAL_ENABLE) | GE_ABORT, SMB_GLOBAL_ENABLE); - i2c_delay(100); - outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS); - return -1; -} - -/* Return -1 on error. */ - -static s32 amd756_access(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, union i2c_smbus_data * data) -{ - int i, len; - - /** TODO: Should I supporte the 10-bit transfers? */ - switch (size) { - /* TODO: proc call is supported, I'm just not sure what to do here... */ - case I2C_SMBUS_QUICK: - outw_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMB_HOST_ADDRESS); - size = AMD756_QUICK; - break; - case I2C_SMBUS_BYTE: - outw_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMB_HOST_ADDRESS); - if (read_write == I2C_SMBUS_WRITE) - outb_p(command, SMB_HOST_DATA); - size = AMD756_BYTE; - break; - case I2C_SMBUS_BYTE_DATA: - outw_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMB_HOST_ADDRESS); - outb_p(command, SMB_HOST_COMMAND); - if (read_write == I2C_SMBUS_WRITE) - outw_p(data->byte, SMB_HOST_DATA); - size = AMD756_BYTE_DATA; - break; - case I2C_SMBUS_WORD_DATA: - outw_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMB_HOST_ADDRESS); - outb_p(command, SMB_HOST_COMMAND); - if (read_write == I2C_SMBUS_WRITE) - outw_p(data->word, SMB_HOST_DATA); /* TODO: endian???? */ - size = AMD756_WORD_DATA; - break; - case I2C_SMBUS_BLOCK_DATA: - outw_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMB_HOST_ADDRESS); - outb_p(command, SMB_HOST_COMMAND); - if (read_write == I2C_SMBUS_WRITE) { - len = data->block[0]; - if (len < 0) - len = 0; - if (len > 32) - len = 32; - outw_p(len, SMB_HOST_DATA); - /* i = inw_p(SMBHSTCNT); Reset SMBBLKDAT */ - for (i = 1; i <= len; i++) - outb_p(data->block[i], - SMB_HOST_BLOCK_DATA); - } - size = AMD756_BLOCK_DATA; - break; - default: - printk - (KERN_WARNING "i2c-amd756.o: Unsupported transaction %d\n", size); - return -1; - } - - /* How about enabling interrupts... */ - outw_p(size & GE_CYC_TYPE_MASK, SMB_GLOBAL_ENABLE); - - if (amd756_transaction()) /* Error in transaction */ - return -1; - - if ((read_write == I2C_SMBUS_WRITE) || (size == AMD756_QUICK)) - return 0; - - - switch (size) { - case AMD756_BYTE: - data->byte = inw_p(SMB_HOST_DATA); - break; - case AMD756_BYTE_DATA: - data->byte = inw_p(SMB_HOST_DATA); - break; - case AMD756_WORD_DATA: - data->word = inw_p(SMB_HOST_DATA); /* TODO: endian???? */ - break; - case AMD756_BLOCK_DATA: - data->block[0] = inw_p(SMB_HOST_DATA) & 0x3f; - if(data->block[0] > 32) - data->block[0] = 32; - /* i = inw_p(SMBHSTCNT); Reset SMBBLKDAT */ - for (i = 1; i <= data->block[0]; i++) - data->block[i] = inb_p(SMB_HOST_BLOCK_DATA); - break; - } - - return 0; -} - -static void amd756_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void amd756_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static u32 amd756_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL; -} - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = amd756_access, - .functionality = amd756_func, -}; - -struct i2c_adapter amd756_smbus = { - .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD756, - .algo = &smbus_algorithm, - .inc_use = amd756_inc, - .dec_use = amd756_dec, -}; - -enum chiptype { AMD756, AMD766, AMD768, NFORCE, AMD8111 }; -static const char* chipname[] = { - "AMD756", "AMD766", "AMD768", - "nVidia nForce", "AMD8111", -}; - -static struct pci_device_id amd756_ids[] __devinitdata = { - {PCI_VENDOR_ID_AMD, 0x740B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD756 }, - {PCI_VENDOR_ID_AMD, 0x7413, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD766 }, - {PCI_VENDOR_ID_AMD, 0x7443, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD768 }, - {PCI_VENDOR_ID_AMD, 0x746B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD8111 }, - {PCI_VENDOR_ID_NVIDIA, 0x01B4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NFORCE }, - { 0, } -}; - -static int __devinit amd756_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - int nforce = (id->driver_data == NFORCE); - int error; - u8 temp; - - if (amd756_ioport) { - printk(KERN_ERR DRV_NAME ": Only one device supported. " - "(you have a strange motherboard, btw..)\n"); - return -ENODEV; - } - - if (nforce) { - if (PCI_FUNC(pdev->devfn) != 1) - return -ENODEV; - - pci_read_config_word(pdev, SMBBANFORCE, &amd756_ioport); - amd756_ioport &= 0xfffc; - } else { /* amd */ - if (PCI_FUNC(pdev->devfn) != 3) - return -ENODEV; - - pci_read_config_byte(pdev, SMBGCFG, &temp); - if ((temp & 128) == 0) { - printk(KERN_ERR DRV_NAME - ": Error: SMBus controller I/O not enabled!\n"); - return -ENODEV; - } - - /* Determine the address of the SMBus areas */ - /* Technically it is a dword but... */ - pci_read_config_word(pdev, SMBBA, &amd756_ioport); - amd756_ioport &= 0xff00; - amd756_ioport += SMB_ADDR_OFFSET; - } - - if (!request_region(amd756_ioport, SMB_IOSIZE, "amd756-smbus")) { - printk(KERN_ERR DRV_NAME - ": SMB region 0x%x already in use!\n", amd756_ioport); - return -ENODEV; - } - -#ifdef DEBUG - pci_read_config_byte(pdev, SMBREV, &temp); - printk(KERN_DEBUG DRV_NAME ": SMBREV = 0x%X\n", temp); - printk(KERN_DEBUG DRV_NAME ": AMD756_smba = 0x%X\n", amd756_ioport); -#endif - - sprintf(amd756_smbus.name, "SMBus %s adapter at %04x", - chipname[id->driver_data], amd756_ioport); - - error = i2c_add_adapter(&amd756_smbus); - if (error) { - printk(KERN_ERR DRV_NAME - ": Adapter registration failed, module not inserted.\n"); - goto out_err; - } - - return 0; - - out_err: - release_region(amd756_ioport, SMB_IOSIZE); - return error; -} - - -static int __init i2c_amd756_init(void) -{ - struct pci_dev *dev; - const struct pci_device_id *id; - - printk(KERN_INFO "i2c-amd756.o version %s (%s)\n", LM_VERSION, LM_DATE); - - pci_for_each_dev(dev) { - id = pci_match_device(amd756_ids, dev); - if (id && amd756_probe(dev, id) >= 0) - return 0; - } - - return -ENODEV; -} - - -static void __exit i2c_amd756_exit(void) -{ - i2c_del_adapter(&amd756_smbus); - release_region(amd756_ioport, SMB_IOSIZE); -} - -MODULE_AUTHOR("Merlin Hughes "); -MODULE_DESCRIPTION("AMD756/766/768/8111 and nVidia nForce SMBus driver"); -MODULE_LICENSE("GPL"); - -EXPORT_SYMBOL(amd756_smbus); - -module_init(i2c_amd756_init) -module_exit(i2c_amd756_exit) diff --git a/kernel/busses/i2c-amd8111.c b/kernel/busses/i2c-amd8111.c deleted file mode 100644 index a6bc973a..00000000 --- a/kernel/busses/i2c-amd8111.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - * SMBus 2.0 driver for AMD-8111 IO-Hub. - * - * Copyright (c) 2002 Vojtech Pavlik - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - -#ifndef I2C_HW_SMBUS_AMD8111 -#error Your i2c is too old - i2c-2.7.0 or greater required! -#endif - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR ("Vojtech Pavlik "); -MODULE_DESCRIPTION("AMD8111 SMBus 2.0 driver"); - -struct amd_smbus { - struct pci_dev *dev; - struct i2c_adapter adapter; - int base; - int size; -}; - -static struct pci_driver amd8111_driver; - -/* - * AMD PCI control registers definitions. - */ - -#define AMD_PCI_MISC 0x48 - -#define AMD_PCI_MISC_SCI 0x04 /* deliver SCI */ -#define AMD_PCI_MISC_INT 0x02 /* deliver PCI IRQ */ -#define AMD_PCI_MISC_SPEEDUP 0x01 /* 16x clock speedup */ - -/* - * ACPI 2.0 chapter 13 PCI interface definitions. - */ - -#define AMD_EC_DATA 0x00 /* data register */ -#define AMD_EC_SC 0x04 /* status of controller */ -#define AMD_EC_CMD 0x04 /* command register */ -#define AMD_EC_ICR 0x08 /* interrupt control register */ - -#define AMD_EC_SC_SMI 0x04 /* smi event pending */ -#define AMD_EC_SC_SCI 0x02 /* sci event pending */ -#define AMD_EC_SC_BURST 0x01 /* burst mode enabled */ -#define AMD_EC_SC_CMD 0x08 /* byte in data reg is command */ -#define AMD_EC_SC_IBF 0x02 /* data ready for embedded controller */ -#define AMD_EC_SC_OBF 0x01 /* data ready for host */ - -#define AMD_EC_CMD_RD 0x80 /* read EC */ -#define AMD_EC_CMD_WR 0x81 /* write EC */ -#define AMD_EC_CMD_BE 0x82 /* enable burst mode */ -#define AMD_EC_CMD_BD 0x83 /* disable burst mode */ -#define AMD_EC_CMD_QR 0x84 /* query EC */ - -/* - * ACPI 2.0 chapter 13 access of registers of the EC - */ - -unsigned int amd_ec_wait_write(struct amd_smbus *smbus) -{ - int timeout = 500; - - while (timeout-- && (inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF)) - udelay(1); - - if (!timeout) { - printk(KERN_WARNING "i2c-amd8111.c: Timeout while waiting for IBF to clear\n"); - return -1; - } - - return 0; -} - -unsigned int amd_ec_wait_read(struct amd_smbus *smbus) -{ - int timeout = 500; - - while (timeout-- && (~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF)) - udelay(1); - - if (!timeout) { - printk(KERN_WARNING "i2c-amd8111.c: Timeout while waiting for OBF to set\n"); - return -1; - } - - return 0; -} - -unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, unsigned char *data) -{ - if (amd_ec_wait_write(smbus)) - return -1; - outb(AMD_EC_CMD_RD, smbus->base + AMD_EC_CMD); - - if (amd_ec_wait_write(smbus)) - return -1; - outb(address, smbus->base + AMD_EC_DATA); - - if (amd_ec_wait_read(smbus)) - return -1; - *data = inb(smbus->base + AMD_EC_DATA); - - return 0; -} - -unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, unsigned char data) -{ - if (amd_ec_wait_write(smbus)) - return -1; - outb(AMD_EC_CMD_WR, smbus->base + AMD_EC_CMD); - - if (amd_ec_wait_write(smbus)) - return -1; - outb(address, smbus->base + AMD_EC_DATA); - - if (amd_ec_wait_write(smbus)) - return -1; - outb(data, smbus->base + AMD_EC_DATA); - - return 0; -} - -/* - * ACPI 2.0 chapter 13 SMBus 2.0 EC register model - */ - -#define AMD_SMB_PRTCL 0x00 /* protocol, PEC */ -#define AMD_SMB_STS 0x01 /* status */ -#define AMD_SMB_ADDR 0x02 /* address */ -#define AMD_SMB_CMD 0x03 /* command */ -#define AMD_SMB_DATA 0x04 /* 32 data registers */ -#define AMD_SMB_BCNT 0x24 /* number of data bytes */ -#define AMD_SMB_ALRM_A 0x25 /* alarm address */ -#define AMD_SMB_ALRM_D 0x26 /* 2 bytes alarm data */ - -#define AMD_SMB_STS_DONE 0x80 -#define AMD_SMB_STS_ALRM 0x40 -#define AMD_SMB_STS_RES 0x20 -#define AMD_SMB_STS_STATUS 0x1f - -#define AMD_SMB_STATUS_OK 0x00 -#define AMD_SMB_STATUS_FAIL 0x07 -#define AMD_SMB_STATUS_DNAK 0x10 -#define AMD_SMB_STATUS_DERR 0x11 -#define AMD_SMB_STATUS_CMD_DENY 0x12 -#define AMD_SMB_STATUS_UNKNOWN 0x13 -#define AMD_SMB_STATUS_ACC_DENY 0x17 -#define AMD_SMB_STATUS_TIMEOUT 0x18 -#define AMD_SMB_STATUS_NOTSUP 0x19 -#define AMD_SMB_STATUS_BUSY 0x1A -#define AMD_SMB_STATUS_PEC 0x1F - -#define AMD_SMB_PRTCL_WRITE 0x00 -#define AMD_SMB_PRTCL_READ 0x01 -#define AMD_SMB_PRTCL_QUICK 0x02 -#define AMD_SMB_PRTCL_BYTE 0x04 -#define AMD_SMB_PRTCL_BYTE_DATA 0x06 -#define AMD_SMB_PRTCL_WORD_DATA 0x08 -#define AMD_SMB_PRTCL_BLOCK_DATA 0x0a -#define AMD_SMB_PRTCL_PROC_CALL 0x0c -#define AMD_SMB_PRTCL_BLOCK_PROC_CALL 0x0d -#define AMD_SMB_PRTCL_I2C_BLOCK_DATA 0x4a -#define AMD_SMB_PRTCL_PEC 0x80 - - -s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, - char read_write, u8 command, int size, union i2c_smbus_data * data) -{ - struct amd_smbus *smbus = adap->algo_data; - unsigned char protocol, len, pec, temp[2]; - int i; - - protocol = (read_write == I2C_SMBUS_READ) ? AMD_SMB_PRTCL_READ : AMD_SMB_PRTCL_WRITE; - pec = (flags & I2C_CLIENT_PEC) ? AMD_SMB_PRTCL_PEC : 0; - - switch (size) { - - case I2C_SMBUS_QUICK: - protocol |= AMD_SMB_PRTCL_QUICK; - read_write = I2C_SMBUS_WRITE; - break; - - case I2C_SMBUS_BYTE: - if (read_write == I2C_SMBUS_WRITE) - amd_ec_write(smbus, AMD_SMB_CMD, command); - protocol |= AMD_SMB_PRTCL_BYTE; - break; - - case I2C_SMBUS_BYTE_DATA: - amd_ec_write(smbus, AMD_SMB_CMD, command); - if (read_write == I2C_SMBUS_WRITE) - amd_ec_write(smbus, AMD_SMB_DATA, data->byte); - protocol |= AMD_SMB_PRTCL_BYTE_DATA; - break; - - case I2C_SMBUS_WORD_DATA: - amd_ec_write(smbus, AMD_SMB_CMD, command); - if (read_write == I2C_SMBUS_WRITE) { - amd_ec_write(smbus, AMD_SMB_DATA, data->word & 0xff); - amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); - } - protocol |= AMD_SMB_PRTCL_WORD_DATA | pec; - break; - - case I2C_SMBUS_BLOCK_DATA: - amd_ec_write(smbus, AMD_SMB_CMD, command); - if (read_write == I2C_SMBUS_WRITE) { - len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX); - amd_ec_write(smbus, AMD_SMB_BCNT, len); - for (i = 0; i < len; i++) - amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); - } - protocol |= AMD_SMB_PRTCL_BLOCK_DATA | pec; - break; - - case I2C_SMBUS_I2C_BLOCK_DATA: - len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX); - amd_ec_write(smbus, AMD_SMB_CMD, command); - amd_ec_write(smbus, AMD_SMB_BCNT, len); - if (read_write == I2C_SMBUS_WRITE) - for (i = 0; i < len; i++) - amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); - protocol |= AMD_SMB_PRTCL_I2C_BLOCK_DATA; - break; - - case I2C_SMBUS_PROC_CALL: - amd_ec_write(smbus, AMD_SMB_CMD, command); - amd_ec_write(smbus, AMD_SMB_DATA, data->word & 0xff); - amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); - protocol = AMD_SMB_PRTCL_PROC_CALL | pec; - read_write = I2C_SMBUS_READ; - break; - - case I2C_SMBUS_BLOCK_PROC_CALL: - len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX - 1); - amd_ec_write(smbus, AMD_SMB_CMD, command); - amd_ec_write(smbus, AMD_SMB_BCNT, len); - for (i = 0; i < len; i++) - amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); - protocol = AMD_SMB_PRTCL_BLOCK_PROC_CALL | pec; - read_write = I2C_SMBUS_READ; - break; - - default: - printk(KERN_WARNING "i2c-amd8111.c: Unsupported transaction %d\n", size); - return -1; - } - - amd_ec_write(smbus, AMD_SMB_ADDR, addr << 1); - amd_ec_write(smbus, AMD_SMB_PRTCL, protocol); - - amd_ec_read(smbus, AMD_SMB_STS, temp + 0); - - if (~temp[0] & AMD_SMB_STS_DONE) { - udelay(500); - amd_ec_read(smbus, AMD_SMB_STS, temp + 0); - } - - if (~temp[0] & AMD_SMB_STS_DONE) { - i2c_delay(HZ/100); - amd_ec_read(smbus, AMD_SMB_STS, temp + 0); - } - - if ((~temp[0] & AMD_SMB_STS_DONE) || (temp[0] & AMD_SMB_STS_STATUS)) - return -1; - - if (read_write == I2C_SMBUS_WRITE) - return 0; - - switch (size) { - - case I2C_SMBUS_BYTE: - case I2C_SMBUS_BYTE_DATA: - amd_ec_read(smbus, AMD_SMB_DATA, &data->byte); - break; - - case I2C_SMBUS_WORD_DATA: - case I2C_SMBUS_PROC_CALL: - amd_ec_read(smbus, AMD_SMB_DATA, temp + 0); - amd_ec_read(smbus, AMD_SMB_DATA + 1, temp + 1); - data->word = (temp[1] << 8) | temp[0]; - break; - - case I2C_SMBUS_BLOCK_DATA: - case I2C_SMBUS_BLOCK_PROC_CALL: - amd_ec_read(smbus, AMD_SMB_BCNT, &len); - len = min_t(u8, len, I2C_SMBUS_BLOCK_MAX); - case I2C_SMBUS_I2C_BLOCK_DATA: - for (i = 0; i < len; i++) - amd_ec_read(smbus, AMD_SMB_DATA + i, data->block + i + 1); - data->block[0] = len; - break; - } - - return 0; -} - -static void amd8111_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void amd8111_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -u32 amd8111_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA | - I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_BLOCK_PROC_CALL | - I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_HWPEC_CALC; -} - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus 2.0 adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = amd8111_access, - .functionality = amd8111_func, -}; - - -static struct pci_device_id amd8111_ids[] __devinitdata = { - { 0x1022, 0x746a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0, } -}; - -static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - struct amd_smbus *smbus; - int error; - - if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO)) - return -ENODEV; - - if (!(smbus = kmalloc(sizeof(struct amd_smbus), GFP_KERNEL))) - return -ENOMEM; - memset(smbus, 0, sizeof(struct amd_smbus)); - - pci_set_drvdata(dev, smbus); - smbus->dev = dev; - smbus->base = pci_resource_start(dev, 0); - smbus->size = pci_resource_len(dev, 0); - - if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) { - kfree(smbus); - return -EBUSY; - } - - sprintf(smbus->adapter.name, "SMBus2 AMD8111 adapter at %04x", smbus->base); - smbus->adapter.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD8111; - smbus->adapter.algo = &smbus_algorithm; - smbus->adapter.algo_data = smbus; - smbus->adapter.inc_use = amd8111_inc; - smbus->adapter.dec_use = amd8111_dec; - - pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0); - - error = i2c_add_adapter(&smbus->adapter); - if (error) { - printk(KERN_WARNING "i2c-amd8111.c: Failed to register adapter.\n"); - release_region(smbus->base, smbus->size); - kfree(smbus); - return error; - } - - printk(KERN_INFO "i2c-amd8111.c: AMD8111 SMBus 2.0 adapter at %#x\n", smbus->base); - return 0; -} - - -static void __devexit amd8111_remove(struct pci_dev *dev) -{ - struct amd_smbus *smbus = (void*) pci_get_drvdata(dev); - i2c_del_adapter(&smbus->adapter); - release_region(smbus->base, smbus->size); - kfree(smbus); -} - -static struct pci_driver amd8111_driver = { - .name = "amd8111 smbus 2.0", - .id_table = amd8111_ids, - .probe = amd8111_probe, - .remove = __devexit_p(amd8111_remove), -}; - -static int __init i2c_amd8111_init(void) -{ - printk(KERN_INFO "i2c-amd8111.o version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&amd8111_driver); -} - - -static void __exit i2c_amd8111_exit(void) -{ - pci_unregister_driver(&amd8111_driver); -} - -module_init(i2c_amd8111_init); -module_exit(i2c_amd8111_exit); diff --git a/kernel/busses/i2c-hydra.c b/kernel/busses/i2c-hydra.c deleted file mode 100644 index eb904e9f..00000000 --- a/kernel/busses/i2c-hydra.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - i2c-hydra.c - Part of lm_sensors, Linux kernel modules - for hardware monitoring - - i2c Support for the Apple `Hydra' Mac I/O - - Copyright (c) 1999 Geert Uytterhoeven - - Based on i2c Support for Via Technologies 82C586B South Bridge - Copyright (c) 1998, 1999 Kyösti Mälkki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for HZ */ -#include "sensors_compat.h" - -MODULE_LICENSE("GPL"); - - -#define HYDRA_CACHE_PD 0x00000030 - -#define HYDRA_CPD_PD0 0x00000001 /* CachePD lines */ -#define HYDRA_CPD_PD1 0x00000002 -#define HYDRA_CPD_PD2 0x00000004 -#define HYDRA_CPD_PD3 0x00000008 - -#define HYDRA_SCLK HYDRA_CPD_PD0 -#define HYDRA_SDAT HYDRA_CPD_PD1 -#define HYDRA_SCLK_OE 0x00000010 -#define HYDRA_SDAT_OE 0x00000020 - -static unsigned long hydra_base; - -static inline void pdregw(u32 val) -{ - writel(val, hydra_base + HYDRA_CACHE_PD); -} - -static inline u32 pdregr(void) -{ - u32 val = readl(hydra_base + HYDRA_CACHE_PD); - return val; -} - -static void bit_hydra_setscl(void *data, int state) -{ - u32 val = pdregr(); - if (state) - val &= ~HYDRA_SCLK_OE; - else { - val &= ~HYDRA_SCLK; - val |= HYDRA_SCLK_OE; - } - pdregw(val); - pdregr(); /* flush posted write */ -} - -static void bit_hydra_setsda(void *data, int state) -{ - u32 val = pdregr(); - if (state) - val &= ~HYDRA_SDAT_OE; - else { - val &= ~HYDRA_SDAT; - val |= HYDRA_SDAT_OE; - } - pdregw(val); - pdregr(); /* flush posted write */ -} - -static int bit_hydra_getscl(void *data) -{ - return (pdregr() & HYDRA_SCLK) != 0; -} - -static int bit_hydra_getsda(void *data) -{ - return (pdregr() & HYDRA_SDAT) != 0; -} - -static void bit_hydra_inc(struct i2c_adapter *adap) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void bit_hydra_dec(struct i2c_adapter *adap) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -/* ------------------------------------------------------------------------ */ - -static struct i2c_algo_bit_data bit_hydra_data = { - .setsda = bit_hydra_setsda, - .setscl = bit_hydra_setscl, - .getsda = bit_hydra_getsda, - .getscl = bit_hydra_getscl, - .udelay = 5, - .mdelay = 5, - .timeout = HZ -}; - -static struct i2c_adapter bit_hydra_ops = { - .name = "Hydra i2c", - .id = I2C_HW_B_HYDRA, - .algo_data = &bit_hydra_data, - .inc_use = bit_hydra_inc, - .dec_use = bit_hydra_dec, -}; - -static struct pci_device_id hydra_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_APPLE, - .device = PCI_DEVICE_ID_APPLE_HYDRA, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit hydra_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - unsigned int base_addr; - - base_addr = dev->resource[0].start; - hydra_base = (unsigned long) ioremap(base_addr, 0x100); - - pdregw(0); /* clear SCLK_OE and SDAT_OE */ - return i2c_bit_add_bus(&bit_hydra_ops); -} - -static void __devexit hydra_remove(struct pci_dev *dev) -{ - pdregw(0); /* clear SCLK_OE and SDAT_OE */ - i2c_bit_del_bus(&bit_hydra_ops); - iounmap((void *) hydra_base); -} - - -static struct pci_driver hydra_driver = { - .name = "hydra smbus", - .id_table = hydra_ids, - .probe = hydra_probe, - .remove = __devexit_p(hydra_remove), -}; - -static int __init i2c_hydra_init(void) -{ - return pci_module_init(&hydra_driver); -} - - -static void __exit i2c_hydra_exit(void) -{ - pci_unregister_driver(&hydra_driver); -} - - - -MODULE_AUTHOR("Geert Uytterhoeven "); -MODULE_DESCRIPTION("i2c for Apple Hydra Mac I/O"); - -module_init(i2c_hydra_init); -module_exit(i2c_hydra_exit); - diff --git a/kernel/busses/i2c-i801.c b/kernel/busses/i2c-i801.c deleted file mode 100644 index a85889ef..00000000 --- a/kernel/busses/i2c-i801.c +++ /dev/null @@ -1,737 +0,0 @@ -/* - i2c-i801.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998 - 2002 Frodo Looijaard , - Philip Edelbrock , and Mark D. Studebaker - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - SUPPORTED DEVICES PCI ID - 82801AA 2413 - 82801AB 2423 - 82801BA 2443 - 82801CA/CAM 2483 - 82801DB 24C3 (HW PEC supported, 32 byte buffer not supported) - 82801EB 24D3 (HW PEC supported, 32 byte buffer not supported) - 6300ESB 25A4 ("") - ICH6 266A ("") - ICH7 27DA ("") - ESB2 269B ("") - ICH8 283E ("") - ICH9 2930 ("") - - This driver supports several versions of Intel's I/O Controller Hubs (ICH). - For SMBus support, they are similar to the PIIX4 and are part - of Intel's '810' and other chipsets. - See the doc/busses/i2c-i801 file for details. - I2C Block Read supported for ICH5 and higher. - Block Process Call are not supported. -*/ - -/* Note: we assume there can only be one I801, with one SMBus interface */ - -/* #define DEBUG 1 */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - -/* 82801CA is undefined before kernel 2.4.13 */ -#ifndef PCI_DEVICE_ID_INTEL_82801CA_3 -#define PCI_DEVICE_ID_INTEL_82801CA_3 0x2483 -#endif - -/* 82801DB is undefined before kernel 2.4.19 */ -#ifndef PCI_DEVICE_ID_INTEL_82801DB_3 -#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3 -#endif - -/* 82801EB is undefined before kernel 2.4.21 */ -#ifndef PCI_DEVICE_ID_INTEL_82801EB_3 -#define PCI_DEVICE_ID_INTEL_82801EB_3 0x24d3 -#endif - -/* ESB is undefined before kernel 2.4.22 */ -#ifndef PCI_DEVICE_ID_INTEL_ESB_4 -#define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4 -#endif - -/* ESB2 - Enterprise Southbridge is undefined */ -#ifndef PCI_DEVICE_ID_INTEL_ESB2_17 -#define PCI_DEVICE_ID_INTEL_ESB2_17 0x269b -#endif - -/* ICH6 is undefined */ -#ifndef PCI_DEVICE_ID_INTEL_ICH6_16 -#define PCI_DEVICE_ID_INTEL_ICH6_16 0x266a -#endif - -/* ICH7 is undefined */ -#ifndef PCI_DEVICE_ID_INTEL_ICH7_17 -#define PCI_DEVICE_ID_INTEL_ICH7_17 0x27da -#endif - -/* ICH8 is undefined */ -#ifndef PCI_DEVICE_ID_INTEL_ICH8_5 -#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e -#endif - -/* ICH9 is undefined */ -#ifndef PCI_DEVICE_ID_INTEL_ICH9_6 -#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 -#endif - -#ifdef I2C_CLIENT_PEC -#define HAVE_PEC -#endif - -/* I801 SMBus address offsets */ -#define SMBHSTSTS (0 + i801_smba) -#define SMBHSTCNT (2 + i801_smba) -#define SMBHSTCMD (3 + i801_smba) -#define SMBHSTADD (4 + i801_smba) -#define SMBHSTDAT0 (5 + i801_smba) -#define SMBHSTDAT1 (6 + i801_smba) -#define SMBBLKDAT (7 + i801_smba) -#define SMBPEC (8 + i801_smba) /* ICH4 only */ -#define SMBAUXSTS (12 + i801_smba) /* ICH4 only */ -#define SMBAUXCTL (13 + i801_smba) /* ICH4 only */ - -/* PCI Address Constants */ -#define SMBBA 0x020 -#define SMBHSTCFG 0x040 -#define SMBREV 0x008 - -/* Host configuration bits for SMBHSTCFG */ -#define SMBHSTCFG_HST_EN 1 -#define SMBHSTCFG_SMB_SMI_EN 2 -#define SMBHSTCFG_I2C_EN 4 - -/* Other settings */ -#define MAX_TIMEOUT 100 -#define ENABLE_INT9 0 /* set to 0x01 to enable - untested */ - -/* I801 command constants */ -#define I801_QUICK 0x00 -#define I801_BYTE 0x04 -#define I801_BYTE_DATA 0x08 -#define I801_WORD_DATA 0x0C -#define I801_PROC_CALL 0x10 /* later chips only, unimplemented */ -#define I801_BLOCK_DATA 0x14 -#define I801_I2C_BLOCK_DATA 0x18 /* ich4 and later */ -#define I801_BLOCK_LAST 0x34 -#define I801_I2C_BLOCK_LAST 0x38 /* unimplemented */ -#define I801_START 0x40 -#define I801_PEC_EN 0x80 /* ich4 and later */ - -/* insmod parameters */ - -/* If force_addr is set to anything different from 0, we forcibly enable - the I801 at the given address. VERY DANGEROUS! */ -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Forcibly enable the I801 at the given address. " - "EXTREMELY DANGEROUS!"); - -static int i801_transaction(void); -static int i801_block_transaction(union i2c_smbus_data *data, char read_write, - int command, int hwpec); - -static unsigned short i801_smba; -static struct pci_driver i801_driver; -static struct pci_dev *I801_dev; -static int isich4; /* is PEC supported? */ -static int isich5; /* is i2c block read supported? */ - -static int __devinit i801_setup(struct pci_dev *dev) -{ - unsigned char temp; - - I801_dev = dev; - if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_3 || - dev->device == PCI_DEVICE_ID_INTEL_82801EB_3 || - dev->device == PCI_DEVICE_ID_INTEL_ESB_4 || - dev->device == PCI_DEVICE_ID_INTEL_ESB2_17 || - dev->device == PCI_DEVICE_ID_INTEL_ICH6_16 || - dev->device == PCI_DEVICE_ID_INTEL_ICH7_17 || - dev->device == PCI_DEVICE_ID_INTEL_ICH8_5 || - dev->device == PCI_DEVICE_ID_INTEL_ICH9_6) - isich4 = 1; - else - isich4 = 0; - isich5 = isich4 && dev->device != PCI_DEVICE_ID_INTEL_82801DB_3; - - /* Determine the address of the SMBus area */ - if (force_addr) { - i801_smba = force_addr & 0xfff0; - } else { - pci_read_config_word(I801_dev, SMBBA, &i801_smba); - i801_smba &= 0xfff0; - if(i801_smba == 0) { - dev_err(dev, "SMB base address uninitialized " - "- upgrade BIOS or use force_addr=0xaddr\n"); - return -ENODEV; - } - } - - if (!request_region(i801_smba, (isich4 ? 16 : 8), i801_driver.name)) { - dev_err(dev, "I801_smb region 0x%x already in use!\n", - i801_smba); - return -EBUSY; - } - - pci_read_config_byte(I801_dev, SMBHSTCFG, &temp); - temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ - pci_write_config_byte(I801_dev, SMBHSTCFG, temp); - - /* If force_addr is set, we program the new address here. Just to make - sure, we disable the device first. */ - if (force_addr) { - pci_write_config_byte(I801_dev, SMBHSTCFG, - temp & ~SMBHSTCFG_HST_EN); - pci_write_config_word(I801_dev, SMBBA, i801_smba); - pci_write_config_byte(I801_dev, SMBHSTCFG, - temp | SMBHSTCFG_HST_EN); - dev_warn(dev, "WARNING: I801 SMBus interface set to " - "new address %04x!\n", i801_smba); - } else if (!(temp & SMBHSTCFG_HST_EN)) { - pci_write_config_byte(I801_dev, SMBHSTCFG, - temp | SMBHSTCFG_HST_EN); - dev_warn(dev, "enabling SMBus device\n"); - } - - if (temp & SMBHSTCFG_SMB_SMI_EN) - dev_dbg(dev, "I801 using Interrupt SMI# for SMBus.\n"); - else - dev_dbg(dev, "I801 using PCI Interrupt for SMBus.\n"); - - pci_read_config_byte(I801_dev, SMBREV, &temp); - dev_dbg(dev, "SMBREV = 0x%X\n", temp); - dev_dbg(dev, "I801_smba = 0x%X\n", i801_smba); - - return 0; -} - - -static int i801_transaction(void) -{ - int temp; - int result = 0; - int timeout = 0; - - dev_dbg(I801_dev, "Transaction (pre): CNT=%02x, CMD=%02x, " - "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), - inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), - inb_p(SMBHSTDAT1)); - - /* Make sure the SMBus host is ready to start transmitting */ - /* 0x1f = Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ - if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { - dev_dbg(I801_dev, "SMBus busy (%02x). Resetting...\n", - temp); - outb_p(temp, SMBHSTSTS); - if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { - dev_dbg(I801_dev, "Failed! (%02x)\n", temp); - return -1; - } else { - dev_dbg(I801_dev, "Successful!\n"); - } - } - - outb_p(inb(SMBHSTCNT) | I801_START, SMBHSTCNT); - - /* We will always wait for a fraction of a second! */ - do { - i2c_delay(1); - temp = inb_p(SMBHSTSTS); - } while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT)); - - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { - dev_dbg(I801_dev, "SMBus Timeout!\n"); - result = -1; - } - - if (temp & 0x10) { - result = -1; - dev_dbg(I801_dev, "Error: Failed bus transaction\n"); - } - - if (temp & 0x08) { - result = -1; - dev_err(I801_dev, "Bus collision! SMBus may be locked " - "until next hard reset. (sorry!)\n"); - /* Clock stops and slave is stuck in mid-transmission */ - } - - if (temp & 0x04) { - result = -1; - dev_dbg(I801_dev, "Error: no response!\n"); - } - - if ((inb_p(SMBHSTSTS) & 0x1f) != 0x00) - outb_p(inb(SMBHSTSTS), SMBHSTSTS); - - if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { - dev_dbg(I801_dev, "Failed reset at end of transaction " - "(%02x)\n", temp); - } - dev_dbg(I801_dev, "Transaction (post): CNT=%02x, CMD=%02x, " - "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), - inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), - inb_p(SMBHSTDAT1)); - return result; -} - -/* All-inclusive block transaction function */ -static int i801_block_transaction(union i2c_smbus_data *data, char read_write, - int command, int hwpec) -{ - int i, len; - int smbcmd; - int temp; - int result = 0; - int timeout; - unsigned char hostc, errmask; - - if (command == I2C_SMBUS_I2C_BLOCK_DATA) { - if (read_write == I2C_SMBUS_WRITE) { - /* set I2C_EN bit in configuration register */ - pci_read_config_byte(I801_dev, SMBHSTCFG, &hostc); - pci_write_config_byte(I801_dev, SMBHSTCFG, - hostc | SMBHSTCFG_I2C_EN); - } else if (!isich5) { - dev_err(I801_dev, - "I2C_SMBUS_I2C_BLOCK_READ unsupported!\n"); - return -1; - } - } - - if (read_write == I2C_SMBUS_WRITE) { - len = data->block[0]; - if (len < 1) - len = 1; - if (len > 32) - len = 32; - outb_p(len, SMBHSTDAT0); - outb_p(data->block[1], SMBBLKDAT); - } else { - len = 32; /* max for reads */ - } - - if(isich4 && command != I2C_SMBUS_I2C_BLOCK_DATA) { - /* set 32 byte buffer */ - } - - for (i = 1; i <= len; i++) { - if (i == len && read_write == I2C_SMBUS_READ) - smbcmd = I801_BLOCK_LAST; - else if (command == I2C_SMBUS_I2C_BLOCK_DATA && - read_write == I2C_SMBUS_READ) - smbcmd = I801_I2C_BLOCK_DATA; - else - smbcmd = I801_BLOCK_DATA; - outb_p(smbcmd | ENABLE_INT9, SMBHSTCNT); - - dev_dbg(I801_dev, "Block (pre %d): CNT=%02x, CMD=%02x, " - "ADD=%02x, DAT0=%02x, BLKDAT=%02x\n", i, - inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD), - inb_p(SMBHSTDAT0), inb_p(SMBBLKDAT)); - - /* Make sure the SMBus host is ready to start transmitting */ - temp = inb_p(SMBHSTSTS); - if (i == 1) { - /* Erronenous conditions before transaction: - * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ - errmask=0x9f; - } else { - /* Erronenous conditions during transaction: - * Failed, Bus_Err, Dev_Err, Intr */ - errmask=0x1e; - } - if (temp & errmask) { - dev_dbg(I801_dev, "SMBus busy (%02x). " - "Resetting...\n", temp); - outb_p(temp, SMBHSTSTS); - if (((temp = inb_p(SMBHSTSTS)) & errmask) != 0x00) { - dev_err(I801_dev, - "Reset failed! (%02x)\n", temp); - result = -1; - goto END; - } - if (i != 1) { - /* if die in middle of block transaction, fail */ - result = -1; - goto END; - } - } - - if (i == 1) - outb_p(inb(SMBHSTCNT) | I801_START, SMBHSTCNT); - - /* We will always wait for a fraction of a second! */ - timeout = 0; - do { - i2c_delay(1); - temp = inb_p(SMBHSTSTS); - } - while ((!(temp & 0x80)) - && (timeout++ < MAX_TIMEOUT)); - - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { - result = -1; - dev_dbg(I801_dev, "SMBus Timeout!\n"); - } - - if (temp & 0x10) { - result = -1; - dev_dbg(I801_dev, - "Error: Failed bus transaction\n"); - } else if (temp & 0x08) { - result = -1; - dev_err(I801_dev, "Bus collision!\n"); - } else if (temp & 0x04) { - result = -1; - dev_dbg(I801_dev, "Error: no response!\n"); - } - - if (i == 1 && read_write == I2C_SMBUS_READ) { - if (command != I2C_SMBUS_I2C_BLOCK_DATA) { - len = inb_p(SMBHSTDAT0); - if (len < 1) - len = 1; - if (len > 32) - len = 32; - data->block[0] = len; - } else { - /* if slave returns < 32 bytes transaction will fail */ - data->block[0] = 32; - } - } - - /* Retrieve/store value in SMBBLKDAT */ - if (read_write == I2C_SMBUS_READ) - data->block[i] = inb_p(SMBBLKDAT); - if (read_write == I2C_SMBUS_WRITE && i+1 <= len) - outb_p(data->block[i+1], SMBBLKDAT); - if ((temp & 0x9e) != 0x00) - outb_p(temp, SMBHSTSTS); /* signals SMBBLKDAT ready */ - - if ((temp = (0x1e & inb_p(SMBHSTSTS))) != 0x00) { - dev_dbg(I801_dev, - "Bad status (%02x) at end of transaction\n", - temp); - } - dev_dbg(I801_dev, "Block (post %d): CNT=%02x, CMD=%02x, " - "ADD=%02x, DAT0=%02x, BLKDAT=%02x\n", i, - inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD), - inb_p(SMBHSTDAT0), inb_p(SMBBLKDAT)); - - if (result < 0) - goto END; - } - - if (hwpec) { - /* wait for INTR bit as advised by Intel */ - timeout = 0; - do { - i2c_delay(1); - temp = inb_p(SMBHSTSTS); - } while ((!(temp & 0x02)) - && (timeout++ < MAX_TIMEOUT)); - - if (timeout >= MAX_TIMEOUT) { - dev_dbg(I801_dev, "PEC Timeout!\n"); - } - outb_p(temp, SMBHSTSTS); - } - result = 0; -END: - if (command == I2C_SMBUS_I2C_BLOCK_DATA && - read_write == I2C_SMBUS_WRITE) { - /* restore saved configuration register value */ - pci_write_config_byte(I801_dev, SMBHSTCFG, hostc); - } - return result; -} - -/* Return -1 on error. */ -static s32 i801_access(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, u8 command, - int size, union i2c_smbus_data * data) -{ - int hwpec = 0; - int block = 0; - int ret, xact = 0; - -#ifdef HAVE_PEC - hwpec = isich4 && (flags & I2C_CLIENT_PEC) - && size != I2C_SMBUS_QUICK - && size != I2C_SMBUS_I2C_BLOCK_DATA; -#endif - - switch (size) { - case I2C_SMBUS_QUICK: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - xact = I801_QUICK; - break; - case I2C_SMBUS_BYTE: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - if (read_write == I2C_SMBUS_WRITE) - outb_p(command, SMBHSTCMD); - xact = I801_BYTE; - break; - case I2C_SMBUS_BYTE_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) - outb_p(data->byte, SMBHSTDAT0); - xact = I801_BYTE_DATA; - break; - case I2C_SMBUS_WORD_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) { - outb_p(data->word & 0xff, SMBHSTDAT0); - outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); - } - xact = I801_WORD_DATA; - break; - case I2C_SMBUS_BLOCK_DATA: - case I2C_SMBUS_I2C_BLOCK_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - outb_p(command, SMBHSTCMD); - block = 1; - break; - case I2C_SMBUS_PROC_CALL: - default: - dev_err(I801_dev, "Unsupported transaction %d\n", size); - return -1; - } - - outb_p(hwpec, SMBAUXCTL); /* enable/disable hardware PEC */ - - if(block) - ret = i801_block_transaction(data, read_write, size, hwpec); - else { - outb_p(xact | ENABLE_INT9, SMBHSTCNT); - ret = i801_transaction(); - } - - /* Some BIOSes don't like it when PEC is enabled at reboot or resume - time, so we forcibly disable it after every transaction. */ - if (hwpec) - outb_p(0, SMBAUXCTL); - - if(block) - return ret; - if(ret) - return -1; - if ((read_write == I2C_SMBUS_WRITE) || (xact == I801_QUICK)) - return 0; - - switch (xact & 0x7f) { - case I801_BYTE: /* Result put in SMBHSTDAT0 */ - case I801_BYTE_DATA: - data->byte = inb_p(SMBHSTDAT0); - break; - case I801_WORD_DATA: - data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); - break; - } - return 0; -} - -static void i801_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void i801_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static u32 i801_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK -#ifdef HAVE_PEC - | (isich4 ? I2C_FUNC_SMBUS_HWPEC_CALC : 0) -#endif -#if 0 - | (isich5 ? I2C_FUNC_SMBUS_READ_I2C_BLOCK - : 0) -#endif - ; -} - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = i801_access, - .functionality = i801_func, -}; - -static struct i2c_adapter i801_adapter = { - .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_I801, - .algo = &smbus_algorithm, - .inc_use = i801_inc, - .dec_use = i801_dec, -}; - -static struct pci_device_id i801_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82801AA_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82801AB_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82801BA_2, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82801CA_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82801DB_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82801EB_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_ESB_4, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_ESB2_17, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_ICH6_16, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_ICH7_17, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_ICH8_5, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_ICH9_6, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - int err; - - if ((err = i801_setup(dev))) - return err; - - snprintf(i801_adapter.name, 32, - "SMBus I801 adapter at %04x", i801_smba); - return i2c_add_adapter(&i801_adapter); -} - -static void __devexit i801_remove(struct pci_dev *dev) -{ - i2c_del_adapter(&i801_adapter); - release_region(i801_smba, (isich4 ? 16 : 8)); -} - -static struct pci_driver i801_driver = { - .name = "i801 smbus", - .id_table = i801_ids, - .probe = i801_probe, - .remove = __devexit_p(i801_remove), -}; - -static int __init i2c_i801_init(void) -{ - printk(KERN_INFO "i2c-i801 version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&i801_driver); -} - -static void __exit i2c_i801_exit(void) -{ - pci_unregister_driver(&i801_driver); -} - -MODULE_AUTHOR ("Frodo Looijaard , " - "Philip Edelbrock , " - "and Mark D. Studebaker "); -MODULE_DESCRIPTION("I801 SMBus driver"); -MODULE_LICENSE("GPL"); - -module_init(i2c_i801_init); -module_exit(i2c_i801_exit); diff --git a/kernel/busses/i2c-i810.c b/kernel/busses/i2c-i810.c deleted file mode 100644 index 804890ee..00000000 --- a/kernel/busses/i2c-i810.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - i2c-i810.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999, 2000 Frodo Looijaard , - Philip Edelbrock , - Ralph Metzler , and - Mark D. Studebaker - - Based on code written by Ralph Metzler and - Simon Vogl - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ -/* - This interfaces to the I810/I815 to provide access to - the DDC Bus and the I2C Bus. - - SUPPORTED DEVICES PCI ID - i810AA 7121 - i810AB 7123 - i810E 7125 - i815 1132 - i845G 2562 -*/ - - -#include -#include -#include -#include -#include -#include -#include /* for HZ */ -#include "version.h" -#include "sensors_compat.h" - -MODULE_LICENSE("GPL"); - -/* Not defined by any Linux 2.4 kernel */ -#define PCI_DEVICE_ID_INTEL_82810E_IG 0x7125 -#define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132 -#define PCI_DEVICE_ID_INTEL_82845G_IG 0x2562 - -/* GPIO register locations */ -#define I810_IOCONTROL_OFFSET 0x5000 -#define I810_HVSYNC 0x00 /* not used */ -#define I810_GPIOA 0x10 -#define I810_GPIOB 0x14 - -/* bit locations in the registers */ -#define SCL_DIR_MASK 0x0001 -#define SCL_DIR 0x0002 -#define SCL_VAL_MASK 0x0004 -#define SCL_VAL_OUT 0x0008 -#define SCL_VAL_IN 0x0010 -#define SDA_DIR_MASK 0x0100 -#define SDA_DIR 0x0200 -#define SDA_VAL_MASK 0x0400 -#define SDA_VAL_OUT 0x0800 -#define SDA_VAL_IN 0x1000 - -/* initialization states */ -#define INIT1 0x1 -#define INIT2 0x2 -#define INIT3 0x4 - -/* delays */ -#define CYCLE_DELAY 10 -#define TIMEOUT (HZ / 2) - - -static void config_i810(struct pci_dev *dev); - - -static unsigned long ioaddr; - -/* The i810 GPIO registers have individual masks for each bit - so we never have to read before writing. Nice. */ - -static void bit_i810i2c_setscl(void *data, int val) -{ - writel((val ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK, - ioaddr + I810_GPIOB); - readl(ioaddr + I810_GPIOB); /* flush posted write */ -} - -static void bit_i810i2c_setsda(void *data, int val) -{ - writel((val ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK, - ioaddr + I810_GPIOB); - readl(ioaddr + I810_GPIOB); /* flush posted write */ -} - -/* The GPIO pins are open drain, so the pins could always remain outputs. - However, some chip versions don't latch the inputs unless they - are set as inputs. - We rely on the i2c-algo-bit routines to set the pins high before - reading the input from other chips. Following guidance in the 815 - prog. ref. guide, we do a "dummy write" of 0 to the register before - reading which forces the input value to be latched. We presume this - applies to the 810 as well; shouldn't hurt anyway. This is necessary to get - i2c_algo_bit bit_test=1 to pass. */ - -static int bit_i810i2c_getscl(void *data) -{ - writel(SCL_DIR_MASK, ioaddr + I810_GPIOB); - writel(0, ioaddr + I810_GPIOB); - return (0 != (readl(ioaddr + I810_GPIOB) & SCL_VAL_IN)); -} - -static int bit_i810i2c_getsda(void *data) -{ - writel(SDA_DIR_MASK, ioaddr + I810_GPIOB); - writel(0, ioaddr + I810_GPIOB); - return (0 != (readl(ioaddr + I810_GPIOB) & SDA_VAL_IN)); -} - -static void bit_i810ddc_setscl(void *data, int val) -{ - writel((val ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK, - ioaddr + I810_GPIOA); - readl(ioaddr + I810_GPIOA); /* flush posted write */ -} - -static void bit_i810ddc_setsda(void *data, int val) -{ - writel((val ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK, - ioaddr + I810_GPIOA); - readl(ioaddr + I810_GPIOA); /* flush posted write */ -} - -static int bit_i810ddc_getscl(void *data) -{ - writel(SCL_DIR_MASK, ioaddr + I810_GPIOA); - writel(0, ioaddr + I810_GPIOA); - return (0 != (readl(ioaddr + I810_GPIOA) & SCL_VAL_IN)); -} - -static int bit_i810ddc_getsda(void *data) -{ - writel(SDA_DIR_MASK, ioaddr + I810_GPIOA); - writel(0, ioaddr + I810_GPIOA); - return (0 != (readl(ioaddr + I810_GPIOA) & SDA_VAL_IN)); -} - - -/* Configures the chip */ -void config_i810(struct pci_dev *dev) -{ - unsigned long cadr; - - /* map I810 memory */ - cadr = dev->resource[1].start; - cadr += I810_IOCONTROL_OFFSET; - cadr &= PCI_BASE_ADDRESS_MEM_MASK; - ioaddr = (unsigned long)ioremap_nocache(cadr, 0x1000); - if(ioaddr) { - bit_i810i2c_setscl(NULL, 1); - bit_i810i2c_setsda(NULL, 1); - bit_i810ddc_setscl(NULL, 1); - bit_i810ddc_setsda(NULL, 1); - } -} - -static void i810_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void i810_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static struct i2c_algo_bit_data i810_i2c_bit_data = { - .setsda = bit_i810i2c_setsda, - .setscl = bit_i810i2c_setscl, - .getsda = bit_i810i2c_getsda, - .getscl = bit_i810i2c_getscl, - .udelay = CYCLE_DELAY, - .mdelay = CYCLE_DELAY, - .timeout = TIMEOUT, -}; - -static struct i2c_adapter i810_i2c_adapter = { - .name = "I810/I815 I2C Adapter", - .id = I2C_HW_B_I810, - .algo_data = &i810_i2c_bit_data, - .inc_use = i810_inc, - .dec_use = i810_dec, -}; - -static struct i2c_algo_bit_data i810_ddc_bit_data = { - .setsda = bit_i810ddc_setsda, - .setscl = bit_i810ddc_setscl, - .getsda = bit_i810ddc_getsda, - .getscl = bit_i810ddc_getscl, - .udelay = CYCLE_DELAY, - .mdelay = CYCLE_DELAY, - .timeout = TIMEOUT, -}; - -static struct i2c_adapter i810_ddc_adapter = { - .name = "I810/I815 DDC Adapter", - .id = I2C_HW_B_I810, - .algo_data = &i810_ddc_bit_data, - .inc_use = i810_inc, - .dec_use = i810_dec, -}; - - -static struct pci_device_id i810_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82810_IG1, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82810_IG3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82810E_IG, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82815_CGC, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82845G_IG, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit i810_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - int retval; - - config_i810(dev); - printk("i2c-i810.o: i810/i815 found.\n"); - - retval = i2c_bit_add_bus(&i810_i2c_adapter); - if(retval) - return retval; - retval = i2c_bit_add_bus(&i810_ddc_adapter); - if(retval) - i2c_bit_del_bus(&i810_i2c_adapter); - return retval; -} - -static void __devexit i810_remove(struct pci_dev *dev) -{ - i2c_bit_del_bus(&i810_ddc_adapter); - i2c_bit_del_bus(&i810_i2c_adapter); -} - - -/* Don't register driver to avoid driver conflicts */ -/* -static struct pci_driver i810_driver = { - .name = "i810 smbus", - .id_table = i810_ids, - .probe = i810_probe, - .remove = __devexit_p(i810_remove), -}; -*/ - -static int __init i2c_i810_init(void) -{ - struct pci_dev *dev; - const struct pci_device_id *id; - - printk("i2c-i810.o version %s (%s)\n", LM_VERSION, LM_DATE); -/* - return pci_module_init(&i810_driver); -*/ - pci_for_each_dev(dev) { - id = pci_match_device(i810_ids, dev); - if(id) - if(i810_probe(dev, id) >= 0) - return 0; - } - return -ENODEV; -} - -static void __exit i2c_i810_exit(void) -{ -/* - pci_unregister_driver(&i810_driver); -*/ - i810_remove(NULL); - iounmap((void *)ioaddr); -} - -MODULE_AUTHOR - ("Frodo Looijaard , Philip Edelbrock , Ralph Metzler , and Mark D. Studebaker "); -MODULE_DESCRIPTION("I810/I815 I2C/DDC driver"); - -module_init(i2c_i810_init); -module_exit(i2c_i810_exit); diff --git a/kernel/busses/i2c-ipmb.c b/kernel/busses/i2c-ipmb.c deleted file mode 100644 index b11b0d0b..00000000 --- a/kernel/busses/i2c-ipmb.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - i2c-ipmb.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2002 Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - THIS DOESN'T WORK YET - DON'T BOTHER TRYING IT. - This implements an i2c adapter for the BMC IPMB. -*/ - -#include -#include -#include -#include -#include -#include "version.h" - - -static u32 i2c_ipmb_func(struct i2c_adapter *adapter); -int ipmb_access(struct i2c_adapter *adap,struct i2c_msg msgs[], - int num); - - -/* I2C Data */ -static struct i2c_algorithm i2c_ipmb_algorithm = { - .name = "IPMB algorithm", - .id = I2C_ALGO_IPMB, - .master_xfer = ipmb_access, - .functionality = i2c_ipmb_func, -}; - -#define MAX_IPMB_ADAPTERS 8 -static struct i2c_adapter i2c_ipmb_adapter[MAX_IPMB_ADAPTERS]; - -/* IPMI Data */ -#define IPMI_IPMB_CHANNEL 0 -static ipmi_user_t i2c_ipmb_user; -static unsigned char ipmi_version_major; -static unsigned char ipmi_version_minor; -static const char msgdata[IPMI_MAX_ADDR_SIZE]; /* ?? */ -static struct ipmi_system_interface_addr address = { - IPMI_SYSTEM_INTERFACE_ADDR_TYPE, - IPMI_BMC_CHANNEL, - 0 -}; /* send address */ -static struct ipmi_ipmb_addr ipmb_address = { - IPMI_IPMB_ADDR_TYPE, - IPMI_IPMB_CHANNEL, - 0, - 0 -}; /* send address */ -static long msgid; /* message ID */ -static int interfaces; /* number of BMC's found */ -static struct ipmi_msg tx_message; /* send message */ -static unsigned char tx_msg_data[IPMI_MAX_MSG_LENGTH + 50]; -static unsigned char rx_msg_data[IPMI_MAX_MSG_LENGTH + 50]; /* sloppy */ - -/* IPMI Message defs */ -/* Network Function Codes */ -#define IPMI_NETFN_APP 0x06 -/* Commands */ -#define IPMI_ENABLE_CHANNEL 0x32 -#define IPMI_SEND_MSG 0x34 -#define IPMI_GET_CHANNEL_INFO 0x42 /* unfortunately, IPMI 1.5 only */ -#define IPMI_MASTER_WR 0x52 - - -/************** Message Sending **************/ - -static void ipmb_i2c_send_message(struct ipmi_addr *address, - int id, struct ipmi_msg * msg) -{ - int err; - -#ifdef IPMI_RESPONSE_RESPONSE_TYPE - err = ipmi_request(i2c_ipmb_user, address, id, msg, NULL, 0); -#else - err = ipmi_request(i2c_ipmb_user, address, id, msg, 0); -#endif - if (err) - printk(KERN_INFO "i2c-ipmb.o: ipmi_request error %d\n", - err); -} - -/* not used */ -static void ipmb_i2c_bmc_send_message(int id, struct ipmi_msg * msg) -{ - address.channel = IPMI_BMC_CHANNEL; - ipmb_i2c_send_message((struct ipmi_addr *) &address, id, msg); -} - -/* this is for sending commands like master w/r */ -static void ipmb_i2c_ipmb_send_message(int id, struct ipmi_msg * msg) -{ -/* - address.channel = IPMI_IPMB_CHANNEL; -*/ - address.channel = IPMI_BMC_CHANNEL; - ipmb_i2c_send_message((struct ipmi_addr *) &address, id, msg); -} - -#if 0 -/* not used */ -/* this is for an smi message, not for things like master w/r */ -static void ipmb_i2c_ipmb_send_smi(int addr, int id, struct ipmi_msg * msg) -{ - ipmb_address.slave_addr = addr; - ipmb_address.lun = 0; /* pass in */ - ipmb_i2c_send_message((struct ipmi_addr *) &ipmb_address, id, msg); -} - -/* not used */ -/* Compose and send a "Enable Channel Receive" message */ -static void ipmb_enable_channel_rcv(int channel, int code) -{ - tx_message.netfn = IPMI_NETFN_APP; - tx_message.cmd = IPMI_ENABLE_CHANNEL; - tx_message.data_len = 2; - tx_message.data = tx_msg_data; - tx_msg_data[0] = channel; - tx_msg_data[1] = code; - ipmb_i2c_bmc_send_message(msgid++, &tx_message); -} - -/* not used */ -/* Compose and send a "Get Channel Info" message (1.5 only) */ -static void ipmb_get_channel_info(int channel) -{ - tx_message.netfn = IPMI_NETFN_APP; - tx_message.cmd = IPMI_GET_CHANNEL_INFO; - tx_message.data_len = 1; - tx_message.data = tx_msg_data; - tx_msg_data[0] = channel; - ipmb_i2c_bmc_send_message(msgid++, &tx_message); -} -#endif /* 0 */ - -/* Compose and send a "Master W/R" message */ -static void ipmb_master_wr(int bus, u8 addr, u8 rdcount, - u8 wrcount, u8 *wrdata) -{ - printk(KERN_INFO "i2c-ipmb.o: trying bus %d ...\n", bus); - tx_message.netfn = IPMI_NETFN_APP; - tx_message.cmd = IPMI_MASTER_WR; - tx_message.data_len = 3 + wrcount; - tx_msg_data[0] = bus & 0x0f; - tx_msg_data[1] = addr << 1; - tx_msg_data[2] = rdcount; - if(wrcount > 0) - memcpy(tx_msg_data + 3, wrdata, wrcount); - tx_message.data = tx_msg_data; - ipmb_i2c_ipmb_send_message(msgid++, &tx_message); -} - -int xchan; -int xbus; -/* look for channels. IPMI 1.5 defines multiple channels and an - easy way to get the information. - We don't bother using SDR type 14 for IPMI 1.0; that isn't - always present anyway. We could try "enable message channel receive" - with a channel state = 2 (query) but 1.0 is likely to have only - IPMB busses anyway. Therefore, we assume there is only - the IPMB at channel 0. -*/ -static void ipmb_get_all_channel_info(void) - -{ -#if 0 - if(ipmi_version_major > 1 || - (ipmi_version_major == 1 && ipmi_version_minor >= 5)) - ipmb_get_channel_info(0); -#endif -/* - else - scan SDR's for type 14 - else { - for all xchan 0-15 - ipmb_enable_channel_rcv(xchan, 2); -*/ - xbus = 0; - ipmb_master_wr(xbus, 0x2d, 1, 1, "\0"); -/* -*/ -/* - else - assume IPMB at channel 0 only -*/ -} - -/************** Message Receiving **************/ - -/* not used */ -static void ipmb_rcv_channel_info(struct ipmi_msg *msg) -{ - u8 channel, type, protocol; - - channel = msg->data[1] & 0x0f; - type = msg->data[2] & 0x7f; - protocol = msg->data[3] & 0x1f; - printk(KERN_INFO "i2c-ipmb.o: Channel %d; type 0x%x; protocol 0x%x\n", - channel, type, protocol); -} -/* - return i2c_add_adapter(&i2c_ipmb_adapter); - if (error) { - printk(KERN_ERR "i2c-ipmb.o: Adapter registration failed, " - "module i2c-ipmb.o is not inserted\n."); - return; - } -*/ -/* - if(channel < 7) - ipmb_get_channel_info(channel + 1); -*/ -static void ipmb_rcv_master_resp(struct ipmi_msg *msg) -{ - if(++xbus > 0x0f) - return; - ipmb_master_wr(xbus, 0x2d, 1, 1, "\0"); -} - -#if 0 -/* not used */ -static void ipmb_rcv_channel_enable(struct ipmi_msg *msg) -{ - int state; - - state = msg->data[2] & 1; - - printk(KERN_INFO "i2c-ipmb.o: Channel %d; state %d\n", - xchan, state); - if(++xchan > 0x0f) - return; - ipmb_enable_channel_rcv(xchan, 2); -} -#endif /* 0 */ - -static void ipmb_i2c_msg_handler(struct ipmi_recv_msg *msg, - void *handler_data) -{ - int rcvid = msg->msgid & 0xffffff; - int client = (msg->msgid >> 24) & 0xf; - - if (msg->msg.data[0] != 0) - printk(KERN_WARNING "i2c-ipmb.o: Error 0x%x on cmd 0x%x/0x%x\n", - msg->msg.data[0], msg->msg.netfn & 0xfe, msg->msg.cmd); -/* - else -*/ - ipmb_rcv_master_resp(&(msg->msg)); - - - - - - ipmi_free_recv_msg(msg); -} - -static struct ipmi_user_hndl ipmb_hndlrs = -{ - .ipmi_recv_hndl = ipmb_i2c_msg_handler, -}; - -/*************** I2C funtions *******************/ - -/* Return -1 on error. */ -int ipmb_access(struct i2c_adapter *adap,struct i2c_msg msgs[], - int num) -{ - - - - - - -} - -static u32 i2c_ipmb_func(struct i2c_adapter *adapter) -{ - return 0; /* fixme */ -} - -/**************** Initialization ****************/ - -/* callback for each BMC found */ -static void ipmb_register(int ipmi_intf) -{ - unsigned long flags; - int rv; - - if(interfaces > 0) { /* 1 max for now */ - printk(KERN_INFO - "i2c-ipmb.o: Additional IPMI interface %d not supported\n", - ipmi_intf); - return; - } - - rv = ipmi_create_user(ipmi_intf, &ipmb_hndlrs, NULL, &i2c_ipmb_user); - if (rv < 0) { - printk(KERN_ERR "i2c-ipmb.o: Unable to register with ipmi\n"); - return; - } - - ipmi_get_version(i2c_ipmb_user, &ipmi_version_major, - &ipmi_version_minor); - printk(KERN_INFO - "i2c-ipmb.o: Registered IPMI interface %d with version %d.%d\n", - ipmi_intf, ipmi_version_major, ipmi_version_minor); - interfaces++; - - ipmb_get_all_channel_info(); -} - -static void ipmb_new_smi(int if_num) -{ - ipmb_register(if_num); -} - -static void ipmb_smi_gone(int if_num) -{ - if (interfaces >= 1) { -/* - i2c_del_adapter(&i2c_ipmb_adapter); -*/ - ipmi_destroy_user(i2c_ipmb_user); - interfaces--; - } -} - -static struct ipmi_smi_watcher smi_watcher = -{ - .new_smi = ipmb_new_smi, - .smi_gone = ipmb_smi_gone -}; - -static int __init i2c_ipmb_init(void) -{ - int rv; - - printk(KERN_INFO "i2c-ipmb.o version %s (%s)\n", LM_VERSION, LM_DATE); - - rv = ipmi_smi_watcher_register(&smi_watcher); - if (rv) { - printk(KERN_WARNING - "ipmi_watchdog: can't register smi watcher\n"); - return rv; - } - - printk(KERN_INFO "i2c-ipmb.o: BMC access for i2c modules initialized.\n"); - return 0; -} - - -static void __exit i2c_ipmi_exit(void) -{ - ipmi_smi_watcher_unregister(&smi_watcher); - ipmb_smi_gone(0); -} - -MODULE_AUTHOR("M. D. Studebaker "); -MODULE_DESCRIPTION("IPMB-BMC access through i2c"); -MODULE_LICENSE("GPL"); - -module_init(i2c_ipmb_init); -module_exit(i2c_ipmi_exit); diff --git a/kernel/busses/i2c-ipmi.c b/kernel/busses/i2c-ipmi.c deleted file mode 100644 index cae78e36..00000000 --- a/kernel/busses/i2c-ipmi.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - i2c-ipmi.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2002 Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - This implements a "dummy" i2c adapter for clients to access the - BMC via IPMI messages. Supports only one BMC and one client for now! -*/ - -#include -#include -#include -#include -#include -#include "version.h" - - -static u32 i2c_ipmi_func(struct i2c_adapter *adapter); -static int bmcclient_i2c_send_message(struct i2c_adapter *, char *, int); - -static void i2c_ipmi_inc_use(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void i2c_ipmi_dec_use(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -/* I2C Data */ -static struct i2c_algorithm i2c_ipmi_algorithm = { - .name = "IPMI algorithm", - .id = I2C_ALGO_IPMI, - .slave_send = &bmcclient_i2c_send_message, - .functionality = &i2c_ipmi_func, -}; - -static struct i2c_adapter i2c_ipmi_adapter = { - .name = "IPMI adapter", - .id = I2C_ALGO_IPMI | I2C_HW_IPMI, - .algo = &i2c_ipmi_algorithm, - .inc_use = &i2c_ipmi_inc_use, - .dec_use = &i2c_ipmi_dec_use, -}; - -/* IPMI Data */ -static ipmi_user_t i2c_ipmi_user; -static unsigned char ipmi_version_major; -static unsigned char ipmi_version_minor; -static const char msgdata[IPMI_MAX_ADDR_SIZE]; /* ?? */ -static struct ipmi_addr address = { - IPMI_SYSTEM_INTERFACE_ADDR_TYPE, - IPMI_BMC_CHANNEL, - {0} -}; /* send address */ -static int interfaces; /* number of BMC's found */ - - -/* Dummy adapter... */ -static u32 i2c_ipmi_func(struct i2c_adapter *adapter) -{ - return 0; -} - -/************** Message Sending **************/ - -static int find_client(struct i2c_client * client) -{ - int i; - - for (i = 0; i < I2C_CLIENT_MAX; i++) - if (client == i2c_ipmi_adapter.clients[i]) - return i; - return -1; -} - -static void ipmi_i2c_send_message(int id, struct ipmi_msg * msg) -{ -#ifdef IPMI_RESPONSE_RESPONSE_TYPE - ipmi_request(i2c_ipmi_user, &address, (long) id, msg, NULL, 0); -#else - ipmi_request(i2c_ipmi_user, &address, (long) id, msg, 0); -#endif -} - -/* This is the message send function exported to the client - via the i2c_adapter struct. - We use the existing (but unused) slave_send function pointer. - Hence the ugly casts. */ -static int bmcclient_i2c_send_message(struct i2c_adapter *clnt, - char * mesg, int id) -{ - struct ipmi_msg *msg = (struct ipmi_msg *) mesg; - struct i2c_client *client = (struct i2c_client *) clnt; - int clientid; - -#ifdef DEBUG - if(msg->data == NULL) - printk(KERN_INFO "i2c-ipmi.o: Send 0x%x\n", msg->cmd); - else - printk(KERN_INFO "i2c-ipmi.o: Send 0x%x 0x%x 0x%x\n", msg->cmd, msg->data[0], msg->data[1]); -#endif - /* save the client number in the upper 8 bits of the message id */ - if((clientid = find_client(client)) < 0) { - printk(KERN_WARNING "i2c-ipmi.o: Request from unknown client\n"); - return -1; - } - - id = (id & 0xffffff) | (clientid << 24); - ipmi_i2c_send_message(id, msg); - return 0; -} - -/************** Message Receiving **************/ - -static void ipmi_i2c_msg_handler(struct ipmi_recv_msg *msg, - void *handler_data) -{ - int rcvid = msg->msgid & 0xffffff; - int clientid = (msg->msgid >> 24) & 0xff; - -#ifdef DEBUG - if (msg->msg.data[0] != 0) - printk(KERN_WARNING "i2c-ipmi.o: Error 0x%x on cmd 0x%x/0x%x\n", - msg->msg.data[0], msg->msg.netfn, msg->msg.cmd); -#endif - /* Protect ourselves here; verify the client and its callback - since the client may have gone away since - the message was sent! */ - if(clientid < I2C_CLIENT_MAX && - i2c_ipmi_adapter.clients[clientid] != NULL && - i2c_ipmi_adapter.clients[clientid]->driver->command != NULL) - (* i2c_ipmi_adapter.clients[clientid]->driver->command) - (i2c_ipmi_adapter.clients[clientid], rcvid, msg); - else { - printk(KERN_WARNING "i2c-ipmi.o: Response for unknown client\n"); - ipmi_free_recv_msg(msg); - } -} - -static struct ipmi_user_hndl ipmi_hndlrs = -{ - .ipmi_recv_hndl = ipmi_i2c_msg_handler, -}; - -/**************** Initialization ****************/ - -/* callback for each BMC found */ -static void ipmi_register_bmc(int ipmi_intf) -{ - int error; - - if(interfaces > 0) { /* 1 max for now */ - printk(KERN_INFO - "i2c-ipmi.o: Additional IPMI interface %d not supported\n", - ipmi_intf); - return; - } - - error = ipmi_create_user(ipmi_intf, &ipmi_hndlrs, NULL, &i2c_ipmi_user); - if (error < 0) { - printk(KERN_ERR "i2c-ipmi.o: Unable to register with ipmi\n"); - return; - } - - error = i2c_add_adapter(&i2c_ipmi_adapter); - if (error) { - printk(KERN_ERR "i2c-ipmi.o: Adapter registration failed, " - "module i2c-ipmi.o is not inserted\n."); - return; - } - - ipmi_get_version(i2c_ipmi_user, &ipmi_version_major, - &ipmi_version_minor); - printk(KERN_INFO - "i2c-ipmi.o: Registered IPMI interface %d with version %d.%d\n", - ipmi_intf, ipmi_version_major, ipmi_version_minor); - interfaces++; -} - -static void ipmi_new_smi(int if_num) -{ - ipmi_register_bmc(if_num); -} - -static void ipmi_smi_gone(int if_num) -{ - if (interfaces >= 1) { - i2c_del_adapter(&i2c_ipmi_adapter); - ipmi_destroy_user(i2c_ipmi_user); - interfaces--; - } -} - -static struct ipmi_smi_watcher smi_watcher = -{ - .new_smi = ipmi_new_smi, - .smi_gone = ipmi_smi_gone -}; - -static int __init i2c_ipmi_init(void) -{ - int rv; - - printk(KERN_INFO "i2c-ipmi.o version %s (%s)\n", LM_VERSION, LM_DATE); - - rv = ipmi_smi_watcher_register(&smi_watcher); - if (rv) { - printk(KERN_WARNING - "ipmi_watchdog: can't register smi watcher\n"); - return rv; - } - - printk(KERN_INFO "i2c-ipmi.o: BMC access for i2c modules initialized.\n"); - return 0; -} - - -static void __exit i2c_ipmi_exit(void) -{ - ipmi_smi_watcher_unregister(&smi_watcher); - ipmi_smi_gone(0); -} - -MODULE_AUTHOR("M. D. Studebaker "); -MODULE_DESCRIPTION("IPMI-BMC access through i2c"); -MODULE_LICENSE("GPL"); - -module_init(i2c_ipmi_init); -module_exit(i2c_ipmi_exit); diff --git a/kernel/busses/i2c-isa.c b/kernel/busses/i2c-isa.c deleted file mode 100644 index 517cef67..00000000 --- a/kernel/busses/i2c-isa.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - i2c-isa.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* This implements an i2c algorithm/adapter for ISA bus. Not that this is - on first sight very useful; almost no functionality is preserved. - Except that it makes writing drivers for chips which can be on both - the SMBus and the ISA bus very much easier. See lm78.c for an example - of this. */ - -#include -#include -#include -#include -#include -#include "version.h" - -static u32 isa_func(struct i2c_adapter *adapter); - -/* This is the actual algorithm we define */ -static struct i2c_algorithm isa_algorithm = { - .name = "ISA bus algorithm", - .id = I2C_ALGO_ISA, - .functionality = isa_func, -}; - -static void isa_inc_use(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void isa_dec_use(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -/* There can only be one... */ -static struct i2c_adapter isa_adapter = { - .name = "ISA main adapter", - .id = I2C_ALGO_ISA | I2C_HW_ISA, - .algo = &isa_algorithm, - .inc_use = isa_inc_use, - .dec_use = isa_dec_use, -}; - -/* We can't do a thing... */ -static u32 isa_func(struct i2c_adapter *adapter) -{ - return 0; -} - -static int __init i2c_isa_init(void) -{ - printk("i2c-isa.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_adapter(&isa_adapter); -} - -static void __exit i2c_isa_exit(void) -{ - i2c_del_adapter(&isa_adapter); -} - -MODULE_AUTHOR("Frodo Looijaard "); -MODULE_DESCRIPTION("ISA bus access through i2c"); -MODULE_LICENSE("GPL"); - -module_init(i2c_isa_init); -module_exit(i2c_isa_exit); diff --git a/kernel/busses/i2c-keywest.c b/kernel/busses/i2c-keywest.c deleted file mode 100644 index 02ee7245..00000000 --- a/kernel/busses/i2c-keywest.c +++ /dev/null @@ -1,619 +0,0 @@ -/* - i2c Support for Apple Keywest I2C Bus Controller - - Copyright (c) 2001 Benjamin Herrenschmidt - - Original work by - - Copyright (c) 2000 Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - Changes: - - 2001/12/13 BenH New implementation - 2001/12/15 BenH Add support for "byte" and "quick" - transfers. Add i2c_xfer routine. - - My understanding of the various modes supported by keywest are: - - - Dumb mode : not implemented, probably direct tweaking of lines - - Standard mode : simple i2c transaction of type - S Addr R/W A Data A Data ... T - - Standard sub mode : combined 8 bit subaddr write with data read - S Addr R/W A SubAddr A Data A Data ... T - - Combined mode : Subaddress and Data sequences appended with no stop - S Addr R/W A SubAddr S Addr R/W A Data A Data ... T - - Currently, this driver uses only Standard mode for i2c xfer, and - smbus byte & quick transfers ; and uses StandardSub mode for - other smbus transfers instead of combined as we need that for the - sound driver to be happy -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "i2c-keywest.h" - -#define DBG(x...) do {\ - if (debug > 0) \ - printk(KERN_DEBUG "KW:" x); \ - } while(0) - - -MODULE_AUTHOR("Benjamin Herrenschmidt "); -MODULE_DESCRIPTION("I2C driver for Apple's Keywest"); -MODULE_LICENSE("GPL"); -MODULE_PARM(debug, "i"); - -int debug = 0; - -static struct keywest_iface *ifaces = NULL; - - -static void -do_stop(struct keywest_iface* iface, int result) -{ - write_reg(reg_control, read_reg(reg_control) | KW_I2C_CTL_STOP); - iface->state = state_stop; - iface->result = result; -} - -/* Main state machine for standard & standard sub mode */ -static int -handle_interrupt(struct keywest_iface *iface, u8 isr) -{ - int ack; - int rearm_timer = 1; - - DBG("handle_interrupt(), got: %x, status: %x, state: %d\n", - isr, read_reg(reg_status), iface->state); - if (isr == 0 && iface->state != state_stop) { - do_stop(iface, -1); - return rearm_timer; - } - if (isr & KW_I2C_IRQ_STOP && iface->state != state_stop) { - iface->result = -1; - iface->state = state_stop; - } - switch(iface->state) { - case state_addr: - if (!(isr & KW_I2C_IRQ_ADDR)) { - do_stop(iface, -1); - break; - } - ack = read_reg(reg_status); - DBG("ack on set address: %x\n", ack); - if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { - do_stop(iface, -1); - break; - } - /* Handle rw "quick" mode */ - if (iface->datalen == 0) - do_stop(iface, 0); - else if (iface->read_write == I2C_SMBUS_READ) { - iface->state = state_read; - if (iface->datalen > 1) - write_reg(reg_control, read_reg(reg_control) - | KW_I2C_CTL_AAK); - } else { - iface->state = state_write; - DBG("write byte: %x\n", *(iface->data)); - write_reg(reg_data, *(iface->data++)); - iface->datalen--; - } - - break; - case state_read: - if (!(isr & KW_I2C_IRQ_DATA)) { - do_stop(iface, -1); - break; - } - *(iface->data++) = read_reg(reg_data); - DBG("read byte: %x\n", *(iface->data-1)); - iface->datalen--; - if (iface->datalen == 0) - iface->state = state_stop; - else - write_reg(reg_control, 0); - break; - case state_write: - if (!(isr & KW_I2C_IRQ_DATA)) { - do_stop(iface, -1); - break; - } - /* Check ack status */ - ack = read_reg(reg_status); - DBG("ack on data write: %x\n", ack); - if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { - do_stop(iface, -1); - break; - } - if (iface->datalen) { - DBG("write byte: %x\n", *(iface->data)); - write_reg(reg_data, *(iface->data++)); - iface->datalen--; - } else - do_stop(iface, 0); - break; - - case state_stop: - if (!(isr & KW_I2C_IRQ_STOP) && (++iface->stopretry) < 10) - do_stop(iface, -1); - else { - rearm_timer = 0; - iface->state = state_idle; - write_reg(reg_control, 0x00); - write_reg(reg_ier, 0x00); - complete(&iface->complete); - } - break; - } - - write_reg(reg_isr, isr); - - return rearm_timer; -} - -/* Interrupt handler */ -static void -keywest_irq(int irq, void *dev_id, struct pt_regs *regs) -{ - struct keywest_iface *iface = (struct keywest_iface *)dev_id; - - spin_lock(&iface->lock); - del_timer(&iface->timeout_timer); - if (handle_interrupt(iface, read_reg(reg_isr))) { - iface->timeout_timer.expires = jiffies + POLL_TIMEOUT; - add_timer(&iface->timeout_timer); - } - spin_unlock(&iface->lock); -} - -static void -keywest_timeout(unsigned long data) -{ - struct keywest_iface *iface = (struct keywest_iface *)data; - - DBG("timeout !\n"); - spin_lock_irq(&iface->lock); - if (iface->state != state_idle) { - iface->timeout_timer.expires = jiffies + POLL_TIMEOUT; - add_timer(&iface->timeout_timer); - } - spin_unlock(&iface->lock); -} - -/* - * SMBUS-type transfer entrypoint - */ -static s32 -keywest_smbus_xfer( struct i2c_adapter* adap, - u16 addr, - unsigned short flags, - char read_write, - u8 command, - int size, - union i2c_smbus_data* data) -{ - struct keywest_chan* chan = (struct keywest_chan*)adap->data; - struct keywest_iface* iface = chan->iface; - int len; - u8* buffer; - u16 cur_word; - int rc = 0; - - if (iface->state == state_dead) - return -1; - - /* Prepare datas & select mode */ - iface->cur_mode &= ~KW_I2C_MODE_MODE_MASK; - switch (size) { - case I2C_SMBUS_QUICK: - len = 0; - buffer = NULL; - iface->cur_mode |= KW_I2C_MODE_STANDARD; - break; - case I2C_SMBUS_BYTE: - len = 1; - buffer = &data->byte; - iface->cur_mode |= KW_I2C_MODE_STANDARD; - break; - case I2C_SMBUS_BYTE_DATA: - len = 1; - buffer = &data->byte; - iface->cur_mode |= KW_I2C_MODE_STANDARDSUB; - //iface->cur_mode |= KW_I2C_MODE_COMBINED; - break; - case I2C_SMBUS_WORD_DATA: - len = 2; - cur_word = cpu_to_le16(data->word); - buffer = (u8 *)&cur_word; - iface->cur_mode |= KW_I2C_MODE_STANDARDSUB; - //iface->cur_mode |= KW_I2C_MODE_COMBINED; - break; - case I2C_SMBUS_BLOCK_DATA: - len = data->block[0]; - buffer = &data->block[1]; - iface->cur_mode |= KW_I2C_MODE_STANDARDSUB; - //iface->cur_mode |= KW_I2C_MODE_COMBINED; - break; - default: - return -1; - } - - /* Original driver had this limitation */ - if (len > 32) - len = 32; - - down(&iface->sem); - - DBG("chan: %d, addr: 0x%x, transfer len: %d, read: %d\n", - chan->chan_no, addr, len, read_write == I2C_SMBUS_READ); - - iface->data = buffer; - iface->datalen = len; - iface->state = state_addr; - iface->result = 0; - iface->stopretry = 0; - iface->read_write = read_write; - - /* Setup channel & clear pending irqs */ - write_reg(reg_mode, iface->cur_mode | (chan->chan_no << 4)); - write_reg(reg_isr, read_reg(reg_isr)); - write_reg(reg_status, 0); - - /* Set up address and r/w bit */ - write_reg(reg_addr, - (addr << 1) | ((read_write == I2C_SMBUS_READ) ? 0x01 : 0x00)); - - /* Set up the sub address */ - if ((iface->cur_mode & KW_I2C_MODE_MODE_MASK) == KW_I2C_MODE_STANDARDSUB - || (iface->cur_mode & KW_I2C_MODE_MODE_MASK) == KW_I2C_MODE_COMBINED) - write_reg(reg_subaddr, command); - - /* Arm timeout */ - iface->timeout_timer.expires = jiffies + POLL_TIMEOUT; - add_timer(&iface->timeout_timer); - - /* Start sending address & enable interrupt*/ - write_reg(reg_control, read_reg(reg_control) | KW_I2C_CTL_XADDR); - write_reg(reg_ier, KW_I2C_IRQ_MASK); - - wait_for_completion(&iface->complete); - - rc = iface->result; - DBG("transfer done, result: %d\n", rc); - - if (rc == 0 && size == I2C_SMBUS_WORD_DATA && read_write == I2C_SMBUS_READ) - data->word = le16_to_cpu(cur_word); - - /* Release sem */ - up(&iface->sem); - - return rc; -} - -/* - * Generic i2c master transfer entrypoint - */ -static int -keywest_xfer( struct i2c_adapter *adap, - struct i2c_msg msgs[], - int num) -{ - struct keywest_chan* chan = (struct keywest_chan*)adap->data; - struct keywest_iface* iface = chan->iface; - struct i2c_msg *pmsg; - int i, completed; - int rc = 0; - - down(&iface->sem); - - /* Set adapter to standard mode */ - iface->cur_mode &= ~KW_I2C_MODE_MODE_MASK; - iface->cur_mode |= KW_I2C_MODE_STANDARD; - - completed = 0; - for (i = 0; rc >= 0 && i < num;) { - u8 addr; - - pmsg = &msgs[i++]; - addr = pmsg->addr; - if (pmsg->flags & I2C_M_TEN) { - printk(KERN_ERR "i2c-keywest: 10 bits addr not supported !\n"); - rc = -EINVAL; - break; - } - DBG("xfer: chan: %d, doing %s %d bytes to 0x%02x - %d of %d messages\n", - chan->chan_no, - pmsg->flags & I2C_M_RD ? "read" : "write", - pmsg->len, addr, i, num); - - /* Setup channel & clear pending irqs */ - write_reg(reg_mode, iface->cur_mode | (chan->chan_no << 4)); - write_reg(reg_isr, read_reg(reg_isr)); - write_reg(reg_status, 0); - - iface->data = pmsg->buf; - iface->datalen = pmsg->len; - iface->state = state_addr; - iface->result = 0; - iface->stopretry = 0; - if (pmsg->flags & I2C_M_RD) - iface->read_write = I2C_SMBUS_READ; - else - iface->read_write = I2C_SMBUS_WRITE; - - /* Set up address and r/w bit */ - if (pmsg->flags & I2C_M_REV_DIR_ADDR) - addr ^= 1; - write_reg(reg_addr, - (addr << 1) | - ((iface->read_write == I2C_SMBUS_READ) ? 0x01 : 0x00)); - - /* Arm timeout */ - iface->timeout_timer.expires = jiffies + POLL_TIMEOUT; - add_timer(&iface->timeout_timer); - - /* Start sending address & enable interrupt*/ - write_reg(reg_control, read_reg(reg_control) | KW_I2C_CTL_XADDR); - write_reg(reg_ier, KW_I2C_IRQ_MASK); - - wait_for_completion(&iface->complete); - - rc = iface->result; - if (rc == 0) - completed++; - DBG("transfer done, result: %d\n", rc); - } - - /* Release sem */ - up(&iface->sem); - - return completed; -} - -static u32 -keywest_func(struct i2c_adapter * adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA; -} - -static void -keywest_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void -keywest_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -/* For now, we only handle combined mode (smbus) */ -static struct i2c_algorithm keywest_algorithm = { - .name = "Keywest i2c", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = keywest_smbus_xfer, - .master_xfer = keywest_xfer, - .functionality = keywest_func, -}; - - -static int __init -create_iface(struct device_node* np) -{ - unsigned long steps, *psteps, *prate; - unsigned bsteps, tsize, i, nchan, addroffset; - struct keywest_iface* iface; - int error; - - psteps = (unsigned long *)get_property(np, "AAPL,address-step", NULL); - steps = psteps ? (*psteps) : 0x10; - - /* Hrm... maybe we can be smarter here */ - for (bsteps = 0; (steps & 0x01) == 0; bsteps++) - steps >>= 1; - - if (!strcmp(np->parent->name, "uni-n")) { - nchan = 2; - addroffset = 3; - } else { - addroffset = 0; - nchan = 1; - } - - tsize = sizeof(struct keywest_iface) + - (sizeof(struct keywest_chan) + 4) * nchan; - iface = kmalloc(tsize, GFP_KERNEL); - if (iface == NULL) { - printk(KERN_ERR "i2c-keywest: can't allocate inteface !\n"); - return -ENOMEM; - } - memset(iface, 0, tsize); - init_MUTEX(&iface->sem); - spin_lock_init(&iface->lock); - init_completion(&iface->complete); - iface->bsteps = bsteps; - iface->chan_count = nchan; - iface->state = state_idle; - iface->irq = np->intrs[0].line; - iface->channels = (struct keywest_chan *) - (((unsigned long)(iface + 1) + 3UL) & ~3UL); - iface->base = (unsigned long)ioremap(np->addrs[0].address + addroffset, - np->addrs[0].size); - if (iface->base == 0) { - printk(KERN_ERR "i2c-keywest: can't map inteface !\n"); - kfree(iface); - return -ENOMEM; - } - - init_timer(&iface->timeout_timer); - iface->timeout_timer.function = keywest_timeout; - iface->timeout_timer.data = (unsigned long)iface; - - /* Select interface rate */ - iface->cur_mode = KW_I2C_MODE_100KHZ; - prate = (unsigned long *)get_property(np, "AAPL,i2c-rate", NULL); - if (prate) switch(*prate) { - case 100: - iface->cur_mode = KW_I2C_MODE_100KHZ; - break; - case 50: - iface->cur_mode = KW_I2C_MODE_50KHZ; - break; - case 25: - iface->cur_mode = KW_I2C_MODE_25KHZ; - break; - default: - printk(KERN_WARNING "i2c-keywest: unknown rate %ldKhz, using 100KHz\n", - *prate); - } - - /* Select standard mode by default */ - iface->cur_mode |= KW_I2C_MODE_STANDARD; - - /* Write mode */ - write_reg(reg_mode, iface->cur_mode); - - /* Switch interrupts off & clear them*/ - write_reg(reg_ier, 0x00); - write_reg(reg_isr, KW_I2C_IRQ_MASK); - - /* Request chip interrupt */ - error = request_irq(iface->irq, keywest_irq, 0, "keywest i2c", iface); - if (error) { - printk(KERN_ERR "i2c-keywest: can't get IRQ %d !\n", iface->irq); - iounmap((void *)iface->base); - kfree(iface); - return -ENODEV; - } - - for (i=0; ichannels[i]; - - sprintf(chan->adapter.name, "%s %d", np->parent->name, i); - chan->iface = iface; - chan->chan_no = i; - chan->adapter.id = I2C_ALGO_SMBUS; - chan->adapter.algo = &keywest_algorithm; - chan->adapter.algo_data = NULL; - chan->adapter.inc_use = keywest_inc; - chan->adapter.dec_use = keywest_dec; - chan->adapter.client_register = NULL; - chan->adapter.client_unregister = NULL; - chan->adapter.data = chan; - - error = i2c_add_adapter(&chan->adapter); - if (error) { - printk("i2c-keywest.c: Adapter %s registration failed\n", - chan->adapter.name); - chan->adapter.data = NULL; - } - } - - printk(KERN_INFO "Found KeyWest i2c on \"%s\", %d channel%s, stepping: %d bits\n", - np->parent->name, nchan, nchan > 1 ? "s" : "", bsteps); - - iface->next = ifaces; - ifaces = iface; - return 0; -} - -static void __exit -dispose_iface(struct keywest_iface *iface) -{ - int i, error; - - ifaces = iface->next; - - /* Make sure we stop all activity */ - down(&iface->sem); - spin_lock_irq(&iface->lock); - while (iface->state != state_idle) { - spin_unlock_irq(&iface->lock); - set_task_state(current,TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ/10); - spin_lock_irq(&iface->lock); - } - iface->state = state_dead; - spin_unlock_irq(&iface->lock); - free_irq(iface->irq, iface); - up(&iface->sem); - - /* Release all channels */ - for (i=0; ichan_count; i++) { - struct keywest_chan* chan = &iface->channels[i]; - if (!chan->adapter.data) - continue; - i2c_del_adapter(&chan->adapter); - chan->adapter.data = NULL; - /* We aren't that prepared to deal with this... */ - if (error) - printk("i2c-keywest.c: i2c_del_adapter failed, that's bad !\n"); - } - iounmap((void *)iface->base); - kfree(iface); -} - -static int __init i2c_keywest_init(void) -{ - struct device_node *np; - int error = -ENODEV; - - np = find_compatible_devices("i2c", "keywest"); - while (np != 0) { - if (np->n_addrs >= 1 && np->n_intrs >= 1) - error = create_iface(np); - np = np->next; - } - if (ifaces) - error = 0; - return error; -} - -static void __exit i2c_keywest_exit(void) -{ - while(ifaces) - dispose_iface(ifaces); -} - -module_init(i2c_keywest_init); -module_exit(i2c_keywest_exit); diff --git a/kernel/busses/i2c-keywest.h b/kernel/busses/i2c-keywest.h deleted file mode 100644 index 906a6f12..00000000 --- a/kernel/busses/i2c-keywest.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef __I2C_KEYWEST_H__ -#define __I2C_KEYWEST_H__ - -#include - -/* The Tumbler audio equalizer can be really slow sometimes */ -#define POLL_TIMEOUT (2*HZ) - -/* Register indices */ -typedef enum { - reg_mode = 0, - reg_control, - reg_status, - reg_isr, - reg_ier, - reg_addr, - reg_subaddr, - reg_data -} reg_t; - - -/* Mode register */ -#define KW_I2C_MODE_100KHZ 0x00 -#define KW_I2C_MODE_50KHZ 0x01 -#define KW_I2C_MODE_25KHZ 0x02 -#define KW_I2C_MODE_DUMB 0x00 -#define KW_I2C_MODE_STANDARD 0x04 -#define KW_I2C_MODE_STANDARDSUB 0x08 -#define KW_I2C_MODE_COMBINED 0x0C -#define KW_I2C_MODE_MODE_MASK 0x0C -#define KW_I2C_MODE_CHAN_MASK 0xF0 - -/* Control register */ -#define KW_I2C_CTL_AAK 0x01 -#define KW_I2C_CTL_XADDR 0x02 -#define KW_I2C_CTL_STOP 0x04 -#define KW_I2C_CTL_START 0x08 - -/* Status register */ -#define KW_I2C_STAT_BUSY 0x01 -#define KW_I2C_STAT_LAST_AAK 0x02 -#define KW_I2C_STAT_LAST_RW 0x04 -#define KW_I2C_STAT_SDA 0x08 -#define KW_I2C_STAT_SCL 0x10 - -/* IER & ISR registers */ -#define KW_I2C_IRQ_DATA 0x01 -#define KW_I2C_IRQ_ADDR 0x02 -#define KW_I2C_IRQ_STOP 0x04 -#define KW_I2C_IRQ_START 0x08 -#define KW_I2C_IRQ_MASK 0x0F - -/* Physical interface */ -struct keywest_iface -{ - unsigned long base; - unsigned bsteps; - int irq; - struct semaphore sem; - spinlock_t lock; - struct keywest_chan* channels; - unsigned chan_count; - u8 cur_mode; - char read_write; - u8* data; - unsigned datalen; - int state; - int result; - int stopretry; - struct timer_list timeout_timer; - struct completion complete; - struct keywest_iface* next; -}; - -enum { - state_idle, - state_addr, - state_read, - state_write, - state_stop, - state_dead -}; - -/* Channel on an interface */ -struct keywest_chan -{ - struct i2c_adapter adapter; - struct keywest_iface* iface; - unsigned chan_no; -}; - -/* Register access */ - -static inline u8 __read_reg(struct keywest_iface *iface, reg_t reg) -{ - return in_8(((volatile u8 *)iface->base) - + (((unsigned)reg) << iface->bsteps)); -} - -static inline void __write_reg(struct keywest_iface *iface, reg_t reg, u8 val) -{ - out_8(((volatile u8 *)iface->base) - + (((unsigned)reg) << iface->bsteps), val); - (void)__read_reg(iface, reg); - udelay(10); -} - -#define write_reg(reg, val) __write_reg(iface, reg, val) -#define read_reg(reg) __read_reg(iface, reg) - - - -#endif /* __I2C_KEYWEST_H__ */ diff --git a/kernel/busses/i2c-nforce2.c b/kernel/busses/i2c-nforce2.c deleted file mode 100644 index b8ed6cf0..00000000 --- a/kernel/busses/i2c-nforce2.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - SMBus driver for nVidia nForce2 MCP - - Copyright (c) 2003 Hans-Frieder Vogt , - Based on - SMBus 2.0 driver for AMD-8111 IO-Hub - Copyright (c) 2002 Vojtech Pavlik - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - SUPPORTED DEVICES PCI ID - nForce2 MCP 0064 - nForce2 Ultra 400 MCP 0084 - nForce3 Pro150 MCP 00D4 - nForce3 250Gb MCP 00E4 - nForce4 MCP 0052 - nForce4 MCP-04 0034 - nForce4 MCP51 0264 - nForce4 MCP55 0368 - - This driver supports the 2 SMBuses that are included in the MCP of the - nForce2/3/4 chipsets. -*/ - -/* Note: we assume there can only be one nForce2, with two SMBus interfaces */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR ("Hans-Frieder Vogt "); -MODULE_DESCRIPTION("nForce2 SMBus driver"); - -#ifndef PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS -#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 -#endif - -#ifndef PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS -#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084 -#endif - -#ifndef PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS -#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00D4 -#endif - -#ifndef PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS -#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00E4 -#endif - -#ifndef PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS -#define PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS 0x0052 -#endif - -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS 0x0264 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS 0x0368 - - -struct nforce2_smbus { - struct i2c_adapter adapter; - int base; - int size; -}; - - -/* - * nVidia nForce2 SMBus control register definitions - * (Newer incarnations use standard BARs 4 and 5 instead) - */ -#define NFORCE_PCI_SMB1 0x50 -#define NFORCE_PCI_SMB2 0x54 - - -/* - * ACPI 2.0 chapter 13 SMBus 2.0 EC register model - */ -#define NVIDIA_SMB_PRTCL (smbus->base + 0x00) /* protocol, PEC */ -#define NVIDIA_SMB_STS (smbus->base + 0x01) /* status */ -#define NVIDIA_SMB_ADDR (smbus->base + 0x02) /* address */ -#define NVIDIA_SMB_CMD (smbus->base + 0x03) /* command */ -#define NVIDIA_SMB_DATA (smbus->base + 0x04) /* 32 data registers */ -#define NVIDIA_SMB_BCNT (smbus->base + 0x24) /* number of data bytes */ -#define NVIDIA_SMB_ALRM_A (smbus->base + 0x25) /* alarm address */ -#define NVIDIA_SMB_ALRM_D (smbus->base + 0x26) /* 2 bytes alarm data */ - -#define NVIDIA_SMB_STS_DONE 0x80 -#define NVIDIA_SMB_STS_ALRM 0x40 -#define NVIDIA_SMB_STS_RES 0x20 -#define NVIDIA_SMB_STS_STATUS 0x1f - -#define NVIDIA_SMB_PRTCL_WRITE 0x00 -#define NVIDIA_SMB_PRTCL_READ 0x01 -#define NVIDIA_SMB_PRTCL_QUICK 0x02 -#define NVIDIA_SMB_PRTCL_BYTE 0x04 -#define NVIDIA_SMB_PRTCL_BYTE_DATA 0x06 -#define NVIDIA_SMB_PRTCL_WORD_DATA 0x08 -#define NVIDIA_SMB_PRTCL_BLOCK_DATA 0x0a -#define NVIDIA_SMB_PRTCL_PROC_CALL 0x0c -#define NVIDIA_SMB_PRTCL_BLOCK_PROC_CALL 0x0d -#define NVIDIA_SMB_PRTCL_I2C_BLOCK_DATA 0x4a -#define NVIDIA_SMB_PRTCL_PEC 0x80 - -static struct pci_driver nforce2_driver; - -static s32 nforce2_access(struct i2c_adapter *adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, union i2c_smbus_data *data); -/* -static int nforce2_block_transaction(union i2c_smbus_data *data, - char read_write, int i2c_enable); - */ -static u32 nforce2_func(struct i2c_adapter *adapter); - - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = nforce2_access, - .functionality = nforce2_func, -}; - -/* Return -1 on error. See smbus.h for more information */ -s32 nforce2_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, - char read_write, u8 command, int size, - union i2c_smbus_data * data) -{ - struct nforce2_smbus *smbus = adap->algo_data; - unsigned char protocol, pec, temp; - unsigned char len = 0; /* to keep the compiler quiet */ - int i; - - protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ : NVIDIA_SMB_PRTCL_WRITE; - pec = (flags & I2C_CLIENT_PEC) ? NVIDIA_SMB_PRTCL_PEC : 0; - - switch (size) { - - case I2C_SMBUS_QUICK: - protocol |= NVIDIA_SMB_PRTCL_QUICK; - read_write = I2C_SMBUS_WRITE; - break; - - case I2C_SMBUS_BYTE: - if (read_write == I2C_SMBUS_WRITE) - outb_p(command, NVIDIA_SMB_CMD); - protocol |= NVIDIA_SMB_PRTCL_BYTE; - break; - - case I2C_SMBUS_BYTE_DATA: - outb_p(command, NVIDIA_SMB_CMD); - if (read_write == I2C_SMBUS_WRITE) - outb_p(data->byte, NVIDIA_SMB_DATA); - protocol |= NVIDIA_SMB_PRTCL_BYTE_DATA; - break; - - case I2C_SMBUS_WORD_DATA: - outb_p(command, NVIDIA_SMB_CMD); - if (read_write == I2C_SMBUS_WRITE) { - outb_p(data->word, NVIDIA_SMB_DATA); - outb_p(data->word >> 8, NVIDIA_SMB_DATA+1); - } - protocol |= NVIDIA_SMB_PRTCL_WORD_DATA | pec; - break; - - case I2C_SMBUS_BLOCK_DATA: - outb_p(command, NVIDIA_SMB_CMD); - if (read_write == I2C_SMBUS_WRITE) { - len = min_t(u8, data->block[0], 32); - outb_p(len, NVIDIA_SMB_BCNT); - for (i = 0; i < len; i++) - outb_p(data->block[i + 1], NVIDIA_SMB_DATA+i); - } - protocol |= NVIDIA_SMB_PRTCL_BLOCK_DATA | pec; - break; - - case I2C_SMBUS_I2C_BLOCK_DATA: - len = min_t(u8, data->block[0], 32); - outb_p(command, NVIDIA_SMB_CMD); - outb_p(len, NVIDIA_SMB_BCNT); - if (read_write == I2C_SMBUS_WRITE) - for (i = 0; i < len; i++) - outb_p(data->block[i + 1], NVIDIA_SMB_DATA+i); - protocol |= NVIDIA_SMB_PRTCL_I2C_BLOCK_DATA; - break; - - case I2C_SMBUS_PROC_CALL: - printk(KERN_WARNING "i2c-nforce2.o: I2C_SMBUS_PROC_CALL not supported!\n"); - return -1; - - case I2C_SMBUS_BLOCK_PROC_CALL: - printk(KERN_WARNING "i2c-nforce2.o: I2C_SMBUS_BLOCK_PROC_CALL not supported!\n"); - return -1; - - default: - printk(KERN_WARNING "i2c-nforce2.c: Unsupported transaction %d\n", size); - return -1; - } - - outb_p((addr & 0x7f) << 1, NVIDIA_SMB_ADDR); - outb_p(protocol, NVIDIA_SMB_PRTCL); - - temp = inb_p(NVIDIA_SMB_STS); - - if (~temp & NVIDIA_SMB_STS_DONE) { - udelay(500); - temp = inb_p(NVIDIA_SMB_STS); - } - if (~temp & NVIDIA_SMB_STS_DONE) { - i2c_delay(HZ/100); - temp = inb_p(NVIDIA_SMB_STS); - } - - if ((~temp & NVIDIA_SMB_STS_DONE) || (temp & NVIDIA_SMB_STS_STATUS)) { - printk(KERN_DEBUG "i2c-nforce2.o: SMBus Timeout! (0x%02x)\n", - temp); - return -1; - } - - if (read_write == I2C_SMBUS_WRITE) - return 0; - - switch (size) { - - case I2C_SMBUS_BYTE: - case I2C_SMBUS_BYTE_DATA: - data->byte = inb_p(NVIDIA_SMB_DATA); - break; - - case I2C_SMBUS_WORD_DATA: - /* case I2C_SMBUS_PROC_CALL: not supported */ - data->word = inb_p(NVIDIA_SMB_DATA) | (inb_p(NVIDIA_SMB_DATA+1) << 8); - break; - - case I2C_SMBUS_BLOCK_DATA: - /* case I2C_SMBUS_BLOCK_PROC_CALL: not supported */ - len = inb_p(NVIDIA_SMB_BCNT); - len = min_t(u8, len, 32); - case I2C_SMBUS_I2C_BLOCK_DATA: - for (i = 0; i < len; i++) - data->block[i+1] = inb_p(NVIDIA_SMB_DATA + i); - data->block[0] = len; - break; - } - - return 0; -} - - -u32 nforce2_func(struct i2c_adapter *adapter) -{ - /* other functionality might be possible, but is not tested */ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA /* | - I2C_FUNC_SMBUS_BLOCK_DATA */; -} - -static void nforce2_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void nforce2_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static struct pci_device_id nforce2_ids[] = { - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0 } -}; - - -static int __devinit nforce2_probe_smb(struct pci_dev *dev, int bar, - int alt_reg, struct nforce2_smbus *smbus, char *name) -{ - int error; - - smbus->base = pci_resource_start(dev, bar); - if (smbus->base) { - smbus->size = pci_resource_len(dev, bar); - } else { - /* Older incarnations of the device used non-standard BARs */ - u16 iobase; - - if (pci_read_config_word(dev, alt_reg, &iobase) - != PCIBIOS_SUCCESSFUL) { - printk(KERN_ERR "i2c-nforce2.o: Error reading PCI " - "config for %s\n", name); - return -1; - } - - smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; - smbus->size = 8; - } - - if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { - printk (KERN_ERR "i2c-nforce2.o: Error requesting region %02x .. %02X for %s\n", smbus->base, smbus->base+smbus->size-1, name); - return -1; - } - - sprintf(smbus->adapter.name, "SMBus nForce2 adapter at %04x", smbus->base); - smbus->adapter.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_NFORCE2; - smbus->adapter.algo = &smbus_algorithm; - smbus->adapter.algo_data = smbus; - smbus->adapter.inc_use = nforce2_inc; - smbus->adapter.dec_use = nforce2_dec; - - error = i2c_add_adapter(&smbus->adapter); - if (error) { - printk(KERN_WARNING "i2c-nforce2.o: Failed to register adapter.\n"); - release_region(smbus->base, smbus->size); - return -1; - } - printk(KERN_INFO "i2c-nforce2.o: nForce2 SMBus adapter at %#x\n", smbus->base); - return 0; -} - - -static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - struct nforce2_smbus *smbuses; - int res1, res2; - - /* we support 2 SMBus adapters */ - if (!(smbuses = kmalloc(2*sizeof(struct nforce2_smbus), GFP_KERNEL))) - return -ENOMEM; - memset (smbuses, 0, 2*sizeof(struct nforce2_smbus)); - pci_set_drvdata(dev, smbuses); - - /* SMBus adapter 1 */ - res1 = nforce2_probe_smb(dev, 4, NFORCE_PCI_SMB1, &smbuses[0], "SMB1"); - if (res1 < 0) { - printk (KERN_ERR "i2c-nforce2.o: Error probing SMB1.\n"); - smbuses[0].base = 0; /* to have a check value */ - } - /* SMBus adapter 2 */ - res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2"); - if (res2 < 0) { - printk (KERN_ERR "i2c-nforce2.o: Error probing SMB2.\n"); - smbuses[1].base = 0; /* to have a check value */ - } - if ((res1 < 0) && (res2 < 0)) { - /* we did not find even one of the SMBuses, so we give up */ - kfree(smbuses); - return -ENODEV; - } - - return 0; -} - - -static void __devexit nforce2_remove(struct pci_dev *dev) -{ - struct nforce2_smbus *smbuses = (void*) pci_get_drvdata(dev); - - if (smbuses[0].base) { - i2c_del_adapter(&smbuses[0].adapter); - release_region(smbuses[0].base, smbuses[0].size); - } - if (smbuses[1].base) { - i2c_del_adapter(&smbuses[1].adapter); - release_region(smbuses[1].base, smbuses[1].size); - } - kfree(smbuses); -} - -static struct pci_driver nforce2_driver = { - .name = "nForce2 SMBus", - .id_table = nforce2_ids, - .probe = nforce2_probe, - .remove = __devexit_p(nforce2_remove), -}; - -int __init nforce2_init(void) -{ - printk(KERN_INFO "i2c-nforce2.o version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&nforce2_driver); -} - -void __exit nforce2_exit(void) -{ - pci_unregister_driver(&nforce2_driver); -} - -module_init(nforce2_init); -module_exit(nforce2_exit); - diff --git a/kernel/busses/i2c-piix4.c b/kernel/busses/i2c-piix4.c deleted file mode 100644 index 94a4c301..00000000 --- a/kernel/busses/i2c-piix4.c +++ /dev/null @@ -1,584 +0,0 @@ -/* - piix4.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998 - 2002 Frodo Looijaard and - Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - Supports: - Intel PIIX4, 440MX - Serverworks OSB4, CSB5, CSB6, HT-1000 - ATI IXP200, IXP300, IXP400, SB600 - SMSC Victory66 - - Note: we assume there can only be one device, with one SMBus interface. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - - -struct sd { - const unsigned short mfr; - const unsigned short dev; - const unsigned char fn; - const char *name; -}; - -/* PIIX4 SMBus address offsets */ -#define SMBHSTSTS (0 + piix4_smba) -#define SMBHSLVSTS (1 + piix4_smba) -#define SMBHSTCNT (2 + piix4_smba) -#define SMBHSTCMD (3 + piix4_smba) -#define SMBHSTADD (4 + piix4_smba) -#define SMBHSTDAT0 (5 + piix4_smba) -#define SMBHSTDAT1 (6 + piix4_smba) -#define SMBBLKDAT (7 + piix4_smba) -#define SMBSLVCNT (8 + piix4_smba) -#define SMBSHDWCMD (9 + piix4_smba) -#define SMBSLVEVT (0xA + piix4_smba) -#define SMBSLVDAT (0xC + piix4_smba) - -/* count for request_region */ -#define SMBIOSIZE 8 - -/* PCI Address Constants */ -#define SMBBA 0x090 -#define SMBHSTCFG 0x0D2 -#define SMBSLVC 0x0D3 -#define SMBSHDW1 0x0D4 -#define SMBSHDW2 0x0D5 -#define SMBREV 0x0D6 - -/* Other settings */ -#define MAX_TIMEOUT 500 -#define ENABLE_INT9 0 - -/* PIIX4 constants */ -#define PIIX4_QUICK 0x00 -#define PIIX4_BYTE 0x04 -#define PIIX4_BYTE_DATA 0x08 -#define PIIX4_WORD_DATA 0x0C -#define PIIX4_BLOCK_DATA 0x14 - -/* insmod parameters */ - -/* If force is set to anything different from 0, we forcibly enable the - PIIX4. DANGEROUS! */ -static int force = 0; -MODULE_PARM(force, "i"); -MODULE_PARM_DESC(force, "Forcibly enable the PIIX4. DANGEROUS!"); - -/* If force_addr is set to anything different from 0, we forcibly enable - the PIIX4 at the given address. VERY DANGEROUS! */ -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Forcibly enable the PIIX4 at the given address. " - "EXTREMELY DANGEROUS!"); - -static int piix4_transaction(void); - -static unsigned short piix4_smba = 0; -static struct pci_driver piix4_driver; - -#ifdef CONFIG_X86 -/* - * Get DMI information. - */ - -static int __devinit ibm_dmi_probe(void) -{ - extern int is_unsafe_smbus; - return is_unsafe_smbus; -} -#endif - -/* Detect whether a PIIX4 can be found, and initialize it, where necessary. - Note the differences between kernels with the old PCI BIOS interface and - newer kernels with the real PCI interface. In compat.h some things are - defined to make the transition easier. */ -static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, - const struct pci_device_id *id) -{ - unsigned char temp; - - /* match up the function */ - if (PCI_FUNC(PIIX4_dev->devfn) != id->driver_data) - return -ENODEV; - - printk(KERN_INFO "Found %s device\n", PIIX4_dev->name); - -#ifdef CONFIG_X86 - if(ibm_dmi_probe() && PIIX4_dev->vendor == PCI_VENDOR_ID_INTEL) { - printk(KERN_ERR "i2c-piix4.o: IBM system detected; this module " - "may corrupt your serial eeprom! Refusing to load " - "module!\n"); - return -EPERM; - } -#endif - - /* Determine the address of the SMBus areas */ - if (force_addr) { - piix4_smba = force_addr & 0xfff0; - force = 0; - } else { - pci_read_config_word(PIIX4_dev, SMBBA, &piix4_smba); - piix4_smba &= 0xfff0; - if(piix4_smba == 0) { - printk(KERN_ERR "i2c-piix4.o: SMB base address " - "uninitialized - upgrade BIOS or use " - "force_addr=0xaddr\n"); - return -ENODEV; - } - } - - if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) { - printk(KERN_ERR "i2c-piix4.o: SMB region 0x%x already in " - "use!\n", piix4_smba); - return -ENODEV; - } - - pci_read_config_byte(PIIX4_dev, SMBHSTCFG, &temp); - - /* If force_addr is set, we program the new address here. Just to make - sure, we disable the PIIX4 first. */ - if (force_addr) { - pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp & 0xfe); - pci_write_config_word(PIIX4_dev, SMBBA, piix4_smba); - pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp | 0x01); - printk(KERN_INFO "i2c-piix4.o: WARNING: SMBus interface set to " - "new address %04x!\n", piix4_smba); - } else if ((temp & 1) == 0) { - if (force) { - /* This should never need to be done, but has been - * noted that many Dell machines have the SMBus - * interface on the PIIX4 disabled!? NOTE: This assumes - * I/O space and other allocations WERE done by the - * Bios! Don't complain if your hardware does weird - * things after enabling this. :') Check for Bios - * updates before resorting to this. - */ - pci_write_config_byte(PIIX4_dev, SMBHSTCFG, - temp | 1); - printk(KERN_NOTICE "i2c-piix4.o: WARNING: SMBus " - "interface has been FORCEFULLY ENABLED!\n"); - } else { - printk(KERN_ERR "i2c-piix4.o: Host SMBus controller " - "not enabled!\n"); - release_region(piix4_smba, SMBIOSIZE); - piix4_smba = 0; - return -ENODEV; - } - } - -#ifdef DEBUG - if (((temp & 0x0E) == 8) || ((temp & 0x0E) == 2)) - printk(KERN_DEBUG "i2c-piix4.o: Using Interrupt 9 for " - "SMBus.\n"); - else if ((temp & 0x0E) == 0) - printk(KERN_DEBUG "i2c-piix4.o: Using Interrupt SMI# " - "for SMBus.\n"); - else - printk(KERN_ERR "i2c-piix4.o: Illegal Interrupt configuration " - "(or code out of date)!\n"); - - pci_read_config_byte(PIIX4_dev, SMBREV, &temp); - printk(KERN_DEBUG "i2c-piix4.o: SMBREV = 0x%X\n", temp); - printk(KERN_DEBUG "i2c-piix4.o: SMBA = 0x%X\n", piix4_smba); -#endif /* DEBUG */ - - return 0; -} - - -/* Another internally used function */ -int piix4_transaction(void) -{ - int temp; - int result = 0; - int timeout = 0; - -#ifdef DEBUG - printk - (KERN_DEBUG "i2c-piix4.o: Transaction (pre): CNT=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, " - "DAT1=%02x\n", inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), - inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1)); -#endif - - /* Make sure the SMBus host is ready to start transmitting */ - if ((temp = inb_p(SMBHSTSTS)) != 0x00) { -#ifdef DEBUG - printk(KERN_DEBUG "i2c-piix4.o: SMBus busy (%02x). Resetting...\n", - temp); -#endif - outb_p(temp, SMBHSTSTS); - if ((temp = inb_p(SMBHSTSTS)) != 0x00) { -#ifdef DEBUG - printk(KERN_ERR "i2c-piix4.o: Failed! (%02x)\n", temp); -#endif - return -1; - } else { -#ifdef DEBUG - printk(KERN_DEBUG "i2c-piix4.o: Successful!\n"); -#endif - } - } - - /* start the transaction by setting bit 6 */ - outb_p(inb(SMBHSTCNT) | 0x040, SMBHSTCNT); - - /* We will always wait for a fraction of a second! (See PIIX4 docs errata) */ - do { - i2c_delay(1); - temp = inb_p(SMBHSTSTS); - } while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT)); - -#ifdef DEBUG - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { - printk(KERN_ERR "i2c-piix4.o: SMBus Timeout!\n"); - result = -1; - } -#endif - - if (temp & 0x10) { - result = -1; -#ifdef DEBUG - printk(KERN_ERR "i2c-piix4.o: Error: Failed bus transaction\n"); -#endif - } - - if (temp & 0x08) { - result = -1; - printk - (KERN_ERR "i2c-piix4.o: Bus collision! SMBus may be locked until next hard\n" - "reset. (sorry!)\n"); - /* Clock stops and slave is stuck in mid-transmission */ - } - - if (temp & 0x04) { - result = -1; -#ifdef DEBUG - printk(KERN_ERR "i2c-piix4.o: Error: no response!\n"); -#endif - } - - if (inb_p(SMBHSTSTS) != 0x00) - outb_p(inb(SMBHSTSTS), SMBHSTSTS); - -#ifdef DEBUG - if ((temp = inb_p(SMBHSTSTS)) != 0x00) { - printk - (KERN_ERR "i2c-piix4.o: Failed reset at end of transaction (%02x)\n", - temp); - } - printk - (KERN_DEBUG "i2c-piix4.o: Transaction (post): CNT=%02x, CMD=%02x, ADD=%02x, " - "DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), - inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1)); -#endif - return result; -} - -/* Return -1 on error. */ -s32 piix4_access(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, union i2c_smbus_data * data) -{ - int i, len; - - switch (size) { - case I2C_SMBUS_QUICK: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - size = PIIX4_QUICK; - break; - case I2C_SMBUS_BYTE: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - if (read_write == I2C_SMBUS_WRITE) - outb_p(command, SMBHSTCMD); - size = PIIX4_BYTE; - break; - case I2C_SMBUS_BYTE_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) - outb_p(data->byte, SMBHSTDAT0); - size = PIIX4_BYTE_DATA; - break; - case I2C_SMBUS_WORD_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) { - outb_p(data->word & 0xff, SMBHSTDAT0); - outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); - } - size = PIIX4_WORD_DATA; - break; - case I2C_SMBUS_BLOCK_DATA: - outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), - SMBHSTADD); - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) { - len = data->block[0]; - if (len < 0) - len = 0; - if (len > 32) - len = 32; - outb_p(len, SMBHSTDAT0); - i = inb_p(SMBHSTCNT); /* Reset SMBBLKDAT */ - for (i = 1; i <= len; i++) - outb_p(data->block[i], SMBBLKDAT); - } - size = PIIX4_BLOCK_DATA; - break; - default: - printk - (KERN_WARNING "i2c-piix4.o: Unsupported transaction %d\n", size); - return -1; - } - - outb_p((size & 0x1C) + (ENABLE_INT9 & 1), SMBHSTCNT); - - if (piix4_transaction()) /* Error in transaction */ - return -1; - - if ((read_write == I2C_SMBUS_WRITE) || (size == PIIX4_QUICK)) - return 0; - - - switch (size) { - case PIIX4_BYTE: /* Where is the result put? I assume here it is in - SMBHSTDAT0 but it might just as well be in the - SMBHSTCMD. No clue in the docs */ - - data->byte = inb_p(SMBHSTDAT0); - break; - case PIIX4_BYTE_DATA: - data->byte = inb_p(SMBHSTDAT0); - break; - case PIIX4_WORD_DATA: - data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); - break; - case PIIX4_BLOCK_DATA: - data->block[0] = inb_p(SMBHSTDAT0); - i = inb_p(SMBHSTCNT); /* Reset SMBBLKDAT */ - for (i = 1; i <= data->block[0]; i++) - data->block[i] = inb_p(SMBBLKDAT); - break; - } - return 0; -} - -static void piix4_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void piix4_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -u32 piix4_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA; -} - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = piix4_access, - .functionality = piix4_func, -}; - -static struct i2c_adapter piix4_adapter = { - .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_PIIX4, - .algo = &smbus_algorithm, - .inc_use = piix4_inc, - .dec_use = piix4_dec, -}; - -#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353 -#define PCI_DEVICE_ID_ATI_IXP300_SMBUS 0x4363 -#define PCI_DEVICE_ID_ATI_IXP400_SMBUS 0x4372 -#define PCI_DEVICE_ID_ATI_IXP600_SMBUS 0x4385 - -#ifndef PCI_DEVICE_ID_SERVERWORKS_CSB6 -#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 -#endif - -#define PCI_DEVICE_ID_SERVERWORKS_HT1000SB 0x0205 - -static struct pci_device_id piix4_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82371AB_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 3 - }, - { - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_IXP200_SMBUS, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 0, - }, - { - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_IXP300_SMBUS, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 0, - }, - { - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_IXP400_SMBUS, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 0, - }, - { - .vendor = PCI_VENDOR_ID_ATI, - .device = PCI_DEVICE_ID_ATI_IXP600_SMBUS, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 0, - }, - { - .vendor = PCI_VENDOR_ID_SERVERWORKS, - .device = PCI_DEVICE_ID_SERVERWORKS_OSB4, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 0, - }, - { - .vendor = PCI_VENDOR_ID_SERVERWORKS, - .device = PCI_DEVICE_ID_SERVERWORKS_CSB5, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 0, - }, - { - .vendor = PCI_VENDOR_ID_SERVERWORKS, - .device = PCI_DEVICE_ID_SERVERWORKS_CSB6, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 0, - }, - { - .vendor = PCI_VENDOR_ID_SERVERWORKS, - .device = PCI_DEVICE_ID_SERVERWORKS_HT1000SB, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 0, - }, - { - .vendor = PCI_VENDOR_ID_INTEL, - .device = PCI_DEVICE_ID_INTEL_82443MX_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 3, - }, - { - .vendor = PCI_VENDOR_ID_EFAR, - .device = PCI_DEVICE_ID_EFAR_SLC90E66_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = 0, - }, - { 0, } -}; - -static int __devinit piix4_probe(struct pci_dev *dev, - const struct pci_device_id *id) -{ - int retval; - - retval = piix4_setup(dev, id); - if (retval) - return retval; - - sprintf(piix4_adapter.name, "SMBus PIIX4 adapter at %04x", - piix4_smba); - - if ((retval = i2c_add_adapter(&piix4_adapter))) { - printk(KERN_ERR "i2c-piix4.o: Couldn't register adapter!\n"); - release_region(piix4_smba, SMBIOSIZE); - piix4_smba = 0; - } - - return retval; -} - -static void __devexit piix4_remove(struct pci_dev *dev) -{ - if (piix4_smba) { - i2c_del_adapter(&piix4_adapter); - release_region(piix4_smba, SMBIOSIZE); - piix4_smba = 0; - } -} - -static struct pci_driver piix4_driver = { - .name = "piix4 smbus", - .id_table = piix4_ids, - .probe = piix4_probe, - .remove = __devexit_p(piix4_remove), -}; - -static int __init i2c_piix4_init(void) -{ - printk("i2c-piix4.o version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&piix4_driver); -} - -static void __exit i2c_piix4_exit(void) -{ - pci_unregister_driver(&piix4_driver); -} - -MODULE_AUTHOR("Frodo Looijaard and " - "Philip Edelbrock "); -MODULE_DESCRIPTION("PIIX4 SMBus driver"); -MODULE_LICENSE("GPL"); - -module_init(i2c_piix4_init); -module_exit(i2c_piix4_exit); diff --git a/kernel/busses/i2c-savage4.c b/kernel/busses/i2c-savage4.c deleted file mode 100644 index b34239f0..00000000 --- a/kernel/busses/i2c-savage4.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - i2c-savage4.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (C) 1998-2003 The LM Sensors Team - Alexander Wold - Mark D. Studebaker - - Based on i2c-voodoo3.c. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* This interfaces to the I2C bus of the Savage4 to gain access to - the BT869 and possibly other I2C devices. The DDC bus is not - yet supported because its register is not memory-mapped. - However we leave the DDC code here, commented out, to make - it easier to add later. -*/ - -#include -#include -#include -#include -#include -#include -#include /* for HZ */ -#include "version.h" -#include "sensors_compat.h" - -/* 3DFX defines */ -/* #define PCI_VENDOR_ID_S3 0x5333 */ -#define PCI_CHIP_SAVAGE3D 0x8A20 -#define PCI_CHIP_SAVAGE3D_MV 0x8A21 -#define PCI_CHIP_SAVAGE4 0x8A22 -#define PCI_CHIP_SAVAGE2000 0x9102 -#define PCI_CHIP_PROSAVAGE_PM 0x8A25 -#define PCI_CHIP_PROSAVAGE_KM 0x8A26 -#define PCI_CHIP_SAVAGE_MX_MV 0x8c10 -#define PCI_CHIP_SAVAGE_MX 0x8c11 -#define PCI_CHIP_SAVAGE_IX_MV 0x8c12 -#define PCI_CHIP_SAVAGE_IX 0x8c13 - -#define REG 0xff20 /* Serial Port 1 Register */ - -/* bit locations in the register */ -//#define DDC_ENAB 0x00040000 -//#define DDC_SCL_OUT 0x00080000 -//#define DDC_SDA_OUT 0x00100000 -//#define DDC_SCL_IN 0x00200000 -//#define DDC_SDA_IN 0x00400000 -#define I2C_ENAB 0x00000020 -#define I2C_SCL_OUT 0x00000001 -#define I2C_SDA_OUT 0x00000002 -#define I2C_SCL_IN 0x00000008 -#define I2C_SDA_IN 0x00000010 - -/* initialization states */ -#define INIT2 0x20 -/* #define INIT3 0x4 */ - -/* delays */ -#define CYCLE_DELAY 10 -#define TIMEOUT (HZ / 2) - - -static void config_s4(struct pci_dev *dev); - -static unsigned long ioaddr; - -/* The sav GPIO registers don't have individual masks for each bit - so we always have to read before writing. */ - -static void bit_savi2c_setscl(void *data, int val) -{ - unsigned int r; - r = readl(ioaddr + REG); - if(val) - r |= I2C_SCL_OUT; - else - r &= ~I2C_SCL_OUT; - writel(r, ioaddr + REG); - readl(ioaddr + REG); /* flush posted write */ -} - -static void bit_savi2c_setsda(void *data, int val) -{ - unsigned int r; - r = readl(ioaddr + REG); - if(val) - r |= I2C_SDA_OUT; - else - r &= ~I2C_SDA_OUT; - writel(r, ioaddr + REG); - readl(ioaddr + REG); /* flush posted write */ -} - -/* The GPIO pins are open drain, so the pins always remain outputs. - We rely on the i2c-algo-bit routines to set the pins high before - reading the input from other chips. */ - -static int bit_savi2c_getscl(void *data) -{ - return (0 != (readl(ioaddr + REG) & I2C_SCL_IN)); -} - -static int bit_savi2c_getsda(void *data) -{ - return (0 != (readl(ioaddr + REG) & I2C_SDA_IN)); -} - -/* Configures the chip */ - -void config_s4(struct pci_dev *dev) -{ - unsigned int cadr; - - /* map memory */ - cadr = dev->resource[0].start; - cadr &= PCI_BASE_ADDRESS_MEM_MASK; - ioaddr = (unsigned long)ioremap_nocache(cadr, 0x0080000); - if(ioaddr) { -// writel(0x8160, ioaddr + REG2); - writel(0x00000020, ioaddr + REG); - printk("i2c-savage4: Using Savage4 at 0x%lx\n", ioaddr); - } -} - -static void savage4_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void savage4_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static struct i2c_algo_bit_data sav_i2c_bit_data = { - .setsda = bit_savi2c_setsda, - .setscl = bit_savi2c_setscl, - .getsda = bit_savi2c_getsda, - .getscl = bit_savi2c_getscl, - .udelay = CYCLE_DELAY, - .mdelay = CYCLE_DELAY, - .timeout = TIMEOUT -}; - -static struct i2c_adapter savage4_i2c_adapter = { - .name = "I2C Savage4 adapter", - .id = I2C_HW_B_SAVG, - .algo_data = &sav_i2c_bit_data, - .inc_use = savage4_inc, - .dec_use = savage4_dec, -}; - -static struct pci_device_id savage4_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_S3, - .device = PCI_CHIP_SAVAGE4, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_S3, - .device = PCI_CHIP_SAVAGE2000, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit savage4_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - config_s4(dev); - return i2c_bit_add_bus(&savage4_i2c_adapter); -} - -static void __devexit savage4_remove(struct pci_dev *dev) -{ - i2c_bit_del_bus(&savage4_i2c_adapter); -} - - -/* Don't register driver to avoid driver conflicts */ -/* -static struct pci_driver savage4_driver = { - .name = "savage4 smbus", - .id_table = savage4_ids, - .probe = savage4_probe, - .remove = __devexit_p(savage4_remove), -}; -*/ - -static int __init i2c_savage4_init(void) -{ - struct pci_dev *dev; - const struct pci_device_id *id; - - printk("i2c-savage4.o version %s (%s)\n", LM_VERSION, LM_DATE); -/* - return pci_module_init(&savage4_driver); -*/ - pci_for_each_dev(dev) { - id = pci_match_device(savage4_ids, dev); - if(id) - if(savage4_probe(dev, id) >= 0) - return 0; - } - return -ENODEV; -} - -static void __exit i2c_savage4_exit(void) -{ -/* - pci_unregister_driver(&savage4_driver); -*/ - savage4_remove(NULL); - iounmap((void *)ioaddr); -} - -MODULE_AUTHOR("Alexander Wold " - "and Mark D. Studebaker "); -MODULE_DESCRIPTION("Savage4 I2C/SMBus driver"); -MODULE_LICENSE("GPL"); - -module_init(i2c_savage4_init); -module_exit(i2c_savage4_exit); diff --git a/kernel/busses/i2c-sis5595.c b/kernel/busses/i2c-sis5595.c deleted file mode 100644 index e0c8b6ce..00000000 --- a/kernel/busses/i2c-sis5595.c +++ /dev/null @@ -1,495 +0,0 @@ -/* - sis5595.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard and - Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* Note: we assume there can only be one SIS5595 with one SMBus interface */ - -/* - Note: all have mfr. ID 0x1039. - SUPPORTED PCI ID - 5595 0008 - - Note: these chips contain a 0008 device which is incompatible with the - 5595. We recognize these by the presence of the listed - "blacklist" PCI ID and refuse to load. - - NOT SUPPORTED PCI ID BLACKLIST PCI ID - 540 0008 0540 - 550 0008 0550 - 5513 0008 5511 - 5581 0008 5597 - 5582 0008 5597 - 5597 0008 5597 - 5598 0008 5597/5598 - 630 0008 0630 - 645 0008 0645 - 646 0008 0646 - 648 0008 0648 - 650 0008 0650 - 651 0008 0651 - 730 0008 0730 - 735 0008 0735 - 745 0008 0745 - 746 0008 0746 -*/ - -/* TO DO: - * Add Block Transfers (ugly, but supported by the adapter) - * Add adapter resets - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - -MODULE_LICENSE("GPL"); - -static int blacklist[] = { - PCI_DEVICE_ID_SI_540, - PCI_DEVICE_ID_SI_550, - PCI_DEVICE_ID_SI_630, - PCI_DEVICE_ID_SI_730, - PCI_DEVICE_ID_SI_5511, /* 5513 chip has the 0008 device but - that ID shows up in other chips so we - use the 5511 ID for recognition */ - PCI_DEVICE_ID_SI_5597, - PCI_DEVICE_ID_SI_5598, - 0x645, - 0x646, - 0x648, - 0x650, - 0x651, - 0x735, - 0x745, - 0x746, - 0 }; - -/* Length of ISA address segment */ -#define SIS5595_EXTENT 8 -/* SIS5595 SMBus registers */ -#define SMB_STS_LO 0x00 -#define SMB_STS_HI 0x01 -#define SMB_CTL_LO 0x02 -#define SMB_CTL_HI 0x03 -#define SMB_ADDR 0x04 -#define SMB_CMD 0x05 -#define SMB_PCNT 0x06 -#define SMB_CNT 0x07 -#define SMB_BYTE 0x08 -#define SMB_DEV 0x10 -#define SMB_DB0 0x11 -#define SMB_DB1 0x12 -#define SMB_HAA 0x13 - -/* PCI Address Constants */ -#define SMB_INDEX 0x38 -#define SMB_DAT 0x39 -#define SIS5595_ENABLE_REG 0x40 -#define ACPI_BASE 0x90 - -/* Other settings */ -#define MAX_TIMEOUT 500 - -/* SIS5595 constants */ -#define SIS5595_QUICK 0x00 -#define SIS5595_BYTE 0x02 -#define SIS5595_BYTE_DATA 0x04 -#define SIS5595_WORD_DATA 0x06 -#define SIS5595_PROC_CALL 0x08 -#define SIS5595_BLOCK_DATA 0x0A - -/* insmod parameters */ - -/* If force_addr is set to anything different from 0, we forcibly enable - the device at the given address. */ -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Initialize the base address of the i2c controller"); - -static int sis5595_transaction(void); - -static struct pci_driver sis5595_driver; -static unsigned short sis5595_base = 0; - -static u8 sis5595_read(u8 reg) -{ - outb(reg, sis5595_base + SMB_INDEX); - return inb(sis5595_base + SMB_DAT); -} - -static void sis5595_write(u8 reg, u8 data) -{ - outb(reg, sis5595_base + SMB_INDEX); - outb(data, sis5595_base + SMB_DAT); -} - - -/* Detect whether a SIS5595 can be found, and initialize it, where necessary. - Note the differences between kernels with the old PCI BIOS interface and - newer kernels with the real PCI interface. In compat.h some things are - defined to make the transition easier. */ -int sis5595_setup(struct pci_dev *SIS5595_dev) -{ - u16 a; - u8 val; - int *i; - - /* Look for imposters */ - for(i = blacklist; *i != 0; i++) { - if (pci_find_device(PCI_VENDOR_ID_SI, *i, NULL)) { - printk("i2c-sis5595.o: Error: Looked for SIS5595 but found unsupported device %.4X\n", *i); - return -ENODEV; - } - } - -/* Determine the address of the SMBus areas */ - pci_read_config_word(SIS5595_dev, ACPI_BASE, &sis5595_base); - if(sis5595_base == 0 && force_addr == 0) { - printk("i2c-sis5595.o: ACPI base address uninitialized - upgrade BIOS or use force_addr=0xaddr\n"); - return -ENODEV; - } - - if(force_addr) - sis5595_base = force_addr & ~(SIS5595_EXTENT - 1); -#ifdef DEBUG - printk("ACPI Base address: %04x\n", sis5595_base); -#endif - /* NB: We grab just the two SMBus registers here, but this may still - * interfere with ACPI :-( */ - if (check_region(sis5595_base + SMB_INDEX, 2)) { - printk - ("i2c-sis5595.o: SMBus registers 0x%04x-0x%04x already in use!\n", - sis5595_base + SMB_INDEX, - sis5595_base + SMB_INDEX + 1); - return -ENODEV; - } - - if(force_addr) { - printk("i2c-sis5595.o: forcing ISA address 0x%04X\n", sis5595_base); - if (PCIBIOS_SUCCESSFUL != - pci_write_config_word(SIS5595_dev, ACPI_BASE, sis5595_base)) - return -ENODEV; - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(SIS5595_dev, ACPI_BASE, &a)) - return -ENODEV; - if ((a & ~(SIS5595_EXTENT - 1)) != sis5595_base) { - /* doesn't work for some chips! */ - printk("i2c-sis5595.o: force address failed - not supported?\n"); - return -ENODEV; - } - } - - if (PCIBIOS_SUCCESSFUL != - pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val)) - return -ENODEV; - if((val & 0x80) == 0) { - printk("sis5595.o: enabling ACPI\n"); - if (PCIBIOS_SUCCESSFUL != - pci_write_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, - val | 0x80)) - return -ENODEV; - if (PCIBIOS_SUCCESSFUL != - pci_read_config_byte(SIS5595_dev, SIS5595_ENABLE_REG, &val)) - return -ENODEV; - if((val & 0x80) == 0) { /* doesn't work for some chips? */ - printk("sis5595.o: ACPI enable failed - not supported?\n"); - return -ENODEV; - } - } - - /* Everything is happy, let's grab the memory and set things up. */ - request_region(sis5595_base + SMB_INDEX, 2, sis5595_driver.name); - return(0); -} - - -/* Another internally used function */ -int sis5595_transaction(void) -{ - int temp; - int result = 0; - int timeout = 0; - - /* Make sure the SMBus host is ready to start transmitting */ - if ( - (temp = - sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8)) != - 0x00) { -#ifdef DEBUG - printk("i2c-sis5595.o: SMBus busy (%04x). Resetting...\n", - temp); -#endif - sis5595_write(SMB_STS_LO, temp & 0xff); - sis5595_write(SMB_STS_HI, temp >> 8); - if ( - (temp = - sis5595_read(SMB_STS_LO) + - (sis5595_read(SMB_STS_HI) << 8)) != 0x00) { -#ifdef DEBUG - printk("i2c-sis5595.o: Failed! (%02x)\n", temp); -#endif - return -1; - } else { -#ifdef DEBUG - printk("i2c-sis5595.o: Successful!\n"); -#endif - } - } - - /* start the transaction by setting bit 4 */ - sis5595_write(SMB_CTL_LO, sis5595_read(SMB_CTL_LO) | 0x10); - - /* We will always wait for a fraction of a second! */ - do { - i2c_delay(1); - temp = sis5595_read(SMB_STS_LO); - } while (!(temp & 0x40) && (timeout++ < MAX_TIMEOUT)); - - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { -#ifdef DEBUG - printk("i2c-sis5595.o: SMBus Timeout!\n"); -#endif - result = -1; - } - - if (temp & 0x10) { - result = -1; -#ifdef DEBUG - printk("i2c-sis5595.o: Error: Failed bus transaction\n"); -#endif - } - - if (temp & 0x20) { - result = -1; - printk - ("i2c-sis5595.o: Bus collision! SMBus may be locked until next hard\n" - "reset (or not...)\n"); - /* Clock stops and slave is stuck in mid-transmission */ - } - - if ( - (temp = - sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8)) != - 0x00) { - sis5595_write(SMB_STS_LO, temp & 0xff); - sis5595_write(SMB_STS_HI, temp >> 8); - } - - if ( - (temp = - sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8)) != - 0x00) { - -#ifdef DEBUG - printk - ("i2c-sis5595.o: Failed reset at end of transaction (%02x)\n", - temp); -#endif - } - return result; -} - -/* Return -1 on error. */ -s32 sis5595_access(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, union i2c_smbus_data * data) -{ - switch (size) { - case I2C_SMBUS_QUICK: - sis5595_write(SMB_ADDR, - ((addr & 0x7f) << 1) | (read_write & 0x01)); - size = SIS5595_QUICK; - break; - case I2C_SMBUS_BYTE: - sis5595_write(SMB_ADDR, - ((addr & 0x7f) << 1) | (read_write & 0x01)); - if (read_write == I2C_SMBUS_WRITE) - sis5595_write(SMB_CMD, command); - size = SIS5595_BYTE; - break; - case I2C_SMBUS_BYTE_DATA: - sis5595_write(SMB_ADDR, - ((addr & 0x7f) << 1) | (read_write & 0x01)); - sis5595_write(SMB_CMD, command); - if (read_write == I2C_SMBUS_WRITE) - sis5595_write(SMB_BYTE, data->byte); - size = SIS5595_BYTE_DATA; - break; - case I2C_SMBUS_PROC_CALL: - case I2C_SMBUS_WORD_DATA: - sis5595_write(SMB_ADDR, - ((addr & 0x7f) << 1) | (read_write & 0x01)); - sis5595_write(SMB_CMD, command); - if (read_write == I2C_SMBUS_WRITE) { - sis5595_write(SMB_BYTE, data->word & 0xff); - sis5595_write(SMB_BYTE + 1, - (data->word & 0xff00) >> 8); - } - size = - (size == - I2C_SMBUS_PROC_CALL) ? SIS5595_PROC_CALL : - SIS5595_WORD_DATA; - break; -/* - case I2C_SMBUS_BLOCK_DATA: - printk("sis5595.o: Block data not yet implemented!\n"); - return -1; - break; -*/ - default: - printk - (KERN_WARNING "sis5595.o: Unsupported transaction %d\n", size); - return -1; - } - - sis5595_write(SMB_CTL_LO, ((size & 0x0E))); - - if (sis5595_transaction()) /* Error in transaction */ - return -1; - - if ((size != SIS5595_PROC_CALL) && - ((read_write == I2C_SMBUS_WRITE) || (size == SIS5595_QUICK))) - return 0; - - - switch (size) { - case SIS5595_BYTE: /* Where is the result put? I assume here it is in - SMB_DATA but it might just as well be in the - SMB_CMD. No clue in the docs */ - case SIS5595_BYTE_DATA: - data->byte = sis5595_read(SMB_BYTE); - break; - case SIS5595_WORD_DATA: - case SIS5595_PROC_CALL: - data->word = - sis5595_read(SMB_BYTE) + - (sis5595_read(SMB_BYTE + 1) << 8); - break; - } - return 0; -} - -static void sis5595_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void sis5595_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -u32 sis5595_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_PROC_CALL; -} - - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = sis5595_access, - .functionality = sis5595_func, -}; - -static struct i2c_adapter sis5595_adapter = { - .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS5595, - .algo = &smbus_algorithm, - .inc_use = sis5595_inc, - .dec_use = sis5595_dec, -}; - - -static struct pci_device_id sis5595_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_SI, - .device = PCI_DEVICE_ID_SI_503, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - - if (sis5595_setup(dev)) { - printk - ("i2c-sis5595.o: SIS5595 not detected, module not inserted.\n"); - - return -ENODEV; - } - - sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x", - sis5595_base + SMB_INDEX); - i2c_add_adapter(&sis5595_adapter); - - return 0; -} - -static void __devexit sis5595_remove(struct pci_dev *dev) -{ - i2c_del_adapter(&sis5595_adapter); - release_region(sis5595_base + SMB_INDEX, 2); -} - - -static struct pci_driver sis5595_driver = { - .name = "sis5595 smbus", - .id_table = sis5595_ids, - .probe = sis5595_probe, - .remove = __devexit_p(sis5595_remove), -}; - -static int __init i2c_sis5595_init(void) -{ - printk("i2c-sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&sis5595_driver); -} - - -static void __exit i2c_sis5595_exit(void) -{ - pci_unregister_driver(&sis5595_driver); -} - - - -MODULE_AUTHOR("Frodo Looijaard "); -MODULE_DESCRIPTION("SIS5595 SMBus driver"); - -module_init(i2c_sis5595_init); -module_exit(i2c_sis5595_exit); diff --git a/kernel/busses/i2c-sis630.c b/kernel/busses/i2c-sis630.c deleted file mode 100644 index 88c02d9f..00000000 --- a/kernel/busses/i2c-sis630.c +++ /dev/null @@ -1,544 +0,0 @@ -/* - i2c-sis630.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - - Copyright (c) 2002,2003 Alexander Malysh - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - Changes: - 24.08.2002 - Fixed the typo in sis630_access (Thanks to Mark M. Hoffman) - Changed sis630_transaction.(Thanks to Mark M. Hoffman) - 18.09.2002 - Added SIS730 as supported. - 21.09.2002 - Added high_clock module option.If this option is set - used Host Master Clock 56KHz (default 14KHz).For now we save old Host - Master Clock and after transaction completed restore (otherwise - it's confuse BIOS and hung Machine). - 24.09.2002 - Fixed typo in sis630_access - Fixed logical error by restoring of Host Master Clock - 31.07.2003 - Added block data read/write support. -*/ - -/* - Status: beta - - Supports: - SIS 630 - SIS 730 - - Note: we assume there can only be one device, with one SMBus interface. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - - -#ifdef DEBUG -#define DBG(x...) printk(KERN_DEBUG "i2c-sis630.o: " x) -#else -#define DBG(x...) -#endif - -/* SIS630 SMBus registers */ -#define SMB_STS 0x80 /* status */ -#define SMB_EN 0x81 /* status enable */ -#define SMB_CNT 0x82 -#define SMBHOST_CNT 0x83 -#define SMB_ADDR 0x84 -#define SMB_CMD 0x85 -#define SMB_PCOUNT 0x86 /* processed count */ -#define SMB_COUNT 0x87 -#define SMB_BYTE 0x88 /* ~0x8F data byte field */ -#define SMBDEV_ADDR 0x90 -#define SMB_DB0 0x91 -#define SMB_DB1 0x92 -#define SMB_SAA 0x93 - -/* register count for request_region */ -#define SIS630_SMB_IOREGION 20 - -/* PCI address constants */ -/* acpi base address register */ -#define SIS630_ACPI_BASE_REG 0x74 -/* bios control register */ -#define SIS630_BIOS_CTL_REG 0x40 - -/* Other settings */ -#define MAX_TIMEOUT 500 - -/* SIS630 constants */ -#define SIS630_QUICK 0x00 -#define SIS630_BYTE 0x01 -#define SIS630_BYTE_DATA 0x02 -#define SIS630_WORD_DATA 0x03 -#define SIS630_PCALL 0x04 -#define SIS630_BLOCK_DATA 0x05 - -static struct pci_driver sis630_driver; - -/* insmod parameters */ -static int high_clock = 0; -static int force = 0; -MODULE_PARM(high_clock, "i"); -MODULE_PARM_DESC(high_clock, "Set Host Master Clock to 56KHz (default 14KHz)."); -MODULE_PARM(force, "i"); -MODULE_PARM_DESC(force, "Forcibly enable the SIS630. DANGEROUS!"); - -/* acpi base address */ -static unsigned short acpi_base = 0; - -/* supported chips */ -static int supported[] = { - PCI_DEVICE_ID_SI_630, - PCI_DEVICE_ID_SI_730, - 0 /* terminates the list */ -}; - -static inline u8 sis630_read(u8 reg) { - return inb(acpi_base + reg); -} - -static inline void sis630_write(u8 reg, u8 data) { - outb(data, acpi_base + reg); -} - -static int sis630_transaction_start(int size, u8 *oldclock) { - int temp; - - /* - Make sure the SMBus host is ready to start transmitting. - */ - if ((temp = sis630_read(SMB_CNT) & 0x03) != 0x00) { - DBG("SMBus busy (%02x).Resetting...\n",temp); - /* kill smbus transaction */ - sis630_write(SMBHOST_CNT, 0x20); - - if ((temp = sis630_read(SMB_CNT) & 0x03) != 0x00) { - DBG("Failed! (%02x)\n", temp); - return -1; - } else { - DBG("Successful!\n"); - } - } - - /* save old clock, so we can prevent machine for hung */ - *oldclock = sis630_read(SMB_CNT); - - DBG("saved clock 0x%02x\n", *oldclock); - - /* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ - if (high_clock > 0) - sis630_write(SMB_CNT, 0x20); - else - sis630_write(SMB_CNT, (*oldclock & ~0x40)); - - /* clear all sticky bits */ - temp = sis630_read(SMB_STS); - sis630_write(SMB_STS, temp & 0x1e); - - /* start the transaction by setting bit 4 and size */ - sis630_write(SMBHOST_CNT,0x10 | (size & 0x07)); - - return 0; -} - -static int sis630_transaction_wait(int size) { - int temp, result = 0, timeout = 0; - - /* We will always wait for a fraction of a second! */ - do { - i2c_delay(1); - temp = sis630_read(SMB_STS); - /* check if block transmitted */ - if (size == SIS630_BLOCK_DATA && (temp & 0x10)) - break; - } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); - - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { - DBG("SMBus Timeout!\n"); - result = -1; - } - - if (temp & 0x02) { - result = -1; - DBG("Error: Failed bus transaction\n"); - } - - if (temp & 0x04) { - result = -1; - printk(KERN_ERR "i2c-sis630.o: Bus collision!\n"); - /* - TBD: Datasheet say: - the software should clear this bit and restart SMBUS operation. - Should we do it or user start request again? - */ - } - - return result; -} - -static void sis630_transaction_end(u8 oldclock) { - int temp = 0; - - /* clear all status "sticky" bits */ - sis630_write(SMB_STS, temp); - - DBG("SMB_CNT before clock restore 0x%02x\n", sis630_read(SMB_CNT)); - - /* - * restore old Host Master Clock if high_clock is set - * and oldclock was not 56KHz - */ - if (high_clock > 0 && !(oldclock & 0x20)) - sis630_write(SMB_CNT,(sis630_read(SMB_CNT) & ~0x20)); - - DBG("SMB_CNT after clock restore 0x%02x\n", sis630_read(SMB_CNT)); -} - -static int sis630_transaction(int size) { - int result = 0; - u8 oldclock = 0; - - if (!(result = sis630_transaction_start(size, &oldclock))) { - result = sis630_transaction_wait(size); - sis630_transaction_end(oldclock); - } - - return result; -} - -static int sis630_block_data(union i2c_smbus_data * data, int read_write) { - int i, len = 0, rc = 0; - u8 oldclock = 0; - - if (read_write == I2C_SMBUS_WRITE) { - len = data->block[0]; - if (len < 0) - len = 0; - else if (len > 32) - len = 32; - sis630_write(SMB_COUNT, len); - for (i=1; i <= len; i++) { - DBG("set data 0x%02x\n", data->block[i]); - /* set data */ - sis630_write(SMB_BYTE+(i-1)%8, data->block[i]); - if (i==8 || (len<8 && i==len)) { - DBG("start trans len=%d i=%d\n",len ,i); - /* first transaction */ - if (sis630_transaction_start(SIS630_BLOCK_DATA, &oldclock)) - return -1; - } - else if ((i-1)%8 == 7 || i==len) { - DBG("trans_wait len=%d i=%d\n",len,i); - if (i>8) { - DBG("clear smbary_sts len=%d i=%d\n",len,i); - /* - If this is not first transaction, - we must clear sticky bit. - clear SMBARY_STS - */ - sis630_write(SMB_STS,0x10); - } - if (sis630_transaction_wait(SIS630_BLOCK_DATA)) { - DBG("trans_wait failed\n"); - rc = -1; - break; - } - - } - } - } - else { /* read request */ - data->block[0] = len = 0; - if (sis630_transaction_start(SIS630_BLOCK_DATA, &oldclock)) { - return -1; - } - do { - if (sis630_transaction_wait(SIS630_BLOCK_DATA)) { - DBG("trans_wait failed\n"); - rc = -1; - break; - } - /* if this first transaction then read byte count */ - if (len == 0) - data->block[0] = sis630_read(SMB_COUNT); - - /* just to be sure */ - if (data->block[0] > 32) - data->block[0] = 32; - - DBG("block data read len=0x%x\n", data->block[0]); - - for (i=0; i < 8 && len < data->block[0]; i++,len++) { - DBG("read i=%d len=%d\n", i, len); - data->block[len+1] = sis630_read(SMB_BYTE+i); - } - - DBG("clear smbary_sts len=%d i=%d\n",len,i); - - /* clear SMBARY_STS */ - sis630_write(SMB_STS,0x10); - } while(len < data->block[0]); - } - - sis630_transaction_end(oldclock); - - return rc; -} - -/* Return -1 on error. */ -static s32 sis630_access(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, union i2c_smbus_data * data) -{ - - switch (size) { - case I2C_SMBUS_QUICK: - sis630_write(SMB_ADDR, ((addr & 0x7f) << 1) | (read_write & 0x01)); - size = SIS630_QUICK; - break; - case I2C_SMBUS_BYTE: - sis630_write(SMB_ADDR, ((addr & 0x7f) << 1) | (read_write & 0x01)); - if (read_write == I2C_SMBUS_WRITE) - sis630_write(SMB_CMD, command); - size = SIS630_BYTE; - break; - case I2C_SMBUS_BYTE_DATA: - sis630_write(SMB_ADDR, ((addr & 0x7f) << 1) | (read_write & 0x01)); - sis630_write(SMB_CMD, command); - if (read_write == I2C_SMBUS_WRITE) - sis630_write(SMB_BYTE, data->byte); - size = SIS630_BYTE_DATA; - break; - case I2C_SMBUS_PROC_CALL: - case I2C_SMBUS_WORD_DATA: - sis630_write(SMB_ADDR,((addr & 0x7f) << 1) | (read_write & 0x01)); - sis630_write(SMB_CMD, command); - if (read_write == I2C_SMBUS_WRITE) { - sis630_write(SMB_BYTE, data->word & 0xff); - sis630_write(SMB_BYTE + 1,(data->word & 0xff00) >> 8); - } - size = (size == I2C_SMBUS_PROC_CALL ? SIS630_PCALL : SIS630_WORD_DATA); - break; - case I2C_SMBUS_BLOCK_DATA: - sis630_write(SMB_ADDR,((addr & 0x7f) << 1) | (read_write & 0x01)); - sis630_write(SMB_CMD, command); - size = SIS630_BLOCK_DATA; - return sis630_block_data(data, read_write); - default: - printk("Unsupported I2C size\n"); - return -1; - break; - } - - - if (sis630_transaction(size)) - return -1; - - if ((size != SIS630_PCALL) && - ((read_write == I2C_SMBUS_WRITE) || (size == SIS630_QUICK))) { - return 0; - } - - switch(size) { - case SIS630_BYTE: - case SIS630_BYTE_DATA: - data->byte = sis630_read(SMB_BYTE); - break; - case SIS630_PCALL: - case SIS630_WORD_DATA: - data->word = sis630_read(SMB_BYTE) + (sis630_read(SMB_BYTE + 1) << 8); - break; - default: - return -1; - break; - } - - return 0; -} - -static void sis630_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void sis630_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - - -static u32 sis630_func(struct i2c_adapter *adapter) { - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_PROC_CALL | - I2C_FUNC_SMBUS_BLOCK_DATA; -} - -static int __devinit sis630_setup(struct pci_dev *sis630_dev) { - unsigned char b; - struct pci_dev *dummy = NULL; - int i; - - /* check for supported SiS devices */ - for (i=0; supported[i] > 0; i++) { - if ((dummy = pci_find_device(PCI_VENDOR_ID_SI, supported[i], dummy))) - break; /* found */ - } - - if (!dummy && force > 0) { - printk(KERN_ERR "i2c-sis630.o: WARNING: Can't detect SIS630 compatible device, but " - "loading because of force option enabled\n"); - } - else if (!dummy) { - return -ENODEV; - } - - /* - Enable ACPI first , so we can accsess reg 74-75 - in acpi io space and read acpi base addr - */ - if (PCIBIOS_SUCCESSFUL != - pci_read_config_byte(sis630_dev, SIS630_BIOS_CTL_REG,&b)) { - printk(KERN_ERR "i2c-sis630.o: Error: Can't read bios ctl reg\n"); - return -ENODEV; - } - - /* if ACPI already enabled , do nothing */ - if (!(b & 0x80) && - PCIBIOS_SUCCESSFUL != - pci_write_config_byte(sis630_dev,SIS630_BIOS_CTL_REG,b|0x80)) { - printk(KERN_ERR "i2c-sis630.o: Error: Can't enable ACPI\n"); - return -ENODEV; - } - /* Determine the ACPI base address */ - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(sis630_dev,SIS630_ACPI_BASE_REG,&acpi_base)) { - printk(KERN_ERR "i2c-sis630.o: Error: Can't determine ACPI base address\n"); - return -ENODEV; - } - - DBG("ACPI base at 0x%04x\n", acpi_base); - - /* Everything is happy, let's grab the memory and set things up. */ - if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, - sis630_driver.name)){ - printk(KERN_ERR "i2c-sis630.o: SMBus registers 0x%04x-0x%04x " - "already in use!\n",acpi_base + SMB_STS, acpi_base + SMB_SAA); - acpi_base = 0; /* reset acpi_base */ - return -ENODEV; - } - - return 0; -} - - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = sis630_access, - .functionality = sis630_func, -}; - -static struct i2c_adapter sis630_adapter = { - .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS630, - .algo = &smbus_algorithm, - .inc_use = sis630_inc, - .dec_use = sis630_dec, -}; - - -static struct pci_device_id sis630_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_SI, - .device = PCI_DEVICE_ID_SI_503, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - if (sis630_setup(dev)) { - printk(KERN_ERR "i2c-sis630.o: SIS630 comp. bus not detected, module not inserted.\n"); - return -ENODEV; - } - - sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x", - acpi_base + SMB_STS); - - return i2c_add_adapter(&sis630_adapter); -} - -static void __devexit sis630_remove(struct pci_dev *dev) -{ - if (acpi_base) { - i2c_del_adapter(&sis630_adapter); - release_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION); - acpi_base = 0; - } -} - - -static struct pci_driver sis630_driver = { - .name = "sis630 smbus", - .id_table = sis630_ids, - .probe = sis630_probe, - .remove = __devexit_p(sis630_remove), -}; - -static int __init i2c_sis630_init(void) -{ - printk("i2c-sis630.o version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&sis630_driver); -} - - -static void __exit i2c_sis630_exit(void) -{ - pci_unregister_driver(&sis630_driver); -} - - - - -MODULE_LICENSE("GPL"); - -MODULE_AUTHOR("Alexander Malysh "); -MODULE_DESCRIPTION("SIS630 SMBus driver"); - -module_init(i2c_sis630_init); -module_exit(i2c_sis630_exit); diff --git a/kernel/busses/i2c-sis645.c b/kernel/busses/i2c-sis645.c deleted file mode 100644 index 52916cf8..00000000 --- a/kernel/busses/i2c-sis645.c +++ /dev/null @@ -1,605 +0,0 @@ -/* - sis645.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - - Copyright (c) 2003 Mark M. Hoffman - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - This module must be considered BETA unless and until - the chipset manufacturer releases a datasheet. - - The register definitions are based on the SiS630. - The method for *finding* the registers is based on trial and error. - - A history of changes to this file is available by SVN: - http://www.lm-sensors.org/wiki/Download -*/ - -/* 25th March 2004 - Support for Sis655 chipsets added by Ken Healy -*/ - -/* - Note: we assume there can only be one SiS645 with one SMBus interface -*/ - -/* #define DEBUG 1 */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - -#define DRV_NAME "i2c-sis645" - -/* SiS645DX north bridge (defined in 2.4.21) */ -#ifndef PCI_DEVICE_ID_SI_646 -#define PCI_DEVICE_ID_SI_646 0x0646 -#endif - -/* SiS648 north bridge (defined in 2.4.21) */ -#ifndef PCI_DEVICE_ID_SI_648 -#define PCI_DEVICE_ID_SI_648 0x0648 -#endif - -/* SiS650 north bridge (defined in 2.4.19) */ -#ifndef PCI_DEVICE_ID_SI_650 -#define PCI_DEVICE_ID_SI_650 0x0650 -#endif - -/* SiS651 north bridge (defined in 2.4.21)*/ -#ifndef PCI_DEVICE_ID_SI_651 -#define PCI_DEVICE_ID_SI_651 0x0651 -#endif - -/* SiS655 north bridge (defined in 2.4.22)*/ -#ifndef PCI_DEVICE_ID_SI_655 -#define PCI_DEVICE_ID_SI_655 0x0655 -#endif - -/* SiS746 north bridge (defined in 2.4.21) */ -#ifndef PCI_DEVICE_ID_SI_746 -#define PCI_DEVICE_ID_SI_746 0x0746 -#endif - -/* SiS85C503/5513 (LPC Bridge) */ -#ifndef PCI_DEVICE_ID_SI_LPC -#define PCI_DEVICE_ID_SI_LPC 0x0018 -#endif - -/* SiS961 south bridge */ -#ifndef PCI_DEVICE_ID_SI_961 -#define PCI_DEVICE_ID_SI_961 0x0961 -#endif - -/* SiS962 south bridge */ -#ifndef PCI_DEVICE_ID_SI_962 -#define PCI_DEVICE_ID_SI_962 0x0962 -#endif - -/* SiS963 south bridge */ -#ifndef PCI_DEVICE_ID_SI_963 -#define PCI_DEVICE_ID_SI_963 0x0963 -#endif - -/* SMBus ID */ -#ifndef PCI_DEVICE_ID_SI_SMBUS -#define PCI_DEVICE_ID_SI_SMBUS 0x16 -#endif - -/* base address register in PCI config space */ -#define SIS645_BAR 0x04 - -/* SiS645 SMBus registers */ -#define SMB_STS 0x00 -#define SMB_EN 0x01 -#define SMB_CNT 0x02 -#define SMB_HOST_CNT 0x03 -#define SMB_ADDR 0x04 -#define SMB_CMD 0x05 -#define SMB_PCOUNT 0x06 -#define SMB_COUNT 0x07 -#define SMB_BYTE 0x08 -#define SMB_DEV_ADDR 0x10 -#define SMB_DB0 0x11 -#define SMB_DB1 0x12 -#define SMB_SAA 0x13 - -/* register count for request_region */ -#define SMB_IOSIZE 0x20 - -/* Other settings */ -#define MAX_TIMEOUT 500 - -/* SiS645 SMBus constants */ -#define SIS645_QUICK 0x00 -#define SIS645_BYTE 0x01 -#define SIS645_BYTE_DATA 0x02 -#define SIS645_WORD_DATA 0x03 -#define SIS645_PROC_CALL 0x04 -#define SIS645_BLOCK_DATA 0x05 - -static struct pci_driver sis645_driver; -static struct i2c_adapter sis645_adapter; -static u16 sis645_smbus_base = 0; - -static inline u8 sis645_read(u8 reg) -{ - return inb(sis645_smbus_base + reg) ; -} - -static inline void sis645_write(u8 reg, u8 data) -{ - outb(data, sis645_smbus_base + reg) ; -} - -#ifdef CONFIG_HOTPLUG - -/* Turns on SMBus device if it is not; return 0 iff successful - */ -static int __devinit sis645_enable_smbus(struct pci_dev *dev) -{ - u8 val = 0; - - pci_read_config_byte(dev, 0x77, &val); - -#ifdef DEBUG - printk(KERN_DEBUG DRV_NAME ": Config byte was 0x%02x.\n", val); -#endif - - pci_write_config_byte(dev, 0x77, val & ~0x10); - - pci_read_config_byte(dev, 0x77, &val); - - if (val & 0x10) { -#ifdef DEBUG - printk(KERN_DEBUG DRV_NAME ": Config byte stuck!\n"); -#endif - return -1; - } - - return 0; -} - -/* Builds the basic pci_dev for SiS645 SMBus - */ -static int __devinit sis645_build_dev(struct pci_dev **smbus_dev, - struct pci_dev *bridge_dev) -{ - struct pci_dev temp_dev; - u16 vid = 0, did = 0; - int ret; - - /* fill in the device structure for search */ - memset(&temp_dev, 0, sizeof(temp_dev)); - temp_dev.bus = bridge_dev->bus; - temp_dev.sysdata = bridge_dev->bus->sysdata; - temp_dev.hdr_type = PCI_HEADER_TYPE_NORMAL; - - /* the SMBus device is function 1 on the same unit as the ISA bridge */ - temp_dev.devfn = bridge_dev->devfn + 1; - - /* query to make sure */ - ret = pci_read_config_word(&temp_dev, PCI_VENDOR_ID, &vid); - if (ret || PCI_VENDOR_ID_SI != vid) { - printk(KERN_ERR DRV_NAME ": Couldn't find SMBus device!\n"); - return ret; - } - temp_dev.vendor = vid; - - ret = pci_read_config_word(&temp_dev, PCI_DEVICE_ID, &did); - if (ret || PCI_DEVICE_ID_SI_SMBUS != did) { - printk(KERN_ERR DRV_NAME ": Couldn't find SMBus device!\n"); - return ret; - } - temp_dev.device = did; - - /* ok, we've got it... request some memory and finish it off */ - *smbus_dev = kmalloc(sizeof(**smbus_dev), GFP_ATOMIC); - if (NULL == *smbus_dev) { - printk(KERN_ERR DRV_NAME ": Out of memory!\n"); - return -ENOMEM; - } - - **smbus_dev = temp_dev; - - ret = pci_setup_device(*smbus_dev); - if (ret) { - printk(KERN_ERR DRV_NAME ": pci_setup_device failed (0x%08x)\n",ret); - } - return ret; -} - -/* See if a SMBus can be found, and enable it if possible. - */ -static int __devinit sis645_hotplug_smbus(void) -{ - int ret; - struct pci_dev *smbus_dev, *bridge_dev ; - - if ((bridge_dev = pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_961, NULL))) - printk(KERN_INFO DRV_NAME ": Found SiS961 south bridge.\n"); - - else if ((bridge_dev = pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_962, NULL))) - printk(KERN_INFO DRV_NAME ": Found SiS962 [MuTIOL Media IO].\n"); - - else if ((bridge_dev = pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_963, NULL))) - printk(KERN_INFO DRV_NAME ": Found SiS963 [MuTIOL Media IO].\n"); - - else if ((bridge_dev = pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_503, NULL)) || - (bridge_dev = pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_LPC, NULL))) { - - printk(KERN_INFO DRV_NAME ": Found SiS south bridge in compatability mode(?)\n"); - - /* look for known compatible north bridges */ - if ((NULL == pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_645, NULL)) - && (NULL == pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_646, NULL)) - && (NULL == pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_648, NULL)) - && (NULL == pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_650, NULL)) - && (NULL == pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_651, NULL)) - && (NULL == pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_655, NULL)) - && (NULL == pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_735, NULL)) - && (NULL == pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_745, NULL)) - && (NULL == pci_find_device(PCI_VENDOR_ID_SI, - PCI_DEVICE_ID_SI_746, NULL))) { - printk(KERN_ERR DRV_NAME ": Can't find suitable host bridge!\n"); - return -ENODEV; - } - } else { - printk(KERN_ERR DRV_NAME ": Can't find suitable south bridge!\n"); - return -ENODEV; - } - - /* if we get this far, we think the smbus device is present */ - - if ((ret = sis645_enable_smbus(bridge_dev))) - return ret; - - if ((ret = sis645_build_dev(&smbus_dev, bridge_dev))) - return ret; - - if ((ret = pci_enable_device(smbus_dev))) { - printk(KERN_ERR DRV_NAME ": Can't pci_enable SMBus device!" - " (0x%08x)\n", ret); - return ret; - } - - pci_insert_device(smbus_dev, smbus_dev->bus); - - return 0; -} -#endif /* CONFIG_HOTPLUG */ - -/* Execute a SMBus transaction. - int size is from SIS645_QUICK to SIS645_BLOCK_DATA - */ -static int sis645_transaction(int size) -{ - int temp; - int result = 0; - int timeout = 0; - - /* Make sure the SMBus host is ready to start transmitting */ - if (((temp = sis645_read(SMB_CNT)) & 0x03) != 0x00) { -#ifdef DEBUG - printk(KERN_DEBUG DRV_NAME ": SMBus busy (0x%02x). Resetting...\n", - temp); -#endif - - /* kill the transaction */ - sis645_write(SMB_HOST_CNT, 0x20); - - /* check it again */ - if (((temp = sis645_read(SMB_CNT)) & 0x03) != 0x00) { -#ifdef DEBUG - printk(KERN_DEBUG DRV_NAME ": Failed! (0x%02x)\n", temp); -#endif - return -1; - } else { -#ifdef DEBUG - printk(KERN_DEBUG DRV_NAME ": Successful!\n"); -#endif - } - } - - /* Turn off timeout interrupts, set fast host clock */ - sis645_write(SMB_CNT, 0x20); - - /* clear all (sticky) status flags */ - temp = sis645_read(SMB_STS); - sis645_write(SMB_STS, temp & 0x1e); - - /* start the transaction by setting bit 4 and size bits */ - sis645_write(SMB_HOST_CNT, 0x10 | (size & 0x07)); - - /* We will always wait for a fraction of a second! */ - do { - i2c_delay(1); - temp = sis645_read(SMB_STS); - } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); - - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { - printk(KERN_DEBUG DRV_NAME ": SMBus Timeout! (0x%02x)\n",temp); - result = -1; - } - - /* device error - probably missing ACK */ - if (temp & 0x02) { -#ifdef DEBUG - printk(KERN_DEBUG DRV_NAME ": Failed bus transaction!\n"); -#endif - result = -1; - } - - /* bus collision */ - if (temp & 0x04) { -#ifdef DEBUG - printk(KERN_DEBUG DRV_NAME ": Bus collision!\n"); -#endif - result = -1; - } - - /* Finish up by resetting the bus */ - sis645_write(SMB_STS, temp); - if ((temp = sis645_read(SMB_STS))) { -#ifdef DEBUG - printk(KERN_DEBUG DRV_NAME ": Failed reset at end of transaction!" - " (0x%02x)\n", temp); -#endif - } - - return result; -} - -/* Return -1 on error. */ -static s32 sis645_access(struct i2c_adapter * adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, union i2c_smbus_data * data) -{ - - switch (size) { - case I2C_SMBUS_QUICK: - sis645_write(SMB_ADDR, ((addr & 0x7f) << 1) | (read_write & 0x01)); - size = SIS645_QUICK; - break; - - case I2C_SMBUS_BYTE: - sis645_write(SMB_ADDR, ((addr & 0x7f) << 1) | (read_write & 0x01)); - if (read_write == I2C_SMBUS_WRITE) - sis645_write(SMB_CMD, command); - size = SIS645_BYTE; - break; - - case I2C_SMBUS_BYTE_DATA: - sis645_write(SMB_ADDR, ((addr & 0x7f) << 1) | (read_write & 0x01)); - sis645_write(SMB_CMD, command); - if (read_write == I2C_SMBUS_WRITE) - sis645_write(SMB_BYTE, data->byte); - size = SIS645_BYTE_DATA; - break; - - case I2C_SMBUS_PROC_CALL: - case I2C_SMBUS_WORD_DATA: - sis645_write(SMB_ADDR, ((addr & 0x7f) << 1) | (read_write & 0x01)); - sis645_write(SMB_CMD, command); - if (read_write == I2C_SMBUS_WRITE) { - sis645_write(SMB_BYTE, data->word & 0xff); - sis645_write(SMB_BYTE + 1, (data->word & 0xff00) >> 8); - } - size = (size == I2C_SMBUS_PROC_CALL ? SIS645_PROC_CALL : SIS645_WORD_DATA); - break; - - case I2C_SMBUS_BLOCK_DATA: - /* TO DO: */ - printk(KERN_INFO DRV_NAME ": SMBus block not implemented!\n"); - return -1; - break; - - default: - printk(KERN_INFO DRV_NAME ": Unsupported I2C size\n"); - return -1; - break; - } - - if (sis645_transaction(size)) - return -1; - - if ((size != SIS645_PROC_CALL) && - ((read_write == I2C_SMBUS_WRITE) || (size == SIS645_QUICK))) - return 0; - - switch (size) { - case SIS645_BYTE: - case SIS645_BYTE_DATA: - data->byte = sis645_read(SMB_BYTE); - break; - - case SIS645_WORD_DATA: - case SIS645_PROC_CALL: - data->word = sis645_read(SMB_BYTE) + - (sis645_read(SMB_BYTE + 1) << 8); - break; - } - return 0; -} - -static void sis645_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void sis645_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static u32 sis645_func(struct i2c_adapter *adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_PROC_CALL; -} - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = sis645_access, - .functionality = sis645_func, -}; - -static struct i2c_adapter sis645_adapter = { - .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS645, - .algo = &smbus_algorithm, - .inc_use = sis645_inc, - .dec_use = sis645_dec, -}; - -static struct pci_device_id sis645_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_SI, - .device = PCI_DEVICE_ID_SI_SMBUS, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit sis645_probe(struct pci_dev *dev, - const struct pci_device_id *id) -{ - u16 ww = 0; - int retval; - - if (sis645_smbus_base) { - dev_err(dev, "Only one device supported.\n"); - return -EBUSY; - } - - pci_read_config_word(dev, PCI_CLASS_DEVICE, &ww); - if (PCI_CLASS_SERIAL_SMBUS != ww) { - dev_err(dev, "Unsupported device class 0x%04x!\n", ww); - return -ENODEV; - } - - sis645_smbus_base = pci_resource_start(dev, SIS645_BAR); - if (!sis645_smbus_base) { - dev_err(dev, "SiS645 SMBus base address " - "not initialized!\n"); - return -EINVAL; - } - dev_info(dev, "SiS645 SMBus base address: 0x%04x\n", - sis645_smbus_base); - - /* Everything is happy, let's grab the memory and set things up. */ - if (!request_region(sis645_smbus_base, SMB_IOSIZE, - sis645_driver.name)) { - dev_err(dev, "SMBus registers 0x%04x-0x%04x " - "already in use!\n", sis645_smbus_base, - sis645_smbus_base + SMB_IOSIZE - 1); - - sis645_smbus_base = 0; - return -EINVAL; - } - - sprintf(sis645_adapter.name, "SiS645 SMBus adapter at 0x%04x", - sis645_smbus_base); - - if ((retval = i2c_add_adapter(&sis645_adapter))) { - dev_err(dev, "Couldn't register adapter!\n"); - release_region(sis645_smbus_base, SMB_IOSIZE); - sis645_smbus_base = 0; - } - - return retval; -} - -static void __devexit sis645_remove(struct pci_dev *dev) -{ - if (sis645_smbus_base) { - i2c_del_adapter(&sis645_adapter); - release_region(sis645_smbus_base, SMB_IOSIZE); - sis645_smbus_base = 0; - } -} - -static struct pci_driver sis645_driver = { - .name = "sis645 smbus", - .id_table = sis645_ids, - .probe = sis645_probe, - .remove = __devexit_p(sis645_remove), -}; - -static int __init i2c_sis645_init(void) -{ - printk(KERN_INFO DRV_NAME ".o version %s (%s)\n", LM_VERSION, LM_DATE); - - /* if the required device id is not present, try to HOTPLUG it first */ - if (!pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_SMBUS, NULL)) { - - printk(KERN_INFO DRV_NAME ": " - "Attempting to enable SiS645 SMBus device\n"); - -#ifdef CONFIG_HOTPLUG - sis645_hotplug_smbus(); -#else - printk(KERN_INFO DRV_NAME ": " - "Requires kernel with CONFIG_HOTPLUG, sorry!\n"); -#endif - } - - return pci_module_init(&sis645_driver); -} - -static void __exit i2c_sis645_exit(void) -{ - pci_unregister_driver(&sis645_driver); -} - -MODULE_AUTHOR("Mark M. Hoffman "); -MODULE_DESCRIPTION("SiS645 SMBus driver"); -MODULE_LICENSE("GPL"); - -/* Register initialization functions using helper macros */ -module_init(i2c_sis645_init); -module_exit(i2c_sis645_exit); diff --git a/kernel/busses/i2c-tsunami.c b/kernel/busses/i2c-tsunami.c deleted file mode 100644 index 7b27c56b..00000000 --- a/kernel/busses/i2c-tsunami.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - i2c-tsunami.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2001 Oleg Vdovikin - - Based on code written by Ralph Metzler and - Simon Vogl - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* This interfaces to the I2C bus of the Tsunami/Typhoon 21272 chipsets - to gain access to the on-board I2C devices. - - For more information refer to Compaq's - "Tsunami/Typhoon 21272 Chipset Hardware Reference Manual" - Order Number: DS-0025-TE -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - -MODULE_LICENSE("GPL"); - -/* Memory Presence Detect Register (MPD-RW) bits - with except of reserved RAZ bits */ - -#define MPD_DR 0x8 /* Data receive - RO */ -#define MPD_CKR 0x4 /* Clock receive - RO */ -#define MPD_DS 0x2 /* Data send - Must be a 1 to receive - WO */ -#define MPD_CKS 0x1 /* Clock send - WO */ - -static inline void writempd(unsigned long value) -{ - TSUNAMI_cchip->mpd.csr = value; - mb(); -} - -static inline unsigned long readmpd(void) -{ - return TSUNAMI_cchip->mpd.csr; -} - -static void bit_tsunami_setscl(void *data, int val) -{ - /* read currently setted bits to modify them */ - unsigned long bits = readmpd() >> 2; /* assume output == input */ - - if (val) - bits |= MPD_CKS; - else - bits &= ~MPD_CKS; - - writempd(bits); -} - -static void bit_tsunami_setsda(void *data, int val) -{ - /* read currently setted bits to modify them */ - unsigned long bits = readmpd() >> 2; /* assume output == input */ - - if (val) - bits |= MPD_DS; - else - bits &= ~MPD_DS; - - writempd(bits); -} - -/* The MPD pins are open drain, so the pins always remain outputs. - We rely on the i2c-algo-bit routines to set the pins high before - reading the input from other chips. */ - -static int bit_tsunami_getscl(void *data) -{ - return (0 != (readmpd() & MPD_CKR)); -} - -static int bit_tsunami_getsda(void *data) -{ - return (0 != (readmpd() & MPD_DR)); -} - -static void i2c_tsunami_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void i2c_tsunami_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static struct i2c_algo_bit_data tsunami_i2c_bit_data = { - .setsda = bit_tsunami_setsda, - .setscl = bit_tsunami_setscl, - .getsda = bit_tsunami_getsda, - .getscl = bit_tsunami_getscl, - .udelay = 10, - .mdelay = 10, - .timeout = HZ/2 -}; - -static struct i2c_adapter tsunami_i2c_adapter = { - .name = "I2C Tsunami/Typhoon adapter", - .id = I2C_HW_B_TSUNA, - .algo_data = &tsunami_i2c_bit_data, - .inc_use = i2c_tsunami_inc, - .dec_use = i2c_tsunami_dec, -}; - - -#if 0 -static struct pci_driver tsunami_driver = { - .name = "tsunami smbus", - .id_table = tsunami_ids, - .probe = tsunami_probe, - .remove = __devexit_p(tsunami_remove), -}; -#endif - -static int __init i2c_tsunami_init(void) -{ - printk("i2c-tsunami.o version %s (%s)\n", LM_VERSION, LM_DATE); - - if (hwrpb->sys_type != ST_DEC_TSUNAMI) { - printk("i2c-tsunami.o: not Tsunami based system (%ld), module not inserted.\n", hwrpb->sys_type); - return -ENXIO; - } else { - printk("i2c-tsunami.o: using Cchip MPD at 0x%lx.\n", (long) &TSUNAMI_cchip->mpd); - } - return i2c_bit_add_bus(&tsunami_i2c_adapter); -} - - -static void __exit i2c_tsunami_exit(void) -{ - i2c_bit_del_bus(&tsunami_i2c_adapter); -} - - - -MODULE_AUTHOR("Oleg I. Vdovikin "); -MODULE_DESCRIPTION("Tsunami I2C/SMBus driver"); - -module_init(i2c_tsunami_init); -module_exit(i2c_tsunami_exit); diff --git a/kernel/busses/i2c-via.c b/kernel/busses/i2c-via.c deleted file mode 100644 index efe4f54a..00000000 --- a/kernel/busses/i2c-via.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - i2c-via.c - Part of lm_sensors, Linux kernel modules - for hardware monitoring - - i2c Support for Via Technologies 82C586B South Bridge - - Copyright (c) 1998, 1999 Kyösti Mälkki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for HZ */ -#include "version.h" -#include "sensors_compat.h" - -/* Power management registers */ - -#define PM_CFG_REVID 0x08 /* silicon revision code */ -#define PM_CFG_IOBASE0 0x20 -#define PM_CFG_IOBASE1 0x48 - -#define I2C_DIR (pm_io_base+0x40) -#define I2C_OUT (pm_io_base+0x42) -#define I2C_IN (pm_io_base+0x44) -#define I2C_SCL 0x02 /* clock bit in DIR/OUT/IN register */ -#define I2C_SDA 0x04 - -/* io-region reservation */ -#define IOSPACE 0x06 -#define IOTEXT "via-i2c" - -static u16 pm_io_base = 0; - -/* - It does not appear from the datasheet that the GPIO pins are - open drain. So a we set a low value by setting the direction to - output and a high value by setting the direction to input and - relying on the required I2C pullup. The data value is initialized - to 0 in via_init() and never changed. -*/ - -static void bit_via_setscl(void *data, int state) -{ - outb(state ? inb(I2C_DIR) & ~I2C_SCL : inb(I2C_DIR) | I2C_SCL, - I2C_DIR); -} - -static void bit_via_setsda(void *data, int state) -{ - outb(state ? inb(I2C_DIR) & ~I2C_SDA : inb(I2C_DIR) | I2C_SDA, - I2C_DIR); -} - -static int bit_via_getscl(void *data) -{ - return (0 != (inb(I2C_IN) & I2C_SCL)); -} - -static int bit_via_getsda(void *data) -{ - return (0 != (inb(I2C_IN) & I2C_SDA)); -} - -static void bit_via_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void bit_via_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static struct i2c_algo_bit_data bit_data = { - .setsda = bit_via_setsda, - .setscl = bit_via_setscl, - .getsda = bit_via_getsda, - .getscl = bit_via_getscl, - .udelay = 5, - .mdelay = 5, - .timeout = HZ -}; - -static struct i2c_adapter vt586b_adapter = { - .name = "VIA i2c", - .id = I2C_HW_B_VIA, - .algo_data = &bit_data, - .inc_use = bit_via_inc, - .dec_use = bit_via_dec, -}; - - -static struct pci_device_id vt586b_ids[] __initdata = { - { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0, } -}; - -static int __init vt586b_probe(struct pci_dev *dev, - const struct pci_device_id *id) -{ - u16 base; - u8 rev; - int res; - - if (pm_io_base) { - printk(KERN_ERR "i2c-via.o: Will only support one host\n"); - return -EBUSY; - } - - pci_read_config_byte(dev, PM_CFG_REVID, &rev); - - switch (rev) { - case 0x00: - base = PM_CFG_IOBASE0; - break; - case 0x01: - case 0x10: - base = PM_CFG_IOBASE1; - break; - - default: - base = PM_CFG_IOBASE1; - /* later revision */ - } - - pci_read_config_word(dev, base, &pm_io_base); - pm_io_base &= (0xff << 8); - - if (! request_region(I2C_DIR, IOSPACE, IOTEXT)) { - printk("i2c-via.o: IO 0x%x-0x%x already in use\n", - I2C_DIR, I2C_DIR + IOSPACE); - return -EBUSY; - } - outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR); - outb(inb(I2C_OUT) & ~(I2C_SDA | I2C_SCL), I2C_OUT); - - res = i2c_bit_add_bus(&vt586b_adapter); - if ( res < 0 ) { - release_region(I2C_DIR, IOSPACE); - pm_io_base = 0; - return res; - } - return 0; -} - -static int __init i2c_vt586b_init(void) -{ - struct pci_dev *dev; - const struct pci_device_id *id; - - printk("i2c-via.o version %s (%s)\n", LM_VERSION, LM_DATE); - pci_for_each_dev(dev) { - id = pci_match_device(vt586b_ids, dev); - if(id) - if(vt586b_probe(dev, id) >= 0) - return 0; - } - return -ENODEV; -} - - -static void __exit i2c_vt586b_exit(void) -{ - i2c_bit_del_bus(&vt586b_adapter); - release_region(I2C_DIR, IOSPACE); -} - - -MODULE_AUTHOR("Kyösti Mälkki "); -MODULE_DESCRIPTION("i2c for Via vt82c586b southbridge"); -MODULE_LICENSE("GPL"); - -module_init(i2c_vt586b_init); -module_exit(i2c_vt586b_exit); diff --git a/kernel/busses/i2c-viapro.c b/kernel/busses/i2c-viapro.c deleted file mode 100644 index 3a6d70f2..00000000 --- a/kernel/busses/i2c-viapro.c +++ /dev/null @@ -1,564 +0,0 @@ -/* - i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998 - 2002 Frodo Looijaard , - Philip Edelbrock , Kyösti Mälkki , - Mark D. Studebaker - Copyright (C) 2005 - 2007 Jean Delvare - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - Supports the following VIA south bridges: - - Chip name PCI ID REV I2C block - VT82C596A 0x3050 no - VT82C596B 0x3051 no - VT82C686A 0x3057 0x30 no - VT82C686B 0x3057 0x40 yes - VT8231 0x8235 no? - VT8233 0x3074 yes - VT8233A 0x3147 yes? - VT8235 0x3177 yes - VT8237R 0x3227 yes - VT8237A 0x3337 yes - VT8251 0x3287 yes - CX700 0x8324 yes - - Note: we assume there can only be one device, with one SMBus interface. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - -/* 8233A is undefined before kernel 2.4.19 */ -#ifndef PCI_DEVICE_ID_VIA_8233A -#define PCI_DEVICE_ID_VIA_8233A 0x3147 -#endif -/* 8235 is undefined before kernel 2.4.21 */ -#ifndef PCI_DEVICE_ID_VIA_8235 -#define PCI_DEVICE_ID_VIA_8235 0x3177 -#endif -/* 8237 is undefined before kernel 2.4.21 */ -#ifndef PCI_DEVICE_ID_VIA_8237 -#define PCI_DEVICE_ID_VIA_8237 0x3227 -#endif -/* 8237A is undefined */ -#ifndef PCI_DEVICE_ID_VIA_8237A -#define PCI_DEVICE_ID_VIA_8237A 0x3337 -#endif -/* 8251 is undefined */ -#ifndef PCI_DEVICE_ID_VIA_8251 -#define PCI_DEVICE_ID_VIA_8251 0x3287 -#endif -/* CX700 is undefined */ -#ifndef PCI_DEVICE_ID_VIA_CX700 -#define PCI_DEVICE_ID_VIA_CX700 0x8324 -#endif - -#define SMBBA1 0x90 -#define SMBBA2 0x80 -#define SMBBA3 0xD0 - -/* SMBus address offsets */ -static unsigned short vt596_smba; -#define SMBHSTSTS (vt596_smba + 0) -#define SMBHSTCNT (vt596_smba + 2) -#define SMBHSTCMD (vt596_smba + 3) -#define SMBHSTADD (vt596_smba + 4) -#define SMBHSTDAT0 (vt596_smba + 5) -#define SMBHSTDAT1 (vt596_smba + 6) -#define SMBBLKDAT (vt596_smba + 7) - -/* PCI Address Constants */ - -/* SMBus data in configuration space can be found in two places, - We try to select the better one */ - -static unsigned short SMBHSTCFG = 0xD2; - -/* Other settings */ -#define MAX_TIMEOUT 500 - -/* VT82C596 constants */ -#define VT596_QUICK 0x00 -#define VT596_BYTE 0x04 -#define VT596_BYTE_DATA 0x08 -#define VT596_WORD_DATA 0x0C -#define VT596_BLOCK_DATA 0x14 -#define VT596_I2C_BLOCK_DATA 0x34 - - -/* If force is set to anything different from 0, we forcibly enable the - VT596. DANGEROUS! */ -static int force; -MODULE_PARM(force, "i"); -MODULE_PARM_DESC(force, "Forcibly enable the SMBus. DANGEROUS!"); - -/* If force_addr is set to anything different from 0, we forcibly enable - the VT596 at the given address. VERY DANGEROUS! */ -static int force_addr; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Forcibly enable the SMBus at the given address. " - "EXTREMELY DANGEROUS!"); - - -static struct i2c_adapter vt596_adapter; - -#define FEATURE_I2CBLOCK (1<<0) -static unsigned int vt596_features; - -#ifdef DEBUG -static void vt596_dump_regs(const char *msg, u8 size) -{ - dev_dbg(&vt596_adapter, "%s: STS=%02x CNT=%02x CMD=%02x ADD=%02x " - "DAT=%02x,%02x\n", msg, inb_p(SMBHSTSTS), inb_p(SMBHSTCNT), - inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), - inb_p(SMBHSTDAT1)); - - if (size == VT596_BLOCK_DATA - || size == VT596_I2C_BLOCK_DATA) { - int i; - - dev_dbg(&vt596_adapter, "BLK="); - for (i = 0; i < I2C_SMBUS_BLOCK_MAX / 2; i++) - printk("%02x,", inb_p(SMBBLKDAT)); - printk("\n"); - dev_dbg(&vt596_adapter, " "); - for (; i < I2C_SMBUS_BLOCK_MAX - 1; i++) - printk("%02x,", inb_p(SMBBLKDAT)); - printk("%02x\n", inb_p(SMBBLKDAT)); - } -} -#else -static inline void vt596_dump_regs(const char *msg, u8 size) { } -#endif - -/* Return -1 on error, 0 on success */ -static int vt596_transaction(u8 size) -{ - int temp; - int result = 0; - int timeout = 0; - - vt596_dump_regs("Transaction (pre)", size); - - /* Make sure the SMBus host is ready to start transmitting */ - if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { - dev_dbg(&vt596_adapter, "SMBus busy (0x%02x). " - "Resetting...\n", temp); - - outb_p(temp, SMBHSTSTS); - if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { - dev_err(&vt596_adapter, "SMBus reset failed! " - "(0x%02x)\n", temp); - return -1; - } - } - - /* Start the transaction by setting bit 6 */ - outb_p(0x40 | size, SMBHSTCNT); - - /* We will always wait for a fraction of a second */ - do { - i2c_delay(1); - temp = inb_p(SMBHSTSTS); - } while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT)); - - /* If the SMBus is still busy, we give up */ - if (timeout >= MAX_TIMEOUT) { - result = -1; - dev_err(&vt596_adapter, "SMBus Timeout!\n"); - } - - if (temp & 0x10) { - result = -1; - dev_err(&vt596_adapter, "Transaction failed (0x%02x)\n", size); - } - - if (temp & 0x08) { - result = -1; - dev_err(&vt596_adapter, "SMBus collision!\n"); - } - - if (temp & 0x04) { - int read = inb_p(SMBHSTADD) & 0x01; - result = -1; - /* The quick and receive byte commands are used to probe - for chips, so errors are expected, and we don't want - to frighten the user. */ - if (!((size == VT596_QUICK && !read) || - (size == VT596_BYTE && read))) - dev_err(&vt596_adapter, "Transaction error!\n"); - } - - /* Resetting status register */ - if (temp & 0x1F) - outb_p(temp, SMBHSTSTS); - - vt596_dump_regs("Transaction (post)", size); - - return result; -} - -/* Return -1 on error, 0 on success */ -static s32 vt596_access(struct i2c_adapter *adap, u16 addr, - unsigned short flags, char read_write, u8 command, - int size, union i2c_smbus_data *data) -{ - int i; - - switch (size) { - case I2C_SMBUS_QUICK: - size = VT596_QUICK; - break; - case I2C_SMBUS_BYTE: - if (read_write == I2C_SMBUS_WRITE) - outb_p(command, SMBHSTCMD); - size = VT596_BYTE; - break; - case I2C_SMBUS_BYTE_DATA: - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) - outb_p(data->byte, SMBHSTDAT0); - size = VT596_BYTE_DATA; - break; - case I2C_SMBUS_WORD_DATA: - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) { - outb_p(data->word & 0xff, SMBHSTDAT0); - outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); - } - size = VT596_WORD_DATA; - break; - case I2C_SMBUS_I2C_BLOCK_DATA: - if (!(vt596_features & FEATURE_I2CBLOCK)) - goto exit_unsupported; - if (read_write == I2C_SMBUS_READ) - outb_p(I2C_SMBUS_BLOCK_MAX, SMBHSTDAT0); - /* Fall through */ - case I2C_SMBUS_BLOCK_DATA: - outb_p(command, SMBHSTCMD); - if (read_write == I2C_SMBUS_WRITE) { - u8 len = data->block[0]; - if (len > I2C_SMBUS_BLOCK_MAX) - len = I2C_SMBUS_BLOCK_MAX; - outb_p(len, SMBHSTDAT0); - inb_p(SMBHSTCNT); /* Reset SMBBLKDAT */ - for (i = 1; i <= len; i++) - outb_p(data->block[i], SMBBLKDAT); - } - size = (size == I2C_SMBUS_I2C_BLOCK_DATA) ? - VT596_I2C_BLOCK_DATA : VT596_BLOCK_DATA; - break; - default: - goto exit_unsupported; - } - - outb_p(((addr & 0x7f) << 1) | read_write, SMBHSTADD); - - if (vt596_transaction(size)) /* Error in transaction */ - return -1; - - if ((read_write == I2C_SMBUS_WRITE) || (size == VT596_QUICK)) - return 0; - - switch (size) { - case VT596_BYTE: - case VT596_BYTE_DATA: - data->byte = inb_p(SMBHSTDAT0); - break; - case VT596_WORD_DATA: - data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); - break; - case VT596_I2C_BLOCK_DATA: - case VT596_BLOCK_DATA: - data->block[0] = inb_p(SMBHSTDAT0); - if (data->block[0] > I2C_SMBUS_BLOCK_MAX) - data->block[0] = I2C_SMBUS_BLOCK_MAX; - inb_p(SMBHSTCNT); /* Reset SMBBLKDAT */ - for (i = 1; i <= data->block[0]; i++) - data->block[i] = inb_p(SMBBLKDAT); - break; - } - return 0; - -exit_unsupported: - dev_warn(&vt596_adapter, "Unsupported command invoked! (0x%02x)\n", - size); - return -1; -} - -static void vt596_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -static void vt596_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static u32 vt596_func(struct i2c_adapter *adapter) -{ - u32 func = I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA; - - if (vt596_features & FEATURE_I2CBLOCK) - func |= I2C_FUNC_SMBUS_I2C_BLOCK; - return func; -} - -static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, - .smbus_xfer = vt596_access, - .functionality = vt596_func, -}; - -static struct i2c_adapter vt596_adapter = { - .id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_VIA2, - .algo = &smbus_algorithm, - .inc_use = vt596_inc, - .dec_use = vt596_dec, -}; - -static int __init vt596_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - unsigned char temp; - int error = -ENODEV; - - /* Determine the address of the SMBus areas */ - if (force_addr) { - vt596_smba = force_addr & 0xfff0; - force = 0; - goto found; - } - - if ((pci_read_config_word(pdev, id->driver_data, &vt596_smba)) || - !(vt596_smba & 0x0001)) { - /* try 2nd address and config reg. for 596 */ - if (id->device == PCI_DEVICE_ID_VIA_82C596_3 && - !pci_read_config_word(pdev, SMBBA2, &vt596_smba) && - (vt596_smba & 0x0001)) { - SMBHSTCFG = 0x84; - } else { - /* no matches at all */ - dev_err(pdev, "Cannot configure " - "SMBus I/O Base address\n"); - return -ENODEV; - } - } - - vt596_smba &= 0xfff0; - if (vt596_smba == 0) { - dev_err(pdev, "SMBus base address " - "uninitialized - upgrade BIOS or use " - "force_addr=0xaddr\n"); - return -ENODEV; - } - -found: - if (!request_region(vt596_smba, 8, "viapro-smbus")) { - dev_err(pdev, "SMBus region 0x%x already in use!\n", - vt596_smba); - return -ENODEV; - } - - pci_read_config_byte(pdev, SMBHSTCFG, &temp); - /* If force_addr is set, we program the new address here. Just to make - sure, we disable the VT596 first. */ - if (force_addr) { - pci_write_config_byte(pdev, SMBHSTCFG, temp & 0xfe); - pci_write_config_word(pdev, id->driver_data, vt596_smba); - pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01); - dev_warn(pdev, "WARNING: SMBus interface set to new " - "address 0x%04x!\n", vt596_smba); - } else if (!(temp & 0x01)) { - if (force) { - /* NOTE: This assumes I/O space and other allocations - * WERE done by the Bios! Don't complain if your - * hardware does weird things after enabling this. - * :') Check for Bios updates before resorting to - * this. - */ - pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01); - dev_info(pdev, "Enabling SMBus device\n"); - } else { - dev_err(pdev, "SMBUS: Error: Host SMBus " - "controller not enabled! - upgrade BIOS or " - "use force=1\n"); - goto release_region; - } - } - - dev_dbg(pdev, "VT596_smba = 0x%X\n", vt596_smba); - - switch (id->device) { - case PCI_DEVICE_ID_VIA_CX700: - case PCI_DEVICE_ID_VIA_8251: - case PCI_DEVICE_ID_VIA_8237: - case PCI_DEVICE_ID_VIA_8237A: - case PCI_DEVICE_ID_VIA_8235: - case PCI_DEVICE_ID_VIA_8233A: - case PCI_DEVICE_ID_VIA_8233_0: - vt596_features |= FEATURE_I2CBLOCK; - break; - case PCI_DEVICE_ID_VIA_82C686_4: - /* The VT82C686B (rev 0x40) does support I2C block - transactions, but the VT82C686A (rev 0x30) doesn't */ - if (!pci_read_config_byte(pdev, PCI_REVISION_ID, &temp) - && temp >= 0x40) - vt596_features |= FEATURE_I2CBLOCK; - break; - } - - snprintf(vt596_adapter.name, 32, - "SMBus Via Pro adapter at %04x", vt596_smba); - - return i2c_add_adapter(&vt596_adapter); - -release_region: - release_region(vt596_smba, 8); - return error; -} - -static struct pci_device_id vt596_ids[] __initdata = { - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_82C596_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA1, - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_82C596B_3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA1, - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_82C686_4, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA1, - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_8233_0, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA3 - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_8233A, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA3, - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_8235, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA3 - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_8237, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA3 - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_8237A, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA3 - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_8231_4, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA1, - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_8251, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA3 - }, - { - .vendor = PCI_VENDOR_ID_VIA, - .device = PCI_DEVICE_ID_VIA_CX700, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .driver_data = SMBBA3 - }, - { 0, } -}; - -static int __init i2c_vt596_init(void) -{ - struct pci_dev *dev; - const struct pci_device_id *id; - - printk("i2c-viapro.o version %s (%s)\n", LM_VERSION, LM_DATE); - pci_for_each_dev(dev) { - id = pci_match_device(vt596_ids, dev); - if(id) - if(vt596_probe(dev, id) >= 0) - return 0; - } - return -ENODEV; -} - - -static void __exit i2c_vt596_exit(void) -{ - i2c_del_adapter(&vt596_adapter); - release_region(vt596_smba, 8); -} - -MODULE_AUTHOR("Kyosti Malkki , " - "Mark D. Studebaker and " - "Jean Delvare "); -MODULE_DESCRIPTION("vt82c596 SMBus driver"); -MODULE_LICENSE("GPL"); - -module_init(i2c_vt596_init); -module_exit(i2c_vt596_exit); diff --git a/kernel/busses/i2c-virtual.c b/kernel/busses/i2c-virtual.c deleted file mode 100644 index 7af5c1df..00000000 --- a/kernel/busses/i2c-virtual.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * i2c-virtual.c - Virtual I2C bus driver. - * - * Simplifies access to complex multiplexed I2C bus topologies, by presenting - * each multiplexed bus segment as a virtual I2C adapter. Supports multi-level - * mux'ing (mux behind a mux), as well as arbitration for exclusive bus access - * for those systems which require it (some bladed chassis for example). - * - * Copyright (c) 2004 Google, Inc. (Ken Harrenstien) - * - * Based on: - * i2c-virtual.c from Brian Kuschak - * which was: - * Adapted from i2c-adap-ibm_ocp.c - * Original file Copyright 2000-2002 MontaVista Software Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "i2c-virtual.h" -#include -#include -#include - -#include -#include -#include - -#ifdef DEBUG -# define DBG(x) x -#else -# define DBG(x) {} -#endif - -#define I2C_VIRT_PROCMAP 0 /* 1 for /proc/driver/i2c/virtual_i2c_map */ - -#define VIRT_TIMEOUT (HZ/2) /* 500msec */ -#define VIRT_RETRIES 3 - -/* exclusive access to the bus */ -#define I2C_LOCK(adap) down(&adap->bus) -#define I2C_UNLOCK(adap) up(&adap->bus) - -#if I2C_VIRT_PROCMAP -/* pointer to the list of i2c_bus_mappings */ -static LIST_HEAD(i2c_map_list); -struct i2c_bus_mapping { - struct i2c_adapter *parent; - struct i2c_adapter *virt; - unsigned long mux_addr; - unsigned long mux_val; - struct list_head list; -}; -static void *i2c_virt_add_map(struct i2c_adapter *parent, - struct i2c_adapter *virt, - unsigned long mux_addr, - unsigned long mux_val); -#endif - -/* First the I2C 'algorithm' driver code: */ - -/* - * Description: acquire exclusive access (if needed), select the mux, - * perform the transfer on the parent i2c adapter, deselect mux and drop - * exclusive access. - */ -static int -i2c_virt_master_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) -{ - struct i2c_virt_priv *priv = (struct i2c_virt_priv *)adap->data; - struct i2c_adapter *parent = priv->parent_adap; - int ret; - - -#ifdef I2C_REQUIRE_ARBITRATION - /* Acquire exclusive access to a shared I2C bus _before_ taking the - local I2C lock to prevent stalling local I2C transactions while - waiting for exclusive access. - */ - if(parent->algo->acquire_exclusive) - if ((ret = parent->algo->acquire_exclusive(parent)) < 0) - return ret; -#endif - /* Grab the lock for the parent adapter. We already hold the lock for - the virtual adapter. Then select the right mux port and perform - the transfer. - */ - DBG(printk(KERN_DEBUG "%s: Locking parent bus %0lX\n", - __FUNCTION__, (unsigned long)parent)); - I2C_LOCK(parent); - if ((ret = priv->mux.select(parent, &priv->mux)) == 0) { - ret = parent->algo->master_xfer(parent, msgs, num); - } - (void) priv->mux.deselect(parent, &priv->mux); - I2C_UNLOCK(parent); - DBG(printk(KERN_DEBUG "%s: Unlocked parent bus %0lX\n", - __FUNCTION__, (unsigned long)parent)); - -#ifdef I2C_REQUIRE_ARBITRATION - { - int ret2; - /* Release exclusive bus access */ - if(parent->algo->release_exclusive) - if ((ret2 = parent->algo->release_exclusive(parent)) < 0) - return ret2; - } -#endif - return ret; -} - -static int -i2c_virt_smbus_xfer(struct i2c_adapter *adap, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, union i2c_smbus_data * data) -{ - struct i2c_virt_priv *priv = (struct i2c_virt_priv *)adap->data; - struct i2c_adapter *parent = priv->parent_adap; - int ret; - -#ifdef I2C_REQUIRE_ARBITRATION - /* Acquire exclusive access to a shared I2C bus _before_ taking the - local I2C lock to prevent stalling local I2C transactions while - waiting for exclusive access. - */ - if(parent->algo->acquire_exclusive) - if ((ret = parent->algo->acquire_exclusive(parent)) < 0) - return ret; -#endif - /* Grab the lock for the parent adapter. We already hold the lock for - the virtual adapter. Then select the right mux port and perform - the transfer. - */ - DBG(printk(KERN_DEBUG "%s: Locking parent bus %0lX\n", - __FUNCTION__, (unsigned long)parent)); - I2C_LOCK(parent); - if ((ret = priv->mux.select(parent, &priv->mux)) == 0) { - ret = parent->algo->smbus_xfer(parent, addr, flags, - read_write, command, size, data); - } - (void) priv->mux.deselect(parent, &priv->mux); - I2C_UNLOCK(parent); - DBG(printk(KERN_DEBUG "%s: Unlocked parent bus %0lX\n", - __FUNCTION__, (unsigned long)parent)); - -#ifdef I2C_REQUIRE_ARBITRATION - { - int ret2; - /* Release exclusive bus access */ - if(parent->algo->release_exclusive) - if ((ret2 = parent->algo->release_exclusive(parent)) < 0) - return ret2; - } -#endif - return ret; -} - -/* - * Description: Implements device specific ioctls. - * We don't support any yet. - */ -static int -i2c_virt_algo_control(struct i2c_adapter *adap, unsigned int cmd, - unsigned long arg) -{ - return 0; -} - -/* Virtual adapter functionality; returns functionality of parent adapter. - * OK if parent itself is virtual, as this will go all the way up to the - * real adapter. - */ -static u32 -i2c_virt_functionality(struct i2c_adapter *adap) -{ - struct i2c_virt_priv *priv = (struct i2c_virt_priv *)adap->data; - struct i2c_adapter *parent = priv->parent_adap; - - return parent->algo->functionality(parent); -} - -/* ===================================================================== */ - -/* The 'adapter' driver code: */ - -static int -i2c_virt_reg(struct i2c_client *client) -{ - return 0; -} -static int -i2c_virt_unreg(struct i2c_client *client) -{ - return 0; -} - - -/* - * Called to create a 'virtual' i2c bus which represents a multiplexed bus - * segment. Client and mux_val are passed to the select and deselect - * callback functions to perform hardware-specific mux control. - */ -struct i2c_adapter *i2c_virt_create_adapter(struct i2c_adapter *parent_adap, - struct i2c_client *client, - unsigned long mux_val, - void *select_cb, - void *deselect_cb) -{ - struct i2c_adapter *adap; - struct i2c_virt_priv *priv; - struct i2c_algorithm *algo; - - if (!(adap = kmalloc(sizeof (struct i2c_adapter) - + sizeof(struct i2c_virt_priv) - + sizeof(struct i2c_algorithm), - GFP_KERNEL))) { - printk(KERN_ERR "i2c_virt_register_adap: Failed allocation\n"); - return NULL; - } - - memset(adap, 0, sizeof(struct i2c_adapter) - + sizeof(struct i2c_virt_priv) - + sizeof(struct i2c_algorithm)); - priv = (struct i2c_virt_priv *) (adap+1); - algo = (struct i2c_algorithm *) (priv+1); - - /* Set up private adapter data */ - priv->parent_adap = parent_adap; - priv->mux.client = client; - priv->mux.addr = client->addr; - priv->mux.value = mux_val; - priv->mux.select = select_cb; - priv->mux.deselect = deselect_cb; - - /* Need to do algo dynamically because we don't know ahead - of time what sort of physical adapter we'll be dealing with. - */ - algo->id = I2C_ALGO_VIRT; - strcpy(algo->name, "Virtual I2C algorithm driver"); - algo->master_xfer = (parent_adap->algo->master_xfer - ? i2c_virt_master_xfer : NULL); - algo->smbus_xfer = (parent_adap->algo->smbus_xfer - ? i2c_virt_smbus_xfer : NULL); - algo->slave_send = NULL; - algo->slave_recv = NULL; - algo->algo_control = i2c_virt_algo_control; - algo->functionality = i2c_virt_functionality; -#ifdef I2C_REQUIRE_ARBITRATION - algo->acquire_exclusive = NULL; - algo->release_exclusive = NULL; -#endif - - /* Now fill out new adapter structure */ - adap->inc_use = NULL; - adap->dec_use = NULL; - snprintf(adap->name, sizeof(adap->name), - "Virtual I2C (i2c-%d, mux %02lx:%02lx)", - i2c_adapter_id(parent_adap), - (unsigned long)client->addr, mux_val); - adap->id = I2C_HW_VIRT | algo->id; - adap->algo = algo; - adap->algo_data = NULL; /* XXX: Use this?? */ - adap->client_register = i2c_virt_reg; - adap->client_unregister = i2c_virt_unreg; - adap->data = priv; - adap->flags = 0; - adap->timeout = VIRT_TIMEOUT; - adap->retries = VIRT_RETRIES; - - DBG(printk(KERN_DEBUG "%s: Adding virt bus %0lX\n", - __FUNCTION__, (unsigned long)adap)); - - if (i2c_add_adapter_nolock(adap) < 0) { - kfree(adap); - return NULL; - } - - printk(KERN_NOTICE "i2c%d: Virtual I2C bus " - "(Physical bus i2c%d, multiplexer %02lx port %ld)\n", - i2c_adapter_id(adap), i2c_adapter_id(parent_adap), - priv->mux.addr, mux_val); - -#if I2C_VIRT_PROCMAP - i2c_virt_add_map(priv->parent_adap, adap, - priv->mux.addr, priv->value); -#endif - - MOD_INC_USE_COUNT; - DBG(printk(KERN_DEBUG "%s: Added virt bus %0lX\n", - __FUNCTION__, (unsigned long)adap)); - - return adap; -} - -int i2c_virt_remove_adapter(struct i2c_adapter *adap) -{ - int ret; - - DBG(printk(KERN_DEBUG "%s: Removing virt bus %0lX\n", - __FUNCTION__, (unsigned long)adap)); - - if ((ret = i2c_del_adapter_nolock(adap)) < 0) - return ret; - kfree(adap); - - MOD_DEC_USE_COUNT; - return 0; -} - - -/* ------------------------------------------------------------------ */ - -#if I2C_VIRT_PROCMAP -/* Dubious stuff to implement a /proc/driver/i2c/virtual_i2c_map - * listing of all virtual busses. - * - * XXX: LOCKING??? - */ -static int i2c_virt_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - int len; - char *buf = page; - struct list_head *l; - struct i2c_bus_mapping *pmap; - - /* XXX: BUFFER BOUNDS CHECKING? */ - - buf += sprintf(buf, "i2c bus_mapping\n"); - - list_for_each(l, &i2c_map_list) { - pmap = list_entry(l, struct i2c_bus_mapping, list); - - if(pmap) - buf += sprintf(buf, "base=iic%d mux_addr=%02hx, mux_val=%02hx => iic%d\n", - i2c_adapter_id(pmap->parent), - pmap->mux_addr, pmap->mux_val, - i2c_adapter_id(pmap->virt)); - } - - len = buf - page; - if (len <= off+count) *eof = 1; - *start = page + off; - len -= off; - if (len>count) len = count; - if (len<0) len = 0; - return len; -} - - -static void *i2c_virt_add_map(struct i2c_adapter *parent, - struct i2c_adapter *virt, - unsigned long mux_addr, - unsigned long mux_val) -{ - struct i2c_bus_mapping *pmap; - - if((pmap = kmalloc(sizeof(struct i2c_bus_mapping), GFP_KERNEL)) - == NULL) { - printk(KERN_ERR "%s: Failed to allocate bus mapping\n", - __FUNCTION__); - return; - } - pmap->virt = virt; - pmap->parent = parent; - pmap->mux_addr = mux_addr; - pmap->mux_val = mux_val; - - if (list_empty(&i2c_map_list)) { - /* If first time, ensure proc entry exists */ - /* XXX: Maybe do this with module_init() */ - create_proc_read_entry("driver/i2c/virtual_i2c_map", 0, NULL, - &i2c_virt_read_proc, NULL); - } - list_add_tail(&pmap->list, &i2c_map_list); -} - - -#if 0 /* Not used by anything, but kept for a while in case */ - -/* Called to find out which i2c bus to use to get to a specific bus segment. - */ -struct i2c_adapter *i2c_lookup_adapter(struct i2c_adapter *base, - unsigned long mux_addr, - unsigned long mux_val) -{ - struct list_head *l; - struct i2c_bus_mapping *pmap; - - list_for_each(l, &i2c_map_list) { - pmap = list_entry(l, struct i2c_bus_mapping, list); - if(pmap->parent == base - && pmap->mux_addr == mux_addr - && pmap->mux_val == mux_val) - return pmap->virt; - } - return NULL; /* none found */ -} - -EXPORT_SYMBOL(i2c_lookup_adapter); -#endif /* 0 */ - - -#endif /* I2C_VIRT_PROCMAP */ - -EXPORT_SYMBOL(i2c_virt_create_adapter); -EXPORT_SYMBOL(i2c_virt_remove_adapter); - -MODULE_AUTHOR("Ken Harrenstien (from Brian Kuschak)"); -MODULE_DESCRIPTION("Virtual I2C driver for multiplexed I2C busses"); -MODULE_LICENSE("GPL"); diff --git a/kernel/busses/i2c-voodoo3.c b/kernel/busses/i2c-voodoo3.c deleted file mode 100644 index 567ba9ea..00000000 --- a/kernel/busses/i2c-voodoo3.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - voodoo3.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard , - Philip Edelbrock , - Ralph Metzler , and - Mark D. Studebaker - - Based on code written by Ralph Metzler and - Simon Vogl - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* This interfaces to the I2C bus of the Voodoo3 to gain access to - the BT869 and possibly other I2C devices. */ - -#include -#include -#include -#include -#include -#include -#include /* for HZ */ -#include "version.h" -#include "sensors_compat.h" - -MODULE_LICENSE("GPL"); - -/* the only registers we use */ -#define REG 0x78 -#define REG2 0x70 - -/* bit locations in the register */ -#define DDC_ENAB 0x00040000 -#define DDC_SCL_OUT 0x00080000 -#define DDC_SDA_OUT 0x00100000 -#define DDC_SCL_IN 0x00200000 -#define DDC_SDA_IN 0x00400000 -#define I2C_ENAB 0x00800000 -#define I2C_SCL_OUT 0x01000000 -#define I2C_SDA_OUT 0x02000000 -#define I2C_SCL_IN 0x04000000 -#define I2C_SDA_IN 0x08000000 - -/* initialization states */ -#define INIT2 0x2 -#define INIT3 0x4 - -/* delays */ -#define CYCLE_DELAY 10 -#define TIMEOUT (HZ / 2) - - -static void config_v3(struct pci_dev *dev); - -static unsigned long ioaddr; - -/* The voo GPIO registers don't have individual masks for each bit - so we always have to read before writing. */ - -static void bit_vooi2c_setscl(void *data, int val) -{ - unsigned int r; - r = readl(ioaddr + REG); - if(val) - r |= I2C_SCL_OUT; - else - r &= ~I2C_SCL_OUT; - writel(r, ioaddr + REG); - readl(ioaddr + REG); /* flush posted write */ -} - -static void bit_vooi2c_setsda(void *data, int val) -{ - unsigned int r; - r = readl(ioaddr + REG); - if(val) - r |= I2C_SDA_OUT; - else - r &= ~I2C_SDA_OUT; - writel(r, ioaddr + REG); - readl(ioaddr + REG); /* flush posted write */ -} - -/* The GPIO pins are open drain, so the pins always remain outputs. - We rely on the i2c-algo-bit routines to set the pins high before - reading the input from other chips. */ - -static int bit_vooi2c_getscl(void *data) -{ - return (0 != (readl(ioaddr + REG) & I2C_SCL_IN)); -} - -static int bit_vooi2c_getsda(void *data) -{ - return (0 != (readl(ioaddr + REG) & I2C_SDA_IN)); -} - -static void bit_vooddc_setscl(void *data, int val) -{ - unsigned int r; - r = readl(ioaddr + REG); - if(val) - r |= DDC_SCL_OUT; - else - r &= ~DDC_SCL_OUT; - writel(r, ioaddr + REG); - readl(ioaddr + REG); /* flush posted write */ -} - -static void bit_vooddc_setsda(void *data, int val) -{ - unsigned int r; - r = readl(ioaddr + REG); - if(val) - r |= DDC_SDA_OUT; - else - r &= ~DDC_SDA_OUT; - writel(r, ioaddr + REG); - readl(ioaddr + REG); /* flush posted write */ -} - -static int bit_vooddc_getscl(void *data) -{ - return (0 != (readl(ioaddr + REG) & DDC_SCL_IN)); -} - -static int bit_vooddc_getsda(void *data) -{ - return (0 != (readl(ioaddr + REG) & DDC_SDA_IN)); -} - - -/* Configures the chip */ - -void config_v3(struct pci_dev *dev) -{ - unsigned int cadr; - - /* map Voodoo3 memory */ - cadr = dev->resource[0].start; - cadr &= PCI_BASE_ADDRESS_MEM_MASK; - ioaddr = (unsigned long)ioremap_nocache(cadr, 0x1000); - if(ioaddr) { - writel(0x8160, ioaddr + REG2); - writel(0xcffc0020, ioaddr + REG); - printk("i2c-voodoo3: Using Banshee/Voodoo3 at 0x%lx\n", ioaddr); - } -} - -static void voodoo3_inc(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_INC_USE_COUNT; -#endif -} - -void voodoo3_dec(struct i2c_adapter *adapter) -{ -#ifdef MODULE - MOD_DEC_USE_COUNT; -#endif -} - -static struct i2c_algo_bit_data voo_i2c_bit_data = { - .setsda = bit_vooi2c_setsda, - .setscl = bit_vooi2c_setscl, - .getsda = bit_vooi2c_getsda, - .getscl = bit_vooi2c_getscl, - .udelay = CYCLE_DELAY, - .mdelay = CYCLE_DELAY, - .timeout = TIMEOUT -}; - -static struct i2c_adapter voodoo3_i2c_adapter = { - .name = "I2C Voodoo3/Banshee adapter", - .id = I2C_HW_B_VOO, - .algo_data = &voo_i2c_bit_data, - .inc_use = voodoo3_inc, - .dec_use = voodoo3_dec, -}; - -static struct i2c_algo_bit_data voo_ddc_bit_data = { - .setsda = bit_vooddc_setsda, - .setscl = bit_vooddc_setscl, - .getsda = bit_vooddc_getsda, - .getscl = bit_vooddc_getscl, - .udelay = CYCLE_DELAY, - .mdelay = CYCLE_DELAY, - .timeout = TIMEOUT -}; - -static struct i2c_adapter voodoo3_ddc_adapter = { - .name = "DDC Voodoo3/Banshee adapter", - .id = I2C_HW_B_VOO, - .algo_data = &voo_ddc_bit_data, - .inc_use = voodoo3_inc, - .dec_use = voodoo3_dec, -}; - - -static struct pci_device_id voodoo3_ids[] __devinitdata = { - { - .vendor = PCI_VENDOR_ID_3DFX, - .device = PCI_DEVICE_ID_3DFX_VOODOO3, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { - .vendor = PCI_VENDOR_ID_3DFX, - .device = PCI_DEVICE_ID_3DFX_BANSHEE, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - }, - { 0, } -}; - -static int __devinit voodoo3_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - int retval; - - config_v3(dev); - retval = i2c_bit_add_bus(&voodoo3_i2c_adapter); - if(retval) - return retval; - retval = i2c_bit_add_bus(&voodoo3_ddc_adapter); - if(retval) - i2c_bit_del_bus(&voodoo3_i2c_adapter); - return retval; -} - -static void __devexit voodoo3_remove(struct pci_dev *dev) -{ - i2c_bit_del_bus(&voodoo3_i2c_adapter); - i2c_bit_del_bus(&voodoo3_ddc_adapter); -} - - -/* Don't register driver to avoid driver conflicts */ -/* -static struct pci_driver voodoo3_driver = { - .name = "voodoo3 smbus", - .id_table = voodoo3_ids, - .probe = voodoo3_probe, - .remove = __devexit_p(voodoo3_remove), -}; -*/ - -static int __init i2c_voodoo3_init(void) -{ - struct pci_dev *dev; - const struct pci_device_id *id; - - printk("i2c-voodoo3.o version %s (%s)\n", LM_VERSION, LM_DATE); -/* - return pci_module_init(&voodoo3_driver); -*/ - pci_for_each_dev(dev) { - id = pci_match_device(voodoo3_ids, dev); - if(id) - if(voodoo3_probe(dev, id) >= 0) - return 0; - } - return -ENODEV; -} - - -static void __exit i2c_voodoo3_exit(void) -{ -/* - pci_unregister_driver(&voodoo3_driver); -*/ - voodoo3_remove(NULL); - iounmap((void *)ioaddr); -} - - -MODULE_AUTHOR - ("Frodo Looijaard , Philip Edelbrock , Ralph Metzler , and Mark D. Studebaker "); -MODULE_DESCRIPTION("Voodoo3 I2C/SMBus driver"); - -module_init(i2c_voodoo3_init); -module_exit(i2c_voodoo3_exit); diff --git a/kernel/chips/pca954x.c b/kernel/chips/pca954x.c deleted file mode 100644 index 7e1cbb9d..00000000 --- a/kernel/chips/pca954x.c +++ /dev/null @@ -1,836 +0,0 @@ -/* - * pca954x.c - Part of lm_sensors, Linux kernel modules for hardware - * monitoring - * This module supports the PCA954x series of I2C multiplexer/switch chips - * made by Philips Semiconductors. This includes the - * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, and PCA9548. - * - * Copyright (c) 2004 Google, Inc. (Ken Harrenstien) - * - * Based on: - * i2c-virtual_cb.c from Brian Kuschak - * and - * pca9540.c from Jean Delvare , which was - * based on pcf8574.c from the same project by Frodo Looijaard, - * Philip Edelbrock, Dan Eaton and Aurelien Jarno. - * - * These chips are all controlled via the I2C bus itself, and all have a - * single 8-bit register (normally at 0x70). The upstream "parent" bus fans - * out to two, four, or eight downstream busses or channels; which of these - * are selected is determined by the chip type and register contents. A - * mux can select only one sub-bus at a time; a switch can select any - * combination simultaneously. - * - * See Documentation/i2c/virtual_i2c for details on the virtual bus/adapter - * mechanism. - * - ********************************************************************* - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include "i2c-virtual.h" -#include "version.h" - -MODULE_LICENSE("GPL"); - -#define DEBUG 1 /* XXX: Comment out before release? */ -#ifdef DEBUG -# define DBG(x) if (pca954x_debug > 0) { x; } else -#else -# define DBG(x) {} -#endif - -#define PCA954X_NCHANS 8 /* Max # of channels (PCA9548) */ - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { /*0x70,*/ SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod/modprobe parameters */ - -/* Chip type must normally be specified using a parameter of the form - "force_pca9544=0,0x70" - The following declares the possible types. -*/ -SENSORS_INSMOD_7(pca9540,pca9542,pca9543,pca9544,pca9545,pca9546,pca9548); - -static int pca954x_debug; -MODULE_PARM(pca954x_debug, "i"); -MODULE_PARM_DESC(pca954x_debug, "Debug output level (0 = none)"); - -#if 0 /* Considered adding this, but too many issues. See doc. */ -static int pca954x_selmask[32]; /* Max # chips supported, sigh */ -MODULE_PARM(pca954x_selmask, "1-32i"); -MODULE_PARM_DESC(pca954x_selmask, "List of selmask settings for each mux/swi"); -#endif - -/* Provide specs for the PCA954x types we know about - */ -static struct pca954x_chipdef { - enum chips type; - const char *type_name; - int pcanum; - int nchans; - enum muxtype { pca954x_ismux=0, pca954x_isswi } muxtype; -} pca954x_chipdefs[] = { - { pca9540, "pca9540", 9540, 2, pca954x_ismux }, - { pca9542, "pca9542", 9542, 2, pca954x_ismux }, - { pca9543, "pca9543", 9543, 2, pca954x_isswi }, - { pca9544, "pca9544", 9544, 4, pca954x_ismux }, - { pca9545, "pca9545", 9545, 4, pca954x_isswi }, - { pca9546, "pca9546", 9546, 4, pca954x_isswi }, - { pca9548, "pca9548", 9548, 8, pca954x_isswi }, -}; -#define PCA954X_MUX_ENA 0x04 /* Mux enable bit */ - -/* Each client has this additional data. - Note the two conventions for identifying a chip's channel (sub-bus): - "channel" 0 to N-1, where N is the number of channels supported - "bitmask" 1 to 1 << N-1, so bit 0 is channel 0. - This use of "channel" is consistent with that in the Philips PCA954X doc. - */ -struct pca954x_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - enum muxtype muxtype; - int pcanum; /* PCA chip number */ - int nchans; /* # of channels (busses) this chip controls */ - int nchmask; /* Mask of all channels */ - - struct semaphore update_lock; - int selmask; /* Bitmask of chans OK to leave on (chn1 == bit0) */ - int curmask; /* Bitmask of chans currently selected */ - - u8 regval; /* Current chip register value */ - u8 origval; /* Original value at initialization */ - - struct i2c_adapter *virt_adapters[PCA954X_NCHANS]; -}; - -static int pca954x_attach_adapter(struct i2c_adapter *adapter); -static int pca954x_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int pca954x_detach_client(struct i2c_client *client); -static void pca954x_pe_busses(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pca954x_pe_debug(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pca954x_pe_regval(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pca954x_pe_selbus(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pca954x_pe_selmask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pca954x_pe_type(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pca954x_set_selmask(struct i2c_client *client, int mask); -static u8 pca954x_mask2val(struct i2c_client *client, int mask); -static int pca954x_val2mask(struct i2c_client *client, u8 val); - -static int pca954x_select_mux(struct i2c_adapter *adap, - struct i2c_mux_ctrl *mux); -static int pca954x_deselect_mux(struct i2c_adapter *adap, - struct i2c_mux_ctrl *mux); -static int pca954x_select_chan(struct i2c_adapter *adap, - struct i2c_client *client, unsigned long chan); -static int pca954x_xfer(struct i2c_adapter *adap, - struct i2c_client *client, - int read_write, u8 *val); - - -/* This is the driver that will be inserted */ -static struct i2c_driver pca954x_driver = { - .name = "PCA954X I2C mux/switch driver", - .flags = I2C_DF_NOTIFY, - .attach_adapter = pca954x_attach_adapter, - .detach_client = pca954x_detach_client, -}; - - -/* -- SENSORS SYSCTL START -- */ - -#define PCA954X_SYSCTL_BUSSES 1000 -#define PCA954X_SYSCTL_DEBUG 1001 -#define PCA954X_SYSCTL_REGVAL 1002 -#define PCA954X_SYSCTL_SELBUS 1003 -#define PCA954X_SYSCTL_SELMASK 1004 -#define PCA954X_SYSCTL_TYPE 1005 - -/* -- SENSORS SYSCTL END -- */ - -static ctl_table pca954x_dir_table_template[] = { - {PCA954X_SYSCTL_BUSSES, "busses", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pca954x_pe_busses}, - {PCA954X_SYSCTL_DEBUG, "debug", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pca954x_pe_debug}, - {PCA954X_SYSCTL_REGVAL, "regval", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pca954x_pe_regval}, - {PCA954X_SYSCTL_SELBUS, "selbus", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pca954x_pe_selbus}, - {PCA954X_SYSCTL_SELMASK, "selmask", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pca954x_pe_selmask}, - {PCA954X_SYSCTL_TYPE, "type", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pca954x_pe_type}, - {0} -}; - -static int pca954x_id = 0; - -static int __init pca954x_init(void) -{ - printk("pca954x.o version %s (%s)\n", LM_VERSION, LM_DATE); - - /* Because we've set I2C_DF_NOTIFY in our driver struct, - * this call results in calling pca954x_attach_adapter() for - * every adapter currently known, both real and virtual. - */ - return i2c_add_driver(&pca954x_driver); -} - -static void __exit pca954x_exit(void) -{ - i2c_del_driver(&pca954x_driver); -} - -/* This function is called whenever a new bus/adapter is added, OR when - the driver itself is added (for all existing adapters), to see if - the driver can find a chip address it's responsible for. - */ -static int pca954x_attach_adapter(struct i2c_adapter *adapter) -{ - DBG(printk(KERN_DEBUG "%s: %0lX\n", - __FUNCTION__, (unsigned long)adapter)); - - /* Apply standard lookup via parameters or probing. - "addr_data" is defined by the SENSORS_INSMOD_n macro. - */ - return i2c_detect(adapter, &addr_data, pca954x_detect); -} - -/* This function is called by i2c_detect and must be of type - "i2c_found_addr_proc" as defined in i2c-proc.h. - For the PCA954x series this should only happen due to "force" parameters - given to insmod/modprobe, as there is no way to autodetect what flavor - of chip we have (and the differences matter!) - - Thus, we should never get a "kind" of -1. - - Note the unique potential for infinite recursion here because we are - creating new adapters (one for each muxed virtual bus). This will cause - our attach_adapter() function to be called twice for each new adapter, - because: - - (1) The call to i2c_add_adapter results in calling the attach_adapter() - function of all known chip drivers, including this one. - - (2) Because normally this is first called via i2c_add_driver calling - i2c_add_adapter, each new virtual bus/adapter created here will create - a new entry in i2c-core's master adapter list at a point that hasn't - yet been reached by i2c_add_driver's scan, and thus i2c_add_driver - will cause yet another call to our attach_adapter for each of these - new bus/adapters. - - Each call to our attach_adapter() causes another call to i2c_detect, - which would detect the mux all over again if an actual probe was made. - - This is prevented in two ways. The first line of defense is - i2c_check_addr() which is called by both i2c-proc.c:i2c_detect() - and i2c-core.c:i2c_probe() to make sure a bus/addr pair has not already - been seen; that function now knows how to verify this on all parent - busses as well. - - The second line of defense is to never put anything in the "normal_i2c" - or "normal_i2c_range" tables that would induce i2c_detect() to probe - a PCA954x address. - */ -int pca954x_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i, n; - struct i2c_client *client; - struct pca954x_data *data; - const char *type_name = ""; - int err = 0; - - DBG(printk(KERN_DEBUG "%s: %0lX %0x %0x %d\n", - __FUNCTION__, (unsigned long)adapter, - address, flags, kind)); - - /* XXX: Remove this after verifying that no more recursion - is happening! - */ - if (adapter->algo->id == I2C_ALGO_VIRT) { - - printk(KERN_ERR "%s: Avoiding recursion! %0lX %0x %0x %d\n", - __FUNCTION__, (unsigned long)adapter, - address, flags, kind); - goto ERROR0; - } - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. */ - if (!(data = kmalloc(sizeof(struct pca954x_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - memset(data, 0, sizeof(struct pca954x_data)); - - client = &data->client; - client->addr = address; - client->data = data; - client->adapter = adapter; - client->driver = &pca954x_driver; - client->flags = 0; - - /* The detection is very weak. In fact, we have no way of - * telling what kind of mux/swi is there, and the differences matter, - * so if asked to figure it out we just complain instead. - */ - if (kind < 0) { - printk(KERN_ERR "%s: Attempted ill-advised probe at addr %0x", - __FUNCTION__, address); - goto ERROR1; - } - - /* Read the mux register at addr. This does two things: it verifies - that the mux is in fact present, and fetches its current - contents for possible use with a future deselect algorithm. - */ - if ((i = i2c_smbus_read_byte(client)) < 0) { - printk(KERN_WARNING - "i2c-%d: pca954x.o failed to read reg at %0x", - i2c_adapter_id(adapter), address); - goto ERROR1; - } - data->origval = i; - - if (kind == any_chip) { - printk(KERN_WARNING - "i2c-%d: pca954x.o needs advice on chip type -" - " wildly guessing %0x is a PCA9540", - i2c_adapter_id(adapter), address); - kind = pca9540; /* Make "any" default to PCA9540 */ - } - - /* Look up in table */ - for (i = sizeof(pca954x_chipdefs)/sizeof(pca954x_chipdefs[0]); - --i >= 0;) { - if (pca954x_chipdefs[i].type == kind) - break; - } - if (i < 0) { - printk(KERN_ERR "%s: Internal error: unknown kind (%d)", - __FUNCTION__, kind); - goto ERROR1; - } - data->type = kind; - type_name = pca954x_chipdefs[i].type_name; - data->pcanum = pca954x_chipdefs[i].pcanum; - data->nchans = pca954x_chipdefs[i].nchans; - data->muxtype = pca954x_chipdefs[i].muxtype; - data->nchmask = (1 << data->nchans) - 1; - - /* Now that we know the mux/swi type, we can analyze the - pca954x_selmask parameter, if one was specified. - - XXX: Not yet. Still uncertain whether there is a good way - to initialize selmask and still continue to detect other chips - correctly on the right busses, or whether the original reg - setting (origval) should be retained in case BIOS depends on it. - */ - - /* Fill in remaining client fields and put it into the global list */ - snprintf(client->name, sizeof(client->name), - "PCA%d I2C %d-chan %s chip", - data->pcanum, data->nchans, - (data->muxtype == pca954x_ismux ? "mux" : "switch")); - client->id = pca954x_id++; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(client))) - goto ERROR1; - - /* Register new /proc directory entries with module sensors */ - if ((i = i2c_register_entry(client, type_name, - pca954x_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR2; - } - data->sysctl_id = i; - - /* Initialize the PCA954X chip. - For now, force unselected. This had better happen BEFORE any - other sensors modules are loaded, or their chip addresses will - stop working if they were actually behind the mux chip. - */ - pca954x_set_selmask(client, 0); - - /* Now create virtual busses and adapters for them */ - -#ifdef I2C_REQUIRE_ARBITRATION - /* This doesn't actually do anything yet; kept as a - placeholder from the original i2c-virtual_cb.c - */ - adapter->algo->acquire_exclusive = &acquire_shared_bus; - adapter->algo->release_exclusive = &release_shared_bus; -#endif - - DBG(printk(KERN_DEBUG "%s: creating %d virt busses\n", - __FUNCTION__, data->nchans)); - - for (i = 0, n = 0; i < data->nchans; ++i) { - struct i2c_adapter *virt; - virt = i2c_virt_create_adapter(adapter, client, i, - &pca954x_select_mux, - &pca954x_deselect_mux); - if ((data->virt_adapters[i] = virt) != NULL) - ++n; - } - printk("i2c-%d: Registered %d of %d virtual busses for I2C mux %s\n", - i2c_adapter_id(adapter), n, i, type_name); - - return 0; - - ERROR2: - i2c_detach_client(client); - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int pca954x_detach_client(struct i2c_client *client) -{ - struct pca954x_data *data = (struct pca954x_data *)(client->data); - int i, err; - - DBG(printk(KERN_DEBUG "%s: %0lX\n", - __FUNCTION__, (unsigned long)client)); - - /* Must flush everything attached to our channels! - */ - for (i = 0; i < data->nchans; ++i) { - if (data->virt_adapters[i]) { - err = i2c_virt_remove_adapter(data->virt_adapters[i]); - if (err != 0) { - printk(KERN_ERR "pca954x.o: Bus deregistration failed, " - "client not detached.\n"); - return err; - } - data->virt_adapters[i] = NULL; - } - } - - i2c_deregister_entry(data->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR "pca954x.o: Client deregistration failed, " - "client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -/* Implement /proc "regval" - the actual contents of the chip register. - * This is READ-ONLY. - */ -void pca954x_pe_regval(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct pca954x_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { -#if 0 /* XXX: For now, always use cached value */ - static void pca954x_update_client(struct i2c_client *client); - pca954x_update_client(client); -#endif - results[0] = data->regval; - *nrels_mag = 1; - } -} - -/* Implement /proc "debug" - a non-zero value enables debug output, if - * the code was compiled with it. This actually applies to all mux chips, - * not just a single instance, but that's OK. - */ -void pca954x_pe_debug(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = pca954x_debug; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - pca954x_debug = results[0]; - } - } -} - -/* Implement /proc "busses" - list of (virtual) adapter IDs that constitute - the busses that this chip connects to. - This is READ-ONLY. - */ -void pca954x_pe_busses(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct pca954x_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - int i, lasti; - if ((lasti = data->nchans) > *nrels_mag) - lasti = *nrels_mag; - for (i = 0; i < lasti; ++i) { - results[i] = i2c_adapter_id(data->virt_adapters[i]); - } - *nrels_mag = lasti; - } -} - -/* Implement /proc "selmask" - the value specifies the current default - * channel mask. Sub-bus 0 == bit 0. - # A value of 0 means "none" - */ -void pca954x_pe_selmask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct pca954x_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->selmask; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - pca954x_set_selmask(client, results[0]); - } - } -} - - -/* Implement /proc "selbus" - the list of values is considered to be virtual - adapter IDs, as an alternative representation of the select mask. - No values at all means "none". - */ -void pca954x_pe_selbus(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct pca954x_data *data = client->data; - int i, nres; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - for (i = 0, nres = 0; i < data->nchans; ++i) { - if ((data->selmask & (1<virt_adapters[i]); - ++nres; - } - } - *nrels_mag = nres; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - int newmask = 0; - for (nres = 0; nres < *nrels_mag; ++nres) { - /* Ugly, but shouldn't happen very often */ - for (i = 0; i < data->nchans; ++i) { - if (results[nres] - == i2c_adapter_id(data->virt_adapters[i])) { - newmask |= (1<data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - if (*nrels_mag >= 3) { - results[0] = data->pcanum; - results[1] = data->muxtype; - results[2] = data->nchans; - *nrels_mag = 3; - } - } -} - - -/* Set default select mask. - Since this can be executed while something else is using the mux or - one of its sub-busses, the main consideration is making sure we don't - mess up anything in progress. - - This is accomplished by locking the parent bus that the mux resides on, - and then calling our internal write function. - - It would not work to just call i2c_smbus_write_byte() because - by the time that returns, the values we're trying to update - could already be wrong. This can happen if something else grabs - the bus and writes to the mux (eg for doing I/O to a sub-bus - device), leading to a race condition for updating - selmask, regval, and curmask. - - It doesn't help to use an update_lock for those values because - you still have to contend with other threads trying to select - sub-busses and would encounter deadlocks. - - */ -static void pca954x_set_selmask(struct i2c_client *client, int mask) -{ - struct pca954x_data *data = client->data; - - DBG(printk(KERN_DEBUG - "%s: Locking bus %d mux %d (%0lX) " - "for write of selmask %0x\n", - __FUNCTION__, i2c_adapter_id(client->adapter), - client->id, (unsigned long)client, mask)); - - down(&client->adapter->bus); - DBG(printk(KERN_DEBUG "%s: Starting write.\n", __FUNCTION__)); - data->selmask = (mask & data->nchmask); - (void) pca954x_select_chan(client->adapter, client, -1); - up(&client->adapter->bus); - - DBG(printk(KERN_DEBUG "%s: Unlocked mux (%0lX) for write.\n", - __FUNCTION__, (unsigned long)client)); -} - -#if 0 /* Not needed at the moment; see pca954x_pe_regval() */ - -/* Read pca954x register into cached value - */ -static void pca954x_update_client(struct i2c_client *client) -{ - struct pca954x_data *data = client->data; - - DBG(printk(KERN_DEBUG - "%s: Locking bus %d mux %d (%0lX) for read\n", - __FUNCTION__, i2c_adapter_id(client->adapter), - client->id, (unsigned long)client)); - - down(&client->adapter->bus); - DBG(printk(KERN_DEBUG "%s: Starting read.\n", __FUNCTION__)); - pca954x_xfer(client->adapter, client, I2C_SMBUS_READ, &data->regval); - data->curmask = pca954x_val2mask(client, data->regval); - up(&client->adapter->bus); - - DBG(printk(KERN_DEBUG "%s: Unlocked mux (%0lX) for read.\n", - __FUNCTION__, (unsigned long)client)); -} -#endif - - -static u8 pca954x_mask2val(struct i2c_client *client, int mask) -{ - struct pca954x_data *data = (struct pca954x_data *)(client->data); - int i; - - mask &= data->nchmask; /* Sanitize mask */ - if (mask == 0) - return 0; /* Deselecting all, turn off */ - if (data->muxtype == pca954x_isswi) - return mask; /* Switch, can enable all at once! */ - - /* Mux, can only pick one. Select lowest chan bit */ - for (i=0; (mask & (1<data); - - if (data->muxtype == pca954x_isswi) - return val & data->nchmask; /* Switch val is == mask */ - - /* Mux - mask off low bits to get 0-based chan # as bit shift */ - if (val & PCA954X_MUX_ENA) - return 1 << (val & (data->nchans-1)); - return 0; -} - -/***************************************************************************** - * All of the following functions should only be called after the parent - * adapter bus semaphore (adapter->bus) has been acquired, so we cannot - * call the high-level i2c_smbus_write_byte() function -- it will deadlock - * attempting to acquire the same bus lock. Instead do directly what it - * would do, by means of pca954x_xfer(). Sigh! - * - * These functions are allowed to block. - * - *****************************************************************************/ - - -static int pca954x_select_mux(struct i2c_adapter *adap, - struct i2c_mux_ctrl *mux) -{ - return pca954x_select_chan(adap, mux->client, mux->value); -} - -static int pca954x_deselect_mux(struct i2c_adapter *adap, - struct i2c_mux_ctrl *mux) -{ - return pca954x_select_chan(adap, mux->client, -1); -} - -/* Select channel. - * PCA954x I2C-controlled bus mux/switch chips mainly differ in - * whether the chip is a mux or a switch: - * Mux: value addressed, only 1 bus can be selected. - * Swi: bitmask selected, any/all busses can be selected. - */ -static int pca954x_select_chan(struct i2c_adapter *adap, - struct i2c_client *client, - unsigned long chan) -{ - struct pca954x_data *data = (struct pca954x_data *)(client->data); - int maskbit; - u8 newregval; - int ret; - - if (chan == -1) { /* Op: clever deselect (to selmask) */ - if ((data->muxtype == pca954x_ismux) - && (data->curmask & data->selmask)) { - /* If mux, and current chan allowed by selmask, do nothing */ - newregval = data->regval; /* No change */ - } else { - /* Anything else just reverts to selmask */ - newregval = pca954x_mask2val(client, data->selmask); - } - - } else { /* Op: select chan */ - maskbit = 1 << chan; - if (maskbit & data->curmask) { /* If already selected, */ - newregval = data->regval; /* no change */ - } else if ((data->muxtype == pca954x_ismux) - || !(maskbit & data->selmask)) { - newregval = pca954x_mask2val(client, maskbit); - } else - newregval = pca954x_mask2val(client, data->selmask); - } - - /* Only clobber control reg when value changes, to avoid - unnecessary mux writes. For safety and initialization, - ALWAYS force the write if 0 is desired. - */ - ret = (!newregval || (data->regval != newregval)); - DBG(printk(KERN_DEBUG - "%s: Mux %d: chan %d, val %02x - %s\n", - __FUNCTION__, - client->id, (int)chan, newregval, - (ret ? "writing" : "skipping" ) )); - if (ret) { - ret = pca954x_xfer(adap, client, I2C_SMBUS_WRITE, &newregval); - - if (ret < 0) { - printk(KERN_ERR "%s: I2C mux %d select failed " - "(addr=%02x, val=%02x, err=%d)!\n", - __FUNCTION__, client->id, - client->addr, newregval, ret); - } else { - data->regval = newregval; - data->curmask = pca954x_val2mask(client, newregval); - } - } - return ret; -} - - -static int pca954x_xfer(struct i2c_adapter *adap, - struct i2c_client *client, - int read_write, u8 *val) -{ - int ret; - - if (adap->algo->master_xfer) { - /* Use I2C transfer */ - struct i2c_msg msg; - char buf[1]; - - msg.addr = client->addr; - msg.flags = (read_write == I2C_SMBUS_READ ? I2C_M_RD : 0); - msg.len = 1; - buf[0] = *val; - msg.buf = buf; - ret = adap->algo->master_xfer(adap, &msg, 1); - if (!ret && (read_write == I2C_SMBUS_READ)) - *val = buf[0]; - - } else if (adap->algo->smbus_xfer) { - /* Use SMBus transfer */ - union i2c_smbus_data data; - ret = adap->algo->smbus_xfer(adap, - client->addr, - client->flags & I2C_M_TEN, - read_write, - *val, - I2C_SMBUS_BYTE, &data); - if (!ret && (read_write == I2C_SMBUS_READ)) - *val = data.byte; - } else { - printk(KERN_ERR "%s: no smbus_xfer or master_xfer for " - "adapter %0lX, client %0lX\n", - __FUNCTION__, (unsigned long)adap, (unsigned long)client); - ret = -1; - } - return ret; -} - - -/* ------------------ */ - -MODULE_AUTHOR("Ken Harrenstien "); -MODULE_DESCRIPTION("PCA954X I2C mux/switch driver"); - -module_init(pca954x_init); -module_exit(pca954x_exit); diff --git a/kernel/include/i2c-virtual.h b/kernel/include/i2c-virtual.h deleted file mode 100644 index 4bca2f1a..00000000 --- a/kernel/include/i2c-virtual.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * i2c-virtual.h - Header file for the 'virtual i2c' adapter driver. - * - * Copyright (c) 2004 Google, Inc. - * - * Based on: - * i2c-virtual.h from Brian Kuschak - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef __I2C_VIRTUAL_H -#define __I2C_VIRTUAL_H - -#include - -struct i2c_mux_ctrl { - struct i2c_client *client; /* The mux chip/device */ - - unsigned long addr; - unsigned long value; /* Channel # */ - - /* fn which enables the mux */ - int (*select)(struct i2c_adapter *adap, struct i2c_mux_ctrl *mux); - - /* fn which disables the mux */ - int (*deselect)(struct i2c_adapter *adap, struct i2c_mux_ctrl *mux); -}; - -/* This has to be exposed, since the code which assigns the callbacks must - use it. - */ -struct i2c_virt_priv { - struct i2c_adapter *parent_adap; /* pointer to parent adapter */ - struct i2c_mux_ctrl mux; /* MUX settings for this adapter */ -}; - - -static inline struct i2c_adapter *i2c_virt_parent(struct i2c_adapter *adap) -{ - if (adap->algo && (adap->algo->id == I2C_ALGO_VIRT)) { - return ((struct i2c_virt_priv *)(adap->data))->parent_adap; - } - return NULL; -} - -/* - * Called to create a 'virtual' i2c bus which represents a multiplexed bus - * segment. The client and mux_val are passed to the select and deselect - * callback functions to perform hardware-specific mux control. - */ -struct i2c_adapter *i2c_virt_create_adapter(struct i2c_adapter *parent_adap, - struct i2c_client *client, - unsigned long mux_val, - void *select_cb, - void *deselect_cb); -int i2c_virt_remove_adapter(struct i2c_adapter *adap); - - -#endif /* __I2C_VIRTUAL_H */ diff --git a/lm_sensors.lsm b/lm_sensors.lsm index 13d37e4c..96b1f3cb 100644 --- a/lm_sensors.lsm +++ b/lm_sensors.lsm @@ -7,10 +7,9 @@ Description: Hardware health monitoring package for Linux. It consists of of a library to allow applications to read this data more easily, and of an example program to pretty print this data. LM78, LM79, LM80, W83781D and GL518SM sensor chips are - supported, among others. PIIX4 and VIA chipset SMBus - implementations are supported, as well as many I2C busses. + supported, among others. Version 2 is a complete non-compatible modular rewrite of this - package, with full I2C and SMBus support. + package. Keywords: kernel module SMBus sensors LM78 health Author: frodol@dds.nl (Frodo Looijaard) phil@netroedge.com (Philip Edelbrock) From 448c4a70e95312f55d247d852671b7bcc8f6ad7f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 8 May 2007 11:06:35 +0000 Subject: [PATCH 025/718] Ignore generated files. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4392 7894878c-1315-0410-8ee3-d5d059ff63e0 From 9232f4eb43d7b8b00f460d1dc93e6d1db0938cd1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 9 May 2007 13:00:30 +0000 Subject: [PATCH 026/718] Delete all kernel chip drivers, documentation and references. We are moving to a user-space-only package, all the drivers are maintained in the Linux kernel tree itself. I tried to update the documentation a bit, but there's still a lot to go. In fact, a complete rewrite seems to be needed. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4397 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + Makefile | 189 +-- QUICKSTART | 54 +- README.directories | 4 +- doc/chips/adm1021 | 415 ----- doc/chips/adm1024 | 12 - doc/chips/adm1025 | 135 -- doc/chips/adm1026 | 217 --- doc/chips/adm1031 | 109 -- doc/chips/adm9240 | 424 ------ doc/chips/asb100 | 89 -- doc/chips/bmcsensors | 140 -- doc/chips/bt869 | 397 ----- doc/chips/ddcmon | 272 ---- doc/chips/ds1307 | 25 - doc/chips/ds1621 | 237 --- doc/chips/eeprom | 228 --- doc/chips/f71805f | 107 -- doc/chips/fscher | 266 ---- doc/chips/fscpos | 122 -- doc/chips/fscscy | 251 --- doc/chips/gl518sm | 184 --- doc/chips/gl520sm | 146 -- doc/chips/it87 | 273 ---- doc/chips/lm63 | 102 -- doc/chips/lm75 | 107 -- doc/chips/lm78 | 337 ----- doc/chips/lm80 | 149 -- doc/chips/lm83 | 156 -- doc/chips/lm85 | 527 ------- doc/chips/lm87 | 150 -- doc/chips/lm90 | 223 --- doc/chips/lm92 | 89 -- doc/chips/lm93 | 386 ----- doc/chips/ltc1710 | 67 - doc/chips/matorb | 97 -- doc/chips/max1619 | 73 - doc/chips/max6650 | 125 -- doc/chips/maxilife | 433 ------ doc/chips/mic74 | 57 - doc/chips/mtp008 | 73 - doc/chips/pc87360 | 184 --- doc/chips/pca9540 | 76 - doc/chips/pcf8574 | 100 -- doc/chips/pcf8591 | 127 -- doc/chips/saa1064 | 81 - doc/chips/sis5595 | 165 -- doc/chips/smartbatt | 66 - doc/chips/smbus-arp | 66 - doc/chips/smsc47m1 | 75 - doc/chips/thmc50 | 96 -- doc/chips/via686a | 155 -- doc/chips/vt1211 | 70 - doc/chips/vt8231 | 184 --- doc/chips/w83627hf | 103 -- doc/chips/w83781d | 799 ---------- doc/chips/w83792d | 298 ---- doc/chips/w83l785ts | 77 - doc/chips/xeontemp | 108 -- doc/developers/design | 550 ------- doc/developers/makefiles | 20 +- doc/developers/new_drivers | 166 -- doc/developers/proc | 145 -- doc/developers/release_checklist | 12 +- doc/developers/sysctl | 16 - doc/kernel/file_operations | 91 -- doc/kernel/proc_dir_entry | 145 -- doc/modules | 14 - etc/sensors.conf.eg | 10 +- kernel/Module.mk | 42 - kernel/chips/Module.mk | 210 --- kernel/chips/adm1021.c | 587 -------- kernel/chips/adm1024.c | 776 ---------- kernel/chips/adm1025.c | 588 -------- kernel/chips/adm1026.c | 1741 --------------------- kernel/chips/adm1031.c | 643 -------- kernel/chips/adm9240.c | 700 --------- kernel/chips/asb100.c | 1017 ------------- kernel/chips/bmcsensors.c | 1133 -------------- kernel/chips/bt869.c | 886 ----------- kernel/chips/ddcmon.c | 586 -------- kernel/chips/ds1307.c | 345 ----- kernel/chips/ds1621.c | 537 ------- kernel/chips/eeprom.c | 370 ----- kernel/chips/f71805f.c | 757 ---------- kernel/chips/fscher.c | 729 --------- kernel/chips/fscpos.c | 684 --------- kernel/chips/fscscy.c | 909 ----------- kernel/chips/gl518sm.c | 987 ------------ kernel/chips/gl520sm.c | 804 ---------- kernel/chips/it87.c | 1130 -------------- kernel/chips/lm63.c | 645 -------- kernel/chips/lm75.c | 330 ---- kernel/chips/lm75.h | 49 - kernel/chips/lm78.c | 721 --------- kernel/chips/lm80.c | 599 -------- kernel/chips/lm83.c | 528 ------- kernel/chips/lm85.c | 2037 ------------------------- kernel/chips/lm87.c | 982 ------------ kernel/chips/lm90.c | 858 ----------- kernel/chips/lm92.c | 416 ----- kernel/chips/lm93.c | 2343 ----------------------------- kernel/chips/lm93.h | 113 -- kernel/chips/ltc1710.c | 313 ---- kernel/chips/matorb.c | 281 ---- kernel/chips/max1619.c | 491 ------ kernel/chips/max6650.c | 537 ------- kernel/chips/maxilife.c | 1379 ----------------- kernel/chips/mic74.c | 378 ----- kernel/chips/mtp008.c | 1098 -------------- kernel/chips/pc87360.c | 1350 ----------------- kernel/chips/pca9540.c | 241 --- kernel/chips/pcf8574.c | 304 ---- kernel/chips/pcf8591.c | 443 ------ kernel/chips/saa1064.c | 427 ------ kernel/chips/sis5595.c | 721 --------- kernel/chips/smartbatt.c | 546 ------- kernel/chips/smbus-arp.c | 478 ------ kernel/chips/smsc47m1.c | 603 -------- kernel/chips/thmc50.c | 491 ------ kernel/chips/via686a.c | 840 ----------- kernel/chips/vt1211.c | 820 ---------- kernel/chips/vt8231.c | 836 ---------- kernel/chips/w83627hf.c | 1501 ------------------ kernel/chips/w83781d.c | 1883 ----------------------- kernel/chips/w83792d.c | 1532 ------------------- kernel/chips/w83l785ts.c | 379 ----- kernel/chips/xeontemp.c | 383 ----- kernel/include/Module.mk | 18 - kernel/include/ds1307.h | 59 - kernel/include/sensors.h | 1608 ++++++++++++++++++++ kernel/include/sensors.h.template | 55 - kernel/include/sensors_compat.h | 51 - kernel/include/sensors_vid.h | 98 -- kernel/sensors.c | 20 - lm_sensors.lsm | 7 +- 136 files changed, 1633 insertions(+), 55767 deletions(-) delete mode 100644 doc/chips/adm1021 delete mode 100644 doc/chips/adm1024 delete mode 100644 doc/chips/adm1025 delete mode 100644 doc/chips/adm1026 delete mode 100644 doc/chips/adm1031 delete mode 100644 doc/chips/adm9240 delete mode 100644 doc/chips/asb100 delete mode 100644 doc/chips/bmcsensors delete mode 100644 doc/chips/bt869 delete mode 100644 doc/chips/ddcmon delete mode 100644 doc/chips/ds1307 delete mode 100644 doc/chips/ds1621 delete mode 100644 doc/chips/eeprom delete mode 100644 doc/chips/f71805f delete mode 100644 doc/chips/fscher delete mode 100644 doc/chips/fscpos delete mode 100644 doc/chips/fscscy delete mode 100644 doc/chips/gl518sm delete mode 100644 doc/chips/gl520sm delete mode 100644 doc/chips/it87 delete mode 100644 doc/chips/lm63 delete mode 100644 doc/chips/lm75 delete mode 100644 doc/chips/lm78 delete mode 100644 doc/chips/lm80 delete mode 100644 doc/chips/lm83 delete mode 100644 doc/chips/lm85 delete mode 100644 doc/chips/lm87 delete mode 100644 doc/chips/lm90 delete mode 100644 doc/chips/lm92 delete mode 100644 doc/chips/lm93 delete mode 100644 doc/chips/ltc1710 delete mode 100644 doc/chips/matorb delete mode 100644 doc/chips/max1619 delete mode 100644 doc/chips/max6650 delete mode 100644 doc/chips/maxilife delete mode 100644 doc/chips/mic74 delete mode 100644 doc/chips/mtp008 delete mode 100644 doc/chips/pc87360 delete mode 100644 doc/chips/pca9540 delete mode 100644 doc/chips/pcf8574 delete mode 100644 doc/chips/pcf8591 delete mode 100644 doc/chips/saa1064 delete mode 100644 doc/chips/sis5595 delete mode 100644 doc/chips/smartbatt delete mode 100644 doc/chips/smbus-arp delete mode 100644 doc/chips/smsc47m1 delete mode 100644 doc/chips/thmc50 delete mode 100644 doc/chips/via686a delete mode 100644 doc/chips/vt1211 delete mode 100644 doc/chips/vt8231 delete mode 100644 doc/chips/w83627hf delete mode 100644 doc/chips/w83781d delete mode 100644 doc/chips/w83792d delete mode 100644 doc/chips/w83l785ts delete mode 100644 doc/chips/xeontemp delete mode 100644 doc/developers/design delete mode 100644 doc/developers/new_drivers delete mode 100644 doc/developers/proc delete mode 100644 doc/developers/sysctl delete mode 100644 doc/kernel/file_operations delete mode 100644 doc/kernel/proc_dir_entry delete mode 100644 doc/modules delete mode 100644 kernel/Module.mk delete mode 100644 kernel/chips/Module.mk delete mode 100644 kernel/chips/adm1021.c delete mode 100644 kernel/chips/adm1024.c delete mode 100644 kernel/chips/adm1025.c delete mode 100644 kernel/chips/adm1026.c delete mode 100644 kernel/chips/adm1031.c delete mode 100644 kernel/chips/adm9240.c delete mode 100644 kernel/chips/asb100.c delete mode 100644 kernel/chips/bmcsensors.c delete mode 100644 kernel/chips/bt869.c delete mode 100644 kernel/chips/ddcmon.c delete mode 100644 kernel/chips/ds1307.c delete mode 100644 kernel/chips/ds1621.c delete mode 100644 kernel/chips/eeprom.c delete mode 100644 kernel/chips/f71805f.c delete mode 100644 kernel/chips/fscher.c delete mode 100644 kernel/chips/fscpos.c delete mode 100644 kernel/chips/fscscy.c delete mode 100644 kernel/chips/gl518sm.c delete mode 100644 kernel/chips/gl520sm.c delete mode 100644 kernel/chips/it87.c delete mode 100644 kernel/chips/lm63.c delete mode 100644 kernel/chips/lm75.c delete mode 100644 kernel/chips/lm75.h delete mode 100644 kernel/chips/lm78.c delete mode 100644 kernel/chips/lm80.c delete mode 100644 kernel/chips/lm83.c delete mode 100644 kernel/chips/lm85.c delete mode 100644 kernel/chips/lm87.c delete mode 100644 kernel/chips/lm90.c delete mode 100644 kernel/chips/lm92.c delete mode 100644 kernel/chips/lm93.c delete mode 100644 kernel/chips/lm93.h delete mode 100644 kernel/chips/ltc1710.c delete mode 100644 kernel/chips/matorb.c delete mode 100644 kernel/chips/max1619.c delete mode 100644 kernel/chips/max6650.c delete mode 100644 kernel/chips/maxilife.c delete mode 100644 kernel/chips/mic74.c delete mode 100644 kernel/chips/mtp008.c delete mode 100644 kernel/chips/pc87360.c delete mode 100644 kernel/chips/pca9540.c delete mode 100644 kernel/chips/pcf8574.c delete mode 100644 kernel/chips/pcf8591.c delete mode 100644 kernel/chips/saa1064.c delete mode 100644 kernel/chips/sis5595.c delete mode 100644 kernel/chips/smartbatt.c delete mode 100644 kernel/chips/smbus-arp.c delete mode 100644 kernel/chips/smsc47m1.c delete mode 100644 kernel/chips/thmc50.c delete mode 100644 kernel/chips/via686a.c delete mode 100644 kernel/chips/vt1211.c delete mode 100644 kernel/chips/vt8231.c delete mode 100644 kernel/chips/w83627hf.c delete mode 100644 kernel/chips/w83781d.c delete mode 100644 kernel/chips/w83792d.c delete mode 100644 kernel/chips/w83l785ts.c delete mode 100644 kernel/chips/xeontemp.c delete mode 100644 kernel/include/ds1307.h create mode 100644 kernel/include/sensors.h delete mode 100644 kernel/include/sensors.h.template delete mode 100644 kernel/include/sensors_compat.h delete mode 100644 kernel/include/sensors_vid.h delete mode 100644 kernel/sensors.c diff --git a/CHANGES b/CHANGES index 065109f0..46c4d34f 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ lm_sensors CHANGES file SVN HEAD All bus modules and documentation: Delete + All chip modules and documentation: Delete File doc/version-2: Delete, obsolete File sensors.conf.eg: Add a dme1737 section File lm_sensors.sysconfig: Delete, now generated by sensors-detect diff --git a/Makefile b/Makefile index eeb8af9c..61a5b39e 100644 --- a/Makefile +++ b/Makefile @@ -27,38 +27,6 @@ # I think so, but I have not tested it. #SHELL := /usr/bin/bash -# The currently running kernel version. This is used right below to -# determine where the kernel sources can be found. -KERNELVERSION := $(shell uname -r) - -# The location of linux itself. This is used to find the kernel headers -# and other things. -#LINUX := /usr/src/linux -LINUX := $(shell if [ -L "/lib/modules/$(KERNELVERSION)/build" ] ; \ - then echo "/lib/modules/$(KERNELVERSION)/build" ; \ - else echo "/usr/src/linux" ; fi) -LINUX_HEADERS := $(LINUX)/include - -# If you have installed the i2c header at some other place (like -# /usr/local/include/linux), set that directory here. Please check this out -# if you get strange compilation errors; the default Linux i2c headers -# may be used mistakenly. Note: This should point to the directory -# *above* the linux/ subdirectory, so to /usr/local/include in the -# above example. -I2C_HEADERS := /usr/local/include -#I2C_HEADERS := $(LINUX_HEADERS) - -ifneq ($(MAKECMDGOALS),user) -ifneq ($(MAKECMDGOALS),user_install) -ifneq ($(MAKECMDGOALS),user_uninstall) -SMP := $(shell if grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_SMP[[:space:]]*1' $(LINUX_HEADERS)/linux/autoconf.h ; \ - then echo 1; else echo 0; fi) -MODVER := $(shell if grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_MODVERSIONS[[:space:]]*1' $(LINUX_HEADERS)/linux/autoconf.h ; \ - then echo 1; else echo 0; fi) -endif -endif -endif - # Uncomment the second line if you are a developer. This will enable many # additional warnings at compile-time WARN := 0 @@ -80,34 +48,8 @@ PREFIX := /usr/local # Your C compiler CC := gcc -# This is the main modules directory into which the modules will be installed. -# The magic invocation will return something like this: -# /lib/modules/2.4.29 -KERNELVERSION := $(shell $(CC) -I$(LINUX_HEADERS) -E etc/config.c | grep uts_release | cut -f 2 -d'"') -MODPREF := /lib/modules/$(KERNELVERSION) - -# When building userspace for use with 2.4.x series kernels, we turn off -# sysfs support by default. You can override this (e.g. if you want -# to build binaries that work for both 2.4.x, and 2.6.x and above) -# by uncommenting the line after the next endif. Keep in mind, if and only -# if you do this: you will need to install the libsysfs libraries on your -# kernel 2.4.x systems also. -ifeq (,$(findstring /2.4., $(MODPREF))) - SYSFS_SUPPORT := 1 -else - SYSFS_SUPPORT := -endif -#SYSFS_SUPPORT := 1 - -# Prevent 2.6+ users from using improper targets, as this won't work. -ifeq (,$(findstring /2.4., $(MODPREF))) - ifeq (, $(MAKECMDGOALS)) - $(error For 2.6 kernels and later, use "make user") - endif - ifeq (install, $(MAKECMDGOALS)) - $(error For 2.6 kernels and later, use "make user_install") - endif -endif +# Build with sysfs support +SYSFS_SUPPORT := 1 # This is the directory where sensors.conf will be installed, if no other # configuration file is found @@ -170,19 +112,6 @@ MACHINE := $(shell uname -m) # The subdirectories we need to build things in SRCDIRS := -ifneq ($(MAKECMDGOALS),user) -ifneq ($(MAKECMDGOALS),user_install) -ifneq ($(MAKECMDGOALS),user_uninstall) -ifneq ($(MAKECMDGOALS),package) -ifneq ($(MAKECMDGOALS),userpackage) -ifneq ($(MAKECMDGOALS),manhtml) -SRCDIRS += kernel kernel/chips -endif -endif -endif -endif -endif -endif SRCDIRS += kernel/include SRCDIRS += lib prog/detect prog/dump prog/eeprom prog/pwm \ prog/sensors prog/xeon ${PROG_EXTRA:%=prog/%} etc @@ -204,11 +133,10 @@ SED := sed # Determine the default compiler flags # Set CFLAGS or CPPFLAGS above to add your own flags to all. # ALLCPPFLAGS/ALLCFLAGS are common flags, plus any user-specified overrides from the environment or make command line. -# MODCPPFLAGS/MODCFLAGS is to create in-kernel object files (modules). -# PROGCPPFLAGS/PROGCFLAGS is to create non-kernel object files (which are linked into executables). +# PROGCPPFLAGS/PROGCFLAGS is to create regular object files (which are linked into executables). # ARCPPFLAGS/ARCFLAGS are used to create archive object files (static libraries). # LIBCPPFLAGS/LIBCFLAGS are for shared library objects. -ALL_CPPFLAGS := -I. -Ikernel/include -I$(I2C_HEADERS) +ALL_CPPFLAGS := -I. -Ikernel/include ALL_CFLAGS := -Wall ifeq ($(DEBUG),1) @@ -226,47 +154,6 @@ endif ALL_CPPFLAGS += $(CPPFLAGS) ALL_CFLAGS += $(CFLAGS) -MODCPPFLAGS := -MODCFLAGS := -fno-strict-aliasing - -ifeq ($(MACHINE),alpha) -MODCFLAGS += -ffixed-8 -mno-fp-regs -mcpu=ev56 -endif - -ifeq ($(MACHINE),x86_64) -MODCFLAGS += -fno-common -fomit-frame-pointer -mno-red-zone \ - -mcmodel=kernel -fno-reorder-blocks -finline-limit=2000 -fno-strength-reduce -endif - -ifeq ($(MACHINE),mips) -MODCFLAGS += -mabi=32 -mips3 -Wa,-32 -Wa,-mips3 -Wa,--trap -endif - -ifeq ($(MACHINE),sparc32) -MODCFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 -endif - -ifeq ($(MACHINE),sparc64) -MODCFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \ - -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare \ - -Wa,--undeclared-regs -endif - -ifeq ($(SMP),1) -MODCPPFLAGS += -D__SMP__ -endif - -ifeq ($(MODVER),1) -MODCPPFLAGS += -DMODVERSIONS -include $(LINUX_HEADERS)/linux/modversions.h -endif - -# This magic is from the kernel Makefile. -# Extra cflags for kbuild 2.4. The default is to forbid includes by kernel code -# from user space headers. -kbuild_2_4_nostdinc := -nostdinc $(shell LC_ALL=C $(CC) -print-search-dirs | sed -ne 's/install: \(.*\)/-I \1include/gp') - -MODCPPFLAGS += -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -fomit-frame-pointer $(ALL_CPPFLAGS) -I$(LINUX_HEADERS) $(kbuild_2_4_nostdinc) -MODCFLAGS += $(ALL_CFLAGS) PROGCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS) -Wundef PROGCFLAGS := $(ALL_CFLAGS) ARCPPFLAGS := $(ALL_CPPFLAGS) @@ -317,22 +204,6 @@ user_install:: @echo "*** to fit your needs again." all :: user install :: all user_install -ifeq ($(DESTDIR),) - -if [ -r $(MODPREF)/build/System.map -a -x /sbin/depmod ] ; then \ - /sbin/depmod -a -F $(MODPREF)/build/System.map $(KERNELVERSION) ; \ - fi -else - @echo "*** This is a \`staged' install using \"$(DESTDIR)\" as prefix." - @echo "***" - @echo "*** Once the modules have been moved to their final destination" - @echo "*** you must run the command \"/sbin/depmod -a\"." - @echo "***" - @echo "*** Alternatively, if you build a package (e.g. rpm), include the" - @echo "*** command \"/sbin/depmod -a\" in the post-(un)install procedure." - @echo "***" - @echo "*** The depmod command mentioned above may generate errors. We are" - @echo "*** aware of the problem and are working on a solution." -endif clean:: $(RM) lm_sensors-* lex.backup @@ -340,8 +211,6 @@ clean:: user_uninstall:: uninstall :: user_uninstall - @echo "*** Note:" - @echo "*** * Kernel modules were not uninstalled." # This is tricky, but it works like a charm. It needs lots of utilities # though: cut, find, gzip, ln, tail and tar. @@ -359,23 +228,6 @@ package: version clean $(RM) $$lmpackage.tar $$lmpackage cat doc/developers/checklist -# doesn't work well yet... needs Makefile changes too -userpackage: version clean $(KERNELINCLUDEDIR)/sensors.h - lmversion=`tail -1 version.h|cut -f 2 -d \"`; \ - lmpackage=lm_sensors-user-$$lmversion; \ - ln -s . $$lmpackage; \ - find $$lmpackage/ -type f | grep -v ^$$lmpackage/$$lmpackage$$ | \ - grep -v ^$$lmpackage/$$lmpackage.tar$$ | \ - grep -v ^$$lmpackage/doc/chips | \ - grep -v ^$$lmpackage/kernel/chips | \ - grep -v ^$$lmpackage/$$ | \ - grep -v /CVS | \ - grep -v /\\.# | \ - tar rvf $$lmpackage.tar -T -; \ - gzip -9 $$lmpackage.tar ;\ - $(RM) $$lmpackage.tar $$lmpackage - cat doc/developers/checklist - version: $(RM) version.h echo '#define LM_DATE "'`date +'%Y%m%d'`\" > version.h @@ -384,29 +236,12 @@ version: help: @echo 'Make targets are:' - @echo ' all (default): build modules and userspace programs' - @echo ' install: install modules and userspace programs' - @echo ' user: build userspace programs' - @echo ' user_install: install userspace programs' - @echo ' user_uninstall: remove userspace programs' + @echo ' all (default): build library and userspace programs' + @echo ' install: install library and userspace programs' + @echo ' uninstall: uninstall library and userspace programs' @echo ' clean: cleanup' @echo ' package: create a distribution package' -$(LINUX)/.config: - @echo - @echo "Error - missing file $(LINUX)/.config !! " - @echo " Verify kernel source is in $(LINUX) and then" - @echo " cd to $(LINUX) and run 'make config' !!" - @echo - @echo "Exception: if you're using a stock RedHat kernel..." - @echo " (1) Install the appropriate kernel-source RPM." - @echo " (2) Copy the appropriate config..." - @echo " from $(LINUX)/configs/<...>" - @echo " to $(LINUX)/.config" - @echo " (3) Do *NOT* 'make dep' or 'make config'." - @echo - @exit 1 - # Generate html man pages to be copied to the lm_sensors website. # This uses the man2html from here # http://ftp.math.utah.edu/pub/sgml/ @@ -427,16 +262,6 @@ manhtml: # We need to create dependency files. Tricky. The sed rule puts dir/file.d and # dir/file.c in front of the dependency file rule. -# .o files are used for modules -# depend on the kernel config file! -%.o: %.c $(LINUX)/.config - $(CC) $(MODCPPFLAGS) $(MODCFLAGS) -c $< -o $@ - -%.d: %.c $(LINUX)/.config - $(CC) -M -MG $(MODCPPFLAGS) $(MODCFLAGS) $< | \ - $(SED) -e 's@^\(.*\)\.o:@$*.d $*.o: Makefile '`dirname $*.d`/Module.mk' @' > $@ - - # .ro files are used for programs (as opposed to modules) %.ro: %.c diff --git a/QUICKSTART b/QUICKSTART index bb964bfc..092fc3eb 100644 --- a/QUICKSTART +++ b/QUICKSTART @@ -4,14 +4,11 @@ LM_SENSORS QUICK INSTALLATION INSTRUCTIONS The instructions in this document will generally work if you have a standard system, but not always!! -The first part of document is for 2.6 kernel series, second part is for -older 2.4 kernels. - Quickstart for Kernel 2.6 ------------------------- 0) Just compile and install lm-sensors userspace tools. You can do that with: - 'make user; make user_install' + 'make ; make install' 1) Make sure your kernel has support for all I2C bus drivers and 'i2c device interface'. If you are using a distribution kernel, all is already prepared, you don't need to recompile it. @@ -26,52 +23,3 @@ http://www.lm-sensors.org/wiki/iwizard/1 We are aware that the documentation could be improved, please contact us if you want to help us with that. - -Quickstart for Kernel 2.4 -------------------------- - -NOTE: PLEASE SKIM THE INSTALL DOCUMENT, OR BETTER YET READ IT CAREFULLY! - -Quickstart for i2c option 1 (modules) and lm_sensors option 1 (modules). -This is by far the EASIEST METHOD. -Other methods are described in INSTALL. ------------------------------------------- - - * Verify you are running a 2.4 kernel, 2.4.10 or later. - - * Make sure you have the kernel tree corresponding to your current - kernel in /lib/modules/$(uname -r)/build. - Even if the source is there, it may not correspond to your running - kernel. If so, you will have to recompile your kernel. - - * Verify that your i2c support in the kernel is configured as - modules or is disabled. If it is compiled-in, you obviously - cannot replace it with modules in the next step. - - * Do `lsmod'. If there are any old i2c or sensors modules loaded, - you MUST remove them (as root) with `rmmod'. - - * Download, build, and install the latest i2c package, - (i2c-2.9.0 or later). The i2c subsystem found in the Linux 2.4 - kernel trees, even the latest ones, is outdated and won't work. - Quickstart for i2c: make; (as root) make install - - * Go back to the lm_sensors directory. Do `make'. - The warnings about .d files at the start are harmless. - - * Do (as root) `make install'. - - * Verify that /usr/local/lib is listed in /etc/ld.so.conf; - if it isn't, add it, then run (as root) `ldconfig'. - - * Run (as root) `prog/mkdev/mkdev.sh' to create the device files, - unless you already have them or are running devfs or udev. - - * Run (as root) `prog/detect/sensors-detect' to detect your hardware, - put the lines it suggests into /etc/modules.conf, and run all - the commands it suggests (`modprobe X', `sensors -s'). - - * Run `sensors' to see your output. - - * That's it! If you have problems, read our excellent FAQ - (doc/FAQ or doc/lm_sensors-FAQ.html). diff --git a/README.directories b/README.directories index 37a50074..f5c29871 100644 --- a/README.directories +++ b/README.directories @@ -1,11 +1,11 @@ The directories within this package: * doc - Documentation about the modules within this package, and all other things. + Documentation. * etc A sample configuration file for the 'sensors' program. * kernel - The kernel modules: sensor chip drivers. + A few kernel-related header files. * lib The user-space sensors support library code. * prog diff --git a/doc/chips/adm1021 b/doc/chips/adm1021 deleted file mode 100644 index c3bb602b..00000000 --- a/doc/chips/adm1021 +++ /dev/null @@ -1,415 +0,0 @@ -Kernel driver `adm1021.o' -========================= - -Status: Complete; tested for most devices except Xeon. - -Supported chips: - * Analog Devices ADM1021 - Prefix: 'adm1021' - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the Analog Devices website - * Analog Devices ADM1021A/ADM1023 - Prefix: 'adm1023' - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the Analog Devices website - * Genesys Logic GL523SM - Prefix: 'gl523sm' - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: - * Intel Xeon Processor - Prefix - any other - may require 'force_adm1021' parameter - - see MODPARMS and xeontemp files for more information - Addresses scanned: none - Datasheet: Publicly available at Intel website - Status: Alpha, untested. - * Maxim MAX1617 - Prefix: 'max1617' - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the Maxim website - * Maxim MAX1617A - Prefix: 'max1617a' - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the Maxim website - * National Semiconductor LM84 - Prefix: 'lm84' - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the National Semiconductor website - * Philips NE1617 - Prefix: 'max1617' (probably detected as a max1617) - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the Philips website - * Philips NE1617A - Prefix: 'max1617' (probably detected as a max1617) - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the Philips website - * TI THMC10 - Prefix: 'thmc10' - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the TI website - * Onsemi MC1066 - Prefix: 'mc1066' - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the Onsemi website - - -Author: Frodo Looijaard and Philip Edelbrock - - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_adm1021: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adm1021' chip -* force_adm1023: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adm1023' chip -* force_max1617: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `max1617' chip -* force_max1617a: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `max1617a' chip -* force_thmc10: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `thmc10' chip -* force_lm84: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm84' chip -* force_gl523sm: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `gl523sm' chip -* force_mc1066: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `mc1066' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* read_only: int - Don't set any values, read only mode - - -Description ------------ - -The chips supported by this driver are very similar. The Maxim MAX1617 -is the oldest; it has the problem that it is not very well detectable. -The MAX1617A solves that. The ADM1021 is a straight clone of the MAX1617A. -Ditto for the THMC10. -From here on, we will refer to all these chips as ADM1021-clones. - -ADM1021-clones implement two temperature sensors. One of them is internal, -and measures the temperature of the chip itself; the other is external -and is realised in the form of a transistor-like device. A special alarm -indicates whether the remote sensor is connected. - -Each sensor has its own low and high limits. When they are crossed, the -corresponding alarm is set and remains on as long as the temperature stays -out of range. Temperatures are measured in degrees Celsius. Measurements -are possible between -65 and +127 degrees, with a resolution of one degree. - -The ADM1021 reports a die code, which is a sort of revision code. This -can help us pinpoint problems; it is not very useful otherwise. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! - -This driver only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. It is possible to make -ADM1021-clones do faster measurements, but there is really no good reason -for that. - - -Xeon support ------------- -Some Xeon processors have real max1617, adm1021, or compatible chips -with in them, with two temperature sensors. - -Other Xeons have chips with only one sensor. - -If you have a Xeon, and the adm1021 module loads, and both -temperatures appear valid, then things are good. - -If the adm1021 module doesn't load, you should try two things: - 1) modprobe adm1021 force_adm1021=BUS,ADDRESS - ADDRESS can only be 0x18, 0x1a, 0x29, 0x2b, 0x4c, or 0x4e. - See if you have one or two valid temperatures - - 2) modprobe xeontemp - See if you have one valid temperature. - -If you have dual Xeons you may have appear to have two separate -adm1021-compatible chips, or two single-temperature sensors, -at distinct addresses. - -Pick the best module for your processor based on the results. -See the xeontemp documentation for further information. - - -Chip Features -------------- - -Chip 'adm1021' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 0 -temp_low temp temp RW 0 -temp_over temp temp RW 0 -remote_temp - - R- 0 -remote_temp_low remote_temp remote_temp RW 0 -remote_temp_over remote_temp remote_temp RW 0 -alarms - - R- 0 -die_code - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_ADM1021_TEMP temp1:3 -temp_low SENSORS_ADM1021_TEMP_HYST temp1:2 -temp_over SENSORS_ADM1021_TEMP_OVER temp1:1 -remote_temp SENSORS_ADM1021_REMOTE_TEMP temp2:3 -remote_temp_low SENSORS_ADM1021_REMOTE_TEMP_HYST temp2:2 -remote_temp_over SENSORS_ADM1021_REMOTE_TEMP_OVER temp2:1 -alarms SENSORS_ADM1021_ALARMS alarms:1 -die_code SENSORS_ADM1021_DIE_CODE die_code:1 - - -Chip 'adm1023' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 0 -temp_low temp temp RW 0 -temp_over temp temp RW 0 -remote_temp - - R- 3 -remote_temp_low remote_temp remote_temp RW 3 -remote_temp_over remote_temp remote_temp RW 3 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_ADM1021_TEMP temp1:3 -temp_low SENSORS_ADM1021_TEMP_HYST temp1:2 -temp_over SENSORS_ADM1021_TEMP_OVER temp1:1 -remote_temp SENSORS_ADM1021_REMOTE_TEMP temp2:4 -remote_temp_low SENSORS_ADM1021_REMOTE_TEMP_HYST temp2:2 -remote_temp_over SENSORS_ADM1021_REMOTE_TEMP_OVER temp2:1 -alarms SENSORS_ADM1021_ALARMS alarms:1 - - -Chip 'max1617' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 0 -temp_low temp temp RW 0 -temp_over temp temp RW 0 -remote_temp - - R- 0 -remote_temp_low remote_temp remote_temp RW 0 -remote_temp_over remote_temp remote_temp RW 0 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_MAX1617_TEMP temp1:3 -temp_low SENSORS_MAX1617_TEMP_HYST temp1:2 -temp_over SENSORS_MAX1617_TEMP_OVER temp1:1 -remote_temp SENSORS_MAX1617_REMOTE_TEMP temp2:3 -remote_temp_low SENSORS_MAX1617_REMOTE_TEMP_HYST temp2:2 -remote_temp_over SENSORS_MAX1617_REMOTE_TEMP_OVER temp2:1 -alarms SENSORS_MAX1617_ALARMS alarms:1 - - -Chip 'max1617a' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 0 -temp_low temp temp RW 0 -temp_over temp temp RW 0 -remote_temp - - R- 0 -remote_temp_low remote_temp remote_temp RW 0 -remote_temp_over remote_temp remote_temp RW 0 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_MAX1617A_TEMP temp1:3 -temp_low SENSORS_MAX1617A_TEMP_HYST temp1:2 -temp_over SENSORS_MAX1617A_TEMP_OVER temp1:1 -remote_temp SENSORS_MAX1617A_REMOTE_TEMP temp2:3 -remote_temp_low SENSORS_MAX1617A_REMOTE_TEMP_HYST temp2:2 -remote_temp_over SENSORS_MAX1617A_REMOTE_TEMP_OVER temp2:1 -alarms SENSORS_MAX1617A_ALARMS alarms:1 - - -Chip 'thmc10' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 0 -temp_low temp temp RW 0 -temp_over temp temp RW 0 -remote_temp - - R- 0 -remote_temp_low remote_temp remote_temp RW 0 -remote_temp_over remote_temp remote_temp RW 0 -alarms - - R- 0 -die_code - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_ADM1021_TEMP temp1:3 -temp_low SENSORS_ADM1021_TEMP_HYST temp1:2 -temp_over SENSORS_ADM1021_TEMP_OVER temp1:1 -remote_temp SENSORS_ADM1021_REMOTE_TEMP temp2:3 -remote_temp_low SENSORS_ADM1021_REMOTE_TEMP_HYST temp2:2 -remote_temp_over SENSORS_ADM1021_REMOTE_TEMP_OVER temp2:1 -alarms SENSORS_ADM1021_ALARMS alarms:1 -die_code SENSORS_ADM1021_DIE_CODE die_code:1 - - -Chip 'lm84' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 0 -temp_low temp temp RW 0 -temp_over temp temp RW 0 -remote_temp - - R- 0 -remote_temp_low remote_temp remote_temp RW 0 -remote_temp_over remote_temp remote_temp RW 0 -alarms - - R- 0 -die_code - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_ADM1021_TEMP temp1:3 -temp_low SENSORS_ADM1021_TEMP_HYST temp1:2 -temp_over SENSORS_ADM1021_TEMP_OVER temp1:1 -remote_temp SENSORS_ADM1021_REMOTE_TEMP temp2:3 -remote_temp_low SENSORS_ADM1021_REMOTE_TEMP_HYST temp2:2 -remote_temp_over SENSORS_ADM1021_REMOTE_TEMP_OVER temp2:1 -alarms SENSORS_ADM1021_ALARMS alarms:1 -die_code SENSORS_ADM1021_DIE_CODE die_code:1 - - -Chip 'gl523' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 0 -temp_low temp temp RW 0 -temp_over temp temp RW 0 -remote_temp - - R- 0 -remote_temp_low remote_temp remote_temp RW 0 -remote_temp_over remote_temp remote_temp RW 0 -alarms - - R- 0 -die_code - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_ADM1021_TEMP temp1:3 -temp_low SENSORS_ADM1021_TEMP_HYST temp1:2 -temp_over SENSORS_ADM1021_TEMP_OVER temp1:1 -remote_temp SENSORS_ADM1021_REMOTE_TEMP temp2:3 -remote_temp_low SENSORS_ADM1021_REMOTE_TEMP_HYST temp2:2 -remote_temp_over SENSORS_ADM1021_REMOTE_TEMP_OVER temp2:1 -alarms SENSORS_ADM1021_ALARMS alarms:1 -die_code SENSORS_ADM1021_DIE_CODE die_code:1 - - -Chip 'mc1066' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 0 -temp_low temp temp RW 0 -temp_over temp temp RW 0 -remote_temp - - R- 0 -remote_temp_low remote_temp remote_temp RW 0 -remote_temp_over remote_temp remote_temp RW 0 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_MAX1617_TEMP temp1:3 -temp_low SENSORS_MAX1617_TEMP_HYST temp1:2 -temp_over SENSORS_MAX1617_TEMP_OVER temp1:1 -remote_temp SENSORS_MAX1617_REMOTE_TEMP temp2:3 -remote_temp_low SENSORS_MAX1617_REMOTE_TEMP_HYST temp2:2 -remote_temp_over SENSORS_MAX1617_REMOTE_TEMP_OVER temp2:1 -alarms SENSORS_MAX1617_ALARMS alarms:1 - - - - - -Old Documentation (may be outdated) ------------------------------------ - -This file documents the adm1021 directories for the Analog Devices ADM1021 -and MAX1617 temperature sensor chip. Note that this last chip should be -fully compatible; it is not yet well-tested, though. - -There will be one directory created for each detected ADM1021 chip. As -ADM1021 chips can only be on a SMBus, they will be called adm1021-i2c-?-??, with -the first question mark being the number of the i2c bus (see /proc/bus/i2c -for a list of them, if i2c-proc is loaded), and the SMBus (I2C) address -of the chip at the end. An ADM1021 is uniquely characterised with these -two numbers. Likewise, for each MAX1617 chip, a directory max1617-i2c-?-?? -will be created. /proc/sys/dev/sensors/chips contains the SYSCTL values for -all chip directories. - -Within each ADM1021 or MAX1617 directory, you can find the following files: -* die_code (ADM1021_SYSCTL_DIE_CODE) - Silicon die (mask) revision code. This driver was written using a sample - device of die code 3. Normally this kind of information isn't reported - in its own proc file, but for a device this simple I didn't think it - would hurt. -* status (ADM1021_SYSCTL_STATUS) - This is an intergral number composed of 8-bits, which indicate the - different alarms and conversion status's of the chip. Here is what - each bit indicates: - 7 BUSY 1 When ADC Converting. - 6 LHIGH# 1 When Local High Temp Limit Tripped. - 5 LLOW# 1 When Local Low Temp Limit Tripped. - 4 RHIGH# 1 When Remote High Temp Limit Tripped. - 3 RLOW# 1 When Remote Low Temp Limit Tripped. - 2 OPEN# 1 When Remote Sensor Open-Circuit. (i.e., no connected remote - sensor) - 1-0 Reserved. - Note: # - These flags stay high until the status register is read or they - are reset by POR. -* temp1 (ADM1021_SYSCTL_TEMP) - A list of three numbers. The first number is the Overtemperature Shutdown - value, the second number is Low limit value, and the third number is the - current temperature. The first two values can be modified. Each value can - be set and read to full-degree accuracy. All values are in degrees Celsius. - An alarm is issued (usually to a connected ADM9240) when the temperature - gets higher then the Overtemperature Shutdown value; it stays on until - the temperature falls back below the Overtemperature Shutdown value. - NOTE: This is different than the way most remote temperature sensors work - (e.g. the LM75), they usually use the lower limit to clear the alarm set - from initially going above the Overtemperature limit. Instead, the - ADM1021 acts much the way that voltage limits work on, say, the LM78 or - ADM9240. A disadvantage to this is that the alarm doesn't have a - hysteresis (like a shmidt-trigger or thermostat) type of function for - doing things like controlling over-heat fans and such. Instead, the - lower limit can be used to signal an alarm if (goodness forbid!) the - computer gets too cold. - If accessed through sysctl, this is a list of longs, each being the - temperature times 10. -* temp2 (ADM1021_SYSCTL_REMOTE_TEMP) - Works exactly the same way as 'temp1', but uses an external temperature - probe for the sensing. The temperature probe is of a silicon diode type - and not of a thermal-resistive type. A probe can easily be made from a - common transister (see the ADM1021 for qualification specs) by shorting - the base to the collector. From the docs: "Transistors such as 2N3904, - 2N3906 or equivalents in SOT-23 package are suitable to use." - -The data for each chip is updated each 1.5 seconds, but only if it is -actually read. And, any alarms triggered between reads which always be -present in the next read just after the alarm was triggered (regardless if -the alarm situation has been resolved or not). - -This driver was written and is maintained by Philip Edelbrock -. Please send corrections/comments to him. For -further technical information on this chip, please get the Acrobat PDF -documentation available from www.analog.com. We'd also like to thank -Analog Devices for helping us with correspondance and free samples to make -this driver (and other Analog Devices drivers) possible. diff --git a/doc/chips/adm1024 b/doc/chips/adm1024 deleted file mode 100644 index 4965fa61..00000000 --- a/doc/chips/adm1024 +++ /dev/null @@ -1,12 +0,0 @@ -Kernel driver `adm1024.o' -========================= - -Status: Complete; Alpha. - -Supported chips: - * Analog Devices ADM1024 - Prefix: 'adm1024' - Addresses scanned: I2C 0x2c - 0x2e - Datasheet: Publicly available at the Analog Devices website - -Author: Ken Bowley diff --git a/doc/chips/adm1025 b/doc/chips/adm1025 deleted file mode 100644 index 0a2ab693..00000000 --- a/doc/chips/adm1025 +++ /dev/null @@ -1,135 +0,0 @@ -Kernel driver `adm1025.o' -========================= - -Status: Complete, known to work but not heavily tested - -Supported chips: - * Analog Devices ADM1025 - Prefix: 'adm1025' - Addresses scanned: I2C 0x2c - 0x2e - Datasheet: Publicly available at the Analog Devices website - * Philips NE1619 - Prefix: 'ne1619' - Addresses scanned: I2C 0x2c - 0x2d - Datasheet: Publicly available at the Philips website - -The NE1619 presents some differences with the original ADM1025: - * Only two possible addresses (0x2c - 0x2d). - * No temperature offset register, but we don't use it anyway. - * No INT mode for pin 16. We don't play with it anyway. - -Author: Chen-Yuan Wu and Jean Delvare - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_adm1025: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adm1025' chip -* force_ne1619: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `ne1619' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -(This is from Analog Devices.) The ADM1025 is a complete system hardware -monitor for microprocessor-based systems, providing measurement and limit -comparison of various system parameters. Five voltage measurement inputs -are provided, for monitoring +2.5V, +3.3V, +5V and +12V power supplies and -the processor core voltage. The ADM1025 can monitor a sixth power-supply -voltage by measuring its own VCC. One input (two pins) is dedicated to a -remote temperature-sensing diode and an on-chip temperature sensor allows -ambient temperature to be monitored. - -One specificity of this chip is that the pin 11 can be hardwired in two -different manners. It can act as the +12V power-supply voltage analog -input, or as the a fifth digital entry for the VID reading (bit 4). It's -kind of strange since both are useful, and the reason for designing the -chip that way is obscure at least to me. The bit 5 of the configuration -register can be used to define how the chip is hardwired. Please note -that it is not a choice you have to make as the user. The choice was -already made by your motherboard's maker. If the configuration bit isn't -set properly, you'll have a wrong +12V reading or a wrong VID reading. -The way the driver handles that is to preserve this bit through the -initialization process, assuming that the BIOS set it up properly -beforehand. If it turns out not to be true in some cases, we'll provide -a module parameter to force modes. - - -Chip Features -------------- - -Chips 'adm1025' and 'ne1619' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -in0 - - R- 2 -in1 - - R- 2 -in2 - - R- 2 -in3 - - R- 2 -in4 - - R- 2 -in5 - - R- 2 -in0_min in0 in0 RW 2 -in1_min in1 in1 RW 2 -in2_min in2 in2 RW 2 -in3_min in3 in3 RW 2 -in4_min in4 in4 RW 2 -in5_min in5 in5 RW 2 -in0_max in0 in0 RW 2 -in1_max in1 in1 RW 2 -in2_max in2 in2 RW 2 -in3_max in3 in3 RW 2 -in4_max in4 in4 RW 2 -in5_max in5 in5 RW 2 -temp1 - - R- 1 -temp1_low temp1 temp1 RW 1 -temp1_high temp1 temp1 RW 1 -temp2 - - R- 1 -temp2_low temp2 temp2 RW 1 -temp2_high temp2 temp2 RW 1 -vid - - R- 3 -vrm - - RW 1 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -in0 SENSORS_ADM1025_IN0 in0:3 -in1 SENSORS_ADM1025_IN1 in1:3 -in2 SENSORS_ADM1025_IN2 in2:3 -in3 SENSORS_ADM1025_IN3 in3:3 -in4 SENSORS_ADM1025_IN4 in4:3 -in5 SENSORS_ADM1025_IN5 in5:3 -in0_min SENSORS_ADM1025_IN0_MIN in0:1 -in1_min SENSORS_ADM1025_IN1_MIN in1:1 -in2_min SENSORS_ADM1025_IN2_MIN in2:1 -in3_min SENSORS_ADM1025_IN3_MIN in3:1 -in4_min SENSORS_ADM1025_IN4_MIN in4:1 -in5_min SENSORS_ADM1025_IN5_MIN in5:1 -in0_max SENSORS_ADM1025_IN0_MAX in0:2 -in1_max SENSORS_ADM1025_IN1_MAX in1:2 -in2_max SENSORS_ADM1025_IN2_MAX in2:2 -in3_max SENSORS_ADM1025_IN3_MAX in3:2 -in4_max SENSORS_ADM1025_IN4_MAX in4:2 -in5_max SENSORS_ADM1025_IN5_MAX in5:2 -temp1 SENSORS_ADM1025_TEMP1 temp1:3 -temp1_low SENSORS_ADM1025_TEMP1_LOW temp1:2 -temp1_high SENSORS_ADM1025_TEMP1_HIGH temp1:1 -temp2 SENSORS_ADM1025_TEMP2 temp2:3 -temp2_low SENSORS_ADM1025_TEMP2_LOW temp2:2 -temp2_high SENSORS_ADM1025_TEMP2_HIGH temp2:1 -vid SENSORS_ADM1025_VID vid:1 -vrm SENSORS_ADM1025_VRM vrm:1 -alarms SENSORS_ADM1025_ALARMS alarms:1 diff --git a/doc/chips/adm1026 b/doc/chips/adm1026 deleted file mode 100644 index 6330927a..00000000 --- a/doc/chips/adm1026 +++ /dev/null @@ -1,217 +0,0 @@ -Kernel driver `adm1026.o' -====================== - -Status: In development - -Supported chips: - * Analog Devices ADM1026 - Prefix: 'adm1026' - Addresses scanned: I2C 0x2c, 0x2d, 0x2e - -Author: Philip Pokorny - for Penguin Computing - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_adm1026: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - an `adm1026' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - -The following only apply to the first ADM1026 detected. These are a -workaround for if your BIOS hasn't setup your chip. - -* gpio_input: int array (min = 1, max = 17) - List of GPIO pins (0-16) to program as inputs -* gpio_output: int array (min = 1, max = 17) - List of GPIO pins (0-16) to program as outputs -* gpio_inverted: int array (min = 1, max = 17) - List of GPIO pins (0-16) to program as inverted -* gpio_normal: int array (min = 1, max = 17) - List of GPIO pins (0-16) to program as normal/non-inverted -* gpio_fan: int array (min = 1, max = 8) - List of GPIO pins (0-7) to program as fan tachs - - -Description ------------ - -This driver implements support for the Analog Devices ADM1026. Analog -Devices calls it a "complete thermal system management controller." - -The ADM1026 implements three (3) temperature sensors, 17 voltage -sensors, 16 general purpose digital I/O lines, eight (8) fan speed -sensors (8-bit), an analog output and a PWM output along with limit, -alarm and mask bits for all of the above. There is even 8k bytes of -EEPROM memory on chip. - -Temperatures are measured in degrees Celsius. There are two external -sensor inputs and one internal sensor. Each sensor has a high and low -limit. If the limit is exceeded, an interrupt (#SMBALERT) can be -generated. The interrupts can be masked. In addition, there are -over-temp limits for each sensor. If this limit is exceeded, the -#THERM output will be asserted. The current temperature and limits -have a resolution of 1 degree. - -Fan rotation speeds are reported in RPM (rotations per minute) but -measured in counts of a 22.5kHz internal clock. Each fan has a high -limit which corresponds to a minimum fan speed. If the limit is -exceeded, an interrupt can be generated. Each fan can be programmed -to divide the reference clock by 1, 2, 4 or 8. Not all RPM values can -accurately be represented, so some rounding is done. With a divider of -8, the slowest measureable speed of a one pulse per rev fan is 1323 -RPM. Two pulse per rev fans can be measured as slow as 661 RPM. - -Voltage sensors (in0 to in16) report their values in volts. An alarm -is triggered if the voltage has crossed a programmable minimum or -maximum limit. Note that minimum in this case always means 'closest -to zero'; this is important for negative voltage measurements. -Several inputs have integrated attenuators so they can measure higher -voltages directly. 3.3V, 5V, 12V, -12V and battery voltage all have -dedicated inputs. There are several inputs scaled to 0-3V full-scale -range for SCSI terminator power. The remaining inputs are not scaled -and have a 0-2.5V full-scale range. A 2.5V or 1.82V reference voltage -is provided for negative voltage measurements. - -If an alarm triggers, it will remain triggered until the hardware -register is read at least once. This means that the cause for the -alarm may already have disappeared! Note that in the current -implementation, all hardware registers are read whenever any data is -read (unless it is less than 2.0 seconds since the last update). This -means that you can easily miss once-only alarms. - -The ADM1026 measures continuously. Analog inputs are measured about 4 -times a second. Fan speed measurement time depends on fan speed and -divisor. It can take as long as 1.5 seconds to measure all fan -speeds. - -The ADM1026 has the ability to automaticaly control fan speed based on -the temperature sensor inputs. Both the PWM output and the DAC output -can be used to control fan speed. Usually only one of these two -outputs will be used. Write the minimum PWM or DAC value to the -appropriate control register. Then set the low temperature limit in -the tmin values for each temperature sensor. The range of control is -fixed at 20 degC, and the largest difference between current and tmin -of the temperature sensors sets the control output. See the datasheet -for several example circuits for controlling fan speed with the PWM -and DAC outputs. The fan speed sensors do not have PWM compensation, -so it is probably best to control the fan voltage from the power -lead rather than on the ground lead. - -The datasheet shows an example application with VID signals attached -to GPIO lines. Unfortunately, the chip may not be connected to the -VID lines in this way. The driver assumes that the chips *is* -connected this way to get a vid voltage. If the VID value is wrong or -not wired as shown in the example, then you will need to write the -correct VID value to the driver either based on the GPIO values or -setting it directly. The value written to VID should be the *raw* VID -value (0 to 0x3f) or -1 (to restore the default value). When read, -the vid interface returns the scaled voltage according to the VRM spec -selected. - -Example sensors.conf --------------------- - -Here is an example sensors.conf configuration section for the ADM1026. - ---------- cut here --------- -chip "adm1026-*" - -# Voltage inputs - label in0 "V2.25_0" # Scaled for "SCSI terminator"? - label in1 "V2.25_1" # supply voltage? - label in2 "V2.25_2" - label in3 "V2.25_3" - label in4 "V2.25_4" - label in5 "V2.25_5" - - label in6 "V1.875_0" # Unscaled inputs - label in7 "V1.875_1" - -# If temp3 is enabled, in8 and in9 are disabled. -# label in8 "V1.875_2" -# label in9 "V1.875_3" - ignore in8 - ignore in9 - -# Dedicated voltage inputs - label in10 "Vbat" - label in11 "V3.3STBY" - label in12 "V3.3MAIN" - label in13 "V5" - label in14 "Vccp" - label in15 "V12" - label in16 "V-12" - -# Temperature inputs - label temp1 "Board" - label temp2 "CPU0" - label temp3 "CPU1" - -# Fan inputs - label fan0 "CPU_Fan" - label fan1 "Fan1" - label fan2 "Fan2" - label fan3 "Fan3" - label fan4 "Fan4" - label fan5 "Fan5" - label fan6 "Fan6" - label fan7 "Fan7" - -# PWM Outputs - label pwm "PWM" - -# Voltage scaling is done on-chip. No 'compute' directive -# should be necessary. If in0-in9 have external scaling, -# set it here. - -# compute in0 @ * 2.5, @ / 2.5 - -# Adjust fans speeds for actual pulses per rev -# compute fan0 @ / 2, @ * 2 # 2 pulse per rev -# compute fan1 @ / 3, @ * 3 # 3 pulse per rev -# compute fan2 @ / 4, @ * 4 # 4 pulse per rev -# compute fan3 @ / 8, @ * 8 # 8 pulse per rev - -# Set VRM version - set vrm 9.1 -# set vid 1.580 - -# Set voltage limits - set in10_min 3.0 * 0.95 - set in10_max 3.0 * 1.05 - set in11_min 3.3 * 0.95 - set in11_max 3.3 * 1.05 - set in12_min 3.3 * 0.95 - set in12_max 3.3 * 1.05 - set in13_min 5.0 * 0.95 - set in13_max 5.0 * 1.05 -# Uncomment if VID is wired or set above -# set in14_min vid * 0.95 -# set in14_max vid * 1.05 - set in15_min 12 * 0.95 - set in15_max 12 * 1.05 - set in16_min -12 * 0.95 - set in16_max -12 * 1.05 - -# Set Fan limits - set fan0_min 7000 - set fan1_min 7000 - set fan2_min 7000 - set fan3_min 7000 - set fan4_min 3000 - set fan5_min 3000 - set fan6_min 3000 - set fan7_min 3000 - diff --git a/doc/chips/adm1031 b/doc/chips/adm1031 deleted file mode 100644 index db59c94b..00000000 --- a/doc/chips/adm1031 +++ /dev/null @@ -1,109 +0,0 @@ -Kernel driver `adm1031.o' -========================= - -Status: Driver supports basic temp and fan readings, min/max/crit settings - alarms. This driver does not support auto fan control. - -Supported chips: - * Analog Devices ADM1030 - Prefix: 'adm1030' - Addresses scanned: I2C 0x2c to 0x2e - Datasheet: Publicly available at the Analog Devices website - http://products.analog.com/products/info.asp?product=ADM1030 - - * Analog Devices ADM1031 - Prefix: 'adm1031' - Addresses scanned: I2C 0x2c to 0x2e - Datasheet: Publicly available at the Analog Devices website - http://products.analog.com/products/info.asp?product=ADM1031 - - -Author: Alexandre d'Alton - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_adm1030: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adm1030' chip -* force_adm1031: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adm1031' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -ADM1030 and ADM1031 are digital temperature sensors and fan controllers. -They sense their own temperature as well as the temperature of up to one -(ADM1030) or two (ADM1031) external diodes. - -All temperature values are given in degrees Celsius. Resolution -is 0.5 degree for the local temperature, 0.125 degree for the remote -temperatures. - -Each temperature channel has its own high and low limits, plus a critical -limit. - -The ADM1030 monitors a single fan speed, while the ADM1031 monitors up to -two. Each fan channel has its own low speed limit. - - -Chip Features -------------- - -Chip 'adm1030' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp1 - - R- 3 -temp1_high temp1 temp1 RW 3 -temp1_low temp1 temp1 RW 3 -temp1_crit temp1 temp1 RW 3 -temp2 - - R- 3 -temp2_high temp2 temp2 RW 3 -temp2_low temp2 temp2 RW 3 -temp2_crit temp2 temp2 RW 3 - -fan1_input - - R- 0 -fan1_min fan1 fan1 RW 0 -fan1_div fan1 - RW 0 - -alarms - - R- 0 - -Chip 'adm1031' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp1 - - R- 3 -temp1_high temp1 temp1 RW 3 -temp1_low temp1 temp1 RW 3 -temp1_crit temp1 temp1 RW 3 -temp2 - - R- 3 -temp2_high temp2 temp2 RW 3 -temp2_low temp2 temp2 RW 3 -temp2_crit temp2 temp2 RW 3 -temp3 - - R- 3 -temp3_high temp3 temp3 RW 3 -temp3_low temp3 temp3 RW 3 -temp3_crit temp3 temp3 RW 3 - -fan1_input - - R- 0 -fan1_min fan1 fan1 RW 0 -fan1_div fan1 - RW 0 -fan2_input - - R- 0 -fan2_min fan2 fan2 RW 0 -fan2_div fan2 - RW 0 - -alarms - - R- 0 diff --git a/doc/chips/adm9240 b/doc/chips/adm9240 deleted file mode 100644 index bdad871d..00000000 --- a/doc/chips/adm9240 +++ /dev/null @@ -1,424 +0,0 @@ -Kernel driver `adm9240.o' -========================= - -Status: Complete and tested - -Supported chips: - * Analog Devices ADM9240 - Prefix: 'adm9240' - Addresses scanned: I2C 0x2c - 0x2f - Datasheet: Publicly available at the Analog Devices website - * Dallas Semiconductor DS1780 - Prefix: 'ds1780' - Addresses scanned: I2C 0x2c - 0x2f - Datasheet: Publicly available at the Dallas Semiconductor website - * National Semiconductor LM81 - Prefix: 'lm81' - Addresses scanned: I2C 0x2c - 0x2f - Datasheet: Publicly available at the National Semiconductor website - - -Author: Frodo Looijaard and Philip Edelbrock - - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_adm9240: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adm9240' chip -* force_ds1780: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `ds1780' chip -* force_lm81: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm81' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This driver implements support for the Analog Devices ADM9240, -Dallas Semiconductor DS1780, and National Semiconductor LM81 chips. -These chips appear to be completely -identical, except for the manufacturer IDs encoded in two registers, and -the speed with which they update their sensor readings. - -The chips implement six voltage sensors, a temperature sensor, -two fan rotation speed sensors, VID lines and some miscellaneous stuff. - -Temperatures are measured in degrees Celsius. An alarm is triggered whenever -the temperature is above the hot limit, and will continue to be generated -until the temperature has dropped beneath the hysteresis limit. Measurements -are guaranteed between -40 and +125 degrees. The current temperature -has a resolution of 0.5 degrees, the limits of 1 degree. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -Voltage sensors (also known as IN sensors) report their values in volts. -An alarm is triggered if the voltage has crossed a programmable minimum -or maximum limit. Note that minimum in this case always means 'closest to -zero'; this is important for negative voltage measurements. -IMPORTANT: The current voltage measurement system is very probably broken. -Please report back to us if you have a ADM9240 or DS1780! - -The VID lines encode the core voltage value: the voltage level your processor -should work with. This is hardcoded by the mainboard and/or processor itself. -It is a value in volts. When it is unconnected, you will often find the -value 3.50 V here. - -The analog output can be programmed separatedly. It can take values -between 0 and 255. What it actually does is mainboard-dependent; it -might influence the fan speed. Please report to us whether this is -the case with your ADM9240. - -In addition to the alarms described above, the CHAS alarm triggers -if your computer case is open. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.5 seconds since the last update). This means that you can easily -miss once-only alarms. - -Thes ADM9240 only updates its values every 0.5 seconds; the DS1780 one -every 2 seconds; and the LM81 every 0.4 seconds. -Reading them more often will do no harm, but will return -'old' values. (NB: theoretically, this could be done much faster for the -ADM9240, but there is no real reason to do so, and this way the SMBus use -is kept within reasonable limits) - - -Chip Features -------------- - -Chip `adm9240' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - 2.5V NONE NONE R 2 - Vccp1 NONE NONE R 2 - 3.3V NONE NONE R 2 - 5V NONE NONE R 2 - 12V NONE NONE R 2 - Vccp2 NONE NONE R 2 - 2.5V_min 2.5V 2.5V RW 2 - Vccp1_min Vccp1 Vccp1 RW 2 - 3.3V_min 3.3V 3.3V RW 2 - 5V_min 5V 5V RW 2 - 12V_min 12V 12V RW 2 - Vccp2_min Vccp2 Vccp2 RW 2 - 2.5V_max 2.5V 2.5V RW 2 - Vccp1_max Vccp1 Vccp1 RW 2 - 3.3V_max 3.3V 3.3V RW 2 - 5V_max 5V 5V RW 2 - 12V_max 12V 12V RW 2 - Vccp2_max Vccp2 Vccp2 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - alarms NONE NONE R 0 - analog_out NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - 2.5V SENSORS_ADM9240_IN0 2.5V:3 - Vccp1 SENSORS_ADM9240_IN1 Vccp1:3 - 3.3V SENSORS_ADM9240_IN2 3.3V:3 - 5V SENSORS_ADM9240_IN3 5V:3 - 12V SENSORS_ADM9240_IN4 12V:3 - Vccp2 SENSORS_ADM9240_IN5 Vccp2:3 - 2.5V_min SENSORS_ADM9240_IN0_MIN 2.5V:1 - Vccp1_min SENSORS_ADM9240_IN1_MIN Vccp1:1 - 3.3V_min SENSORS_ADM9240_IN2_MIN 3.3V:1 - 5V_min SENSORS_ADM9240_IN3_MIN 5V:1 - 12V_min SENSORS_ADM9240_IN4_MIN 12V:1 - Vccp2_min SENSORS_ADM9240_IN5_MIN Vccp2:1 - 2.5V_max SENSORS_ADM9240_IN0_MAX 2.5V:2 - Vccp1_max SENSORS_ADM9240_IN1_MAX Vccp1:2 - 3.3V_max SENSORS_ADM9240_IN2_MAX 3.3V:2 - 5V_max SENSORS_ADM9240_IN3_MAX 5V:2 - 12V_max SENSORS_ADM9240_IN4_MAX 12V:2 - Vccp2_max SENSORS_ADM9240_IN5_MAX Vccp2:2 - fan1 SENSORS_ADM9240_FAN1 fan1:2 - fan2 SENSORS_ADM9240_FAN2 fan2:2 - fan1_min SENSORS_ADM9240_FAN1_MIN fan1:1 - fan2_min SENSORS_ADM9240_FAN2_MIN fan2:1 - temp SENSORS_ADM9240_TEMP temp:3 - temp_hyst SENSORS_ADM9240_TEMP_HYST temp:2 - temp_over SENSORS_ADM9240_TEMP_OVER temp:1 - vid SENSORS_ADM9240_VID vid:1 - fan1_div SENSORS_ADM9240_FAN1_DIV fan_div:1 - fan2_div SENSORS_ADM9240_FAN2_DIV fan_div:2 - alarms SENSORS_ADM9240_ALARMS alarms:1 - analog_out SENSORS_ADM9240_ANALOG_OUT analog_out:1 - - -Chip `ds1780' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - 2.5V NONE NONE R 2 - Vccp1 NONE NONE R 2 - 3.3V NONE NONE R 2 - 5V NONE NONE R 2 - 12V NONE NONE R 2 - Vccp2 NONE NONE R 2 - 2.5V_min 2.5V 2.5V RW 2 - Vccp1_min Vccp1 Vccp1 RW 2 - 3.3V_min 3.3V 3.3V RW 2 - 5V_min 5V 5V RW 2 - 12V_min 12V 12V RW 2 - Vccp2_min Vccp2 Vccp2 RW 2 - 2.5V_max 2.5V 2.5V RW 2 - Vccp1_max Vccp1 Vccp1 RW 2 - 3.3V_max 3.3V 3.3V RW 2 - 5V_max 5V 5V RW 2 - 12V_max 12V 12V RW 2 - Vccp2_max Vccp2 Vccp2 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - alarms NONE NONE R 0 - analog_out NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - 2.5V SENSORS_DS1780_IN0 2.5V:3 - Vccp1 SENSORS_DS1780_IN1 Vccp1:3 - 3.3V SENSORS_DS1780_IN2 3.3V:3 - 5V SENSORS_DS1780_IN3 5V:3 - 12V SENSORS_DS1780_IN4 12V:3 - Vccp2 SENSORS_DS1780_IN5 Vccp2:3 - 2.5V_min SENSORS_DS1780_IN0_MIN 2.5V:1 - Vccp1_min SENSORS_DS1780_IN1_MIN Vccp1:1 - 3.3V_min SENSORS_DS1780_IN2_MIN 3.3V:1 - 5V_min SENSORS_DS1780_IN3_MIN 5V:1 - 12V_min SENSORS_DS1780_IN4_MIN 12V:1 - Vccp2_min SENSORS_DS1780_IN5_MIN Vccp2:1 - 2.5V_max SENSORS_DS1780_IN0_MAX 2.5V:2 - Vccp1_max SENSORS_DS1780_IN1_MAX Vccp1:2 - 3.3V_max SENSORS_DS1780_IN2_MAX 3.3V:2 - 5V_max SENSORS_DS1780_IN3_MAX 5V:2 - 12V_max SENSORS_DS1780_IN4_MAX 12V:2 - Vccp2_max SENSORS_DS1780_IN5_MAX Vccp2:2 - fan1 SENSORS_DS1780_FAN1 fan1:2 - fan2 SENSORS_DS1780_FAN2 fan2:2 - fan1_min SENSORS_DS1780_FAN1_MIN fan1:1 - fan2_min SENSORS_DS1780_FAN2_MIN fan2:1 - temp SENSORS_DS1780_TEMP temp:3 - temp_hyst SENSORS_DS1780_TEMP_HYST temp:2 - temp_over SENSORS_DS1780_TEMP_OVER temp:1 - vid SENSORS_DS1780_VID vid:1 - fan1_div SENSORS_DS1780_FAN1_DIV fan_div:1 - fan2_div SENSORS_DS1780_FAN2_DIV fan_div:2 - alarms SENSORS_DS1780_ALARMS alarms:1 - analog_out SENSORS_DS1780_ANALOG_OUT analog_out:1 - - -Chip `lm81' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - 2.5V NONE NONE R 2 - Vccp1 NONE NONE R 2 - 3.3V NONE NONE R 2 - 5V NONE NONE R 2 - 12V NONE NONE R 2 - Vccp2 NONE NONE R 2 - 2.5V_min 2.5V 2.5V RW 2 - Vccp1_min Vccp1 Vccp1 RW 2 - 3.3V_min 3.3V 3.3V RW 2 - 5V_min 5V 5V RW 2 - 12V_min 12V 12V RW 2 - Vccp2_min Vccp2 Vccp2 RW 2 - 2.5V_max 2.5V 2.5V RW 2 - Vccp1_max Vccp1 Vccp1 RW 2 - 3.3V_max 3.3V 3.3V RW 2 - 5V_max 5V 5V RW 2 - 12V_max 12V 12V RW 2 - Vccp2_max Vccp2 Vccp2 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - alarms NONE NONE R 0 - analog_out NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - 2.5V SENSORS_ADM9240_IN0 2.5V:3 - Vccp1 SENSORS_ADM9240_IN1 Vccp1:3 - 3.3V SENSORS_ADM9240_IN2 3.3V:3 - 5V SENSORS_ADM9240_IN3 5V:3 - 12V SENSORS_ADM9240_IN4 12V:3 - Vccp2 SENSORS_ADM9240_IN5 Vccp2:3 - 2.5V_min SENSORS_ADM9240_IN0_MIN 2.5V:1 - Vccp1_min SENSORS_ADM9240_IN1_MIN Vccp1:1 - 3.3V_min SENSORS_ADM9240_IN2_MIN 3.3V:1 - 5V_min SENSORS_ADM9240_IN3_MIN 5V:1 - 12V_min SENSORS_ADM9240_IN4_MIN 12V:1 - Vccp2_min SENSORS_ADM9240_IN5_MIN Vccp2:1 - 2.5V_max SENSORS_ADM9240_IN0_MAX 2.5V:2 - Vccp1_max SENSORS_ADM9240_IN1_MAX Vccp1:2 - 3.3V_max SENSORS_ADM9240_IN2_MAX 3.3V:2 - 5V_max SENSORS_ADM9240_IN3_MAX 5V:2 - 12V_max SENSORS_ADM9240_IN4_MAX 12V:2 - Vccp2_max SENSORS_ADM9240_IN5_MAX Vccp2:2 - fan1 SENSORS_ADM9240_FAN1 fan1:2 - fan2 SENSORS_ADM9240_FAN2 fan2:2 - fan1_min SENSORS_ADM9240_FAN1_MIN fan1:1 - fan2_min SENSORS_ADM9240_FAN2_MIN fan2:1 - temp SENSORS_ADM9240_TEMP temp:3 - temp_hyst SENSORS_ADM9240_TEMP_HYST temp:2 - temp_over SENSORS_ADM9240_TEMP_OVER temp:1 - vid SENSORS_ADM9240_VID vid:1 - fan1_div SENSORS_ADM9240_FAN1_DIV fan_div:1 - fan2_div SENSORS_ADM9240_FAN2_DIV fan_div:2 - alarms SENSORS_ADM9240_ALARMS alarms:1 - analog_out SENSORS_ADM9240_ANALOG_OUT analog_out:1 - - - - -Old Documentation ------------------ - -Supports the Analog Devices ADM9240 and the Dallas Semiconductor DS1780. -These chips are apparently identical except for the manufacturer ID -register. -The proc directory will be adm9240-i2c-x-xx for the adm9240 and -ds1780-i2c-x-xx for the ds1780. - ------------------------------------------------------------------------ - -This file documents the adm9240 directories for the Analog Devices -ADM9240 hardware health monitoring chip found on some Intel mainboards -(and others?). - -There will be one directory created for each detected ADM9240 chip. -Each chip must be on the SMBus. Directories are called things -like adm9240-i2c-1-2c. /proc/sys/dev/sensors/chips contains the SYSCTL -values for all chip directories. - -Within each ADM9240 directory, you can find the following files: -* alarms (ADM9240_SYSCTL_ALARMS) - A number which indicates which alarms are on. An alarm gets triggered when - some limit has been crossed. This number is composed from a 16 bit - value which is the combination of the Interrupt Status Register 1 - (low byte) and 2 (high byte). - This file can not be written to. - The number is the logical OR of the following components (bit # - followed by a description): - -0 +2.5 V_Error Read Only A "1" indicates a high or low limit has been exceeded. -1 VCCP_Error Read Only A "1" indicates a high or low limit has been exceeded. -2 +3.3 V_Error Read Only A "1" indicates a high or low limit has been exceeded. -3 +5 V_Error Read Only A "1" indicates a high or low limit has been exceeded. -4 Temp_Error Read Only A "1" indicates that a temperature interrupt has been set. -5 Reserved Read Only Undefined. -6 FAN1_Error Read Only A "1" indicates that a fan count limit has been exceeded. -7 FAN2_Error Read Only A "1" indicates that a fan count limit has been exceeded. -8 +12 V_Error Read Only A "1" indicates a high or low limit has been exceeded. -9 VCCP2_Error Read Only A "1" indicates a high or low limit has been exceeded. -10 Reserved Read Only Undefined. -11 Reserved Read Only Undefined. -12 Chassis_Error Read Only A "1" indicates chassis intrusion has gone high. -13 Reserved Read Only Undefined. -14 Reserved Read Only Undefined. -15 Reserved Read Only Undefined. - - If accessed through sysctl, this value is a long. -* fan[1-3] (ADM9240_SYSCTL_FAN[1-2]) - A list of two numbers. The first is the minimum fan rotation limit; the - second is the current fan rotation speed. Both are in RPM (rotations per - minute). An alarm is triggered if the rotation speed drops below the - limit. The first value can be changed. Not all RPM values can accurately - be represented, so some rounding is done. - If accessed through sysctl, this is a list of longs. -* fan_div (LM78_SYSCTL_FAN_DIV) - A list of two numbers, one for each fan. Each number can be either 1, 2, - 4 or 8. It is the internal scaling factor used for the fan rotations. If - you change this number, the fan readings get more or less detailed, but - the range in which they can be read too. Higher numbers give better - resolution, but less range. The first two numbers can be changed, the - third not. - If accessed through sysctl, this is a list of longs. -* 2.5V, Vccp1, 3.3V, 5V, 12V, and Vccp2 (ADM9240_SYSCTL_IN[0-5] in the - order shown) - A list of three numbers. The first is the minimum limit, the second is the - maximum limit, and the third is the current value. Note that - minimum means 'closest to zero'; so if the normal value equals -10, a - minimum could equal -9, and a maximum -11. Vccp1 and Vccp2 reflect core - voltages; they are by default set from the vid values, or set to 2.80V - if the vid lines seem to be unconnected. Not all voltage values - can be accurately represented, so some rounding is done. - The first two numbers can be changed, the third not. - If accessed through sysctl, this is a list of longs, each being the voltage - times 100. -* temp - A list of three numbers. The first number is the Overtemperature Shutdown - value; the second is the Hysteresis value and the third number is the - current value. The first two values can be modified. All values are in - degrees Celsius. An alarm is issued when the temperature first gets above - the Overtemperature Shutdown value; no more alarms are issued until the - temperature gets below the Hysteresis value, at which moment another alarm - is issued, and the state is reset. A more useful behaviour can be found - by setting the Hysteresis value to +127 degrees Celsius; in this case, - alarms are issued during all the time when the actual temperature is - above the Overtemperature Shutdown value. - The first two numbers can be changed, the third not. - If accessed through sysctl, this is a list of longs, each being the - temperature in degrees Celsius times 10. -* vid - The core voltage value (the voltage level your processor should work with), - in volts. This is the value IN0 and IN1 are initialized to. If unconnected, - it usually reads 3.50V. - This number can not be changed. - If accessed through sysctl, this is a long, being the voltage times 100. -* analog_out - This is feature is specific to the ADM9240. It is a DAC voltage - control register for the Analog-Out pin. Valid values are from 255 - to 0 (with 255 being the highest voltage, and 0 the lowest). From - the docs: "The ADM9240 has a single analog output from an unsigned - 8-bit DAC which produces 0 V - 1.25 V." - -The data for each ADM9240 is updated each 1.5 seconds, -but only if it is actually read. - -Note: Much of this documentation is copied from the LM78 documenation -(the device from which most featuers of the ADM9240 is modelled from). -The maintainer of the ADM9240 is Philip Edelbrock -; please forward corrections, suggestions, etc. -to him. For further technical information on this chip, I suggest -getting the Acrobat PDF documentation from www.analog.com. - -Dallas documentation is at http://www.dalsemi.com. diff --git a/doc/chips/asb100 b/doc/chips/asb100 deleted file mode 100644 index ab099b68..00000000 --- a/doc/chips/asb100 +++ /dev/null @@ -1,89 +0,0 @@ -Kernel driver `asb100.o' -======================== - -Status: Work in progress - -Supported Chips: - * Asus ASB100 and ASB100-A "Bach" - Prefix: 'asb100' - Addresses scanned: I2C 0x2d - Datasheet: none released - -Author: Mark M. Hoffman - -Module Parameters ------------------ - - - -Asus' BIOS is often broken --------------------------- - -If you have an Asus P4PE, you need to read prog/hotplug/README.p4b. - -If you have any other (Asus) board for which sensors-detect finds neither -asb100 nor an I2C bus, please read prog/hotplug/README.p4b before sending -a bug report. - -Description ------------ - -This driver implements support for the Asus ASB100 and ASB100-A "Bach". These -are custom ASICs available only on Asus mainboards. Asus refuses to supply a -datasheet for these chips. Thanks go to many people who helped investigate -their hardware, including: - -Vitaly V. Bursov -Alexander van Kaam (author of MBM for Windows) -Bertrik Sikken - -The ASB100 implements seven voltage sensors, three fan rotation speed sensors, -four temperature sensors, VID lines and alarms. In addition to these, the -ASB100-A also implements a single PWM controller for fans 2 and 3 (i.e. one -setting controls both.) If you have a plain ASB100, the pwm controller will -simply not work (or maybe it will for you... it doesn't for me). - -Temperatures are measured and reported in degrees Celsius. - -Fan speeds are reported in RPM (rotations per minute). An alarm is triggered -if the rotation speed has dropped below a programmable limit. - -Voltage sensors (also known as IN sensors) report values in volts. - -The VID lines encode the core voltage value: the voltage level your processor -should work with. This is hardcoded by the mainboard and/or processor itself. -It is a value in volts. - -Alarms: (TODO question marks indicate may or may not work) - -0x0001 => in0 (?) -0x0002 => in1 (?) -0x0004 => in2 -0x0008 => in3 -0x0010 => temp1 (1) -0x0020 => temp2 -0x0040 => fan1 -0x0080 => fan2 -0x0100 => in4 -0x0200 => in5 (?) (2) -0x0400 => in6 (?) (2) -0x0800 => fan3 -0x1000 => chassis switch -0x2000 => temp3 - -Alarm Notes: - -(1) This alarm will only trigger if the hysteresis value is 127C. -I.e. it behaves the same as w83781d. - -(2) The min and max registers for these values appear to -be read-only or otherwise stuck at 0x00. - -TODO: -* Experiment with fan divisors > 8. -* Experiment with temp. sensor types. -* Are there really 13 voltage inputs? Probably not... -* Fix bogus client deregistration (like w83781d in 2.6). -* Fix fan divisor / fan minimum interaction (like lm78). -* Cleanups, no doubt... - diff --git a/doc/chips/bmcsensors b/doc/chips/bmcsensors deleted file mode 100644 index b2aac3a1..00000000 --- a/doc/chips/bmcsensors +++ /dev/null @@ -1,140 +0,0 @@ -Kernel driver `bmcsensors.o' -========================== - -Status: Alpha - -Supported chips: - * IPMI BMC - Prefix: 'bmc' - Requires dummy adapter i2c-ipmi; - Driver will be registered as bmc-ipmi-0000. - -Author: M. Studebaker - -License: GPL - - -Module Parameters ------------------ - -None. - - -Detection ---------- - -Registers only with i2c-ipmi. - - -Description ------------ - -Together with the i2c-ipmi module, this provides high-level -access to sensors known by the BMC. For low-level access to -IPMB (I2C/SMBus) busses behind the BMC, use the i2c-ipmb module -and individual chip drivers. - -This module REQUIRES the IPMI kernel patch by Corey Minyard, -v13 or higher, available at http://openipmi.sourceforge.net . -Other IPMI drivers are not supported. - -See http://www.intel.com/design/servers/ipmi/ for -IPMI standards information. - -You must configure the following features in your kernel -(under Character Devices): - IPMI top-level message handler - IPMI KCS handler -The IPMI device interface and IPMI watchdog handler are not required. - -You must modprobe i2c-ipmi separately, it will not -load automatically when you modprobe bmcsensors. - -If the KCS handler (ipmi_kcs_drv) is configured as a module, -you must also modprobe it separately, it will not load automatically -when you modprobe i2c-ipmi or ipmi_msghandler (unless you set up -/etc/modules.conf to load ipmi_kcs_drv when ipmi_msghandler is loaded). - - -/proc entries -------------- - -The BMC SDR's (Sensor Data Records) are scanned and -the /proc table is built dynamically. Sensor types and quantities -depend on what the BMC supports. - - curr1-n Currents. Max, min, and reading in amps. - fan1-n Fan speeds. Min and reading in RPM. - in1-n Voltages. Max, min, and reading in volts. - temp1-n Temps. Max, hysteresis or min, and reading in degrees C. - -Thresholds will appear as 0 if unsupported or unreadable, as indicated -in the SDR. - -If the thresholds are not settable (as indicated in the SDR), the -/proc permissions for that sensor will be 444. - -After the SDR's are scanned, the module will print -the sensor names and bindings to syslog/dmesg. -Cut these messages out and paste them to /etc/sensors.conf -so that 'sensors' has correct labeling. - - -Issues ------- -The module will not register in /proc/sys/dev/sensors until -the SDR's are scanned. This may take several seconds. - -The driver uses a very simple state machine. It only sends -one message at a time and then waits for a response. -This makes the driver relatively slow. -If a response is an error or does not arrive, the driver -will probably be stuck. - -/proc access kicks off an update but returns the old data, -not the new; need to wait for update to finish and then return. - -Probably there are some locking issues. - -Every attempt is made to present the sensor data in /proc in a -manner consistent with lm_sensors /proc standards, as defined -in doc/developers/proc. Given the wide variation in possible SDR definitions, -this may not generate expected or useful data. - -IPMI supports up to 4 max and 4 min thresholds (non-recoverable, critical, -non-critical, and hysteresis) for each sensor. This driver -tries to pick out the best one and exports it as the max and min -to /proc. - -ins start at 1, other modules start at in0. - -Alarms and thresholds are not yet supported. - -Threshold-only sensors are not supported. - -Threshold setting is not yet supported. - -1's and 2's complement formats not yet supported. - -Non-linear conversions not supported, except for 1/x. - -Fan divs are not supported (or required) - should the driver -export a fan_div entry (1 1 1 ...) for compatibility? - -Supports only sensor types 1-4 (temp, voltage, current, and fan). - -Libsensors can't handle dynamic /proc entries so the table -in lib/chips.c must be static and contain the max number of -each sensor. Bmcsensors can register more of a sensor type -than libsensors supports in its static table. - -Only one BMC is supported - shouldn't be a problem. - -Alpha! - - - - -********************** -The lm_sensors project gratefully acknowledges the support of -Hewlett Packard (Ft. Collins) in the development of this driver. diff --git a/doc/chips/bt869 b/doc/chips/bt869 deleted file mode 100644 index 9a3b1470..00000000 --- a/doc/chips/bt869 +++ /dev/null @@ -1,397 +0,0 @@ -Kernel driver `bt869.o' -====================== - -Status: 'Beta' and needs further development and testing - -Supported chips: - * Brooktree BT869 Video Modulator chips - Prefix: 'bt869' - Addresses scanned: I2C 0x44 - 0x45 - Datasheet: Publicly available at the brooktree web site - (www.brooktree.com) - -Author: Frodo Looijaard , Philip Edelbrock - , Ralph Metzler - Steve Davies added the 720x576 and - 720x480 support, and the svideo configuration. - -Main Contact: Philip Edelbrock - -Module Parameters ------------------ -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_bt869: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `bt869' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This driver provides some access to the Brooktree bt869 found on some -video cards (like the 'Voodoo3 3000'). Typically, the output can be -either an s-video connection or composite video. Resolutions -supported using the chip's built in configurations are 640x480 or -800x600. In addition, a 720x576 PAL mode and a 720x480 NTSC mode, -both without overscan compensation, are supported - a convenient -configuration for video playback. - -Other possible implementations may allow for double resolutions with some -decimations (e.g., a monitor running at 1280x960 but the TV out getting every -other pixel for 640x480). - - -Driver Features ---------------- -Standards: (US) NTSC or PAL -Resolutions: 640x480, 800x600, 720x576 (PAL only), 720x480 (NTSC only) -Depths: 16, 24 or 32 bits -Colorbars: Switch on the built-in color bar generator. (FYI- using a blue -filter, you should see only alternating bright stripes of equal brightness. -Adjust your TV's color and saturation if this isn't the case.) -SVideo: composite or s-video output. Also, theoretically, RGB output, though -this isn't tested and will require that your card presents all three DAC outputs -(the 3dfx Voodoo3 doesn't) - -In your XF86Config file, you should have these entries for NTSC output: - -ModeLine "640x480NTSC" 28.195793 640 656 658 784 480 520 525 600 -ModeLine "720x480NTSC" 27.5 720 744 800 872 480 483 485 525 -ModeLine "800x600NTSC" 38.769241 800 812 814 880 600 646 649 735 - -or for PAL - -ModeLine "640x480PAL" 29.50 640 675 678 944 480 530 535 625 -ModeLine "720x576PAL" 27.50 720 744 800 880 576 581 583 625 -ModeLine "800x600PAL" 36.00 800 818 820 960 600 653 655 750 - -Also, don't forget to add these modes to the resolutions list in the -'screen' sections of XF86Config. You can change modes on the fly in X by -pressing (usually) ctrl-alt-+ or ctrl-alt-(minus) with + and - being the -keys on your numeric 10-key pad. - -BTW- My monitor doesn't like these entries very much, and as I've read: -don't run your monitor out of spec or else it will burst into fire. So, -having the monitor turned on while in any of these modes is at your own -risk. (I've never heard of a monitor breaking from this, but it seems to -be fashionable to warn about it.) - - -Chip Features -------------- -The chip is very flexible and customizable for many standards. Right -now the driver sticks with the chip's built in NTSC and PAL standards, -with the addition of the 720x576PAL and 720x480NTSC modes. It also -does some other wacky stuff like closed-captioning, Macro-vision -copy-protection, and other things. Check out the datasheet for more -info. - - -Issues ------- -The depth register doesn't seem to do much? If you have troubles or -aren't sure the output is working, turn the color-bars on. If they display -OK, then the chip is syncing correctly. The next thing to try is the depth -setting. Lastly, turning off your computer and back on with your TV -connected but you monitor not, may force the video card to configure and -use the BT869 as your primary output device (all bets are off once X is -started). Let me know if you have problems which you can't figure out -(phil@netroedge.com). - --------------------------------- - -On May 3rd, 2001 (My birthday, as it happens to be :') Tomi Ollila sent me -a how-to from a user's perspective on using the BT869 with a 3Dfx card. -It should also provide insight for other video card users who have a -BT869 on board. Here is his document: - - -How-To ------- - - -This text describes my successful attempt to eventually get the TV-Out -feature of 3DFX Voodoo 3 3000 (PAL) working in a Linux environment. -I've successfully configured the 800x600 mode -- And currently I am -not interested in 640x480 -- hardware scaling rules in all cases -I need the tv-out. My monitor works much less worse w/ 800x600PAL... - -All the information is based on my best knowledge but there might be -some mistakes. In any case, THE ENTIRE RISK OF USING THIS INFORMATION -IS WITH YOU, AND NO ONE ELSE IS LIABLE OF ANY PROBLEMS ENCOUNTERED. -Please fix any mistakes, inaccuracies, writing errors, etc. you -notice in this document. - -I was about to write briefly, but sorry due to limited resources -I did not have time to write briefly (too much thinking ;). -Well, browse through the text and skip all irrelevant parts -to proceed... - -Tomi Ollila - - -The first time I got the the tv-out working I was working w/ Linux kernel -2.4.3. Now I am redoing the work w/ Linux 2.4.4 and recording the steps -in this document. Description of my system and software used is as follows: - -RedHat 7.0 linux distribution (probably any distribution will do, since -all of the needed software is compiled from packages that are not RH-pagkaged) -(maybe if anything is important, are modutils-2.3.14-3 and kernel-headers-2.4.0-0.26) - -XFree-4.0.3. I don't see any reason anyone uses any older. HW acceleration -of Voodoo3 3000 works out of the box with this. Also Windowed!!! - -lm_sensors-2.5.5: Get this or newer. I have not used any older. - -i2c-2.5.5: Probably 2.4.x -kernel distributions has recent enough version -of i2c. Since I also have IOmega BUZ and it's (working) versions require -i2c-old, I cannot use the one's kernel provided. Since I cannot say anything -about not using this i2c as separate package I suggest you do the same -and compile this also. - -I have used kgcc that comes in RedHat 7.0 -distribution to compile all -stuff. Probably all other recent gcc -compilers will produce good results -also: kgcc -v outputs: -Reading specs from /usr/lib/gcc-lib/i386-glibc21-linux/egcs-2.91.66/specs -gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) - --- - -1) The work starts w/ kernel compilation (or skip to step 2, I quess it will - work w/ any recent 2.2 and 2.4 -kernels) - - # run make config, make menuconfig or make xconfig (I suggest 'xconfig') - - For sure you need kernel module support and /proc -filesystem support - (XXX add more absolute requirements) - - Now I cannot say for sure, if following things needs to be compiled - at kernel compilation time or does i2c-2.5.5 bring all these: - character devices->i2c support->i2c support - character devices->i2c support->i2c bit-banging interfaces (*) - character devices->i2c support->i2c devices (**) - character devices->/dev/agpart support - character devices->Direct Rendering Manager (XFree86 DRI support) (+) - character devices->3dfx banshee/Voodoo3+ - - make above as modules. - - (*) I already forgot why I wanted some special attention for this - (**) It seems I never need this - (+) Hmm, It seems I have compiled this as part of the kernel binary - - There is of course lot of other options you need to choose but these - are probably the ones needed... - - # run make dep - # run make bzImage - # run make modules - # run make modules_install (as root) - # copy arch/i386/boot/bzImage to /boot/vmlinuz-2.4.4 (as root) - # edit /etc/lilo.conf and run lilo (as root) - -2) In order to (the most easiest way) compile separate i2c and lm_sensors - -package, symlink your linux source tree to /usr/src/linux (unless it is - there already) and do the following - - # tar zxvf i2c-2.5.5.tar.gz - # cd i2c-2.5.5 - # make - # make install (as root) - # cd .. - # tar zxvf lm_sensors-2.5.5.tar.gz - # cd lm_sensors-2.5.5 - # make - # make install (as root) - # cd .. - - Now you have all necessary modules installed on the system (and - /usr/local/bin/sensors and /usr/local/sbin/sensors-detect). - - But there is some configuration missing in order to activate - the needed functionality of the modules... - -3) Now, before going any further, let's take a look the modifications that - is required in XFree86 -configuration so that X is ready for the - tv-out functionality next time it is started. - - XFree86-4.x uses the configuration file /etc/X11/XF86Config-4. Older - configuration files needed "ModeLine"s for all display resolutions - that are needed, but XFree86 version 4 can figure out those by itself. - But what it cannot figure out, are some special ModeLines that may - be reguired in various cases... and this is one of these. - - For Voodoo 3 3000 TV out feature, special modelines are needed for - the supported resolutions, 640x480 and 800x600 (there might be others - but I don't know enough of the issue. In this document, I only - activate the 800x600 mode. - - Make backup copy of your /etc/X11/XF86Config-4 in case you accidentally - screw something up so you can then reuse the old file if this happens. - - Open /etc/X11/XF86Config-4 in your favourite editor and find line - that contains `Section "Monitor"'. At the end of that section, - just before line `EndSection', add the following lines: - -ModeLine "640x480PAL" 29.50 640 675 678 944 480 530 535 625 -ModeLine "800x600PAL" 36.00 800 818 820 960 600 653 655 750 - - Then, find lines that starts with something like: - -Section "Screen" - Identifier "Screen0" - Device "3Dfx Interactive, Inc.|Voodoo 3" - Monitor "" - DefaultDepth 16 -... - Subsection "Display" - Depth 16 -# Modes "1024x768" "640x480" "800x600" "800x600PAL" #"400x300" - Modes "1024x768" "800x600PAL" - EndSubSection - - Make sure that `DefaultDepth' is set 16 (I don't know if any other works) - Then you notice there my resolutions as `Modes' -lines. I have outcommented - the first `Modes' -line so that testing is easier. You can do what - you widh here, just make sure to add that `"800x600PAL"' -line there. - Save the file and exit editor. - - -4) It's is time to reboot (with new kernel), that is the easiest way to - continue. - -5) After rebooting, and X startup `lsmod' in my machine output following: - Module Size Used by - tdfx 54536 1 - es1371 28500 0 - ac97_codec 8808 0 [es1371] - - tdfx -module was loaded by X, and sound module by some RH -startup script. - - Now you could run /usr/local/sbin/sensors-detect. After that was run in - my PII class -machine it suggested I add the following: - - to /etc/modules.conf - alias char-major-89 i2c-dev - - to some startup script (i choose append to /etc/rc.local) - # I2C adapter drivers - /sbin/modprobe i2c-piix4 - /sbin/modprobe i2c-voodoo3 - # I2C chip drivers - /sbin/modprobe w83781d - /sbin/modprobe eeprom - - (you run the prg and add the stuff it suggests) - - Let's now /sbin/modprobe -v i2c-voodoo3. Now I have: - - Module Size Used by - i2c-voodoo3 3012 0 (unused) - i2c-algo-bit 7796 2 [i2c-voodoo3] - i2c-core 12844 0 [i2c-algo-bit] - tdfx 54536 1 - es1371 28500 0 - ac97_codec 8808 0 [es1371] - - I think this is the only one of the above that is required for the task. - (If that is not true, I'll revise this text and you never know I though - such a thing) - - Now, turn on your TV set (unless it is already open) and make sure it - is getting (either s-video or composite... I personally have only - tested composite) input from your voodoo3 card. Don't change any - screen resolution just yet... - - You notice the tv set screen is still blank. Changing screen resolutions - won't do any change on that, don't bother trying. - - So, how to continue from there. The answer was found looking through - all the files that are found with zsh command line in lm_sensors dir: - grep -i voodoo3 **/*(.) | less - The file doc/chips/bt869 contains interesting information, with it - and some other information I found somewhere else, don't remember - either, I did: - - modprobe -v bt869 (or insmod /lib/modules/2.x.x/misc/bt869) - - NOW! you should see some noise on your TV-Set screen. - - and `lsmod' returns (on my machine) - - Module Size Used by - bt869 5392 0 (unused) - i2c-voodoo3 3012 0 (unused) - sensors 6140 0 [bt869] - i2c-algo-bit 7796 2 [i2c-voodoo3] - i2c-core 12844 0 [bt869 sensors i2c-algo-bit] - tdfx 54536 1 - es1371 28500 0 - ac97_codec 8808 0 [es1371] - - If you now try to change mode to `800x600PAL' The noise pattern just - changes. That's because there are various parameters for bt869 to - make it operate in different systems. - - The configuration entries for bt869 live somewhere in `proc' filesystem - and since it is so hard to remember, the following commands helps out: - - # find /proc -name "bt869*" -print - - In my system that output: /proc/sys/dev/sensors/bt869-i2c-0-44. Since - the last few characters may be different on your system I'll use... - - # ls /proc/sys/dev/sensors/bt869* ... and this outputs: - - colorbars: Output colorbars instead of display data. Default `0'. - depth: Display depth. Seems to be `16' on my system. - half: No idea. Default `0'. - ntsc: 1: use NTSC, 0: use PAL. Default: `1'. - res; Screen resolution to use. Defaut: `640 480'. - status: Outputs some status info I do not know what that is. - - For me, in order to get TV sync with incoming signal (or is it Voodoo3 - that needs syncing), I first put colorbars on, and when I get colorbars - visible I shut colorbars off -- and then I have part of my 1024x768 - displayed on TV-screen. Normal WIMP screen doesn't look so nice, but - games, pictures, etc. Looks just fine. And HW acceleration rules. - - Do the following to achieve this: - - # echo 1 > /proc/sys/dev/sensors/bt869*/colorbars - # echo 0 > /proc/sys/dev/sensors/bt869*/ntsc - # echo 800 600 > /proc/sys/dev/sensors/bt869*/res - - Press ctrl-alt-num_keypad_+ - - Now you should see vertical colorbars on your TV-Set - - # echo 0 > /proc/sys/dev/sensors/bt869*/colorbars - - Now (part of) your computer display should be visible on your TV-Set. - - - ... Ok, I did just that... after ctrl-alt-num_keypad_+ I did not get - synchronized colorbar output visible on my TV. So, at this time I - re-did... - - # echo 1 > /proc/sys/dev/sensors/bt869*/colorbars - - ... and got colorbars, and ... - - # echo 0 > /proc/sys/dev/sensors/bt869*/colorbars - - ... got my computer display visible on my TV. - - -#EOF - diff --git a/doc/chips/ddcmon b/doc/chips/ddcmon deleted file mode 100644 index 63ef0aa3..00000000 --- a/doc/chips/ddcmon +++ /dev/null @@ -1,272 +0,0 @@ -Kernel driver `ddcmon.o' -======================== - -Status: As complete as we want it to be, lightly tested - -Supported chips: - * Any DDC Monitor EDID EEPROM chip at 0x50 - Prefix: 'ddcmon' - Addresses scanned: I2C 0x50 - Standards: available for purchase from VESA http://www.vesa.org - Datasheets: Publicly available from Atmel (www.atmel.com), - Fairchild (www.fairchildsemi.com), and - Microchip (www.microchip.com) - - Chip Size (bits) Address - 24C01 1K 0x50 (shadows at 0x51 - 0x57) - (Typical device in monitors) - 24C01A 1K 0x50 - 0x57 (Typical device in monitors) - 24C02 2K 0x50 - 0x57 - 24C04 4K 0x50, 0x52, 0x54, 0x56 - (additional data at 0x51, 0x53, 0x55, 0x57) - 24C08 8K 0x50, 0x54 (additional data at 0x51, 0x52, - 0x53, 0x55, 0x56, 0x57) - 24C16 16K 0x50 (additional data at 0x51 - 0x57) - - -Author: Frodo Looijaard , Philip Edelbrock - , Mark Studebaker and - Jean Delvare - -Special assistance on DDC provided by Petr Vandrovec - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_ddcmon: short array (min = 1, max = 48) - Same as 'force' -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 -* checksum: int - Only accept eeproms whose checksum is correct - - -Description ------------ - -This is a simple module for reading the EEPROM on a DDC-compliant monitor. -DDC (Display Data Channel) is the I2C-based communication channel -to the monitor. The EEPROM contains a 128-byte data structure defined -by the EDID (Extended Display Identification Data) standard. - -Use: - -After inserting the module (and any other required smbus/i2c modules), you -should have a directory in /proc/sys/dev/sensors/ with a name such -as "ddcmon-i2c-3-50". Inside each of these is a series of files which -represent interesting data from the DDC monitor. - -/proc entries: - - dpms: bitmask - DPMS support flags - 0x20 Active Off - 0x40 Suspend - 0x80 Standby - - edid: 2 integers - EDID version and revision - - gamma: 1 float - gamma factor - - id: 2 integers - manufacturer ID and product ID - Manufacturer ID is encoded, see 'sensors' - source ../../prog/sensors/chips.c. - - maxclock: 1 integer - max pixel clock (also known as video bandwidth) (MHz) - 0 if not available. - - serial: 1 integer - serial number - Encoding depends on the manufacturer, don't expect the - real serial number here. 0 probably means "not available". - - size: 2 integers - vertical monitor size (cm) - horizontal monitor size (cm) - - sync: 4 integers - minimum vertical sync frequency (Hz) - maximum vertical sync frequency (Hz) - minimum horizontal sync frequency (KHz) - maximum horizontal sync frequency (KHz) - 0 0 0 0 if not available. - - time: 2 integers - Manufacture year and week - - timing[1-8]: 3 integers - supported standard timing - horizontal resolution - vertical resolution - (vertical) refresh rate - 0 0 0 if not used. - - timings: bitmask - supported established timings - 0x000001 720x400@70Hz (VGA 640x400, IBM) - 0x000002 720x400@88Hz (XGA2) - 0x000004 640x480@60Hz (VGA) - 0x000008 640x480@67Hz (Mac II, Apple) - 0x000010 640x480@72Hz (VESA) - 0x000020 640x480@75Hz (VESA) - 0x000040 800x600@56Hz (VESA) - 0x000080 800x600@60Hz (VESA) - 0x000100 800x600@72Hz (VESA) - 0x000200 800x600@75Hz (VESA) - 0x000400 832x624@75Hz (Mac II) - 0x000800 1024x768@87Hz interlaced (8514A) - 0x001000 1024x768@60Hz (VESA) - 0x002000 1024x768@70Hz (VESA) - 0x004000 1024x768@75Hz (VESA) - 0x008000 1280x1024@75Hz (VESA) - 0x010000 - 0x800000 Manufacturer reserved - 0x800000 1152x870 @ 75 Hz (Mac II, Apple)? - - -Chip Features -------------- - -Chip 'ddcmon' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -Manufacturer ID - - R- 0 -Model Number - - R- 0 -Monitor Size (cm) - - R- 0 -hsize Monitor Size (cm) - R- 0 -Vertical Sync (Hz) - - R- 0 -v_sync_max Vertical Sync (Hz) - R- 0 -Horizontal Sync (KHz) - - R- 0 -h_sync_max Horizontal Sync (KHz) - R- 0 -Established Timings - - R- 0 -Serial Number - - R- 0 -Manufacture Time - - R- 0 -week Manufacture Time - R- 0 -EDID Version - - R- 0 -revision EDID Version - R- 0 -Gamma Factor - - R- 2 -DPMS Modes - - R- 0 -Standard Timing 1 - - R- 0 -vertical Standard Timing 1 - R- 0 -refresh Standard Timing 1 - R- 0 -Standard Timing 2 - - R- 0 -vertical Standard Timing 2 - R- 0 -refresh Standard Timing 2 - R- 0 -Standard Timing 3 - - R- 0 -vertical Standard Timing 3 - R- 0 -refresh Standard Timing 3 - R- 0 -Standard Timing 4 - - R- 0 -vertical Standard Timing 4 - R- 0 -refresh Standard Timing 4 - R- 0 -Standard Timing 5 - - R- 0 -vertical Standard Timing 5 - R- 0 -refresh Standard Timing 5 - R- 0 -Standard Timing 6 - - R- 0 -vertical Standard Timing 6 - R- 0 -refresh Standard Timing 6 - R- 0 -Standard Timing 7 - - R- 0 -vertical Standard Timing 7 - R- 0 -refresh Standard Timing 7 - R- 0 -Standard Timing 8 - - R- 0 -vertical Standard Timing 8 - R- 0 -refresh Standard Timing 8 - R- 0 -Max Pixel Clock (MHz) - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -Manufacturer ID SENSORS_DDCMON_MAN_ID id:1 -Model Number SENSORS_DDCMON_PROD_ID id:2 -Monitor Size (cm) SENSORS_DDCMON_VERSIZE size:1 -hsize SENSORS_DDCMON_HORSIZE size:2 -Vertical Sync (Hz) SENSORS_DDCMON_VERSYNCMIN sync:1 -v_sync_max SENSORS_DDCMON_VERSYNCMAX sync:2 -Horizontal Sync (KHz) SENSORS_DDCMON_HORSYNCMIN sync:3 -h_sync_max SENSORS_DDCMON_HORSYNCMAX sync:4 -Established Timings SENSORS_DDCMON_TIMINGS timings:1 -Serial Number SENSORS_DDCMON_SERIAL serial:1 -Manufacture Time SENSORS_DDCMON_YEAR time:1 -week SENSORS_DDCMON_WEEK time:2 -EDID Version SENSORS_DDCMON_EDID_VER edid:1 -revision SENSORS_DDCMON_EDID_REV edid:2 -Gamma Factor SENSORS_DDCMON_GAMMA gamma:1 -DPMS Modes SENSORS_DDCMON_DPMS dpms:1 -Standard Timing 1 SENSORS_DDCMON_TIMING1_HOR timing1:1 -vertical SENSORS_DDCMON_TIMING1_VER timing1:2 -refresh SENSORS_DDCMON_TIMING1_REF timing1:3 -Standard Timing 2 SENSORS_DDCMON_TIMING2_HOR timing2:1 -vertical SENSORS_DDCMON_TIMING2_VER timing2:2 -refresh SENSORS_DDCMON_TIMING2_REF timing2:3 -Standard Timing 3 SENSORS_DDCMON_TIMING3_HOR timing3:1 -vertical SENSORS_DDCMON_TIMING3_VER timing3:2 -refresh SENSORS_DDCMON_TIMING3_REF timing3:3 -Standard Timing 4 SENSORS_DDCMON_TIMING4_HOR timing4:1 -vertical SENSORS_DDCMON_TIMING4_VER timing4:2 -refresh SENSORS_DDCMON_TIMING4_REF timing4:3 -Standard Timing 5 SENSORS_DDCMON_TIMING5_HOR timing5:1 -vertical SENSORS_DDCMON_TIMING5_VER timing5:2 -refresh SENSORS_DDCMON_TIMING5_REF timing5:3 -Standard Timing 6 SENSORS_DDCMON_TIMING6_HOR timing6:1 -vertical SENSORS_DDCMON_TIMING6_VER timing6:2 -refresh SENSORS_DDCMON_TIMING6_REF timing6:3 -Standard Timing 7 SENSORS_DDCMON_TIMING7_HOR timing7:1 -vertical SENSORS_DDCMON_TIMING7_VER timing7:2 -refresh SENSORS_DDCMON_TIMING7_REF timing7:3 -Standard Timing 8 SENSORS_DDCMON_TIMING8_HOR timing8:1 -vertical SENSORS_DDCMON_TIMING8_VER timing8:2 -refresh SENSORS_DDCMON_TIMING8_REF timing8:3 -Max Pixel Clock (MHz) SENSORS_DDCMON_MAXCLOCK maxclock:1 - - -Notes ------ - -- The eeprom.o module will also attach to a DDC monitor. Install the - ddcmon.o module before the eeprom.o module to prevent this. - Alternatively, give the eeprom.o module an ignore= parameter or - a checksum= parameter. The ddcmon.o module will not attach to non-DDC - eeproms because it checks for a DDC 'signature' at the beginning - of the DDC Monitor's eeprom. Additionally, you can give it a checksum= - parameter. - -- If a DDC monitor eeprom lacks the 'signature', you may use the - 'force' parameter (modprobe ddcmon force=x,0x50 where 'x' is the - i2c bus number). - -- This module requires a bus driver for your video chip to access the - DDC bus. In this package, drivers exist for Voodoo3/Banshee chips. - See documentation for those drivers in ../busses. Other drivers - (Matrox and NVidia, for example) are available in the kernel or - elsewhere. See our 'Supported Devices' web page for details. - -- There is a checksum over the 128 bytes in the eeprom. The driver - used not to check it, now it does (providing you give it a - checksum= parameter). - -- More information is available in the eeprom which could be made - available by enhancing the driver. - To see the entire eeprom, use the eeprom.o module instead of ddcmon.o. - However, then you lose the DDC-specific formatting. - Also see ../../prog/eeprom/decode-edid.pl. - -- This driver does not support the DDC/CI (DDC2Bi) bidirectional - communications channel to the monitor for controlling the monitor. - -- The driver caches the data from the monitor and only rereads it - from the eeprom if the cache is more than 5 minutes old. - -- X 4.0 also accesses the DDC monitor EEPROM to auto-configure itself. - There could possibly be conflicts from these multiple accesses, but - none were ever reported so far. diff --git a/doc/chips/ds1307 b/doc/chips/ds1307 deleted file mode 100644 index 217c40ca..00000000 --- a/doc/chips/ds1307 +++ /dev/null @@ -1,25 +0,0 @@ -Kernel driver `ds1307.o' -======================== - -Status: Complete and well-tested - -Supported chips: - * Dallas Semiconductor DS1307 Real-time clock - -Author: Abraham vd Merwe - - -Module Parameters ------------------ - -There are no module parameters. The driver only scans address 0x68 for -presence of the real-time clock chip (which is the only possible address). - - -Description ------------ - -This module provides an API for drivers RTC and NVRAM drivers to use in -order to access the DS1307 real-time clock. Examples of drivers that uses -this API are the frodo-nvram and frodo-rtc drivers. - diff --git a/doc/chips/ds1621 b/doc/chips/ds1621 deleted file mode 100644 index 9cf89b4e..00000000 --- a/doc/chips/ds1621 +++ /dev/null @@ -1,237 +0,0 @@ -Kernel driver `ds1621.o' -======================== - -Status: Complete and tested; enhanced features experimental - -Supported chips: - * Dallas Semiconductor DS1621 - Prefix: 'ds1621' - Addresses scanned: I2C 0x48 - 0x4f - Datasheet: Publicly available at the Dallas Semiconductor website - http://www.dalsemi.com/ - * Dallas Semiconductor DS1625 - Prefix: 'ds1621' - Addresses scanned: I2C 0x48 - 0x4f - Datasheet: Publicly available at the Dallas Semiconductor website - http://www.dalsemi.com/ - -Author: Christian W. Zuckschwerdt -valueable contributions by Jan M. Sendler - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_ds1621: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to - contain a `ds1621' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -The DS1621 is a (one instance) digital thermometer and thermostat. It -has both high and low temperature limits which can be user defined -(i. e. programmed into non-volatile on-chip registers). -Temperature range is -55 degree Celsius to +125 in 0.5 increments. You -may convert this into a Fahrenheit range of -67 to +257 degrees with -0.9 steps. Unfortunally though, you will need a hash table or even a -conversion routine for that. - -Temperature readings are internally converted into a 9bit value to be -read straight via the i2c-bus, but higher resolutions may be obtained -with little effort via 'precise_temp' access or using a simple algorithm. - -As for the thermostat, behavior can also be programmed using the -polarity toggle. -On the one hand ("heater"), the thermostat output of the chip, Tout, -will trigger when the low limit temperature is met or underrun and -stays high until the high limit is met or exceeded. On the other hand -("cooler"), vice versa. -That way "heater" equals "active low", whereas "conditioner" equals -"active high". Please note that the DS1621 data sheet is somewhat -misleading in this point since setting the polarity bit does not -simply invert Tout. - - -A second thing is that, during extensive testing, Tout showed a -tolerance of up to +/- 0.5 degrees even when compared against precise -temperature readings. -Be sure to have a high vs. low temperature limit gap of al least 1.0 -degree Celsius to avoid Tout "bouncing", though! - -As for alarms, you can read the alarm status of the DS1621 via the -'alarms' proc file interface. The result consits mainly of bit 6 and 5 -of the configuration register of the chip; bit 6 (0x40 or 64) is the -high alarm bit and bit 5 (0x20 or 32) the low one. These bits are set -when the high or low limits are met or exceeded and are reset by the -module as soon as the respective temperature ranges are left. - -The alarm registers are in no way suitable to find out about the -actual status of Tout. They will only tell you about its history, -whether or not any of the limits have ever been met or exceeded since -last power-up or reset. Be aware: When testing, it showed that the -status of Tout can change with neither of the alarms set. - -Temperature conversion of the DS1621 takes up to 1000ms; internal -access to non-volatile registers may last for 10ms or below. - -This driver also detects DS1625. As this chip is discontinued, you -should use a DS1621 instead. Detected 1625s also get the -"ds1621"-prefix, but the accuracy registers are not supported. -The latest modification of this driver was not checked against 1625s, -though, but should work well with them. - -Default values written into the DS1621 upon detection are: -Temperature limits: High 60.0; low 0.0 degree Celsius; -Continuous mode (not enabled), Tout active high, alarms reset. - - -Accessing DS1621 via /proc interface (part I) ---------------------------------------------- - -On detection (i.e. insmod, modprobe et al.), directories are being -created for each detected DS1621: - -/proc/sys/dev/sensors/ds1621-<0>-<1>/ -where <0> is the bus the chip was detected on (e. g. i2c-0) -and <1> the chip address ([48..4f]): ./ds1621-i2c-0-48/ - -Inside these directories, there are five files each: -alarms, continuous, enable, polarity and temp. - -The temp, alarms and enable are LM75-like for compatibility reasons: - -The temp file is rw. Reading gives TEMP_HIGH:TEMP_HYST:TEMP, where -TEMP_HIGH is the upper limit temp, TEMP_HYST is the hysteresis (lower -limit) temp and TEMP is the actual temperature. (For things like -ONE_SHOT, see below.) - Writing takes two results (read: input -values): TEMP_HIGH:TEMP_HYST. This provides an easy way to set limits. - -The alarms file is ro. Basically, it is 0x40 ("64") for the high alarm -bit set plus 0x20 ("32") for the low one. Since alarms are being reset -by the module when the limit conditions are no longer met, you should -first read the alarms before you do anything else (such as reading the -temperature), or the information may be lost. - -The polarity file is rw. Reading gives "0" for active high, which -describes a need for cooling corresponds to Tout status. "1" means -active low, so you can connect a powerful heater directly to Tout -(DON'T TRY!). - Writing accepts "0" and "1" accordingly. Again, note -that the statements on page 5 of the DS1621 data sheet are misleading; -change the orientation of the vertical arrows in the sketch there -instead. - -To understand the use of the other things, it is useful to have a -brief look at the internal DS1621 procedures: - - -High Accuracy Temperature Reading ---------------------------------- - -As said before, the temperature issued via the 9bit i2c-bus data is -somewhat arbitrary. Internally, the temperature conversion is of a -different kind that is explained (not so...) well in the DS1621 data -sheet. To cut the long story short: Inside the DS1621 there are two -oscillators, both of them biassed by a temperature coefficient. - -Higher accuracy of the temperature reading can be achieved using the -internal projection, which means taking account of REG_COUNT and -REG_SLOPE (the driver manages them): - -Taken from Dallas Semiconductors App Note 068: 'Increasing Temperature -Resolution on the DS1620' and App Note 105: 'High Resolution -Temperature Measurement with Dallas Direct-to-Digital Temperature -Sensors' - -- Read the 9bit temperature and strip the LSB (Truncate the .5 degs) -- The resulting value is TEMP_READ. -- Then, read REG_COUNT. -- And then, REG_SLOPE. - - TEMP = TEMP_READ - 0.25 + ((REG_SLOPE - REG_COUNT) / REG_SLOPE) - -Note that this is what the DONE bit in the DS1621 configuration -register is good for: Internally, one temperature conversion takes up -to 1000ms. Before that conversion is complete you will not be able to -read valid things out of REG_COUNT and REG_SLOPE. The DONE bit, as you -may have guessed by now, tells you whether the conversion is complete -("done", in plain english) and thus, whether the values you read are -good or not. - -The DS1621 has two modes of operation: "Continuous" conversion, which -can be understood as the default stand-alone mode where the chip gets -the temperature and controls external devices via its Tout pin or -tells other i2c's about it if they care. The other mode is called -"1SHOT", that means that it only figures out about the temperature -when it is explicitly told to do so; this can be seen as power saving -mode. - -Now if you want to read REG_COUNT and REG_SLOPE, you have to either -stop the continuous conversions until the contents of these registers -are valid, or, in 1SHOT mode, you have to have one conversion made. - - - -Accessing DS1621 via /proc interface (part II and end) ------------------------------------------------------- - -The continuous file is rw. Reading gives "1" when the chip is in -continuous mode and "0" for 1SHOT. - Writing accepts "1" to put it -into continuous mode or "0" for 1SHOT. - -The enable file is rw. Reading gives "1" if in continuous mode the -DS1621 is "running" or if in 1SHOT mode it is "shooting". In fact, the -value returned here is the negated DONE bit, just like a "BUSY" -flag. This means, that the "1" tells you that the values in REG_COUNT -and REG_SLOPE are not valid. "0", on the other hand, means that the -continuous conversion had been stopped long enough to provide valid -readings and that one shot has successfully been fi- red, -respectively. - Writing accepts "1" to start continuous conversion or -to pull the trigger in 1SHOT mode, and "0" stops continuous conversion -to allow for valid readings. Writing "0" in 1SHOT doesn't make much -sense since you cannot catch a bullet, can you? No, the thing is that -DS1621 does only do one conversion then anyway, and after that, -there's nothing to stop. - -Last, but best try writing "0" to the "continuous" file and after that -"1" to the "enable" file. This gives you the precise temperature with -two digits after the radix (decimal point). -The precise results are only updated if the DONE bit was set, thus you -have to stop continuous conversion early enough prior to reading, -i. e. 1000ms. And, on the other hand, you shouldn't forget to fire off -1SHOT in order to get the actual temperature rather than that of the -day before yesterday. So read enable before any of these. - - -Chip Features -------------- - -Chip `ds1621' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - alarms NONE NONE R 0 - enable NONE NONE RW 0 - continuous NONE NONE RW 0 - polarity NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - temp SENSORS_DS1621_TEMP temp:3 - temp_hyst SENSORS_DS1621_TEMP_HYST temp:2 - temp_over SENSORS_DS1621_TEMP_OVER temp:1 - alarms SENSORS_DS1621_ALARMS alarms:1 - enable SENSORS_DS1621_ENABLE enable:1 - continuous SENSORS_DS1621_CONTINUOUS continuous:1 - polarity SENSORS_DS1621_POLARITY polarity:1 diff --git a/doc/chips/eeprom b/doc/chips/eeprom deleted file mode 100644 index 7d14c711..00000000 --- a/doc/chips/eeprom +++ /dev/null @@ -1,228 +0,0 @@ -Kernel driver `eeprom.o' -======================== - -Status: Complete and well-tested - -Supported chips: - * Any EEPROM chip in the designated address range - Prefix: 'eeprom' - Addresses scanned: I2C 0x50 - 0x57 - Datasheets: Publicly available from: - Atmel (www.atmel.com), - Catalyst (www.catsemi.com), - Fairchild (www.fairchildsemi.com), - Microchip (www.microchip.com), - Philips (www.semiconductor.philips.com), - Rohm (www.rohm.com), - ST (www.st.com), - Xicor (www.xicor.com), - and others. - - Chip Size (bits) Address - 24C01 1K 0x50 (shadows at 0x51 - 0x57) - 24C01A 1K 0x50 - 0x57 (Typical device on DIMMs) - 24C02 2K 0x50 - 0x57 - 24C04 4K 0x50, 0x52, 0x54, 0x56 - (additional data at 0x51, 0x53, 0x55, 0x57) - 24C08 8K 0x50, 0x54 (additional data at 0x51, 0x52, - 0x53, 0x55, 0x56, 0x57) - 24C16 16K 0x50 (additional data at 0x51 - 0x57) - Sony 2K 0x57 - - Atmel 34C02B 2K 0x50 - 0x57, SW write protect at 0x30-37 - Catalyst 34FC02 2K 0x50 - 0x57, SW write protect at 0x30-37 - Catalyst 34RC02 2K 0x50 - 0x57, SW write protect at 0x30-37 - Fairchild 34W02 2K 0x50 - 0x57, SW write protect at 0x30-37 - Microchip 24AA52 2K 0x50 - 0x57, SW write protect at 0x30-37 - ST M34C02 2K 0x50 - 0x57, SW write protect at 0x30-37 - - -Author: Frodo Looijaard and Philip Edelbrock - - - -Module Parameters ------------------ - -* checksum: int - Only accept eeproms whose checksum is correct -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_eeprom: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `eeprom' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This is a simple EEPROM module meant to enable reading the first 256 bytes -of an EEPROM (on a SDRAM DIMM for example). However, it will access serial -EEPROMs on any I2C adapter. The supported devices are generically -called 24Cxx, and are listed above; however the numbering -for these industry-standard devices may vary by manufacturer. - -This module was a programming exercise to get used to the new project -organization laid out by Frodo, but it should be at least completely -effective for decoding the contents of EEPROMs on DIMMs. - -DIMMS will typically contain a 24C01A or 24C02, or the 34C02 variants. -The other devices will not be found on a DIMM because -they respond to more than one address. - -DDC Monitors may contain any device. Often a 24C01, which responds -to all 8 addresses, is found. See the 'ddcmon' driver which has -specialized /proc entries for DDC monitors. If the eeprom driver is -loaded before the ddcmon driver and there is no 'ignore' line in the -/etc/sensors.conf file, the eeprom driver will latch onto the DDC monitor -eeprom. - -Recent Sony Vaio laptops have an EEPROM at 0x57. We couldn't get the -specification, so it is guess work and far from being complete. - -The Microchip 24AA52/24LCS52, ST M34C02, and others support an additional -software write protect register at 0x30 - 0x37 (0x20 less than the -memory location). The chip responds to "write quick" detection at this -address but does not respond to byte reads. -If this register is present, the lower 128 bytes of the memory -array are not write protected. Any byte data write to this address -will write protect the memory array permanently, and the device -will no longer respond at the 0x30-37 address. -The eeprom driver does not support this register. - -Lacking functionality: - -* Full support for larger devices (24C04, 24C08, 24C16). These are -not typically found on a PC. These devices will appear as separate -devices at multiple addresses. - -* Support for really large devices (24C32, 24C64, 24C128, 24C256, 24C512). -These devices require two-byte address fields and are not supported. - -* Enable Writing. Again, no technical reason why not, but making it easy -to change the contents of the EEPROMs (on DIMMs anyway) also makes it easy -to disable the DIMMs (potentially preventing the computer from booting) -until the values are restored somehow. - - -Use: - -After inserting the module (and any other required smbus/i2c modules), you -should have some EEPROM directories in /proc/sys/dev/sensors/ of names such -as "eeprom-i2c-0-50". Inside each of these is a series of files which -represent 16 bytes blocks from the EEPROM. The data is in decimal (base -10) delimited by spaces. - -Note: - -EEPROMs reported are not nessesarily all from DIMMs. Xeon processors, for -example, have serial EEPROMs in them connected to the SMBus which will be -found by the module. Take care to ignore the output of decode-dimms.pl for -these EEPROMs. There is decode-xeon.pl for them. Same applies to Vaio -EEPROMs, which have decode-vaio.pl. - -The driver caches the data from the monitor and only rereads it -from the eeprom if the cache is more than 5 minutes old. - - -Decode-dimms.pl ---------------- - -This Perl script attempts to make sense of the first 128 bytes of a SDRAM -PC-100 DIMM. Using the 'Serial Presence Detect (SPD)' Spec (Rev1.2a)** from -Intel. When finished, it will decode and report all the values defined in -the spec. Much of the information is technical timing and interfacing info -(probably not all used by the BIOS or clocking IC). - -Note: During testing, we noticed that many DIMMs have trucated SPD records. -I'm not sure if these conform to an old spec, or if the manufacturers are -simply just taking shortcuts. But, many DIMMs have all zeros stored past -byte 21. I asked an Intel SDRAM tester, Sat Kolli (skolli@smartm.com), -about this and this is what he had to say: - -"[...] Now in terms of SPD contents, you are right that people do all kinds -of things. The way to insure that any module works is to look for the most -basic information, such as module bank density, number of banks, and device -addresses. That will give you the module size and what devices are used. It -is very difficult to verify if the module is PC-100, because of -inconsistencies between spd data from different manufacturers. You could -read the timing information or the special Intel bytes (126 & 127) but I do -not know how many program that information. These inconsistencies may be -minimized if you or your customers stay with some of the better known -manufacturers." (Thanks goes to Sat Kolli for his comments and help.) - -Use: - -After inserting the necessary modules, run the script! - -Notes: - -The script assumes that Perl can be found at /usr/bin/perl. If different, -you will need to adjust the first line of the file accordingly, or else -you will get a strange "decode-dimms.pl: no such file or directory" error. - -Also note that the script assumes that _all_ the eeproms belong to DIMMs, -which may not be the case. - - -Decode-vaio.pl --------------- - -This Perl script looks for a Sony Vaio EEPROM at 0x57. If your system is not -a Sony Vaio laptop, you just don't care. If your system is an old Vaio, you -probably don't have an EEPROM on it and this script will be useless to you -as well. - -Use: - -After inserting the necessary modules, run the script! - -Notes: - -The script assumes that Perl can be found at /usr/bin/perl. If different, -you will need to adjust the first line of the file accordingly, or else -you will get a strange "decode-vaio.pl: no such file or directory" error. - - -Decode-edid.pl - -This Perl script acts as an interface between the eeprom module and -parse-edid, which is part of read-edid. Read-edid is a tool for gathering -information on VESA PNP monitors. It is somewhat similar to what our -ddcmon driver does, except that ddcmon outputs user-oriented data while -read-edid generates a a computer oriented configuration file (primarily -for XFree86). - -Read-edid is made of two components, get-edid which retrieves binary data -from the monitor, and parse-edid which decodes the data into useful -information. Get-edid uses low level functions, and relies on compliance -of both the video card and the monitor to some standard (DCC as it is -called). It may not work for everyone. On the other hand, some video -cards make this information available on an I2C bus and we are able to -get it using our eeprom module. That's why we wrote this script that -converts the data as exported by our eeprom module into what parse-edid -expects from get-edid. That way, users who can't get get-edid to work -still have a chance to be able to retrieve the wanted information thanks -to the lm_sensors modules and tools. - -Use: - -Unload the ddcmon if it was loaded, load the eeprom module instead. Then, -run the script. The script will try to figure out on which I2C bus and at -which address is the eeprom, but it may fail. In this case, you can pass -the parameters to the script. Examples: - - decode-edid.pl 1 - decode-edid.pl 2 0x50 - -You will find additional details in the script itself. Read-edid is avilable -there: - http://john.fremlin.de/programs/linux/read-edid/ diff --git a/doc/chips/f71805f b/doc/chips/f71805f deleted file mode 100644 index 40ee929a..00000000 --- a/doc/chips/f71805f +++ /dev/null @@ -1,107 +0,0 @@ -Kernel driver `f71805f.o' -========================= - -Status: Beta. - -Supported chips: - * Fintek F71805F/FG - Addresses scanned: none, address read from Super I/O config space - Prefix: 'f71805f' - Datasheet: Provided by Fintek on request - -Author: Jean Delvare - -Thanks to Denis Kieft from Barracuda Networks for the donation of a -test system (custom Jetway K8M8MS motherboard, with CPU and RAM) and -for providing initial documentation. - -Thanks to Kris Chen from Fintek for answering technical questions and -providing additional documentation. - -Thanks to Chris Lin from Jetway for providing wiring schematics and -answering technical questions. - - -Description ------------ - -The Fintek F71805F/FG Super I/O chip includes complete hardware monitoring -capabilities. It can monitor up to 9 voltages (counting its own power -source), 3 fans and 3 temperature sensors. - -This chip also has fan controlling features, using either DC or PWM, in -three different modes (one manual, two automatic). The driver doesn't -support these features yet. - -The driver assumes that no more than one chip is present, which seems -reasonable. - - -Voltage Monitoring ------------------- - -Voltages are sampled by an 8-bit ADC with a LSB of 8 mV. The supported -range is thus from 0 to 2.040 V. Voltage values outside of this range -need external resistors. An exception is in0, which is used to monitor -the chip's own power source (+3.3V), and is divided internally by a -factor 2. - -The two LSB of the voltage limit registers are not used (always 0), so -you can only set the limits in steps of 32 mV (before scaling). - -The wirings and resistor values suggested by Fintek are as follow: - - pin expected - name use R1 R2 divider raw val. - -in0 VCC VCC3.3V int. int. 2.00 1.65 V -in1 VIN1 VTT1.2V 10K - 1.00 1.20 V -in2 VIN2 VRAM 100K 100K 2.00 ~1.25 V (1) -in3 VIN3 VCHIPSET 47K 100K 1.47 2.24 V (2) -in4 VIN4 VCC5V 200K 47K 5.25 0.95 V -in5 VIN5 +12V 200K 20K 11.00 1.05 V -in6 VIN6 VCC1.5V 10K - 1.00 1.50 V -in7 VIN7 VCORE 10K - 1.00 ~1.40 V (1) -in8 VIN8 VSB5V 200K 47K 1.00 0.95 V - -(1) Depends on your hardware setup. -(2) Obviously not correct, swapping R1 and R2 would make more sense. - -These values can be used as hints at best, as motherboard manufacturers -are free to use a completely different setup. As a matter of fact, the -Jetway K8M8MS uses a significantly different setup. You will have to -find out documentation about your own motherboard, and edit sensors.conf -accordingly. - -Each voltage measured has associated low and high limits, each of which -triggers an alarm when crossed. - - -Fan Monitoring --------------- - -Fan rotation speeds are reported as 12-bit values from a gated clock -signal. Speeds down to 366 RPM can be measured. There is no theoretical -high limit, but values over 6000 RPM seem to cause problem. The effective -resolution is much lower than you would expect, the step between different -register values being 10 rather than 1. - -The chip assumes 2 pulse-per-revolution fans. - -An alarm is triggered if the rotation speed drops below a programmable -limit or is too low to be measured. - - -Temperature Monitoring ----------------------- - -Temperatures are reported in degrees Celsius. Each temperature measured -has a high limit, those crossing triggers an alarm. There is an associated -hysteresis value, below which the temperature has to drop before the -alarm is cleared. - -All temperature channels are external, there is no embedded temperature -sensor. Each channel can be used for connecting either a thermal diode -or a thermistor. The driver reports the currently selected mode, but -doesn't allow changing it. In theory, the BIOS should have configured -everything properly. diff --git a/doc/chips/fscher b/doc/chips/fscher deleted file mode 100644 index 2b8fee45..00000000 --- a/doc/chips/fscher +++ /dev/null @@ -1,266 +0,0 @@ -Kernel driver `fscher.o' -======================= - -Status: Stable - Tested with motherboard D1562 - - Think twice before you're using the write mode of some - variables, especially the watchdog - - -Supported chips: - * Fujitsu-Siemens Hermes chip - Prefix: 'fscher' - Addresses scanned: I2C 0x73 - -Author: Reinhard Nissl based on work from Hermann Jung - , Frodo Looijaard and Philip Edelbrock - - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_fscher: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `fscher' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -This driver implements support for the Fujitsu-Siemens Hermes chip. -It is described in the 'Register Set Specification BMC Hermes based -Systemboard' from Fujitsu-Siemens. - -The Hermes chip implements a hardware-based system management, -e.g. for controlling fan speed and core voltage. -There is also a watchdog counter on the chip which can trigger -an alarm and even shut the system down. - -The chip provides three temperature values (CPU, motherboard and auxiliary), -three voltage values (+12V, +5V and battery) and three fans (power supply, -CPU and auxiliary). - -Temperatures are measured in degrees Celsius. The resolution is 1 degree. - -Fan rotation speeds are reported in RPM (rotations per minute). -The value can be divided by a programmable divider (1, 2 or 4) which -is stored on the chip. - -Voltage sensors (also known as "in" sensors) report their values in volts. - -All values are reported as final values from the driver. -There is no need for further calculations. - - -Detailed description --------------------- - -Below you'll find a single line description of all the bit values. With this -information, you're able to decode e. g. alarms, wdog, etc. -To make use of the watchdog, you'll need to set the watchdog time and enable -the watchdog. After that it is necessary to restart the watchdog time within -the specified period of time, or a system reset will occur. - -* rev:1 - READING & 0xff = 0x??: HERMES revision identification - -* alarms:1 - READING & 0x80 = 0x80: CPU throttling active - READING & 0x80 = 0x00: CPU running at full speed - - READING & 0x10 = 0x10: software event (see control:1) - READING & 0x10 = 0x00: no software event - - READING & 0x08 = 0x08: watchdog event (see wdog:2) - READING & 0x08 = 0x00: no watchdog event - - READING & 0x02 = 0x02: thermal event (see temp*:1) - READING & 0x02 = 0x00: no thermal event - - READING & 0x01 = 0x01: fan event (see fan*:1) - READING & 0x01 = 0x00: no fan event - - READING & 0x13 ! 0x00: ALERT LED is flashing - -* control:1 - READING & 0x01 = 0x01: software event - READING & 0x01 = 0x00: no software event - - WRITING & 0x01 = 0x01: set software event - WRITING & 0x01 = 0x00: clear software event - -* wdog:3 - READING & 0x80 = 0x80: power off on watchdog event while thermal event - READING & 0x80 = 0x00: watchdog power off disabled (just system reset enabled) - - READING & 0x40 = 0x40: watchdog timebase 60 seconds (see also wdog:1) - READING & 0x40 = 0x00: watchdog timebase 2 seconds - - READING & 0x10 = 0x10: watchdog enabled - READING & 0x10 = 0x00: watchdog disabled - - WRITING & 0x80 = 0x80: enable "power off on watchdog event while thermal event" - WRITING & 0x80 = 0x00: disable "power off on watchdog event while thermal event" - - WRITING & 0x40 = 0x40: set watchdog timebase to 60 seconds - WRITING & 0x40 = 0x00: set watchdog timebase to 2 seconds - - WRITING & 0x20 = 0x20: disable watchdog - - WRITING & 0x10 = 0x10: enable watchdog / restart watchdog time - -* wdog:2 - READING & 0x02 = 0x02: watchdog system reset occurred - READING & 0x02 = 0x00: no watchdog system reset occurred - - WRITING & 0x02 = 0x02: clear watchdog event - -* wdog:1 - READING & 0xff = 0x??: configured watch dog time in units (see wdog:3 0x40) - - WRITING & 0xff = 0x??: configure watch dog time in units - -* in*:1 (0: +5V, 1: +12V, 2: onboard 3V battery) - READING: actual voltage value - -* temp*:1 (1: CPU sensor, 2: onboard sensor, 3: auxiliary sensor) - READING & 0x02 = 0x02: thermal event (overtemperature) - READING & 0x02 = 0x00: no thermal event - - READING & 0x01 = 0x01: sensor is working - READING & 0x01 = 0x00: sensor is faulty - - WRITING & 0x02 = 0x02: clear thermal event - -* temp*:2 (1: CPU sensor, 2: onboard sensor, 3: auxiliary sensor) - READING: actual temperature value - -* fan*:1 (1: power supply fan, 2: CPU fan, 3: auxiliary fan) - READING & 0x04 = 0x04: fan event (fan fault) - READING & 0x04 = 0x00: no fan event - - WRITING & 0x04 = 0x04: clear fan event - -* fan*:2 (1: power supply fan, 2: CPU fan, 3: auxiliary fan) - READING & 0x03 = 0x03: 8 ripples are one fan turn - READING & 0x03 = 0x02: 4 ripples are one fan turn - READING & 0x03 = 0x01: 2 ripples are one fan turn - - WRITING & 0x03 = 0x03: set prescaler to "8 ripples are one fan turn" - WRITING & 0x03 = 0x02: set prescaler to "4 ripples are one fan turn" - WRITING & 0x03 = 0x01: set prescaler to "2 ripples are one fan turn" - -* fan*:3 (1: power supply fan, 2: CPU fan, 3: auxiliary fan) - READING & 0xff = 0x00: fan may be switched off - READING & 0xff = 0x01: fan must run at least at minimum speed (supply: 6V) - READING & 0xff = 0xff: fan must run at maximum speed (supply: 12V) - READING & 0xff = 0x??: fan must run at least at given speed (supply: 6V..12V) - - WRITING & 0xff = 0x00: fan may be switched off - WRITING & 0xff = 0x01: fan must run at least at minimum speed (supply: 6V) - WRITING & 0xff = 0xff: fan must run at maximum speed (supply: 12V) - WRITING & 0xff = 0x??: fan must run at least at given speed (supply: 6V..12V) - -* fan*:4 (1: power supply fan, 2: CPU fan, 3: auxiliary fan) - READING: actual RPM value - - -Limitations ------------ - -* Measuring fan speed -It seems that the chip counts "ripples" (typical fans produce 2 ripples per -rotation while VERAX fans produce 18) in a 9-bit register. This register is -read out every second, then the ripple prescaler (2, 4 or 8) is applied and -the result is stored in the 8 bit output register. Due to the limitation of -the counting register to 9 bits, it is impossible to measure a VERAX fan -properly (even with a prescaler of 8). At its maximum speed of 3500 RPM the -fan produces 1080 ripples per second which causes the counting register to -overflow twice, leading to only 186 RPM. - -* Measuring input voltages -in2 ("battery") reports the voltage of the onboard lithium battery and not -+3.3V from the power supply. - -* Undocumented features -Fujitsu-Siemens Computers has not documented all features of the chip so far. -Their software, System Guard, shows that there are a still some features which -cannot be controled by this implementation. - - -Chip Features -------------- - -Chip 'fscher' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -rev - - R- 0 -alarms - - R- 0 -control - - RW 0 -in0 - - R- 2 -in1 - - R- 2 -in2 - - R- 2 -temp1 - - R- 0 -temp2 - - R- 0 -temp3 - - R- 0 -temp1_state temp1 temp1 RW 0 -temp2_state temp2 temp2 RW 0 -temp3_state temp3 temp3 RW 0 -fan1 - - R- 0 -fan2 - - R- 0 -fan3 - - R- 0 -fan1_min fan1 fan1 RW 0 -fan2_min fan2 fan2 RW 0 -fan3_min fan3 fan3 RW 0 -fan1_state fan1 fan1 RW 0 -fan2_state fan2 fan2 RW 0 -fan3_state fan3 fan3 RW 0 -fan1_ripple fan1 fan1 RW 0 -fan2_ripple fan2 fan2 RW 0 -fan3_ripple fan3 fan3 RW 0 -wdog_preset - - RW 0 -wdog_state wdog_preset wdog_preset RW 0 -wdog_control wdog_preset wdog_preset RW 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -rev SENSORS_FSCHER_REV rev:1 -alarms SENSORS_FSCHER_EVENT alarms:1 -control SENSORS_FSCHER_CONTROL control:1 -in0 SENSORS_FSCHER_VOLTAGE1 in0:1 -in1 SENSORS_FSCHER_VOLTAGE2 in1:1 -in2 SENSORS_FSCHER_VOLTAGE3 in2:1 -temp1 SENSORS_FSCHER_TEMP1 temp1:2 -temp2 SENSORS_FSCHER_TEMP2 temp2:2 -temp3 SENSORS_FSCHER_TEMP3 temp3:2 -temp1_state SENSORS_FSCHER_TEMP1_STATE temp1:1 -temp2_state SENSORS_FSCHER_TEMP2_STATE temp2:1 -temp3_state SENSORS_FSCHER_TEMP3_STATE temp3:1 -fan1 SENSORS_FSCHER_FAN1 fan1:4 -fan2 SENSORS_FSCHER_FAN2 fan2:4 -fan3 SENSORS_FSCHER_FAN3 fan3:4 -fan1_min SENSORS_FSCHER_FAN1_MIN fan1:2 -fan2_min SENSORS_FSCHER_FAN2_MIN fan2:2 -fan3_min SENSORS_FSCHER_FAN3_MIN fan3:2 -fan1_state SENSORS_FSCHER_FAN1_STATE fan1:1 -fan2_state SENSORS_FSCHER_FAN2_STATE fan2:1 -fan3_state SENSORS_FSCHER_FAN3_STATE fan3:1 -fan1_ripple SENSORS_FSCHER_FAN1_RIPPLE fan1:3 -fan2_ripple SENSORS_FSCHER_FAN2_RIPPLE fan2:3 -fan3_ripple SENSORS_FSCHER_FAN3_RIPPLE fan3:3 -wdog_preset SENSORS_FSCHER_WDOG_PRESET wdog:1 -wdog_state SENSORS_FSCHER_WDOG_STATE wdog:2 -wdog_control SENSORS_FSCHER_WDOG_CONTROL wdog:3 diff --git a/doc/chips/fscpos b/doc/chips/fscpos deleted file mode 100644 index 0707dc0d..00000000 --- a/doc/chips/fscpos +++ /dev/null @@ -1,122 +0,0 @@ -Kernel driver `fscpos.o' -====================== - -Status: Beta - Tested with motherboard d1107 - - Think twice before you're using the write mode of some - variables, especially the watchdog - - -Supported chips: - * Fujitsu Siemens Poseidon chip - Prefix: 'fscpos' - Addresses scanned: I2C 0x73 - -Author: Hermann Jung - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This driver implements support for the Fujitsu Siemens Poseidon chip. -It is descibed in the 'Register Set Specification BMC Poseidon based -Systemboard' from Fujitsu Siemens. - -The poseidon chip implements a hardware based system management, -e.g. for controlling fan speed and core voltage. -There is also a watchdog counter on the chip which can trigger -an alarm and even shutdown the system. - -The chip provides three temperature values (cpu, motherboard and auxiliary), -three current values (12 volt, 5 volt and battery) and -three fans (power supply, cpu and auxiliary). - -Temperatures are measured in degrees Celsius. The resolution is 1 degree. - -Fan rotation speeds are reported in RPM (rotations per minute). -The value can be divided by a programmable divider (1, 2, 4 or 8) which -is stored on the chip. - -Voltage sensors (also known as IN sensors) report their values in volts. - -All values are reported as final values from the driver. -There is no need for further calculations. - -Chip Features -------------- - -Chip `fscpos' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - rev NONE NONE R 0 - event NONE NONE R 0 - control NONE NONE RW 0 - volt12 NONE NONE R 2 - volt5 NONE NONE R 2 - voltbatt NONE NONE R 2 - temp1 NONE NONE R 0 - temp2 NONE NONE R 0 - temp3 NONE NONE R 0 - temp1_state temp1 temp1 RW 0 - temp2_state temp2 temp2 RW 0 - temp3_state temp3 temp3 RW 0 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - fan1_state fan1 fan1 RW 0 - fan2_state fan2 fan2 RW 0 - fan3_state fan3 fan3 RW 0 - fan1_ripple fan1 fan1 RW 0 - fan2_ripple fan2 fan2 RW 0 - fan3_ripple fan3 fan3 RW 0 - wdog_preset NONE NONE RW 0 - wdog_state wdog_preset wdog_preset RW 0 - wdog_control wdog_preset wdog_preset RW 0 - - - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - rev FSCPOS_SYSCTL_REV rev:1 - event FSCPOS_SYSCTL_EVENT event:1 - control FSCPOS_SYSCTL_CONTROL control:1 - volt12 FSCPOS_SYSCTL_VOLTAGE1 volt0:1 - volt5 FSCPOS_SYSCTL_VOLTAGE2 volt1:1 - voltbatt FSCPOS_SYSCTL_VOLTAGE3 volt2:1 - temp1 FSCPOS_SYSCTL_TEMP1 temp0:2 - temp2 FSCPOS_SYSCTL_TEMP2 temp1:2 - temp3 FSCPOS_SYSCTL_TEMP3 temp2:2 - temp1_state FSCPOS_SYSCTL_TEMP1_STATE temp0:1 - temp2_state FSCPOS_SYSCTL_TEMP2_STATE temp1:1 - temp3_state FSCPOS_SYSCTL_TEMP3_STATE temp2:1 - fan1 FSCPOS_SYSCTL_FAN1 fan0:4 - fan2 FSCPOS_SYSCTL_FAN2 fan1:4 - fan3 FSCPOS_SYSCTL_FAN3 fan2:4 - fan1_min FSCPOS_SYSCTL_FAN1_MIN fan0:2 - fan2_min FSCPOS_SYSCTL_FAN2_MIN fan1:2 - fan1_state FSCPOS_SYSCTL_FAN1_STATE fan0:1 - fan2_state FSCPOS_SYSCTL_FAN2_STATE fan1:1 - fan3_state FSCPOS_SYSCTL_FAN3_STATE fan2:1 - fan1_ripple FSCPOS_SYSCTL_FAN1_RIPPLE fan0:3 - fan2_ripple FSCPOS_SYSCTL_FAN2_RIPPLE fan1:3 - fan3_ripple FSCPOS_SYSCTL_FAN3_RIPPLE fan2:3 - wdog_preset FSCPOS_SYSCTL_WDOG_PRESET wdog:1 - wdog_state FSCPOS_SYSCTL_WDOG_STATE wdog:2 - wdog_control FSCPOS_SYSCTL_WDOG_CONTROL wdog:3 - diff --git a/doc/chips/fscscy b/doc/chips/fscscy deleted file mode 100644 index 6cc2f2ee..00000000 --- a/doc/chips/fscscy +++ /dev/null @@ -1,251 +0,0 @@ -Kernel driver `fscscy.o' -====================== - -Status: Beta - Tested with motherboard D1230 - Should also work with D1204, D1306 and D1307 - - Think twice before you're using the write mode of some - variables, especially the watchdog (Not my comment, but it makes - good sense to observe :-) - - -Supported chips: - * Fujitsu Siemens Scylla chip - Prefix: 'fscscy' - Addresses scanned: I2C 0x73 - -Author: Martin Knoblauch - -Acknowledgement: - This code has been greatly inspired by Hermann Jung - and his work on the Poseidon driver (fscpos) - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This driver implements support for the Fujitsu Siemens Scylla chip. -The code is based on the "fscpos" driver for the FSC Poseidon chip. -In fact, it seems the Scylla is a superset of the "Poseidon", "Poseidon II" -and "Hydra" chips. - -The register readings/setting have been deduced from the 'Register Set -Specification BMC Poseidon based Systemboard' by Fujitsu Siemens and the -"sbbmon.ini" file from the Fujitsu-Siemens ServerView software. - -The scylla chip implements a hardware based system management, -e.g. for controlling fan speed and core voltage. -There is also a watchdog counter on the chip which can trigger -an alarm and even shutdown the system. See above for more details about using -the watchdog feature. - -The chip provides four temperature values (cpu0/1, motherboard and auxiliary), -three current values (12 volt, 5 volt and battery) and up to -six fans (power supply, cpu and auxiliary). - -Temperatures are measured in degrees Celsius. The resolution is 1 degree. -In addition to state and actual temperature, the temperature sensors also export -a LIMIT temperature for each sensor. The meaning of the information itself is -obvious. The rest is guesswork. It likely triggers an alarm/event as soon as it is -reached. The authors feeling is that it is even a writeable register. But beeing of -the cautios kind he did not implement writing the LIMIT resister. The driver itself -keeps track of the minimum and maximum temperatures since module load. The more often -the module is accessed, the more meaningful these values are. - -Fan rotation speeds are reported in RPM (rotations per minute). -The value can be divided by a programmable divider (1, 2, 4 or 8) which -is stored on the chip. - -Voltage sensors (also known as IN sensors) report their values in volts. - -All values are reported as final values from the driver. -There is no need for further calculations. - - -Using The Watchdog ------------------- - -This part was mostly contributed by A'rpi . Thanks! -I (Jean Delvare) edited the text for greater clarity, mainly to integrate -the e-mail exchange I and A'rpi had as a sequel of the original report. -Here it goes. - -I've spent few hours experiencing with the watchdog feature of the Fujitsu -Siemens server board (don't ask the model name, what I know is that it uses -Serverworks CSB5 chipset) using lm_sensors' fscscy driver. - -OK, so there is /proc/sys/dev/sensors/fscscy-i2c-0-73/wdog, containing 3 -8-bit values for the 3 watchdog registers. - -The first one is the time counter, it counts backwards. It's in 2 seconds -base, so writting 30 there means 60 seconds delay. It seems the whole range -(0 to 255) is supported, so up to 510 seconds (8.5 minutes). Writting 0 means -immediate hardware reset. The value you can read back is the same as you wrote -there, not the current value of the counter (as I expected). - -The second number is supposed to be a state register. It doesn't matter what -value I put there. It's always 0. Even if I write a non-zero value there, i got -0 back. Maybe it's non-zero at the moment of reset :) - -The third is the control register, with 5th (value 16), 6th (value 32) and 8th -(value 128) bits used only. If I write 16 or 144 (128+16), it means system -reset when the counter reaches 0. If I add 32 (for a value of 48 or 176), no -reset will occur. - -So, the world's simplest watchdog using this mainboard: - -while true ; do - echo 30 0 16 > /proc/sys/dev/sensors/fscscy-i2c-0-73/wdog - sleep 10 -done - -It does hardware reset after 1 minute, if this script is killed or system -hang-up occurs. Adjust the 30 and 10 values according to you needs, but -remember you must sleep less than the reset countdown time (here, 30*2-10 -gives us a 50 seconds margin, which is more than enough). - -Also note that BIOS has a strange setting, named 'OS Boot Retry Count', set -to 0 by default, it changes watchdog behaviour to power off instead of reset. -(0=poweroff 1..7=reset). It took me a while to find this. This behavior is -probably related to the "Reset Limit" parameter defined by the ACPI -specification (3.3.24 System Reset (Type 23)). It sets how many unintentional -resets can be performed in a row before giving up (and shut down). - -Please add the above to the documentation (doc/chips/fscscy), so i can save -a few hours of resetting for other people :) - - -Chip Features -------------- - -Chip `fscscy' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - rev NONE NONE R 0 - event NONE NONE R 0 - control NONE NONE RW 0 - volt12 NONE NONE R 2 - volt5 NONE NONE R 2 - voltbatt NONE NONE R 2 - temp1 NONE NONE R 0 - temp2 NONE NONE R 0 - temp3 NONE NONE R 0 - temp4 NONE NONE R 0 - temp1_state temp1 temp1 RW 0 - temp2_state temp2 temp2 RW 0 - temp3_state temp3 temp3 RW 0 - temp4_state temp4 temp4 RW 0 - temp1_lim temp1 temp1 R* 0 - temp2_lim temp2 temp2 R* 0 - temp3_lim temp3 temp3 R* 0 - temp4_lim temp4 temp4 R* 0 - temp1_min temp1 temp1 R 0 - temp2_min temp2 temp2 R 0 - temp3_min temp3 temp3 R 0 - temp4_min temp4 temp4 R 0 - temp1_max temp1 temp1 R 0 - temp2_max temp2 temp2 R 0 - temp3_max temp3 temp3 R 0 - temp4_max temp4 temp4 R 0 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan4 NONE NONE R 0 - fan5 NONE NONE R 0 - fan6 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - fan3_min fan3 fan3 RW 0 - fan4_min fan4 fan4 RW 0 - fan5_min fan5 fan5 RW 0 - fan6_min fan6 fan6 RW 0 - fan1_state fan1 fan1 RW 0 - fan2_state fan2 fan2 RW 0 - fan3_state fan3 fan3 RW 0 - fan4_state fan4 fan4 RW 0 - fan5_state fan5 fan5 RW 0 - fan6_state fan6 fan6 RW 0 - fan1_ripple fan1 fan1 RW 0 - fan2_ripple fan2 fan2 RW 0 - fan3_ripple fan3 fan3 RW 0 - fan4_ripple fan4 fan4 RW 0 - fan5_ripple fan5 fan5 RW 0 - fan6_ripple fan6 fan6 RW 0 - wdog_preset NONE NONE RW 0 - wdog_state wdog_preset wdog_preset RW 0 - wdog_control wdog_preset wdog_preset RW 0 - - R*: Maybe writable, but due to lack of documentation the author did not dare - to implement it :-) - - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - rev FSCSCY_SYSCTL_REV rev:1 - event FSCSCY_SYSCTL_EVENT event:1 - control FSCSCY_SYSCTL_CONTROL control:1 - volt12 FSCSCY_SYSCTL_VOLTAGE1 volt0:1 - volt5 FSCSCY_SYSCTL_VOLTAGE2 volt1:1 - voltbatt FSCSCY_SYSCTL_VOLTAGE3 volt2:1 - temp1 FSCSCY_SYSCTL_TEMP1 temp0:2 - temp2 FSCSCY_SYSCTL_TEMP2 temp1:2 - temp3 FSCSCY_SYSCTL_TEMP3 temp2:2 - temp4 FSCSCY_SYSCTL_TEMP4 temp3:2 - temp1_state FSCSCY_SYSCTL_TEMP1_STATE temp0:1 - temp2_state FSCSCY_SYSCTL_TEMP2_STATE temp1:1 - temp3_state FSCSCY_SYSCTL_TEMP3_STATE temp2:1 - temp4_state FSCSCY_SYSCTL_TEMP4_STATE temp3:1 - temp1_lim FSCSCY_SYSCTL_TEMP1_LIM temp0:3 - temp2_lim FSCSCY_SYSCTL_TEMP2_LIM temp1:3 - temp3_lim FSCSCY_SYSCTL_TEMP3_LIM temp2:3 - temp4_lim FSCSCY_SYSCTL_TEMP4_LIM temp3:3 - temp1_min FSCSCY_SYSCTL_TEMP1_MIN temp0:4 - temp2_min FSCSCY_SYSCTL_TEMP2_MIN temp1:4 - temp3_min FSCSCY_SYSCTL_TEMP3_MIN temp2:4 - temp4_min FSCSCY_SYSCTL_TEMP4_MIN temp3:4 - temp1_max FSCSCY_SYSCTL_TEMP1_MIN temp0:5 - temp2_max FSCSCY_SYSCTL_TEMP2_MIN temp1:5 - temp3_max FSCSCY_SYSCTL_TEMP3_MIN temp2:5 - temp4_max FSCSCY_SYSCTL_TEMP4_MIN temp3:5 - fan1 FSCSCY_SYSCTL_FAN1 fan0:4 - fan2 FSCSCY_SYSCTL_FAN2 fan1:4 - fan3 FSCSCY_SYSCTL_FAN3 fan2:4 - fan4 FSCSCY_SYSCTL_FAN4 fan3:4 - fan5 FSCSCY_SYSCTL_FAN5 fan4:4 - fan6 FSCSCY_SYSCTL_FAN6 fan5:4 - fan1_min FSCSCY_SYSCTL_FAN1_MIN fan0:2 - fan2_min FSCSCY_SYSCTL_FAN2_MIN fan1:2 - fan3_min FSCSCY_SYSCTL_FAN3_MIN fan2:2 - fan4_min FSCSCY_SYSCTL_FAN4_MIN fan3:2 - fan5_min FSCSCY_SYSCTL_FAN5_MIN fan4:2 - fan6_min FSCSCY_SYSCTL_FAN6_MIN fan5:2 - fan1_state FSCSCY_SYSCTL_FAN1_STATE fan0:1 - fan2_state FSCSCY_SYSCTL_FAN2_STATE fan1:1 - fan3_state FSCSCY_SYSCTL_FAN3_STATE fan2:1 - fan4_state FSCSCY_SYSCTL_FAN4_STATE fan3:1 - fan5_state FSCSCY_SYSCTL_FAN5_STATE fan4:1 - fan6_state FSCSCY_SYSCTL_FAN6_STATE fan5:1 - fan1_ripple FSCSCY_SYSCTL_FAN1_RIPPLE fan0:3 - fan2_ripple FSCSCY_SYSCTL_FAN2_RIPPLE fan1:3 - fan3_ripple FSCSCY_SYSCTL_FAN3_RIPPLE fan2:3 - fan4_ripple FSCSCY_SYSCTL_FAN3_RIPPLE fan3:3 - fan5_ripple FSCSCY_SYSCTL_FAN3_RIPPLE fan4:3 - fan6_ripple FSCSCY_SYSCTL_FAN3_RIPPLE fan5:3 - wdog_preset FSCSCY_SYSCTL_WDOG_PRESET wdog:1 - wdog_state FSCSCY_SYSCTL_WDOG_STATE wdog:2 - wdog_control FSCSCY_SYSCTL_WDOG_CONTROL wdog:3 - diff --git a/doc/chips/gl518sm b/doc/chips/gl518sm deleted file mode 100644 index 02aaa6e5..00000000 --- a/doc/chips/gl518sm +++ /dev/null @@ -1,184 +0,0 @@ -Kernel driver `gl518sm.o' -========================= - -Status: Complete and well-tested - -Supported chips: - * Genesys Logic GL518SM release 0x00 - Prefix: 'gl518sm' - Addresses scanned: I2C 0x2c and 0x2d - Datasheet: http://www.genesyslogic.com/pdf - * Genesys Logic GL518SM release 0x80 - Prefix: 'gl518sm' - Addresses scanned: I2C 0x2c and 0x2d - Datasheet: http://www.genesyslogic.com/pdf - -Author: Frodo Looijaard , - Kyösti Mälkki - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_gl518sm_r00: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `gl518sm_r00' chip -* force_gl518sm_r80: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `gl518sm_r80' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - -Description ------------ - -IMPORTANT: For the revision 0x00 chip, the - in0, in1, and in2 values (+5, +3, and +12) CANNOT be read - unless you use the slow 'iterate' method. Limits will still - work even when iterate=0. See below. This is a limitation - of the chip, not the driver. - Note that the 'iterate' method was trimmed while porting the - driver to Linux 2.6 as we considered it too ugly for the thin - benefit. - - -This driver supports the Genesys Logic GL518SM chip. There are at least -two revision of this chip, which we call revision 0x00 and 0x80. Revision -0x80 chips support the reading of voltages directly, 0x00 only for VIN3. - -The GL518SM implements one temperature sensor, two fan rotation speed -sensors, and four voltage sensors. It can report alarms through the -computer speakers. - -Temperatures are measured in degrees Celsius. An alarm goes off while the -temperature is above the over temperature limit, and has not yet dropped -below the hysteresis limit. The alarm always reflects the current situation. -Measurements are guaranteed between -10 degrees and +110 degrees, with -a resolution of +-3 degrees. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. -In case when you have selected to turn Fan1 off, no Fan1 alarm is triggered. - -Fan readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 1900 RPM. - -Voltage sensors (also known as VIN sensors) report their values in volts. An -alarm is triggered if the voltage has crossed a programmable minimum or -maximum limit. Note that minimum in this case always means 'closest to -zero'; this is important for negative voltage measurements. The VDD input -measures voltages between 0.000 and 5.865 volt, with a resolution of 0.023 -volt. The other inputs measure voltages between 0.000 and 4.845 volt, with a -resolution of 0.019 volt. Note that revision 0x00 chips do not support -reading the current voltage of any input except for VIN3; limit setting and -alarms work fine, though. There is code to compute them by iterating. - -When an alarm goes off, you can be warned by a beeping signal through -your computer speaker. It is possible to enable all beeping globally, -or only the beeping for some alarms. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once (except for temperature alarms). This means that the -cause for the alarm may already have disappeared! Note that in the current -implementation, all hardware registers are read whenever any data is read -(unless it is less than 1.5 seconds since the last update). This means that -you can easily miss once-only alarms. - -The GL518SM only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. - -Iteration Code --------------- - -IMPORTANT: For the revision 0x00 chip only, -you may select between three modes to read the vin0-2 inputs with -the following lines in /etc/sensors.conf: - - set iterate 0 Don't read in0-in2 inputs. - set iterate 1 Run the iteration loop, this takes up to 10 seconds. - set iterate 2 Show the results of the last iteration loop, - and start a new loop to run in the background. - -You may also set the iteration type with -'echo n > /proc/sys/dev/sensors/gl518sm-i2c-x-y/iterate'. - -If you have a rev 0x80 chip, the in0-in2 inputs are readable. -In this case, 'iterate' will be read-only and the read value is 3. - -This does NOT apply to the Linux 2.6 kernel driver, where the 'iteration' -code was dropped for being too ugly. - - -Chip Features -------------- - -Chip `gl518sm' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - vdd NONE NONE R 2 - vin1 NONE NONE R 2 - vin2 NONE NONE R 2 - vin3 NONE NONE R 2 - vdd_min vdd vdd RW 2 - vin1_min vin1 vin1 RW 2 - vin2_min vin2 vin2 RW 2 - vin3_min vin3 vin3 RW 2 - vdd_max vdd vdd RW 2 - vin1_max vin1 vin1 RW 2 - vin2_max vin2 vin2 RW 2 - vin3_max vin3 vin3 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - alarms NONE NONE R 0 - beep_enable alarms NONE RW 0 - beeps alarms alarms RW 0 - fan1_off NONE NONE RW 0 - fan1_off_pin NONE NONE RW 0 - iterate NONE NONE RW 0 - - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - vdd SENSORS_GL518_VDD vdd:3 - vin1 SENSORS_GL518_VIN1 vin1:3 - vin2 SENSORS_GL518_VIN2 vin2:3 - vin3 SENSORS_GL518_VIN3 vin3:3 - vdd_min SENSORS_GL518_VDD_MIN vdd:1 - vin1_min SENSORS_GL518_VIN1_MIN vin1:1 - vin2_min SENSORS_GL518_VIN2_MIN vin2:1 - vin3_min SENSORS_GL518_VIN3_MIN vin3:1 - vdd_max SENSORS_GL518_VDD_MAX vdd:2 - vin1_max SENSORS_GL518_VIN1_MAX vin1:2 - vin2_max SENSORS_GL518_VIN2_MAX vin2:2 - vin3_max SENSORS_GL518_VIN3_MAX vin3:2 - fan1 SENSORS_GL518_FAN1 fan1:2 - fan2 SENSORS_GL518_FAN2 fan2:2 - fan1_min SENSORS_GL518_FAN1_MIN fan1:1 - fan2_min SENSORS_GL518_FAN2_MIN fan2:1 - temp SENSORS_GL518_TEMP temp:3 - temp_hyst SENSORS_GL518_TEMP_HYST temp:2 - temp_over SENSORS_GL518_TEMP_OVER temp:1 - fan1_div SENSORS_GL518_FAN1_DIV fan_div:1 - fan2_div SENSORS_GL518_FAN2_DIV fan_div:2 - alarms SENSORS_GL518_ALARMS alarms:1 - beep_enable SENSORS_GL518_BEEP_ENABLE beep:1 - beeps SENSORS_GL518_BEEPS beep:2 - fan1_off SENSORS_GL518_FAN1OFF fan1off:1 - fan1_off_pin SENSORS_GL518_FAN1PIN fan1off:2 - iterate SENSORS_GL518_ITERATE iterate:1 - diff --git a/doc/chips/gl520sm b/doc/chips/gl520sm deleted file mode 100644 index 17d7c84a..00000000 --- a/doc/chips/gl520sm +++ /dev/null @@ -1,146 +0,0 @@ -Kernel driver `gl520sm.o' -========================= - -Status: Complete but experimental - -Supported chips: - * Genesys Logic GL520SM release 0x00 - Prefix: 'gl520sm' - Addresses scanned: I2C 0x2c and 0x2d - Datasheet: Not openly available - -Author: Frodo Looijaard , - Kyösti Mälkki - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - -Description ------------ - -This driver supports the Genesys Logic GL520SM chip. - -The GL520SM implements one temperature sensor, two fan rotation speed -sensors, four voltage sensors and the cpu VID lines. In addition, one input -can be configured as either a temperature or voltage sensor. -The sensor can report alarms through the computer speakers. - -Temperatures are measured in degrees Celsius. An alarm goes off while the -temperature is above the over temperature limit, and has not yet dropped -below the hysteresis limit. The alarm always reflects the current situation. -Measurements are guaranteed between 0 degrees and +110 degrees, with -a resolution of +-3 degrees. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. -In case when you have selected to turn Fan1 off, no Fan1 alarm is triggered -if measured temperature is below 'over temperature' limit. - -Fan readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 1900 RPM. - -Voltage sensors (also known as VIN sensors) report their values in volts. An -alarm is triggered if the voltage has crossed a programmable minimum or -maximum limit. Note that minimum in this case always means 'closest to -zero'; this is important for negative voltage measurements. The VDD input -measures voltages between 0.000 and 5.865 volt, with a resolution of 0.023 -volt. The other inputs measure voltages between 0.000 and 4.845 volt, with a -resolution of 0.019 volt. - -When an alarm goes off, you can be warned by a beeping signal through -your computer speaker. It is possible to enable all beeping globally, -or only the beeping for some alarms. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once (except for temperature alarms). This means that the -cause for the alarm may already have disappeared! Note that in the current -implementation, all hardware registers are read whenever any data is read -(unless it is less than 1.5 seconds since the last update). This means that -you can easily miss once-only alarms. - -The GL520SM only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. - -Chip Features -------------- - -Chip `gl520sm' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - vdd NONE NONE R 2 - vin1 NONE NONE R 2 - vin2 NONE NONE R 2 - vin3 NONE NONE R 2 - vin4 NONE NONE R 2 - vdd_min vdd vdd RW 2 - vin1_min vin1 vin1 RW 2 - vin2_min vin2 vin2 RW 2 - vin3_min vin3 vin3 RW 2 - vin4_min vin4 vin4 RW 2 - vdd_max vdd vdd RW 2 - vin1_max vin1 vin1 RW 2 - vin2_max vin2 vin2 RW 2 - vin3_max vin3 vin3 RW 2 - vin4_max vin4 vin4 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - temp1 NONE NONE R 1 - temp2 NONE NONE R 1 - temp1_hyst temp1 temp1 RW 1 - temp2_hyst temp2 temp2 RW 1 - temp1_over temp1 temp1 RW 1 - temp2_over temp2 temp2 RW 1 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - alarms NONE NONE R 0 - beep_enable alarms NONE RW 0 - beeps alarms alarms RW 0 - two_temps NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - vdd SENSORS_GL520_VDD vdd:3 - vin1 SENSORS_GL520_VIN1 vin1:3 - vin2 SENSORS_GL520_VIN2 vin2:3 - vin3 SENSORS_GL520_VIN3 vin3:3 - vin4 SENSORS_GL520_VIN4 vin3:3 - vdd_min SENSORS_GL520_VDD_MIN vdd:1 - vin1_min SENSORS_GL520_VIN1_MIN vin1:1 - vin2_min SENSORS_GL520_VIN2_MIN vin2:1 - vin3_min SENSORS_GL520_VIN3_MIN vin3:1 - vin4_min SENSORS_GL520_VIN4_MIN vin3:1 - vdd_max SENSORS_GL520_VDD_MAX vdd:2 - vin1_max SENSORS_GL520_VIN1_MAX vin1:2 - vin2_max SENSORS_GL520_VIN2_MAX vin2:2 - vin3_max SENSORS_GL520_VIN3_MAX vin3:2 - vin4_max SENSORS_GL520_VIN4_MAX vin3:2 - fan1 SENSORS_GL520_FAN1 fan1:2 - fan2 SENSORS_GL520_FAN2 fan2:2 - fan1_min SENSORS_GL520_FAN1_MIN fan1:1 - fan2_min SENSORS_GL520_FAN2_MIN fan2:1 - temp1 SENSORS_GL520_TEMP1 temp1:3 - temp2 SENSORS_GL520_TEMP2 temp2:3 - temp1_hyst SENSORS_GL520_TEMP1_HYST temp1:2 - temp2_hyst SENSORS_GL520_TEMP2_HYST temp2:2 - temp1_over SENSORS_GL520_TEMP1_OVER temp1:1 - temp2_over SENSORS_GL520_TEMP2_OVER temp2:1 - fan1_div SENSORS_GL520_FAN1_DIV fan_div:1 - fan2_div SENSORS_GL520_FAN2_DIV fan_div:2 - alarms SENSORS_GL520_ALARMS alarms:1 - beep_enable SENSORS_GL520_BEEP_ENABLE beep:1 - beeps SENSORS_GL520_BEEPS beep:2 - two_temps SENSORS_GL520_TWOTEMPS config:1 diff --git a/doc/chips/it87 b/doc/chips/it87 deleted file mode 100644 index d33fdd92..00000000 --- a/doc/chips/it87 +++ /dev/null @@ -1,273 +0,0 @@ -Kernel driver `it87.o' -====================== - -Status: Complete, stable - -Supported chips: - * IT8705F - Prefix: 'it87' - Addresses scanned: ISA autodetected - Datasheet: Publicly available at the ITE website - http://www.ite.com.tw/ - * IT8712F - Prefix: 'it8712' - Addresses scanned: I2C 0x28 - 0x2f, ISA autodetected - Datasheet: Publicly available at the ITE website - http://www.ite.com.tw/ - * SiS950 [clone of IT8705F] - Prefix: 'it87' - Addresses scanned: ISA autodetected - Datasheet: No longer publicly available - -Author: Christophe Gauthron - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 -* update_vbat: integer 0 if vbat should report power on value, 1 if - vbat should be updated after each read. Default is 0. - On some boards the battery voltage is provided by either the battery or - the onboard power supply. Only the first reading at power on will be - the actual battery voltage (which the chip does automatically). On other - boards the battery voltage is always fed to the chip so can be read at - any time. Excessive reading may decrease battery life but no information - is given in the datasheet. -* reset: integer 1 if the registers of the chip should be reset at - module load time, 0 to not reset the registers. Default is 0. - - -Description ------------ - -This driver implements support for the IT8705F, IT8712F and SiS950 chips. - -These chips are 'Super I/O chips', supporting floppy disks, infrared ports, -joysticks and other miscellaneous stuff. For hardware monitoring, -they include an 'environmnent controller' with 3 temperature sensors, -3 fan rotation speed sensors, 8 voltage sensors, and associated alarms. -The IT8712F additionally features VID inputs. - -Temperatures are measured in degrees Celsius. An alarm is triggered once -when the Overtemperature Shutdown limit is crossed. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -Voltage sensors (also known as IN sensors) report their values in volts. -An alarm is triggered if the voltage has crossed a programmable minimum -or maximum limit. Note that minimum in this case always means 'closest to -zero'; this is important for negative voltage measurements. All voltage -inputs can measure voltages between 0 and 4.08 volts, with a resolution -of 0.016 volt. The battery voltage in8 does not have limit registers. - -The VID lines (IT8712F only) encode the core voltage value: the voltage level -your processor should work with. This is hardcoded by the mainboard and/or -processor itself. It is a value in volts. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.5 seconds since the last update). This means that you can easily -miss once-only alarms. - -The IT87xx only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. - -The sensor type can be set at runtime as of release 2.8.2. -To change sensor N to a thermistor, 'echo 2 > sensorN' -where N is 1, 2, or 3. -To change sensor N to a thermal diode, 'echo 3 > sensorN'. -Give 0 for unused sensor. Any other value is invalid. -To configure this at startup, put the following lines in the it87 section -of /etc/sensors.conf. -(2 = thermistor; 3 = thermal diode; 0 = unused) - set sensor1 3 - set sensor2 3 - set sensor3 3 - -If you set a sensor to 0, you'll also want to ignore its value: - ignore tempN - -The fan speed control features can be enabled by setting the bits 0-2 of -the fan_ctl register to 1. (Note: bits 6-4 of this register must be set to -1 to enable the fan monitoring). - 0x40 : enable fan speed monitoring for fan3 - 0x20 : enable fan speed monitoring for fan2 - 0x10 : enable fan speed monitoring for fan1 - 0x04 : enable fan smart guardian mode for fan3 - 0x02 : enable fan smart guardian mode for fan2 - 0x01 : enable fan smart guardian mode for fan1 - -If a fan's smart guardian bit is not set this fan is in on-off mode. -It can be switched on or off by setting/clearing the corresponding bit 0-2 -of the second fan control register fan_on_off. This register has no effect if -a fan is in smart guardian mode. - 0x04 : fan3 is on - 0x02 : fan2 is on - 0x01 : fan1 is on - -Bit 7 of the pwm[1-3] registers enables/disables the chip's automatic -temperature control mode for the specified fan. If Bit 7 is set the bits -1 and 0 encode the number of the temperature sensor used for this feature. -Possible register values are: - 0x00-0x7f direct power control for the fan speed - 0x80 automatic smart guardian mode use temperature sensor 1 - 0x81 automatic smart guardian mode use temperature sensor 2 - 0x82 automatic smart guardian mode use temperature sensor 3 - -In automatic smart guardian mode pwm values for low, medium and high speed -can be set in sg_pwm[1-3]. The temperature limits for fan off, low, medium, -hi speed and over temperature are set in sg_tl[1-3]. While the sensor's -temperature is between the low and medium speed value the fan will run in -low speed. When the sensor's temperature is between the medium and high speed -value the fan spins in medium speed. When the sensor's temperature is between -the high speed and over temperature value the fan spins in high speed. -If the sensor's temperature is higher than the over temperature limit the -fan will spin with the highest possible speed. - -Example: -The preconfigured (BIOS set) values of the Shuttle XPC SN41G2 Barebone. -The MB uses temp2 to monitor the CPU temperature and fan3 as the fan for their -special ICE heatpipe cooling system. - $ cat fan_ctl - 116 - $ cat tan_on_off - 215 - $ cat pwm3 - 129 - $ cat sg_tl3 - 16.0 16.0 48.0 54.0 58.0 - $ cat sg_pwm3 - 3 4 9 - -Explanation: - fan_ctl -> 116 = 0x74 = 01110100 : fan monitoring on for all fans, - and fan3 is in smart guardian mode. - fan_on_off -> 215 = 0xd7 =11010111 : all fans are on this setting is - ignored for fan3 which is in smart guardian mode - pwm3 -> 129 = 0x81 = 10000001 : fan3 is in automatic mode and uses - temp2 for speed control - sg_tl3 -> 16.0 16.0 48.0 54.0 58.0 : off, low, med, high, and - over temperature limits of fan3 - sg_pwm3 -> 3 4 9 : pwm values for low, medium and high fan speed of fan3. - - - -Chip features -------------- - -Chip `it87` - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in5 NONE NONE R 2 - in6 NONE NONE R 2 - in7 NONE NONE R 2 - in8 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in4 in4 RW 2 - in5_min in5 in5 RW 2 - in6_min in6 in6 RW 2 - in7_min in6 in6 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in4 in4 RW 2 - in5_max in5 in5 RW 2 - in6_max in6 in6 RW 2 - in7_max in6 in6 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - fan3_min fan3 fan3 RW 0 - temp1 NONE NONE R 1 - temp2 NONE NONE R 1 - temp3 NONE NONE R 1 - temp1_low temp temp RW 1 - temp1_over temp temp RW 1 - temp2_low temp temp RW 1 - temp2_over temp temp RW 1 - temp3_low temp temp RW 1 - temp3_over temp temp RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - fan3_div fan3 NONE R 0 - alarms_vin NONE NONE R 0 - alarms_fan NONE NONE R 0 - alarms_temp NONE NONE R 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - in0 SENSORS_IT87_IN0 in0:3 - in1 SENSORS_IT87_IN1 in1:3 - in2 SENSORS_IT87_IN2 in2:3 - in3 SENSORS_IT87_IN3 in3:3 - in4 SENSORS_IT87_IN4 in4:3 - in5 SENSORS_IT87_IN5 in5:3 - in6 SENSORS_IT87_IN6 in6:3 - in7 SENSORS_IT87_IN7 in7:3 - in0_min SENSORS_IT87_IN0_MIN in0:1 - in1_min SENSORS_IT87_IN1_MIN in1:1 - in2_min SENSORS_IT87_IN2_MIN in2:1 - in3_min SENSORS_IT87_IN3_MIN in3:1 - in4_min SENSORS_IT87_IN4_MIN in4:1 - in5_min SENSORS_IT87_IN5_MIN in5:1 - in6_min SENSORS_IT87_IN6_MIN in6:1 - in7_min SENSORS_IT87_IN7_MIN in7:1 - in0_max SENSORS_IT87_IN0_MAX in0:2 - in1_max SENSORS_IT87_IN1_MAX in1:2 - in2_max SENSORS_IT87_IN2_MAX in2:2 - in3_max SENSORS_IT87_IN3_MAX in3:2 - in4_max SENSORS_IT87_IN4_MAX in4:2 - in5_max SENSORS_IT87_IN5_MAX in5:2 - in6_max SENSORS_IT87_IN6_MAX in6:2 - in7_max SENSORS_IT87_IN7_MAX in7:2 - fan1 SENSORS_IT87_FAN1 fan1:2 - fan2 SENSORS_IT87_FAN2 fan2:2 - fan3 SENSORS_IT87_FAN3 fan3:2 - fan1_min SENSORS_IT87_FAN1_MIN fan1:1 - fan2_min SENSORS_IT87_FAN2_MIN fan2:1 - fan3_min SENSORS_IT87_FAN3_MIN fan3:1 - temp1 SENSORS_IT87_TEMP1 temp1:3 - temp2 SENSORS_IT87_TEMP2 temp2:3 - temp3 SENSORS_IT87_TEMP3 temp3:3 - temp1_low SENSORS_IT87_TEMP1_LOW temp1:2 - temp1_over SENSORS_IT87_TEMP1_HIGH temp1:1 - temp2_low SENSORS_IT87_TEMP2_LOW temp2:2 - temp2_over SENSORS_IT87_TEMP2_HIGH temp2:1 - temp3_low SENSORS_IT87_TEMP3_LOW temp3:2 - temp3_over SENSORS_IT87_TEMP3_HIGH temp3:1 - vid SENSORS_IT87_VID vid:1 - fan1_div SENSORS_IT87_FAN1_DIV fan_div:1 - fan2_div SENSORS_IT87_FAN2_DIV fan_div:2 - fan3_div SENSORS_IT87_FAN3_DIV fan_div:3 - alarms_fan SENSORS_IT87_ALARMS_FAN alarms_fan:1 - alarms_vin SENSORS_IT87_ALARMS_VIN alarms_vin:1 - alarms_temp SENSORS_IT87_ALARMS_TEMP alarms_temp:1 - - diff --git a/doc/chips/lm63 b/doc/chips/lm63 deleted file mode 100644 index d40397a7..00000000 --- a/doc/chips/lm63 +++ /dev/null @@ -1,102 +0,0 @@ -Kernel driver `lm63.o' -====================== - -Status: Complete, lightly tested - -Supported chips: - * National Semiconductor LM63 - Prefix: 'lm63' - Addresses scanned: I2C 0x4c - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/pf/LM/LM63.html - - -Author: Jean Delvare - -Thanks go to Tyan and especially Alex Buckingham for setting up a remote -access to their S4882 test platform for this driver. - http://www.tyan.com/ - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_lm63: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm63' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -The LM63 is a digital temperature sensor with integrated fan monitoring -and control. - -All temperature values are given in degrees Celsius. Resolution is 1.0 -degree for the local temperature, 0.125 degree for the remote temperature. - -The fan speed is measured using a tachometer. Contrary to most chips which -store the value in an 8-bit register and have a selectable clock divider -to make sure that the result will fit in the register, the LM63 uses 16-bit -value for measuring the speed of the fan. It can measure fan speeds down to -83 RPM, at least in theory. - -Note that the pin used for fan monitoring is shared with an alert out -function. Depending on how the board designer wanted to use the chip, fan -speed monitoring will or will not be possible. The proper chip configuration -is left to the BIOS, and the driver will blindly trust it. - -A PWM output can be used to control the speed of the fan. The LM63 has two -PWM modes: manual and automatic. Automatic mode is not fully implemented yet -(you cannot define your custom pwm/temperature curve), and mode change isn't -supported either. - -The lm63 driver will not update its values more frequently than every -second; reading them more often will do no harm, but will return 'old' -values. - - -Chip Features -------------- - -Chip 'lm63' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp1 - - R- 0 -temp1_high temp1 temp1 RW 0 -temp2 - - R- 3 -temp2_high temp2 temp2 RW 3 -temp2_low temp2 temp2 RW 3 -temp2_crit temp2 temp2 R- 0 -temp2_crit_hyst temp2 temp2 RW 0 -fan1 - - R- 0 -fan1_low fan1 fan1 RW 0 -pwm1 - - RW 0 -pwm1_enable pwm1 - R- 0 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp1 SENSORS_LM63_LOCAL_TEMP temp1:2 -temp1_high SENSORS_LM63_LOCAL_HIGH temp1:1 -temp2 SENSORS_LM63_REMOTE_TEMP temp2:3 -temp2_high SENSORS_LM63_REMOTE_HIGH temp2:1 -temp2_low SENSORS_LM63_REMOTE_LOW temp2:2 -temp2_crit SENSORS_LM63_REMOTE_TCRIT temp2_crit:1 -temp2_crit_hyst SENSORS_LM63_REMOTE_TCRIT_HYST temp2_crit_hyst:1 -fan1 SENSORS_LM63_FAN fan1:2 -fan1_low SENSORS_LM63_FAN_LOW fan1:1 -pwm1 SENSORS_LM63_PWM pwm1:1 -pwm1_enable SENSORS_LM63_PWM_ENABLE pwm1:2 -alarms SENSORS_LM63_ALARMS alarms:1 diff --git a/doc/chips/lm75 b/doc/chips/lm75 deleted file mode 100644 index 697ebbde..00000000 --- a/doc/chips/lm75 +++ /dev/null @@ -1,107 +0,0 @@ -Kernel driver `lm75.o' -===================== - -Status: Complete and well-tested - -Supported chips: - * National Semiconductor LM75 - Prefix: 'lm75' - Addresses scanned: I2C 0x48 - 0x4f - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/ - * Dallas Semiconductor DS75 - Prefix: 'lm75' - Addresses scanned: I2C 0x48 - 0x4f - Datasheet: Publicly available at the Maxim website - http://www.maxim-ic.com/ - * Dallas Semiconductor DS1775 - Prefix: 'lm75' - Addresses scanned: I2C 0x48 - 0x4f - Datasheet: Publicly available at the Maxim website - http://www.maxim-ic.com/ - * Maxim MAX6625, MAX6626 - Prefix: 'lm75' - Addresses scanned: I2C 0x48 - 0x4b - Datasheet: Publicly available at the Maxim website - http://www.maxim-ic.com/ - * Microchip (TelCom) TCN75 - Prefix: 'lm75' - Addresses scanned: I2C 0x48 - 0x4f - Datasheet: Publicly available at the Microchip website - http://www.microchip.com/ - * Texas Instruments TMP100, TMP101 - Prefix: 'lm75' - Addresses scanned: I2C 0x48 - 0x4f - Datasheet: Publicly available at the TI website - http://www.ti.com/ - -Author: Frodo Looijaard - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_lm75: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm75' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -The LM75 implements one temperature sensor. Limits can be set through the -Overtemperature Shutdown register and Hysteresis register. Each value can be -set and read to half-degree accuracy. -An alarm is issued (usually to a connected LM78) when the temperature -gets higher then the Overtemperature Shutdown value; it stays on until -the temperature falls below the Hysteresis value. -All temperatures are in degrees Celsius, and are guaranteed within a -range of -55 to +125 degrees. - -The LM75 only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. - -The LM75 is usually used in combination with LM78-like chips, to measure -the temperature of the processor(s). - -The DS75, DS1775, MAX6625, MAX6626, and others are supported as well. -They are not distinguished from an LM75. While most of these chips -have three additional bits of accuracy (12 vs. 9 for the LM75), -the additional bits are not supported. Not only that, but these chips will -not be detected if not in 9-bit precision mode (use the force parameter if -needed). -The prefix in the /proc directory is still 'lm75'. - -The LM75 is essentially an industry standard; there may be other -LM75 clones not listed here, with or without various enhancements, -that are supported. - -The LM77 is not supported, contrary to what we pretended for a long time. -Both chips are simply not compatible, value encoding differs. - - -Chip Features -------------- - -Chip `lm75' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - temp SENSORS_LM75_TEMP temp:3 - temp_hyst SENSORS_LM75_TEMP_HYST temp:2 - temp_over SENSORS_LM75_TEMP_OVER temp:1 - - diff --git a/doc/chips/lm78 b/doc/chips/lm78 deleted file mode 100644 index 9151973d..00000000 --- a/doc/chips/lm78 +++ /dev/null @@ -1,337 +0,0 @@ -Kernel driver `lm78.o' -====================== - -Status: Complete and well-tested - -Supported chips: - * National Semiconductor LM78 - Prefix: 'lm78' - Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) - Datasheet: Publicly available at the National Semiconductor website - * National Semiconductor LM78-J - Prefix: 'lm78-j' - Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) - Datasheet: Publicly available at the National Semiconductor website - * National Semiconductor LM79 - Prefix: 'lm79' - Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) - Datasheet: Publicly available at the National Semiconductor website - -Author: Frodo Looijaard - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_lm78: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm78' chip -* force_lm78j: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm78j' chip -* force_lm79: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm79' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This driver implements support for the National Semiconductor LM78, LM78-J -and LM79. They are described as `Microprocessor System Hardware Monitors'. - -There is almost no difference between the three supported chips. Functionally, -the LM78 and LM78-J are exactly identical. The LM79 has one more VID line, -which is used to report the lower voltages newer Pentium processors use. -From here on, LM7* means either of these three types. - -The LM7* implements one temperature sensor, three fan rotation speed sensors, -seven voltage sensors, VID lines, alarms, and some miscellaneous stuff. - -Temperatures are measured in degrees Celsius. An alarm is triggered once -when the Overtemperature Shutdown limit is crossed; it is triggered again -as soon as it drops below the Hysteresis value. A more useful behaviour -can be found by setting the Hysteresis value to +127 degrees Celsius; in -this case, alarms are issued during all the time when the actual temperature -is above the Overtemperature Shutdown value. Measurements are guaranteed -between -55 and +125 degrees, with a resolution of 1 degree. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -Voltage sensors (also known as IN sensors) report their values in volts. -An alarm is triggered if the voltage has crossed a programmable minimum -or maximum limit. Note that minimum in this case always means 'closest to -zero'; this is important for negative voltage measurements. All voltage -inputs can measure voltages between 0 and 4.08 volts, with a resolution -of 0.016 volt. - -The VID lines encode the core voltage value: the voltage level your processor -should work with. This is hardcoded by the mainboard and/or processor itself. -It is a value in volts. When it is unconnected, you will often find the -value 3.50 V here. - -In addition to the alarms described above, there are a couple of additional -ones. There is a BTI alarm, which gets triggered when an external chip has -crossed its limits. Usually, this is connected to all LM75 chips; if at -least one crosses its limits, this bit gets set. The CHAS alarm triggers -if your computer case is open. The FIFO alarms should never trigger; it -indicates an internal error. The SMI_IN alarm indicates some other chip -has triggered an SMI interrupt. As we do not use SMI interrupts at all, -this condition usually indicates there is a problem with some other -device. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.5 seconds since the last update). This means that you can easily -miss once-only alarms. - -The LM7* only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. - - -Chip features -------------- - -Chip `lm78' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in5 NONE NONE R 2 - in6 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in4 in4 RW 2 - in5_min in5 in5 RW 2 - in6_min in6 in6 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in4 in4 RW 2 - in5_max in5 in5 RW 2 - in6_max in6 in6 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - fan3_min fan3 fan3 RW 0 - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - fan3_div fan3 NONE R 0 - alarms NONE NONE R 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - in0 SENSORS_LM78_IN0 in0:3 - in1 SENSORS_LM78_IN1 in1:3 - in2 SENSORS_LM78_IN2 in2:3 - in3 SENSORS_LM78_IN3 in3:3 - in4 SENSORS_LM78_IN4 in4:3 - in5 SENSORS_LM78_IN5 in5:3 - in6 SENSORS_LM78_IN6 in6:3 - in0_min SENSORS_LM78_IN0_MIN in0:1 - in1_min SENSORS_LM78_IN1_MIN in1:1 - in2_min SENSORS_LM78_IN2_MIN in2:1 - in3_min SENSORS_LM78_IN3_MIN in3:1 - in4_min SENSORS_LM78_IN4_MIN in4:1 - in5_min SENSORS_LM78_IN5_MIN in5:1 - in6_min SENSORS_LM78_IN6_MIN in6:1 - in0_max SENSORS_LM78_IN0_MAX in0:2 - in1_max SENSORS_LM78_IN1_MAX in1:2 - in2_max SENSORS_LM78_IN2_MAX in2:2 - in3_max SENSORS_LM78_IN3_MAX in3:2 - in4_max SENSORS_LM78_IN4_MAX in4:2 - in5_max SENSORS_LM78_IN5_MAX in5:2 - in6_max SENSORS_LM78_IN6_MAX in6:2 - fan1 SENSORS_LM78_FAN1 fan1:2 - fan2 SENSORS_LM78_FAN2 fan2:2 - fan3 SENSORS_LM78_FAN3 fan3:2 - fan1_min SENSORS_LM78_FAN1_MIN fan1:1 - fan2_min SENSORS_LM78_FAN2_MIN fan2:1 - fan3_min SENSORS_LM78_FAN3_MIN fan3:1 - temp SENSORS_LM78_TEMP temp:3 - temp_hyst SENSORS_LM78_TEMP_HYST temp:2 - temp_over SENSORS_LM78_TEMP_OVER temp:1 - vid SENSORS_LM78_VID vid:1 - fan1_div SENSORS_LM78_FAN1_DIV fan_div:1 - fan2_div SENSORS_LM78_FAN2_DIV fan_div:2 - fan3_div SENSORS_LM78_FAN3_DIV fan_div:3 - alarms SENSORS_LM78_ALARMS alarms:1 - - -Chip `lm78-j' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in5 NONE NONE R 2 - in6 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in4 in4 RW 2 - in5_min in5 in5 RW 2 - in6_min in6 in6 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in4 in4 RW 2 - in5_max in5 in5 RW 2 - in6_max in6 in6 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - fan3_min fan3 fan3 RW 0 - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - fan3_div fan3 NONE R 0 - alarms NONE NONE R 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - in0 SENSORS_LM78J_IN0 in0:3 - in1 SENSORS_LM78J_IN1 in1:3 - in2 SENSORS_LM78J_IN2 in2:3 - in3 SENSORS_LM78J_IN3 in3:3 - in4 SENSORS_LM78J_IN4 in4:3 - in5 SENSORS_LM78J_IN5 in5:3 - in6 SENSORS_LM78J_IN6 in6:3 - in0_min SENSORS_LM78J_IN0_MIN in0:1 - in1_min SENSORS_LM78J_IN1_MIN in1:1 - in2_min SENSORS_LM78J_IN2_MIN in2:1 - in3_min SENSORS_LM78J_IN3_MIN in3:1 - in4_min SENSORS_LM78J_IN4_MIN in4:1 - in5_min SENSORS_LM78J_IN5_MIN in5:1 - in6_min SENSORS_LM78J_IN6_MIN in6:1 - in0_max SENSORS_LM78J_IN0_MAX in0:2 - in1_max SENSORS_LM78J_IN1_MAX in1:2 - in2_max SENSORS_LM78J_IN2_MAX in2:2 - in3_max SENSORS_LM78J_IN3_MAX in3:2 - in4_max SENSORS_LM78J_IN4_MAX in4:2 - in5_max SENSORS_LM78J_IN5_MAX in5:2 - in6_max SENSORS_LM78J_IN6_MAX in6:2 - fan1 SENSORS_LM78J_FAN1 fan1:2 - fan2 SENSORS_LM78J_FAN2 fan2:2 - fan3 SENSORS_LM78J_FAN3 fan3:2 - fan1_min SENSORS_LM78J_FAN1_MIN fan1:1 - fan2_min SENSORS_LM78J_FAN2_MIN fan2:1 - fan3_min SENSORS_LM78J_FAN3_MIN fan3:1 - temp SENSORS_LM78J_TEMP temp:3 - temp_hyst SENSORS_LM78J_TEMP_HYST temp:2 - temp_over SENSORS_LM78J_TEMP_OVER temp:1 - vid SENSORS_LM78J_VID vid:1 - fan1_div SENSORS_LM78J_FAN1_DIV fan_div:1 - fan2_div SENSORS_LM78J_FAN2_DIV fan_div:2 - fan3_div SENSORS_LM78J_FAN3_DIV fan_div:3 - alarms SENSORS_LM78J_ALARMS alarms:1 - - -Chip `lm79' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in5 NONE NONE R 2 - in6 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in4 in4 RW 2 - in5_min in5 in5 RW 2 - in6_min in6 in6 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in4 in4 RW 2 - in5_max in5 in5 RW 2 - in6_max in6 in6 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - fan3_min fan3 fan3 RW 0 - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - fan3_div fan3 NONE R 0 - alarms NONE NONE R 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - in0 SENSORS_LM79_IN0 in0:3 - in1 SENSORS_LM79_IN1 in1:3 - in2 SENSORS_LM79_IN2 in2:3 - in3 SENSORS_LM79_IN3 in3:3 - in4 SENSORS_LM79_IN4 in4:3 - in5 SENSORS_LM79_IN5 in5:3 - in6 SENSORS_LM79_IN6 in6:3 - in0_min SENSORS_LM79_IN0_MIN in0:1 - in1_min SENSORS_LM79_IN1_MIN in1:1 - in2_min SENSORS_LM79_IN2_MIN in2:1 - in3_min SENSORS_LM79_IN3_MIN in3:1 - in4_min SENSORS_LM79_IN4_MIN in4:1 - in5_min SENSORS_LM79_IN5_MIN in5:1 - in6_min SENSORS_LM79_IN6_MIN in6:1 - in0_max SENSORS_LM79_IN0_MAX in0:2 - in1_max SENSORS_LM79_IN1_MAX in1:2 - in2_max SENSORS_LM79_IN2_MAX in2:2 - in3_max SENSORS_LM79_IN3_MAX in3:2 - in4_max SENSORS_LM79_IN4_MAX in4:2 - in5_max SENSORS_LM79_IN5_MAX in5:2 - in6_max SENSORS_LM79_IN6_MAX in6:2 - fan1 SENSORS_LM79_FAN1 fan1:2 - fan2 SENSORS_LM79_FAN2 fan2:2 - fan3 SENSORS_LM79_FAN3 fan3:2 - fan1_min SENSORS_LM79_FAN1_MIN fan1:1 - fan2_min SENSORS_LM79_FAN2_MIN fan2:1 - fan3_min SENSORS_LM79_FAN3_MIN fan3:1 - temp SENSORS_LM79_TEMP temp:3 - temp_hyst SENSORS_LM79_TEMP_HYST temp:2 - temp_over SENSORS_LM79_TEMP_OVER temp:1 - vid SENSORS_LM79_VID vid:1 - fan1_div SENSORS_LM79_FAN1_DIV fan_div:1 - fan2_div SENSORS_LM79_FAN2_DIV fan_div:2 - fan3_div SENSORS_LM79_FAN3_DIV fan_div:3 - alarms SENSORS_LM79_ALARMS alarms:1 diff --git a/doc/chips/lm80 b/doc/chips/lm80 deleted file mode 100644 index 7930124d..00000000 --- a/doc/chips/lm80 +++ /dev/null @@ -1,149 +0,0 @@ -Kernel driver `lm80.o' -====================== - -Status: Complete and tested - -Supported chips: - * National Semiconductor LM80 - Prefix: 'lm80' - Addresses scanned: I2C 0x20 - 0x2f - -Author: Frodo Looijaard and Philip Edelbrock - - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_lm80: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm80' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This driver implements support for the National Semiconductor LM80. -It is descibed as a `Serial Interface ACPI-Compatible Microprocessor -System Hardware Monitor'. - -The LM80 implements one temperature sensor, two fan rotation speed sensors, -seven voltage sensors, alarms, and some miscellaneous stuff. - -Temperatures are measured in degrees Celsius. There are two sets of limits -which operate independently. When the HOT Temperature Limit is crossed, -this will cause an alarm that will be reasserted until the temperature -drops below the HOT Hysteresis. The Overtemperature Shotdown (OS) limits -should work in the same way (but this must be checked; the datasheet -is unclear about this). Measurements are guaranteed between -55 and -+125 degrees. The current temperature measurement has a resolution of -0.0625 degrees; the limits have a resolution of 1 degree. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -Voltage ensors (also known as IN sensors) report their values in volts. -An alarm is triggered if the voltage has crossed a programmable minimum -or maximum limit. Note that minimum in this case always means 'closest to -zero'; this is important for negative voltage measurements. All voltage -inputs can measure voltages between 0 and 2.55 volts, with a resolution -of 0.01 volt. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 2.0 seconds since the last update). This means that you can easily -miss once-only alarms. - -The LM80 only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. - - -Chip Features -------------- - -Chip `lm80' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in5 NONE NONE R 2 - in6 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in4 in4 RW 2 - in5_min in5 in5 RW 2 - in6_min in6 in6 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in4 in4 RW 2 - in5_max in5 in5 RW 2 - in6_max in6 in6 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan1_min fan1 NONE RW 0 - fan2_min fan2 NONE RW 0 - temp NONE NONE R 2 - temp_hot_hyst temp temp RW 2 - temp_hot_max temp temp RW 2 - temp_os_hyst temp temp RW 2 - temp_os_max temp temp RW 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - alarms NONE NONE R 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - in0 SENSORS_LM80_IN0 in0:3 - in1 SENSORS_LM80_IN1 in1:3 - in2 SENSORS_LM80_IN2 in2:3 - in3 SENSORS_LM80_IN3 in3:3 - in4 SENSORS_LM80_IN4 in4:3 - in5 SENSORS_LM80_IN5 in5:3 - in6 SENSORS_LM80_IN6 in6:3 - in0_min SENSORS_LM80_IN0_MIN in0:1 - in1_min SENSORS_LM80_IN1_MIN in1:1 - in2_min SENSORS_LM80_IN2_MIN in2:1 - in3_min SENSORS_LM80_IN3_MIN in3:1 - in4_min SENSORS_LM80_IN4_MIN in4:1 - in5_min SENSORS_LM80_IN5_MIN in5:1 - in6_min SENSORS_LM80_IN6_MIN in6:1 - in0_max SENSORS_LM80_IN0_MAX in0:2 - in1_max SENSORS_LM80_IN1_MAX in1:2 - in2_max SENSORS_LM80_IN2_MAX in2:2 - in3_max SENSORS_LM80_IN3_MAX in3:2 - in4_max SENSORS_LM80_IN4_MAX in4:2 - in5_max SENSORS_LM80_IN5_MAX in5:2 - in6_max SENSORS_LM80_IN6_MAX in6:2 - fan1 SENSORS_LM80_FAN1 fan1:2 - fan2 SENSORS_LM80_FAN2 fan2:2 - fan1_min SENSORS_LM80_FAN1_MIN fan1:1 - fan2_min SENSORS_LM80_FAN2_MIN fan2:1 - temp SENSORS_LM80_TEMP temp:5 - temp_hot_hyst SENSORS_LM80_TEMP_HOT_HYST temp:2 - temp_hot_max SENSORS_LM80_TEMP_HOT_MAX temp:1 - temp_os_hyst SENSORS_LM80_TEMP_OS_HYST temp:4 - temp_os_max SENSORS_LM80_TEMP_OS_MAX temp:3 - fan1_div SENSORS_LM80_FAN1_DIV fan_div:1 - fan2_div SENSORS_LM80_FAN2_DIV fan_div:2 - alarms SENSORS_LM80_ALARMS alarms:1 diff --git a/doc/chips/lm83 b/doc/chips/lm83 deleted file mode 100644 index d7f64690..00000000 --- a/doc/chips/lm83 +++ /dev/null @@ -1,156 +0,0 @@ -Kernel driver `lm83.o' -===================== - -Status: Complete and lightly tested - -Supported chips: - * National Semiconductor LM83 - Prefix: 'lm83' - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/pf/LM/LM83.html - * National Semiconductor LM82 - Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/pf/LM/LM82.html - - -Author: Jean Delvare - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_lm83: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm83' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -The LM83 is a digital temperature sensor. It senses its own temperature as -well as the temperature of up to three external diodes. The LM82 is -a stripped down version of the LM83 that only supports one external diode. -Both are compatible with many other devices such as the LM84 and all -other ADM1021 clones. The main difference between the LM83 and the LM84 -in that the later can only sense the temperature of one external diode. - -Using the adm1021 driver for a LM83 should work, but only two temperatures -will be reported instead of four. - -The LM83 is only found on a handful of motherboards. Both a confirmed -list and an unconfirmed list follow. If you can confirm or infirm the -fact that any of these motherboards do actually have an LM83, please -contact us. Note that the LM90 can easily be misdetected as a LM83. - -Confirmed motherboards: - SBS P014 - SBS PSL09 - -Unconfirmed motherboards: - Gigabyte GA-8IK1100 - Iwill MPX2 - Soltek SL-75DRV5 - -The LM82 is confirmed to have been found on most AMD Geode reference -designs and test platforms. - -The driver has been successfully tested by Magnus Forsström, who I'd -like to thank here. More testers will be of course welcome. - -The fact that the LM83 is only scarcely used can be easily explained. -Most motherboards come with more than just temperature sensors for -health monitoring. They also have voltage and fan rotation speed -sensors. This means that temperature-only chips are usually used as -secondary chips coupled with another chip such as an IT8705F or similar -chip, which provides more features. Since systems usually need three -temperature sensors (motherboard, processor, power supply) and primary -chips provide some temperature sensors, the secondary chip, if needed, -won't have to handle more than two temperatures. Thus, ADM1021 clones -are sufficent, and there is no need for a four temperatures sensor -chip such as the LM83. The only case where using an LM83 would make -sense is on SMP systems, such as the above-mentioned Iwill MPX2, -because you want an additional temperature sensor for each additional -CPU. - -On the SBS P014, this is different, since the LM83 is the only hardware -monitoring chipset. One temperature sensor is used for the motherboard -(actually measuring the LM83's own temperature), one is used for the -CPU. The two other sensors must be used to measure the temperature of -two other points of the motherboard. We suspect these points to be the -north and south bridges, but this couldn't be confirmed. - -All temperature values are given in degrees Celsius. Local temperature -is given within a range of 0 to +85 degrees. Remote temperatures are -given within a range of 0 to +125 degrees. Resolution is 1.0 degree, -accuracy is guaranteed to 3.0 degrees (see the datasheet for more -details). - -Each sensor has its own high limit, but the critical limit is common to -all four sensors. There is no hysteresis mechanism as found on most -recent temperature sensors. - -The lm83 driver will not update its values more frequently than every -other second; reading them more often will do no harm, but will return -'old' values. - - -Chip Features -------------- - -Chip 'lm83' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp1 - - R- 0 -temp1_high temp1 temp1 RW 0 -temp2 - - R- 0 -temp2_high temp2 temp2 RW 0 -temp3 - - R- 0 -temp3_high temp3 temp3 RW 0 -temp4 - - R- 0 -temp4_high temp4 temp4 RW 0 -tcrit - - RW 0 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp1 SENSORS_LM83_LOCAL_TEMP temp1:2 -temp1_high SENSORS_LM83_LOCAL_HIGH temp1:1 -temp2 SENSORS_LM83_REMOTE1_TEMP temp2:2 -temp2_high SENSORS_LM83_REMOTE1_HIGH temp2:1 -temp3 SENSORS_LM83_REMOTE2_TEMP temp3:2 -temp3_high SENSORS_LM83_REMOTE2_HIGH temp3:1 -temp4 SENSORS_LM83_REMOTE3_TEMP temp4:2 -temp4_high SENSORS_LM83_REMOTE3_HIGH temp4:1 -tcrit SENSORS_LM83_TCRIT tcrit:1 -alarms SENSORS_LM83_ALARMS alarms:1 - -Chip 'lm82' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp1 - - R- 0 -temp1_high temp1 temp1 RW 0 -temp3 - - R- 0 -temp3_high temp3 temp3 RW 0 -tcrit - - RW 0 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp1 SENSORS_LM83_LOCAL_TEMP temp1:2 -temp1_high SENSORS_LM83_LOCAL_HIGH temp1:1 -temp3 SENSORS_LM83_REMOTE2_TEMP temp3:2 -temp3_high SENSORS_LM83_REMOTE2_HIGH temp3:1 -tcrit SENSORS_LM83_TCRIT tcrit:1 -alarms SENSORS_LM83_ALARMS alarms:1 diff --git a/doc/chips/lm85 b/doc/chips/lm85 deleted file mode 100644 index a0df8296..00000000 --- a/doc/chips/lm85 +++ /dev/null @@ -1,527 +0,0 @@ -Kernel driver `lm85.o' -====================== - -Status: Complete and somewhat tested - -Supported chips: - * National Semiconductor LM85 (B and C versions) - Prefix: 'lm85' - Addresses scanned: I2C 0x2c, 0x2d, 0x2e - Datasheet: http://www.national.com/pf/LM/LM85.html - * Analog Devices ADM1027 - Prefix: 'adm1027' - Addresses scanned: I2C 0x2c, 0x2d, 0x2e - Datasheet: http://www.analog.com/en/prod/0,,766_825_ADM1027,00.html - * Analog Devices ADT7463 - Prefix: 'adt7463' - Addresses scanned: I2C 0x2c, 0x2d, 0x2e - Datasheet: http://www.analog.com/en/prod/0,,766_825_ADT7463,00.html - * SMSC EMC6D100, SMSC EMC6D101 - Prefix: 'emc6d100' - Addresses scanned: I2C 0x2c, 0x2d, 0x2e - Datasheet: http://www.smsc.com/main/tools/discontinued/6d100.pdf - * SMSC EMC6D102, SMSC EMC6D101 - Prefix: 'emc6d102' - Addresses scanned: I2C 0x2c, 0x2d, 0x2e - Datasheet: http://www.smsc.com/main/catalog/emc6d102.html - -Authors: - Philip Pokorny - Frodo Looijaard - Richard Barrington - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to assume to be present. Autodetection - of the target device will still be attempted. Use one of the more - specific force directives below if this doesn't detect the device. -* force_lm85b: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm85-B' chip -* force_lm85c: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm85-C' chip -* force_adm1027: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adm1027' chip -* force_adt7463: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adt7463' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This driver implements support for the National Semiconductor LM85 -and compatible chips including the Analog Devices ADM1027 and ADT7463, -and SMSC EMC6D100, EMC6D101 and EMC6D102. - -The LM85 uses the 2-wire interface compatible with the SMBUS 2.0 -specification. Using an analog to digital converter it measures three -(3) temperatures and five (5) voltages. It has four (4) 16-bit -counters for measuring fan speed. Five (5) digital inputs are -provided for sampling the VID signals from the processor to the VRM. -Lastly, there are three (3) PWM outputs that can be used to control -fan speed. - -The voltage inputs have internal scaling resistors so that the -following voltage can be measured without external resistors: - - 2.5V, 3.3V, 5V, 12V, and CPU core voltage (2.25V) - -The temperatures measured are one internal diode, and two remote -diodes. Remote 1 is generally the CPU temperature. These inputs are -designed to measure a thermal diode like the one in a Pentium 4 -processor in a socket 423 or socket 478 package. They can also -measure temperature using a transistor like the 2N3904. - -A sophisticated control system for the PWM outputs is designed into -the LM85 that allows fan speed to be adjusted automatically based on -any of the three temperature sensors. Each PWM output is individually -adjustable and programmable. Once configured, the LM85 will adjust -the PWM outputs in response to the measured temperatures without -further host intervention. This feature can also be disabled for -manual control of the PWM's. - -Each of the measured inputs (voltage, temperature, fan speed) has -corresponding high/low limit values. The LM85 will signal an ALARM if -any measured value exceeds either limit. - -The LM85 samples all inputs continuously. The lm85 driver will not -read the registers more often than once a second. Further, configuration -data is only read once each 5 minutes. There is twice as much config -data as measurements, so this would seem to be a worthwhile -optimization. - -Special Features - -The LM85 has four fan speed monitoring modes. The ADM1027 has only -two. Both have special circuitry to compensate for PWM interactions -with the TACH signal from the fans. The ADM1027 can be configured to -measure the speed of a two wire fan, but the input conditioning -circuitry is different for 3-wire and 2-wire mode. For this reason, -the 2-wire fan modes are not exposed to user control. The BIOS should -initialize them to the correct mode. If you've designed your own -ADM1027, you'll have to modify the init_client function and add an -insmod parameter to set this up. - -To smooth the response of fans to changes in temperature, the LM85 has -an optional filter for smoothing temperatures. The ADM1027 has the -same config option but uses it to rate limit the changes to fan speed -instead. In libsensors, we associate the smoothing feature with a -zone in the LM85 and with a PWM in the ADM1027. - -The ADM1027 and ADT7463 have a 10-bit ADC and can therefore measure -temperatures with 0.25 degC resolution. They also provide an offset to -the temperature readings that is automatically applied during -measurement. This offset can be used to zero out any errors due to -traces and placement. The documentation says that the offset is in -0.25 degC steps, but in initial testing of the ADM1027 it was 1.00 -degC steps. Analog Devices has confirmed this "bug". The ADT7463 is -reported to work as described in the documentation. Accordingly, the -driver currently reports 1.00 degC steps for the ADM1027 and 0.25 degC -steps for the ADT7463. If you have an ADT7463, please confirm to the -LM85 maintainer that the temperature offset works as implemented. - -The ADT7463 has a THERM asserted counter. This counter has a 22.76ms -resolution and a range of 5.8 seconds. The driver implements a 31-bit -accumulator of the counter value to extend the range to over a year. -The counter will stay at it's max value until read. If you want to -insure no counts get lost, you need to trigger the driver to read the -counter every 5 seconds. You can do this by reading just the -therm_signal value. The driver implements reads of 'therm_signal' -without reading the other values for speed. A background shell script -like: - - #!/bin/bash - while [ 1 ] ; do - cat /proc/sys/dev/sensors/adt7463-*/therm_signal > /dev/null - sleep 5 - done - -Or if you want to record the values: - - #!/bin/bash - last=0 - while [ 1 ] ; do - read tlim total ovfl < /proc/sys/dev/sensors/adt7463-*/therm_signal - if [ $total -gt $last ]; then - echo $(date) - $tlim $total $ovfl - last=$total - fi - sleep 5; - done - -Either script should insure no counts are lost. - -See the vendor datasheets for more information. There is application -note from National (AN-1260) with some additional information about -the LM85. The Analog Devices datasheet is very detailed and describes -a procedure for determining an optimal configuration for the automatic -PWM control. - -Hardware Configurations ------------------------ - -The LM85 can be jumpered for 3 different SMBus addresses. There are -no other hardware configuration options for the LM85. - -The lm85 driver detects both LM85B and LM85C revisions of the chip. -See the datasheet for a complete description of the differences. -Other than identifying the chip, the driver behaves no differently -with regard to these two chips. The LM85B is recommended for new -designs. - -The ADM1027 and ADT7463 chips have an optional SMBALERT output that -can be used to signal the chipset in case a limit is exceeded or the -temperature sensors fail. Individual sensor interrupts can be masked -with 'alarm_mask' so they won't trigger SMBALERT. The SMBALERT output -if configured replaces one of the other functions (PWM2 or IN0). The -driver will print a message if the BIOS has configured this option -when the chip is detected. - -The ADT7463 also has an optional THERM output/input which can be -connected to the processor PROC_HOT output. If available, the autofan -control dynamic Tmin feature can be enabled to keep the system -temperature within spec (just?!) with the least possible fan noise. - -Configuration Notes -------------------- - -The voltage, temperature and fan inputs are available in libsensors -and the sensors executable. In addition, the automatic control of the -PWM outputs can also be configured via sensors.conf. This -configuration is described below: - -* Temperatures and Zones - -Each temperature sensor is associated with a Zone. There are three -sensors and therefore three zones. Each zone has the following -temperature configuration points: - - Limit temp -- Temperature at which the fan will turn on - [ absolute deg C from 0.0 to 127.0 ] - [ sensors.conf: zone#_limit ] - Hysteresis -- Degrees below the limit that fan will remain - on before turning off. - [ relative C from 0.0 to -15.0 ] - [ sensors.conf: zone#_hyst ] - Range -- Degrees above the limit over which the fan - PWM will be adjusted (from PWM_MIN to 100%) - [ relative deg C from 2.0 to 80.0 ] - [ sensors.conf: zone#_range ] - Critical temp -- Temperature above which other fans will be - forced to 100% PWM - [ absolute deg C from 0.0 to 127.0 ] - [ sensors.conf: zone#_critical ] - -** Temperature Range for a Zone - -The RANGE value for a given zone can have one of 16 different values -in an approximately logrithmic spacing: -Selecting a RANGE not in this list will cause the next larger range to -be used. - - Temperature ranges: 2.0, 2.5, 3.3, 4.0, 5.0, 6.6, 8.0, 10.0, - (in deg C) 13.3, 16.0, 20.0, 26.6, 32.0, 40.0, 53.3, - 80.0 - -* Temperature Smoothing or Acoustic Enhancement - -The LM85 and ADM1027 use this value in different ways. In the LM85 -it's used to filter the temperature input of a zone. In this way, it -affects all PWM's controlled by that zone temperature. In the -ADM1027, it limits the rate of change in fan speed. Thus it is part -of the PWM control algorithm. - - Smooth filter -- Optional filter constant to smooth the system - response to temperature spikes. It either - filters the measured temperatures or limits the - rate of change of fan speed. This improves - the system by limiting rapid changes in fan - speed. - [ seconds from 0.8 to 35.0 or 0.0 for OFF ] - [ sensors.conf: zone#_smooth or pwm#_smooth ] - -The smoothing can be disabled, or enabled and set to one of the values -listed below. Selecting a filter time constant not on this list will -cause the next smaller value to be used. Setting the time constant to -0 will disable the filtering. - - Filter time constant: 35.0, 17.6, 11.8, 7.0, 4.4, 3.0, 1.6, 0.8 - (in seconds) - -* PWM Control - -There are three PWM outputs. The LM85 datasheet suggests that the -pwm3 output control both fan3 and fan4. Each PWM can be individually -configured and assigned to a zone for it's control value. Each PWM can be -configured individually according to the following options. - - Spinup time -- When turning on a fan that was off, the PWM will - temporarily be set to 100% for this length of - time to insure the fan starts spinning. - [ seconds from 0.0 to 4.0 ] - [ sensors.conf: pwm#_spinup ] - Minimum PWM -- This is the PWM value at the limit temp of the - referenced zone. - [ PWM value from 0.0 to 255.0 ] - [ sensors.conf: pwm#_min ] - Frequency -- This is the base frequency of the PWM output. - [ Hz from 10.0 to 98.0 ] - [ sensors.conf: pwm#_freq ] - Min/Off flag -- This flag determines if the PWM will be off or - "min PWM" below the limit temperature. - [ 0.0 means PWM off (0%) below limit ] - [ sensors.conf: pwm#_min_ctl ] - Invert flag -- This flag causes the PWM output to be inverted. - If inverted, a PWM setting of 0 will be full on - and 100 will be off. - [ 0.0 means PWM is "normal" ] - [ sensors.conf: pwm#_invert ] - -** Spinup Time - -Spinup time can be one of eight (8) values. Selecting a spinup time -not on this list will result in the next larger spinup time being -selected. Note, the value 0.2 actually results in a setting of 0.250 -seconds. - - Spinup Time 0.0, 0.1, 0.2, 0.4, 0.7, 1.0, 2.0, 4.0 - (in seconds) - -** PWM Frequency - -The base frequency of the PWM can be controlled. The frequency can be -set to one of the following 8 values. Setting the frequency to a -value not on this list, will result in the next higher frequency being -selected. The actual device frequency may vary slightly from this -specification as designed by the manufacturer. Consult the datasheet -for more details. - - PWM Frequency 10.0, 15.0, 23.0, 30.0, 38.0, 47.0, 62.0, 98.0 - (in Hz) - -** Min/Off Flag - -Below the temperature "Limit - Hysteresis" from the controlling zone, -the PWM can turn off (set to 0) or it can stay at the minimum PWM -value. Setting this flag to 1 will cause the PWM value to be the -"Minimum PWM" value below this limit. Setting it to 0 will set the -PWM to 0 (off) below that limit. - -NOTE: It has been reported that there is a bug in the LM85 that causes -the Min/Off flag to be associated with the zones not the PWMs. This -contradicts all the published documentation. Setting pwm#_min_ctl in -this case actually affects all PWMs controlled by zone '#'. - -** Invert Flag - -The PWM output can be inverted. This may be useful if the fan power -circuitry is inverted. (A low output turns on power and a high output -turns off power to the fan). Alternatively, if a slower fan speed is -needed for higher temperatures, this could be set. - -Setting this flag to 1 will invert the PWM output. A value of 0 -does not invert the PWM output. - -* PWM Controlling Zone selection - -PWM's can be controlled by zones according to the following -configuration choices: - - Value Meaning - ------ ------------------------------------------------ - 1 Controlled by Zone 1 - 2 Controlled by Zone 2 - 3 Controlled by Zone 3 - 23 Controlled by higher temp of Zone 2 or 3 - 123 Controlled by highest temp of Zone 1, 2 or 3 - 0 PWM alwasy 0% (off) - -1 PWM always 100% (full on) - -2 Manual control (write to 'pwm#' to set) - -These are specified in sensors.conf using 'pwm#_zone' - -* /proc Interface - -These values can also be set using the /proc interface. The following -files contain the above settings in the order listed below: - - Name Values - ---------- ---------------------------------------------------- - zone# Limit, Hysteresis, Range, Critical - pwm#_cfg Spinup, PWM at low limit, Frequency, Min/Off, Invert - pwm#_zone Control Zone choice - smooth# Filtering - -The National LM85's have two vendor specific configuration -features. Tach. mode and Spinup Control. For more details on these, -see the LM85 datasheet or Application Note AN-1260. - - Name Values - ------------ -------------------------------------------------- - tach_mode For best fan speed measurement when PWM's are in use, - the Tach Mode should be set to 2 for all three (Fan's - 3 and 4 share a config setting) config values. If - PWM's are not in use or not wired to control fan - speed, mode 0 or 1 may be better. - [ sensors.conf: fan#_tach_mode ] - spinup_ctl Setting spinup_ctl to 1 will modify the fan spinup - algorithm. Instead of setting the PWM to 100% for - the configured period of time, it will be set to 100% - until the measured RPM is greater than the RPM limit - register or the time period elapses. - [ sensors.conf: pwm#_spinup_ctl ] - -The Analog Devices ADM1027 has several vendor specific enhancements. -The number of pulses-per-rev of the fans can be set, Tach monitoring -can be optimized for PWM operation, and an offset can be applied to -the temperatures to compensate for systemic errors in the -measurements. - - Name Values - ------------ -------------------------------------------------- - tach_mode For best fan speed measurement when PWM's are in use, - the Tach Mode should be set to 0. If PWM's are not - in use or not wired to control fan speed, a mode of 1 - can be selected. This will also increase the rate - of fan speed measurement from 1 per second to 4 per - second. - [ sensors.conf: fan#_tach_mode ] - fan_ppr You can set the pulses per rev to 1, 2, 3 or 4 so - that fan speeds don't have to be scaled. - [ sensors.conf: fan#_ppr ] - temp#_offset This is the value to be added or subtracted from the - measured temperature before reporting it. This also - affects the PWM control algorithms. - [ sensors.conf: temp#_offset ] - -In addition to the ADM1027 features, the ADT7463 also has Tmin control -and THERM asserted counts. Automatic Tmin control acts to adjust the -Tmin value to maintain the measured temperature sensor at a specified -temperature. There isn't much documentation on this feature in the -ADT7463 data sheet. The following values control this feature. -(These are not available via sensors.conf) - - Enable Flag -- When set to 1, the Tmin control is enabled. When - set to 0, Tmin will remain unchanged. - [ 1 means Tmin control is enabled ] - [ sensors.conf: none ] - Control Loop -- This value sets the cycle time of the control - loop which adjusts the Tmin value. The mapping - from raw value to loop period is non-linear. - [ Raw value from 0 to 7 (4sec) ] - [ sensors.conf: none ] - Set on THERM -- If enabled, this causes the operating point to be - set from the current temperature when THERM is - asserted. If THERM is connected to a PROC_HOT - signal, this can automatically set the operating - point to the highest value that is within spec. - allowing the lowest/quietest fan speed possible. - [ 1 means set op-point on THERM asserted ] - [ sensors.conf: none ] - Target Temp -- This is the target temperature. Tmin will be - adjusted to keep the measured temperature at this - value. - [ degC -127 to 127 degC ] - [ sensors.conf: none ] - -The THERM signal monitoring has three parameters: - - THERM Limit -- How long THERM can be asserted before an ALARM is - triggered. - [ 22.7 ms counts ] - [ sensors.conf: none ] - THERM Total -- How long THERM has been asserted since the driver - was loaded. - [ 22.7 ms counts ] - [ sensors.conf: none ] - Overflows -- How many times the THERM counter was read with a - max value indicating it overflowed. - [ count ] - [ sensors.conf: none ] - -These values are available via /proc under the following names in the -listed order. - - Name Values - ------------ -------------------------------------------------- - tmin_ctl# Enable, Control Period, Set on THREM, Target - therm_signal Limit, Total, Overflows - - -* Sample sensors.conf Config File - -Here is a sample LM85 chip config for sensors.conf - ---------- cut here --------- -chip "lm85c-*" "adm1027-*" "adt7463-*" "lm85-*" "lm85b-*" - -# Voltage inputs - label in0 "V1.5" # AGP on Intel S845WD1-E - label in1 "VCore" - label in2 "V3.3" - label in3 "V5" - label in4 "V12" - -# Temperature inputs - label temp1 "CPU" - label temp2 "Board" - label temp3 "Remote" - -# Fan inputs - label fan1 "CPU_Fan" - label fan2 "Fan2" - label fan3 "Fan3" - label fan4 "Fan4" - -# PWM Outputs - label pwm1 "CPU_PWM" - label pwm2 "Fan2_PWM" - label pwm3 "Fan3_PWM" - -# Voltage scaling is done on-chip. No 'compute' directive -# should be necessary. If in0 has external scaling set -# it here. - -# compute in0 @ * 2.5, @ / 2.5 - -# Adjust fans speeds for actual pulses per rev - compute fan1 @ * 2, @ / 2 # 1 pulse per rev -# set fan1_ppr 1 # ADM1027 or ADT7463 - compute fan2 @ / 2, @ * 2 # 4 pulse per rev -# set fan2_ppr 4 # ADM1027 or ADT7463 - -# Set VRM version - set vrm 9.1 # Pentium 4 - -# Set voltage limits - set in0_min 1.5 * 0.95 - set in0_max 1.5 * 1.05 - set in1_min vid * 0.95 - set in1_max vid * 1.05 - set in2_min 3.3 * 0.95 - set in2_max 3.3 * 1.05 - set in3_min 5.0 * 0.95 - set in3_max 5.0 * 1.05 - set in4_min 12 * 0.95 - set in4_max 12 * 1.05 - -# Set Fan limits - set fan1_min 3000 - set fan2_min 3000 - set fan3_min 3000 - set fan4_min 3000 - diff --git a/doc/chips/lm87 b/doc/chips/lm87 deleted file mode 100644 index 25ebc057..00000000 --- a/doc/chips/lm87 +++ /dev/null @@ -1,150 +0,0 @@ -Kernel driver `lm87.o' -====================== - -Status: Complete and somewhat tested - -Supported chips: - * National Semiconductor LM87 - Prefix: 'lm87' - Addresses scanned: I2C 0x2c - 0x2f - Datasheet: http://www.national.com/pf/LM/LM87.html - -Authors: Frodo Looijaard , - Philip Edelbrock , - Mark Studebaker , - and Stephen Rousset - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_lm87: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm87' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This driver implements support for the National Semiconductor LM87. - -The LM87 implements up to three temperature sensors, up to two fan -rotation speed sensors, up to seven voltage sensors, alarms, and some -miscellaneous stuff. - -Temperatures are measured in degrees Celsius. Each input has a high -and low alarm settings. A high limit produces an alarm when the value -goes above it, and an alarm is also produced when the value goes below -the low limit. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -Voltage sensors (also known as IN sensors) report their values in -volts. An alarm is triggered if the voltage has crossed a programmable -minimum or maximum limit. Note that minimum in this case always means -'closest to zero'; this is important for negative voltage -measurements. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.0 second since the last update). This means that you can easily -miss once-only alarms. - -The lm87 driver only updates its values each 1.0 seconds; reading it more -often will do no harm, but will return 'old' values. - - -Hardware Configurations ------------------------ - -The LM87 has four pins which can serve one of two possible functions, -depending on the hardware configuration. These pins are: - -Vccp2/D2- (pin 17) -+2.5V(IN0)/D2+ (pin 18) -FAN1/AIN1 (pin 5) -FAN2/AIN2 (pin 6) - -The most common configuration is to use the values shown here on the -left (Vccp2, 2.5V, FAN1, and FAN2). However, for a third temperature -sensor, it is possible to do away with Vccp2 and 2.5V (IN0) for the -second external temp diode inputs. Strangely, it seems that you can -monitor the core voltage of the second processor or its temperature, -but never both at the same time. Also, either/both FAN1 and FAN2 -inputs can be substituted for aux analog inputs AIN1 and/or AIN2, -respectively. - -To adjust the driver for a hardware configuration other than the -default, simply uncomment the appropriate #defines in the -kernel/chips/lm87.c driver header, and then recompile/reinstall. -Here is a copy (as of this writing) of the header: - - ---snip-- -/* Chip configuration settings. These should be set to reflect the -HARDWARE configuration of your chip. By default (read: when all of -these are left commented out), this driver assumes that the -configuration is the same as National's defaults for the Channel Mode -register. - - Set to '1' the appropriate defines, as nessesary: - - - External temp sensors 2 (possible second CPU temp) - This will disable the 2.5V and Vccp2 readings. - Strangely, National decided that you can read the - temperature of a second CPU or its core voltage, - but not both! Comment out if FAULT is reported. */ - -/* #define LM87_EXT2 1 */ - -/* Aux analog input. When enabled, the Fan 1 reading - will be disabled */ - -/* #define LM87_AIN1 1 */ - -/* Aux analog input 2. When enabled, the Fan 2 reading - will be disabled */ - -/* #define LM87_AIN2 1 */ - -/* Internal Vcc is 5V instead of 3.3V */ - -/* #define LM87_5V_VCC 1 */ - -/* That's the end of the hardware config defines. I would have made - them insmod params, but it would be too much work. ;') */ ---snip-- - -Please note: Only adjust the #defines to reflect your HARDWARE -configuration. Otherwise some, if not all, the readings will be -wrong. Simply enabling different driver configurations does not -provide the desired readings. You must make hardware changes (which -is hard) if you really wish to get a different set of readings!! - -If you may suspect that your configuration may be different than the -default, try enabling the different #defines. If you get a 'FAULT' -when using D2, it is most likely that you don't have a second external -diode, so recomment-out the #define. If you get strange readings for -some/all of the other values when enabling a AIN, then recomment-out -that #define. - -Unfortunately, it's tough to 'detect' all hardware config's -automaticly. And, I needed to resort to using #defines instead of -insmod params to make life easier on myself. diff --git a/doc/chips/lm90 b/doc/chips/lm90 deleted file mode 100644 index 75a174aa..00000000 --- a/doc/chips/lm90 +++ /dev/null @@ -1,223 +0,0 @@ -Kernel driver `lm90.o' -====================== - -Status: Complete and well tested - -Supported chips: - * National Semiconductor LM90 - Prefix: 'lm90' - Addresses scanned: I2C 0x4c - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/pf/LM/LM90.html - * National Semiconductor LM89 - Prefix: 'lm99' - Addresses scanned: I2C 0x4c and 0x4d - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/pf/LM/LM89.html - * National Semiconductor LM99 - Prefix: 'lm99' - Addresses scanned: I2C 0x4c and 0x4d - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/pf/LM/LM99.html - * National Semiconductor LM86 - Prefix: 'lm86' - Addresses scanned: I2C 0x4c - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/pf/LM/LM86.html - * Analog Devices ADM1032 - Prefix: 'adm1032' - Addresses scanned: I2C 0x4c and 0x4d - Datasheet: Publicly available at the Analog Devices website - http://products.analog.com/products/info.asp?product=ADM1032 - * Analog Devices ADT7461 - Prefix: 'adt7461' - Addresses scanned: I2C 0x4c and 0x4d - Datasheet: Publicly available at the Analog Devices website - http://products.analog.com/products/info.asp?product=ADT7461 - Note: Only if in ADM1032 compatibility mode - * Maxim MAX6657 - Prefix: 'max6657' - Addresses scanned: I2C 0x4c - Datasheet: Publicly available at the Maxim website - http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 - * Maxim MAX6658 - Prefix: 'max6657' - Addresses scanned: I2C 0x4c - Datasheet: Publicly available at the Maxim website - http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 - * Maxim MAX6659 - Prefix: 'max6657' - Addresses scanned: I2C 0x4c and 0x4d - Datasheet: Publicly available at the Maxim website - http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 - - -Author: Jean Delvare - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_lm90: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm90' chip -* force_adm1032: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adm1032' chip -* force_lm99: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm99' chip -* force_lm86: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm86' chip -* force_max6657: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `max6657' chip -* force_adt7461: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `adt7461' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -The LM90 is a digital temperature sensor. It senses its own temperature as -well as the temperature of up to one external diode. It is compatible -with many other devices such as the LM86, the LM89, the LM99, the ADM1032, -the MAX6657, the MAX6658, and the MAX6659, all of which are supported by -this driver. Additionally, the ADT7461 is supported if found in ADM1032 -compatibility mode. - -The specificity of this family of chipsets over the ADM1021/LM84 -family is that it features critical limits with hysteresis, and an -increased resolution of the remote temperature measurement. - -The different chipsets of the family are not strictly identical, although -very similar. This driver doesn't handle any specific feature for now, -with the exception of SMBus PEC. For reference, here comes a non-exhaustive -list of specific features: - -LM90: - * Filter and alert configuration register at 0xBF. - * ALERT is triggered by temperatures over critical limits. - -LM86 and LM89: - * Same as LM90 - * Better external channel accuracy - -LM99: - * Same as LM89 - * External temperature shifted by 16 degrees down - -ADM1032: - * Consecutive alert register at 0x22. - * Conversion averaging. - * Up to 64 conversions/s. - * ALERT is triggered by open remote sensor. - * SMBus PEC support for Write Byte and Receive Byte transactions. - -ADT7461 - * Extended temperature range (breaks compatibility) - * Lower resolution for remote temperature - -MAX6657 and MAX6658: - * Remote sensor type selecion - -MAX6659 - * Selectable address - * Second critical temperature limit - -All temperature values are given in degrees Celsius. Resolution -is 1.0 degree for the local temperature, 0.125 degree for the remote -temperature. - -Each sensor has its own high and low limits, plus a critical limit. -Additionally, there is a relative hysteresis value common to both critical -values. To make life easier to user-space applications, two absolute values -are exported, one for each channel, but these values are of course linked. -Only the local hysteresis can be set from user-space, and the same delta -applies to the remote hysteresis. - -The lm90 driver will not update its values more frequently than every -other second; reading them more often will do no harm, but will return -'old' values. - - -PEC Support ------------ - -The ADM1032 is the only chip of the family which supports PEC. It does -not support PEC on all transactions though, so some care must be taken. - -When reading a register value, the PEC byte is computed and sent by the -ADM1032 chip. However, in the case of a combined transaction (SMBus Read -Byte), the ADM1032 computes the CRC value over only the second half of -the message rather than its entirety, because it thinks the first half -of the message belongs to a different transaction. As a result, the CRC -value differs from what the SMBus master expects, and all reads fail. - -For this reason, the lm90 driver will enable PEC for the ADM1032 only if -the bus supports the SMBus Send Byte and Receive Byte transaction types. -These transactions will be used to read register values, instead of -SMBus Read Byte, and PEC will work properly. - -Additionally, the ADM1032 doesn't support SMBus Send Byte with PEC. -Instead, it will try to write the PEC value to the register (because the -SMBus Send Byte transaction with PEC is similar to a Write Byte transaction -without PEC), which is not what we want. Thus, PEC is explicitly disabled -on SMBus Send Byte transactions in the lm90 driver. - -PEC on byte data transactions represents a significant increase in bandwidth -usage (+33% for writes, +25% for reads) in normal conditions. With the need -to use two SMBus transaction for reads, this overhead jumps to +50%. Worse, -two transactions will typically mean twice as much delay waiting for -transaction completion, effectively doubling the register cache refresh time. -I guess reliability comes at a price, but it's quite expensive this time. - -So, as not everyone might enjoy the slowdown, PEC can be disabled through -procfs. Just write 0 to the "pec" file and PEC will be disabled. Write 1 -to that file to enable PEC again. - - -Chip Features -------------- - -Chips 'lm90', adm1032', 'lm99', 'lm86', 'max6657' and 'adt7461' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp1 - - R- 0 -temp1_high temp1 temp1 RW 0 -temp1_low temp1 temp1 RW 0 -temp2 - - R- 1 -temp2_high temp2 temp2 RW 1 -temp2_low temp2 temp2 RW 1 -tcrit1 temp1 temp1 RW 0 -tcrit2 temp2 temp2 RW 0 -hyst1 temp1 temp1 RW 0 -hyst2 temp2 temp2 R- 0 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp1 SENSORS_LM90_LOCAL_TEMP temp1:3 -temp1_high SENSORS_LM90_LOCAL_HIGH temp1:1 -temp1_low SENSORS_LM90_LOCAL_LOW temp1:2 -temp2 SENSORS_LM90_REMOTE_TEMP temp2:3 -temp2_high SENSORS_LM90_REMOTE_HIGH temp2:1 -temp2_low SENSORS_LM90_REMOTE_LOW temp2:2 -tcrit1 SENSORS_LM90_LOCAL_TCRIT tcrit1:1 -tcrit2 SENSORS_LM90_REMOTE_TCRIT tcrit2:1 -hyst1 SENSORS_LM90_LOCAL_TCRIT_HYST hyst1:1 -hyst2 SENSORS_LM90_REMOTE_TCRIT_HYST hyst2:1 -alarms SENSORS_LM90_ALARMS alarms:1 diff --git a/doc/chips/lm92 b/doc/chips/lm92 deleted file mode 100644 index d59803c8..00000000 --- a/doc/chips/lm92 +++ /dev/null @@ -1,89 +0,0 @@ -Kernel driver `lm92.o' -====================== - -Status: Complete and somewhat tested - -Supported chips: - * National Semiconductor LM92 - Prefix: 'lm92' - Addresses scanned: I2C 0x48 - 0x4b - * National Semiconductor LM76 - Prefix: 'lm92' - Addresses scanned: none, force parameter needed - * Maxim MAX6633/MAX6634/MAX6635 - Prefix: 'lm92' - Addresses scanned: I2C 0x48 - 0x4f - MAX6633 with address in 0x40 - 0x47 needs force parameter - -Author: Abraham van der Merwe - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_lm92: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `lm92' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -This driver implements support for the National Semiconductor LM92 -temperature sensor. - -Each LM92 temperature sensor supports a single temperature sensor. -Temperatures are exported to proc in degrees Celsius * 10000 (in other -words temperatures are accurate to 4 decimal places). There are alarms -for high, low, and critical thresholds. There's also an hysteresis to -control the thresholds for resetting alarms. - -At the moment the driver controls these sensors in comparator mode and the -interrupt pins (INT, T_CRIT_A) are ignored. - -Support was added later for the LM76 and Maxim MAX6633/MAX6634/MAX6635, -which are mostly compatible. They have not all been tested, so you -may need to use the force parameter. - - -Hardware Configurations ------------------------ - -The only thing that can be changed is enabling of the fault queue. Doing so -ensures that alarms will only be triggered if 4 consecutive readings all -cross the alarm thresholds. You can enable this behaviour by uncommenting -the #define in the driver source, and then recompile/reinstall. - - -Chip Features -------------- - -Chip 'lm92' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 4 -temp_high temp temp RW 4 -temp_low temp temp RW 4 -temp_crit temp temp RW 4 -temp_hyst temp temp RW 4 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_LM92_TEMP temp:1 -temp_high SENSORS_LM92_TEMP_HIGH temp:2 -temp_low SENSORS_LM92_TEMP_LOW temp:3 -temp_crit SENSORS_LM92_TEMP_CRIT temp:4 -temp_hyst SENSORS_LM92_TEMP_HYST temp:5 -alarms SENSORS_LM92_ALARMS alarms:1 diff --git a/doc/chips/lm93 b/doc/chips/lm93 deleted file mode 100644 index ae3e5c68..00000000 --- a/doc/chips/lm93 +++ /dev/null @@ -1,386 +0,0 @@ -Kernel driver 'lm93.o' -====================== - -Status: In progress - -Supported chips: - * National Semiconductor LM93 - Prefix: 'lm93' - Addresses scanned: I2C 0x2c-0x2e - -Author: - Mark M. Hoffman - - -Module Parameters ------------------ - -(specific to LM93) -* init: integer - Set to zero to disable some initializations (default is 1) -* disable_block: integer - A "0" allows SMBus block data transactions if the host supports them. A "1" - disables SMBus block data transactions. The default is 0. -* vccp_limit_type: integer array (2) - Configures in7 and in8 limit type, where 0 means absolute and non-zero - means relative. "Relative" here refers to "Dynamic Vccp Monitoring using - VID" from the datasheet. It greatly simplifies the interface to allow - only one set of limits (absolute or relative) to be in operation at a - time (even though the hardware is capable of enabling both). There's - not a compelling use case for enabling both at once, anyway. The default - is "0,0". -* vid_agtl: integer - A "0" configures the VID pins for V(ih) = 2.1V min, V(il) = 0.8V max. - A "1" configures the VID pins for V(ih) = 0.8V min, V(il) = 0.4V max. - (The latter setting is referred to as AGTL+ Compatible in the datasheet.) - I.e. this parameter controls the VID pin input thresholds; if your VID - inputs are not working, trying changing this. The default value is "0". - -(common among sensor drivers) -* force: short array (min = 1, max = 48) - List of adapter,address pairs to assume to be present. Autodetection - of the target device will still be attempted. Use one of the more - specific force directives below if this doesn't detect the device. -* force_lm93: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a 'lm93' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Hardware Description --------------------- - -(from the datasheet) - -The LM93, hardware monitor, has a two wire digital interface compatible with -SMBus 2.0. Using an 8-bit ADC, the LM93 measures the temperature of two remote -diode connected transistors as well as its own die and 16 power supply -voltages. To set fan speed, the LM93 has two PWM outputs that are each -controlled by up to four temperature zones. The fancontrol algorithm is lookup -table based. The LM93 includes a digital filter that can be invoked to smooth -temperature readings for better control of fan speed. The LM93 has four -tachometer inputs to measure fan speed. Limit and status registers for all -measured values are included. The LM93 builds upon the functionality of -previous motherboard management ASICs and uses some of the LM85's features -(i.e. smart tachometer mode). It also adds measurement and control support -for dynamic Vccp monitoring and PROCHOT. It is designed to monitor a dual -processor Xeon class motherboard with a minimum of external components. - - -User Interface --------------- - -#PROCHOT: - -The LM93 can monitor two #PROCHOT signals. The results are found in the -/proc files prochot1 and prochot2. There are three values per file: the first -value is the user limit. The second value is the current reading for the -most recent complete time interval. The third value is something like a -2 period exponential moving average (but not quite - check the datasheet). -Note that this third value is calculated by the chip itself. All values -range from 0-255 where 0 indicates no throttling, and 255 indicates > 99.6%. - -The monitoring intervals for the two #PROCHOT signals is also configurable. -These intervals can be found in the /proc file prochot_interval. There are -two values in this file: one each for #P1_PROCHOT and #P2_PROCHOT, res- -pectively. Selecting a value not in this list will cause the driver to -use the next largest interval. The available intervals are (in seconds): - -#PROCHOT intervals: 0.73, 1.46, 2.9, 5.8, 11.7, 23.3, 46.6, 93.2, 186, 372 - -It is possible to configure the LM93 to logically short the two #PROCHOT -signals. I.e. when #P1_PROCHOT is asserted, the LM93 will automatically -assert #P2_PROCHOT, and vice-versa. This mode is enabled by writing a -non-zero integer to the /proc file prochot_short. - -The LM93 can also override the #PROCHOT pins by driving a PWM signal onto -one or both of them. When overridden, the signal has a period of 3.56 ms, -a minimum pulse width of 5 clocks (at 22.5kHz => 6.25% duty cycle), and -a maximum pulse width of 80 clocks (at 22.5kHz => 99.88% duty cycle). - -The /proc file prochot_override has three values. The first two are boolean -integers which enable/disable the override funtion for #P1_PROCHOT and -#P2_PROCHOT, the third value is 0-15 where 0 indicates minimum duty cycle -and 15 indicates maximum. - -#VRD_HOT: - -The LM93 can monitor two #VRD_HOT signals. The results are found in the -/proc files vrdhot1 and vrdhot2. There is one value per file: a boolean for -which 1 indicates #VRD_HOT is asserted and 0 indicates it is negated. These -files are read-only. - -Smart Tach Mode: - -(from the datasheet) - - If a fan is driven using a low-side drive PWM, the tachometer - output of the fan is corrupted. The LM93 includes smart tachometer - circuitry that allows an accurate tachometer reading to be - achieved despite the signal corruption. In smart tach mode all - four signals are measured within 4 seconds. - -Smart tach mode is enabled by the driver by writing 1 or 2 (associating the -the fan tachometer with a pwm) to the /proc file fan_smart_tach. A zero -will disable the function for that fan. Note that Smart tach mode cannot be -enabled if the PWM output frequency is 22500 Hz (see below). - -Manual PWM: - -The LM93 has a fixed or override mode for the two PWM outputs (although, there -are still some conditions that will override even this mode - see section -15.10.6 of the datasheet for details.) The /proc files pwm1 and pwm2 are -used to enable and control this mode. The first value of the file is an -integer (0-255) where 0 is 0% duty cycle, and 255 is 100%. The second value -is a boolean integer where 0 disables and 1 enables the manual control mode. -Note that the duty cycle values are constrained by the hardware. Selecting -a value which is not available will cause the driver to use the next largest -value. Also note: when manual PWM mode is disabled, the first value of the -/proc files indicates the current duty cycle chosen by the h/w. - -PWM Output Frequency: - -The LM93 supports several different frequencies for the PWM output channels. -The /proc files pwm1_freq and pwm2_freq are used to select the frequency. The -frequency values are constrained by the hardware. Selecting a value which is -not available will cause the driver to use the next largest value. Also note -that this parameter has implications for the Smart Tach Mode (see above). - -PWM Output Frequencies: 12, 36, 48, 60, 72, 84, 96, 22500 Hz (h/w default) - -Automatic PWM: - -The LM93 is capable of complex automatic fan control, with many different -points of configuration. To start, each PWM output can be bound to any -combination of eight control sources. The final PWM is the largest of all -individual control sources to which the PWM output is bound. - -The eight control sources are: temp1-temp4 (aka "zones" in the datasheet), -#PROCHOT 1 & 2, and #VRDHOT 1 & 2. The bindings are expressed as a bitmask -in the /proc files pwm_auto_channels, where a "1" enables the binding, and -a "0" disables it. The h/w default is 0x0f (all temperatures bound). - - 0x01 - Temp 1 - 0x02 - Temp 2 - 0x04 - Temp 3 - 0x08 - Temp 4 - 0x10 - #PROCHOT 1 - 0x20 - #PROCHOT 2 - 0x40 - #VRDHOT 1 - 0x80 - #VRDHOT 2 - -The function y = f(x) takes a source temperature x to a PWM output y. This -function of the LM93 is derived from a base temperature and a table of 12 -temperature offsets. The base temperature is expressed in degrees C in the -/proc files temp_auto_base. The offsets are expressed in cumulative -degrees C, with all 12 values in the files temp_auto_offsets. E.g. if the -base temperature is 40C: - - offset # temp_auto_offsets range pwm - 1 0 - 25.00% - 2 0 - 28.57% - 3 1 40C - 41C 32.14% - 4 1 41C - 42C 35.71% - 5 2 42C - 44C 39.29% - 6 2 44C - 46C 42.86% - 7 2 48C - 50C 46.43% - 8 2 50C - 52C 50.00% - 9 2 52C - 54C 53.57% - 10 2 54C - 56C 57.14% - 11 2 56C - 58C 71.43% - 12 2 58C - 60C 85.71% - > 60C 100.00% - -Valid offsets are in the range 0C <= x <= 7.5C in 0.5C increments. - -There is an independent base temperature for each temperature channel. Note, -however, there are only two tables of offsets: one each for temp[12] and -temp[34]. Therefore, any change to e.g. temp1_auto_offsets will also affect -temp2_auto_offsets. - -The LM93 can also apply hysteresis to the offset table, to prevent unwanted -oscillation between two steps in the offsets table. These values are found in -the /proc files temp_auto_offset_hyst. There is just one value; it has the -same representation as in temp_auto_offsets. - -If a temperature reading falls below the base value for that channel, the LM93 -will use the minimum PWM value. These values are found in the /proc files -temp_auto_pwm_min. Note, there are only two minimums: one each for temp[12] -and temp[34]. Therefore, any change to e.g. temp1_auto_pwm_min will also -affect temp2_auto_pwm_min. - -PWM Spin-Up Cycle: - -A spin-up cycle occurs when a PWM output is commanded from 0% duty cycle to -some value > 0%. The LM93 supports a minimum duty cycle during spin-up. These -values are found in the /proc files pwm_auto_spinup_min. There is one value -per file; it has the same representation as other PWM duty cycle values. The -duration of the spin-up cycle is also configurable. These values are found in -the /proc files pwm_auto_spinup_time. There is one value per file; it is -the spin-up time in seconds. The available spin-up times are constrained by -the hardware. Selecting a value which is not available will cause the driver -to use the next largest value. - -Spin-up Durations: 0 (disabled, h/w default), 0.1, 0.25, 0.4, 0.7, 1.0, 2.0, 4.0 - -#PROCHOT and #VRDHOT PWM Ramping: - -If the #PROCHOT or #VRDHOT signals are asserted while bound to a PWM output -channel, the LM93 will ramp the PWM output up to 100% duty cycle in discrete -steps. The duration of each step is configurable. There are two files, with -one value each in seconds: pwm_auto_prochot_ramp and pwm_auto_vrdhot_ramp. -The available ramp times are constrained by the hardware. Selecting a value -which is not available will cause the driver to use the next largest value. - -Ramp Times: 0 (disabled, h/w default) to 0.75 in 0.05 second intervals - -Fan Boost: - -For each temperature channel, there is a boost temperature: if the channel -exceeds this limit, the LM93 will immediately drive both PWM outputs to 100%. -This limit is expressed in degrees C in the /proc files temp_auto_boost. -There is also a hysteresis temperature for this function: after the boost -limit is reached, the temperature channel must drop below this value before -the boost function is disabled. This temperature is also expressed in degrees -C in the /proc files temp_auto_boost_hyst. - -GPIO Pins: - -The LM93 can monitor the logic level of four dedicated GPIO pins as well as the -four tach input pins. GPIO0-GPIO3 correspond to (fan) tach 1-4, respectively. -All eight GPIOs are read by reading the bitmask in the /proc file gpio. The -LSB is GPIO0, and the MSB is GPIO7. - - -LM93 Unique /proc Files ------------------------ - - file description - ------------------------------------------------------------- - - prochot limit, current, and moving average #PROCHOT % - - prochot_short enable or disable logical #PROCHOT pin short - - prochot_override force #PROCHOT assertion as PWM - - prochot_interval #PROCHOT PWM sampling interval - - vrdhot 0 means negated, 1 means asserted - - fan_smart_tach enable or disable smart tach mode - - pwm_auto_spinup_min minimum duty cycle during spin-up - - pwm_auto_spinup_time duration of spin-up - - pwm_auto_prochot_ramp ramp time per step when #PROCHOT asserted - - pwm_auto_vrdhot_ramp ramp time per step when #VRDHOT asserted - - temp_auto_base temperature channel base - - temp_auto_offsets temperature channel offsets - - temp_auto_offset_hyst - temperature channel offset hysteresis - - temp_auto_boost temperature channel boost (PWMs to 100%) limit - - temp_auto_boost_hyst temperature channel boost hysteresis - - gpio input state of 8 GPIO pins; read-only - - -Sample Configuration File -------------------------- - -Here is a sample LM93 chip config for sensors.conf: - ----------- cut here ---------- -chip "lm93-*" - -# VOLTAGE INPUTS - - # labels and scaling based on datasheet recommendations - label in1 "+12V1" - compute in1 @ * 12.945, @ / 12.945 - set in1_min 12 * 0.90 - set in1_max 12 * 1.10 - - label in2 "+12V2" - compute in2 @ * 12.945, @ / 12.945 - set in2_min 12 * 0.90 - set in2_max 12 * 1.10 - - label in3 "+12V3" - compute in3 @ * 12.945, @ / 12.945 - set in3_min 12 * 0.90 - set in3_max 12 * 1.10 - - label in4 "FSB_Vtt" - - label in5 "3GIO" - - label in6 "ICH_Core" - - label in7 "Vccp1" - - label in8 "Vccp2" - - label in9 "+3.3V" - set in9_min 3.3 * 0.90 - set in9_max 3.3 * 1.10 - - label in10 "+5V" - set in10_min 5.0 * 0.90 - set in10_max 5.0 * 1.10 - - label in11 "SCSI_Core" - - label in12 "Mem_Core" - - label in13 "Mem_Vtt" - - label in14 "Gbit_Core" - - # Assuming R1/R2 = 4.1143, and 3.3V reference - # -12V = (4.1143 + 1) * (@ - 3.3) + 3.3 - label in15 "-12V" - compute in15 @ * 5.1143 - 13.57719, (@ + 13.57719) / 5.1143 - set in15_min -12 * 0.90 - set in15_max -12 * 1.10 - - label in16 "+3.3VSB" - set in16_min 3.3 * 0.90 - set in16_max 3.3 * 1.10 - -# TEMPERATURE INPUTS - - label temp1 "CPU1" - label temp2 "CPU2" - label temp3 "LM93" - -# TACHOMETER INPUTS - - label fan1 "Fan1" - set fan1_min 3000 - label fan2 "Fan2" - set fan2_min 3000 - label fan3 "Fan3" - set fan3_min 3000 - label fan4 "Fan4" - set fan4_min 3000 - -# PWM OUTPUTS - - label pwm1 "CPU1" - label pwm2 "CPU2" - diff --git a/doc/chips/ltc1710 b/doc/chips/ltc1710 deleted file mode 100644 index 7d1b5897..00000000 --- a/doc/chips/ltc1710 +++ /dev/null @@ -1,67 +0,0 @@ -Kernel driver `ltc1710.o' -========================= - -Status: Complete and well-tested - -Supported chips: - * Linear Technologies LTC1710 - Prefix: 'ltc1710' - Addresses scanned: I2C 0x58 - 0x5a - Datasheet: Publicly available at the Linear Technologies website - -Author: Frodo Looijaard and Philip Edelbrock - - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_ltc1710: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `ltc1710' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -This is some documenation for the ltc1710 driver for the Linear -Technologies LTC1710. - -The LTC1710 is a simple dual switch device with a SMBus interface. It can -switch a supply voltage to either of its two output pins independantly -from the built-in SMBus interface. - -For each sensed LTC1710 there is a directory which looks something like: -ltc1710-i2c-1-59 - -For each directory there are the following files: - -* switch1 (LTC1710_SYSCTL_SWITCH_1) - Simply contains either a 1 or 0 depending on whether the switch is - currently turned on or off. -* switch2 (LTC1710_SYSCTL_SWITCH_2) - Works the same way as switch1, but is for the second switch. - -Some notes: The LTC1710 is a *very* simple I2C/SMBus device. It does not -support reads, so the status of the switches isn't polled, but rather -remembered. The LTC1710 has enough 'umph' to drive 300mA with only 0.4 Ohm -impedence (in an 'on' state). This works well for LEDs, or to drive other -devices (MOSFETs and such) which can multiply the switching effect. The -LTC1710 also contains an emergency over-temperature shut-off in the case -of too much current flow. Switch 2 switches the Vcc voltage on/off, but -Switch 1 switches the voltage present on pin 1 (0V to Vcc). - -This driver was written and maintained by Philip Edelbrock -. Please send comments/suggestions/corrections to him. -For more technical information on the LTC1710, please get the Acrobat PDF -from http://www.linear-tech.com/ diff --git a/doc/chips/matorb b/doc/chips/matorb deleted file mode 100644 index 8de73fcd..00000000 --- a/doc/chips/matorb +++ /dev/null @@ -1,97 +0,0 @@ -Kernel driver `matorb.o' -======================= - -Status: 'Beta', but it's so simple that it may be in its final state - -Supported devices: - * Matrix-Orbital (www.matrix-orbital.com) displays. Developed and - tested on the LCD2041V, but should work with all their displays. - Prefix: 'matorb' - Addresses scanned: I2C 0x2E - Datasheet: Publicly available at the Matrix-Orbital web site - (www.matrix-orbital.com) - -Author: Frodo Looijaard , and Philip Edelbrock - - -Main Contact: Philip Edelbrock - -Module Parameters ------------------ -(I'm not positive about these, so don't take this as granite) -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_matorb: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `bt869' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ -This driver provides access to the Matrix-Orbital display devices. These -devices are usually in the form of a small LCD (20x4 is typical) screen -which is mounted in a carrier which is then mounted into a 5.25" drive bay -of a computer. - -This driver allows the user to send any data to the display to control or -display anything which the display supports. - -For more information on the displays or of particular features/command sets -go to: - -http://www.matrix-orbital.com - - -Use ---- -To use, just redirect the base-10 ordinal value of bytes (or chars) to the -display. For example, to clear the screen and write a simple message, you -could do this: - -# To clear the screen, send byte 0xFE and the char 'X' (ordinal 88) -echo "254 88" > /proc/sys/dev/sensors/matorb*/disp - -# To display "hi there" -echo "hi there" \ - | perl -e '$_=; while (/(.)/gc) { print ord($1)," "; }' \ - > /proc/sys/dev/sensors/matorb*/disp - -I've written a simple sample program (in Perl) to display a full screen -of text (which is fed in on standard-input) to the display. It is in the -prog/matorb folder of this project. - -I think the displays are very attractive and add a neat sort of 'status' -display to things like servers. It would be very simple to either -make a script daemon (or modify the healthd provided in this project) -to display a current status of health info (voltages, fans, temps, etc.) -on the display. Let's see Windoze do *THAT*! :') - - -Issues ------- -Redirecting too long of a string (32 ordinals seem to be the max) to 'disp' -seems to cause problems. Keep things in small chunks (like lines). - -Built in functions (screen clearing, etc.) were initially planned to be -added as other device files (other than just 'disp'), but these functions -are just as easily done by sending the command sequences to disp (as shown -above when clearing the screen). This also ensures that the driver will -be compatible with all the displays. - -Detection is very poor (as of this writing, anyway). It looks for a device -at 0x2E and asumes it is a display. Unfortunately, the 'beta' firmware -the Matrix-Orbital people gave me doesn't have good detection abilities to -it (it ignores reads... it used to lock up the bus on reads, so at least -it doesn't do that any more! :'). If they provide an easy way to 'sense' -that it is a display (and what kind it is?) then I will add support for it. - -Let me know if you have problems which you can't figure out -(phil@netroedge.com). diff --git a/doc/chips/max1619 b/doc/chips/max1619 deleted file mode 100644 index 83bf5756..00000000 --- a/doc/chips/max1619 +++ /dev/null @@ -1,73 +0,0 @@ -Kernel driver `max1619.o' -========================= - -Status: New - -Supported chips: - * Maxim MAX1619 - Prefix: 'max1619' - Addresses scanned: I2C 0x18-0x1a, 0x29-0x2b, 0x4c-0x4e - Datasheet: Publicly available at the Maxim website - http://pdfserv.maxim-ic.com/en/ds/MAX1619.pdf - -Author: Alexey Fisher - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_max1619: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `max1619' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -The MAX1619 is a digital temperature sensor. It senses its own temperature as -well as the temperature of up to one external diode. - -All temperature values are given in degrees Celsius. Resolution -is 1.0 degree for the local temperature and for the remote temperature. - -Only the external sensor has high and low limits. - -The max1619 driver will not update its values more frequently than every -other second; reading them more often will do no harm, but will return -'old' values. - - -Chip Features -------------- - -Chips 'max1619' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp1 - - R- 0 -temp2 - - R- 0 -temp2_max temp2 temp2 RW 0 -temp2_min temp2 temp2 RW 0 -temp2_crit temp2 temp2 RW 0 -temp2_hyst temp2 temp2 RW 0 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp1 SENSORS_MAX1619_LOCAL_TEMP temp1:1 -temp2 SENSORS_MAX1619_REMOTE_TEMP temp2:3 -temp2_max SENSORS_MAX1619_REMOTE_HIGH temp2:1 -temp2_min SENSORS_MAX1619_REMOTE_LOW temp2:2 -temp2_crit SENSORS_MAX1619_REMOTE_HYST temp2_crit:1 -temp2_hyst SENSORS_MAX1619_REMOTE_MAX temp2_crit:2 -alarms SENSORS_MAX1619_ALARMS alarms:1 diff --git a/doc/chips/max6650 b/doc/chips/max6650 deleted file mode 100644 index bbd63d6c..00000000 --- a/doc/chips/max6650 +++ /dev/null @@ -1,125 +0,0 @@ -Sensors chip driver for MAXIM MAX6650 / MAX6651 fan controllers -=============================================================== - -Chip notes ----------- - -The MAX6651 is a fan controller. It has two distinct functions: - -1) Speed control, with feedback, for a single fan. The code can write - to a register requesting that the fan run at a certain speed, and the - chip will adjust the fan voltage until it reaches that speed. This - is called "closed loop" mode in the datasheet. - -2) Speed measurement (tachometers) for up to four fans, including the - controlled one. - -The MAX6650 is similar but only has one measurement tachometer. - -Both chips have a few general purpose i/o pins, some of which can be -configured to have special functions. At the time of writing an overview -of the chip, with links to the datasheet, can be seen at: - - http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2296/ln/en - -If that has moved searching for MAX6650 from Maxim's home page should -work. - -Driver state ------------- - -Currently the driver provides the following entries in /proc/sys/ -dev/sensors/max6650-xxx/: - -fan1 through fan4 (read only): the current measured fan speeds, in -rpm. - -speed (read/write): when written, sets the chip to closed loop mode and -sets the configured speed, in rpm, to the value written. When read returns -the configured speed, again in rpm. - -xdump (read only): returns all of the chip register values, except the -tachometers. Used for debug, and should probably go away or be conditionally -compiled. - -The MAX665x uses byte wide registers with various scaling factors and -some more or less complex equations (in the datasheet) relating register -values to real world values. The driver takes care of all of this. - -Note that the measured speed ("fan1") never exactly matches the set speed -("speed") because of the coarse resolution of the underlying registers. - -Assumptions ------------ - -The driver assumes that: - - o The MAX665x is running from its internal 254 kHz clock, not an - external clock. - - o The monitored fans produce two pulses per rotation (This same - assumption is made by Maxim throughout the datasheet.) - - o The tachometer count time (register 0x16) has been configured suitably - for the fans in use, perhaps by some boot code. The driver reads this - register to compute rpm, but never writes to it. - - o The speed controller prescale (low three bits of register 0x04) has - been configured suitably for the fans in use, perhaps by some boot - code. The driver reads these bits to compute rpm, but never changes - them. - -The driver currently never reads or writes any other configuration -(gpio config, alarms, 5V/12V setting). - -Bugs ----- - - o The driver assumes too much: it should be possible to set more of the - configuration dynamically instead of assuming that some other code has - done it. - - o It does not differentiate between a MAX6650 and a MAX6651, as I can - see no obvious way to do this. It has only been tested with a MAX6651 - so if anyone gets a board with a MAX6650 to test with maybe something - will be revealed, such as the three missing tachometer registers - returning all ones or something. (OK, so maybe I should have called - this driver max6651, and ignored the max6650 totally...) - - o The /proc names don't match the standards in doc/developers/proc, - as this chip doesn't map well to other fan controllers, - -Detection notes ---------------- - -The module will autodetect the presence of a max6650 or max6651 at any -of the four possible I2C addresses for these devices. There is no ID -register, but there are several registers with all zero bits at the -high end. The driver checks that all of these are in fact zero before -declaring the chip to be a MAX6650/1. - -sensors-detect --------------- - -Support for MAX6650/1 has been added to sensors-detect. It has been -tested as correctly detecting a MAX6651 at I2C address 0x1B. Like the -driver, it cannot yet distinguish a MAX6650 and MAX6651. - -prog/sensors ------------- - -Initial read-only support has been added to the "sensors" program. - -Testing -------- - -The driver and associated programs have been tested under Linux 2.4.18 -running on an embedded Intel XScale processor (actually an IXP425 running -in big-endian mode) with a MAX6651 chip. - -Author ------- - -John Morris (john.morris@spirentcom.com) - - diff --git a/doc/chips/maxilife b/doc/chips/maxilife deleted file mode 100644 index 800ee8c0..00000000 --- a/doc/chips/maxilife +++ /dev/null @@ -1,433 +0,0 @@ -Kernel driver `maxilife.o' -========================== - -Status: Mostly done and tested - -Supported chips: - * Hewlett Packard Maxilife Revision AS 00.01 for Single Pentium II Slot 1 - Prefix: 'maxilife-as' - Addresses scanned: I2C 0x10 - 0x14 - Datasheet: Only available under NDA - * Hewlett Packard Maxilife Revision CO 00.03 for Dual Xeon Slot 2 - Prefix: 'maxilife-co' - Addresses scanned: I2C 0x10 - 0x14 - Datasheet: Only available under NDA - * Hewlett Packard Maxilife Revision CG 00.04 for Dual Pentium II Slot 1 - Prefix: 'maxilife-cg' - Addresses scanned: I2C 0x10 - 0x14 - Datasheet: Only available under NDA - * Hewlett Packard NBA (New BIOS Architecture) for newer machines, - for example Kayak XU800 and XM600. - Prefix: 'maxilife-nba' - Addresses scanned: I2C 0x10 - 0x14 - Datasheet: Only available under NDA - -Author: Fons Rademakers - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_maxilife: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `maxilife' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* maxi_version: int - MaxiLife firmware version - - -Description ------------ - -The is the driver for the HP MaxiLife Health monitoring system -as used in the line of HP Kayak Workstation PC's. - -The driver supports the following MaxiLife firmware versions: - -0) HP KAYAK XU/XAs (Dual Pentium II Slot 1, Deschutes/Klamath) -1) HP KAYAK XU (Dual Xeon [Slot 2] 400/450 Mhz) -2) HP KAYAK XA (Pentium II Slot 1, monoprocessor) - -Currently firmware auto detection is not implemented. To use the -driver load it with the correct option for you Kayak. For example: - -insmod maxilife.o maxi_version=0 | 1 | 2 - -maxi_version=0 is the default - - -The lm75's are indeed accessable in the regular way via the lm75 module. -They worked out of the box. However, I don't use the "raw" lm75 info. -MaxiLife takes care of reading out the lm75's and converts the values to -temperatures. Compared to some of the other monitoring controllers MaxiLife -is quite advanced. It takes care of a lot of issues, like setting ranges, -raising alarms, etc. Machines with MaxiLife also have a little LCD display -on their front (lcd is at address 0x54). The idea is that later versions -of the driver will write health info on the lcd (a bit like lcdproc). - - -Note ----- -sensors-detect does not support recognition of the maxilife chips. - - -Chip Features -------------- - -Chip 'maxilife-as' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -fan1 - - R- 0 -fan2 - - R- 0 -fan3 - - R- 0 -fan1_min fan1 fan1 RW 0 -fan2_min fan2 fan2 RW 0 -fan3_min fan3 fan3 RW 0 -fan1_div fan1 - R- 0 -fan2_div fan2 - R- 0 -fan3_div fan3 - R- 0 -temp1 - - R- 1 -temp2 - - R- 1 -temp3 - - R- 1 -temp4 - - R- 1 -temp5 - - R- 1 -temp1_max temp1 temp1 R- 1 -temp2_max temp2 temp2 R- 1 -temp3_max temp3 temp3 R- 1 -temp4_max temp4 temp4 R- 1 -temp5_max temp5 temp5 R- 1 -temp1_hyst temp1 temp1 R- 1 -temp2_hyst temp2 temp2 R- 1 -temp3_hyst temp3 temp3 R- 1 -temp4_hyst temp4 temp4 R- 1 -temp5_hyst temp5 temp5 R- 1 -pll - - R- 2 -pll_min pll pll RW 2 -pll_max pll pll RW 2 -vid1 - - R- 4 -vid2 - - R- 4 -vid3 - - R- 4 -vid4 - - R- 4 -vid1_min vid1 vid1 RW 4 -vid2_min vid2 vid2 RW 4 -vid3_min vid3 vid3 RW 4 -vid4_min vid4 vid4 RW 4 -vid1_max vid1 vid1 RW 4 -vid2_max vid2 vid2 RW 4 -vid3_max vid3 vid3 RW 4 -vid4_max vid4 vid4 RW 4 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -fan1 SENSORS_MAXI_AS_FAN1 fan1:3 -fan2 SENSORS_MAXI_AS_FAN2 fan2:3 -fan3 SENSORS_MAXI_AS_FAN3 fan3:3 -fan1_min SENSORS_MAXI_AS_FAN1_MIN fan1:1 -fan2_min SENSORS_MAXI_AS_FAN2_MIN fan2:1 -fan3_min SENSORS_MAXI_AS_FAN3_MIN fan3:1 -fan1_div SENSORS_MAXI_AS_FAN1_DIV fan1:2 -fan2_div SENSORS_MAXI_AS_FAN2_DIV fan2:2 -fan3_div SENSORS_MAXI_AS_FAN3_DIV fan3:2 -temp1 SENSORS_MAXI_AS_TEMP1 temp1:3 -temp2 SENSORS_MAXI_AS_TEMP2 temp2:3 -temp3 SENSORS_MAXI_AS_TEMP3 temp3:3 -temp4 SENSORS_MAXI_AS_TEMP4 temp4:3 -temp5 SENSORS_MAXI_AS_TEMP5 temp5:3 -temp1_max SENSORS_MAXI_AS_TEMP1_MAX temp1:1 -temp2_max SENSORS_MAXI_AS_TEMP2_MAX temp2:1 -temp3_max SENSORS_MAXI_AS_TEMP3_MAX temp3:1 -temp4_max SENSORS_MAXI_AS_TEMP4_MAX temp4:1 -temp5_max SENSORS_MAXI_AS_TEMP5_MAX temp5:1 -temp1_hyst SENSORS_MAXI_AS_TEMP1_HYST temp1:2 -temp2_hyst SENSORS_MAXI_AS_TEMP2_HYST temp2:2 -temp3_hyst SENSORS_MAXI_AS_TEMP3_HYST temp3:2 -temp4_hyst SENSORS_MAXI_AS_TEMP4_HYST temp4:2 -temp5_hyst SENSORS_MAXI_AS_TEMP5_HYST temp5:2 -pll SENSORS_MAXI_AS_PLL pll:3 -pll_min SENSORS_MAXI_AS_PLL_MIN pll:1 -pll_max SENSORS_MAXI_AS_PLL_MAX pll:2 -vid1 SENSORS_MAXI_AS_VID1 vid1:3 -vid2 SENSORS_MAXI_AS_VID2 vid2:3 -vid3 SENSORS_MAXI_AS_VID3 vid3:3 -vid4 SENSORS_MAXI_AS_VID4 vid4:3 -vid1_min SENSORS_MAXI_AS_VID1_MIN vid1:1 -vid2_min SENSORS_MAXI_AS_VID2_MIN vid2:1 -vid3_min SENSORS_MAXI_AS_VID3_MIN vid3:1 -vid4_min SENSORS_MAXI_AS_VID4_MIN vid4:1 -vid1_max SENSORS_MAXI_AS_VID1_MAX vid1:2 -vid2_max SENSORS_MAXI_AS_VID2_MAX vid2:2 -vid3_max SENSORS_MAXI_AS_VID3_MAX vid3:2 -vid4_max SENSORS_MAXI_AS_VID4_MAX vid4:2 -alarms SENSORS_MAXI_AS_ALARMS alarms:1 - - -Chip 'maxilife-cg' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -fan1 - - R- 0 -fan2 - - R- 0 -fan3 - - R- 0 -fan1_min fan1 fan1 RW 0 -fan2_min fan2 fan2 RW 0 -fan3_min fan3 fan3 RW 0 -fan1_div fan1 - R- 0 -fan2_div fan2 - R- 0 -fan3_div fan3 - R- 0 -temp1 - - R- 1 -temp2 - - R- 1 -temp3 - - R- 1 -temp4 - - R- 1 -temp5 - - R- 1 -temp1_max temp1 temp1 R- 1 -temp2_max temp2 temp2 R- 1 -temp3_max temp3 temp3 R- 1 -temp4_max temp4 temp4 R- 1 -temp5_max temp5 temp5 R- 1 -temp1_hyst temp1 temp1 R- 1 -temp2_hyst temp2 temp2 R- 1 -temp3_hyst temp3 temp3 R- 1 -temp4_hyst temp4 temp4 R- 1 -temp5_hyst temp5 temp5 R- 1 -pll - - R- 2 -pll_min pll pll RW 2 -pll_max pll pll RW 2 -vid1 - - R- 4 -vid2 - - R- 4 -vid3 - - R- 4 -vid4 - - R- 4 -vid1_min vid1 vid1 RW 4 -vid2_min vid2 vid2 RW 4 -vid3_min vid3 vid3 RW 4 -vid4_min vid4 vid4 RW 4 -vid1_max vid1 vid1 RW 4 -vid2_max vid2 vid2 RW 4 -vid3_max vid3 vid3 RW 4 -vid4_max vid4 vid4 RW 4 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -fan1 SENSORS_MAXI_CG_FAN1 fan1:3 -fan2 SENSORS_MAXI_CG_FAN2 fan2:3 -fan3 SENSORS_MAXI_CG_FAN3 fan3:3 -fan1_min SENSORS_MAXI_CG_FAN1_MIN fan1:1 -fan2_min SENSORS_MAXI_CG_FAN2_MIN fan2:1 -fan3_min SENSORS_MAXI_CG_FAN3_MIN fan3:1 -fan1_div SENSORS_MAXI_CG_FAN1_DIV fan1:2 -fan2_div SENSORS_MAXI_CG_FAN2_DIV fan2:2 -fan3_div SENSORS_MAXI_CG_FAN3_DIV fan3:2 -temp1 SENSORS_MAXI_CG_TEMP1 temp1:3 -temp2 SENSORS_MAXI_CG_TEMP2 temp2:3 -temp3 SENSORS_MAXI_CG_TEMP3 temp3:3 -temp4 SENSORS_MAXI_CG_TEMP4 temp4:3 -temp5 SENSORS_MAXI_CG_TEMP5 temp5:3 -temp1_max SENSORS_MAXI_CG_TEMP1_MAX temp1:1 -temp2_max SENSORS_MAXI_CG_TEMP2_MAX temp2:1 -temp3_max SENSORS_MAXI_CG_TEMP3_MAX temp3:1 -temp4_max SENSORS_MAXI_CG_TEMP4_MAX temp4:1 -temp5_max SENSORS_MAXI_CG_TEMP5_MAX temp5:1 -temp1_hyst SENSORS_MAXI_CG_TEMP1_HYST temp1:2 -temp2_hyst SENSORS_MAXI_CG_TEMP2_HYST temp2:2 -temp3_hyst SENSORS_MAXI_CG_TEMP3_HYST temp3:2 -temp4_hyst SENSORS_MAXI_CG_TEMP4_HYST temp4:2 -temp5_hyst SENSORS_MAXI_CG_TEMP5_HYST temp5:2 -pll SENSORS_MAXI_CG_PLL pll:3 -pll_min SENSORS_MAXI_CG_PLL_MIN pll:1 -pll_max SENSORS_MAXI_CG_PLL_MAX pll:2 -vid1 SENSORS_MAXI_CG_VID1 vid1:3 -vid2 SENSORS_MAXI_CG_VID2 vid2:3 -vid3 SENSORS_MAXI_CG_VID3 vid3:3 -vid4 SENSORS_MAXI_CG_VID4 vid4:3 -vid1_min SENSORS_MAXI_CG_VID1_MIN vid1:1 -vid2_min SENSORS_MAXI_CG_VID2_MIN vid2:1 -vid3_min SENSORS_MAXI_CG_VID3_MIN vid3:1 -vid4_min SENSORS_MAXI_CG_VID4_MIN vid4:1 -vid1_max SENSORS_MAXI_CG_VID1_MAX vid1:2 -vid2_max SENSORS_MAXI_CG_VID2_MAX vid2:2 -vid3_max SENSORS_MAXI_CG_VID3_MAX vid3:2 -vid4_max SENSORS_MAXI_CG_VID4_MAX vid4:2 -alarms SENSORS_MAXI_CG_ALARMS alarms:1 - - -Chip 'maxilife-co' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -fan1 - - R- 0 -fan2 - - R- 0 -fan3 - - R- 0 -fan1_min fan1 fan1 RW 0 -fan2_min fan2 fan2 RW 0 -fan3_min fan3 fan3 RW 0 -fan1_div fan1 - R- 0 -fan2_div fan2 - R- 0 -fan3_div fan3 - R- 0 -temp1 - - R- 1 -temp2 - - R- 1 -temp3 - - R- 1 -temp4 - - R- 1 -temp5 - - R- 1 -temp1_max temp1 temp1 R- 1 -temp2_max temp2 temp2 R- 1 -temp3_max temp3 temp3 R- 1 -temp4_max temp4 temp4 R- 1 -temp5_max temp5 temp5 R- 1 -temp1_hyst temp1 temp1 R- 1 -temp2_hyst temp2 temp2 R- 1 -temp3_hyst temp3 temp3 R- 1 -temp4_hyst temp4 temp4 R- 1 -temp5_hyst temp5 temp5 R- 1 -pll - - R- 2 -pll_min pll pll RW 2 -pll_max pll pll RW 2 -vid1 - - R- 4 -vid2 - - R- 4 -vid3 - - R- 4 -vid4 - - R- 4 -vid1_min vid1 vid1 RW 4 -vid2_min vid2 vid2 RW 4 -vid3_min vid3 vid3 RW 4 -vid4_min vid4 vid4 RW 4 -vid1_max vid1 vid1 RW 4 -vid2_max vid2 vid2 RW 4 -vid3_max vid3 vid3 RW 4 -vid4_max vid4 vid4 RW 4 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -fan1 SENSORS_MAXI_CO_FAN1 fan1:3 -fan2 SENSORS_MAXI_CO_FAN2 fan2:3 -fan3 SENSORS_MAXI_CO_FAN3 fan3:3 -fan1_min SENSORS_MAXI_CO_FAN1_MIN fan1:1 -fan2_min SENSORS_MAXI_CO_FAN2_MIN fan2:1 -fan3_min SENSORS_MAXI_CO_FAN3_MIN fan3:1 -fan1_div SENSORS_MAXI_CO_FAN1_DIV fan1:2 -fan2_div SENSORS_MAXI_CO_FAN2_DIV fan2:2 -fan3_div SENSORS_MAXI_CO_FAN3_DIV fan3:2 -temp1 SENSORS_MAXI_CO_TEMP1 temp1:3 -temp2 SENSORS_MAXI_CO_TEMP2 temp2:3 -temp3 SENSORS_MAXI_CO_TEMP3 temp3:3 -temp4 SENSORS_MAXI_CO_TEMP4 temp4:3 -temp5 SENSORS_MAXI_CO_TEMP5 temp5:3 -temp1_max SENSORS_MAXI_CO_TEMP1_MAX temp1:1 -temp2_max SENSORS_MAXI_CO_TEMP2_MAX temp2:1 -temp3_max SENSORS_MAXI_CO_TEMP3_MAX temp3:1 -temp4_max SENSORS_MAXI_CO_TEMP4_MAX temp4:1 -temp5_max SENSORS_MAXI_CO_TEMP5_MAX temp5:1 -temp1_hyst SENSORS_MAXI_CO_TEMP1_HYST temp1:2 -temp2_hyst SENSORS_MAXI_CO_TEMP2_HYST temp2:2 -temp3_hyst SENSORS_MAXI_CO_TEMP3_HYST temp3:2 -temp4_hyst SENSORS_MAXI_CO_TEMP4_HYST temp4:2 -temp5_hyst SENSORS_MAXI_CO_TEMP5_HYST temp5:2 -pll SENSORS_MAXI_CO_PLL pll:3 -pll_min SENSORS_MAXI_CO_PLL_MIN pll:1 -pll_max SENSORS_MAXI_CO_PLL_MAX pll:2 -vid1 SENSORS_MAXI_CO_VID1 vid1:3 -vid2 SENSORS_MAXI_CO_VID2 vid2:3 -vid3 SENSORS_MAXI_CO_VID3 vid3:3 -vid4 SENSORS_MAXI_CO_VID4 vid4:3 -vid1_min SENSORS_MAXI_CO_VID1_MIN vid1:1 -vid2_min SENSORS_MAXI_CO_VID2_MIN vid2:1 -vid3_min SENSORS_MAXI_CO_VID3_MIN vid3:1 -vid4_min SENSORS_MAXI_CO_VID4_MIN vid4:1 -vid1_max SENSORS_MAXI_CO_VID1_MAX vid1:2 -vid2_max SENSORS_MAXI_CO_VID2_MAX vid2:2 -vid3_max SENSORS_MAXI_CG_VID3_MAX vid3:2 -vid4_max SENSORS_MAXI_CO_VID4_MAX vid4:2 -alarms SENSORS_MAXI_CO_ALARMS alarms:1 - - -Chip 'maxilife-nba' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -fan1 - - R- 0 -fan2 - - R- 0 -fan3 - - R- 0 -fan1_min fan1 fan1 RW 0 -fan2_min fan2 fan2 RW 0 -fan3_min fan3 fan3 RW 0 -fan1_div fan1 - R- 0 -fan2_div fan2 - R- 0 -fan3_div fan3 - R- 0 -temp1 - - R- 1 -temp2 - - R- 1 -temp3 - - R- 1 -temp4 - - R- 1 -temp5 - - R- 1 -temp1_max temp1 temp1 R- 1 -temp2_max temp2 temp2 R- 1 -temp3_max temp3 temp3 R- 1 -temp4_max temp4 temp4 R- 1 -temp5_max temp5 temp5 R- 1 -temp1_hyst temp1 temp1 R- 1 -temp2_hyst temp2 temp2 R- 1 -temp3_hyst temp3 temp3 R- 1 -temp4_hyst temp4 temp4 R- 1 -temp5_hyst temp5 temp5 R- 1 -pll - - R- 2 -pll_min pll pll RW 2 -pll_max pll pll RW 2 -vid1 - - R- 4 -vid2 - - R- 4 -vid3 - - R- 4 -vid4 - - R- 4 -vid1_min vid1 vid1 RW 4 -vid2_min vid2 vid2 RW 4 -vid3_min vid3 vid3 RW 4 -vid4_min vid4 vid4 RW 4 -vid1_max vid1 vid1 RW 4 -vid2_max vid2 vid2 RW 4 -vid3_max vid3 vid3 RW 4 -vid4_max vid4 vid4 RW 4 -alarms - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -fan1 SENSORS_MAXI_AS_FAN1 fan1:3 -fan2 SENSORS_MAXI_AS_FAN2 fan2:3 -fan3 SENSORS_MAXI_AS_FAN3 fan3:3 -fan1_min SENSORS_MAXI_AS_FAN1_MIN fan1:1 -fan2_min SENSORS_MAXI_AS_FAN2_MIN fan2:1 -fan3_min SENSORS_MAXI_AS_FAN3_MIN fan3:1 -fan1_div SENSORS_MAXI_AS_FAN1_DIV fan1:2 -fan2_div SENSORS_MAXI_AS_FAN2_DIV fan2:2 -fan3_div SENSORS_MAXI_AS_FAN3_DIV fan3:2 -temp1 SENSORS_MAXI_AS_TEMP1 temp1:3 -temp2 SENSORS_MAXI_AS_TEMP2 temp2:3 -temp3 SENSORS_MAXI_AS_TEMP3 temp3:3 -temp4 SENSORS_MAXI_AS_TEMP4 temp4:3 -temp5 SENSORS_MAXI_AS_TEMP5 temp5:3 -temp1_max SENSORS_MAXI_AS_TEMP1_MAX temp1:1 -temp2_max SENSORS_MAXI_AS_TEMP2_MAX temp2:1 -temp3_max SENSORS_MAXI_AS_TEMP3_MAX temp3:1 -temp4_max SENSORS_MAXI_AS_TEMP4_MAX temp4:1 -temp5_max SENSORS_MAXI_AS_TEMP5_MAX temp5:1 -temp1_hyst SENSORS_MAXI_AS_TEMP1_HYST temp1:2 -temp2_hyst SENSORS_MAXI_AS_TEMP2_HYST temp2:2 -temp3_hyst SENSORS_MAXI_AS_TEMP3_HYST temp3:2 -temp4_hyst SENSORS_MAXI_AS_TEMP4_HYST temp4:2 -temp5_hyst SENSORS_MAXI_AS_TEMP5_HYST temp5:2 -pll SENSORS_MAXI_AS_PLL pll:3 -pll_min SENSORS_MAXI_AS_PLL_MIN pll:1 -pll_max SENSORS_MAXI_AS_PLL_MAX pll:2 -vid1 SENSORS_MAXI_AS_VID1 vid1:3 -vid2 SENSORS_MAXI_AS_VID2 vid2:3 -vid3 SENSORS_MAXI_AS_VID3 vid3:3 -vid4 SENSORS_MAXI_AS_VID4 vid4:3 -vid1_min SENSORS_MAXI_AS_VID1_MIN vid1:1 -vid2_min SENSORS_MAXI_AS_VID2_MIN vid2:1 -vid3_min SENSORS_MAXI_AS_VID3_MIN vid3:1 -vid4_min SENSORS_MAXI_AS_VID4_MIN vid4:1 -vid1_max SENSORS_MAXI_AS_VID1_MAX vid1:2 -vid2_max SENSORS_MAXI_AS_VID2_MAX vid2:2 -vid3_max SENSORS_MAXI_AS_VID3_MAX vid3:2 -vid4_max SENSORS_MAXI_AS_VID4_MAX vid4:2 -alarms SENSORS_MAXI_AS_ALARMS alarms:1 diff --git a/doc/chips/mic74 b/doc/chips/mic74 deleted file mode 100644 index e115d385..00000000 --- a/doc/chips/mic74 +++ /dev/null @@ -1,57 +0,0 @@ -Kernel driver `mic74.o' -========================= - -Status: Beta - -Supported chips: - * Micrel MIC74 - Prefix: 'mic74' - Addresses scanned: I2C 0x20 - 0x27 - Datasheet: Publicly available at the Micrel website - http://www.micrel.com/ - -Authors: zebo25 - mds (cleanups and this doc) - -Module Parameters ------------------ - - -Description ------------ -The MIC74 is an 8-bit I/O expander for the I2C bus. -Semiconductors. It is designed to provide a byte I2C interface to up to 8 -separate devices. - -This device consists of a quasi-bidirectionnal port. Each of the eight I/Os -can be independently used as an input or output. - -The driver does not initialize the ports, they will be at their -power-up defaults, or however the BIOS programmed them. - -For more information see the datasheet. - - -Accessing MIC74 via /proc interface -------------------------------------- - -! Be careful ! -The chip is plainly impossible to detect ! Stupid chip. -So every chip with adress in the interval [20..27] could be -detected as an MIC74 or a PCF8574. Don't load both drivers. -If you have other chips in this address -range, the workaround is to load this module after the one -for your others chips. - -On detection, directories are created for each detected chip: - - /proc/sys/dev/sensors/mic74-<0>-<1>/ - where <0> is the bus the chip was detected on (e. g. i2c-0) - and <1> the chip address [20..27]: - ./mic74-i2c-0-27/ - -Inside these directories, there are seven files each, -one for each of the seven registers in the device. - -At this point you really need the datasheet. -It should be self-explanatory which file is for which register. diff --git a/doc/chips/mtp008 b/doc/chips/mtp008 deleted file mode 100644 index bf20c2c0..00000000 --- a/doc/chips/mtp008 +++ /dev/null @@ -1,73 +0,0 @@ -Kernel driver `mtp008.o' -========================= - -Status: Complete; Beta. - This chip is quite configurable and many settings cannot - be done through the driver. Hopefully the BIOS settings will - be correct for most motherboards. - -Supported chips: - * Myson MTP008 - Prefix: 'mtp008' - Addresses scanned: I2C 0x2c - 0x2e - Datasheet: Publicly available at the Myson website - -Author: Kris Van Hees - - -Description ------------ - -The Myson MTP008 is similar in function to the Winbond W83781D and the -National Semi LM78. See documentation for those chips for an overview. - - -The MTP008 chip has several pins that are configurable. - -The three temperature sensors are configurable via the driver -using either the /proc entries or 'set sensorx y' statements in -/etc/sensors.conf. -One temperature input is always temp1, and the sensor type is configured -with the sensor1 entry in /proc. -One input is either in4 or temp2, and is configured with the sensor2 entry. -One input is either in5 or temp3, and is configured with the sensor3 entry. - -For example, on the Tyan S1824D motherboard, -AIN4 is configured as PII temp sensor 2 and -AIN5 is hooked up to the -12V sensing circuit. - -Other Tyan motherboards (the 2510 Thunder and the Tiger 200) appear to -have different configurations. - -For the 2510, which has two MTP008 chips, each with a different -configuration, follow the instructions in the mtp008 section of -etc/sensors.conf.eg to configure 'sensors' correctly. - -The PWM outputs are configurable via the driver. -PWM values are from 0 to 255. The first value in the /proc entry is -the pwm value; the second is the enable (0 or 1). - -The fan3 and pwm1 functions share a pin. -If pwm1 is enabled than fan3 will read as 0. - -The Fan input types (2 wire or 3 wire) are configurable but -not via the driver. - -The driver now preserves pin settings that the BIOS configures. -If your BIOS did it right then the driver should work great. - -The MTP008 has sensor type selection in /proc like the Winbond W83782D. -However, the appropriate values used to make the selection are different. - -To select a sensor type, echo the value to the /proc entry, for example: - echo 1 > /proc/sys/dev/sensors/mtp008-i2c-0-2d/sensor1 -Or, use /etc/sensors.conf and add a line 'set sensor1 1', for example. -Hopefully the BIOS has set these already. - -Sensor selection is as follows: - - Value Function Valid on sensors - ----- -------- ---------------- - 1 Analog input (not for temperature sensing) 2,3 - 2 Thermistor 1,2,3 - 3 Pentium diode 1,2 diff --git a/doc/chips/pc87360 b/doc/chips/pc87360 deleted file mode 100644 index 0a866002..00000000 --- a/doc/chips/pc87360 +++ /dev/null @@ -1,184 +0,0 @@ -Kernel driver `pc87360.o' -========================= - -Status: Beta, PC87366 well tested, other chips untested. - -Supported chips: - * National Semiconductor PC87360, PC87363, PC87364, PC87365 and PC87366 - Addresses scanned: none, address read from Super I/O config space - Prefixes: 'pc87360', 'pc87363', 'pc87364', 'pc87365', 'pc87366' - Datasheets: - http://www.national.com/pf/PC/PC87360.html - http://www.national.com/pf/PC/PC87363.html - http://www.national.com/pf/PC/PC87364.html - http://www.national.com/pf/PC/PC87365.html - http://www.national.com/pf/PC/PC87366.html - -Authors: Jean Delvare - -Thanks to Sandeep Mehta, Tonko de Rooy and Daniel Ceregatti for testing. -Thanks to Rudolf Marek for helping me investigate conversion issues. - - -Module Parameters ------------------ - -init (int): - Chip initialization level: - 0: None - *1: Forcibly enable internal voltage and temperature channels, except in9 - 2: Forcibly enable all voltage and temperature channels, except in9 - 3: Forcibly enable all voltage and temperature channels, including in9 - -Note that this parameter has no effect for the PC87360, PC87363 and PC87364 -chips. - -Also note that for the PC87366, initialization levels 2 and 3 don't enable -all temperature channels, because some of them share pins with each other, -so they can't be used at the same time. - - -Description ------------ - -The National Semiconductor PC87360 Super I/O chip contains monitoring and -PWM control circuitry for two fans. The PC87363 chip is similar, and the -PC87364 chip has monitoring and PWM control for a third fan. - -The National Semiconductor PC87365 and PC87366 Super I/O chips are complete -hardware monitoring chipsets, not only controling and monitoring three fans, -but also monitoring eleven voltage inputs and two (PC87365) or up to four -(PC87366) temperatures. - -The driver assumes that no more than one chip is present, and one of the -standard Super I/O addresses is used (0x2E/0x2F or 0x4E/0x4F). - - -Fan Monitoring --------------- - -Fan rotation speeds are reported in RPM (revolutions per minute). An alarm -is triggered if the rotation speed has dropped below a programmable limit. -A different alarm is triggered if the fan speed is too low to be measured. - -Fan readings are affected by a programmable clock divider, giving the -readings more range or accuracy. Usually, users have to learn how it works, -but this driver implements dynamic clock divider selection, so you don't -have to care no more. - -For reference, here are a few values about clock dividers: - - slowest accuracy highest - measurable around 3000 accurate - divider speed (RPM) RPM (RPM) speed (RPM) - 1 1882 18 6928 - 2 941 37 4898 - 4 470 74 3464 - 8 235 150 2449 - -For the curious, here is how the values above were computed: - * slowest measurable speed: clock/(255*divider) - * accuracy around 3000 RPM: 3000^2/clock - * highest accurate speed: sqrt(clock*100) -The clock speed for the PC87360 family is 480 kHz. I arbitrarily chose 100 -RPM as the lowest acceptable accuracy. - -As mentioned above, you don't have to care about this no more. - -Note that not all RPM values can be represented, even when the best clock -divider is selected. This is not only true for the measured speeds, but -also for the programmable low limits, so don't be surprised if you try to -set, say, fan1_min to 2900 and it finaly reads 2909. - - -Fan Control ------------ - -PWM (pulse width modulation) values range from 0 to 255, with 0 meaning -that the fan is stopped, and 255 meaning that the fan goes at full speed. - -Be extremely careful when changing PWM values. Low PWM values, even -non-zero, can stop the fan, which may cause irreversible damage to your -hardware if temperature increases too much. When changing PWM values, go -step by step and keep an eye on temperatures. - -One user reported problems with PWM. Changing PWM values would break fan -speed readings. No explanation nor fix could be found. - - -Temperature Monitoring ----------------------- - -Temperatures are reported in degrees Celsius. Each temperature measured has -associated low, high and overtemperature limits, each of which triggers an -alarm when crossed. - -The first two temperature channels are external. The third one (PC87366 -only) is internal. - -The PC87366 has three additional temperature channels, based on -thermistors (as opposed to thermal diodes for the first three temperature -channels). For technical reasons, these channels are held by the VLM -(voltage level monitor) logical device, not the TMS (temperature -measurement) one. As a consequence, these temperatures are exported as -voltages, and converted into temperatures in user-space. - -Note that these three additional channels share their pins with the -external thermal diode channels, so you (physically) can't use them all at -the same time. Although it should be possible to mix the two sensor types, -the documents from National Semiconductor suggest that motherboard -manufacturers should choose one type and stick to it. So you will more -likely have either channels 1 to 3 (thermal diodes) or 3 to 6 (internal -thermal diode, and thermistors). - - -Voltage Monitoring ------------------- - -Voltages are reported relatively to a reference voltage, either internal or -external. Some of them (in7:Vsb, in8:Vdd and in10:AVdd) are divided by two -internally, you will have to compensate in sensors.conf. Others (in0 to in6) -are likely to be divided externally. The meaning of each of these inputs as -well as the values of the resistors used for division is left to the -motherboard manufacturers, so you will have to document yourself and edit -sensors.conf accordingly. National Semiconductor has a document with -recommended resistor values for some voltages, but this still leaves much -room for per motherboard specificities, unfortunately. Even worse, -motherboard manufacturers don't seem to care about National Semiconductor's -recommendations. - -Each voltage measured has associated low and high limits, each of which -triggers an alarm when crossed. - -When available, VID inputs are used to provide the nominal CPU Core voltage. -The driver will default to VRM 9.0, but this can be changed from user-space. -The chipsets can handle two sets of VID inputs (on dual-CPU systems), but -the driver will only export one for now. This may change later if there is -a need. - - -General Remarks ---------------- - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may already -have disappeared! Note that all hardware registers are read whenever any -data is read (unless it is less than 2 seconds since the last update, in -which case cached values are returned instead). As a consequence, when -a once-only alarm triggers, it may take 2 seconds for it to show, and 2 -more seconds for it to disappear. - -Monitoring of in9 isn't enabled at lower init levels (<3) because that -channel measures the battery voltage (Vbat). It is a known fact that -repeatedly sampling the battery voltage reduces its lifetime. National -Semiconductor smartly designed their chipset so that in9 is sampled only -once every 1024 sampling cycles (that is every 34 minutes at the default -sampling rate), so the effect is attenuated, but still present. - - -Limitations ------------ - -The datasheets suggests that some values (fan mins, fan dividers) -shouldn't be changed once the monitoring has started, but we ignore that -recommendation. We'll reconsider if it actually causes trouble. diff --git a/doc/chips/pca9540 b/doc/chips/pca9540 deleted file mode 100644 index d810dbc5..00000000 --- a/doc/chips/pca9540 +++ /dev/null @@ -1,76 +0,0 @@ -Kernel driver `pca9540.o' -========================= - -Status: Complete but untested - -Supported chips: - * Philips PCA9540 - Prefix: 'pca9540' - Addresses scanned: I2C 0x70 - Datasheet: Publicly available at the Philips Semiconductors website - http://www.semiconductors.philips.com/pip/PCA9540.html - -Authors: Jean Delvare - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_pca9540: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to - contain a `pca9540' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - -Note that the force and force_pca9540 parameters are equivalent here. - - -Description (from the Philips web site) ---------------------------------------- - -The PCA9540 is a 1-of-2 bi-directional translating multiplexer, controlled -via the I2C bus. The SCL/SDA upstream pair fans out to two SCL/SDA downstream -pairs, or channels. Only one SCL/SDA channel is selected at a time, -determined by the contents of the programmable control register. - - -Accessing the PCA9540 ---------------------- - -The PCA9540 is almost impossible to detect. We are lucky that no other -known chip lives at address 0x70. - -Beware that the PCA9540 has a single internal register. It does work with -READ BYTE and WRITE BYTE commands, contrary to regular chips which use -READ BYTE DATA and WRITE BYTE DATA. Using i2cdump on the PCA9540 will -actually *write* to it and leave its internal register to value 0x07 (i.e. -no downstream channel selected). - - -/proc Interface ---------------- - -There is a single read/write file, named "channel". - - 0 = no downstream channel selected - 1 = first downstream channel selected - 2 = second downstream channel selected - - -Chip Features -------------- - -Chip `pca9540' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - channel NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - channel SENSORS_PCA9540_CHANNEL channel:1 diff --git a/doc/chips/pcf8574 b/doc/chips/pcf8574 deleted file mode 100644 index 744beebf..00000000 --- a/doc/chips/pcf8574 +++ /dev/null @@ -1,100 +0,0 @@ -Kernel driver `pcf8574.o' -========================= - -Status: Complete - -Supported chips: - * Philips PCF8574 - Prefix: 'pcf8574' - Addresses scanned: I2C 0x20 - 0x27 - Datasheet: Publicly available at the Philips Semiconductors website - http://www.semiconductors.philips.com/pip/PCF8574P.html - - * Philips PCF8574A - Prefix: 'pcf8574a' - Addresses scanned: I2C 0x38 - 0x3f - Datasheet: Publicly available at the Philips Semiconductors website - http://www.semiconductors.philips.com/pip/PCF8574P.html - -Authors: Frodo Looijaard , - Philip Edelbrock , - and Dan Eaton - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_pcf8574: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to - contain a `pcf8574' chip -* force_pcf8574a: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to - contain a `pcf8574a' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ -The PCF8574(A) is an 8-bit I/O expander for the I2C bus produced by Philips -Semiconductors. It is designed to provide a byte I2C interface to up to 16 -separate devices (8 x PCF8574 and 8 x PCF8574A). - -This device consists of a quasi-bidirectionnal port. Each of the eight I/Os -can be independently used as an input or output. To setup an I/O as an -input, you have to write a 1 to the corresponding output. - -For more informations see the datasheet. - - -Accessing PCF8574(A) via /proc interface -------------------------------------- - -! Be careful ! -The PCF8574(A) is plainly impossible to detect ! Stupid chip. -So every chip with adress in the interval [20..27] and [38..3f] is -detected as PCF8574(A). If you have other chips in this address -range, the workaround is to load this module after the one -for your others chips. - -On detection (i.e. insmod, modprobe et al.), directories are being -created for each detected PCF8574(A): - -/proc/sys/dev/sensors/pcf8574-<0>-<1>/ -where <0> is the bus the chip was detected on (e. g. i2c-0) -and <1> the chip address ([20..27] or [38..3f]): -./pcf8574-i2c-0-27/ - -Inside these directories, there are two files each: -read and write. - -The read file is read-only. Reading gives you the current I/O input -if the corresponding output is set as 1, otherwise the current output -value, that is to say 0. - -The write file is read/write. Writing a value outputs it on the I/O -port. Reading return the last written value. - -On module initialization the chip is configured as eight inputs (all -outputs to 1), so you can connect any circuit to the PCF8574(A) without -being afraid of short-circuit. - - -Chip Features -------------- - -Chip `pcf8574' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - read NONE NONE R 0 - write NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - read SENSORS_PCF8591_READ read:1 - write SENSORS_PCF8591_WRITE write:1 diff --git a/doc/chips/pcf8591 b/doc/chips/pcf8591 deleted file mode 100644 index 71123adb..00000000 --- a/doc/chips/pcf8591 +++ /dev/null @@ -1,127 +0,0 @@ -Kernel driver `pcf8591.o' -======================== - -Status: Status: Complete; Beta. - -Supported chips: - * Philips PCF8591 - Prefix: 'pcf8591' - Addresses scanned: I2C 0x48 - 0x4f - Datasheet: Publicly available at the Philips Semiconductors website - http://www.semiconductors.philips.com/pip/PCF8591P.html - -Author: Aurelien Jarno -valuable contributions by Jan M. Sendler - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_pcf8591: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to - contain a `pcf8591' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ -The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one -analog ouput) for the I2C bus produced by Philips Semiconductors. It -is designed to provide a byte I2C interface to up to 4 separate devices. - -The PCF8591 has 4 analog inputs programmable as single-ended or -differential inputs : -- mode 0 : four single ended inputs - Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3 - -- mode 1 : three differential inputs - Pins AIN3 is the common negative differential input - Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2 - -- mode 2 : single ended and differential mixed - Pins AIN0 and AIN1 are single ended inputs for channels 0 and 1 - Pins AIN2 is the positive differential input for channel 3 - Pins AIN3 is the negative differential input for channel 3 - -- mode 3 : two differential inputs - Pins AIN0 is the positive differential input for channel 0 - Pins AIN1 is the negative differential input for channel 0 - Pins AIN2 is the positive differential input for channel 1 - Pins AIN3 is the negative differential input for channel 1 - -For more informations see the datasheet. - - -Accessing PCF8591 via /proc interface -------------------------------------- - -! Be careful ! -The PCF8591 is plainly impossible to detect ! Stupid chip. -So every chip with adress in the interval [48..4f] is -detected as PCF8591. If you have other chips in this address -range, the workaround is to load this module after the one -for your others chips. - -On detection (i.e. insmod, modprobe et al.), directories are being -created for each detected PCF8591: - -/proc/sys/dev/sensors/pcf8591-<0>-<1>/ -where <0> is the bus the chip was detected on (e. g. i2c-0) -and <1> the chip address ([48..4f]): ./pcf8591-i2c-0-48/ - -Inside these directories, there are five files each: -ain_conf, ch0, ch1, ch2, ch3, aout_enable, aout. - -The ain_conf file is rw. Reading gives you the current analog inputs -configuration, and writing configure the analog inputs. It must be -a number between 0 and 3., other values are ignored. For the different -modes, see above in the description. - -The ch0, ch1, ch2 and ch3 files are ro. Reading gives the value -of the corresponding channel. Depending on the current analog inputs -configuration, channel ch2 and/or ch3 may are not used by the chip -and so read as 0. Values range are from 0 to 255 for single -ended inputs and -128 to +127 for differential inputs (8-bit ADC). - -The aout_enable is rw. Reading gives "1" for analog output enabled and -"0" for analog output disabled. Writing accepts "0" and "1" accordingly. - -The aout is rw. Writing a number between 0 and 255 (8-bit DAC), send -the value to the digital-to-analog converter. Note that a voltage will -only appears on AOUT pin if aout_enable equals 1. Reading returns the last -value written. - -On module initialization the chip is configured as followed : -- four single ended differential inputs -- analog output set to 0 and enabled - - -Chip Features -------------- - -Chip `pcf8591' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - ain_conf NONE NONE RW 0 - ch0 NONE NONE R 0 - ch1 NONE NONE R 0 - ch2 NONE NONE R 0 - ch3 NONE NONE R 0 - aout_enable NONE NONE RW 0 - aout NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:OFFSET - ain_conf SENSORS_PCF8591_AIN_CONF ain_conf:1 - ch0 SENSORS_PCF8591_CH0 ain_ch0:1 - ch1 SENSORS_PCF8591_CH1 ain_ch1:1 - ch2 SENSORS_PCF8591_CH2 ain_ch2:1 - ch3 SENSORS_PCF8591_CH3 ain_ch3:1 - aout_enable SENSORS_PCF8591_AOUT_ENABLE aout_enable:1 - aout SENSORS_PCF8591_AOUT aout:1 diff --git a/doc/chips/saa1064 b/doc/chips/saa1064 deleted file mode 100644 index bc246eab..00000000 --- a/doc/chips/saa1064 +++ /dev/null @@ -1,81 +0,0 @@ -Kernel driver `saa1064.o' -======================== - -Status: Testing; - -Supported chips: - * Philips SAA1064 - Prefix: 'saa1064' - Addresses scanned: I2C 0x38 - 0x3b - Datasheet: Publicly available at the Philips Semiconductors website - http://www.semiconductors.philips.com/ - http://www.philipslogic.com/products/i2c/pdf/saa1064.pdf - - -Author: Sascha Volkenandt - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_saa1064: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to - contain a `saa1064' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ -The SAA1064 is a 4-digit LED driver chip for the I2C bus produced by Philips -Semiconductors. It is designed to provide a byte I2C interface to up to 4 -separate 4-digit displays (16 digits). - -This device has eight write-only registers, five are used for a control byte -and the four digit values. - -For more informations see the datasheet. - - -Accessing SAA1064 via /proc interface -------------------------------------- - -On detection (i.e. insmod, modprobe et al.), directories are being -created for each detected SAA1064: - -/proc/sys/dev/sensors/saa1064-<0>-<1>/ -where <0> is the bus the chip was detected on (e. g. i2c-0) -and <1> the chip address ([38..3b]): -./saa1064-i2c-0-38/ - -Inside these directories, there are four files each: -bright, test, disp and refresh - -The bright, test and disp files are read-write. - -Writing bright sets the output current to the LEDs connected to the -chip and thus the brightness. Range is from 0 to 7. Reading -gives you the last known value. - -Writing test sets the segment test mode (all LEDs lit regardless of -the digit values) on/off (values 0/1). Reading gives you the last -known value. - -Writing up to four values to disp sets the digits. Each value represents -one segment, while each bit represents one LED of the segment (seven bars -and one dot usually). Reading gives you the last known value. - -The refresh file is read-only. You can't read anything from it, but -reading it will trigger a refresh in case a power-loss has occurred since -the last refresh. - -On module initialization the chip is configured for segment test (test=1), -full brightness (bright=7), all digit values zeroed. - diff --git a/doc/chips/sis5595 b/doc/chips/sis5595 deleted file mode 100644 index a6f4f02b..00000000 --- a/doc/chips/sis5595 +++ /dev/null @@ -1,165 +0,0 @@ -Kernel driver `sis5595.o' -========================= - -Status: Complete and tested - -Supported chips: - * Silicon Integrated Systems Corp. SiS5595 Southbridge Hardware Monitor - Prefix: sis5595 - Addresses scanned: ISA in PCI-space encoded address - Datasheet: Publicly available at the Silicon Integrated Systems Corp. site. - - Supports following revisions: - Version PCI ID PCI Revision - 1 1039/0008 01 - 2 1039/0008 C0 - -Author: Kyösti Mälkki - - Note: The chips below contain a 0008 device which is incompatible with the - 5595. We recognize these by the presence of the listed - "blacklist" PCI ID and refuse to load. - - NOT SUPPORTED PCI ID BLACKLIST PCI ID - 540 0008 0540 - 550 0008 0550 - 5513 0008 5511 - 5581 0008 5597 - 5582 0008 5597 - 5597 0008 5597 - 5598 0008 5597/5598 - 630 0008 0630 - 645 0008 0645 - 730 0008 0730 - 735 0008 0735 - -Module Parameters ------------------ -force_addr=0xaddr Set the I/O base address. Useful for boards - that don't set the address in the BIOS. Does not do a - PCI force; the device must still be present in lspci. - Don't use this unless the driver complains that the - base address is not set. - Example: 'modprobe sis5595 force_addr=0x290' - - -Description ------------ - -The Sis5595 southbridge has integrated hardware monitor functions. -It also has an I2C bus, but this driver only supports the hardware monitor. -For the I2C bus driver see i2c-sis5595. - -The SiS5595 implements zero or one temperature sensor, two fan speed -sensors, four or five voltage sensors, and alarms. - -On the first version of the chip, there are four voltage -sensors and one temperature sensor. - -On the second version of the chip, -the temperature sensor (temp) and the fifth voltage sensor (in4) share a pin -which is configurable, but not through the driver. Sorry. -The driver senses the configuration of the pin, which was hopefully -set by the BIOS. -If the temperature function is enabled, in4 will return 0. -If the in4 function is enabled, temp will return 0. - -Temperatures are measured in degrees Celsius. An alarm is triggered once -when the max is crossed; it is also triggered -when it drops below the min value. -Measurements are guaranteed -between -55 and +125 degrees, with a resolution of 1 degree. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -Voltage sensors (also known as IN sensors) report their values in volts. -An alarm is triggered if the voltage has crossed a programmable minimum -or maximum limit. Note that minimum in this case always means 'closest to -zero'; this is important for negative voltage measurements. All voltage -inputs can measure voltages between 0 and 4.08 volts, with a resolution -of 0.016 volt. - -In addition to the alarms described above, there is a BTI alarm, which gets -triggered when an external chip has crossed its limits. Usually, this is -connected to some LM75-like chip; if at least one crosses its limits, this -bit gets set. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.5 seconds since the last update). This means that you can easily -miss once-only alarms. - -The Sis5595 only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. - -Problems --------- -Some chips refuse to be enabled. We don't know why. -The driver will recognize this and print a message in dmesg. - -Chip Features -------------- - -Chip `sis5595' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in4 in4 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in4 in4 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - alarms NONE NONE R 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - in0 SENSORS_SIS5595_IN0 in0:3 - in1 SENSORS_SIS5595_IN1 in1:3 - in2 SENSORS_SIS5595_IN2 in2:3 - in3 SENSORS_SIS5595_IN3 in3:3 - in4 SENSORS_SIS5595_IN4 in3:3 - in0_min SENSORS_SIS5595_IN0_MIN in0:1 - in1_min SENSORS_SIS5595_IN1_MIN in1:1 - in2_min SENSORS_SIS5595_IN2_MIN in2:1 - in3_min SENSORS_SIS5595_IN3_MIN in3:1 - in4_min SENSORS_SIS5595_IN4_MIN in4:1 - in0_max SENSORS_SIS5595_IN0_MAX in0:2 - in1_max SENSORS_SIS5595_IN1_MAX in1:2 - in2_max SENSORS_SIS5595_IN2_MAX in2:2 - in3_max SENSORS_SIS5595_IN3_MAX in3:2 - in4_max SENSORS_SIS5595_IN4_MAX in4:2 - fan1 SENSORS_SIS5595_FAN1 fan1:2 - fan2 SENSORS_SIS5595_FAN2 fan2:2 - fan1_min SENSORS_SIS5595_FAN1_MIN fan1:1 - fan2_min SENSORS_SIS5595_FAN2_MIN fan2:1 - temp SENSORS_SIS5595_TEMP temp:3 - temp_hyst SENSORS_SIS5595_TEMP_HYST temp:2 - temp_over SENSORS_SIS5595_TEMP_OVER temp:1 - fan1_div SENSORS_SIS5595_FAN1_DIV fan_div:1 - fan2_div SENSORS_SIS5595_FAN2_DIV fan_div:2 - alarms SENSORS_SIS5595_ALARMS alarms:1 - - diff --git a/doc/chips/smartbatt b/doc/chips/smartbatt deleted file mode 100644 index 14e2b14d..00000000 --- a/doc/chips/smartbatt +++ /dev/null @@ -1,66 +0,0 @@ -Kernel driver `smartbatt.o' -========================== - -Status: Alpha - -Supported chips: - * Smart batteries - Prefix: 'smartbatt' - Address scanned: 0x0b - Datasheet: Smart Battery Data Specification Revision 1.1 - http://www.sbs-forum.org/ - -Author: M. Studebaker - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_smartbatt: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `smartbatt' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Detection ---------- - -Very poor. Just looks for the presence of some registers. - - -Uses ----- - -Provides read-only access to battery voltage, current, temperature, -charge status, time remaining, and alarms. - - -/proc entries -------------- - -Average readings are one minute rolling averages. - - alarms bitmask - charge relative charge, absolute charge (%) - i average current, instantaneous current (A) - temp temperature (deg. C) - time avg. time to empty, avg. time to full, - instantaneous time to full (min) - v max voltage, current voltage (V) - - -To do ------ - -More features. diff --git a/doc/chips/smbus-arp b/doc/chips/smbus-arp deleted file mode 100644 index e04fc0a4..00000000 --- a/doc/chips/smbus-arp +++ /dev/null @@ -1,66 +0,0 @@ -SMBUS_ARP Driver -------------- -This is a demonstration driver which provides SMBus 2.0 -ARP services. It isn't much use except for testing SMBus 2.0 -ARP and PEC support in the i2c layer. -It is NOT a normal 'chip' driver for a particular sensor device. -If you don't know what SMBus ARP is you don't need this driver. - - -Stability ---------- -Beta. - - -DETECTION -------------- -This driver requires SMBus 2.0 support in i2c-2.6.4 or higher. -If your kernel does not have i2c-2.6.4 or higher the module -will refuse to load. - -This driver will register itself on each i2c bus which -supports SMBus Block Data transactions. - - -USES ----- -The module ARPs each supported bus when it is inserted -(or after that when a i2c bus driver is inserted). -It does not periodically re-ARP, and the i2c stack does not -currently support SMBus Host Notify, so it will not detect -hot-plugged devices. - -The smbus-arp module should be inserted before any chip modules -so that it has an opportunity to assign addresses. - - -/PROC ENTRIES -------------- -There are 8 entries in /proc, 0-7. Each is a 'slot'. -If a chip has responded to ARP, it will appear in a 'slot' -as follows. See the SMBus 2.0 Specification for details. - - value function - 1 SMBus address - 2 UDID Device Capabilities - 3 UDID Version / Revision - 4 UDID Vendor ID - 5 UDID Device ID - 6 UDID Interface - 7 UDID Subsystem Vendor ID - 8 UDID Subsystem Device ID - 9 UDID Vendor Specific ID - -To reassign a device to a different address, write -that address to the slot. For example, 'echo 13 > 0' -to reassign the device in slot 0 to address 13 (0x0d). - - -TO DO ------ -lots - -Author/Maintainer ------------------ -Mark D. Studebaker (mdsxyz123@yahoo.com) - diff --git a/doc/chips/smsc47m1 b/doc/chips/smsc47m1 deleted file mode 100644 index 6c1c35ae..00000000 --- a/doc/chips/smsc47m1 +++ /dev/null @@ -1,75 +0,0 @@ -Kernel driver `smsc47m1.o' -========================== - -Status: Beta. - -Supported chips: - * SMSC LPC47B27x, LPC47M112, LPC47M10x, LPC47M13x, LPC47M14x, - LPC47M15x and LPC47M192 - Prefix: 'smsc47m1' - Addresses scanned: none, address read from Super I/O config space - Datasheets: - http://www.smsc.com/main/datasheets/47b27x.pdf - http://www.smsc.com/main/datasheets/47m10x.pdf - http://www.smsc.com/main/datasheets/47m112.pdf - http://www.smsc.com/main/tools/discontinued/47m13x.pdf - http://www.smsc.com/main/datasheets/47m14x.pdf - http://www.smsc.com/main/tools/discontinued/47m15x.pdf - http://www.smsc.com/main/datasheets/47m192.pdf - * SMSC LPC47M292 - Prefix: 'smsc47m2' - Addresses scanned: none, address read from Super I/O config space - Datasheet: Not public - * SMSC LPC47M997 - Addresses scanned: none, address read from Super I/O config space - Prefix: 'smsc47m1' - Datasheet: none - -Authors: Mark D. Studebaker - With assistance from Bruce Allen and his - fan.c program: http://www.lsc-group.phys.uwm.edu/%7Eballen/driver/ - -Module Parameters ------------------ - -force_addr=0xaddr Set the I/O base address. Useful for boards - that don't set the address in the BIOS. - Don't use this unless the driver complains that the - base address is not set. - Example: 'modprobe smsc47m1 force_addr=0x680' - - -Description ------------ - -The Standard Microsystems Corporation (SMSC) 47M1xx Super I/O chips -contain monitoring and PWM control circuitry for two fans. - -The LPC47M15x, LPC47M192 and LPC47M292 chips contain a full 'hardware -monitoring block' in addition to the fan monitoring and control. The -hardware monitoring block is not supported by the driver. - -No documentation is available for the 47M997, but it has the same device -ID as the 47M15x and 47M192 chips and seems to be compatible therewith. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -PWM values are from 0 to 255. The first value in the /proc entry is -the pwm value; the second is the enable (0 or 1). - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.5 seconds since the last update). This means that you can easily -miss once-only alarms. - - -********************** -The lm_sensors project gratefully acknowledges the support of -Intel in the development of this driver. diff --git a/doc/chips/thmc50 b/doc/chips/thmc50 deleted file mode 100644 index 33205c53..00000000 --- a/doc/chips/thmc50 +++ /dev/null @@ -1,96 +0,0 @@ -Kernel driver `thmc50.o' -===================== - -Status: Complete and some-what tested - -Supported chips: - * Analog Devices ADM1022 - Prefix: 'adm1022' - Addresses scanned: I2C 0x2D - 0x2F - Datasheet: Publicly available at the Analog Devices website - * Texas Instruments THMC50 - Prefix: 'thmc50' - Addresses scanned: I2C 0x2D - 0x2F - Datasheet: Publicly available at the Texas Instruments' website - -Authors: Frodo Looijaard and - Philip Edelbrock - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_thmc50: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `thmc50' chip -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 - - -Description ------------ - -The THMC50 implements: an internal temperature sensor, support for an -external diode-type temperature sensor (compatible w/ the diode sensor inside -many processors), and a controllable fan/analog_out DAC. For the temperature -sensors, limits can be set through the appropriate Overtemperature Shutdown -register and Hysteresis register. Each value can be set and read to half-degree -accuracy. An alarm is issued (usually to a connected LM78) when the -temperature gets higher then the Overtemperature Shutdown value; it stays on -until the temperature falls below the Hysteresis value. All temperatures are in -degrees Celsius, and are guaranteed within a range of -55 to +125 degrees. - -The THMC50 only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. - -The THMC50 is usually used in combination with LM78-like chips, to measure -the temperature of the processor(s). - - -Driver Features ---------------- - -These are the files which are provided by the driver (ro=read-only, -rw=read and writeable): - -temp1 (internal) -- Three fields: [temp-os,rw] [temp-hyst,rw] [temp,ro] -temp2 (remote) -- Three fields: [temp-os,rw] [temp-hyst,rw] [temp,ro] - -temp-os, temp-hyst, and temp are whole degree integers representing degrees -Celsius. - -analog_out -- One field: [output-value,rw] - -output-value is a number from 0 to 255 representing the voltage output -provided by the DAC from 0 to 2.5, respectively. Note: the max *current* -supplied is actually quite low. Some type of current amplification is needed -in order to control a fan or other current demanding device (see the -datasheet for more info). - -die_code -- One field: [die-code,ro] - -die-code is an integer representation of the die_code byte register. -According to the docs, the high nibble is the die version, and the lower -nibble is the stepping. (Don't ask me why or what this means! ;') - -inter -- One field: [interrupts,rw] - -interrupts is an integer representation of the interrupts byte. See the data -sheet for what bits mean what. - -inter_mask -- One field: [inter-mask,rw] - -inter-mask is an integer repressentation of the interrupt mask which is a -determination of which conditions can cause the /INT pin on the chip to -become asserted. - - - diff --git a/doc/chips/via686a b/doc/chips/via686a deleted file mode 100644 index 6db475fa..00000000 --- a/doc/chips/via686a +++ /dev/null @@ -1,155 +0,0 @@ -Kernel driver `via686a.o' -========================= - -Status: Stable. - -Supported chips: - * Via VT82C686A, VT82C686B Southbridge Integrated Hardware Monitor - Prefix: 'via686a' - Addresses scanned: ISA in PCI-space encoded address - Datasheet: On request through web form - (http://www.via.com.tw/en/support/datasheets/) - -Authors: Kyösti Mälkki , - Mark D. Studebaker - Bob Dougherty - (Some conversion-factor data were contributed by - Jonathan Teh Soon Yew - and Alex van Kaam .) - -Module Parameters ------------------ - -force_addr=0xaddr Set the I/O base address. Useful for boards that - don't set the address in the BIOS. Look for a BIOS - upgrade before resorting to this. Does not do a - PCI force; the via686a must still be present in lspci. - Don't use this unless the driver complains that the - base address is not set. - Example: 'modprobe via686a force_addr=0x6000' - - -Description ------------ - -The driver does not distinguish between the chips and reports -all as a 686A. - -The Via 686a southbridge has integrated hardware monitor functionality. -It also has an I2C bus, but this driver only supports the hardware monitor. -For the I2C bus driver, see ../busses/i2c-viapro. - -The Via 686a implements three temperature sensors, two fan rotation speed -sensors, five voltage sensors and alarms. - -Temperatures are measured in degrees Celsius. An alarm is triggered once -when the Overtemperature Shutdown limit is crossed; it is triggered again -as soon as it drops below the hysteresis value. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -Voltage sensors (also known as IN sensors) report their values in volts. -An alarm is triggered if the voltage has crossed a programmable minimum -or maximum limit. Voltages are internally scalled, so each voltage channel -has a different resolution and range. - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.5 seconds since the last update). This means that you can easily -miss once-only alarms. - -The driver only updates its values each 1.5 seconds; reading it more often -will do no harm, but will return 'old' values. - - -Known Issues ------------- - -This driver handles sensors integrated in some VIA south bridges. It is -possible that a motherboard maker used a VT82C686A/B chip as part of a -product design but was not interested in its hardware monitoring features, -in which case the sensor inputs will not be wired. This is the case of -the Asus K7V, A7V and A7V133 motherboards, to name only a few of them. -So, if you need the force_addr parameter, and end up with values which -don't seem to make any sense, don't look any further: your chip is simply -not wired for hardware monitoring. - - -Chip Features -------------- - -Chip `via686a' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in3 in3 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in3 in3 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan1_min fan1 fan1 RW 0 - fan2_min fan2 fan2 RW 0 - temp NONE NONE R 1 - temp_hyst temp temp RW 1 - temp_over temp temp RW 1 - temp2 NONE NONE R 1 - temp2_hyst temp temp RW 1 - temp2_over temp temp RW 1 - temp3 NONE NONE R 1 - temp3_hyst temp temp RW 1 - temp3_over temp temp RW 1 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - alarms NONE NONE R 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - in0 SENSORS_VIA686A_IN0 in0:3 - in1 SENSORS_VIA686A_IN1 in1:3 - in2 SENSORS_VIA686A_IN2 in2:3 - in3 SENSORS_VIA686A_IN3 in3:3 - in4 SENSORS_VIA686A_IN4 in4:3 - in0_min SENSORS_VIA686A_IN0_MIN in0:1 - in1_min SENSORS_VIA686A_IN1_MIN in1:1 - in2_min SENSORS_VIA686A_IN2_MIN in2:1 - in3_min SENSORS_VIA686A_IN3_MIN in3:1 - in4_min SENSORS_VIA686A_IN4_MIN in4:1 - in0_max SENSORS_VIA686A_IN0_MAX in0:2 - in1_max SENSORS_VIA686A_IN1_MAX in1:2 - in2_max SENSORS_VIA686A_IN2_MAX in2:2 - in3_max SENSORS_VIA686A_IN3_MAX in3:2 - in4_max SENSORS_VIA686A_IN4_MAX in4:2 - fan1 SENSORS_VIA686A_FAN1 fan1:2 - fan2 SENSORS_VIA686A_FAN2 fan2:2 - fan1_min SENSORS_VIA686A_FAN1_MIN fan1:1 - fan2_min SENSORS_VIA686A_FAN2_MIN fan2:1 - temp SENSORS_VIA686A_TEMP temp:3 - temp_hyst SENSORS_VIA686A_TEMP_HYST temp:2 - temp_over SENSORS_VIA686A_TEMP_OVER temp:1 - temp2 SENSORS_VIA686A_TEMP2 temp2:3 - temp2_hyst SENSORS_VIA686A_TEMP2_HYST temp2:2 - temp2_over SENSORS_VIA686A_TEMP2_OVER temp2:1 - temp3 SENSORS_VIA686A_TEMP3 temp3:3 - temp3_hyst SENSORS_VIA686A_TEMP3_HYST temp3:2 - temp3_over SENSORS_VIA686A_TEMP3_OVER temp3:1 - fan1_div SENSORS_VIA686A_FAN1_DIV fan_div:1 - fan2_div SENSORS_VIA686A_FAN2_DIV fan_div:2 - alarms SENSORS_VIA686A_ALARMS alarms:1 - - diff --git a/doc/chips/vt1211 b/doc/chips/vt1211 deleted file mode 100644 index a6156687..00000000 --- a/doc/chips/vt1211 +++ /dev/null @@ -1,70 +0,0 @@ -Kernel driver `vt1211.o' -========================= - -Status: Beta. - -Supported chips: - * Via VT1211 Super I/O Controller - Addresses scanned: none, address read from Super I/O config space - -Authors: Mark D. Studebaker - - -Module Parameters ------------------ - -force_addr=0xaddr Set the I/O base address. Useful for boards - that don't set the address in the BIOS. - Don't use this unless the driver complains that the - base address is not set. - Example: 'modprobe vt1211 force_addr=0x680' - - -Description ------------ - -The Via VT1211 Super I/O chip -contains voltage/temperature monitoring and -PWM control circuitry for two fans. - -We define the sensors as follows. Somewhat convoluted to minimize -changes from via686a. - - Sensor Voltage Mode Temp Mode uch_config bit - -------- ------------ --------- -------------- - Reading 1 temp3 - Reading 3 temp1 - UCH1/Reading2 in0 temp2 0x04 (4) - UCH2 in1 temp4 0x08 (8) - UCH3 in2 temp5 0x10 (16) - UCH4 in3 temp6 0x20 (32) - UCH5 in4 temp7 0x40 (64) - 3.3V in5 - -As noted above, 5 of the sensors are "universal channels" and can -be set for either voltage or temperature. -Set the uch_config bit (in /proc) to 0 for voltage and 1 for temperature. -Voltages will read 0 if set for temperature. -Temperatures will read a really low number if set for voltage. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -PWM values are from 0 to 255. The first value in the /proc entry is -the pwm value; the second is the enable (0 or 1). - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.5 seconds since the last update). This means that you can easily -miss once-only alarms. - - -********************** -The lm_sensors project gratefully acknowledges the support of -Via in the development of this driver. diff --git a/doc/chips/vt8231 b/doc/chips/vt8231 deleted file mode 100644 index fdf7c989..00000000 --- a/doc/chips/vt8231 +++ /dev/null @@ -1,184 +0,0 @@ -Kernel driver `vt8231.o' -======================== - -Status: Beta - -Supported chips: - * VIA VT8231 South Bridge - Prefix: 'vt8231' - Addresses scanned: none, address read from PCI space - -Author: Mark D. Studebaker - -License: GPL - - -Module Parameters ------------------ - -* force_addr: int - Initialize the base address of the sensors -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_vt8231: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `vt8231' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -The VIA VT8231 South Bridge contains voltage/temperature monitoring and -PWM control circuitry for two fans. - -We define the sensors as follows. - - Sensor Voltage Mode Temp Mode uch_config bit - ------ ------------ --------- -------------- - Reading 1 temp1 - UCH1 in0 temp2 0x04 (4) - UCH2 in1 temp3 0x08 (8) - UCH3 in2 temp4 0x10 (16) - UCH4 in3 temp5 0x20 (32) - UCH5 in4 temp6 0x40 (64) - 3.3V in5 - -As noted above, 5 of the sensors are "universal channels" and can -be set for either voltage or temperature. -Set the uch_config bit (in /proc) to 0 for voltage and 1 for temperature. -Voltages will read 0 if set for temperature. -Temperatures will read a really low number if set for voltage. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -PWM values are from 0 to 255. The first value in the /proc entry is -the pwm value; the second is the enable (0 or 1). - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.5 seconds since the last update). This means that you can easily -miss once-only alarms. - - -Chip Features -------------- - -Chip 'vt8231' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -in0 - - R- 2 -in1 - - R- 2 -in2 - - R- 2 -in3 - - R- 2 -in4 - - R- 2 -in5 - - R- 2 -in0_min in0 in0 RW 2 -in1_min in1 in1 RW 2 -in2_min in2 in2 RW 2 -in3_min in3 in3 RW 2 -in4_min in4 in4 RW 2 -in5_min in5 in5 RW 2 -in0_max in0 in0 RW 2 -in1_max in1 in1 RW 2 -in2_max in2 in2 RW 2 -in3_max in3 in3 RW 2 -in4_max in4 in4 RW 2 -in5_max in5 in5 RW 2 -fan1 - - R- 0 -fan2 - - R- 0 -fan1_min fan1 fan1 RW 0 -fan2_min fan2 fan2 RW 0 -temp1 - - R- 1 -temp1_hyst temp1 temp1 RW 1 -temp1_over temp1 temp1 RW 1 -temp2 - - R- 2 -temp2_hyst temp2 temp2 RW 2 -temp2_over temp2 temp2 RW 2 -temp3 - - R- 2 -temp3_hyst temp3 temp3 RW 2 -temp3_over temp3 temp3 RW 2 -temp4 - - R- 2 -temp4_hyst temp4 temp4 RW 2 -temp4_over temp4 temp4 RW 2 -temp5 - - R- 2 -temp5_hyst temp5 temp5 RW 2 -temp5_over temp5 temp5 RW 2 -temp6 - - R- 2 -temp6_hyst temp6 temp6 RW 2 -temp6_over temp6 temp6 RW 2 -fan1_div fan1 - RW 0 -fan2_div fan2 - RW 0 -alarms - - R- 0 -vid - - R- 3 -vrm - - RW 1 -config - - R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -in0 SENSORS_VT8231_IN0 in0:3 -in1 SENSORS_VT8231_IN1 in1:3 -in2 SENSORS_VT8231_IN2 in2:3 -in3 SENSORS_VT8231_IN3 in3:3 -in4 SENSORS_VT8231_IN4 in4:3 -in5 SENSORS_VT8231_IN5 in5:3 -in0_min SENSORS_VT8231_IN0_MIN in0:1 -in1_min SENSORS_VT8231_IN1_MIN in1:1 -in2_min SENSORS_VT8231_IN2_MIN in2:1 -in3_min SENSORS_VT8231_IN3_MIN in3:1 -in4_min SENSORS_VT8231_IN4_MIN in4:1 -in5_min SENSORS_VT8231_IN5_MIN in5:1 -in0_max SENSORS_VT8231_IN0_MAX in0:2 -in1_max SENSORS_VT8231_IN1_MAX in1:2 -in2_max SENSORS_VT8231_IN2_MAX in2:2 -in3_max SENSORS_VT8231_IN3_MAX in3:2 -in4_max SENSORS_VT8231_IN4_MAX in4:2 -in5_max SENSORS_VT8231_IN5_MAX in5:2 -fan1 SENSORS_VT8231_FAN1 fan1:2 -fan2 SENSORS_VT8231_FAN2 fan2:2 -fan1_min SENSORS_VT8231_FAN1_MIN fan1:1 -fan2_min SENSORS_VT8231_FAN2_MIN fan2:1 -temp1 SENSORS_VT8231_TEMP temp1:3 -temp1_hyst SENSORS_VT8231_TEMP_HYST temp1:2 -temp1_over SENSORS_VT8231_TEMP_OVER temp1:1 -temp2 SENSORS_VT8231_TEMP2 temp2:3 -temp2_hyst SENSORS_VT8231_TEMP2_HYST temp2:2 -temp2_over SENSORS_VT8231_TEMP2_OVER temp2:1 -temp3 SENSORS_VT8231_TEMP3 temp3:3 -temp3_hyst SENSORS_VT8231_TEMP3_HYST temp3:2 -temp3_over SENSORS_VT8231_TEMP3_OVER temp3:1 -temp4 SENSORS_VT8231_TEMP4 temp4:3 -temp4_hyst SENSORS_VT8231_TEMP4_HYST temp4:2 -temp4_over SENSORS_VT8231_TEMP4_OVER temp4:1 -temp5 SENSORS_VT8231_TEMP5 temp5:3 -temp5_hyst SENSORS_VT8231_TEMP5_HYST temp5:2 -temp5_over SENSORS_VT8231_TEMP5_OVER temp5:1 -temp6 SENSORS_VT8231_TEMP6 temp6:3 -temp6_hyst SENSORS_VT8231_TEMP6_HYST temp6:2 -temp6_over SENSORS_VT8231_TEMP6_OVER temp6:1 -fan1_div SENSORS_VT8231_FAN1_DIV fan_div:1 -fan2_div SENSORS_VT8231_FAN2_DIV fan_div:2 -alarms SENSORS_VT8231_ALARMS alarms:1 -vid SENSORS_VT8231_VID vid:1 -vrm SENSORS_VT8231_VRM vrm:1 -config SENSORS_VT8231_UCH uch_config:1 - - -Notes ------ - -The lm_sensors project gratefully acknowledges the support of VIA in the -development of this driver. diff --git a/doc/chips/w83627hf b/doc/chips/w83627hf deleted file mode 100644 index f9836f5d..00000000 --- a/doc/chips/w83627hf +++ /dev/null @@ -1,103 +0,0 @@ -Kernel driver `w83627hf.o' -========================= - -Status: Beta. - -Supported chips: - * Winbond W83627HF (ISA accesses ONLY) - Prefix: 'w83627hf' - Addresses scanned: ISA address retrieved from Super I/O registers - Datasheet: http://www.winbond.com/PDF/sheet/w83627hf.pdf - * Winbond W83627THF - Prefix: 'w83627thf' - Addresses scanned: ISA address retrieved from Super I/O registers - Datasheet: http://www.winbond.com/PDF/sheet/w83627thf.pdf - * Winbond W83697HF - Prefix: 'w83697hf' - Addresses scanned: ISA address retrieved from Super I/O registers - Datasheet: http://www.winbond.com/PDF/sheet/w83697hf.pdf - * Winbond W83637HF - 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 - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_addr: int - Initialize the ISA address of the sensors -* force_i2c: int - Initialize the I2C address of the sensors -* force_w83627hf: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `w83627hf' chip -* force_w83627thf: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `w83627thf' chip -* force_w83697hf: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `w83697hf' chip -* 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) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 -* init=[0,1] (default 1) - Use 'init=0' to bypass initializing the chip. - Try this if your computer crashes when you load the module. - - -Description ------------ - -This driver implements support for ISA accesses *only* for -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 -Super I/O chip and a second i2c-only Winbond chip (often a W83782D), -using this driver will avoid i2c address conflicts and complex -initialization that were required in the w83781d driver -(lm_sensors releases 2.7.0 and earlier). - -If you really want i2c accesses for these Super I/O chips, -use the w83781d driver. However this is not the preferred method -now that this ISA driver has been developed. - -The w83627_HF_ uses pins 110-106 as VID0-VID4. The w83627_THF_ uses the -same pins as GPIO[0:4]. Technically, the w83627_THF_ does not support a -VID reading. However the two chips have the identical 128 pin package. So, -it is possible or even likely for a w83627thf to have the VID signals routed -to these pins despite their not being labeled for that purpose. Therefore, -the w83627thf driver interprets these as VID. If the VID on your board -doesn't work, first see doc/vid. If that still doesn't help, you may just -ignore the bogus VID reading with no harm done. - -For further information on this driver, /proc values, etc. -see the w83781d driver documentation. - - -Author/Maintainer ------------------ -Mark D. Studebaker (mdsxyz123@yahoo.com). -Derived from the w83781d driver. diff --git a/doc/chips/w83781d b/doc/chips/w83781d deleted file mode 100644 index d1629186..00000000 --- a/doc/chips/w83781d +++ /dev/null @@ -1,799 +0,0 @@ -Kernel driver `w83781d.o' -========================= - -Status: W83781D support is complete and well-tested. - W83782D support is complete and well-tested. - W83783S support is complete but has not been well-tested. - W83791D support is BETA. - W83627HF support is complete but has not been well-tested. - AS99127F support is BETA and has known problems due to lack of a - chip datasheet. SEE BELOW. - -Supported chips: - * Winbond W83781D - Prefix: 'w83781d' - Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) - Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83781d.pdf - * Winbond W83782D - Prefix: 'w83782d' - Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) - Datasheet: http://www.winbond.com/PDF/sheet/w83782d.pdf - * Winbond W83783S - Prefix: 'w83783s' - Addresses scanned: I2C 0x2d - Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83783s.pdf - * Winbond W83791D - Prefix: 'w83791d' - Addresses scanned: I2C 0x2c - 0x2f - Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83791d.pdf - * Winbond W83627HF - Prefix: 'w83627hf' - Addresses scanned: I2C 0x20 - 0x2f, ISA 0x290 (8 I/O ports) - Datasheet: http://www.winbond.com/PDF/sheet/w83627hf.pdf - * Asus AS99127F - Prefix: 'as99127f' - Addresses scanned: I2C 0x28 - 0x2f - Datasheet: Unavailable from Asus - - - -Authors: Frodo Looijaard , Philip Edelbrock , - and Mark Studebaker - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_w83781d: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `w83781d' chip -* force_w83782d: - Ditto -* force_w83783s: - Ditto -* force_w83791d: - Ditto -* force_w83627hf: - Ditto -* force_as99127f: - Ditto -* force_subclients=bus,caddr,saddr,saddr - This is used to force the i2c addresses for subclients of - a certain chip. Typical usage is `force_subclients=0,0x2d,0x4a,0x4b' - to force the subclients of chip 0x2d on bus 0 to i2c addresses - 0x4a and 0x4b. - This parameter is useful for certain Tyan boards. -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* probe: short array (min = 1, max = 48) - 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 -* init=[0,1] (default 1) - Use 'init=0' to bypass initializing the chip. - Try this if your computer crashes when you load the module. - - -Description ------------ - -This driver implements support for the Winbond W83781D, W83782D, -W83783S, W83791D, W83627HF and W83698HF chips, and the Asus AS99127F chips. -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 ISA W83782D. -The Asus chips are similar 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 -of the chip, use a 'force' parameter; this will put them into a more -well-behaved state first. - -The W8378* implements temperature sensors (three on the W83781D and W83782D, -two on the W83783S), three fan rotation speed sensors, voltage sensors -(seven on the W83781D, nine on the W83782D and six on the W83783S), VID -lines, alarms with beep warnings, and some miscellaneous stuff. - -Temperatures are measured in degrees Celsius. There is always one main -temperature sensor, and one (W83783S) or two (W83781D and W83782D) other -sensors. An alarm is triggered for the main sensor once when the -Overtemperature Shutdown limit is crossed; it is triggered again as soon as -it drops below the Hysteresis value. A more useful behaviour -can be found by setting the Hysteresis value to +127 degrees Celsius; in -this case, alarms are issued during all the time when the actual temperature -is above the Overtemperature Shutdown value. The driver sets the -hysteresis value for temp1 to 127 at initialization. - -For the other temperature sensor(s), an -alarm is triggered when the temperature gets higher then the Overtemperature -Shutdown value; it stays on until the temperature falls below the Hysteresis -value. But on the W83781D, there is only one alarm that functions for both -other sensors! Temperatures are guaranteed within a range of -55 to +125 -degrees. The main temperature sensors has a resolution of 1 degree; the other -sensor(s) of 0.5 degree. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4 or 8 for the -W83781D; 1, 2, 4, 8, 16, 32, 64 or 128 for the others) to give -the readings more range or accuracy. Not all RPM values can accurately be -represented, so some rounding is done. With a divider of 2, the lowest -representable value is around 2600 RPM. - -Voltage sensors (also known as IN sensors) report their values in volts. -An alarm is triggered if the voltage has crossed a programmable minimum -or maximum limit. Note that minimum in this case always means 'closest to -zero'; this is important for negative voltage measurements. All voltage -inputs can measure voltages between 0 and 4.08 volts, with a resolution -of 0.016 volt. - -The VID lines encode the core voltage value: the voltage level your processor -should work with. This is hardcoded by the mainboard and/or processor itself. -It is a value in volts. When it is unconnected, you will often find the -value 3.50 V here. - -The W83782D and W83783S temperature conversion machine understands about -several kinds of temperature probes. You can program the so-called -beta value in the sensor files. '1' is the PII/Celeron diode, '2' is the -TN3904 transistor, and 3435 the default thermistor value. Other values -are (not yet) supported. You can program your own values through the -rt interface, but this is not very useful, because these tables are -under NDA. - -In addition to the alarms described above, there is a CHAS alarm on the -chips which triggers if your computer case is open. - -When an alarm goes off, you can be warned by a beeping signal through -your computer speaker. It is possible to enable all beeping globally, -or only the beeping for some alarms. - -Individual alarm and beep bits: - -0x000001: in0 -0x000002: in1 -0x000004: in2 -0x000008: in3 -0x000010: temp1 -0x000020: temp2 (+temp3 on W83781D) -0x000040: fan1 -0x000080: fan2 -0x000100: in4 -0x000200: in5 -0x000400: in6 -0x000800: fan3 -0x001000: chassis -0x002000: temp3 (W83782D and W83627HF only) -0x010000: in7 (W83782D and W83627HF only) -0x020000: in8 (W83782D and W83627HF only) - -If an alarm triggers, it will remain triggered until the hardware register -is read at least once. This means that the cause for the alarm may -already have disappeared! Note that in the current implementation, all -hardware registers are read whenever any data is read (unless it is less -than 1.5 seconds since the last update). This means that you can easily -miss once-only alarms. - -The chips only update values each 1.5 seconds; reading them more often -will do no harm, but will return 'old' values. - - -AS99127F PROBLEMS ------------------ -The as99127f support was developed without the benefit of a datasheet. -In most cases it is treated as a w83781d (although revision 2 of the -AS9917F looks more like a w83782d). -This support will be BETA until a datasheet is released. -One user has reported problems with fans stopping -occasionally. - -Note that the individual beep bits are inverted from the other chips. -The driver now takes care of this so that user-space applications -don't have to know about it. - -Known problems: - - Problems with diode/thermistor settings (supported?) - - One user reports fans stopping under high server load. - - Revision 2 seems to have 2 PWM registers but we don't know - how to handle them. More details below. - -These will not be fixed unless we get a datasheet. -If you have problems, please lobby Asus to release a datasheet. -Unfortunately several others have without success. -Please do not send mail to us asking for better as99127f support. -We have done the best we can without a datasheet. -Please do not send mail to the author or the sensors group asking for -a datasheet or ideas on how to convince Asus. We can't help. - - -Chip Features -------------- - -Chip `w83781d' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in5 NONE NONE R 2 - in6 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in4 in4 RW 2 - in5_min in5 in5 RW 2 - in6_min in6 in6 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in4 in4 RW 2 - in5_max in5 in5 RW 2 - in6_max in6 in6 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan1_min fan1 NONE RW 0 - fan2_min fan2 NONE RW 0 - fan3_min fan3 NONE RW 0 - temp1 NONE NONE R 1 - temp1_hyst temp1 temp1 RW 1 - temp1_over temp1 temp1 RW 1 - temp2 NONE NONE R 1 - temp2_hyst temp2 temp2 RW 1 - temp2_over temp2 temp2 RW 1 - temp3 NONE NONE R 1 - temp3_hyst temp3 temp3 RW 1 - temp3_over temp3 temp3 RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - fan3_div fan3 NONE R 0 - alarms NONE NONE R 0 - beep_enable alarms NONE RW 0 - beeps alarms alarms RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - in0 SENSORS_W83781D_IN0 in0:3 - in1 SENSORS_W83781D_IN1 in1:3 - in2 SENSORS_W83781D_IN2 in2:3 - in3 SENSORS_W83781D_IN3 in3:3 - in4 SENSORS_W83781D_IN4 in4:3 - in5 SENSORS_W83781D_IN5 in5:3 - in6 SENSORS_W83781D_IN6 in6:3 - in0_min SENSORS_W83781D_IN0_MIN in0:1 - in1_min SENSORS_W83781D_IN1_MIN in1:1 - in2_min SENSORS_W83781D_IN2_MIN in2:1 - in3_min SENSORS_W83781D_IN3_MIN in3:1 - in4_min SENSORS_W83781D_IN4_MIN in4:1 - in5_min SENSORS_W83781D_IN5_MIN in5:1 - in6_min SENSORS_W83781D_IN6_MIN in6:1 - in0_max SENSORS_W83781D_IN0_MAX in0:2 - in1_max SENSORS_W83781D_IN1_MAX in1:2 - in2_max SENSORS_W83781D_IN2_MAX in2:2 - in3_max SENSORS_W83781D_IN3_MAX in3:2 - in4_max SENSORS_W83781D_IN4_MAX in4:2 - in5_max SENSORS_W83781D_IN5_MAX in5:2 - in6_max SENSORS_W83781D_IN6_MAX in6:2 - fan1 SENSORS_W83781D_FAN1 fan1:2 - fan2 SENSORS_W83781D_FAN2 fan2:2 - fan3 SENSORS_W83781D_FAN3 fan3:2 - fan1_min SENSORS_W83781D_FAN1_MIN fan1:1 - fan2_min SENSORS_W83781D_FAN2_MIN fan2:1 - fan3_min SENSORS_W83781D_FAN3_MIN fan3:1 - temp1 SENSORS_W83781D_TEMP1 temp1:3 - temp1_hyst SENSORS_W83781D_TEMP1_HYST temp1:2 - temp1_over SENSORS_W83781D_TEMP1_OVER temp1:1 - temp2 SENSORS_W83781D_TEMP2 temp2:3 - temp2_hyst SENSORS_W83781D_TEMP2_HYST temp2:2 - temp2_over SENSORS_W83781D_TEMP2_OVER temp2:1 - temp3 SENSORS_W83781D_TEMP3 temp3:3 - temp3_hyst SENSORS_W83781D_TEMP3_HYST temp3:2 - temp3_over SENSORS_W83781D_TEMP3_OVER temp3:1 - vid SENSORS_W83781D_VID vid:1 - fan1_div SENSORS_W83781D_FAN1_DIV fan_div:1 - fan2_div SENSORS_W83781D_FAN2_DIV fan_div:2 - fan3_div SENSORS_W83781D_FAN3_DIV fan_div:3 - alarms SENSORS_W83781D_ALARMS alarms:1 - beep_enable SENSORS_W83781D_BEEP_ENABLE beep:1 - beeps SENSORS_W83781D_BEEPS beep:2 - - -Chip `w83782d' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in5 NONE NONE R 2 - in6 NONE NONE R 2 - in7 NONE NONE R 2 - in8 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in4 in4 RW 2 - in5_min in5 in5 RW 2 - in6_min in6 in6 RW 2 - in7_min in7 in7 RW 2 - in8_min in8 in8 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in4 in4 RW 2 - in5_max in5 in5 RW 2 - in6_max in6 in6 RW 2 - in7_max in7 in7 RW 2 - in8_max in8 in8 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan1_min fan1 NONE RW 0 - fan2_min fan2 NONE RW 0 - fan3_min fan3 NONE RW 0 - temp1 NONE NONE R 1 - temp1_hyst temp1 temp1 RW 1 - temp1_over temp1 temp1 RW 1 - temp2 NONE NONE R 1 - temp2_hyst temp2 temp2 RW 1 - temp2_over temp2 temp2 RW 1 - temp3 NONE NONE R 1 - temp3_hyst temp3 temp3 RW 1 - temp3_over temp3 temp3 RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - fan3_div fan3 NONE R 0 - alarms NONE NONE R 0 - beep_enable alarms NONE RW 0 - beeps alarms alarms RW 0 - sensor1 NONE NONE RW 0 - sensor2 NONE NONE RW 0 - sensor3 NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - in0 SENSORS_W83782D_IN0 in0:3 - in1 SENSORS_W83782D_IN1 in1:3 - in2 SENSORS_W83782D_IN2 in2:3 - in3 SENSORS_W83782D_IN3 in3:3 - in4 SENSORS_W83782D_IN4 in4:3 - in5 SENSORS_W83782D_IN5 in5:3 - in6 SENSORS_W83782D_IN6 in6:3 - in7 SENSORS_W83782D_IN7 in7:3 - in8 SENSORS_W83782D_IN8 in8:3 - in0_min SENSORS_W83782D_IN0_MIN in0:1 - in1_min SENSORS_W83782D_IN1_MIN in1:1 - in2_min SENSORS_W83782D_IN2_MIN in2:1 - in3_min SENSORS_W83782D_IN3_MIN in3:1 - in4_min SENSORS_W83782D_IN4_MIN in4:1 - in5_min SENSORS_W83782D_IN5_MIN in5:1 - in6_min SENSORS_W83782D_IN6_MIN in6:1 - in7_min SENSORS_W83782D_IN7_MIN in7:1 - in8_min SENSORS_W83782D_IN8_MIN in8:1 - in0_max SENSORS_W83782D_IN0_MAX in0:2 - in1_max SENSORS_W83782D_IN1_MAX in1:2 - in2_max SENSORS_W83782D_IN2_MAX in2:2 - in3_max SENSORS_W83782D_IN3_MAX in3:2 - in4_max SENSORS_W83782D_IN4_MAX in4:2 - in5_max SENSORS_W83782D_IN5_MAX in5:2 - in6_max SENSORS_W83782D_IN6_MAX in6:2 - in7_max SENSORS_W83782D_IN7_MAX in7:2 - in8_max SENSORS_W83782D_IN8_MAX in8:2 - fan1 SENSORS_W83782D_FAN1 fan1:2 - fan2 SENSORS_W83782D_FAN2 fan2:2 - fan3 SENSORS_W83781D_FAN3 fan3:2 - fan1_min SENSORS_W83782D_FAN1_MIN fan1:1 - fan2_min SENSORS_W83782D_FAN2_MIN fan2:1 - fan3_min SENSORS_W83781D_FAN3_MIN fan3:1 - temp1 SENSORS_W83782D_TEMP1 temp1:3 - temp1_hyst SENSORS_W83782D_TEMP1_HYST temp1:2 - temp1_over SENSORS_W83782D_TEMP1_OVER temp1:1 - temp2 SENSORS_W83782D_TEMP2 temp2:3 - temp2_hyst SENSORS_W83782D_TEMP2_HYST temp2:2 - temp2_over SENSORS_W83782D_TEMP2_OVER temp2:1 - temp3 SENSORS_W83782D_TEMP3 temp3:3 - temp3_hyst SENSORS_W83782D_TEMP3_HYST temp3:2 - temp3_over SENSORS_W83782D_TEMP3_OVER temp3:1 - vid SENSORS_W83782D_VID vid:1 - fan1_div SENSORS_W83782D_FAN1_DIV fan_div:1 - fan2_div SENSORS_W83782D_FAN2_DIV fan_div:2 - fan3_div SENSORS_W83781D_FAN3_DIV fan_div:3 - alarms SENSORS_W83782D_ALARMS alarms:1 - beep_enable SENSORS_W83782D_BEEP_ENABLE beep:1 - beeps SENSORS_W83782D_BEEPS beep:2 - sensor1 SENSORS_W83782D_SENS1 sensor1:1 - sensor2 SENSORS_W83782D_SENS2 sensor2:1 - sensor3 SENSORS_W83782D_SENS3 sensor3:1 - - -Chip `w83783s' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 2 - in1 NONE NONE R 2 - in2 NONE NONE R 2 - in3 NONE NONE R 2 - in4 NONE NONE R 2 - in5 NONE NONE R 2 - in6 NONE NONE R 2 - in0_min in0 in0 RW 2 - in1_min in1 in1 RW 2 - in2_min in2 in2 RW 2 - in3_min in3 in3 RW 2 - in4_min in4 in4 RW 2 - in5_min in5 in5 RW 2 - in6_min in6 in6 RW 2 - in0_max in0 in0 RW 2 - in1_max in1 in1 RW 2 - in2_max in2 in2 RW 2 - in3_max in3 in3 RW 2 - in4_max in4 in4 RW 2 - in5_max in5 in5 RW 2 - in6_max in6 in6 RW 2 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan1_min fan1 NONE RW 0 - fan2_min fan2 NONE RW 0 - fan3_min fan3 NONE RW 0 - temp1 NONE NONE R 1 - temp1_hyst temp1 temp1 RW 1 - temp1_over temp1 temp1 RW 1 - temp2 NONE NONE R 1 - temp2_hyst temp2 temp2 RW 1 - temp2_over temp2 temp2 RW 1 - vid NONE NONE R 2 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - fan3_div fan3 NONE R 0 - alarms NONE NONE R 0 - beep_enable alarms NONE RW 0 - beeps alarms alarms RW 0 - sensor1 NONE NONE RW 0 - sensor2 NONE NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - in0 SENSORS_W83783S_IN0 in0:3 - in1 SENSORS_W83783S_IN1 in1:3 - in2 SENSORS_W83783S_IN2 in2:3 - in3 SENSORS_W83783S_IN3 in3:3 - in4 SENSORS_W83783S_IN4 in4:3 - in5 SENSORS_W83783S_IN5 in5:3 - in6 SENSORS_W83783S_IN6 in6:3 - in0_min SENSORS_W83783S_IN0_MIN in0:1 - in1_min SENSORS_W83783S_IN1_MIN in1:1 - in2_min SENSORS_W83783S_IN2_MIN in2:1 - in3_min SENSORS_W83783S_IN3_MIN in3:1 - in4_min SENSORS_W83783S_IN4_MIN in4:1 - in5_min SENSORS_W83783S_IN5_MIN in5:1 - in6_min SENSORS_W83783S_IN6_MIN in6:1 - in0_max SENSORS_W83783S_IN0_MAX in0:2 - in1_max SENSORS_W83783S_IN1_MAX in1:2 - in2_max SENSORS_W83783S_IN2_MAX in2:2 - in3_max SENSORS_W83783S_IN3_MAX in3:2 - in4_max SENSORS_W83783S_IN4_MAX in4:2 - in5_max SENSORS_W83783S_IN5_MAX in5:2 - in6_max SENSORS_W83783S_IN6_MAX in6:2 - fan1 SENSORS_W83783S_FAN1 fan1:2 - fan2 SENSORS_W83783S_FAN2 fan2:2 - fan3 SENSORS_W83783S_FAN3 fan3:2 - fan1_min SENSORS_W83783S_FAN1_MIN fan1:1 - fan2_min SENSORS_W83783S_FAN2_MIN fan2:1 - fan3_min SENSORS_W83783S_FAN3_MIN fan3:1 - temp1 SENSORS_W83783S_TEMP1 temp1:3 - temp1_hyst SENSORS_W83783S_TEMP1_HYST temp1:2 - temp1_over SENSORS_W83783S_TEMP1_OVER temp1:1 - temp2 SENSORS_W83783S_TEMP2 temp2:3 - temp2_hyst SENSORS_W83783S_TEMP2_HYST temp2:2 - temp2_over SENSORS_W83783S_TEMP2_OVER temp2:1 - vid SENSORS_W83783S_VID vid:1 - fan1_div SENSORS_W83783S_FAN1_DIV fan_div:1 - fan2_div SENSORS_W83783S_FAN2_DIV fan_div:2 - fan3_div SENSORS_W83783S_FAN3_DIV fan_div:3 - alarms SENSORS_W83783S_ALARMS alarms:1 - beep_enable SENSORS_W83783S_BEEP_ENABLE beep:1 - beeps SENSORS_W83783S_BEEPS beep:2 - sensor1 SENSORS_W83783S_SENS1 sensor1:1 - sensor2 SENSORS_W83783S_SENS2 sensor2:1 - - - -Miscellaneous documentation -=========================== - - - -/PROC ENTRIES -------------- -Varies depending on chip type. Most are identical to the lm78 entries. -See the lm78 documentation for details. - -Additional entries not in the lm78: - - pwm[1-4]: (not on w83781d nor as99127f) - Controls the speed of the fans with PWM (Pulse Width Modulation) - Valid values: - 0 - 255. 255 = max speed. - Second value is PWM enable 0/1. - - sensor[1-3]: (not on w83781d nor as99127f) - Controls the sensor type. To change to a different - sensor type, for example, do 'echo 2 > sensor1'. - Valid values: - 1: Pentium II / Celeron diode - 2: 2N3904 Transistor in a diode configuration - 3435: Thermistor with Beta = 3435. Beta is a measure - of sensitivity to temperature. - Thermistors with other Betas could in theory be supported - after correspondence with Winbond. See below. - - rt[1-3]: (w83781d only) - 32-byte tables controlling the conversion from - resistance to temperature for thermistors. - For the curious only. Writing to these entries will - probably render temperature sensing insane. - Only set at initialization; not updated every 1.5 seconds. - - - -TO DO: ------ - 782d programmable pins - - -NOTES: ------ - 783s has no in1 so that in[2-6] are compatible with the 781d/782d. - - 783s pin is programmable for -5V or temp1; defaults to -5V, - no control in driver so temp1 doesn't work. - - 782d and 783s datasheets differ on which is pwm1 and which is pwm2. - We chose to follow 782d. - - 782d and 783s pin is programmable for fan3 input or pwm2 output; - defaults to fan3 input. - If pwm2 is enabled (with echo 255 1 > pwm2), then - fan3 will report 0. - - 782d has pwm1-2 for isa, pwm1-4 for i2c. (pwm3-4 share pins with - the isa pins) - - - -Data sheet updates: ------------------- - - PWM clock registers: - - 000: master / 512 - 001: master / 1024 - 010: master / 2048 - 011: master / 4096 - 100: master / 8192 - - -Answers from Winbond tech support ---------------------------------- -> -> 1) In the W83781D data sheet section 7.2 last paragraph, it talks about -> reprogramming the R-T table if the Beta of the thermistor is not -> 3435K. The R-T table is described briefly in section 8.20. -> What formulas do I use to program a new R-T table for a given Beta? -> - We are sorry that the calculation for R-T table value is -confidential. If you have another Beta value of thermistor, we can help -to calculate the R-T table for you. But you should give us real R-T -Table which can be gotten by thermistor vendor. Therefore we will calculate -them and obtain 32-byte data, and you can fill the 32-byte data to the -register in Bank0.CR51 of W83781D. - - -> 2) In the W83782D data sheet, it mentions that pins 38, 39, and 40 are -> programmable to be either thermistor or Pentium II diode inputs. -> How do I program them for diode inputs? I can't find any register -> to program these to be diode inputs. - --> You may program Bank0 CR[5Dh] and CR[59h] registers. - - CR[5Dh] bit 1(VTIN1) bit 2(VTIN2) bit 3(VTIN3) - - thermistor 0 0 0 - diode 1 1 1 - - -(error) CR[59h] bit 4(VTIN1) bit 2(VTIN2) bit 3(VTIN3) -(right) CR[59h] bit 4(VTIN1) bit 5(VTIN2) bit 6(VTIN3) - - PII thermal diode 1 1 1 - 2N3904 diode 0 0 0 - - -Author/Maintainer ------------------ -Original 781D support: Frodo and Phil -782D/783S support added by: Mark D. Studebaker (mdsxyz123@yahoo.com) - - -Asus Clones ------------ - -We have no datasheets for the Asus clones (AS99127F and ASB100 Bach). -Here are some very useful information that were given to us by Alex Van -Kaam about how to detect these chips, and how to read their values. He -also gives advice for another Asus chipset, the Mozart-2 (which we -don't support yet). Thanks Alex! -I reworded some parts and added personal comments. - -# Detection: - -AS99127F rev.1, AS99127F rev.2 and ASB100: -- I2C address range: 0x29 - 0x2F -- If register 0x58 holds 0x31 then we have an Asus (either ASB100 or - AS99127F) -- Which one depends on register 0x4F (manufacturer ID): - 0x06 or 0x94: ASB100 - 0x12 or 0xC3: AS99127F rev.1 - 0x5C or 0xA3: AS99127F rev.2 - Note that 0x5CA3 is Winbond's ID (WEC), which let us think Asus get their - AS99127F rev.2 direct from Winbond. The other codes mean ATT and DVC, - respectively. ATT could stand for Asustek something (although it would be - very badly chosen IMHO), I don't know what DVC could stand for. Maybe - these codes simply aren't meant to be decoded that way. - -Mozart-2: -- I2C address: 0x77 -- If register 0x58 holds 0x56 or 0x10 then we have a Mozart-2 -- Of the mozart there are 3 types: - 0x58=0x56, 0x4E=0x94, 0x4F=0x36: Asus ASM58 Mozart-2 - 0x58=0x56, 0x4E=0x94, 0x4F=0x06: Asus AS2K129R Mozart-2 - 0x58=0x10, 0x4E=0x5C, 0x4F=0xA3: Asus ??? Mozart-2 - You can handle all 3 the exact same way :) - -# Temperature sensors: - -ASB100: -- sensor 1: register 0x27 -- sensor 2 & 3 are the 2 LM75's on the SMBus -- sensor 4: register 0x17 -Remark: I noticed that on Intel boards sensor 2 is used for the CPU - and 4 is ignored/stuck, on AMD boards sensor 4 is the CPU and sensor 2 is - either ignored or a socket temperature. - -AS99127F (rev.1 and 2 alike): -- sensor 1: register 0x27 -- sensor 2 & 3 are the 2 LM75's on the SMBus -Remark: Register 0x5b is suspected to be temperature type selector. Bit 1 - would control temp1, bit 3 temp2 and bit 5 temp3. - -Mozart-2: -- sensor 1: register 0x27 -- sensor 2: register 0x13 - -# Fan sensors: - -ASB100, AS99127F (rev.1 and 2 alike): -- 3 fans, identical to the W83781D - -Mozart-2: -- 2 fans only, 1350000/rpm/div -- fan 1: register 0x28, divisor on register 0xA1 (bits 4-5) -- fan 2: register 0x29, divisor on register 0xA1 (bits 6-7) - -# Voltages: - -This is where there is a difference between AS99127F rev.1 and 2. -Remark: The difference is similar to the difference between - W83781D and W83782D. - -ASB100: -in0=r(0x20)*0.016 -in1=r(0x21)*0.016 -in2=r(0x22)*0.016 -in3=r(0x23)*0.016*1.68 -in4=r(0x24)*0.016*3.8 -in5=r(0x25)*(-0.016)*3.97 -in6=r(0x26)*(-0.016)*1.666 - -AS99127F rev.1: -in0=r(0x20)*0.016 -in1=r(0x21)*0.016 -in2=r(0x22)*0.016 -in3=r(0x23)*0.016*1.68 -in4=r(0x24)*0.016*3.8 -in5=r(0x25)*(-0.016)*3.97 -in6=r(0x26)*(-0.016)*1.503 - -AS99127F rev.2: -in0=r(0x20)*0.016 -in1=r(0x21)*0.016 -in2=r(0x22)*0.016 -in3=r(0x23)*0.016*1.68 -in4=r(0x24)*0.016*3.8 -in5=(r(0x25)*0.016-3.6)*5.14+3.6 -in6=(r(0x26)*0.016-3.6)*3.14+3.6 - -Mozart-2: -in0=r(0x20)*0.016 -in1=255 -in2=r(0x22)*0.016 -in3=r(0x23)*0.016*1.68 -in4=r(0x24)*0.016*4 -in5=255 -in6=255 - - -# PWM - -Additional info about PWM on the AS99127F (may apply to other Asus -chips as well) by Jean Delvare as of 2004-04-09: - -AS99127F revision 2 seems to have two PWM registers at 0x59 and 0x5A, -and a temperature sensor type selector at 0x5B (which basically means -that they swapped registers 0x59 and 0x5B when you compare with Winbond -chips). -Revision 1 of the chip also has the temperature sensor type selector at -0x5B, but PWM registers have no effect. - -We don't know exactly how the temperature sensor type selection works. -Looks like bits 1-0 are for temp1, bits 3-2 for temp2 and bits 5-4 for -temp3, although it is possible that only the most significant bit matters -each time. So far, values other than 0 always broke the readings. - -PWM registers seem to be split in two parts: bit 7 is a mode selector, -while the other bits seem to define a value or threshold. - -When bit 7 is clear, bits 6-0 seem to hold a threshold value. If the value -is below a given limit, the fan runs at low speed. If the value is above -the limit, the fan runs at full speed. We have no clue as to what the limit -represents. Note that there seem to be some inertia in this mode, speed -changes may need some time to trigger. Also, an hysteresis mechanism is -suspected since walking through all the values increasingly and then -decreasingly led to slightly different limits. - -When bit 7 is set, bits 3-0 seem to hold a threshold value, while bits 6-4 -would not be significant. If the value is below a given limit, the fan runs -at full speed, while if it is above the limit it runs at low speed (so this -is the contrary of the other mode, in a way). Here again, we don't know -what the limit is supposed to represent. - -One remarkable thing is that the fans would only have two or three -different speeds (transitional states left apart), not a whole range as -you usually get with PWM. - -As a conclusion, you can write 0x00 or 0x8F to the PWM registers to make -fans run at low speed, and 0x7F or 0x80 to make them run at full speed. - -Please contact us if you can figure out how it is supposed to work. As -long as we don't know more, the w83781d driver doesn't handle PWM on -AS99127F chips at all. - -Additional info about PWM on the AS99127F rev.1 by Hector Martin: - -I've been fiddling around with the (in)famous 0x59 register and -found out the following values do work as a form of coarse pwm: - -0x80 - seems to turn fans off after some time(1-2 minutes)... might be -some form of auto-fan-control based on temp? hmm (Qfan? this mobo is an -old ASUS, it isn't marketed as Qfan. Maybe some beta pre-attempt at Qfan -that was dropped at the BIOS) -0x81 - off -0x82 - slightly "on-ner" than off, but my fans do not get to move. I can -hear the high-pitched PWM sound that motors give off at too-low-pwm. -0x83 - now they do move. Estimate about 70% speed or so. -0x84-0x8f - full on - -Changing the high nibble doesn't seem to do much except the high bit -(0x80) must be set for PWM to work, else the current pwm doesn't seem to -change. - -My mobo is an ASUS A7V266-E. This behaviour is similar to what I got -with speedfan under Windows, where 0-15% would be off, 15-2x% (can't -remember the exact value) would be 70% and higher would be full on. diff --git a/doc/chips/w83792d b/doc/chips/w83792d deleted file mode 100644 index 046692e8..00000000 --- a/doc/chips/w83792d +++ /dev/null @@ -1,298 +0,0 @@ -Kernel driver `w83792d.o' -========================= - -Status: W83792D support is complete and well-tested. - - -Supported chips: - * Winbond W83792D - Prefix: 'w83792d' - Addresses scanned: I2C 0x2c - 0x2f - Datasheet: http://www.winbond.com.tw/E-WINBONDHTM/partner/PDFresult.asp?Pname=1035 - -Author: Chunhao Huang -Contact: DZShen - - -Module Parameters ------------------ - -* init int - (default 1) - Use 'init=0' to bypass initializing the chip. - Try this if your computer crashes when you load the module. - -* force_subclients=bus,caddr,saddr,saddr - This is used to force the i2c addresses for subclients of - a certain chip. Example usage is `force_subclients=0,0x2f,0x4a,0x4b' - to force the subclients of chip 0x2f on bus 0 to i2c addresses - 0x4a and 0x4b. - - -Description ------------ - -This driver implements support for the Winbond W83792AD/D. - -Detection of the chip can sometimes be foiled because it can be in an -internal state that allows no clean access (Bank with ID register is not -currently selected). If you know the address of the chip, use a 'force' -parameter; this will put it into a more well-behaved state first. - -The driver implements three temperature sensors, seven fan rotation speed -sensors, nine voltage sensors, and two automatic fan regulation -strategies called: Smart Fan I (Thermal Cruise mode) and Smart Fan II. -Automatic fan control mode is possible only for fan1-fan3. Fan4-fan7 can run -synchronized with selected fan (fan1-fan3). This functionality and manual PWM -control for fan4-fan7 is not yet implemented. - -Temperatures are measured in degrees Celsius and measurement resolution is 1 -degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when -the temperature gets higher than the Overtemperature Shutdown value; it stays -on until the temperature falls below the Hysteresis value. - -Fan rotation speeds are reported in RPM (rotations per minute). An alarm is -triggered if the rotation speed has dropped below a programmable limit. Fan -readings can be divided by a programmable divider (1, 2, 4, 8, 16, 32, 64 or -128) to give the readings more range or accuracy. This driver modifies the -fan divisor automatically to get the reasonable RPM rotation range. - -Voltage sensors (also known as IN sensors) report their values in volts. -An alarm is triggered if the voltage has crossed a programmable minimum -or maximum limit. - -Alarms are provided as output from "realtime status register". Following bits -are defined: - -bit - alarm on: -0 - in0 -1 - in1 -2 - temp1 -3 - temp2 -4 - temp3 -5 - fan1 -6 - fan2 -7 - fan3 -8 - in2 -9 - in3 -10 - in4 -11 - in5 -12 - in6 -13 - VID change -14 - chassis -15 - fan7 -16 - tart1 -17 - tart2 -18 - tart3 -19 - in7 -20 - in8 -21 - fan4 -22 - fan5 -23 - fan6 - -Tart will be asserted while target temperature cannot be achieved after 3 minutes -of full speed rotation of corresponding fan. - -In addition to the alarms described above, there is a CHAS alarm on the chips -which triggers if your computer case is open (This one is latched, contrary -to realtime alarms). - -The chips only update values each 3 seconds; reading them more often will -do no harm, but will return 'old' values. - - -W83792D PROBLEMS ----------------- -Known problems: - - This driver is only for Winbond W83792D C version device, there - are also some motherboards with B version W83792D device. The - calculation method to in6-in7(measured value, limits) is a little - different between C and B version. C or B version can be identified - by CR[0x49h]. - - The function of vid and vrm has not been finished, because I'm NOT - very familiar with them. Adding support is welcome. - - The function of chassis open detection needs more tests. - - If you have ASUS server board and chip was not found: Then you will - need to upgrade to latest (or beta) BIOS. If it does not help please - contact us. - - -Chip Features -------------- - -Chip `w83792d' - LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE - in0 NONE NONE R 3 - in1 NONE NONE R 3 - in2 NONE NONE R 3 - in3 NONE NONE R 3 - in4 NONE NONE R 3 - in5 NONE NONE R 3 - in6 NONE NONE R 3 - in7 NONE NONE R 3 - in8 NONE NONE R 3 - in0_min in0 in0 RW 3 - in1_min in1 in1 RW 3 - in2_min in2 in2 RW 3 - in3_min in3 in3 RW 3 - in4_min in4 in4 RW 3 - in5_min in5 in5 RW 3 - in6_min in6 in6 RW 3 - in7_min in7 in7 RW 3 - in8_min in8 in8 RW 3 - in0_max in0 in0 RW 3 - in1_max in1 in1 RW 3 - in2_max in2 in2 RW 3 - in3_max in3 in3 RW 3 - in4_max in4 in4 RW 3 - in5_max in5 in5 RW 3 - in6_max in6 in6 RW 3 - in7_max in7 in7 RW 3 - in8_max in8 in8 RW 3 - fan1 NONE NONE R 0 - fan2 NONE NONE R 0 - fan3 NONE NONE R 0 - fan4 NONE NONE R 0 - fan5 NONE NONE R 0 - fan6 NONE NONE R 0 - fan7 NONE NONE R 0 - fan1_min fan1 NONE RW 0 - fan2_min fan2 NONE RW 0 - fan3_min fan3 NONE RW 0 - fan4_min fan4 NONE RW 0 - fan5_min fan5 NONE RW 0 - fan6_min fan6 NONE RW 0 - fan7_min fan7 NONE RW 0 - temp1 NONE NONE R 1 - temp1_hyst temp1 temp1 RW 1 - temp1_over temp1 temp1 RW 1 - temp2 NONE NONE R 1 - temp2_hyst temp2 temp2 RW 1 - temp2_over temp2 temp2 RW 1 - temp3 NONE NONE R 1 - temp3_hyst temp3 temp3 RW 1 - temp3_over temp3 temp3 RW 1 - fan1_div fan1 NONE RW 0 - fan2_div fan2 NONE RW 0 - fan3_div fan3 NONE RW 0 - fan4_div fan4 NONE RW 0 - fan5_div fan5 NONE RW 0 - fan6_div fan6 NONE RW 0 - fan7_div fan7 NONE RW 0 - - LABEL FEATURE SYMBOL SYSCTL FILE:NR - in0 SENSORS_W83792D_IN0 in0:3 - in1 SENSORS_W83792D_IN1 in1:3 - in2 SENSORS_W83792D_IN2 in2:3 - in3 SENSORS_W83792D_IN3 in3:3 - in4 SENSORS_W83792D_IN4 in4:3 - in5 SENSORS_W83792D_IN5 in5:3 - in6 SENSORS_W83792D_IN6 in6:3 - in7 SENSORS_W83792D_IN7 in7:3 - in8 SENSORS_W83792D_IN8 in8:3 - in0_min SENSORS_W83792D_IN0_MIN in0:1 - in1_min SENSORS_W83792D_IN1_MIN in1:1 - in2_min SENSORS_W83792D_IN2_MIN in2:1 - in3_min SENSORS_W83792D_IN3_MIN in3:1 - in4_min SENSORS_W83792D_IN4_MIN in4:1 - in5_min SENSORS_W83792D_IN5_MIN in5:1 - in6_min SENSORS_W83792D_IN6_MIN in6:1 - in7_min SENSORS_W83792D_IN7_MIN in7:1 - in8_min SENSORS_W83792D_IN8_MIN in8:1 - in0_max SENSORS_W83792D_IN0_MAX in0:2 - in1_max SENSORS_W83792D_IN1_MAX in1:2 - in2_max SENSORS_W83792D_IN2_MAX in2:2 - in3_max SENSORS_W83792D_IN3_MAX in3:2 - in4_max SENSORS_W83792D_IN4_MAX in4:2 - in5_max SENSORS_W83792D_IN5_MAX in5:2 - in6_max SENSORS_W83792D_IN6_MAX in6:2 - in7_max SENSORS_W83792D_IN7_MAX in7:2 - in8_max SENSORS_W83792D_IN8_MAX in8:2 - fan1 SENSORS_W83792D_FAN1 fan1:2 - fan2 SENSORS_W83792D_FAN2 fan2:2 - fan3 SENSORS_W83792D_FAN3 fan3:2 - fan4 SENSORS_W83792D_FAN4 fan4:2 - fan5 SENSORS_W83792D_FAN5 fan5:2 - fan6 SENSORS_W83792D_FAN6 fan6:2 - fan7 SENSORS_W83792D_FAN7 fan7:2 - fan1_min SENSORS_W83792D_FAN1_MIN fan1:1 - fan2_min SENSORS_W83792D_FAN2_MIN fan2:1 - fan3_min SENSORS_W83792D_FAN3_MIN fan3:1 - fan4_min SENSORS_W83792D_FAN4_MIN fan4:1 - fan5_min SENSORS_W83792D_FAN5_MIN fan5:1 - fan6_min SENSORS_W83792D_FAN6_MIN fan6:1 - fan7_min SENSORS_W83792D_FAN7_MIN fan7:1 - temp1 SENSORS_W83792D_TEMP1 temp1:3 - temp1_hyst SENSORS_W83792D_TEMP1_HYST temp1:2 - temp1_over SENSORS_W83792D_TEMP1_OVER temp1:1 - temp2 SENSORS_W83792D_TEMP2 temp2:3 - temp2_hyst SENSORS_W83792D_TEMP2_HYST temp2:2 - temp2_over SENSORS_W83792D_TEMP2_OVER temp2:1 - temp3 SENSORS_W83792D_TEMP3 temp3:3 - temp3_hyst SENSORS_W83792D_TEMP3_HYST temp3:2 - temp3_over SENSORS_W83792D_TEMP3_OVER temp3:1 - fan1_div SENSORS_W83792D_FAN1_DIV fan_div:1 - fan2_div SENSORS_W83792D_FAN2_DIV fan_div:2 - fan3_div SENSORS_W83792D_FAN3_DIV fan_div:3 - fan4_div SENSORS_W83792D_FAN4_DIV fan_div:4 - fan5_div SENSORS_W83792D_FAN5_DIV fan_div:5 - fan6_div SENSORS_W83792D_FAN6_DIV fan_div:6 - fan7_div SENSORS_W83792D_FAN7_DIV fan_div:7 - - - - -/PROC ENTRIES -------------- -Most are identical to the w83781d entries. See the w83781d documentation for -details. - -Most of the additional entries not in the w83781d are Winbond Smart Fan I/II: -Please read "7.7 FAN Speed Count and FAN Speed Control" of W83792AD/D datasheet -before you read the explanation to the /proc entries below. - - fan_cfg: indicates the fan speed control mode: 0 means PWM/DC mode, - 1 means Smart Fan I(Thermal Cruise) mode, 2 or 3 means Smart Fan II - mode. There are three items in this entry, the first one is the - configuration of Fan1, the rest may be deduced by analogy. - - pwm_flag: valid under PWM/DC mode, 1 means PWM mode, 0 means DC mode. - There are three items in this entry, the first one is PWM/DC mode - of Fan1, the rest may be deduced by analogy. - - thermal_cruise: valid under Smart Fan I mode, indicates the wanted - temperature. There are three items in this entry, the first one - is setting temperature of Fan1, the rest may be deduced by analogy. - - fan_tolerance: valid under Smart Fan I or Smart Fan II mode, indicates - the interval temperature. There are also three items in this entry. - - sf2_points_fan1: valid under Smart Fan II mode, there are four items in - this entry, indicates the Temp.[1-4] in "Figure 8. Smart Fan II - behavior" to Fan1. - - sf2_points_fan2: almost same as the above one, except that this entry - is for Fan2. - - sf2_points_fan3: almost same as the above one, except that this entry - is for Fan3. - - sf2_levels_fan1: valid under Smart Fan II mode, there are four items in - this entry, indicates the "Non-Stop Duty Cycle" and "Fan Duty Cycle - Level [1-3]" in "Figure 8. Smart Fan II behavior" to Fan1. The - first item "Non-Stop Duty Cycle" is read only in this driver, while - the other three items can be modified. - - sf2_levels_fan2: almost same as the above one, except that this entry - is for Fan2. - - sf2_levels_fan3: almost same as the above one, except that this entry - is for Fan3. - - -additional entries for chassis intrusion detection: - chassis: There are two items in this entry, the first one indicats the - chassis status, 1 means chassis intrusion detected, while 1 means - normal. The second item in this entry is used to clear the - detected chassis intrusion interrupt and reset the chassis status - to normal. diff --git a/doc/chips/w83l785ts b/doc/chips/w83l785ts deleted file mode 100644 index 16972072..00000000 --- a/doc/chips/w83l785ts +++ /dev/null @@ -1,77 +0,0 @@ -Kernel driver `w83l785ts.o' -=========================== - -Status: Beta, slightly tested - -Supported chips: - * Winbond W83L785TS-S - Prefix: 'w83l785ts' - Addresses scanned: I2C 0x2e - Datasheet: Publicly available at the Winbond USA website - http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83L785TS-S.pdf - - -Author: Jean Delvare - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_w83l785ts: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `w83l785ts' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan - - -Description ------------ - -The W83L785TS-S is a digital temperature sensor. It senses the -temperature of a single external diode. The high limit is -theoretically defined as 85 or 100 degrees C through a combination -of external resistors, so the user cannot change it. Values seen so -far suggest that the two possible limits are actually 95 and 110 -degrees C. The datasheet is rather poor and obviously inaccurate -on several points including this one. - -All temperature values are given in degrees Celsius. Resolution -is 1.0 degree. See the datasheet for details. - -The w83l785ts driver will not update its values more frequently than -every other second; reading them more often will do no harm, but will -return 'old' values. - - -Known Issues ------------- - -On some systems (Asus), the BIOS is known to interfere with the driver -and cause read errors. The driver will retry a given number of times -(5 by default) and then give up, returning the old value (or 0 if -there is no old value). It seems to work well enough so that you should -not notice anything. Thanks to James Bolt for helping test this feature. - - -Chip Features -------------- - -Chip 'w83l785ts' - -LABEL LABEL CLASS COMPUTE CLASS MODE MAGN -temp - - R- 0 -temp_high temp temp R- 0 - -LABEL FEATURE SYMBOL SYSCTL FILE:N -temp SENSORS_W83L785TS_TEMP temp:2 -temp_high SENSORS_W83L785TS_TEMP_OVER temp:1 diff --git a/doc/chips/xeontemp b/doc/chips/xeontemp deleted file mode 100644 index a77a214a..00000000 --- a/doc/chips/xeontemp +++ /dev/null @@ -1,108 +0,0 @@ -Kernel driver `xeontemp.o' -========================= - -Status: Complete; tested for most devices except Xeon. - -Supported chips: - * Intel Xeon and other processors - Prefix: 'xeontemp' - Addresses scanned: I2C 0x18, 0x1a, 0x29, 0x2b, 0x4c, 0x4e - Datasheets: Publicly available at the Intel website - See the adm1021 document for additional references - -Authors: Frodo Looijaard ,Philip Edelbrock - , and Mark D. Studebaker (mdsxyz123@yahoo.com) - -License: GPL - - -Module Parameters ------------------ - -* force: short array (min = 1, max = 48) - List of adapter,address pairs to boldly assume to be present -* force_xeontemp: short array (min = 1, max = 48) - List of adapter,address pairs which are unquestionably assumed to contain - a `xeontemp' chip -* probe: short array (min = 1, max = 48) - 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 -* ignore: short array (min = 1, max = 48) - List of adapter,address pairs not to scan -* ignore_range: short array (min = 1, max = 48) - List of adapter,start-addr,end-addr triples not to scan -* read_only: int - Don't set any values, read only mode - - -Description ------------ - -Many Xeons and other Intel processors have an embedded i2c temperature -sensor that look very similar to an adm1021 or max1617. - -Some Xeons have honest to goodness, real live, actual MAX1617 chips on -them. Others Xeons made around the same time have other ADM1021 -compatible chips on them. They are mounted on the CPU substrate along -with the processor information EEPROM that is part of that generation of -Xeon CPU's. - -So it's basically impossible to tell a Xeon TEMP sensor from a MAX1617 -since they are in fact the same chip. The Xeon Temperature sensors spec -is just a stripped down register spec for the ADM1021 that says the -"on-board" or "built-in" sensor registers are "reserved". That way -Intel could substitute whatever ADM1021 compatible chip was cheapest at -the time when they built the CPU's. - -One reason to use the xeontemp driver is if, when Intel built your -particular Xeon's, they didn't use any of the ADM1021 compatible chips -that the ADM1021 driver recognizes. In that case, using the xeontemp -driver will get you the temperatures you want without potentially -messing up something in the sensor. - -Another reason is to avoid having 'sensors' report the second -temperature. - -Unfortunately, the 533MHz FSB Xeon's, dropped the on-board sensor chip. -So these new Xeons require a sensor on the motherboard to be connected -to the thermal diode to read the temperature. But these 533MHz capable -motherboards can also accept 400MHz CPU's with the on-board sensor so it -gets confusing in a hurry for motherboard vendors and users. - -If you have 400MHz FSB P4 Xeon CPU's, you should have an on-CPU ADM1021 -compatible sensor at 0x18 or 0x19. In that case, use the ADM1021 driver -if it detects a chip at that address. The CPU DIE temperature (Tj) will -be the "REMOTE" temperature from this sensor. The "Board" or "built-in" -temperature from the ADM1021 will be the temperature of the ADM1021 -compatible itself which is one of the chips you see on the side of the CPU. - -If you have sensors at 0x18 and 0x19 that are not detected by the -ADM1021, and you have 400MHz Xeons, then you may want to try the -xeontemp driver. - -If you have 533MHZ FSB Xeons, then you do *not* have an on-board thermal -sensor and you should look for CPU temperatures from the other sensors -on your motherboard. (Winbond chip for example). - -If you have an Intel Xeon processor, and sensors-detect recommended -the adm1021 driver, and the address is one of -0x18, 0x1a, 0x29, 0x2b, 0x4c, or 0x4e, and when using the -adm1021 driver, temp1 is invalid but temp2 looks correct, then -it is likely you should use the xeontemp driver instead. - -If you have dual Xeons you may have appear to have two separate -adm1021-compatible chips, or two single-temperature sensors, -at distinct addresses. - -In summary, the xeontemp module supports one temperature and the -adm1021 module supports two. Use the module that works best for you. - -See the adm1021 documentation for more information. - - -Author/Maintainer ------------------ -Mark D. Studebaker (mdsxyz123@yahoo.com). -Derived from the adm1021 driver. -Thanks to Philip Pokorny for help with this document. diff --git a/doc/developers/design b/doc/developers/design deleted file mode 100644 index 045fb1a3..00000000 --- a/doc/developers/design +++ /dev/null @@ -1,550 +0,0 @@ -This is a design for version 2 of our smbus and lm_sensors module. This -document is Copyright (c) 1998, 1999 by Frodo Looijaard. You may freely copy and -distribute it, as long as you recognize me as the author, and mark any -changes you make as being your own, and distribute this notice with it. - -Document version 1.0, 19981101. - 1.1, 19981111. - 1.2, 19981118. - 1.3, 19981126. - -NOTE: THIS IS BY NOW SOMEWHAT OUTDATED. SORRY. - - -Object oriented approach -======================== - -The i2c module structs contain callback functions and data fields. In the -i2c module, these structures are only referenced by pointers. This makes -it easy to extend these structs to contain additional information or -callback functions. For those familiar with object oriented languages, -you can see the smbus and isa structures as an object extension of the i2c -structures. - -To make this clearer, I will show in an example how this is done. Note -that I have simplified some things here, so this example does not -correspond to an actual struct found in one of the modules. - -In the i2c module, you can find a struct somewhat like this: - -struct i2c_adapter { - char name[32]; - int (*detach_client) (struct i2c_client *); - struct i2c_adapter *next; -} - -We have a plain data field (name), a call-back function which needs one -parameter (a pointer to a i2c_client struct), and a data field which is -a pointer to the next adapter. - -Now we want to extend this structure. We need another data field, -containing a number of flags. We will call this new structure smbus_adapter. -A few other things change too: - -struct smbus_adapter { - char name[32]; - int (*detach_client) (struct smbus_client *); - struct smbus_adapter *next; - unsigned int flags; -} - -So we copy all existing fields. The next field still points to the next -adapter - but it is now of type smbus_adapter, not i2c_adapter. And the -call-back function takes now a parameter of type pointer to smbus_client. -And there is a new data field, called flags. - -Now examine this function definition: - -int fully_detach_i2c_client (struct i2c_client * client) -{ - res = 0; - struct i2c_adapter *current_adapter = first_adapter; /* a global var. */ - while (current_adapter) { - res |= (current_adapter -> detach_client) (client); - current_adapter = current_adapter -> next; - } - return res; -} - -This function detaches a client from all adapters. Nice. But now comes the -Big Trick(tm): we can still use this function for smbus_adapters! - -int fully_detach_smbus_client (struct smbus_client * client) -{ - return fully_detach_i2c_client( (struct i2c_client *) client); -} - -All we needed here was a simple typecast. Datapointers remain datapointers, -so this can safely be done. And because we use call-back functions, the -actual function called to detach a client from a single adapter might -be the same, or different, depending on what function was put in -client->detach_client! - -It gets even better. The i2c module stores internally all registered -adapters. But it stores pointers to the i2c_adapter struct, not the -structs themselves! So there is an array: - -#define I2C_ADAPTER_MAX 32 -struct i2c_adapter *adapters[I2C_ADAPTER_MAX]; -/* this is an array of pointers to structs, not vice versa! */ - -So, an element of this array might in fact point to a smbus_adapter, instead -of an i2c_adapter! If you know this for sure, you might use a typecast and -access the additional fields. In the meantime, the i2c internal -administration remains valid. - -We have to thank Simon Vogl and Gerd Knorr for the way they implemented -their i2c module. Any other way would have made this approach impossible, -and basing anything upon their module much more difficult. - -Limitations ------------ - -Extending the adapter and algorithm structures in this way is quite safe. -They are only allocated on places where the code knows that they are -'special'. Extending the driver or client structures depending on a -specific adapter/algorithm type is *very* *dangerous*. A driver/client -module would need to be aware of every special adapter/algorithm in -order to allocate itself! For the ISA bus, it has to be aware of this -anyway, so it is safe to do; on other places, think twice first! - - -Module overview -=============== - -All in all, lots of modules will be stacked on each other. Too bad, but -that is the only way to cleanly implement everything. Note that in a -specific situation, only a few modules may need to be loaded. isa.o, -for example, does not depend on smbus.o (in the sense that you can load -sensor.o without loading smbus.o). A specific bus driver, though, will -depend on many of them. - -Generally: - isa.o depends on nothing (actually, on i2c.o, to keep the code small) - smbus.o depends on nothing (actually, on i2c.o, to keep the code small) - i2c.o depends on nothing. - - A non-i2c SMBus bus driver depends only on smbus.o - A i2c bus driver depends only on i2c.o - - A sensor chip driver depends either on isa.o or smbus.o, or both. - A SMBus chip driver depends only on smbus.o - A I2C chip driver depends only on i2c.o - -We may need a sensor.o module, to act as a central point for sensor -modules. At this moment, it seems not really necessary, but this may -change. - -We will need an enhanced i2c-dev.o module, to add SMBus access to I2C -/dev entries. - - -isa.o -ISA bus handling. -Encapsulates ISA bus access within the i2c structures. -Unites I2C adapters and the ISA bus. -Defines variables isa_algorithm and isa_adapter. - -smbus.o -Main SMBus handling. -Encapsulates SMBus access within the smbus structures. -Unites I2C adapters and SMBus hosts (like the PIIX4). -Emulates SMBus access on pure I2C adapters. -Defines variable smbus_algorithm. - - piix4.o - SMBus adapter driver for the PIIX4 SMBus host. - Defines variable piix4_adapter (based on smbus_algorithm). - - FOO.o - Adapter driver for FOO SMBus host - Defines variable FOO_adapter (based on smbus_algorithm). - -i2c-core.o (From Simon Vogl) -Main i2c handling. - - ????.o - I2C adapter driver - Implementing a class of I2C busses - - -A chip driver (typically defined in its own module) can be hooked on all -these levels: - * If it is a sensor chip, it should be hooked to isa.o or smbus.o - * A pure ISA chip should be hooked to isa.o - * A pure SMBus chip should be hooked to smbus.o - * An I2C chip should be hooked to i2c.o -It can be difficult to decide whether a specific chip should be hooked to -smbus.o or i2c.o. A good deciding question is, 'could it be connected to -a PIIX4?' - - -Module i2c.o -============ - -This is Simon Vogl's i2c module (this one is different from the i2c module -included in kernels around 2.1.120!). - -A driver --------- - -struct i2c_driver { - char name[32]; - int id; - unsigned int flags; - int (* attach_adapter) (struct i2c_adapter *); - int (* detach_client) (struct i2c_client *); - int (* command) (struct i2c_client *, unsigned int cmd, void *arg); - void (* inc_use) (struct i2c_client *); - void (* dec_use) (struct i2c_client *); -} - -A driver tells us how we should handle a specific type of i2c chip. An -instance of such a chip is called a 'client'. An example would be the LM75 -module: it would contain only one driver, which tells us how to handle the -LM75; but each detected LM75 would be a separate client (which would be -dynamically allocated). - - -A description of the above struct: - name: The name of this driver - id: A unique driver identifier - flags: Flags to set certain kinds of behaviour. Most notably, DF_NOTIFY - will notify the driver when a new i2c bus is detected, so it can - try to detect chips on it. - attach_adapter: A call-back function which is called if a new adapter (bus) - is found. This allows us to do our detection stuff on the new adapter, - and register new clients. - detach_client: A call-back function which is called if a specific client - which uses this driver should be disallocated. If a specific sensor module - is removed, for instance, this function would be called for each registered - client. - command: A generic call-back function to communicate in a driver-dependent - way with a specific client. This should only be seldom needed. - inc_use: Can be called to add one to an internal 'use' counter. This can be - used to control when it is safe to remove this module, for example. - - -A client --------- - -struct i2c_client { - char name[32]; - int id; - unsigned int flags; - unsigned char addr; - struct i2c_adapter *adapter; - struct i2c_driver *driver; - void *data; -} - -A client is a specific sensor chip. Its operation is controlled by a driver -(which describes a type of sensor chip), and it is connected to an adapter -(a bus). - -A description of the above struct: - name: The name of this client - id: A unique client id - flags: Flags to set certain kinds of behaviour (not very important) - addr: The client address. 10-bit addresses are a bit of a kludge right now. - adapter: A pointer to the adapter this client is on. - driver: A pointer to the driver this client uses. - data: Additional, client-dependent data - - -An algorithm ------------- - -struct i2c_algorithm { - char name[32]; - unsigned int id; - int (* master_xfer) (struct i2c_adapter *adap, struct i2c_msg msgs[], - int num); - int (* slave_send) (struct i2c_adapter *,char *, int); - int (* slave_recv) (struct i2c_adapter *,char *, int); - int (* algo_control) (struct i2c_adapter *, unsigned int, unsigned long); - int (* client_register) (struct i2c_client *); - int (* client_unregister) (struct i2c_client *); -} - -An algorithm describes how a certain class of i2c busses can be accessed. - -A description of the above struct: - name: The name of this algorithm - id: A unique algorithm id - master_xfer: Transfer a bunch of messages through a specific i2c bus. - slave_send: Send a message as if we are a slave device - slave_recv: Receive a message as if we are a slave device - client_register: Register a new client - client_unregister: Unregister a client - - -An adapter ----------- - -struct i2c_adapter { - char name[32]; - unsigned int id; - struct i2c_algorithm *algo; - void *data; -#ifdef SPINLOCK - spinlock_t lock; - unsigned long lockflags; -#else - struct semaphore lock; -#endif - unsigned int flags; - struct i2c_client *clients[I2C_CLIENT_MAX]; - int client_count; - int timeout; - int retries; -} - -An adapter is a specific i2c bus. How to access it is defined in the -algorithm associated with it. - -A description of the above struct: - name: The name of this adapter - id: A unique adapter id - algo: The algorithm through which this bus must be accessed - data: Adapter specific data - lock, lockflags: To lock out simultaneous adapter access - flags: Modifiers for adapter operation - clients: All currently connected clients - client_count: The number of currently connected clients - timeout, retries: Internal variables (unimportant here). - - -Access functions ----------------- - -All these functions are defined extern. - -int i2c_master_send(struct i2c_client *,const char *, int); -int i2c_master_recv(struct i2c_client *,char *, int); -int i2c_transfer(struct i2c_adapter *,struct i2c_msg [], int num); - -These function respectively send one message to a client, receive one message -from a client, or transmit a bunch of messages. struct i2c_msg contains -an i2c address to communicate with, and can both read from and write to this -address. - - -int i2c_slave_send(struct i2c_client *, char *, int); -int i2c_slave_recv(struct i2c_client *, char *, int); - -Communicate with another master as if the normal master is a common slave -device. - - -Administration functions ------------------------- - -int i2c_add_algorithm(struct i2c_algorithm *); -int i2c_del_algorithm(struct i2c_algorithm *); - -The i2c_{add,del}_algorithm functions must be called whenever a new module -is inserted with this driver in it, by the module initialization function. - - -int i2c_add_adapter(struct i2c_adapter *); -int i2c_del_adapter(struct i2c_adapter *); - -The i2c_{add,del}_adapter functions must be called if you have detected -a specific bus. It triggers driver->attach_adapter (add, for each driver -present) or driver->detach_client (del, for each registered client on -this adapter). - - -int i2c_add_driver(struct i2c_driver *); -int i2c_del_driver(struct i2c_driver *); - -The i2c_{add,del}_driver functions must be called whenever a new module is -inserted with a chip driver in it, by the module initialization function. - - -int i2c_attach_client(struct i2c_client *); -int i2c_detach_client(struct i2c_client *); - -The i2c_{attach,detach}_client functions must be called if you have detected -a single chip. - - -Module smbus.o -============== - -This module offers support for SMBus operation. An SMBus adapter can either -accept SMBus commands (like the PIIX4), or be in fact an I2C driver. In -the last case, all SMBus commands will be expressed through I2C primitives. -This means that any I2C adapter driver will automatically be a SMBus -driver. - -At this point, it should be noted that there can only be one System -Management Bus in a given system (is this really true, by the way?). This -means there must be some way of selecting which of the many possible adapters -is in fact *the* SMBus. For now, I will ignore this problem. Later on, -we can add a hook somewhere in the i2c module to help us decide this. - -This module consists in fact of three separate parts: first of all, it extends -all i2c structs to accomodate the new smbus fields. Second, it defines a -new algorithm (smbus_algorithm), that will be used by all non-i2c adapters. -Finally, it implements a new access function that sends or receives SMBus -commands; these are either translated into I2C commands or sent to the -SMBus driver. - - -A driver, client and algorithm ------------------------------- - -We will not need to extend i2c_driver, i2c_client or i2c_adapter. This means -that struct smbus_driver is exactly the same as struct i2c_driver, and -struct smbus_client is the same as struct i2c_client, and smbus_adapter is -the same as struct i2c_adapter. We *will* define the smbus_* variants, and -use them within this module, so it should be easy to extend them after all. - -Note that at this moment, 10 bit SMBus addresses seem to be only -partially supported by the i2c module. We will ignore this issue for -now. - - -An adapter ------------- - -struct smbus_adapter { - char name[32]; - unsigned int id; - struct smbus_algorithm *algo; - void *data; -#ifdef SPINLOCK - spinlock_t lock; - unsigned long lockflags; -#else - struct semaphore lock; -#endif - unsigned int flags; - struct smbus_client *clients[I2C_CLIENT_MAX]; - int client_count; - int timeout; - int retries; - - /* Here ended i2c_adapter */ - s32 (* smbus_access) (__u8 addr, char read_write, - __u8 command, int size, union smbus_data * data); -} - -A description of the above struct: - smbus_access: A function to access the SMBus. It is only used for non-i2c - smbus adapters. - - -Access functions ----------------- - -All these functions are defined extern. - -The i2c access function should not be used within SMBus chip drivers, as -they might not be defined (for the PIIX4, for example). Instead, use the -following general access function, or one of the easier functions based -on it: - -int smbus_access (struct i2c_adapter *, __u8 addr, char read_write, - __u8 command, int size, union smbus_data * data); - -There are specific SMBus registration functions too, like the i2c ones. -They are fully compatiable with each other; just substitute 'smbus' for -'i2c' everywhere in the i2c description. - -int i2c_is_smbus_client(struct i2c_client *); -int i2c_is_smbus_adapter(struct i2c_adapter *); - -Decide whether this client, or adapter, is (on) a non-I2C SMBus. Usually -not needed, but it is nice anyway to be able to decide this. - - -Module isa.o -============ - -This module implements a new algorithm and a specific adapter for the -(single) ISA bus in your computer. This makes writing drivers for chips -that can be both on ISA and SMBus much easier. - -Note that this module does *not* in any way depend on smbus.o (previous -versions of this document still assumed it would be build upon it; this -is no longer true). - - -A driver, adapter or algorithm ------------------------------- - -We will not need to extend i2c_driver, i2c_adapter or i2c_algorithm. This -means that struct isa_driver is exactly the same as struct i2c_driver, -struct isa_adapter is the same as struct i2c_adapter and struct isa_algorithm -is the same as struct isa_driver. We *will* define the isa_* variants, and -use them within this module, so it should be easy to extend them after all. - - -A client --------- - -struct isa_client { - char name[32]; - int id; - unsigned int flags; - unsigned char addr; - struct isa_adapter *adapter; - struct isa_driver *driver; - void *data; - - unsigned int isa_addr; -} - -A client is a specific sensor chip. Its operation is controlled by a driver -(which describes a type of sensor chip), and it is connected to an adapter -(a bus, the (single) ISA bus here). - -A description of the above struct: - isa_addr: ISA addresses do not fit in the i2c-compatible addr field, so - we needed a new field. - - -Access functions ----------------- - -All these functions are defined extern. - -In case of the ISA bus, the master_xfer, slave_send and slave_recv hooks -will be NULL, because these functions make no sense. It is regrettably -not easy to create an access abstraction in which both ISA bus access -and SMBus access are united. See below for examples how you can solve -this problem. - -The most imporant additional access function: - -int i2c_is_isa_client(struct i2c_client *); -int i2c_is_isa_adapter(struct i2c_adapter *); - -Decide whether this client, or adapter, is (on) the ISA bus. This is -important, because it determines whether we can use the SMBus access -routines. - -As an example, I will here implement our old LM78 access function: - -/* The SMBus locks itself, but ISA access must be locked explicitly! - We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks, - would slow down the LM78 access and should not be necessary. - There are some ugly typecasts here, but the good new is - they should - nowhere else be necessary! */ -int lm78_read_value(struct i2c_client *client, u8 reg) -{ - int res; - if (i2c_is_isa_client(client)) { - down((struct semaphore *) (client->data)); - outb_p(reg,(((struct isa_client *) client)->isa_addr) + - LM78_ADDR_REG_OFFSET); - res = inb_p((((struct isa_client *) client)->isa_addr) + - LM78_DATA_REG_OFFSET); - up((struct semaphore *) (client->data)); - return res; - } else - return smbus_read_byte_data(client->adapter,client->addr, reg); -} diff --git a/doc/developers/makefiles b/doc/developers/makefiles index b94b50be..59c28fc8 100644 --- a/doc/developers/makefiles +++ b/doc/developers/makefiles @@ -4,36 +4,28 @@ See doc/useful_addresses.html for a link to this article. There is one big Makefile in the root of this package. It includes many other files; one for each directory in which source code is found. These -included files are called 'Module.mk'. There is a separate set of Makefiles -in the i2c/ directories; these are Simon Vogl's original Makefiles, and -not referred by the main package Makefile. +included files are called 'Module.mk'. There are several interesting targets defined through this Makefile: * all Create everything in all directories. - * all-i2c, all-src, ... - Create everything in the designated directory. * install Install everything from all directories. - * install-i2c, install-src, ... - Install everything in the designated directory. + * uninstall + Uninstall everything. * clean Remove anything which can be regenerated from all directories. A call of 'make clean' (without any other targets) will ignore any .d files; this is useful when they are out of date (and prevent the calling of any other target). - * clean-i2c, clean-src, ... - Remove anything which can be regenerated from the designated directory. * version Regenerate version.h, using the current date for the date-stamp, and a user-supplied version number. * package Create a .tar.gz file containing everything except the SVN directories. - * src/lm78.o, i2c/i2c-core.o, ... - You can of course also specify one or more targets to make. The best way to understand the Module.mk subfiles is to examine one of them, -for example src/Module.mk. They are not too difficult to understand. +for example lib/Module.mk. They are not too difficult to understand. There are several variables which can be set in the main Makefile. You can also specify them on the command-line; this overrules any definitions @@ -47,16 +39,12 @@ ones for developers: only output more information, and never make the code mis-behave. Several files are generated by Makefiles: - * .d - Dependency files for modules. Automatically generated. * .rd Dependency files for executables. Automatically generated. * .ao Dependency files for static libraries. Automatically generated. * .lo Dependency files for shared libraries. Automatically generated. - * .o - Generated modules * .ro Object files for executables. They will be linked together to create the executable. This extension is used to distinguish them from diff --git a/doc/developers/new_drivers b/doc/developers/new_drivers deleted file mode 100644 index db28421e..00000000 --- a/doc/developers/new_drivers +++ /dev/null @@ -1,166 +0,0 @@ -These are the steps you should follow to write a new driver and -submit it to us so that it will be applied cleanly to our package. -See at the bottom for adding new chip support to an existing driver. - -Don't be intimidated by the list, it's just here so we don't -forget anything. -We are more than happy to help you with any part of the process. - -There are two types of drivers, chip and bus. -Steps which apply to only one type of driver are noted. - -These instructions are for 2.4-kernel-compatible drivers. -If you wish to write a driver for 2.6 only, not all of the following -steps apply. - ---------------------------------------------------------------------- - -* Check our "New Drivers" page for status!! - -* Contact us. - You are of course free to write your own drivers, but it is smart to - check first nobody else is already working on it, in case the - New Drivers page is out of date. - Tell us it's OK to put your name on the "New Drivers" page. - -* Consider subscribing to the mailing list. - -* Check out our latest code from SVN. - You should use this as a base for your development. - See instructions on our download page. - -* Write the new driver. - If you write a driver for a device that is similar to one we already - support, use the other device driver as a template. If you don't know - which one to use, either ask us or use the following defaults. - For a chip driver, use lm78.c as template. For an SMBus-only adapter, - use i2c-piix4.c. Use i2c-via.c for an I2C-level adapter ('bit banger'). - Usually, we make all prefixes start with the driver name. This is not - really necessary, as these symbols will not be exported anyway. But by - doing this, you are sure you do not shadow any global kernel names. - -* A quick note about conversions. The conversions which are specified - in the sensor chip datasheet and which *cannot* vary from one board to - the next are performed by the driver. If other conversions are - necessary, they are performed in user-space. - -* Meet Kernel coding standards. - See Documentation/CodingStyle in the kernel source. - Be sure and use 8 column tabs. - Also, please do not use // comments. - Also, please do not go past column 80. - Also, please use C99 struct initializers {.foo = blat} - Please do this _before_ you check in your driver. - -* Meet /proc naming standards in the ctl_table (for chip drivers only). - See doc/developers/proc for information. Please do not deviate from - this without discussion. - -* Add the driver to the Module.mk (the makefile). - Usually, you can just add it to KERNEL{CHIPS,DRIVERS}TARGETS in the - Module.mk file in the directory itself. - -* Make sure it compiles cleanly. - Check compilation with 'make DEBUG=1' if you use debugging - information. Remember, things put between #ifdef DEBUG #endif may never - stop the driver from functioning; they should just output additional - information. - -* Check for external symbols. - 'nm --extern --defined' should only output symbols starting with __module, - cleanup_module, init_module and some kernel versioning symbols. Mark all - other symbols as static in your source file. - -* Test the module. - Test with a recent 2.4 kernel. - For bus drivers, use i2cdetect and i2cdump. For i2cdump, test all supported - bus access modes (see i2cdump man page). - For chip drivers, cat all files in applicable /proc or /sys directory - and check for problems. Write all supported settings. - Check ALARM indications. - -* Add detection information to prog/detect/sensors-detect. - This is a perl script that automatically detects what chips and adapters - are present. Contact us if you need help. - -* Add chip information to lib/chips.{c,h} (for chip drivers only). - Until you have done this, the chip will be invisible for user-level - programs which use libsensors. Use standard names in lib/chips.c; - see also the comments in etc/sensors.conf.eg for help. - Contact us if you need more assistance. - -* Be sure that SYSCTL and ALARM definitions in the driver are bracketed - by the special comments so that the kernel/include/sensors.h - file, which is generated automatically, contains your definitions. - (for chip drivers only) - -* Add a procedure to prog/sensors/chips.[ch] (for chip drivers only). - This is a function specific for your driver that - makes the included 'sensors' program pretty-print your chip information. - -* Add an line for the procedure in the matches[] table in - prog/sensors/main.c (for chip drivers only). - This tells sensors to call your new procedure when the chip name matches. - -* Add entries to etc/sensors.conf.eg (for chip drivers only). - If needed, you can set defaults here. - -* Test the userspace apps (sensors-detect and sensors). - Test setting limits with sensors -s. - -* Add the name of the device to the README file. - -* Add your name to the CONTRIBUTORS file. - -* Add entries to the CHANGES file. Please keep in alphabetical order. - -* Write a doc/chips/xxx or doc/busses/xxx file. - -* Add entry to doc/chips/SUMMARY (for chip drivers only). - -* Clearly specify licensing and copyright. - Make sure the GPL boilerplate and your name - (or if applicable your company's name) is at the top of the - new driver so we know you are giving it to us under the GPL. - -* Submit the changes to us. - Do a 'svn update' to get in sync (things will have changed since - you started), then submit the changes to us as a patch against SVN. - -* If you want to have your driver integrated to Linux 2.6, you have to - port your driver to the new sysfs interface. Once done and preferably - after testing, submit a patch to our mailing list: see - http://www.lm-sensors.org/wiki/AuthorsAndContributors - Make sure to check the current status for your driver first: - http://www.lm-sensors.org/wiki/Kernel2.6 - http://www.lm-sensors.org/wiki/Devices - ---------------------------------------------------------------------- -Checklist for us to do on the webpage: - -* Add entry to 'supported drivers' page - -* Update entry on 'new drivers' page - ---------------------------------------------------------------------- -Checklist for _adding_ support for a chip to an _existing_ driver: - -* Make the changes to the driver itself. - -* Add detection information to prog/detect/sensors-detect. - -* Add a strncmp() call for the new prefix in prog/sensors/main.c - (chip drivers only). - -* Add entries for the new prefix to etc/sensors.conf.eg (chip drivers only). - -* Update doc/[chips,busses]/xxx file - -* Update doc/chips/SUMMARY file (chip drivers only) - -* Update list in README - -* Submit the changes as a patch or check them in - -* Update entry on 'new drivers' page - diff --git a/doc/developers/proc b/doc/developers/proc deleted file mode 100644 index 9286febb..00000000 --- a/doc/developers/proc +++ /dev/null @@ -1,145 +0,0 @@ -Naming and data format standards under /proc --------------------------------------------- - -The libsensors library offers an interface to the raw sensors data -through the sysctl interface. See the doc/developers/sysctl -and the libsensors source for further information. - -An alternative method that some programs use is to access the /proc -files directly. This document briefly describes the standards that -the drivers follow, so that an application program can scan for -entries and access this data in a simple and consistent way. - -Note that not all chip drivers adhere to this standard. -We will attempt to migrate older drivers to this standard, -and ensure that new drivers follow this standard wherever possible. -If you are developing a userspace application please send us -feedback on this standard. - -Note that motherboards vary widely in the connections to sensor chips. -There is no standard that ensures, for example, that the second -temperature sensor is connected to the CPU, or that the second -fan is on the CPU. Therefore, programs must provide a facility -for the user to label or bind /proc entries for display. -Sensor chips often have unused inputs that should be ignored -by user programs. - -Each chip gets its own directory under /proc/sys/dev/sensors. -The format is either chip-i2c-bus-hexaddress or chip-isa-hexaddress. -(Exception - chip lm78-j has a '-' in it - should this be changed??) -New dummy drivers may present chips as chip-busname-hexaddress. - -All /proc values are integers or floating point numbers. -There is no facility in the lm_sensors package for drivers -to output general strings via /proc. This facility may be added -in the future. - -Alarms are direct indications read from the chips. The drivers do NOT make -comparisons of readings to thresholds. This allows violations -between readings to be caught and alarmed. The exact definition of -an alarm (for example, whether a threshold must be met or must be -exceeded to cause an alarm) is chip-dependent. - -Guidelines for new entries: - - If there are multiple values, some r/w and some r/o, - put the r/w ones first. - - Additional non-standard values should be after the standard values. - - - -------------------------------------------------------------------------- - -/proc entries are as follows: - - -Entry Values Function ------ ------ -------- -alarms 1 Alarm bitmask. - Read only. - Integer representation of one to four bytes. - A '1' bit means an alarm. - Chips should be programmed for 'comparator' mode so that - the alarm will 'come back' after you read the register - if it is still valid. - Generally a direct representation of a chip's internal - alarm registers; there is no standard for the position - of individual bits. - Bits are defined in kernel/include/sensors.h. - -beep 2 Beep/interrupt enable and bitmask. - The first value is 0 or 1 to globally disable - or enable the beeps. - The second value is a bitmask, with the - same format as 'alarms' with same bit locations. - -curr[1-n] 3 Current max, min or hysteresis, and input value. - Floating point values XX.X or XX.XX in Amps. - The second value is preferably a hysteresis value, - reported as a absolute current, NOT a delta from - the max value. - First two values are read/write and third is read only. - -fan[1-3] 2 Fan minimum and input value. - Two integers indicating RPM. - First value is read/write and second is read only. - -fan_div 3 Fan divisor. - Integers in powers of two (1,2,4,8,16,32,64,128). - Some chips only support values 1,2,4,8. - Entries correspond to the fans[1-3]. - See doc/fan-divisors for details. - -in[0-8] 3 Voltage min, max, and input value. - Floating point values X.XX in volts from 0 to 4.01 volts. - Actual voltage depends on the scaling resistors on the - motherboard, as recommended in the chip datasheet. - This varies by chip and by motherboard. - Because of this variation, values are generally NOT scaled - by the chip driver, and must be done by the application. - However, some drivers (notably lm87 and via686a) - do scale, with various degrees of success. - These drivers will output the actual voltage. - First two values are read/write and third is read only. - Typical usage: - in0 CPU #1 voltage (not scaled) - in1 CPU #1 voltage (not scaled) - in2 3.3V nominal (not scaled) - in3 5.0V nominal (scaled) - in4 12.0V nominal (scaled) - in5 -12.0V nominal (scaled) - in6 -5.0V nominal (scaled) - in7 varies - in8 varies - -pwm[1-3] 1-2 Pulse width modulation fan control. - Integer 0 - 255, read/write. - 255 is max or 100%. - Corresponds to the fans 1-3. - Second value, if present, is an enable (0 or 1) - -sensor[1-3] 1 Sensor type selection. - Integers 1,2,3, or thermistor Beta value (3435); read/write. - -temp, -temp[1-4] 3 Temperature max, min or hysteresis, and input value. - Floating point values XXX.X or XXX.XX in degrees Celsius. - 'temp' is used if there is only one temperature sensor on the - chip; for multiple temps. start with 'temp1'. - Temp1 is generally the sensor inside the chip itself, - generally reported as "motherboard temperature". - Temp2 to temp4 are generally sensors external to the chip - itself, for example the thermal diode inside the CPU or a - termistor nearby. The second value is preferably a hysteresis - value, reported as a absolute temperature, NOT a delta from - the max value. - First two values are read/write and third is read only. - -vid 1 CPU core voltage. - Read only. - Floating point X.XX or X.XXX corresponding to CPU core voltage - as told to the sensor chip. Not always correct. - -vrm 1 Voltage Regulator Module version number. - "Floating point" X.X. Default 8.2. - Affects the way the driver calculates the core voltage from - the vid pins. See doc/vid for details. diff --git a/doc/developers/release_checklist b/doc/developers/release_checklist index 5f21f13e..33efc2d0 100644 --- a/doc/developers/release_checklist +++ b/doc/developers/release_checklist @@ -2,18 +2,16 @@ CHECKLIST FOR NEW RELEASES ========================== Release steps: -- Check out i2c and lm-sensors +- Check out lm-sensors - Update if necessary, the version number of libsensors (edit lib/Module.mk and change LIBMAINVER and/or LIBMINORVER) Remember: update main number when interface changes, minor if new functionality is added, and patch if only bugs are fixed. `svn diff -r Vx-y-z lib' is your friend. -- Update both CHANGES files (add the release date) -- Verify i2c dependency instructions in README, QUICKSTART, and INSTALL, - update if necessary +- Update the CHANGES file (add the release date) - Update lm_sensors.lsm and send it to the LSM by mailing it to lsm@execpc.com with the subject `add' (no quotes). -- Update lm_sensors2/version.h and i2c/kernel/i2c.h +- Update version.h - Commit - Tag the release using SVN: svn copy http://lm-sensors.org/svn/lm-sensors/trunk \ @@ -21,9 +19,9 @@ Release steps: -m "Create tag 'V2-x-x'." - Remove empty directories (e.g. rmdir `find . -type d`) - Remove 'SVN' related files/directories (e.g. rm -fR `find . -name .svn`) -- Rename i2c and lm_sensors2 to i2c-#.#.# and lm_sensors-#.#.# +- Rename lm_sensors2 to lm_sensors-#.#.# - Tar it up and post it (sign it) -- Make sure the file permissions on both the archives and the signatures +- Make sure the file permissions on both the archive and the signature are correct (664) After release, remember to: diff --git a/doc/developers/sysctl b/doc/developers/sysctl deleted file mode 100644 index 4c6532f2..00000000 --- a/doc/developers/sysctl +++ /dev/null @@ -1,16 +0,0 @@ -You can access everything under /proc/sys through the sysctl interface. This -is mostly useful for C programs, which can use the sysctl function. Try -'man 2 sysctl' for more information. - -As each chip gets its own directory under /proc/sys/dev/sensors, you must -somehow know the sysctl id of these directories to access the sensor data. -This is done through the file /proc/sys/dev/sensors/chips (see sensors.h -for the corresponding SYSCTL ids). You can only read this file; it -returns an array of struct sensors_chips_data, as defined in sensors.h. -Each chip will have its own entry here, with both its sysctl id and -the corresponding /proc name. - -Generally, it is a better idea to use the new libsensors to access this -data. If you feel you need more than the library offers, please mail us, -so we can either add the new functionality to the library, or explain how -you can work around it. diff --git a/doc/kernel/file_operations b/doc/kernel/file_operations deleted file mode 100644 index cfd9445b..00000000 --- a/doc/kernel/file_operations +++ /dev/null @@ -1,91 +0,0 @@ -This file documents the changes in struct file_operations throughout the 2.1 -kernel series. - -Kernels 2.0.x: - -struct file_operations { - int (*lseek) (struct inode *, struct file *, off_t, int); - int (*read) (struct inode *, struct file *, char *, int); - int (*write) (struct inode *, struct file *, const char *, int); - int (*readdir) (struct inode *, struct file *, void *, filldir_t); - int (*select) (struct inode *, struct file *, int, select_table *); - int (*ioctl) (struct inode *, struct file *, unsigned int, - unsigned long); - int (*mmap) (struct inode *, struct file *, struct vm_area_struct *); - int (*open) (struct inode *, struct file *); - void (*release) (struct inode *, struct file *); - int (*fsync) (struct inode *, struct file *); - int (*fasync) (struct inode *, struct file *, int); - int (*check_media_change) (kdev_t dev); - int (*revalidate) (kdev_t dev); -}; - - -Kernel 2.1.0: - -- int (*lseek) (struct inode *, struct file *, off_t, int); -+ long long (*llseek) (struct inode *, struct file *, long long, int); -- int (*read) (struct inode *, struct file *, char *, int); -+ long (*read) (struct inode *, struct file *, char *, unsigned long); -- int (*write) (struct inode *, struct file *, const char *, int); -+ long (*write) (struct inode *, struct file *, const char *, unsigned lon - - -Kernel 2.1.23: - -- int (*select) (struct inode *, struct file *, int, select_table *); -+ unsigned int (*poll) (struct file *, poll_table *); -[The lock field is added behind the revalidate field] -+ int (*lock) (struct inode *, struct file *, int, struct file_lock *); - - -Kernel 2.1.31: - -- void (*release) (struct inode *, struct file *); -+ int (*release) (struct inode *, struct file *); - - -Kernel 2.1.55: - -- int (*readdir) (struct inode *, struct file *, void *, filldir_t); -+ int (*readdir) (struct file *, void *, filldir_t); - - -Kernel 2.1.56: - -- long long (*llseek) (struct inode *, struct file *, long long, int); -+ long long (*llseek) (struct file *, long long, int); -- int (*mmap) (struct inode *, struct file *, struct vm_area_struct *); -+ int (*mmap) (struct file *, struct vm_area_struct *); -- int (*fsync) (struct inode *, struct file *); -+ int (*fsync) (struct file *, struct dentry *); -- int (*fasync) (struct inode *, struct file *, int); -+ int (*fasync) (struct file *, int); -- int (*lock) (struct inode *, struct file *, int, struct file_lock *); -+ int (*lock) (struct file *, int, struct file_lock *); - - -Kernel 2.1.70: - -- long long (*llseek) (struct file *, long long, int); -+ loff_t (*llseek) (struct file *, loff_t, int); -- long (*read) (struct inode *, struct file *, char *, unsigned long); -+ ssize_t (*read) (struct file *, char *, size_t, loff_t *); -- long (*write) (struct inode *, struct file *, const char *, - unsigned long); -+ ssize_t (*write) (struct file *, const char *, size_t, loff_t *); - - -Kernel 2.1.72: - -- unsigned int (*poll) (struct file *, poll_table *); -+ unsigned int (*poll) (struct file *, struct poll_table_struct *); - - -Kernel 2.1.118: - -[The flush field is added behind the open field -- stupid...] -+ int (*flush) (struct file *); - - -Last kernel checked: 2.2.0-pre4. diff --git a/doc/kernel/proc_dir_entry b/doc/kernel/proc_dir_entry deleted file mode 100644 index 9763d15e..00000000 --- a/doc/kernel/proc_dir_entry +++ /dev/null @@ -1,145 +0,0 @@ -This file documents how to handle the callback function that returns the -information displayed in a (non-/proc/sys) /proc file. - -For kernels before 2.1.29, you have to declare a proc_dir_entry, with -in the get_info field the procedure handler. For kernels 2.1.29 and later, -you can use the create_proc_entry function and assign a new value (the -procedure handler address) to the read_proc field: - - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29) - static int read_bus_i2c(char *buf, char **start, off_t offset, int len, - int unused); - static struct proc_dir_entry proc_bus_i2c_dir = - { - /* low_ino */ 0, /* Set by proc_register_dynamic */ - /* namelen */ 3, /* The length of the name field */ - /* name */ "i2c", - /* mode */ S_IRUGO | S_IFREG, - /* nlink */ 1, - /* uid */ 0, - /* gid */ 0, - /* size */ 0, - /* ops */ NULL, - /* get_info */ &read_bus_i2c - }; - -#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29) - static int read_bus_i2c(char *buf, char **start, off_t offset, int len, - int *eof , void *private); -#endif - - - /* This code fragment is part of the initialization code. You should do - several safety checks, like whether create_proc_entry does not return - NULL. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29) - proc_register_dynamic(&proc_root, &proc_bus_i2c_dir); -#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29) - proc_bus_i2c = create_proc_entry("i2c",0,proc_root); - proc_bus_i2c->read_proc = &read_bus_i2c; -#endif - - - -Now for the function itself. - - LINUX KERNEL 2.0.x, and 2.1.x upto 2.1.28 - ========================================= - This function is known as the get_info function. - - int get_info(char *buf, char **start, off_t offset, int len, int unused); - - (INPUT) - buf: A kernel-space buffer where we can put the information. - len: The buffer length (we have a bit of slack here: if we write - 'a little' beyond this, things will still work out) - (OUTPUT) - *buf: The complete contents of the /proc file, starting at the - beginning. - return value: the number of chars written to buf. - - This is all you have to do if all information fits in the buffer (it is - about 3K in length). You can safely ignore offset and start in this case. - - If your /proc entry gets larger, you have to do a bit more work. - - (INPUT) - buf: See above - len: see above - offset: The offset from the beginning of the /proc file where the user - wants to start reading - (OUTPUT) - *buf: A part of the /proc file. The requested information does not - have to start at the beginning. - start: this is the place within buf where the information starts (ie. - you must use offset to compute this!). - return value: The number of valid characters written to buf. Begin - counting at start, not at buf! - - You do not have to worry about not the whole information being in buf. - Another call will be done (with a higher offset value) if more is - needed. - - - LINUX KERNEL 2.1.x, from 2.1.29 upwards - ======================================= - - This function is known as the read_proc function. - - int read_proc(char *buf, char **start, off_t offset, int len, int *eof, - void *private); - (INPUT) - buf: A kernel-space buffer where we can put the information. - len: The buffer length (we have a bit of slack here: if we write - 'a little' beyond this, things will still work out) - (OUTPUT) - *buf: The complete contents of the /proc file, starting at the - beginning. - eof: You can set this to true (anything but 0) to indicate we have - reached the end of the file with this read. Not strictly - necessary, but it is more efficient (else this function may be - called again). - return value: The number of valid characters written to buf. Begin - counting at start, not at buf! - - If your /proc entry gets larger, you have to do a bit more work. - - (INPUT) - buf: See above - len: See above - offset: The offset from the beginning of the /proc file where the user - wants to start reading - (OUTPUT) - *buf: A part of the /proc file. The requested information does not - have to start at the beginning. - eof: See above - start: this is the place within buf where the information starts (ie. - you must use offset to compute this!). - return value: The number of valid characters written to buf. - - You do not have to worry about not the whole information being in buf. - Another call will be done (with a higher offset value) if more is - needed. Ignore private. - - A third way to do this: - - (INPUT) - buf: See above - len: See above - offset: The offset from the beginning of the /proc file where the user - wants to start reading - (OUTPUT) - *buf: A part of the /proc file, with the requested information starting - at the beginning. - eof: See above - start: (long)start is added to the offset pointer after reading. This - allows you to play tricks with the file offset, independent of - the number of read bytes. - return value: the number of chars written to buf. - - -This document was written by Frodo Looijaard . I do not -accept any responsibility for omissions or errors, but you are free to -drop me a note if something is wrong or if you miss something. diff --git a/doc/modules b/doc/modules deleted file mode 100644 index fd685dd1..00000000 --- a/doc/modules +++ /dev/null @@ -1,14 +0,0 @@ -Installing Modules -================== - -'make install' will install the kernel modules in the -subdirectory /lib/modules/$version/kernel/drivers/i2c/chips. -This puts the modules in the same location as a kernel -'make modules_install' does so that there will be no duplicate modules. - -If 'make install' fails, particularly on Mandrake kernels, -see FAQ #3.8 (fix MODPREF in the Makefile) and #3.9. - -For details on options that apply to most modules, see -doc/chips/MODPARMS. For details on options specific to particular -modules, see the documentation in doc/chips/. diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index ff89cfd7..1f616ee7 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -920,11 +920,6 @@ chip "as99127f-*" chip "gl518sm-*" # IMPORTANT: in0, in1, and in2 values (+5, +3, and +12) CANNOT be read -# unless you use the slow 'iterate' method. Limits will still -# work even when iterate=0. See doc/chips/gl518sm. -# Note that the 'iterate' method was trimmed while porting the -# driver to Linux 2.6 as we considered it too ugly for the thin -# benefit. # # Factors and labels taken from GL518SM datasheet, they seem to give # reasonable values with EISCA connected Fan78 @@ -1854,13 +1849,14 @@ chip "fscher-*" label in2 "Battery" # Compute Voltages using mainboard dependant MRO-values -# (see doc/chips/fscher) +# (see the fscher driver documentation in the kernel tree) # M R O O M R compute in0 (@ * (49 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (49 * 33) compute in1 (@ * (20 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (20 * 33) compute in2 (@ * (10 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (10 * 33) -# Read documentation before enabling pwm settings (see doc/chips/fscher) +# Read documentation before enabling pwm settings +# (see the fscher driver documentation in the kernel tree) # WARNING: IMPROPER VALUES MAY DAMAGE YOUR SYSTEM DUE TO OVERHEATING! # Allow fans to turn off diff --git a/kernel/Module.mk b/kernel/Module.mk deleted file mode 100644 index 50791a44..00000000 --- a/kernel/Module.mk +++ /dev/null @@ -1,42 +0,0 @@ -# Module.mk - Makefile for a Linux module for reading sensor data. -# Copyright (c) 1998, 1999 Frodo Looijaard -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -# Note that MODULE_DIR (the directory in which this file resides) is a -# 'simply expanded variable'. That means that its value is substituted -# verbatim in the rules, until it is redefined. -MODULE_DIR := kernel -KERNELDIR := $(MODULE_DIR) - -# Regrettably, even 'simply expanded variables' will not put their currently -# defined value verbatim into the command-list of rules... -KERNELTARGETS := - -# Include all dependency files -INCLUDEFILES += $(KERNELTARGETS:.o=.d) - -all-kernel: $(KERNELTARGETS) -all :: all-kernel - -# Remove sensors.o possibly left from old versions -install-kernel: all-kernel - $(RM) $(DESTDIR)$(MODPREF)/misc/sensors.o - -install :: install-kernel - -clean-kernel: - $(RM) $(KERNELDIR)/*.o $(KERNELDIR)/*.d -clean :: clean-kernel diff --git a/kernel/chips/Module.mk b/kernel/chips/Module.mk deleted file mode 100644 index 0173a406..00000000 --- a/kernel/chips/Module.mk +++ /dev/null @@ -1,210 +0,0 @@ -# Module.mk - Makefile for a Linux module for reading sensor data. -# Copyright (c) 1998 - 2001 Frodo Looijaard -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -# Note that MODULE_DIR (the directory in which this file resides) is a -# 'simply expanded variable'. That means that its value is substituted -# verbatim in the rules, until it is redefined. -MODULE_DIR := kernel/chips -KERNELCHIPSDIR := $(MODULE_DIR) - -# Regrettably, even 'simply expanded variables' will not put their currently -# defined value verbatim into the command-list of rules... - -KERNELCHIPSTARGETS := -ifeq ($(shell if grep -q '^CONFIG_IPMI_HANDLER=' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/bmcsensors.o -endif -KERNELCHIPSTARGETS += $(MODULE_DIR)/ds1307.o -KERNELCHIPSTARGETS += $(MODULE_DIR)/ltc1710.o -KERNELCHIPSTARGETS += $(MODULE_DIR)/mic74.o -KERNELCHIPSTARGETS += $(MODULE_DIR)/saa1064.o -KERNELCHIPSTARGETS += $(MODULE_DIR)/smartbatt.o -KERNELCHIPSTARGETS += $(MODULE_DIR)/smbus-arp.o - - -ifneq ($(shell if grep -q '^CONFIG_SENSORS_ADM1021=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/adm1021.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_ADM1024=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/adm1024.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_ADM1025=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/adm1025.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_ADM1026=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/adm1026.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_ADM1031=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/adm1031.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_ADM9240=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/adm9240.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_ASB100=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/asb100.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_BT869=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/bt869.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_DDCMON=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/ddcmon.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_DS1621=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/ds1621.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_EEPROM=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/eeprom.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_F71805F=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/f71805f.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_FSCHER=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/fscher.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_FSCPOS=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/fscpos.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_FSCSCY=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/fscscy.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_GL518SM=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/gl518sm.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_GL520SM=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/gl520sm.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_IT87=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/it87.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM63=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm63.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM75=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm75.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM78=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm78.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM80=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm80.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM83=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm83.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM85=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm85.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM87=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm87.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM90=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm90.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM92=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm92.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_LM93=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/lm93.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_MATORB=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/matorb.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_MAX1619=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/max1619.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_MAX6650=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/max6650.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_MAXILIFE=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/maxilife.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_MTP008=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/mtp008.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_PC87360=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/pc87360.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_PCA9540=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/pca9540.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_PCF8574=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/pcf8574.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_PCF8591=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/pcf8591.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_SIS5595=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/sis5595.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_SMSC47M1=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/smsc47m1.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_THMC50=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/thmc50.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_W83781D=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/w83781d.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_VIA686A=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/via686a.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_VT1211=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/vt1211.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_VT8231=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/vt8231.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_W83792D=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/w83792d.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_W83627HF=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/w83627hf.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_W83L785TS=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/w83l785ts.o -endif -ifneq ($(shell if grep -q '^CONFIG_SENSORS_XEONTEMP=y' $(LINUX)/.config; then echo 1; fi),1) -KERNELCHIPSTARGETS += $(MODULE_DIR)/xeontemp.o -endif - -# Include all dependency files -INCLUDEFILES += $(KERNELCHIPSTARGETS:.o=.d) - -all-kernel-chips: $(KERNELCHIPSTARGETS) -all :: all-kernel-chips - -# -# If $MODPREF/kernel exists, we presume the new (2.4.0) /lib/modules/x.y.z directory -# layout, so we install in kernel/drivers/i2c/chips/ and remove old versions in misc/ -# and kernel/drivers/sensors/ . Otherwise we install in misc/ as before. -# -install-kernel-chips: all-kernel-chips - if [ -n "$(KERNELCHIPSTARGETS)" ] ; then \ - $(MKDIR) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/chips ; \ - $(INSTALL) -m 644 $(KERNELCHIPSTARGETS) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/chips ; \ - for i in $(KERNELCHIPSTARGETS) ; do \ - $(RM) $(DESTDIR)$(MODPREF)/misc/`basename $$i` $(DESTDIR)$(MODPREF)/kernel/drivers/sensors/`basename $$i` \ - $(DESTDIR)$(MODPREF)/kernel/drivers/sensors/`basename $$i`.gz $(DESTDIR)$(MODPREF)/kernel/drivers/chips/`basename $$i`.gz ; \ - done ; \ - $(RMDIR) $(DESTDIR)$(MODPREF)/misc $(DESTDIR)$(MODPREF)/kernel/drivers/sensors 2> /dev/null || true ; \ - fi - -install :: install-kernel-chips - -clean-kernel-chips: - $(RM) $(KERNELCHIPSDIR)/*.o $(KERNELCHIPSDIR)/*.d -clean :: clean-kernel-chips diff --git a/kernel/chips/adm1021.c b/kernel/chips/adm1021.c deleted file mode 100644 index c1ecf1ba..00000000 --- a/kernel/chips/adm1021.c +++ /dev/null @@ -1,587 +0,0 @@ -/* - adm1021.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard and - Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x18, 0x1a, 0x29, 0x2b, - 0x4c, 0x4e, SENSORS_I2C_END -}; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, mc1066); - -/* adm1021 constants specified below */ - -/* The adm1021 registers */ -/* Read-only */ -#define ADM1021_REG_TEMP 0x00 -#define ADM1021_REG_REMOTE_TEMP 0x01 -#define ADM1021_REG_STATUS 0x02 -#define ADM1021_REG_MAN_ID 0x0FE /* 0x41 = Analog Devices, 0x49 = TI, - 0x4D = Maxim, 0x23 = Genesys , 0x54 = Onsemi*/ -#define ADM1021_REG_DEV_ID 0x0FF /* ADM1021 = 0x0X, ADM1021A/ADM1023 = 0x3X */ -#define ADM1021_REG_DIE_CODE 0x0FF /* MAX1617A */ -/* These use different addresses for reading/writing */ -#define ADM1021_REG_CONFIG_R 0x03 -#define ADM1021_REG_CONFIG_W 0x09 -#define ADM1021_REG_CONV_RATE_R 0x04 -#define ADM1021_REG_CONV_RATE_W 0x0A -/* These are for the ADM1023's additional precision on the remote temp sensor */ -#define ADM1021_REG_REM_TEMP_PREC 0x010 -#define ADM1021_REG_REM_OFFSET 0x011 -#define ADM1021_REG_REM_OFFSET_PREC 0x012 -#define ADM1021_REG_REM_TOS_PREC 0x013 -#define ADM1021_REG_REM_THYST_PREC 0x014 -/* limits */ -#define ADM1021_REG_TOS_R 0x05 -#define ADM1021_REG_TOS_W 0x0B -#define ADM1021_REG_REMOTE_TOS_R 0x07 -#define ADM1021_REG_REMOTE_TOS_W 0x0D -#define ADM1021_REG_THYST_R 0x06 -#define ADM1021_REG_THYST_W 0x0C -#define ADM1021_REG_REMOTE_THYST_R 0x08 -#define ADM1021_REG_REMOTE_THYST_W 0x0E -/* write-only */ -#define ADM1021_REG_ONESHOT 0x0F - -#define ADM1021_ALARM_TEMP (ADM1021_ALARM_TEMP_HIGH | ADM1021_ALARM_TEMP_LOW) -#define ADM1021_ALARM_RTEMP (ADM1021_ALARM_RTEMP_HIGH | ADM1021_ALARM_RTEMP_LOW\ - | ADM1021_ALARM_RTEMP_NA) -#define ADM1021_ALARM_ALL (ADM1021_ALARM_TEMP | ADM1021_ALARM_RTEMP) - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -/* Conversions note: 1021 uses normal integer signed-byte format*/ -#define TEMP_FROM_REG(val) (val > 127 ? val-256 : val) -#define TEMP_TO_REG(val) (SENSORS_LIMIT((val < 0 ? val+256 : val),0,255)) - -/* Each client has this additional data */ -struct adm1021_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 temp, temp_os, temp_hyst; /* Register values */ - u8 remote_temp, remote_temp_os, remote_temp_hyst, alarms, die_code; - u8 fail; - /* Special values for ADM1023 only */ - u8 remote_temp_prec, remote_temp_os_prec, remote_temp_hyst_prec, - remote_temp_offset, remote_temp_offset_prec; -}; - -static int adm1021_attach_adapter(struct i2c_adapter *adapter); -static int adm1021_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void adm1021_init_client(struct i2c_client *client); -static int adm1021_detach_client(struct i2c_client *client); -static int adm1021_read_value(struct i2c_client *client, u8 reg); -static int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask); -static int adm1021_write_value(struct i2c_client *client, u8 reg, - u16 value); -static void adm1021_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1021_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, - long *results); -static void adm1021_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -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 = { - .name = "ADM1021, MAX1617 sensor driver", - .id = I2C_DRIVERID_ADM1021, - .flags = I2C_DF_NOTIFY, - .attach_adapter = adm1021_attach_adapter, - .detach_client = adm1021_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define ADM1021_SYSCTL_TEMP 1200 -#define ADM1021_SYSCTL_REMOTE_TEMP 1201 -#define ADM1021_SYSCTL_DIE_CODE 1202 -#define ADM1021_SYSCTL_ALARMS 1203 - -#define ADM1021_ALARM_TEMP_HIGH 0x40 -#define ADM1021_ALARM_TEMP_LOW 0x20 -#define ADM1021_ALARM_RTEMP_HIGH 0x10 -#define ADM1021_ALARM_RTEMP_LOW 0x08 -#define ADM1021_ALARM_RTEMP_NA 0x04 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected adm1021. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table adm1021_dir_table_template[] = { - {ADM1021_SYSCTL_TEMP, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1021_temp}, - {ADM1021_SYSCTL_REMOTE_TEMP, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1021_remote_temp}, - {ADM1021_SYSCTL_DIE_CODE, "die_code", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1021_die_code}, - {ADM1021_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1021_alarms}, - {0} -}; - -static ctl_table adm1021_max_dir_table_template[] = { - {ADM1021_SYSCTL_TEMP, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1021_temp}, - {ADM1021_SYSCTL_REMOTE_TEMP, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1021_remote_temp}, - {ADM1021_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1021_alarms}, - {0} -}; - -static int adm1021_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, adm1021_detect); -} - -static int adm1021_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct adm1021_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("adm1021.o: adm1021_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto error0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access adm1021_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct adm1021_data), GFP_KERNEL))) { - err = -ENOMEM; - goto error0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &adm1021_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - if (kind < 0) { - if ((adm1021_read_value(new_client, ADM1021_REG_STATUS) & 0x03) != 0x00 - || (adm1021_read_value(new_client, ADM1021_REG_CONFIG_R) & 0x3F) != 0x00 - || (adm1021_read_value(new_client, ADM1021_REG_CONV_RATE_R) & 0xF8) != 0x00) - goto error1; - } - - /* Determine the chip type. */ - - if (kind <= 0) { - i = adm1021_read_value(new_client, ADM1021_REG_MAN_ID); - if (i == 0x41) - if ((adm1021_read_value (new_client, ADM1021_REG_DEV_ID) & 0xF0) == 0x30) - kind = adm1023; - else - kind = adm1021; - else if (i == 0x49) - kind = thmc10; - else if (i == 0x23) - kind = gl523sm; - else if ((i == 0x4d) && - (adm1021_read_value - (new_client, ADM1021_REG_DEV_ID) == 0x01)) - kind = max1617a; - else if (i == 0x54) - kind = mc1066; - /* LM84 Mfr ID in a different place, and it has more unused bits */ - else if (adm1021_read_value(new_client, ADM1021_REG_CONV_RATE_R) == 0x00 - && (kind == 0 /* skip extra detection */ - || ((adm1021_read_value(new_client, ADM1021_REG_CONFIG_R) & 0x7F) == 0x00 - && (adm1021_read_value(new_client, ADM1021_REG_STATUS) & 0xAB) == 0x00))) - kind = lm84; - else - kind = max1617; - } - - if (kind == max1617) { - type_name = "max1617"; - client_name = "MAX1617 chip"; - } else if (kind == max1617a) { - type_name = "max1617a"; - client_name = "MAX1617A chip"; - } else if (kind == adm1021) { - type_name = "adm1021"; - client_name = "ADM1021 chip"; - } else if (kind == adm1023) { - type_name = "adm1023"; - client_name = "ADM1023 chip"; - } else if (kind == thmc10) { - type_name = "thmc10"; - client_name = "THMC10 chip"; - } else if (kind == lm84) { - type_name = "lm84"; - client_name = "LM84 chip"; - } else if (kind == gl523sm) { - type_name = "gl523sm"; - client_name = "GL523SM chip"; - } else if (kind == mc1066) { - type_name = "mc1066"; - client_name = "MC1066 chip"; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto error3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - data->type == adm1021 ? adm1021_dir_table_template : - adm1021_max_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto error4; - } - data->sysctl_id = i; - - /* Initialize the ADM1021 chip */ - if (kind != lm84) - adm1021_init_client(new_client); - return 0; - - error4: - i2c_detach_client(new_client); - error3: - error1: - kfree(data); - error0: - return err; -} - -static void adm1021_init_client(struct i2c_client *client) -{ - /* Enable ADC and disable suspend mode */ - adm1021_write_value(client, ADM1021_REG_CONFIG_W, - adm1021_read_value(client, ADM1021_REG_CONFIG_R) & 0xBF); - /* Set Conversion rate to 1/sec (this can be tinkered with) */ - adm1021_write_value(client, ADM1021_REG_CONV_RATE_W, 0x04); -} - -static int adm1021_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct adm1021_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("adm1021.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -/* All registers are byte-sized */ -static int adm1021_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -/* only update value if read succeeded; set fail bit if failed */ -static int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask) -{ - int i; - struct adm1021_data *data = client->data; - - i = i2c_smbus_read_byte_data(client, reg); - if (i < 0) { - data->fail |= mask; - return i; - } - *val = i; - return 0; -} - -static 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); -} - -static void adm1021_update_client(struct i2c_client *client) -{ - struct adm1021_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting adm1021 update\n"); -#endif - - data->fail = 0; - adm1021_rd_good(&(data->temp), client, ADM1021_REG_TEMP, - ADM1021_ALARM_TEMP); - adm1021_rd_good(&(data->temp_os), client, ADM1021_REG_TOS_R, - ADM1021_ALARM_TEMP); - adm1021_rd_good(&(data->temp_hyst), client, - ADM1021_REG_THYST_R, ADM1021_ALARM_TEMP); - adm1021_rd_good(&(data->remote_temp), client, - ADM1021_REG_REMOTE_TEMP, ADM1021_ALARM_RTEMP); - adm1021_rd_good(&(data->remote_temp_os), client, - ADM1021_REG_REMOTE_TOS_R, ADM1021_ALARM_RTEMP); - adm1021_rd_good(&(data->remote_temp_hyst), client, - ADM1021_REG_REMOTE_THYST_R, - ADM1021_ALARM_RTEMP); - data->alarms = ADM1021_ALARM_ALL; - if (!adm1021_rd_good(&(data->alarms), client, - ADM1021_REG_STATUS, 0)) - data->alarms &= ADM1021_ALARM_ALL; - if (data->type == adm1021) - adm1021_rd_good(&(data->die_code), client, - ADM1021_REG_DIE_CODE, 0); - if (data->type == adm1023) { - adm1021_rd_good(&(data->remote_temp_prec), client, - ADM1021_REG_REM_TEMP_PREC, - ADM1021_ALARM_TEMP); - adm1021_rd_good(&(data->remote_temp_os_prec), client, - ADM1021_REG_REM_TOS_PREC, - ADM1021_ALARM_RTEMP); - adm1021_rd_good(&(data->remote_temp_hyst_prec), client, - ADM1021_REG_REM_THYST_PREC, - ADM1021_ALARM_RTEMP); - adm1021_rd_good(&(data->remote_temp_offset), client, - ADM1021_REG_REM_OFFSET, - ADM1021_ALARM_RTEMP); - adm1021_rd_good(&(data->remote_temp_offset_prec), - client, ADM1021_REG_REM_OFFSET_PREC, - ADM1021_ALARM_RTEMP); - } - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void adm1021_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1021_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1021_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_os); - results[1] = TEMP_FROM_REG(data->temp_hyst); - results[2] = TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_os = TEMP_TO_REG(results[0]); - adm1021_write_value(client, ADM1021_REG_TOS_W, - data->temp_os); - } - if (*nrels_mag >= 2) { - data->temp_hyst = TEMP_TO_REG(results[1]); - adm1021_write_value(client, ADM1021_REG_THYST_W, - data->temp_hyst); - } - } -} - -void adm1021_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm1021_data *data = client->data; - int prec = 0; - - if (operation == SENSORS_PROC_REAL_INFO) - if (data->type == adm1023) { *nrels_mag = 3; } - else { *nrels_mag = 0; } - else if (operation == SENSORS_PROC_REAL_READ) { - adm1021_update_client(client); - results[0] = TEMP_FROM_REG(data->remote_temp_os); - results[1] = TEMP_FROM_REG(data->remote_temp_hyst); - results[2] = TEMP_FROM_REG(data->remote_temp); - if (data->type == adm1023) { - results[0]=results[0]*1000 + - ((data->remote_temp_os_prec >> 5) * 125); - results[1]=results[1]*1000 + - ((data->remote_temp_hyst_prec >> 5) * 125); - results[2]=(TEMP_FROM_REG(data->remote_temp_offset)*1000) + - ((data->remote_temp_offset_prec >> 5) * 125); - results[3]=TEMP_FROM_REG(data->remote_temp)*1000 + - ((data->remote_temp_prec >> 5) * 125); - *nrels_mag = 4; - } else { - *nrels_mag = 3; - } - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (data->type == adm1023) { - prec=((results[0]-((results[0]/1000)*1000))/125)<<5; - adm1021_write_value(client, - ADM1021_REG_REM_TOS_PREC, - prec); - results[0]=results[0]/1000; - data->remote_temp_os_prec=prec; - } - data->remote_temp_os = TEMP_TO_REG(results[0]); - adm1021_write_value(client, - ADM1021_REG_REMOTE_TOS_W, - data->remote_temp_os); - } - if (*nrels_mag >= 2) { - if (data->type == adm1023) { - prec=((results[1]-((results[1]/1000)*1000))/125)<<5; - adm1021_write_value(client, - ADM1021_REG_REM_THYST_PREC, - prec); - results[1]=results[1]/1000; - data->remote_temp_hyst_prec=prec; - } - data->remote_temp_hyst = TEMP_TO_REG(results[1]); - adm1021_write_value(client, - ADM1021_REG_REMOTE_THYST_W, - data->remote_temp_hyst); - } - if (*nrels_mag >= 3) { - if (data->type == adm1023) { - prec=((results[2]-((results[2]/1000)*1000))/125)<<5; - adm1021_write_value(client, - ADM1021_REG_REM_OFFSET_PREC, - prec); - results[2]=results[2]/1000; - data->remote_temp_offset_prec=prec; - data->remote_temp_offset=results[2]; - adm1021_write_value(client, - ADM1021_REG_REM_OFFSET, - data->remote_temp_offset); - } - } - } -} - -void adm1021_die_code(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm1021_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1021_update_client(client); - results[0] = data->die_code; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - /* Can't write to it */ - } -} - -void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1021_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1021_update_client(client); - results[0] = data->alarms | data->fail; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - /* Can't write to it */ - } -} - -static int __init sm_adm1021_init(void) -{ - printk(KERN_INFO "adm1021.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&adm1021_driver); -} - -static void __exit sm_adm1021_exit(void) -{ - i2c_del_driver(&adm1021_driver); -} - -MODULE_AUTHOR - ("Frodo Looijaard and Philip Edelbrock "); -MODULE_DESCRIPTION("adm1021 driver"); -MODULE_LICENSE("GPL"); - -MODULE_PARM(read_only, "i"); -MODULE_PARM_DESC(read_only, "Don't set any values, read only mode"); - -module_init(sm_adm1021_init) -module_exit(sm_adm1021_exit) diff --git a/kernel/chips/adm1024.c b/kernel/chips/adm1024.c deleted file mode 100644 index 18ff22c7..00000000 --- a/kernel/chips/adm1024.c +++ /dev/null @@ -1,776 +0,0 @@ -/* - adm1024.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Add by Ken Bowley from the adm1025.c written by - Gordon Wu and from adm9240.c written by - Copyright (c) 1999 Frodo Looijaard - and Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* Supports the Analog Devices ADM1024. See doc/chips/adm1024 for details */ - -#include -#include -#include -#include -#include -#include "version.h" - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x2c, 0x2e, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(adm1024); - -/* Many ADM1024 constants specified below */ - -#define ADM1024_REG_IN_MAX(nr) (0x2b + (nr) * 2) -#define ADM1024_REG_IN_MIN(nr) (0x2c + (nr) * 2) -#define ADM1024_REG_IN(nr) (0x20 + (nr)) - -/* The ADM1024 registers */ -#define ADM1024_REG_INT_TEMP_TRIP_SET 0x13 -#define ADM1024_REG_EXT_TEMP_TRIP_SET 0x14 -#define ADM1024_REG_TEST 0x15 -#define ADM1024_REG_CHANNEL_MODE 0x16 -#define ADM1024_REG_INT_TEMP_TRIP 0x17 /* read only */ -#define ADM1024_REG_EXT_TEMP_TRIP 0x18 /* read only */ -#define ADM1024_REG_ANALOG_OUT 0x19 -#define ADM1024_REG_AIN1_LOW_LIMIT 0x1A -#define ADM1024_REG_AIN2_LOW_LIMIT 0x1B -/* These are all read-only */ -#define ADM1024_REG_2_5V 0x20 /* 2.5V Measured Value/EXT Temp 2 */ -#define ADM1024_REG_VCCP1 0x21 -#define ADM1024_REG_3_3V 0x22 /* VCC Measured Value */ -#define ADM1024_REG_5V 0x23 -#define ADM1024_REG_12V 0x24 -#define ADM1024_REG_VCCP2 0x25 -#define ADM1024_REG_EXT_TEMP1 0x26 -#define ADM1024_REG_TEMP 0x27 -#define ADM1024_REG_FAN1 0x28 /* FAN1/AIN1 Value */ -#define ADM1024_REG_FAN2 0x29 /* FAN2/AIN2 Value */ -#define ADM1024_REG_COMPANY_ID 0x3E /* 0x41 for ADM1024 */ -#define ADM1024_REG_DIE_REV 0x3F -/* These are read/write */ -#define ADM1024_REG_2_5V_HIGH 0x2B /* 2.5V/Ext Temp2 High Limit */ -#define ADM1024_REG_2_5V_LOW 0x2C /* 2.5V/Ext Temp2 Low Limit */ -#define ADM1024_REG_VCCP1_HIGH 0x2D -#define ADM1024_REG_VCCP1_LOW 0x2E -#define ADM1024_REG_3_3V_HIGH 0x2F /* VCC High Limit */ -#define ADM1024_REG_3_3V_LOW 0x30 /* VCC Low Limit */ -#define ADM1024_REG_5V_HIGH 0x31 -#define ADM1024_REG_5V_LOW 0x32 -#define ADM1024_REG_12V_HIGH 0x33 -#define ADM1024_REG_12V_LOW 0x34 -#define ADM1024_REG_VCCP2_HIGH 0x35 -#define ADM1024_REG_VCCP2_LOW 0x36 -#define ADM1024_REG_EXT_TEMP1_HIGH 0x37 -#define ADM1024_REG_EXT_TEMP1_LOW 0x38 -#define ADM1024_REG_TOS 0x39 -#define ADM1024_REG_THYST 0x3A -#define ADM1024_REG_FAN1_MIN 0x3B -#define ADM1024_REG_FAN2_MIN 0x3C - -#define ADM1024_REG_CONFIG 0x40 -#define ADM1024_REG_INT1_STAT 0x41 -#define ADM1024_REG_INT2_STAT 0x42 -#define ADM1024_REG_INT1_MASK 0x43 -#define ADM1024_REG_INT2_MASK 0x44 - -#define ADM1024_REG_CHASSIS_CLEAR 0x46 -#define ADM1024_REG_VID_FAN_DIV 0x47 -#define ADM1024_REG_I2C_ADDR 0x48 -#define ADM1024_REG_VID4 0x49 -#define ADM1024_REG_CONFIG2 0x4A -#define ADM1024_REG_TEMP_CONFIG 0x4B -#define ADM1024_REG_EXTMODE1 0x4C /* Interupt Status Register Mirror No. 1 */ -#define ADM1024_REG_EXTMODE2 0x4D /* Interupt Status Register Mirror No. 2 */ - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -#define IN_TO_REG(val,nr) (SENSORS_LIMIT(((val) & 0xff),0,255)) -#define IN_FROM_REG(val,nr) (val) - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) ((val)==0?-1:\ - (val)==255?0:1350000/((div)*(val))) - -#define TEMP_FROM_REG(temp) \ - ((temp)<256?((((temp)&0x1fe) >> 1) * 10) + ((temp) & 1) * 5: \ - ((((temp)&0x1fe) >> 1) -255) * 10 - ((temp) & 1) * 5) \ - -#define EXT_TEMP_FROM_REG(temp) (((temp)>0x80?(temp)-0x100:(temp))*10) - - -#define TEMP_LIMIT_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*10) - -#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT(((val)<0?(((val)-5)/10):\ - ((val)+5)/10), \ - 0,255) - -#define ALARMS_FROM_REG(val) (val) - -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val)==1?0:((val)==8?3:((val)==4?2:1))) - -#define VID_FROM_REG(val) ((val)==0x1f?0:(val)>=0x10?510-(val)*10:\ - 205-(val)*5) - -/* For each registered ADM1024, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new adm1024 client is - allocated. */ -struct adm1024_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[6]; /* Register value */ - u8 in_max[6]; /* Register value */ - u8 in_min[6]; /* Register value */ - u8 fan[2]; /* Register value */ - u8 fan_min[2]; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ - int temp; /* Temp, shifted right */ - u8 temp_os_max; /* Register value */ - u8 temp_os_hyst; /* Register value */ - int temp1; /* Ext Temp 1 */ - u8 temp1_os_max; - u8 temp1_os_hyst; - int temp2; /* Ext Temp 2 */ - u8 temp2_os_max; - u8 temp2_os_hyst; - u16 alarms; /* Register encoding, combined */ - u8 analog_out; /* Register value */ - u8 vid; /* Register value combined */ -}; - - - -static int adm1024_attach_adapter(struct i2c_adapter *adapter); -static int adm1024_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int adm1024_detach_client(struct i2c_client *client); - -static int adm1024_read_value(struct i2c_client *client, u8 register); -static int adm1024_write_value(struct i2c_client *client, u8 register, - u8 value); -static void adm1024_update_client(struct i2c_client *client); -static void adm1024_init_client(struct i2c_client *client); - - -static void adm1024_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1024_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1024_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1024_temp1(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1024_temp2(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1024_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1024_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1024_analog_out(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, - long *results); -static void adm1024_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver adm1024_driver = { - .name = "ADM1024 sensor driver", - .id = I2C_DRIVERID_ADM1024, - .flags = I2C_DF_NOTIFY, - .attach_adapter = adm1024_attach_adapter, - .detach_client = adm1024_detach_client, -}; - -/* The /proc/sys entries */ -/* -- SENSORS SYSCTL START -- */ - -#define ADM1024_SYSCTL_IN0 1000 /* Volts * 100 */ -#define ADM1024_SYSCTL_IN1 1001 -#define ADM1024_SYSCTL_IN2 1002 -#define ADM1024_SYSCTL_IN3 1003 -#define ADM1024_SYSCTL_IN4 1004 -#define ADM1024_SYSCTL_IN5 1005 -#define ADM1024_SYSCTL_FAN1 1101 /* Rotations/min */ -#define ADM1024_SYSCTL_FAN2 1102 -#define ADM1024_SYSCTL_TEMP 1250 /* Degrees Celsius * 100 */ -#define ADM1024_SYSCTL_TEMP1 1290 /* Degrees Celsius */ -#define ADM1024_SYSCTL_TEMP2 1295 /* Degrees Celsius */ -#define ADM1024_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define ADM1024_SYSCTL_ALARMS 2001 /* bitvector */ -#define ADM1024_SYSCTL_ANALOG_OUT 2002 -#define ADM1024_SYSCTL_VID 2003 - -#define ADM1024_ALARM_IN0 0x0001 -#define ADM1024_ALARM_IN1 0x0002 -#define ADM1024_ALARM_IN2 0x0004 -#define ADM1024_ALARM_IN3 0x0008 -#define ADM1024_ALARM_IN4 0x0100 -#define ADM1024_ALARM_IN5 0x0200 -#define ADM1024_ALARM_FAN1 0x0040 -#define ADM1024_ALARM_FAN2 0x0080 -#define ADM1024_ALARM_TEMP 0x0010 -#define ADM1024_ALARM_TEMP1 0x0020 -#define ADM1024_ALARM_TEMP2 0x0001 -#define ADM1024_ALARM_CHAS 0x1000 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected ADM1024. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table adm1024_dir_table_template[] = { - {ADM1024_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_in}, - {ADM1024_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_in}, - {ADM1024_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_in}, - {ADM1024_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_in}, - {ADM1024_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_in}, - {ADM1024_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_in}, - {ADM1024_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_fan}, - {ADM1024_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_fan}, - {ADM1024_SYSCTL_TEMP, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_temp}, - {ADM1024_SYSCTL_TEMP1, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_temp1}, - {ADM1024_SYSCTL_TEMP2, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_temp2}, - {ADM1024_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_fan_div}, - {ADM1024_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_alarms}, - {ADM1024_SYSCTL_ANALOG_OUT, "analog_out", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_analog_out}, - {ADM1024_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1024_vid}, - {0} -}; - -static int adm1024_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, adm1024_detect); -} - -static int adm1024_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct adm1024_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("adm1024.o: adm1024_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access adm1024_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct adm1024_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &adm1024_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - if (kind < 0) { - if((adm1024_read_value(new_client, ADM1024_REG_CONFIG) & 0x80) != 0x00) - goto ERROR1; - } - - /* Determine the chip type. */ - if (kind <= 0) { - i = adm1024_read_value(new_client, ADM1024_REG_COMPANY_ID); - if (i == 0x41) - kind = adm1024; - else { - if (kind == 0) - printk - ("adm1024.o: Ignoring 'force' parameter for unknown chip at " - "adapter %d, address 0x%02x\n", - i2c_adapter_id(adapter), address); - goto ERROR1; - } - } - - if (kind == adm1024) { - type_name = "adm1024"; - client_name = "ADM1024 chip"; - } else { -#ifdef DEBUG - printk("adm1024.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - adm1024_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the ADM1024 chip */ - adm1024_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int adm1024_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct adm1024_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("adm1024.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -static int adm1024_read_value(struct i2c_client *client, u8 reg) -{ - return 0xFF & i2c_smbus_read_byte_data(client, reg); -} - -static int adm1024_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -static void adm1024_init_client(struct i2c_client *client) -{ - /* Enable temperature channel 2 */ - adm1024_write_value(client, ADM1024_REG_CHANNEL_MODE, adm1024_read_value(client, ADM1024_REG_CHANNEL_MODE) | 0x04); - - /* Start monitoring */ - adm1024_write_value(client, ADM1024_REG_CONFIG, 0x07); -} - -static void adm1024_update_client(struct i2c_client *client) -{ - struct adm1024_data *data = client->data; - u8 i; - - down(&data->update_lock); - - if ( - (jiffies - data->last_updated > - (data->type == adm1024 ? HZ / 2 : HZ * 2)) - || (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting adm1024 update\n"); -#endif - for (i = 0; i <= 5; i++) { - data->in[i] = - adm1024_read_value(client, ADM1024_REG_IN(i)); - data->in_min[i] = - adm1024_read_value(client, - ADM1024_REG_IN_MIN(i)); - data->in_max[i] = - adm1024_read_value(client, - ADM1024_REG_IN_MAX(i)); - } - data->fan[0] = - adm1024_read_value(client, ADM1024_REG_FAN1); - data->fan_min[0] = - adm1024_read_value(client, ADM1024_REG_FAN1_MIN); - data->fan[1] = - adm1024_read_value(client, ADM1024_REG_FAN2); - data->fan_min[1] = - adm1024_read_value(client, ADM1024_REG_FAN2_MIN); - data->temp = - (adm1024_read_value(client, ADM1024_REG_TEMP) << 1) + - ((adm1024_read_value - (client, ADM1024_REG_TEMP_CONFIG) & 0x80) >> 7); - data->temp_os_max = - adm1024_read_value(client, ADM1024_REG_TOS); - data->temp_os_hyst = - adm1024_read_value(client, ADM1024_REG_THYST); - data->temp1 = - adm1024_read_value(client, ADM1024_REG_EXT_TEMP1); - data->temp1_os_max = - adm1024_read_value(client, ADM1024_REG_EXT_TEMP1_HIGH); - data->temp1_os_hyst = - adm1024_read_value(client, ADM1024_REG_EXT_TEMP1_LOW); - data->temp2 = - adm1024_read_value(client, ADM1024_REG_2_5V); - data->temp2_os_max = - adm1024_read_value(client, ADM1024_REG_2_5V_HIGH); - data->temp2_os_hyst = - adm1024_read_value(client, ADM1024_REG_2_5V_LOW); - - i = adm1024_read_value(client, ADM1024_REG_VID_FAN_DIV); - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = (i >> 6) & 0x03; - data->vid = i & 0x0f; - data->vid |= - (adm1024_read_value(client, ADM1024_REG_VID4) & 0x01) - << 4; - - data->alarms = - adm1024_read_value(client, - ADM1024_REG_INT1_STAT) + - (adm1024_read_value(client, ADM1024_REG_INT2_STAT) << - 8); - data->analog_out = - adm1024_read_value(client, ADM1024_REG_ANALOG_OUT); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void adm1024_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - - int scales[6] = { 250, 225, 330, 500, 1200, 270 }; - - struct adm1024_data *data = client->data; - int nr = ctl_name - ADM1024_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1024_update_client(client); - results[0] = - IN_FROM_REG(data->in_min[nr], nr) * scales[nr] / 192; - results[1] = - IN_FROM_REG(data->in_max[nr], nr) * scales[nr] / 192; - results[2] = - IN_FROM_REG(data->in[nr], nr) * scales[nr] / 192; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = - IN_TO_REG((results[0] * 192) / scales[nr], nr); - adm1024_write_value(client, ADM1024_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = - IN_TO_REG((results[1] * 192) / scales[nr], nr); - adm1024_write_value(client, ADM1024_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void adm1024_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1024_data *data = client->data; - int nr = ctl_name - ADM1024_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1024_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data-> - fan_div[nr - 1])); - results[1] = - FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = FAN_TO_REG(results[0], - DIV_FROM_REG - (data-> - fan_div[nr - - 1])); - adm1024_write_value(client, - nr == - 1 ? ADM1024_REG_FAN1_MIN : - ADM1024_REG_FAN2_MIN, - data->fan_min[nr - 1]); - } - } -} - - -void adm1024_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1024_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1024_update_client(client); - results[0] = TEMP_LIMIT_FROM_REG(data->temp_os_max); - results[1] = TEMP_LIMIT_FROM_REG(data->temp_os_hyst); - results[2] = TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_os_max = TEMP_LIMIT_TO_REG(results[0]); - adm1024_write_value(client, ADM1024_REG_TOS, - data->temp_os_max); - } - if (*nrels_mag >= 2) { - data->temp_os_hyst = TEMP_LIMIT_TO_REG(results[1]); - adm1024_write_value(client, ADM1024_REG_THYST, - data->temp_os_hyst); - } - } -} - -void adm1024_temp1(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1024_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1024_update_client(client); - results[0] = TEMP_LIMIT_FROM_REG(data->temp1_os_max); - results[1] = TEMP_LIMIT_FROM_REG(data->temp1_os_hyst); - results[2] = EXT_TEMP_FROM_REG(data->temp1); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp1_os_max = TEMP_LIMIT_TO_REG(results[0]); - adm1024_write_value(client, ADM1024_REG_EXT_TEMP1_HIGH, - data->temp1_os_max); - } - if (*nrels_mag >= 2) { - data->temp1_os_hyst = TEMP_LIMIT_TO_REG(results[1]); - adm1024_write_value(client, ADM1024_REG_EXT_TEMP1_LOW, - data->temp1_os_hyst); - } - } -} - -void adm1024_temp2(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1024_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1024_update_client(client); - results[0] = TEMP_LIMIT_FROM_REG(data->temp2_os_max); - results[1] = TEMP_LIMIT_FROM_REG(data->temp2_os_hyst); - results[2] = EXT_TEMP_FROM_REG(data->temp2); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp2_os_max = TEMP_LIMIT_TO_REG(results[0]); - adm1024_write_value(client, ADM1024_REG_2_5V_HIGH, - data->temp2_os_max); - } - if (*nrels_mag >= 2) { - data->temp2_os_hyst = TEMP_LIMIT_TO_REG(results[1]); - adm1024_write_value(client, ADM1024_REG_2_5V_LOW, - data->temp2_os_hyst); - } - } -} - -void adm1024_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1024_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1024_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -void adm1024_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm1024_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1024_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = adm1024_read_value(client, ADM1024_REG_VID_FAN_DIV); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) | (data->fan_div[1] << 6); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan_div[0] << 4); - adm1024_write_value(client, - ADM1024_REG_VID_FAN_DIV, old); - } - } -} - -void adm1024_analog_out(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm1024_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1024_update_client(client); - results[0] = data->analog_out; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->analog_out = results[0]; - adm1024_write_value(client, ADM1024_REG_ANALOG_OUT, - data->analog_out); - } - } -} - -void adm1024_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1024_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1024_update_client(client); - results[0] = VID_FROM_REG(data->vid); - *nrels_mag = 1; - } -} - -static int __init sm_adm1024_init(void) -{ - printk("adm1024.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&adm1024_driver); -} - -static void __exit sm_adm1024_exit(void) -{ - i2c_del_driver(&adm1024_driver); -} - - - -MODULE_AUTHOR - ("Frodo Looijaard and Philip Edelbrock "); -MODULE_DESCRIPTION("ADM1024 driver"); - -MODULE_LICENSE("GPL"); - -module_init(sm_adm1024_init); -module_exit(sm_adm1024_exit); diff --git a/kernel/chips/adm1025.c b/kernel/chips/adm1025.c deleted file mode 100644 index 22151e12..00000000 --- a/kernel/chips/adm1025.c +++ /dev/null @@ -1,588 +0,0 @@ -/* - adm1025.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2000 Chen-Yuan Wu - Copyright (c) 2003-2004 Jean Delvare - - Based on the adm9240 driver. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* Supports the Analog Devices ADM1025 and the Philips NE1619. - See doc/chips/adm1025 for details */ - -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x2c, 0x2e, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_2(adm1025, ne1619); - -/* Many ADM1025 constants specified below */ - - -/* The ADM1025 registers */ - -/* These are all read-only */ -#define ADM1025_REG_2_5V 0x20 /* not used directly, see */ -#define ADM1025_REG_VCCP1 0x21 /* ADM1025_REG_IN(nr) below */ -#define ADM1025_REG_3_3V 0x22 -#define ADM1025_REG_5V 0x23 -#define ADM1025_REG_12V 0x24 -#define ADM1025_REG_VCC 0x25 - -#define ADM1025_REG_RTEMP 0x26 /* not used directly, see */ -#define ADM1025_REG_LTEMP 0x27 /* ADM1025_REG_TEMP(nr) below */ - -#define ADM1025_REG_COMPANY_ID 0x3E /* 0x41 for Analog Devices, - 0xA1 for Philips */ -#define ADM1025_REG_DIE_REV 0x3F /* 0x20-0x2F for ADM1025 and compatible */ - -#define ADM1025_REG_STATUS1 0x41 -#define ADM1025_REG_STATUS2 0x42 - -#define ADM1025_REG_VID 0x47 -#define ADM1025_REG_VID4 0x49 /* actually R/W - but we don't write to it */ - -/* These are read/write */ -#define ADM1025_REG_2_5V_HIGH 0x2B /* not used directly, see */ -#define ADM1025_REG_2_5V_LOW 0x2C /* ADM1025_REG_IN_MAX(nr) and */ -#define ADM1025_REG_VCCP1_HIGH 0x2D /* ADM1025_REG_IN_MIN(nr) below */ -#define ADM1025_REG_VCCP1_LOW 0x2E -#define ADM1025_REG_3_3V_HIGH 0x2F -#define ADM1025_REG_3_3V_LOW 0x30 -#define ADM1025_REG_5V_HIGH 0x31 -#define ADM1025_REG_5V_LOW 0x32 -#define ADM1025_REG_12V_HIGH 0x33 -#define ADM1025_REG_12V_LOW 0x34 -#define ADM1025_REG_VCC_HIGH 0x35 -#define ADM1025_REG_VCC_LOW 0x36 - -#define ADM1025_REG_RTEMP_HIGH 0x37 /* not used directly, see */ -#define ADM1025_REG_RTEMP_LOW 0x38 /* ADM1025_REG_TEMP_MAX(nr) and */ -#define ADM1025_REG_LTEMP_HIGH 0x39 /* ADM1025_REG_TEMP_MIN(nr) below */ -#define ADM1025_REG_LTEMP_LOW 0x3A - -#define ADM1025_REG_CONFIG 0x40 - -/* Useful macros */ -#define ADM1025_REG_IN(nr) (ADM1025_REG_2_5V + (nr)) -#define ADM1025_REG_IN_MAX(nr) (ADM1025_REG_2_5V_HIGH + (nr) * 2) -#define ADM1025_REG_IN_MIN(nr) (ADM1025_REG_2_5V_LOW + (nr) * 2) -#define ADM1025_REG_TEMP(nr) (ADM1025_REG_RTEMP + (nr)) -#define ADM1025_REG_TEMP_HIGH(nr) (ADM1025_REG_RTEMP_HIGH + (nr) * 2) -#define ADM1025_REG_TEMP_LOW(nr) (ADM1025_REG_RTEMP_LOW + (nr) * 2) - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -#define IN_TO_REG(val) SENSORS_LIMIT(val, 0, 255) -#define IN_FROM_REG(val) (val) - -#define TEMP_FROM_REG(val) (((val)>=0x80?(val)-0x100:(val))*10) -#define TEMP_TO_REG(val) SENSORS_LIMIT(((val)<0?(((val)-5)/10):\ - ((val)+5)/10),-128,127) - -#define ALARMS_FROM_REG(val) (val) - -/* For each registered ADM1025, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new adm1025 client is - allocated. */ -struct adm1025_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[6]; /* Register value */ - u8 in_max[6]; /* Register value */ - u8 in_min[6]; /* Register value */ - u8 temp[2]; /* Register value */ - u8 temp_high[2]; /* Register value */ - u8 temp_low[2]; /* Register value */ - u16 alarms; /* Register encoding, combined */ - u8 vid; /* Register value combined */ - u8 vrm; -}; - - -static int adm1025_attach_adapter(struct i2c_adapter *adapter); -static int adm1025_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int adm1025_detach_client(struct i2c_client *client); -static void adm1025_update_client(struct i2c_client *client); -static void adm1025_init_client(struct i2c_client *client); - - -static void adm1025_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1025_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1025_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1025_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1025_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver adm1025_driver = { - .name = "ADM1025 sensor driver", - .id = I2C_DRIVERID_ADM1025, - .flags = I2C_DF_NOTIFY, - .attach_adapter = adm1025_attach_adapter, - .detach_client = adm1025_detach_client, -}; - -/* The /proc/sys entries */ -/* -- SENSORS SYSCTL START -- */ - -#define ADM1025_SYSCTL_IN0 1000 /* Volts * 100 */ -#define ADM1025_SYSCTL_IN1 1001 -#define ADM1025_SYSCTL_IN2 1002 -#define ADM1025_SYSCTL_IN3 1003 -#define ADM1025_SYSCTL_IN4 1004 -#define ADM1025_SYSCTL_IN5 1005 - -#define ADM1025_SYSCTL_RTEMP 1250 /* Degrees Celsius * 10 */ -#define ADM1025_SYSCTL_TEMP 1251 - -#define ADM1025_SYSCTL_ALARMS 2001 /* bitvector */ -#define ADM1025_SYSCTL_VID 2003 /* Volts * 1000 */ -#define ADM1025_SYSCTL_VRM 2004 - -#define ADM1025_ALARM_IN0 0x0001 -#define ADM1025_ALARM_IN1 0x0002 -#define ADM1025_ALARM_IN2 0x0004 -#define ADM1025_ALARM_IN3 0x0008 -#define ADM1025_ALARM_IN4 0x0100 -#define ADM1025_ALARM_IN5 0x0200 -#define ADM1025_ALARM_RTEMP 0x0020 -#define ADM1025_ALARM_TEMP 0x0010 -#define ADM1025_ALARM_RFAULT 0x4000 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected ADM1025. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table adm1025_dir_table_template[] = { - {ADM1025_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_in}, - {ADM1025_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_in}, - {ADM1025_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_in}, - {ADM1025_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_in}, - {ADM1025_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_in}, - {ADM1025_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_in}, - {ADM1025_SYSCTL_RTEMP, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_temp}, - {ADM1025_SYSCTL_TEMP, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_temp}, - {ADM1025_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_alarms}, - {ADM1025_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_vid}, - {ADM1025_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1025_vrm}, - {0} -}; - -static int adm1025_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, adm1025_detect); -} - -static int adm1025_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct adm1025_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("adm1025.o: adm1025_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access adm1025_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct adm1025_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &adm1025_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - if (kind < 0) { - if ((i2c_smbus_read_byte_data(new_client, - ADM1025_REG_CONFIG) & 0x80) != 0x00 - || (i2c_smbus_read_byte_data(new_client, - ADM1025_REG_STATUS1) & 0xC0) != 0x00 - || (i2c_smbus_read_byte_data(new_client, - ADM1025_REG_STATUS2) & 0xBC) != 0x00) - goto ERROR1; - } - - /* Determine the chip type. */ - if (kind <= 0) { - u8 man_id, chip_id; - - man_id = i2c_smbus_read_byte_data(new_client, - ADM1025_REG_COMPANY_ID); - chip_id = i2c_smbus_read_byte_data(new_client, - ADM1025_REG_DIE_REV); - - if (man_id == 0x41) { /* Analog Devices */ - if ((chip_id & 0xF0) == 0x20) /* ADM1025 */ - kind = adm1025; - } else if (man_id == 0xA1) { /* Philips */ - if (address != 0x2E - && (chip_id & 0xF0) == 0x20) /* NE1619 */ - kind = ne1619; - } - } - - if (kind <= 0) { /* Identification failed */ - printk("adm1025.o: Unsupported chip.\n"); - goto ERROR1; - } - - if (kind == adm1025) { - type_name = "adm1025"; - client_name = "ADM1025 chip"; - } else if (kind == ne1619) { - type_name = "ne1619"; - client_name = "NE1619 chip"; - } else { -#ifdef DEBUG - printk("adm1025.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - adm1025_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the ADM1025 chip */ - adm1025_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int adm1025_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct adm1025_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("adm1025.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -/* Called when we have found a new ADM1025. */ -static void adm1025_init_client(struct i2c_client *client) -{ - struct adm1025_data *data = client->data; - u8 reg; - int i; - - data->vrm = 82; - - /* Set high limits - Usually we avoid setting limits on driver init, but it happens - that the ADM1025 comes with stupid default limits (all registers - set to 0). In case the chip has not gone through any limit - setting yet, we better set the high limits to the max so that - no alarm triggers. */ - for (i=0; i<6; i++) { - reg = i2c_smbus_read_byte_data(client, - ADM1025_REG_IN_MAX(i)); - if (reg == 0) - i2c_smbus_write_byte_data(client, - ADM1025_REG_IN_MAX(i), - 0xFF); - } - for (i=0; i<2; i++) { - reg = i2c_smbus_read_byte_data(client, - ADM1025_REG_TEMP_HIGH(i)); - if (reg == 0) - i2c_smbus_write_byte_data(client, - ADM1025_REG_TEMP_HIGH(i), - 0x7F); - } - - /* Start monitoring */ - reg = i2c_smbus_read_byte_data(client, ADM1025_REG_CONFIG); - i2c_smbus_write_byte_data(client, ADM1025_REG_CONFIG, (reg|0x01)&0x7F); -} - -static void adm1025_update_client(struct i2c_client *client) -{ - struct adm1025_data *data = client->data; - u8 nr; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > 2 * HZ) - || (jiffies < data->last_updated) || !data->valid) { -#ifdef DEBUG - printk("Starting adm1025 update\n"); -#endif - - /* Voltages */ - for (nr = 0; nr < 6; nr++) { - data->in[nr] = i2c_smbus_read_byte_data(client, ADM1025_REG_IN(nr)); - data->in_min[nr] = i2c_smbus_read_byte_data(client, ADM1025_REG_IN_MIN(nr)); - data->in_max[nr] = i2c_smbus_read_byte_data(client, ADM1025_REG_IN_MAX(nr)); - } - - /* Temperatures */ - for (nr = 0; nr < 2; nr++) { - data->temp[nr] = i2c_smbus_read_byte_data(client, ADM1025_REG_TEMP(nr)); - data->temp_high[nr] = i2c_smbus_read_byte_data(client, ADM1025_REG_TEMP_HIGH(nr)); - data->temp_low[nr] = i2c_smbus_read_byte_data(client, ADM1025_REG_TEMP_LOW(nr)); - } - - /* VID */ - data->vid = (i2c_smbus_read_byte_data(client, ADM1025_REG_VID) & 0x0f) - + ((i2c_smbus_read_byte_data(client, ADM1025_REG_VID4) & 0x01) << 4); - - /* Alarms */ - data->alarms = (i2c_smbus_read_byte_data(client, ADM1025_REG_STATUS1) & 0x3f) - + ((i2c_smbus_read_byte_data(client, ADM1025_REG_STATUS2) & 0x43) << 8); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the data - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void adm1025_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - int scales[6] = { 250, 225, 330, 500, 1200, 330 }; - - struct adm1025_data *data = client->data; - int nr = ctl_name - ADM1025_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1025_update_client(client); - results[0] = (IN_FROM_REG(data->in_min[nr]) * scales[nr] + 96) / 192; - results[1] = (IN_FROM_REG(data->in_max[nr]) * scales[nr] + 96) / 192; - results[2] = (IN_FROM_REG(data->in[nr]) * scales[nr] + 96) / 192; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG((results[0] * 192 + scales[nr] / 2) - / scales[nr]); - i2c_smbus_write_byte_data(client, ADM1025_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG((results[1] * 192 + scales[nr] / 2) - / scales[nr]); - i2c_smbus_write_byte_data(client, ADM1025_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void adm1025_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1025_data *data = client->data; - int nr = ctl_name - ADM1025_SYSCTL_RTEMP; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1025_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_high[nr]); - results[1] = TEMP_FROM_REG(data->temp_low[nr]); - results[2] = TEMP_FROM_REG(data->temp[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_high[nr] = TEMP_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, ADM1025_REG_TEMP_HIGH(nr), - data->temp_high[nr]); - } - if (*nrels_mag >= 2) { - data->temp_low[nr] = TEMP_TO_REG(results[1]); - i2c_smbus_write_byte_data(client, ADM1025_REG_TEMP_LOW(nr), - data->temp_low[nr]); - } - } -} - -void adm1025_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1025_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1025_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -void adm1025_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1025_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1025_update_client(client); - results[0] = vid_from_reg(data->vid, data->vrm); - *nrels_mag = 1; - } -} - -void adm1025_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1025_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) - data->vrm = results[0]; - } -} - -static int __init sm_adm1025_init(void) -{ - printk("adm1025.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&adm1025_driver); -} - -static void __exit sm_adm1025_exit(void) -{ - i2c_del_driver(&adm1025_driver); -} - - - -MODULE_AUTHOR("Chen-Yuan Wu " - " and Jean Delvare "); -MODULE_DESCRIPTION("ADM1025 driver"); - -module_init(sm_adm1025_init); -module_exit(sm_adm1025_exit); diff --git a/kernel/chips/adm1026.c b/kernel/chips/adm1026.c deleted file mode 100644 index 6fd62d29..00000000 --- a/kernel/chips/adm1026.c +++ /dev/null @@ -1,1741 +0,0 @@ -/* - adm1026.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2002, 2003 Philip Pokorny - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - CHANGELOG - - 2003-03-13 Initial development - 2003-05-07 First Release. Includes GPIO fixup and full - functionality. - 2003-05-18 Minor fixups and tweaks. - Print GPIO config after fixup. - Adjust fan MIN if DIV changes. - 2003-05-21 Fix printing of FAN/GPIO config - Fix silly bug in fan_div logic - Fix fan_min handling so that 0xff is 0 is 0xff - 2003-05-25 Fix more silly typos... - 2003-06-11 Change FAN_xx_REG macros to use different scaling - Most (all?) drivers assume two pulses per rev fans - and the old scaling was producing double the RPM's - Thanks to Jerome Hsiao @ Arima for pointing this out. - 2004-01-27 Remove use of temporary ID. - Define addresses as a range. -*/ - -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" - -#ifndef I2C_DRIVERID_ADM1026 -#define I2C_DRIVERID_ADM1026 1048 -#endif - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x2c, 0x2e, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(adm1026); - -static int gpio_input[17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1 }; -static int gpio_output[17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1 }; -static int gpio_inverted[17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1 }; -static int gpio_normal[17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1 }; -static int gpio_fan[8] = { -1, -1, -1, -1, -1, -1, -1, -1 }; -MODULE_PARM(gpio_input,"1-17i"); -MODULE_PARM_DESC(gpio_input,"List of GPIO pins (0-16) to program as inputs"); -MODULE_PARM(gpio_output,"1-17i"); -MODULE_PARM_DESC(gpio_output,"List of GPIO pins (0-16) to program as outputs"); -MODULE_PARM(gpio_inverted,"1-17i"); -MODULE_PARM_DESC(gpio_inverted,"List of GPIO pins (0-16) to program as inverted"); -MODULE_PARM(gpio_normal,"1-17i"); -MODULE_PARM_DESC(gpio_normal,"List of GPIO pins (0-16) to program as normal/non-inverted"); -MODULE_PARM(gpio_fan,"1-8i"); -MODULE_PARM_DESC(gpio_fan,"List of GPIO pins (0-7) to program as fan tachs"); - -/* Many ADM1026 constants specified below */ - -/* The ADM1026 registers */ -#define ADM1026_REG_CONFIG1 (0x00) -#define CFG1_MONITOR (0x01) -#define CFG1_INT_ENABLE (0x02) -#define CFG1_INT_CLEAR (0x04) -#define CFG1_AIN8_9 (0x08) -#define CFG1_THERM_HOT (0x10) -#define CFG1_DAC_AFC (0x20) -#define CFG1_PWM_AFC (0x40) -#define CFG1_RESET (0x80) -#define ADM1026_REG_CONFIG2 (0x01) -/* CONFIG2 controls FAN0/GPIO0 through FAN7/GPIO7 */ -#define ADM1026_REG_CONFIG3 (0x07) -#define CFG3_GPIO16_ENABLE (0x01) -#define CFG3_CI_CLEAR (0x02) -#define CFG3_VREF_250 (0x04) -#define CFG3_GPIO16_DIR (0x40) -#define CFG3_GPIO16_POL (0x80) -#define ADM1026_REG_E2CONFIG (0x13) -#define E2CFG_READ (0x01) -#define E2CFG_WRITE (0x02) -#define E2CFG_ERASE (0x04) -#define E2CFG_ROM (0x08) -#define E2CFG_CLK_EXT (0x80) - -/* There are 10 general analog inputs and 7 dedicated inputs - * They are: - * 0 - 9 = AIN0 - AIN9 - * 10 = Vbat - * 11 = 3.3V Standby - * 12 = 3.3V Main - * 13 = +5V - * 14 = Vccp (CPU core voltage) - * 15 = +12V - * 16 = -12V - */ -static u16 REG_IN[] = { - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, - 0x36, 0x37, 0x27, 0x29, 0x26, 0x2a, - 0x2b, 0x2c, 0x2d, 0x2e, 0x2f - }; -static u16 REG_IN_MIN[] = { - 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, - 0x5e, 0x5f, 0x6d, 0x49, 0x6b, 0x4a, - 0x4b, 0x4c, 0x4d, 0x4e, 0x4f - }; -static u16 REG_IN_MAX[] = { - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, - 0x56, 0x57, 0x6c, 0x41, 0x6a, 0x42, - 0x43, 0x44, 0x45, 0x46, 0x47 - }; -#define ADM1026_REG_IN(nr) (REG_IN[(nr)]) -#define ADM1026_REG_IN_MIN(nr) (REG_IN_MIN[(nr)]) -#define ADM1026_REG_IN_MAX(nr) (REG_IN_MAX[(nr)]) - -/* Temperatures are: - * 0 - Internal - * 1 - External 1 - * 2 - External 2 - */ -static u16 REG_TEMP[] = { 0x1f, 0x28, 0x29 }; -static u16 REG_TEMP_MIN[] = { 0x69, 0x48, 0x49 }; -static u16 REG_TEMP_MAX[] = { 0x68, 0x40, 0x41 }; -static u16 REG_TEMP_TMIN[] = { 0x10, 0x11, 0x12 }; -static u16 REG_TEMP_THERM[] = { 0x0d, 0x0e, 0x0f }; -static u16 REG_TEMP_OFFSET[] = { 0x1e, 0x6e, 0x6f }; -#define ADM1026_REG_TEMP(nr) (REG_TEMP[(nr)]) -#define ADM1026_REG_TEMP_MIN(nr) (REG_TEMP_MIN[(nr)]) -#define ADM1026_REG_TEMP_MAX(nr) (REG_TEMP_MAX[(nr)]) -#define ADM1026_REG_TEMP_TMIN(nr) (REG_TEMP_TMIN[(nr)]) -#define ADM1026_REG_TEMP_THERM(nr) (REG_TEMP_THERM[(nr)]) -#define ADM1026_REG_TEMP_OFFSET(nr) (REG_TEMP_OFFSET[(nr)]) - -#define ADM1026_REG_FAN(nr) (0x38 + (nr)) -#define ADM1026_REG_FAN_MIN(nr) (0x60 + (nr)) -#define ADM1026_REG_FAN_DIV_0_3 (0x02) -#define ADM1026_REG_FAN_DIV_4_7 (0x03) - -#define ADM1026_REG_DAC (0x04) -#define ADM1026_REG_PWM (0x05) - -#define ADM1026_REG_GPIO_CFG_0_3 (0x08) -#define ADM1026_REG_GPIO_CFG_4_7 (0x09) -#define ADM1026_REG_GPIO_CFG_8_11 (0x0a) -#define ADM1026_REG_GPIO_CFG_12_15 (0x0b) -/* CFG_16 in REG_CFG3 */ -#define ADM1026_REG_GPIO_STATUS_0_7 (0x24) -#define ADM1026_REG_GPIO_STATUS_8_15 (0x25) -/* STATUS_16 in REG_STATUS4 */ -#define ADM1026_REG_GPIO_MASK_0_7 (0x1c) -#define ADM1026_REG_GPIO_MASK_8_15 (0x1d) -/* MASK_16 in REG_MASK4 */ - -#define ADM1026_REG_COMPANY 0x16 -#define ADM1026_REG_VERSTEP 0x17 -/* These are the recognized values for the above regs */ -#define ADM1026_COMPANY_ANALOG_DEV 0x41 -#define ADM1026_VERSTEP_GENERIC 0x40 -#define ADM1026_VERSTEP_ADM1026 0x44 - -#define ADM1026_REG_MASK1 0x18 -#define ADM1026_REG_MASK2 0x19 -#define ADM1026_REG_MASK3 0x1a -#define ADM1026_REG_MASK4 0x1b - -#define ADM1026_REG_STATUS1 0x20 -#define ADM1026_REG_STATUS2 0x21 -#define ADM1026_REG_STATUS3 0x22 -#define ADM1026_REG_STATUS4 0x23 - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - */ - -/* IN are scaled acording to built-in resistors. These are the - * voltages corresponding to 3/4 of full scale (192 or 0xc0) - * NOTE: The -12V input needs an additional factor to account - * for the Vref pullup resistor. - * NEG12_OFFSET = SCALE * Vref / V-192 - Vref - * = 13875 * 2.50 / 1.875 - 2500 - * = 16000 - */ -#if 1 -/* The values in this table are based on Table II, page 15 of the - * datasheet. - */ -static int adm1026_scaling[] = { /* .001 Volts */ - 2250, 2250, 2250, 2250, 2250, 2250, - 1875, 1875, 1875, 1875, 3000, 3330, - 3330, 4995, 2250, 12000, 13875 - }; -#define NEG12_OFFSET 16000 -#else -/* The values in this table are based on the resistors in - * Figure 5 on page 16. But the 3.3V inputs are not in - * the figure and the values for the 5V input are wrong. - * For 5V, I'm guessing that R2 at 55.2k is right, but - * the total resistance should be 1400 or 1449 like the - * other inputs. Using 1449, gives 4.922V at 192. - */ -static int adm1026_scaling[] = { /* .001 Volts */ - 2249, 2249, 2249, 2249, 2249, 2249, - 1875, 1875, 1875, 1875, 3329, 3329, - 3329, 4922, 2249, 11969, 13889 - }; -#define NEG12_OFFSET 16019 -#endif - -#define SCALE(val,from,to) (((val)*(to) + ((from)/2))/(from)) -#define INS_TO_REG(n,val) (SENSORS_LIMIT(SCALE(val,adm1026_scaling[n],192),0,255)) -#if 0 /* If we have extended A/D bits */ -#define INSEXT_FROM_REG(n,val,ext) (SCALE((val)*4 + (ext),192*4,adm1026_scaling[n])) -#define INS_FROM_REG(n,val) (INSEXT_FROM_REG(n,val,0)) -#else -#define INS_FROM_REG(n,val) (SCALE(val,192,adm1026_scaling[n])) -#endif - -/* FAN speed is measured using 22.5kHz clock and counts for 2 pulses - * and we assume a 2 pulse-per-rev fan tach signal - * 22500 kHz * 60 (sec/min) * 2 (pulse) / 2 (pulse/rev) == 1350000 - */ -#define FAN_TO_REG(val,div) ((val)<=0 ? 0xff : SENSORS_LIMIT(1350000/((val)*(div)),1,254)) -#define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==0xff ? 0 : 1350000/((val)*(div))) -#define DIV_FROM_REG(val) (1<<(val)) -#define DIV_TO_REG(val) ((val)>=8 ? 3 : (val)>=4 ? 2 : (val)>=2 ? 1 : 0) - -/* Temperature is reported in 1 degC increments */ -#define TEMP_TO_REG(val) (SENSORS_LIMIT(val,-127,127)) -#define TEMP_FROM_REG(val) (val) -#define OFFSET_TO_REG(val) (SENSORS_LIMIT(val,-127,127)) -#define OFFSET_FROM_REG(val) (val) - -#define PWM_TO_REG(val) (SENSORS_LIMIT(val,0,255)) -#define PWM_FROM_REG(val) (val) - -/* Analog output is a voltage, but it's used like a PWM - * Seems like this should be scaled, but to be consistent - * with other drivers, we do it this way. - */ -#define DAC_TO_REG(val) (SENSORS_LIMIT(val,0,255)) -#define DAC_FROM_REG(val) (val) - -/* sensors_vid.h defines vid_from_reg() */ -#define VID_FROM_REG(val,vrm) (vid_from_reg(val,vrm)) - -#define ALARMS_FROM_REG(val) (val) - -/* Unlike some other drivers we DO NOT set initial limits. Use - * the config file to set limits. - */ - -/* Typically used with systems using a v9.1 VRM spec ? */ -#define ADM1026_INIT_VRM 91 -#define ADM1026_INIT_VID -1 - -/* Chip sampling rates - * - * Some sensors are not updated more frequently than once per second - * so it doesn't make sense to read them more often than that. - * We cache the results and return the saved data if the driver - * is called again before a second has elapsed. - * - * Also, there is significant configuration data for this chip - * So, we keep the config data up to date in the cache - * when it is written and only sample it once every 5 *minutes* - */ -#define ADM1026_DATA_INTERVAL (1 * HZ) -#define ADM1026_CONFIG_INTERVAL (5 * 60 * HZ) - -/* We allow for multiple chips in a single system. - * - * For each registered ADM1026, we need to keep state information - * at client->data. The adm1026_data structure is dynamically - * allocated, when a new client structure is allocated. */ - -struct adm1026_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - int valid; /* !=0 if following fields are valid */ - unsigned long last_reading; /* In jiffies */ - unsigned long last_config; /* In jiffies */ - - u8 in[17]; /* Register value */ - u8 in_max[17]; /* Register value */ - u8 in_min[17]; /* Register value */ - s8 temp[3]; /* Register value */ - s8 temp_min[3]; /* Register value */ - s8 temp_max[3]; /* Register value */ - s8 temp_tmin[3]; /* Register value */ - s8 temp_therm[3]; /* Register value */ - s8 temp_offset[3]; /* Register value */ - u8 fan[8]; /* Register value */ - u8 fan_min[8]; /* Register value */ - u8 fan_div[8]; /* Decoded value */ - u8 pwm; /* Register value */ - u8 analog_out; /* Register value */ - int vid; /* Decoded value */ - u8 vrm; /* VRM version */ - long alarms; /* Register encoding, combined */ - long alarm_mask; /* Register encoding, combined */ - long gpio; /* Register encoding, combined */ - long gpio_mask; /* Register encoding, combined */ - u8 gpio_config[17]; /* Decoded value */ - u8 config1; /* Register value */ - u8 config2; /* Register value */ - u8 config3; /* Register value */ -}; - -static int adm1026_attach_adapter(struct i2c_adapter *adapter); -static int adm1026_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int adm1026_detach_client(struct i2c_client *client); - -static int adm1026_read_value(struct i2c_client *client, u8 register); -static int adm1026_write_value(struct i2c_client *client, u8 register, int value); -static void adm1026_print_gpio(struct i2c_client *client); -static void adm1026_fixup_gpio(struct i2c_client *client); -static void adm1026_update_client(struct i2c_client *client); -static void adm1026_init_client(struct i2c_client *client); - - -static void adm1026_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void adm1026_in16(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void adm1026_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_fixup_fan_min(struct i2c_client *client, - int fan, int old_div); -static void adm1026_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_temp_offset(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_temp_tmin(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_temp_therm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_alarm_mask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_gpio(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_gpio_mask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_analog_out(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1026_afc(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver adm1026_driver = { - .name = "ADM1026 compatible sensor driver", - .id = I2C_DRIVERID_ADM1026, - .flags = I2C_DF_NOTIFY, - .attach_adapter = &adm1026_attach_adapter, - .detach_client = &adm1026_detach_client, -}; - -/* Unique ID assigned to each ADM1026 detected */ -static int adm1026_id = 0; - -/* -- SENSORS SYSCTL START -- */ -#define ADM1026_SYSCTL_FAN0 1000 -#define ADM1026_SYSCTL_FAN1 1001 -#define ADM1026_SYSCTL_FAN2 1002 -#define ADM1026_SYSCTL_FAN3 1003 -#define ADM1026_SYSCTL_FAN4 1004 -#define ADM1026_SYSCTL_FAN5 1005 -#define ADM1026_SYSCTL_FAN6 1006 -#define ADM1026_SYSCTL_FAN7 1007 -#define ADM1026_SYSCTL_FAN_DIV 1008 -#define ADM1026_SYSCTL_GPIO 1009 -#define ADM1026_SYSCTL_GPIO_MASK 1010 -#define ADM1026_SYSCTL_ALARMS 1011 -#define ADM1026_SYSCTL_ALARM_MASK 1012 -#define ADM1026_SYSCTL_IN0 1013 -#define ADM1026_SYSCTL_IN1 1014 -#define ADM1026_SYSCTL_IN2 1015 -#define ADM1026_SYSCTL_IN3 1016 -#define ADM1026_SYSCTL_IN4 1017 -#define ADM1026_SYSCTL_IN5 1018 -#define ADM1026_SYSCTL_IN6 1019 -#define ADM1026_SYSCTL_IN7 1020 -#define ADM1026_SYSCTL_IN8 1021 -#define ADM1026_SYSCTL_IN9 1022 -#define ADM1026_SYSCTL_IN10 1023 -#define ADM1026_SYSCTL_IN11 1024 -#define ADM1026_SYSCTL_IN12 1025 -#define ADM1026_SYSCTL_IN13 1026 -#define ADM1026_SYSCTL_IN14 1027 -#define ADM1026_SYSCTL_IN15 1028 -#define ADM1026_SYSCTL_IN16 1029 -#define ADM1026_SYSCTL_PWM 1030 -#define ADM1026_SYSCTL_ANALOG_OUT 1031 -#define ADM1026_SYSCTL_AFC 1032 -#define ADM1026_SYSCTL_TEMP1 1033 -#define ADM1026_SYSCTL_TEMP2 1034 -#define ADM1026_SYSCTL_TEMP3 1035 -#define ADM1026_SYSCTL_TEMP_OFFSET1 1036 -#define ADM1026_SYSCTL_TEMP_OFFSET2 1037 -#define ADM1026_SYSCTL_TEMP_OFFSET3 1038 -#define ADM1026_SYSCTL_TEMP_THERM1 1039 -#define ADM1026_SYSCTL_TEMP_THERM2 1040 -#define ADM1026_SYSCTL_TEMP_THERM3 1041 -#define ADM1026_SYSCTL_TEMP_TMIN1 1042 -#define ADM1026_SYSCTL_TEMP_TMIN2 1043 -#define ADM1026_SYSCTL_TEMP_TMIN3 1044 -#define ADM1026_SYSCTL_VID 1045 -#define ADM1026_SYSCTL_VRM 1046 - -#define ADM1026_ALARM_TEMP2 (1L << 0) -#define ADM1026_ALARM_TEMP3 (1L << 1) -#define ADM1026_ALARM_IN9 (1L << 1) -#define ADM1026_ALARM_IN11 (1L << 2) -#define ADM1026_ALARM_IN12 (1L << 3) -#define ADM1026_ALARM_IN13 (1L << 4) -#define ADM1026_ALARM_IN14 (1L << 5) -#define ADM1026_ALARM_IN15 (1L << 6) -#define ADM1026_ALARM_IN16 (1L << 7) -#define ADM1026_ALARM_IN0 (1L << 8) -#define ADM1026_ALARM_IN1 (1L << 9) -#define ADM1026_ALARM_IN2 (1L << 10) -#define ADM1026_ALARM_IN3 (1L << 11) -#define ADM1026_ALARM_IN4 (1L << 12) -#define ADM1026_ALARM_IN5 (1L << 13) -#define ADM1026_ALARM_IN6 (1L << 14) -#define ADM1026_ALARM_IN7 (1L << 15) -#define ADM1026_ALARM_FAN0 (1L << 16) -#define ADM1026_ALARM_FAN1 (1L << 17) -#define ADM1026_ALARM_FAN2 (1L << 18) -#define ADM1026_ALARM_FAN3 (1L << 19) -#define ADM1026_ALARM_FAN4 (1L << 20) -#define ADM1026_ALARM_FAN5 (1L << 21) -#define ADM1026_ALARM_FAN6 (1L << 22) -#define ADM1026_ALARM_FAN7 (1L << 23) -#define ADM1026_ALARM_TEMP1 (1L << 24) -#define ADM1026_ALARM_IN10 (1L << 25) -#define ADM1026_ALARM_IN8 (1L << 26) -#define ADM1026_ALARM_THERM (1L << 27) -#define ADM1026_ALARM_AFC_FAN (1L << 28) -#define ADM1026_ALARM_UNUSED (1L << 29) -#define ADM1026_ALARM_CI (1L << 30) -/* -- SENSORS SYSCTL END -- */ - -/* The /proc/sys entries */ -/* These files are created for each detected ADM1026. This is just a template; - * The actual list is built from this and additional per-chip - * custom lists below. Note the XXX_LEN macros. These must be - * compile time constants because they will be used to allocate - * space for the final template passed to i2c_register_entry. - * We depend on the ability of GCC to evaluate expressions at - * compile time to turn these expressions into compile time - * constants, but this can generate a warning. - */ -static ctl_table adm1026_common[] = { - {ADM1026_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN9, "in9", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN10, "in10", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN11, "in11", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN12, "in12", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN13, "in13", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN14, "in14", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN15, "in15", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in}, - {ADM1026_SYSCTL_IN16, "in16", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_in16}, - - {ADM1026_SYSCTL_FAN0, "fan0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_fan}, - {ADM1026_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_fan}, - {ADM1026_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_fan}, - {ADM1026_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_fan}, - {ADM1026_SYSCTL_FAN4, "fan4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_fan}, - {ADM1026_SYSCTL_FAN5, "fan5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_fan}, - {ADM1026_SYSCTL_FAN6, "fan6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_fan}, - {ADM1026_SYSCTL_FAN7, "fan7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_fan}, - {ADM1026_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_fan_div}, - - {ADM1026_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_temp}, - {ADM1026_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_temp}, - {ADM1026_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_temp}, - {ADM1026_SYSCTL_TEMP_OFFSET1, "temp1_offset", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_temp_offset}, - {ADM1026_SYSCTL_TEMP_OFFSET2, "temp2_offset", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_temp_offset}, - {ADM1026_SYSCTL_TEMP_OFFSET3, "temp3_offset", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_temp_offset}, - {ADM1026_SYSCTL_TEMP_TMIN1, "temp1_tmin", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_temp_tmin}, - {ADM1026_SYSCTL_TEMP_TMIN2, "temp2_tmin", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_temp_tmin}, - {ADM1026_SYSCTL_TEMP_TMIN3, "temp3_tmin", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_temp_tmin}, - {ADM1026_SYSCTL_TEMP_THERM1, "temp1_therm", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_temp_therm}, - {ADM1026_SYSCTL_TEMP_THERM2, "temp2_therm", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_temp_therm}, - {ADM1026_SYSCTL_TEMP_THERM3, "temp3_therm", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_temp_therm}, - - {ADM1026_SYSCTL_VID, "vid", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_vid}, - {ADM1026_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_vrm}, - - {ADM1026_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_alarms}, - {ADM1026_SYSCTL_ALARM_MASK, "alarm_mask", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_alarm_mask}, - - {ADM1026_SYSCTL_GPIO, "gpio", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_gpio}, - {ADM1026_SYSCTL_GPIO_MASK, "gpio_mask", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_gpio_mask}, - - {ADM1026_SYSCTL_PWM, "pwm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_pwm}, - {ADM1026_SYSCTL_ANALOG_OUT, "analog_out", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1026_analog_out}, - {ADM1026_SYSCTL_AFC, "afc", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1026_afc}, - - {0} -}; -#define CTLTBL_COMMON (sizeof(adm1026_common)/sizeof(adm1026_common[0])) - -#define MAX2(a,b) ((a)>(b)?(a):(b)) -#define MAX3(a,b,c) ((a)>(b)?MAX2((a),(c)):MAX2((b),(c))) -#define MAX4(a,b,c,d) ((a)>(b)?MAX3((a),(c),(d)):MAX3((b),(c),(d))) - -#define CTLTBL_MAX (CTLTBL_COMMON) - -/* This function is called when: - * the module is loaded - * a new adapter is loaded - */ -static int adm1026_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, adm1026_detect); -} - -/* This function is called by i2c_detect */ -static int adm1026_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - int company, verstep ; - struct i2c_client *new_client; - struct adm1026_data *data; - int err = 0; - const char *type_name = ""; - struct ctl_table template[CTLTBL_MAX] ; - struct ctl_table * template_next = template ; - - if (i2c_is_isa_adapter(adapter)) { - /* This chip has no ISA interface */ - goto ERROR0 ; - } - - if (!i2c_check_functionality(adapter, - I2C_FUNC_SMBUS_BYTE_DATA)) { - /* We need to be able to do byte I/O */ - goto ERROR0 ; - } - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access adm1026_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct adm1026_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &adm1026_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - company = adm1026_read_value(new_client, ADM1026_REG_COMPANY); - verstep = adm1026_read_value(new_client, ADM1026_REG_VERSTEP); - -#ifdef DEBUG - printk("adm1026: Detecting device at %d,0x%02x with" - " COMPANY: 0x%02x and VERSTEP: 0x%02x\n", - i2c_adapter_id(new_client->adapter), new_client->addr, - company, verstep - ); -#endif - - /* If auto-detecting, Determine the chip type. */ - if (kind <= 0) { -#ifdef DEBUG - printk("adm1026: Autodetecting device at %d,0x%02x ...\n", - i2c_adapter_id(adapter), address ); -#endif - if( company == ADM1026_COMPANY_ANALOG_DEV - && verstep == ADM1026_VERSTEP_ADM1026 ) { - kind = adm1026 ; - } else if( company == ADM1026_COMPANY_ANALOG_DEV - && (verstep & 0xf0) == ADM1026_VERSTEP_GENERIC ) { - printk("adm1026: Unrecgonized stepping 0x%02x" - " Defaulting to ADM1026.\n", verstep ); - kind = adm1026 ; - } else if( (verstep & 0xf0) == ADM1026_VERSTEP_GENERIC ) { - printk("adm1026: Found version/stepping 0x%02x" - " Assuming generic ADM1026.\n", verstep ); - kind = any_chip ; - } else { -#ifdef DEBUG - printk("adm1026: Autodetection failed\n"); -#endif - /* Not an ADM1026 ... */ - if( kind == 0 ) { /* User used force=x,y */ - printk("adm1026: Generic ADM1026 Version 6 not" - " found at %d,0x%02x. Try force_adm1026.\n", - i2c_adapter_id(adapter), address ); - } - goto ERROR1; - } - } - - /* Fill in the chip specific driver values */ - switch (kind) { - case any_chip : - type_name = "adm1026"; - strcpy(new_client->name, "Generic ADM1026"); - template_next = template ; /* None used */ - break ; - case adm1026 : - type_name = "adm1026"; - strcpy(new_client->name, "Analog Devices ADM1026"); - template_next = template ; - break ; -#if 0 - /* Example of another adm1026 "compatible" device */ - case adx1000 : - type_name = "adx1000"; - strcpy(new_client->name, "Compatible ADX1000"); - memcpy( template, adx_specific, sizeof(adx_specific) ); - template_next = template + CTLTBL_ADX1000 ; - break ; -#endif - default : - printk("adm1026: Internal error, invalid kind (%d)!", kind); - err = -EFAULT ; - goto ERROR1; - } - - /* Fill in the remaining client fields */ - new_client->id = adm1026_id++; - printk("adm1026(%d): Assigning ID %d to %s at %d,0x%02x\n", - new_client->id, new_client->id, new_client->name, - i2c_adapter_id(new_client->adapter), - new_client->addr - ); - - /* Housekeeping values */ - data->type = kind; - data->valid = 0; - - /* Set the VRM version */ - data->vrm = ADM1026_INIT_VRM ; - data->vid = ADM1026_INIT_VID ; - - init_MUTEX(&data->update_lock); - - /* Initialize the ADM1026 chip */ - adm1026_init_client(new_client); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR1; - - /* Finish out the template */ - memcpy(template_next, adm1026_common, sizeof(adm1026_common)); - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR2; - } - data->sysctl_id = i; - - return 0; - - /* Error out and cleanup code */ - ERROR2: - i2c_detach_client(new_client); - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int adm1026_detach_client(struct i2c_client *client) -{ - int err; - int id ; - - id = client->id; - i2c_deregister_entry(((struct adm1026_data *)(client->data))->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk("adm1026(%d): Client deregistration failed," - " client not detached.\n", id ); - return err; - } - - kfree(client->data); - - return 0; -} - -static int adm1026_read_value(struct i2c_client *client, u8 reg) -{ - int res; - - if( reg < 0x80 ) { - /* "RAM" locations */ - res = i2c_smbus_read_byte_data(client, reg) & 0xff ; - } else { - /* EEPROM, do nothing */ - res = 0 ; - } - - return res ; -} - -static int adm1026_write_value(struct i2c_client *client, u8 reg, int value) -{ - int res ; - - if( reg < 0x80 ) { - /* "RAM" locations */ - res = i2c_smbus_write_byte_data(client, reg, value); - } else { - /* EEPROM, do nothing */ - res = 0 ; - } - - return res ; -} - -/* Called when we have found a new ADM1026. */ -static void adm1026_init_client(struct i2c_client *client) -{ - int value ; - int i; - struct adm1026_data *data = client->data; - -#ifdef DEBUG - printk("adm1026(%d): Initializing device\n", client->id); -#endif - - /* Read chip config */ - data->config1 = adm1026_read_value(client, ADM1026_REG_CONFIG1); - data->config2 = adm1026_read_value(client, ADM1026_REG_CONFIG2); - data->config3 = adm1026_read_value(client, ADM1026_REG_CONFIG3); - - /* Inform user of chip config */ -#ifdef DEBUG - printk("adm1026(%d): ADM1026_REG_CONFIG1 is: 0x%02x\n", - client->id, data->config1 ); -#endif - if( (data->config1 & CFG1_MONITOR) == 0 ) { - printk("adm1026(%d): Monitoring not currently enabled.\n", - client->id ); - } - if( data->config1 & CFG1_INT_ENABLE ) { - printk("adm1026(%d): SMBALERT interrupts are enabled.\n", - client->id ); - } - if( data->config1 & CFG1_AIN8_9 ) { - printk("adm1026(%d): in8 and in9 enabled. temp3 disabled.\n", - client->id ); - } else { - printk("adm1026(%d): temp3 enabled. in8 and in9 disabled.\n", - client->id ); - } - if( data->config1 & CFG1_THERM_HOT ) { - printk("adm1026(%d): Automatic THERM, PWM, and temp limits enabled.\n", - client->id ); - } - - value = data->config3 ; - if( data->config3 & CFG3_GPIO16_ENABLE ) { - printk("adm1026(%d): GPIO16 enabled. THERM pin disabled.\n", - client->id ); - } else { - printk("adm1026(%d): THERM pin enabled. GPIO16 disabled.\n", - client->id ); - } - if( data->config3 & CFG3_VREF_250 ) { - printk("adm1026(%d): Vref is 2.50 Volts.\n", client->id ); - } else { - printk("adm1026(%d): Vref is 1.82 Volts.\n", client->id ); - } - - /* Read and pick apart the existing GPIO configuration */ - value = 0 ; - for( i = 0 ; i <= 15 ; ++i ) { - if( (i & 0x03) == 0 ) { - value = adm1026_read_value(client, - ADM1026_REG_GPIO_CFG_0_3 + i/4 ); - } - data->gpio_config[i] = value & 0x03 ; - value >>= 2 ; - } - data->gpio_config[16] = (data->config3 >> 6) & 0x03 ; - - /* ... and then print it */ - adm1026_print_gpio(client); - - /* If the user asks us to reprogram the GPIO config, then - * do it now. But only if this is the first ADM1026. - */ - if( client->id == 0 - && (gpio_input[0] != -1 || gpio_output[0] != -1 - || gpio_inverted[0] != -1 || gpio_normal[0] != -1 - || gpio_fan[0] != -1 ) ) { - adm1026_fixup_gpio(client); - } - - /* WE INTENTIONALLY make no changes to the limits, - * offsets, pwms and fans. If they were - * configured, we don't want to mess with them. - * If they weren't, the default is generally safe - * and will suffice until 'sensors -s' can be run. - */ - - /* Start monitoring */ - value = adm1026_read_value(client, ADM1026_REG_CONFIG1); - - /* Set MONITOR, clear interrupt acknowledge and s/w reset */ - value = (value | CFG1_MONITOR) & (~CFG1_INT_CLEAR & ~CFG1_RESET) ; -#ifdef DEBUG - printk("adm1026(%d): Setting CONFIG to: 0x%02x\n", client->id, value ); -#endif - data->config1 = value ; - adm1026_write_value(client, ADM1026_REG_CONFIG1, value); - -} - -static void adm1026_print_gpio(struct i2c_client *client) -{ - struct adm1026_data *data = client->data; - int i ; - - printk("adm1026(%d): GPIO config is:\nadm1026(%d):", - client->id, client->id ); - for( i = 0 ; i <= 7 ; ++i ) { - if( data->config2 & (1 << i) ) { - printk( " %sGP%s%d", - data->gpio_config[i] & 0x02 ? "" : "!", - data->gpio_config[i] & 0x01 ? "OUT" : "IN", - i ); - } else { - printk( " FAN%d", i ); - } - } - printk( "\nadm1026(%d):", client->id ); - for( i = 8 ; i <= 15 ; ++i ) { - printk( " %sGP%s%d", - data->gpio_config[i] & 0x02 ? "" : "!", - data->gpio_config[i] & 0x01 ? "OUT" : "IN", - i ); - } - if( data->config3 & CFG3_GPIO16_ENABLE ) { - printk( " %sGP%s16\n", - data->gpio_config[16] & 0x02 ? "" : "!", - data->gpio_config[16] & 0x01 ? "OUT" : "IN" ); - } else { - /* GPIO16 is THERM */ - printk( " THERM\n" ); - } -} - -static void adm1026_fixup_gpio(struct i2c_client *client) -{ - struct adm1026_data *data = client->data; - int i ; - int value ; - - /* Make the changes requested. */ - /* We may need to unlock/stop monitoring or soft-reset the - * chip before we can make changes. This hasn't been - * tested much. FIXME - */ - - /* Make outputs */ - for( i = 0 ; i <= 16 ; ++i ) { - if( gpio_output[i] >= 0 && gpio_output[i] <= 16 ) { - data->gpio_config[gpio_output[i]] |= 0x01 ; - } - /* if GPIO0-7 is output, it isn't a FAN tach */ - if( gpio_output[i] >= 0 && gpio_output[i] <= 7 ) { - data->config2 |= 1 << gpio_output[i] ; - } - } - - /* Input overrides output */ - for( i = 0 ; i <= 16 ; ++i ) { - if( gpio_input[i] >= 0 && gpio_input[i] <= 16 ) { - data->gpio_config[gpio_input[i]] &= ~ 0x01 ; - } - /* if GPIO0-7 is input, it isn't a FAN tach */ - if( gpio_input[i] >= 0 && gpio_input[i] <= 7 ) { - data->config2 |= 1 << gpio_input[i] ; - } - } - - /* Inverted */ - for( i = 0 ; i <= 16 ; ++i ) { - if( gpio_inverted[i] >= 0 && gpio_inverted[i] <= 16 ) { - data->gpio_config[gpio_inverted[i]] &= ~ 0x02 ; - } - } - - /* Normal overrides inverted */ - for( i = 0 ; i <= 16 ; ++i ) { - if( gpio_normal[i] >= 0 && gpio_normal[i] <= 16 ) { - data->gpio_config[gpio_normal[i]] |= 0x02 ; - } - } - - /* Fan overrides input and output */ - for( i = 0 ; i <= 7 ; ++i ) { - if( gpio_fan[i] >= 0 && gpio_fan[i] <= 7 ) { - data->config2 &= ~( 1 << gpio_fan[i] ); - } - } - - /* Write new configs to registers */ - adm1026_write_value(client, ADM1026_REG_CONFIG2, data->config2); - data->config3 = (data->config3 & 0x3f) - | ((data->gpio_config[16] & 0x03) << 6) ; - adm1026_write_value(client, ADM1026_REG_CONFIG3, data->config3); - for( i = 15, value = 0 ; i >= 0 ; --i ) { - value <<= 2 ; - value |= data->gpio_config[i] & 0x03 ; - if( (i & 0x03) == 0 ) { - adm1026_write_value(client, - ADM1026_REG_GPIO_CFG_0_3 + i/4, - value ); - value = 0 ; - } - } - - /* Print the new config */ - adm1026_print_gpio(client); -} - -static void adm1026_update_client(struct i2c_client *client) -{ - struct adm1026_data *data = client->data; - int i; - long value, alarms, gpio ; - - down(&data->update_lock); - - if (!data->valid - || (jiffies - data->last_reading > ADM1026_DATA_INTERVAL )) { - /* Things that change quickly */ - -#ifdef DEBUG - printk("adm1026(%d): Reading sensor values\n", client->id); -#endif - for (i = 0 ; i <= 16 ; ++i) { - data->in[i] = - adm1026_read_value(client, ADM1026_REG_IN(i)); - } - - for (i = 0 ; i <= 7 ; ++i) { - data->fan[i] = - adm1026_read_value(client, ADM1026_REG_FAN(i)); - } - - for (i = 0 ; i <= 2 ; ++i) { - /* NOTE: temp[] is s8 and we assume 2's complement - * "conversion" in the assignment */ - data->temp[i] = - adm1026_read_value(client, ADM1026_REG_TEMP(i)); - } - - data->pwm = adm1026_read_value(client, ADM1026_REG_PWM); - data->analog_out = adm1026_read_value(client, ADM1026_REG_DAC); - - /* GPIO16 is MSbit of alarms, move it to gpio */ - alarms = adm1026_read_value(client, ADM1026_REG_STATUS4); - gpio = alarms & 0x80 ? 0x0100 : 0 ; /* GPIO16 */ - alarms &= 0x7f ; - alarms <<= 8 ; - alarms |= adm1026_read_value(client, ADM1026_REG_STATUS3); - alarms <<= 8 ; - alarms |= adm1026_read_value(client, ADM1026_REG_STATUS2); - alarms <<= 8 ; - alarms |= adm1026_read_value(client, ADM1026_REG_STATUS1); - data->alarms = alarms ; - - /* Read the GPIO values */ - gpio |= adm1026_read_value(client, ADM1026_REG_GPIO_STATUS_8_15); - gpio <<= 8 ; - gpio |= adm1026_read_value(client, ADM1026_REG_GPIO_STATUS_0_7); - data->gpio = gpio ; - - data->last_reading = jiffies ; - }; /* last_reading */ - - if (!data->valid - || (jiffies - data->last_config > ADM1026_CONFIG_INTERVAL) ) { - /* Things that don't change often */ - -#ifdef DEBUG - printk("adm1026(%d): Reading config values\n", client->id); -#endif - for (i = 0 ; i <= 16 ; ++i) { - data->in_min[i] = - adm1026_read_value(client, ADM1026_REG_IN_MIN(i)); - data->in_max[i] = - adm1026_read_value(client, ADM1026_REG_IN_MAX(i)); - } - - value = adm1026_read_value(client, ADM1026_REG_FAN_DIV_0_3) - | (adm1026_read_value(client, ADM1026_REG_FAN_DIV_4_7) << 8); - for (i = 0 ; i <= 7 ; ++i) { - data->fan_min[i] = - adm1026_read_value(client, ADM1026_REG_FAN_MIN(i)); - data->fan_div[i] = DIV_FROM_REG(value & 0x03); - value >>= 2 ; - } - - for (i = 0; i <= 2; ++i) { - /* NOTE: temp_xxx[] are s8 and we assume 2's complement - * "conversion" in the assignment */ - data->temp_min[i] = - adm1026_read_value(client, ADM1026_REG_TEMP_MIN(i)); - data->temp_max[i] = - adm1026_read_value(client, ADM1026_REG_TEMP_MAX(i)); - data->temp_tmin[i] = - adm1026_read_value(client, ADM1026_REG_TEMP_TMIN(i)); - data->temp_therm[i] = - adm1026_read_value(client, ADM1026_REG_TEMP_THERM(i)); - data->temp_offset[i] = - adm1026_read_value(client, ADM1026_REG_TEMP_OFFSET(i)); - } - - /* Read the STATUS/alarm masks */ - alarms = adm1026_read_value(client, ADM1026_REG_MASK4); - gpio = alarms & 0x80 ? 0x0100 : 0 ; /* GPIO16 */ - alarms = (alarms & 0x7f) << 8 ; - alarms |= adm1026_read_value(client, ADM1026_REG_MASK3); - alarms <<= 8 ; - alarms |= adm1026_read_value(client, ADM1026_REG_MASK2); - alarms <<= 8 ; - alarms |= adm1026_read_value(client, ADM1026_REG_MASK1); - data->alarm_mask = alarms ; - - /* Read the GPIO values */ - gpio |= adm1026_read_value(client, ADM1026_REG_GPIO_MASK_8_15); - gpio <<= 8 ; - gpio |= adm1026_read_value(client, ADM1026_REG_GPIO_MASK_0_7); - data->gpio_mask = gpio ; - - /* Read the GPIO config */ - data->config2 = adm1026_read_value(client, ADM1026_REG_CONFIG2); - data->config3 = adm1026_read_value(client, ADM1026_REG_CONFIG3); - data->gpio_config[16] = (data->config3 >> 6) & 0x03 ; - - value = 0 ; - for( i = 0 ; i <= 15 ; ++i ) { - if( (i & 0x03) == 0 ) { - value = adm1026_read_value(client, - ADM1026_REG_GPIO_CFG_0_3 + i/4 ); - } - data->gpio_config[i] = value & 0x03 ; - value >>= 2 ; - } - - data->last_config = jiffies; - }; /* last_config */ - - /* We don't know where or even _if_ the VID might be on the GPIO - * pins. But the datasheet gives an example config showing - * GPIO11-15 being used to monitor VID0-4, so we go with that - * but make the vid WRITEABLE so if it's wrong, the user can - * set it in /etc/sensors.conf perhaps using an expression or - * 0 to trigger a re-read from the GPIO pins. - */ - if( data->vid == ADM1026_INIT_VID ) { - /* Hasn't been set yet, make a bold assumption */ - printk("adm1026(%d): Setting VID from GPIO11-15.\n", - client->id ); - data->vid = (data->gpio >> 11) & 0x1f ; - } - - data->valid = 1; - - up(&data->update_lock); -} - - -/* The following functions are the call-back functions of the /proc/sys and - sysctl files. The appropriate function is referenced in the ctl_table - extra1 field. - - Each function must return the magnitude (power of 10 to divide the - data with) if it is called with operation set to SENSORS_PROC_REAL_INFO. - It must put a maximum of *nrels elements in results reflecting the - data of this file, and set *nrels to the number it actually put in - it, if operation is SENSORS_PROC_REAL_READ. Finally, it must get - up to *nrels elements from results and write them to the chip, if - operations is SENSORS_PROC_REAL_WRITE. - */ -void adm1026_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - int nr = ctl_name - ADM1026_SYSCTL_IN0; - - /* We handle in0 - in15 here. in16 (-12V) is handled below */ - if (nr < 0 || nr > 15) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; /* 1.000 */ - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = INS_FROM_REG(nr,data->in_min[nr]); - results[1] = INS_FROM_REG(nr,data->in_max[nr]); - results[2] = INS_FROM_REG(nr,data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 1) { - data->in_max[nr] = INS_TO_REG(nr,results[1]); - adm1026_write_value(client, ADM1026_REG_IN_MAX(nr), - data->in_max[nr]); - } - if (*nrels_mag > 0) { - data->in_min[nr] = INS_TO_REG(nr,results[0]); - adm1026_write_value(client, ADM1026_REG_IN_MIN(nr), - data->in_min[nr]); - } - up(&data->update_lock); - } -} - -void adm1026_in16(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - int nr = ctl_name - ADM1026_SYSCTL_IN0; - - /* We handle in16 (-12V) here */ - if (nr != 16) - return ; /* ERROR */ - - /* Apply offset and swap min/max so that min is 90% of - * target and max is 110% of target. - */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; /* 1.000 */ - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = INS_FROM_REG(nr,data->in_max[nr])-NEG12_OFFSET ; - results[1] = INS_FROM_REG(nr,data->in_min[nr])-NEG12_OFFSET ; - results[2] = INS_FROM_REG(nr,data->in[nr])-NEG12_OFFSET ; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 1) { - data->in_min[nr] = INS_TO_REG(nr,results[1]+NEG12_OFFSET); - adm1026_write_value(client, ADM1026_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag > 0) { - data->in_max[nr] = INS_TO_REG(nr,results[0]+NEG12_OFFSET); - adm1026_write_value(client, ADM1026_REG_IN_MAX(nr), - data->in_max[nr]); - } - up(&data->update_lock); - } -} - -void adm1026_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - int nr = ctl_name - ADM1026_SYSCTL_FAN0 ; - - if (nr < 0 || nr > 7) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr], data->fan_div[nr]); - results[1] = FAN_FROM_REG(data->fan[nr], data->fan_div[nr]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->fan_min[nr] = FAN_TO_REG(results[0], - data->fan_div[nr]); - adm1026_write_value(client, ADM1026_REG_FAN_MIN(nr), - data->fan_min[nr]); - } - up(&data->update_lock); - } -} - -/* Adjust fan_min to account for new fan divisor */ -void adm1026_fixup_fan_min(struct i2c_client *client, int fan, int old_div) -{ - struct adm1026_data *data = client->data; - int new_div = data->fan_div[fan] ; - int new_min; - - /* 0 and 0xff are special. Don't adjust them */ - if( data->fan_min[fan] == 0 || data->fan_min[fan] == 0xff ) { - return ; - } - - new_min = data->fan_min[fan] * old_div / new_div ; - new_min = SENSORS_LIMIT(new_min, 1, 254); - data->fan_min[fan] = new_min ; - adm1026_write_value(client, ADM1026_REG_FAN_MIN(fan), new_min); -} - -void adm1026_fan_div(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - int i ; - int value, div, old ; - - if (ctl_name != ADM1026_SYSCTL_FAN_DIV) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - for( i = 0 ; i <= 7 ; ++i ) { - results[i] = data->fan_div[i] ; - } - *nrels_mag = 8; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - value = 0 ; - for( i = 7 ; i >= 0 ; --i ) { - value <<= 2 ; - if (*nrels_mag > i) { - old = data->fan_div[i] ; - div = DIV_TO_REG(results[i]) ; - data->fan_div[i] = DIV_FROM_REG(div) ; - if( data->fan_div[i] != old ) { - adm1026_fixup_fan_min(client,i,old); - } - } else { - div = DIV_TO_REG(data->fan_div[i]) ; - } - value |= div ; - } - adm1026_write_value(client, ADM1026_REG_FAN_DIV_0_3, - value & 0xff); - adm1026_write_value(client, ADM1026_REG_FAN_DIV_4_7, - (value >> 8) & 0xff); - up(&data->update_lock); - } -} - -void adm1026_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - int nr = ctl_name - ADM1026_SYSCTL_TEMP1 ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_min[nr]); - results[1] = TEMP_FROM_REG(data->temp_max[nr]); - results[2] = TEMP_FROM_REG(data->temp[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 1) { - data->temp_max[nr] = TEMP_TO_REG(results[1]); - adm1026_write_value(client, ADM1026_REG_TEMP_MAX(nr), - data->temp_max[nr]); - } - if (*nrels_mag > 0) { - data->temp_min[nr] = TEMP_TO_REG(results[0]); - adm1026_write_value(client, ADM1026_REG_TEMP_MIN(nr), - data->temp_min[nr]); - } - up(&data->update_lock); - } -} - -void adm1026_temp_offset(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - int nr = ctl_name - ADM1026_SYSCTL_TEMP_OFFSET1 ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_offset[nr]); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->temp_offset[nr] = TEMP_TO_REG(results[0]); - adm1026_write_value(client, ADM1026_REG_TEMP_OFFSET(nr), - data->temp_offset[nr]); - } - up(&data->update_lock); - } -} - -void adm1026_temp_tmin(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - int nr = ctl_name - ADM1026_SYSCTL_TEMP_TMIN1 ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_tmin[nr]); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->temp_tmin[nr] = TEMP_TO_REG(results[0]); - adm1026_write_value(client, ADM1026_REG_TEMP_TMIN(nr), - data->temp_tmin[nr]); - } - up(&data->update_lock); - } -} - -void adm1026_temp_therm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - int nr = ctl_name - ADM1026_SYSCTL_TEMP_THERM1 ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_therm[nr]); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->temp_therm[nr] = TEMP_TO_REG(results[0]); - adm1026_write_value(client, ADM1026_REG_TEMP_THERM(nr), - data->temp_therm[nr]); - } - up(&data->update_lock); - } -} - -void adm1026_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - - if (ctl_name != ADM1026_SYSCTL_PWM) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = PWM_FROM_REG(data->pwm); - results[1] = 1 ; /* Always enabled */ - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - /* PWM enable is read-only */ - if (*nrels_mag > 0) { - data->pwm = PWM_TO_REG(results[0]); - adm1026_write_value(client, ADM1026_REG_PWM, - data->pwm); - } - up(&data->update_lock); - } -} - -void adm1026_analog_out(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - - if (ctl_name != ADM1026_SYSCTL_ANALOG_OUT) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* 0 - 255 */ - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = DAC_FROM_REG(data->analog_out); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->analog_out = DAC_TO_REG(results[0]); - adm1026_write_value(client, ADM1026_REG_DAC, - data->analog_out); - } - up(&data->update_lock); - } -} - -void adm1026_afc(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - - if (ctl_name != ADM1026_SYSCTL_AFC) - return ; /* ERROR */ - - /* PWM auto fan control, DAC auto fan control */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = (data->config1 & CFG1_PWM_AFC) != 0 ; - results[1] = (data->config1 & CFG1_DAC_AFC) != 0 ; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 1) { - data->config1 = (data->config1 & ~CFG1_DAC_AFC) - | (results[1] ? CFG1_DAC_AFC : 0) ; - } - if (*nrels_mag > 0) { - data->config1 = (data->config1 & ~CFG1_PWM_AFC) - | (results[0] ? CFG1_PWM_AFC : 0) ; - adm1026_write_value(client, ADM1026_REG_CONFIG1, - data->config1); - } - up(&data->update_lock); - } -} - -void adm1026_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - - if( ctl_name != ADM1026_SYSCTL_VID ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = VID_FROM_REG((data->vid)&0x3f,data->vrm); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - /* Hmmm... There isn't a VID_TO_REG mapping */ - if (*nrels_mag > 0) { - if( results[0] >= 0 ) { - data->vid = results[0] & 0x3f ; - } else { - data->vid = ADM1026_INIT_VID ; - } - } - up(&data->update_lock); - } - -} - -void adm1026_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - - if( ctl_name != ADM1026_SYSCTL_VRM ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm ; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag > 0) { - data->vrm = results[0] ; - } - } -} - -void adm1026_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - - if( ctl_name != ADM1026_SYSCTL_ALARMS ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = data->alarms ; - *nrels_mag = 1; - } - /* FIXME: Perhaps we should implement a write function - * to clear an alarm? - */ -} - -void adm1026_alarm_mask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - unsigned long mask ; - - if( ctl_name != ADM1026_SYSCTL_ALARM_MASK ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = data->alarm_mask ; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->alarm_mask = results[0] & 0x7fffffff ; - mask = data->alarm_mask - | (data->gpio_mask & 0x10000 ? 0x80000000 : 0) ; - adm1026_write_value(client, ADM1026_REG_MASK1, - mask & 0xff); - mask >>= 8 ; - adm1026_write_value(client, ADM1026_REG_MASK2, - mask & 0xff); - mask >>= 8 ; - adm1026_write_value(client, ADM1026_REG_MASK3, - mask & 0xff); - mask >>= 8 ; - adm1026_write_value(client, ADM1026_REG_MASK4, - mask & 0xff); - } - up(&data->update_lock); - } -} - -void adm1026_gpio(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - long gpio ; - - if( ctl_name != ADM1026_SYSCTL_GPIO ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = data->gpio ; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->gpio = results[0] & 0x1ffff ; - gpio = data->gpio ; - adm1026_write_value(client, - ADM1026_REG_GPIO_STATUS_0_7, - gpio & 0xff ); - gpio >>= 8 ; - adm1026_write_value(client, - ADM1026_REG_GPIO_STATUS_8_15, - gpio & 0xff ); - gpio = ((gpio >> 1) & 0x80) - | (data->alarms >> 24 & 0x7f); - adm1026_write_value(client, - ADM1026_REG_STATUS4, - gpio & 0xff ); - } - up(&data->update_lock); - } -} - -void adm1026_gpio_mask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm1026_data *data = client->data; - long mask ; - - if( ctl_name != ADM1026_SYSCTL_GPIO_MASK ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1026_update_client(client); - results[0] = data->gpio_mask ; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->gpio_mask = results[0] & 0x1ffff ; - mask = data->gpio_mask ; - adm1026_write_value(client, ADM1026_REG_GPIO_MASK_0_7, - mask & 0xff); - mask >>= 8 ; - adm1026_write_value(client, ADM1026_REG_GPIO_MASK_8_15, - mask & 0xff); - mask = ((mask >> 1) & 0x80) - | (data->alarm_mask >> 24 & 0x7f); - adm1026_write_value(client, ADM1026_REG_MASK1, - mask & 0xff); - } - up(&data->update_lock); - } -} - -static int __init sm_adm1026_init(void) -{ - printk("adm1026: Version %s (%s)\n", LM_VERSION, LM_DATE); - printk("adm1026: See http://www.penguincomputing.com/lm_sensors for more info.\n" ); - return i2c_add_driver(&adm1026_driver); -} - -static void __exit sm_adm1026_exit(void) -{ - i2c_del_driver(&adm1026_driver); -} - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Philip Pokorny and - Jean Delvare - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -/* Following macros take channel parameter starting from 0 */ -#define ADM1031_REG_FAN_SPEED(nr) (0x08 + (nr)) - -#define ADM1031_REG_FAN_DIV(nr) (0x20 + (nr)) -#define ADM1031_REG_FAN_MIN(nr) (0x10 + (nr)) - -#define ADM1031_REG_TEMP_MAX(nr) (0x14 + 4 * (nr)) -#define ADM1031_REG_TEMP_MIN(nr) (0x15 + 4 * (nr)) -#define ADM1031_REG_TEMP_CRIT(nr) (0x16 + 4 * (nr)) - -#define ADM1031_REG_TEMP(nr) (0x0a + (nr)) -#define ADM1031_REG_AUTO_TEMP(nr) (0x24 + (nr)) - -#define ADM1031_REG_STATUS(nr) (0x02 + (nr)) -#define ADM1031_REG_FAN_PWM 0x22 - -#define ADM1031_REG_CONF1 0x00 -#define ADM1031_REG_CONF2 0x01 -#define ADM1031_REG_EXT_TEMP 0x06 - -#define ADM1031_CONF1_MONITOR_ENABLE 0x01 /* Monitoring enable */ -#define ADM1031_CONF1_PWM_INVERT 0x08 /* PWM Invert (unused) */ -#define ADM1031_CONF1_AUTO_MODE 0x80 /* Auto fan mode */ - -#define ADM1031_CONF2_PWM1_ENABLE 0x01 -#define ADM1031_CONF2_PWM2_ENABLE 0x02 -#define ADM1031_CONF2_TACH1_ENABLE 0x04 -#define ADM1031_CONF2_TACH2_ENABLE 0x08 -#define ADM1031_CONF2_TEMP_ENABLE(chan) (0x10 << (chan)) - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x2c, 0x2e, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_2(adm1030, adm1031); - -/* - * Proc entries - * These files are created for each detected ADM1031. - */ - -/* -- SENSORS SYSCTL START -- */ - -#define ADM1031_SYSCTL_TEMP1 1200 -#define ADM1031_SYSCTL_TEMP2 1201 -#define ADM1031_SYSCTL_TEMP3 1202 - -#define ADM1031_SYSCTL_FAN1 1210 -#define ADM1031_SYSCTL_FAN2 1211 - -#define ADM1031_SYSCTL_FAN_DIV 1220 - -#define ADM1031_SYSCTL_ALARMS 1250 - -#define ADM1031_ALARM_FAN1_MIN 0x0001 -#define ADM1031_ALARM_FAN1_FLT 0x0002 -#define ADM1031_ALARM_TEMP2_HIGH 0x0004 -#define ADM1031_ALARM_TEMP2_LOW 0x0008 -#define ADM1031_ALARM_TEMP2_CRIT 0x0010 -#define ADM1031_ALARM_TEMP2_DIODE 0x0020 -#define ADM1031_ALARM_TEMP1_HIGH 0x0040 -#define ADM1031_ALARM_TEMP1_LOW 0x0080 -#define ADM1031_ALARM_FAN2_MIN 0x0100 -#define ADM1031_ALARM_FAN2_FLT 0x0200 -#define ADM1031_ALARM_TEMP3_HIGH 0x0400 -#define ADM1031_ALARM_TEMP3_LOW 0x0800 -#define ADM1031_ALARM_TEMP3_CRIT 0x1000 -#define ADM1031_ALARM_TEMP3_DIODE 0x2000 -#define ADM1031_ALARM_TEMP1_CRIT 0x4000 -#define ADM1031_ALARM_THERMAL 0x8000 - - -/* -- SENSORS SYSCTL END -- */ -static void adm1031_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1031_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1031_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1031_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static ctl_table adm1031_dir_table_template[] = { - {ADM1031_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_temp}, - {ADM1031_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_temp}, - {ADM1031_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_temp}, - {ADM1031_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_fan}, - {ADM1031_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_fan_div}, - {ADM1031_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_fan}, - {ADM1031_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_alarms}, - {0} -}; - -static ctl_table adm1030_dir_table_template[] = { - {ADM1031_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_temp}, - {ADM1031_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_temp}, - {ADM1031_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_fan}, - {ADM1031_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_fan_div}, - {ADM1031_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm1031_alarms}, - {0} -}; - - -/* Each client has this additional data */ -struct adm1031_data { - struct i2c_client client; - int sysctl_id; - struct semaphore update_lock; - int chip_type; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u16 alarms; - u8 conf1; - u8 conf2; - u8 fan[2]; - u8 fan_min[2]; - u8 fan_pwm[2]; - u8 fan_div[2]; - s8 temp[3]; - u8 auto_temp[3]; - u8 ext_temp[3]; - s8 temp_min[3]; - s8 temp_max[3]; - s8 temp_crit[3]; -}; - -static int adm1031_attach_adapter(struct i2c_adapter *adapter); -static int adm1031_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void adm1031_init_client(struct i2c_client *client); -static int adm1031_detach_client(struct i2c_client *client); - -static inline u8 adm1031_read_value(struct i2c_client *client, u8 reg); -static inline int adm1031_write_value(struct i2c_client *client, u8 reg, - unsigned int value); - -static void adm1031_update_client(struct i2c_client *client); - -/* This is the driver that will be inserted */ -static struct i2c_driver adm1031_driver = { - .name = "ADM1031/ADM1030 sensor driver", - .flags = I2C_DF_NOTIFY, - .attach_adapter = adm1031_attach_adapter, - .detach_client = adm1031_detach_client, -}; - -#define TEMP_TO_REG(val) ((val) < 0 ? (((val) - 500) / 1000) : \ - (((val) + 500) / 1000)) - -#define TEMP_FROM_REG(reg) ((reg) * 1000) - -#define TEMP_FROM_REG_EXT(val,ext) (TEMP_FROM_REG(val) + (ext) * 125) - -#define FAN_FROM_REG(reg,div) ((reg) ? 675000 / ((reg) * (div)) : 0) - -#define FAN_TO_REG(val,div) ((val) <= 0 ? 0 : \ - (val) * (div) >= 675000 ? 1 : \ - (val) * (div) <= 2647 ? 255 : \ - 675000 / ((val) * (div))) - -#define FAN_DIV_TO_REG(val) ((val) == 8 ? 0xc0 : \ - (val) == 4 ? 0x80 : \ - (val) == 1 ? 0x00 : 0x40) - -#define FAN_DIV_FROM_REG(reg) (1 << (((reg)&0xc0) >> 6)) - -#define AUTO_TEMP_MIN_FROM_REG(reg) (((reg) >> 3) * 4) - - -static int adm1031_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, adm1031_detect); -} - -/* This function is called by i2c_detect */ -static int -adm1031_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - struct i2c_client *new_client; - struct adm1031_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto exit; - - if (!(data = kmalloc(sizeof(struct adm1031_data), GFP_KERNEL))) { - err = -ENOMEM; - goto exit; - } - memset(data, 0, sizeof(struct adm1031_data)); - - new_client = &data->client; - new_client->data = data; - new_client->addr = address; - new_client->adapter = adapter; - new_client->driver = &adm1031_driver; - new_client->flags = 0; - - if (kind < 0) { - int id, co; - id = i2c_smbus_read_byte_data(new_client, 0x3d); - co = i2c_smbus_read_byte_data(new_client, 0x3e); - - if (((id != 0x31) || (id != 0x30)) && (co != 0x41)) - goto exit_free; - kind = (id == 0x30) ? adm1030 : adm1031; - } - - if (kind <= 0) - kind = adm1031; - - /* Given the detected chip type, set the chip name and the - * auto fan control helper table. */ - if (kind == adm1030) { - type_name = "adm1030"; - client_name = "ADM1030 chip"; - - } else if (kind == adm1031) { - type_name = "adm1031"; - client_name = "ADM1031 chip"; - } - data->chip_type = kind; - - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto exit_free; - - - if (kind == adm1030) { - if ((err = i2c_register_entry(new_client, type_name, - adm1030_dir_table_template, - THIS_MODULE)) < 0) - goto exit_detach; - } else if (kind == adm1031) { - if ((err = i2c_register_entry(new_client, type_name, - adm1031_dir_table_template, - THIS_MODULE)) < 0) - goto exit_detach; - } - - data->sysctl_id = err; - - /* Initialize the ADM1031 chip */ - adm1031_init_client(new_client); - - return 0; - -exit_detach: - i2c_detach_client(new_client); -exit_free: - kfree(data); -exit: - return err; -} - -static int adm1031_detach_client(struct i2c_client *client) -{ - int ret; - struct adm1031_data *data = client->data; - - i2c_deregister_entry(data->sysctl_id); - if ((ret = i2c_detach_client(client)) != 0) { - return ret; - } - - kfree(data); - return 0; -} - -static inline u8 adm1031_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -static inline int adm1031_write_value(struct i2c_client *client, u8 reg, - unsigned int value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -static void adm1031_init_client(struct i2c_client *client) -{ - unsigned int read_val; - unsigned int mask; - struct adm1031_data *data = client->data; - - mask = (ADM1031_CONF2_PWM1_ENABLE | ADM1031_CONF2_TACH1_ENABLE); - if (data->chip_type == adm1031) { - mask |= (ADM1031_CONF2_PWM2_ENABLE | - ADM1031_CONF2_TACH2_ENABLE); - } - /* Initialize the ADM1031 chip (enable fan speed reading) */ - read_val = adm1031_read_value(client, ADM1031_REG_CONF2); - if ((read_val | mask) != read_val) { - adm1031_write_value(client, ADM1031_REG_CONF2, - read_val | mask); - } - - read_val = adm1031_read_value(client, ADM1031_REG_CONF1); - if ((read_val | ADM1031_CONF1_MONITOR_ENABLE) != read_val) { - adm1031_write_value(client, ADM1031_REG_CONF1, read_val | - ADM1031_CONF1_MONITOR_ENABLE); - } -} - -static void adm1031_update_client(struct i2c_client *client) -{ - struct adm1031_data *data = client->data; - int chan; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { -#ifdef DEBUG - printk(KERN_INFO "adm1031.o: Starting chip update\n"); -#endif - for (chan = 0; - chan < ((data->chip_type == adm1031) ? 3 : 2); - chan++) { - u8 oldh, newh; - - oldh = adm1031_read_value(client, - ADM1031_REG_TEMP(chan)); - data->ext_temp[chan] = adm1031_read_value(client, - ADM1031_REG_EXT_TEMP); - newh = adm1031_read_value(client, - ADM1031_REG_TEMP(chan)); - if (newh != oldh) { - data->ext_temp[chan] = adm1031_read_value(client, - ADM1031_REG_EXT_TEMP); -#ifdef DEBUG - oldh = adm1031_read_value(client, - ADM1031_REG_TEMP(chan)); - - /* oldh is actually newer */ - if (newh != oldh) - printk(KERN_INFO "adm1031.o: Remote " - "temperature may be wrong.\n"); -#endif - } - data->temp[chan] = newh; - - data->temp_min[chan] = adm1031_read_value(client, - ADM1031_REG_TEMP_MIN(chan)); - data->temp_max[chan] = adm1031_read_value(client, - ADM1031_REG_TEMP_MAX(chan)); - data->temp_crit[chan] = adm1031_read_value(client, - ADM1031_REG_TEMP_CRIT(chan)); - data->auto_temp[chan] = adm1031_read_value(client, - ADM1031_REG_AUTO_TEMP(chan)); - } - - data->conf1 = adm1031_read_value(client, ADM1031_REG_CONF1); - - data->alarms = adm1031_read_value(client, ADM1031_REG_STATUS(0)) - | (adm1031_read_value(client, ADM1031_REG_STATUS(1)) - << 8); - if (data->chip_type == adm1030) { - data->alarms &= 0xc0ff; - } - - for (chan = 0; - chan < (data->chip_type == adm1030 ? 1 : 2); - chan++) { - data->fan_div[chan] = adm1031_read_value(client, - ADM1031_REG_FAN_DIV(chan)); - data->fan_min[chan] = adm1031_read_value(client, - ADM1031_REG_FAN_MIN(chan)); - data->fan[chan] = adm1031_read_value(client, - ADM1031_REG_FAN_SPEED(chan)); - data->fan_pwm[chan] = (adm1031_read_value(client, - ADM1031_REG_FAN_PWM) >> (4 * chan)) - & 0x0f; - } - - data->conf1 = adm1031_read_value(client, ADM1031_REG_CONF1); - data->conf2 = adm1031_read_value(client, ADM1031_REG_CONF2); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -static int __init sensors_adm1031_init(void) -{ - printk(KERN_INFO "adm1031.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&adm1031_driver); -} - -static void __exit sensors_adm1031_exit(void) -{ - i2c_del_driver(&adm1031_driver); -} - - -static void -adm1031_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - int ext; - struct adm1031_data *data = client->data; - int tmp; - int nr = ctl_name - ADM1031_SYSCTL_TEMP1; - - ext = nr == 0 ? - ((data->ext_temp[nr] >> 6) & 0x3) * 2 : - (((data->ext_temp[nr] >> ((nr - 1) * 3)) & 7)); - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1031_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_max[nr]); - results[1] = TEMP_FROM_REG(data->temp_min[nr]); - results[2] = TEMP_FROM_REG(data->temp_crit[nr]); - results[3] = TEMP_FROM_REG_EXT(data->temp[nr], ext); - *nrels_mag = 4; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - tmp = SENSORS_LIMIT(results[0], -55000, 127000); - data->temp_max[nr] = TEMP_TO_REG(tmp); - adm1031_write_value(client, - ADM1031_REG_TEMP_MAX(nr), - data->temp_max[nr]); - } - if (*nrels_mag >= 2) { - tmp = SENSORS_LIMIT(results[1], -55000, 127000); - data->temp_min[nr] = TEMP_TO_REG(tmp); - adm1031_write_value(client, - ADM1031_REG_TEMP_MIN(nr), - data->temp_min[nr]); - } - if (*nrels_mag >= 3) { - tmp = SENSORS_LIMIT(results[2], -55000, 127000); - data->temp_crit[nr] = TEMP_TO_REG(tmp); - adm1031_write_value(client, - ADM1031_REG_TEMP_CRIT(nr), - data->temp_crit[nr]); - } - } -} - -/* - * That function checks the cases where the fan reading is not - * relevant. It is used to provide 0 as fan reading when the fan is - * not supposed to run. - */ -static int trust_fan_readings(struct adm1031_data * data, int chan) -{ - int res = 0; - - if (data->conf1 & ADM1031_CONF1_AUTO_MODE) { - switch(data->conf1 & 0x60) { - case 0x00: /* temp2 controls fan1, temp3 controls fan2 */ - res = data->temp[chan+1] >= - AUTO_TEMP_MIN_FROM_REG(data->auto_temp[chan+1]); - break; - case 0x20: /* temp2 controls both fans */ - res = data->temp[1] >= - AUTO_TEMP_MIN_FROM_REG(data->auto_temp[1]); - break; - case 0x40: /* temp3 controls both fans */ - res = data->temp[2] >= - AUTO_TEMP_MIN_FROM_REG(data->auto_temp[2]); - break; - case 0x60: /* max of temp1, temp2 and temp3 controls both - fans */ - res = data->temp[0] >= - AUTO_TEMP_MIN_FROM_REG(data->auto_temp[0]) - || data->temp[1] >= - AUTO_TEMP_MIN_FROM_REG(data->auto_temp[1]) - || (data->chip_type == adm1031 - && data->temp[2] >= - AUTO_TEMP_MIN_FROM_REG(data->auto_temp[2])); - break; - } - } else { - res = data->fan_pwm[chan] > 0; - } - - return res; -} - -static void adm1031_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm1031_data *data = client->data; - int nr = ctl_name - ADM1031_SYSCTL_FAN1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1031_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr], - FAN_DIV_FROM_REG(data->fan_div[nr])); - results[1] = trust_fan_readings(data, nr) ? - FAN_FROM_REG(data->fan[nr], - FAN_DIV_FROM_REG(data->fan_div[nr])) : 0; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr] = FAN_TO_REG(results[0], - FAN_DIV_FROM_REG(data->fan_div[nr])); - adm1031_write_value(client, - ADM1031_REG_FAN_MIN(nr), - data->fan_min[nr]); - } - } -} - -static void adm1031_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm1031_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1031_update_client(client); - results[0] = FAN_DIV_FROM_REG(data->fan_div[0]); - *nrels_mag = 1; - if(data->chip_type == adm1031) { - results[1] = FAN_DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } - } else if (operation == SENSORS_PROC_REAL_WRITE) { - int old_div, new_min; - if (*nrels_mag >= 1) { - old_div = FAN_DIV_FROM_REG(data->fan_div[0]); - data->fan_div[0] = FAN_DIV_TO_REG(results[0]); - adm1031_write_value(client, - ADM1031_REG_FAN_DIV(0), - data->fan_div[0]); - new_min = data->fan_min[0] * old_div / - FAN_DIV_FROM_REG(data->fan_div[0]); - data->fan_min[0] = new_min > 0xff ? 0xff : new_min; - adm1031_write_value(client, - ADM1031_REG_FAN_MIN(0), - data->fan_min[0]); - } - if (*nrels_mag >= 2) { - old_div = FAN_DIV_FROM_REG(data->fan_div[1]); - data->fan_div[1] = FAN_DIV_TO_REG(results[1]); - adm1031_write_value(client, - ADM1031_REG_FAN_DIV(1), - data->fan_div[1]); - new_min = data->fan_min[1] * old_div / - FAN_DIV_FROM_REG(data->fan_div[1]); - data->fan_min[1] = new_min > 0xff ? 0xff : new_min; - adm1031_write_value(client, - ADM1031_REG_FAN_MIN(1), - data->fan_min[1]); - } - } -} - -static void adm1031_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm1031_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm1031_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -MODULE_AUTHOR("Alexandre d'Alton "); -MODULE_DESCRIPTION("ADM1031/ADM1030 driver"); -MODULE_LICENSE("GPL"); - -module_init(sensors_adm1031_init); -module_exit(sensors_adm1031_exit); diff --git a/kernel/chips/adm9240.c b/kernel/chips/adm9240.c deleted file mode 100644 index 27110295..00000000 --- a/kernel/chips/adm9240.c +++ /dev/null @@ -1,700 +0,0 @@ -/* - adm9240.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (C) 1999 Frodo Looijaard - and Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* Supports ADM9240, DS1780, and LM81. See doc/chips/adm9240 for details */ - -/* - A couple notes about the ADM9240: - -* It claims to be 'LM7x' register compatible. This must be in reference - to only the LM78, because it is missing stuff to emulate LM75's as well. - (like the Winbond W83781 does) - -* This driver was written from rev. 0 of the PDF, but it seems well - written and complete (unlike the W83781 which is horrible and has - supposedly gone through a few revisions.. rev 0 of that one must - have been in crayon on construction paper...) - -* All analog inputs can range from 0 to 2.5, eventhough some inputs are - marked as being 5V, 12V, etc. I don't have any real voltages going - into my prototype, so I'm not sure that things are computed right, - but at least the limits seem to be working OK. - -* Another curiousity is that the fan_div seems to be read-only. I.e., - any written value to it doesn't seem to make any difference. The - fan_div seems to be 'stuck' at 2 (which isn't a bad value in most cases). - - --Phil -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x2c, 0x2f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_3(adm9240, ds1780, lm81); - -/* Many ADM9240 constants specified below */ - -#define ADM9240_REG_IN_MAX(nr) (0x2b + (nr) * 2) -#define ADM9240_REG_IN_MIN(nr) (0x2c + (nr) * 2) -#define ADM9240_REG_IN(nr) (0x20 + (nr)) - -/* The ADM9240 registers */ -#define ADM9240_REG_TEST 0x15 -#define ADM9240_REG_ANALOG_OUT 0x19 -/* These are all read-only */ -#define ADM9240_REG_2_5V 0x20 -#define ADM9240_REG_VCCP1 0x21 -#define ADM9240_REG_3_3V 0x22 -#define ADM9240_REG_5V 0x23 -#define ADM9240_REG_12V 0x24 -#define ADM9240_REG_VCCP2 0x25 -#define ADM9240_REG_TEMP 0x27 -#define ADM9240_REG_FAN1 0x28 -#define ADM9240_REG_FAN2 0x29 -#define ADM9240_REG_COMPANY_ID 0x3E /* 0x23 for ADM9240; 0xDA for DS1780 */ - /* 0x01 for LM81 */ -#define ADM9240_REG_DIE_REV 0x3F -/* These are read/write */ -#define ADM9240_REG_2_5V_HIGH 0x2B -#define ADM9240_REG_2_5V_LOW 0x2C -#define ADM9240_REG_VCCP1_HIGH 0x2D -#define ADM9240_REG_VCCP1_LOW 0x2E -#define ADM9240_REG_3_3V_HIGH 0x2F -#define ADM9240_REG_3_3V_LOW 0x30 -#define ADM9240_REG_5V_HIGH 0x31 -#define ADM9240_REG_5V_LOW 0x32 -#define ADM9240_REG_12V_HIGH 0x33 -#define ADM9240_REG_12V_LOW 0x34 -#define ADM9240_REG_VCCP2_HIGH 0x35 -#define ADM9240_REG_VCCP2_LOW 0x36 -#define ADM9240_REG_TCRIT_LIMIT 0x37 /* LM81 only - not supported */ -#define ADM9240_REG_LOW_LIMIT 0x38 /* LM81 only - not supported */ -#define ADM9240_REG_TOS 0x39 -#define ADM9240_REG_THYST 0x3A -#define ADM9240_REG_FAN1_MIN 0x3B -#define ADM9240_REG_FAN2_MIN 0x3C - -#define ADM9240_REG_CONFIG 0x40 -#define ADM9240_REG_INT1_STAT 0x41 -#define ADM9240_REG_INT2_STAT 0x42 -#define ADM9240_REG_INT1_MASK 0x43 -#define ADM9240_REG_INT2_MASK 0x44 - -#define ADM9240_REG_COMPAT 0x45 /* dummy compat. register for other drivers? */ -#define ADM9240_REG_CHASSIS_CLEAR 0x46 -#define ADM9240_REG_VID_FAN_DIV 0x47 -#define ADM9240_REG_I2C_ADDR 0x48 -#define ADM9240_REG_VID4 0x49 -#define ADM9240_REG_TEMP_CONFIG 0x4B -#define ADM9240_REG_EXTMODE1 0x4C /* LM81 only - not supported */ -#define ADM9240_REG_EXTMODE2 0x4D /* LM81 only - not supported */ - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -#define IN_TO_REG(val,nr) (SENSORS_LIMIT((val), 0, 255)) -#define IN_FROM_REG(val,nr) (val) - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) ((val)==0?-1:\ - (val)==255?0:1350000/((div)*(val))) - -#define TEMP_FROM_REG(temp) ((temp)<256 ? (temp) * 5 : \ - ((temp) - 512) * 5) - -#define TEMP_LIMIT_FROM_REG(val) (((val)>=0x80?(val)-0x100:(val))*10) - -#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT(((val)<0?(((val)-5)/10)+256:\ - ((val)+5)/10), \ - 0,255) - -#define ALARMS_FROM_REG(val) (val) - -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val)==1?0:((val)==8?3:((val)==4?2:1))) - -#define VID_FROM_REG(val) ((val)==0x1f?0:(val)>=0x10?510-(val)*10:\ - 205-(val)*5) - -/* For each registered ADM9240, we need to keep some data in memory. */ -struct adm9240_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[6]; /* Register value */ - u8 in_max[6]; /* Register value */ - u8 in_min[6]; /* Register value */ - u8 fan[2]; /* Register value */ - u8 fan_min[2]; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ - int temp; /* Temp, shifted right */ - u8 temp_os_max; /* Register value */ - u8 temp_os_hyst; /* Register value */ - u16 alarms; /* Register encoding, combined */ - u8 analog_out; /* Register value */ - u8 vid; /* Register value combined */ -}; - - -static int adm9240_attach_adapter(struct i2c_adapter *adapter); -static int adm9240_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int adm9240_detach_client(struct i2c_client *client); - -static void adm9240_update_client(struct i2c_client *client); -static void adm9240_init_client(struct i2c_client *client); - - -static void adm9240_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm9240_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm9240_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm9240_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm9240_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm9240_analog_out(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, - long *results); -static void adm9240_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver adm9240_driver = { - .name = "ADM9240 sensor driver", - .id = I2C_DRIVERID_ADM9240, - .flags = I2C_DF_NOTIFY, - .attach_adapter = adm9240_attach_adapter, - .detach_client = adm9240_detach_client, -}; - -/* The /proc/sys entries */ - -/* -- SENSORS SYSCTL START -- */ - -#define ADM9240_SYSCTL_IN0 1000 /* Volts * 100 */ -#define ADM9240_SYSCTL_IN1 1001 -#define ADM9240_SYSCTL_IN2 1002 -#define ADM9240_SYSCTL_IN3 1003 -#define ADM9240_SYSCTL_IN4 1004 -#define ADM9240_SYSCTL_IN5 1005 -#define ADM9240_SYSCTL_FAN1 1101 /* Rotations/min */ -#define ADM9240_SYSCTL_FAN2 1102 -#define ADM9240_SYSCTL_TEMP 1250 /* Degrees Celsius * 100 */ -#define ADM9240_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define ADM9240_SYSCTL_ALARMS 2001 /* bitvector */ -#define ADM9240_SYSCTL_ANALOG_OUT 2002 -#define ADM9240_SYSCTL_VID 2003 - -#define ADM9240_ALARM_IN0 0x0001 -#define ADM9240_ALARM_IN1 0x0002 -#define ADM9240_ALARM_IN2 0x0004 -#define ADM9240_ALARM_IN3 0x0008 -#define ADM9240_ALARM_IN4 0x0100 -#define ADM9240_ALARM_IN5 0x0200 -#define ADM9240_ALARM_FAN1 0x0040 -#define ADM9240_ALARM_FAN2 0x0080 -#define ADM9240_ALARM_TEMP 0x0010 -#define ADM9240_ALARM_CHAS 0x1000 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected ADM9240. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table adm9240_dir_table_template[] = { - {ADM9240_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_in}, - {ADM9240_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_in}, - {ADM9240_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_in}, - {ADM9240_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_in}, - {ADM9240_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_in}, - {ADM9240_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_in}, - {ADM9240_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_fan}, - {ADM9240_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_fan}, - {ADM9240_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_temp}, - {ADM9240_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_fan_div}, - {ADM9240_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_alarms}, - {ADM9240_SYSCTL_ANALOG_OUT, "analog_out", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_analog_out}, - {ADM9240_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &adm9240_vid}, - {0} -}; - -static int adm9240_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, adm9240_detect); -} - -static int adm9240_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct adm9240_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access adm9240_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct adm9240_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &adm9240_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - if (kind < 0) { - if ( - ((i2c_smbus_read_byte_data - (new_client, ADM9240_REG_CONFIG) & 0x80) != 0x00) - || - (i2c_smbus_read_byte_data(new_client, ADM9240_REG_I2C_ADDR) - != address)) - goto ERROR1; - } - - /* Determine the chip type. */ - if (kind <= 0) { - i = i2c_smbus_read_byte_data(new_client, - ADM9240_REG_COMPANY_ID); - if (i == 0x23) - kind = adm9240; - else if (i == 0xda) - kind = ds1780; - else if (i == 0x01) - kind = lm81; - else { - if (kind == 0) - printk("adm9240.o: Ignoring 'force' " - "parameter for unknown chip at " - "adapter %d, address 0x%02x\n", - i2c_adapter_id(adapter), address); - goto ERROR1; - } - } - - if (kind == adm9240) { - type_name = "adm9240"; - client_name = "ADM9240 chip"; - } else if (kind == ds1780) { - type_name = "ds1780"; - client_name = "DS1780 chip"; - } else if (kind == lm81) { - type_name = "lm81"; - client_name = "LM81 chip"; - } else { -#ifdef DEBUG - printk("adm9240.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global - list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - adm9240_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the ADM9240 chip */ - adm9240_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int adm9240_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct adm9240_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk("adm9240.o: Client deregistration failed, " - "client not detached\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -/* Called when we have found a new ADM9240. */ -static void adm9240_init_client(struct i2c_client *client) -{ - /* Start monitoring */ - i2c_smbus_write_byte_data(client, ADM9240_REG_CONFIG, 0x01); -} - -static void adm9240_update_client(struct i2c_client *client) -{ - struct adm9240_data *data = client->data; - u8 i; - - down(&data->update_lock); - - if ( - (jiffies - data->last_updated > - (data->type == adm9240 ? HZ / 2 : HZ * 2)) - || (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting adm9240 update\n"); -#endif - for (i = 0; i <= 5; i++) { - data->in[i] = - i2c_smbus_read_byte_data(client, - ADM9240_REG_IN(i)); - data->in_min[i] = - i2c_smbus_read_byte_data(client, - ADM9240_REG_IN_MIN(i)); - data->in_max[i] = - i2c_smbus_read_byte_data(client, - ADM9240_REG_IN_MAX(i)); - } - data->fan[0] = - i2c_smbus_read_byte_data(client, ADM9240_REG_FAN1); - data->fan_min[0] = - i2c_smbus_read_byte_data(client, ADM9240_REG_FAN1_MIN); - data->fan[1] = - i2c_smbus_read_byte_data(client, ADM9240_REG_FAN2); - data->fan_min[1] = - i2c_smbus_read_byte_data(client, ADM9240_REG_FAN2_MIN); - data->temp = - (i2c_smbus_read_byte_data(client, ADM9240_REG_TEMP) << 1) + - ((i2c_smbus_read_byte_data - (client, ADM9240_REG_TEMP_CONFIG) & 0x80) >> 7); - data->temp_os_max = - i2c_smbus_read_byte_data(client, ADM9240_REG_TOS); - data->temp_os_hyst = - i2c_smbus_read_byte_data(client, ADM9240_REG_THYST); - - i = i2c_smbus_read_byte_data(client, ADM9240_REG_VID_FAN_DIV); - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = (i >> 6) & 0x03; - data->vid = i & 0x0f; - data->vid |= - (i2c_smbus_read_byte_data(client, ADM9240_REG_VID4) & 0x01) - << 4; - - data->alarms = - i2c_smbus_read_byte_data(client, - ADM9240_REG_INT1_STAT) + - (i2c_smbus_read_byte_data(client, ADM9240_REG_INT2_STAT) << - 8); - data->analog_out = - i2c_smbus_read_byte_data(client, ADM9240_REG_ANALOG_OUT); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void adm9240_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - - int scales[6] = { 250, 270, 330, 500, 1200, 270 }; - - struct adm9240_data *data = client->data; - int nr = ctl_name - ADM9240_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - adm9240_update_client(client); - results[0] = - IN_FROM_REG(data->in_min[nr], nr) * scales[nr] / 192; - results[1] = - IN_FROM_REG(data->in_max[nr], nr) * scales[nr] / 192; - results[2] = - IN_FROM_REG(data->in[nr], nr) * scales[nr] / 192; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = - IN_TO_REG((results[0] * 192) / scales[nr], nr); - i2c_smbus_write_byte_data(client, - ADM9240_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = - IN_TO_REG((results[1] * 192) / scales[nr], nr); - i2c_smbus_write_byte_data(client, - ADM9240_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void adm9240_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm9240_data *data = client->data; - int nr = ctl_name - ADM9240_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm9240_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data-> - fan_div[nr - 1])); - results[1] = - FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = FAN_TO_REG(results[0], - DIV_FROM_REG - (data-> - fan_div[nr - - 1])); - i2c_smbus_write_byte_data(client, nr == 1 ? - ADM9240_REG_FAN1_MIN : - ADM9240_REG_FAN2_MIN, - data->fan_min[nr - 1]); - } - } -} - - -void adm9240_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm9240_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - adm9240_update_client(client); - results[0] = TEMP_LIMIT_FROM_REG(data->temp_os_max); - results[1] = TEMP_LIMIT_FROM_REG(data->temp_os_hyst); - results[2] = TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_os_max = TEMP_LIMIT_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, ADM9240_REG_TOS, - data->temp_os_max); - } - if (*nrels_mag >= 2) { - data->temp_os_hyst = TEMP_LIMIT_TO_REG(results[1]); - i2c_smbus_write_byte_data(client, ADM9240_REG_THYST, - data->temp_os_hyst); - } - } -} - -void adm9240_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm9240_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm9240_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -void adm9240_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm9240_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm9240_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = i2c_smbus_read_byte_data(client, - ADM9240_REG_VID_FAN_DIV); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) | (data->fan_div[1] << 6); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan_div[0] << 4); - i2c_smbus_write_byte_data(client, - ADM9240_REG_VID_FAN_DIV, - old); - } - } -} - -void adm9240_analog_out(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct adm9240_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - adm9240_update_client(client); - results[0] = data->analog_out; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->analog_out = results[0]; - i2c_smbus_write_byte_data(client, - ADM9240_REG_ANALOG_OUT, - data->analog_out); - } - } -} - -void adm9240_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct adm9240_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - adm9240_update_client(client); - results[0] = VID_FROM_REG(data->vid); - *nrels_mag = 1; - } -} - -static int __init sm_adm9240_init(void) -{ - printk("adm9240.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&adm9240_driver); -} - -static void __exit sm_adm9240_exit(void) -{ - i2c_del_driver(&adm9240_driver); -} - - -MODULE_AUTHOR("Frodo Looijaard " - "and Philip Edelbrock "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("ADM9240 driver"); - -module_init(sm_adm9240_init); -module_exit(sm_adm9240_exit); diff --git a/kernel/chips/asb100.c b/kernel/chips/asb100.c deleted file mode 100644 index 824bc64b..00000000 --- a/kernel/chips/asb100.c +++ /dev/null @@ -1,1017 +0,0 @@ -/* - asb100.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - - Copyright (c) 2003 Mark M. Hoffman - - (derived from w83781d.c) - - Copyright (c) 1998 - 2003 Frodo Looijaard , - Philip Edelbrock , and - Mark Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - This driver supports the hardware sensor chips: Asus ASB100 and - ASB100-A "BACH". - - ASB100-A supports pwm1, while plain ASB100 does not. There is no known - way for the driver to tell which one is there. - - Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA - asb100 7 3 1 4 0x31 0x0694 yes no -*/ - -//#define DEBUG 1 - -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" -#include "lm75.h" - -#ifndef I2C_DRIVERID_ASB100 -#define I2C_DRIVERID_ASB100 1043 -#endif - -/* I2C addresses to scan */ -static unsigned short normal_i2c[] = { 0x2d, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; - -/* ISA addresses to scan (none) */ -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* default VRM to 9.0 */ -#define ASB100_DEFAULT_VRM 90 - -/* Insmod parameters */ -SENSORS_INSMOD_1(asb100); -SENSORS_MODULE_PARM(force_subclients, "List of subclient addresses: " \ - "{bus, clientaddr, subclientaddr1, subclientaddr2}"); - -/* Voltage IN registers 0-6 */ -#define ASB100_REG_IN(nr) (0x20 + (nr)) -#define ASB100_REG_IN_MAX(nr) (0x2b + (nr * 2)) -#define ASB100_REG_IN_MIN(nr) (0x2c + (nr * 2)) - -/* FAN IN registers 1-3 */ -#define ASB100_REG_FAN(nr) (0x27 + (nr)) -#define ASB100_REG_FAN_MIN(nr) (0x3a + (nr)) - -/* TEMPERATURE registers 1-4 */ -static const u16 asb100_reg_temp[] = {0, 0x27, 0x150, 0x250, 0x17}; -static const u16 asb100_reg_temp_max[] = {0, 0x39, 0x155, 0x255, 0x18}; -static const u16 asb100_reg_temp_hyst[] = {0, 0x3a, 0x153, 0x253, 0x19}; - -#define ASB100_REG_TEMP(nr) (asb100_reg_temp[nr]) -#define ASB100_REG_TEMP_MAX(nr) (asb100_reg_temp_max[nr]) -#define ASB100_REG_TEMP_HYST(nr) (asb100_reg_temp_hyst[nr]) - -#define ASB100_REG_TEMP2_CONFIG 0x0152 -#define ASB100_REG_TEMP3_CONFIG 0x0252 - - -#define ASB100_REG_CONFIG 0x40 -#define ASB100_REG_ALARM1 0x41 -#define ASB100_REG_ALARM2 0x42 -#define ASB100_REG_SMIM1 0x43 -#define ASB100_REG_SMIM2 0x44 -#define ASB100_REG_VID_FANDIV 0x47 -#define ASB100_REG_I2C_ADDR 0x48 -#define ASB100_REG_CHIPID 0x49 -#define ASB100_REG_I2C_SUBADDR 0x4a -#define ASB100_REG_PIN 0x4b -#define ASB100_REG_IRQ 0x4c -#define ASB100_REG_BANK 0x4e -#define ASB100_REG_CHIPMAN 0x4f - -#define ASB100_REG_WCHIPID 0x58 - -/* bit 7 -> enable, bits 0-3 -> duty cycle */ -#define ASB100_REG_PWM1 0x59 - -/* CONVERSIONS - Rounding and limit checking is only done on the TO_REG variants. */ - -/* These constants are a guess, consistent w/ w83781d */ -#define ASB100_IN_MIN ( 0) -#define ASB100_IN_MAX (408) - -/* IN: 1/100 V (0V to 4.08V) - REG: 16mV/bit */ -static u8 IN_TO_REG(unsigned val) -{ - unsigned nval = SENSORS_LIMIT(val, ASB100_IN_MIN, ASB100_IN_MAX); - return (nval * 10 + 8) / 16; -} - -static unsigned IN_FROM_REG(u8 reg) -{ - return (reg * 16 + 5) / 10; -} - -static u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, 254); -} - -static int FAN_FROM_REG(u8 val, int div) -{ - return val==0 ? -1 : val==255 ? 0 : 1350000/(val*div); -} - -/* These constants are a guess, consistent w/ w83781d */ -#define ASB100_TEMP_MIN (-1280) -#define ASB100_TEMP_MAX ( 1270) - -/* TEMP: 1/10 degrees C (-128C to +127C) - REG: 1C/bit, two's complement */ -static u8 TEMP_TO_REG(int temp) -{ - int ntemp = SENSORS_LIMIT(temp, ASB100_TEMP_MIN, ASB100_TEMP_MAX); - ntemp += (ntemp<0 ? -5 : 5); - return (u8)(ntemp / 10); -} - -static int TEMP_FROM_REG(u8 reg) -{ - return (s8)reg * 10; -} - -/* PWM: 0 - 255 per sensors documentation - REG: (6.25% duty cycle per bit) */ -static u8 ASB100_PWM_TO_REG(int pwm) -{ - pwm = SENSORS_LIMIT(pwm, 0, 255); - return (u8)(pwm / 16); -} - -static int ASB100_PWM_FROM_REG(u8 reg) -{ - return reg * 16; -} - -#define ALARMS_FROM_REG(val) (val) - -#define DIV_FROM_REG(val) (1 << (val)) - -/* FAN DIV: 1, 2, 4, or 8 (defaults to 2) - REG: 0, 1, 2, or 3 (respectively) (defaults to 1) */ -static u8 DIV_TO_REG(long val) -{ - return val==8 ? 3 : val==4 ? 2 : val==1 ? 0 : 1; -} - -/* For each registered client, we need to keep some data in memory. That - data is pointed to by client->data. The structure itself is - dynamically allocated, at the same time the client itself is allocated. */ -struct asb100_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - unsigned long last_updated; /* In jiffies */ - - /* array of 2 pointers to subclients */ - struct i2c_client *lm75[2]; - - char valid; /* !=0 if following fields are valid */ - u8 in[7]; /* Register value */ - u8 in_max[7]; /* Register value */ - u8 in_min[7]; /* Register value */ - u8 fan[3]; /* Register value */ - u8 fan_min[3]; /* Register value */ - u16 temp[4]; /* Register value (0 and 3 are u8 only) */ - u16 temp_max[4]; /* Register value (0 and 3 are u8 only) */ - u16 temp_hyst[4]; /* Register value (0 and 3 are u8 only) */ - u8 fan_div[3]; /* Register encoding, right justified */ - u8 pwm; /* Register encoding */ - u8 vid; /* Register encoding, combined */ - u32 alarms; /* Register encoding, combined */ - u8 vrm; -}; - -static int asb100_attach_adapter(struct i2c_adapter *adapter); -static int asb100_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int asb100_detach_client(struct i2c_client *client); - -static int asb100_read_value(struct i2c_client *client, u16 reg); -static void asb100_write_value(struct i2c_client *client, u16 reg, u16 val); -static void asb100_update_client(struct i2c_client *client); -static void asb100_init_client(struct i2c_client *client); - -static void asb100_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void asb100_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void asb100_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void asb100_temp_add(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void asb100_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void asb100_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void asb100_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void asb100_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void asb100_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver asb100_driver = { - .name = "asb100", - .id = I2C_DRIVERID_ASB100, - .flags = I2C_DF_NOTIFY, - .attach_adapter = asb100_attach_adapter, - .detach_client = asb100_detach_client, -}; - -/* The /proc/sys entries */ -/* -- SENSORS SYSCTL START -- */ - -#define ASB100_SYSCTL_IN0 1000 /* Volts * 100 */ -#define ASB100_SYSCTL_IN1 1001 -#define ASB100_SYSCTL_IN2 1002 -#define ASB100_SYSCTL_IN3 1003 -#define ASB100_SYSCTL_IN4 1004 -#define ASB100_SYSCTL_IN5 1005 -#define ASB100_SYSCTL_IN6 1006 - -#define ASB100_SYSCTL_FAN1 1101 /* Rotations/min */ -#define ASB100_SYSCTL_FAN2 1102 -#define ASB100_SYSCTL_FAN3 1103 - -#define ASB100_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define ASB100_SYSCTL_TEMP2 1201 -#define ASB100_SYSCTL_TEMP3 1202 -#define ASB100_SYSCTL_TEMP4 1203 - -#define ASB100_SYSCTL_VID 1300 /* Volts * 1000 */ -#define ASB100_SYSCTL_VRM 1301 - -#define ASB100_SYSCTL_PWM1 1401 /* 0-255 => 0-100% duty cycle */ - -#define ASB100_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define ASB100_SYSCTL_ALARMS 2001 /* bitvector */ - -#define ASB100_ALARM_IN0 0x0001 /* ? */ -#define ASB100_ALARM_IN1 0x0002 /* ? */ -#define ASB100_ALARM_IN2 0x0004 -#define ASB100_ALARM_IN3 0x0008 -#define ASB100_ALARM_TEMP1 0x0010 -#define ASB100_ALARM_TEMP2 0x0020 -#define ASB100_ALARM_FAN1 0x0040 -#define ASB100_ALARM_FAN2 0x0080 -#define ASB100_ALARM_IN4 0x0100 -#define ASB100_ALARM_IN5 0x0200 /* ? */ -#define ASB100_ALARM_IN6 0x0400 /* ? */ -#define ASB100_ALARM_FAN3 0x0800 -#define ASB100_ALARM_CHAS 0x1000 -#define ASB100_ALARM_TEMP3 0x2000 - -#define ASB100_ALARM_IN7 0x10000 /* ? */ -#define ASB100_ALARM_IN8 0x20000 /* ? */ - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected chip. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ - -/* no datasheet - but we did get some hints from someone who - claimed to have the datasheet */ -#define ASB100_SYSCTL_IN(nr) {ASB100_SYSCTL_IN##nr, "in" #nr, NULL, 0, \ - 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &asb100_in} -#define ASB100_SYSCTL_FAN(nr) {ASB100_SYSCTL_FAN##nr, "fan" #nr, NULL, 0, \ - 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &asb100_fan} -#define ASB100_SYSCTL_TEMP(nr, func) {ASB100_SYSCTL_TEMP##nr, "temp" #nr, \ - NULL, 0, 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, func} -static ctl_table asb100_dir_table_template[] = { - ASB100_SYSCTL_IN(0), - ASB100_SYSCTL_IN(1), - ASB100_SYSCTL_IN(2), - ASB100_SYSCTL_IN(3), - ASB100_SYSCTL_IN(4), - ASB100_SYSCTL_IN(5), - ASB100_SYSCTL_IN(6), - - ASB100_SYSCTL_FAN(1), - ASB100_SYSCTL_FAN(2), - ASB100_SYSCTL_FAN(3), - - ASB100_SYSCTL_TEMP(1, &asb100_temp), - ASB100_SYSCTL_TEMP(2, &asb100_temp_add), - ASB100_SYSCTL_TEMP(3, &asb100_temp_add), - ASB100_SYSCTL_TEMP(4, &asb100_temp), - - {ASB100_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &asb100_vid}, - {ASB100_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &asb100_vrm}, - {ASB100_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &asb100_fan_div}, - {ASB100_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &asb100_alarms}, - {ASB100_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &asb100_pwm}, - {0} -}; - -/* This function is called when: - asb100_driver is inserted (when this module is loaded), for each - available adapter - when a new adapter is inserted (and asb100_driver is still present) - */ -static int asb100_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, asb100_detect); -} - -static int asb100_detect_subclients(struct i2c_adapter *adapter, int address, - int kind, struct i2c_client *new_client) -{ - int i, id, err = 0; - struct asb100_data *data = new_client->data; - - data->lm75[0] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); - if (!(data->lm75[0])) { - err = -ENOMEM; - goto ERROR_SC_0; - } - memset(data->lm75[0], 0x00, sizeof(struct i2c_client)); - - data->lm75[1] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); - if (!(data->lm75[1])) { - err = -ENOMEM; - goto ERROR_SC_1; - } - memset(data->lm75[1], 0x00, sizeof(struct i2c_client)); - - id = i2c_adapter_id(adapter); - - if (force_subclients[0] == id && force_subclients[1] == address) { - for (i = 2; i <= 3; i++) { - if (force_subclients[i] < 0x48 || - force_subclients[i] > 0x4f) { - printk(KERN_ERR "asb100.o: invalid subclient " - "address %d; must be 0x48-0x4f\n", - force_subclients[i]); - goto ERROR_SC_2; - } - } - asb100_write_value(new_client, ASB100_REG_I2C_SUBADDR, - (force_subclients[2] & 0x07) | - ((force_subclients[3] & 0x07) <<4)); - data->lm75[0]->addr = force_subclients[2]; - data->lm75[1]->addr = force_subclients[3]; - } else { - int val = asb100_read_value(new_client, ASB100_REG_I2C_SUBADDR); - data->lm75[0]->addr = 0x48 + (val & 0x07); - data->lm75[1]->addr = 0x48 + ((val >> 4) & 0x07); - } - - if(data->lm75[0]->addr == data->lm75[1]->addr) { - printk(KERN_ERR "asb100.o: duplicate addresses 0x%x " - "for subclients\n", data->lm75[0]->addr); - goto ERROR_SC_2; - } - - for (i = 0; i <= 1; i++) { - data->lm75[i]->data = NULL; - data->lm75[i]->adapter = adapter; - data->lm75[i]->driver = &asb100_driver; - data->lm75[i]->flags = 0; - strcpy(data->lm75[i]->name, "asb100 subclient"); - } - - if ((err = i2c_attach_client(data->lm75[0]))) { - printk(KERN_ERR "asb100.o: Subclient %d registration " - "at address 0x%x failed.\n", i, data->lm75[0]->addr); - goto ERROR_SC_2; - } - - if ((err = i2c_attach_client(data->lm75[1]))) { - printk(KERN_ERR "asb100.o: Subclient %d registration " - "at address 0x%x failed.\n", i, data->lm75[1]->addr); - goto ERROR_SC_3; - } - - return 0; - -/* Undo inits in case of errors */ -ERROR_SC_3: - i2c_detach_client(data->lm75[0]); -ERROR_SC_2: - kfree(data->lm75[1]); -ERROR_SC_1: - kfree(data->lm75[0]); -ERROR_SC_0: - return err; -} - -static int asb100_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int err = 0; - struct i2c_client *new_client; - struct asb100_data *data; - - /* asb100 is SMBus only */ - if (i2c_is_isa_adapter(adapter)) { - pr_debug("asb100.o: detect failed, " - "cannot attach to legacy adapter!\n"); - goto ERROR0; - } - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { - pr_debug("asb100.o: detect failed, " - "smbus byte data not supported!\n"); - goto ERROR0; - } - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access asb100_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct asb100_data), GFP_KERNEL))) { - pr_debug("asb100.o: detect failed, kmalloc failed!\n"); - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - init_MUTEX(&data->lock); - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &asb100_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - /* The chip may be stuck in some other bank than bank 0. This may - make reading other information impossible. Specify a force=... or - force_*=... parameter, and the chip will be reset to the right - bank. */ - if (kind < 0) { - - int val1 = asb100_read_value(new_client, ASB100_REG_BANK); - int val2 = asb100_read_value(new_client, ASB100_REG_CHIPMAN); - - /* If we're in bank 0 */ - if ( (!(val1 & 0x07)) && - /* Check for ASB100 ID (low byte) */ - ( ((!(val1 & 0x80)) && (val2 != 0x94)) || - /* Check for ASB100 ID (high byte ) */ - ((val1 & 0x80) && (val2 != 0x06)) ) ) { - pr_debug("asb100.o: detect failed, " - "bad chip id 0x%02x!\n", val2); - goto ERROR1; - } - - } /* kind < 0 */ - - /* We have either had a force parameter, or we have already detected - Winbond. Put it now into bank 0 and Vendor ID High Byte */ - asb100_write_value(new_client, ASB100_REG_BANK, - (asb100_read_value(new_client, ASB100_REG_BANK) & 0x78) | 0x80); - - /* Determine the chip type. */ - if (kind <= 0) { - int val1 = asb100_read_value(new_client, ASB100_REG_WCHIPID); - int val2 = asb100_read_value(new_client, ASB100_REG_CHIPMAN); - - if ((val1 == 0x31) && (val2 == 0x06)) - kind = asb100; - else { - if (kind == 0) - printk (KERN_WARNING "asb100.o: Ignoring " - "'force' parameter for unknown chip " - "at adapter %d, address 0x%02x.\n", - i2c_adapter_id(adapter), address); - goto ERROR1; - } - } - - /* Fill in remaining client fields and put it into the global list */ - strcpy(new_client->name, "ASB100 chip"); - data->type = kind; - - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR1; - - /* Attach secondary lm75 clients */ - if ((err = asb100_detect_subclients(adapter, address, kind, - new_client))) - goto ERROR2; - - /* Initialize the chip */ - asb100_init_client(new_client); - - /* Register a new directory entry with module sensors */ - if ((data->sysctl_id = i2c_register_entry(new_client, "asb100", - asb100_dir_table_template, THIS_MODULE)) < 0) { - err = data->sysctl_id; - goto ERROR3; - } - - return 0; - -ERROR3: - i2c_detach_client(data->lm75[0]); - kfree(data->lm75[1]); - kfree(data->lm75[0]); -ERROR2: - i2c_detach_client(new_client); -ERROR1: - kfree(data); -ERROR0: - return err; -} - -static int asb100_detach_client(struct i2c_client *client) -{ - int err; - struct asb100_data *data = client->data; - - /* remove sysctl table (primary client only) */ - if ((data)) - i2c_deregister_entry(data->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk (KERN_ERR "asb100.o: Client deregistration failed; " - "client not detached.\n"); - return err; - } - - if (data) { - /* primary client */ - kfree(data); - } else { - /* subclients */ - kfree(client); - } - - return 0; -} - -/* The SMBus locks itself, usually, but nothing may access the Winbond between - bank switches. ISA access must always be locked explicitly! - We ignore the W83781D BUSY flag at this moment - it could lead to deadlocks, - would slow down the W83781D access and should not be necessary. - There are some ugly typecasts here, but the good news is - they should - nowhere else be necessary! */ -static int asb100_read_value(struct i2c_client *client, u16 reg) -{ - struct asb100_data *data = client->data; - struct i2c_client *cl; - int res, bank; - - down(&data->lock); - - bank = (reg >> 8) & 0x0f; - if (bank > 2) - /* switch banks */ - i2c_smbus_write_byte_data(client, ASB100_REG_BANK, bank); - - if (bank == 0 || bank > 2) { - res = i2c_smbus_read_byte_data(client, reg & 0xff); - } else { - /* switch to subclient */ - cl = data->lm75[bank - 1]; - - /* convert from ISA to LM75 I2C addresses */ - switch (reg & 0xff) { - case 0x50: /* TEMP */ - res = swab16(i2c_smbus_read_word_data (cl, 0)); - break; - case 0x52: /* CONFIG */ - res = i2c_smbus_read_byte_data(cl, 1); - break; - case 0x53: /* HYST */ - res = swab16(i2c_smbus_read_word_data (cl, 2)); - break; - case 0x55: /* MAX */ - default: - res = swab16(i2c_smbus_read_word_data (cl, 3)); - break; - } - } - - if (bank > 2) - i2c_smbus_write_byte_data(client, ASB100_REG_BANK, 0); - - up(&data->lock); - - return res; -} - -static void asb100_write_value(struct i2c_client *client, u16 reg, u16 value) -{ - struct asb100_data *data = client->data; - struct i2c_client *cl; - int bank; - - down(&data->lock); - - bank = (reg >> 8) & 0x0f; - if (bank > 2) - /* switch banks */ - i2c_smbus_write_byte_data(client, ASB100_REG_BANK, bank); - - if (bank == 0 || bank > 2) { - i2c_smbus_write_byte_data(client, reg & 0xff, value & 0xff); - } else { - /* switch to subclient */ - cl = data->lm75[bank - 1]; - - /* convert from ISA to LM75 I2C addresses */ - switch (reg & 0xff) { - case 0x52: /* CONFIG */ - i2c_smbus_write_byte_data(cl, 1, value & 0xff); - break; - case 0x53: /* HYST */ - i2c_smbus_write_word_data(cl, 2, swab16(value)); - break; - case 0x55: /* MAX */ - i2c_smbus_write_word_data(cl, 3, swab16(value)); - break; - } - } - - if (bank > 2) - i2c_smbus_write_byte_data(client, ASB100_REG_BANK, 0); - - up(&data->lock); -} - -static void asb100_init_client(struct i2c_client *client) -{ - struct asb100_data *data = client->data; - int vid = 0; - - vid = asb100_read_value(client, ASB100_REG_VID_FANDIV) & 0x0f; - vid |= (asb100_read_value(client, ASB100_REG_CHIPID) & 0x01) << 4; - data->vrm = ASB100_DEFAULT_VRM; - vid = vid_from_reg(vid, data->vrm); - - /* Start monitoring */ - asb100_write_value(client, ASB100_REG_CONFIG, - (asb100_read_value(client, ASB100_REG_CONFIG) & 0xf7) | 0x01); -} - -static void asb100_update_client(struct i2c_client *client) -{ - struct asb100_data *data = client->data; - int i; - - down(&data->update_lock); - - if (time_after(jiffies - data->last_updated, HZ + HZ / 2) || - time_before(jiffies, data->last_updated) || !data->valid) { - - pr_debug("asb100.o: starting device update...\n"); - - /* 7 voltage inputs */ - for (i = 0; i < 7; i++) { - data->in[i] = asb100_read_value(client, - ASB100_REG_IN(i)); - data->in_min[i] = asb100_read_value(client, - ASB100_REG_IN_MIN(i)); - data->in_max[i] = asb100_read_value(client, - ASB100_REG_IN_MAX(i)); - } - - /* 3 fan inputs */ - for (i = 1; i <= 3; i++) { - data->fan[i-1] = asb100_read_value(client, - ASB100_REG_FAN(i)); - data->fan_min[i-1] = asb100_read_value(client, - ASB100_REG_FAN_MIN(i)); - } - - /* 4 temperature inputs */ - for (i = 1; i <= 4; i++) { - data->temp[i-1] = asb100_read_value(client, - ASB100_REG_TEMP(i)); - data->temp_max[i-1] = asb100_read_value(client, - ASB100_REG_TEMP_MAX(i)); - data->temp_hyst[i-1] = asb100_read_value(client, - ASB100_REG_TEMP_HYST(i)); - } - - /* VID and fan divisors */ - i = asb100_read_value(client, ASB100_REG_VID_FANDIV); - data->vid = i & 0x0f; - data->vid |= (asb100_read_value(client, - ASB100_REG_CHIPID) & 0x01) << 4; - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = (i >> 6) & 0x03; - data->fan_div[2] = (asb100_read_value(client, - ASB100_REG_PIN) >> 6) & 0x03; - - /* PWM */ - data->pwm = asb100_read_value(client, ASB100_REG_PWM1); - - /* alarms */ - data->alarms = asb100_read_value(client, ASB100_REG_ALARM1) + - (asb100_read_value(client, ASB100_REG_ALARM2) << 8); - - data->last_updated = jiffies; - data->valid = 1; - - pr_debug("asb100.o: ... update complete.\n"); - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -static void asb100_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct asb100_data *data = client->data; - int nr = ctl_name - ASB100_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - asb100_update_client(client); - results[0] = IN_FROM_REG(data->in_min[nr]); - results[1] = IN_FROM_REG(data->in_max[nr]); - results[2] = IN_FROM_REG(data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0]); - asb100_write_value(client, ASB100_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1]); - asb100_write_value(client, ASB100_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void asb100_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct asb100_data *data = client->data; - int nr = ctl_name - ASB100_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - asb100_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - results[1] = FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = - FAN_TO_REG(results[0], - DIV_FROM_REG(data->fan_div[nr-1])); - asb100_write_value(client, - ASB100_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } - } -} - -void asb100_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct asb100_data *data = client->data; - int nr = ctl_name - ASB100_SYSCTL_TEMP1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - - else if (operation == SENSORS_PROC_REAL_READ) { - asb100_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_max[nr]); - results[1] = TEMP_FROM_REG(data->temp_hyst[nr]); - results[2] = TEMP_FROM_REG(data->temp[nr]); - *nrels_mag = 3; - - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_max[nr] = TEMP_TO_REG(results[0]); - asb100_write_value(client, ASB100_REG_TEMP_MAX(nr+1), - data->temp_max[nr]); - } - if (*nrels_mag >= 2) { - data->temp_hyst[nr] = TEMP_TO_REG(results[1]); - asb100_write_value(client, ASB100_REG_TEMP_HYST(nr+1), - data->temp_hyst[nr]); - } - } -} - -void asb100_temp_add(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct asb100_data *data = client->data; - int nr = ctl_name - ASB100_SYSCTL_TEMP1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - - else if (operation == SENSORS_PROC_REAL_READ) { - asb100_update_client(client); - - results[0] = LM75_TEMP_FROM_REG(data->temp_max[nr]); - results[1] = LM75_TEMP_FROM_REG(data->temp_hyst[nr]); - results[2] = LM75_TEMP_FROM_REG(data->temp[nr]); - *nrels_mag = 3; - - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_max[nr] = - LM75_TEMP_TO_REG(results[0]); - asb100_write_value(client, ASB100_REG_TEMP_MAX(nr+1), - data->temp_max[nr]); - } - if (*nrels_mag >= 2) { - data->temp_hyst[nr] = - LM75_TEMP_TO_REG(results[1]); - asb100_write_value(client, ASB100_REG_TEMP_HYST(nr+1), - data->temp_hyst[nr]); - } - } -} - -void asb100_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct asb100_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - asb100_update_client(client); - results[0] = vid_from_reg(data->vid, data->vrm); - *nrels_mag = 1; - } -} - -void asb100_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct asb100_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) - data->vrm = results[0]; - } -} - -void asb100_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct asb100_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - asb100_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -void asb100_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct asb100_data *data = client->data; - int old, old2; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - - else if (operation == SENSORS_PROC_REAL_READ) { - asb100_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - results[2] = DIV_FROM_REG(data->fan_div[2]); - *nrels_mag = 3; - - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = asb100_read_value(client, ASB100_REG_VID_FANDIV); - if (*nrels_mag >= 3) { - data->fan_div[2] = DIV_TO_REG(results[2]); - old2 = asb100_read_value(client, ASB100_REG_PIN); - old2 = (old2 & 0x3f) | ((data->fan_div[2] & 0x03) << 6); - asb100_write_value(client, ASB100_REG_PIN, old2); - } - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) | ((data->fan_div[1] & 0x03) << 6); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) | ((data->fan_div[0] & 0x03) << 4); - asb100_write_value(client, ASB100_REG_VID_FANDIV, old); - } - } -} - -void asb100_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct asb100_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - asb100_update_client(client); - results[0] = ASB100_PWM_FROM_REG(data->pwm & 0x0f); - results[1] = (data->pwm & 0x80) ? 1 : 0; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - u8 val = data->pwm; - if (*nrels_mag >= 1) { - val = 0x0f & ASB100_PWM_TO_REG(results[0]); - if (*nrels_mag >= 2) { - if (results[1]) - val |= 0x80; - else - val &= ~0x80; - } - asb100_write_value(client, ASB100_REG_PWM1, val); - } - } -} - -static int __init asb100_init(void) -{ - printk(KERN_INFO "asb100.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&asb100_driver); -} - -static void __exit asb100_exit(void) -{ - i2c_del_driver(&asb100_driver); -} - -MODULE_AUTHOR( "Mark M. Hoffman , " - "Frodo Looijaard , " - "Philip Edelbrock , and " - "Mark Studebaker "); - -MODULE_DESCRIPTION("ASB100 'Bach' driver"); -MODULE_LICENSE("GPL"); - -module_init(asb100_init); -module_exit(asb100_exit); - diff --git a/kernel/chips/bmcsensors.c b/kernel/chips/bmcsensors.c deleted file mode 100644 index 00077e15..00000000 --- a/kernel/chips/bmcsensors.c +++ /dev/null @@ -1,1133 +0,0 @@ -/* - bmcsensors.c - Part of lm_sensors, Linux kernel modules - for hardware monitoring - - Copyright (c) 2002 Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -/* for kernel thread ... */ -#include -#include -#include -#include -#include "version.h" - -/* -#define DEBUG 1 -*/ - -struct bmcsensors_data { - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 alarms; -}; - - -static int bmcsensors_attach_adapter(struct i2c_adapter *adapter); -static int bmcsensors_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int bmcsensors_detach_client(struct i2c_client *client); -static int bmcsensors_command(struct i2c_client *client, unsigned int cmd, - void *arg); - -static void bmcsensors_update_client(struct i2c_client *client); -static void bmcsensors_reserve_sdr(void); -static void bmc_do_pause(unsigned int amount); /* YJ for debug */ - - -static void bmcsensors_all(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -#if 0 -static void bmcsensors_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void bmcsensors_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void bmcsensors_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -#endif -static void bmcsensors_get_sdr(u16 resid, u16 record, u8 offset); -static void bmcsensors_get_reading(struct i2c_client *client, int i); - -static struct i2c_driver bmcsensors_driver = { - .name = "BMC Sensors driver", - .id = I2C_DRIVERID_BMCSENSORS, - .flags = I2C_DF_NOTIFY, - .attach_adapter = bmcsensors_attach_adapter, - .detach_client = bmcsensors_detach_client, - .command = bmcsensors_command, -}; - -static struct bmcsensors_data bmc_data; -static struct i2c_client bmc_client = { - .name = "BMC Sensors", - .id = 1, /* fake should be 0 */ - .driver = &bmcsensors_driver, - .data = &bmc_data, -}; - -static int bmcsensors_initialized; - -#define MAX_SDR_ENTRIES 100 -#define SDR_LIMITS 8 -#define SDR_MAX_ID_LENGTH 16 -#define SDR_MAX_UNPACKED_ID_LENGTH ((SDR_MAX_ID_LENGTH * 4 / 3) + 2) -struct sdrdata { - /* reverse lookup from sysctl */ - int sysctl; - /* retrieved from SDR, not expected to change */ - u8 stype; - u8 number; - u8 capab; - u16 thresh_mask; - u8 format; - u8 linear; - s16 m; - s16 b; - u8 k; - u8 nominal; - u8 limits[SDR_LIMITS]; - int lim1, lim2; /* index into limits for reported upper and lower limit */ - u8 lim1_write, lim2_write; - u8 string_type; - u8 id_length; - u8 id[SDR_MAX_ID_LENGTH]; - /* retrieved from reading */ - u8 reading; - u8 status; - u8 thresholds; -}; -static struct sdrdata sdrd[MAX_SDR_ENTRIES]; -static int sdrd_count; - - -/* -- SENSORS SYSCTL START -- */ -#define BMC_SYSCTL_IN1 1000 -#define BMC_SYSCTL_TEMP1 1100 -#define BMC_SYSCTL_CURR1 1200 -#define BMC_SYSCTL_FAN1 1300 -#define BMC_SYSCTL_ALARMS 5000 - -/* -- SENSORS SYSCTL END -- */ - -#define MAX_PROC_ENTRIES (MAX_SDR_ENTRIES + 5) -#define MAX_PROCNAME_SIZE 8 -static ctl_table *bmcsensors_dir_table; -static char *bmcsensors_proc_name_pool; - -#define IPMI_SDR_SIZE 67 -#define IPMI_CHUNK_SIZE 16 -static int ipmi_sdr_partial_size = IPMI_CHUNK_SIZE; -static struct ipmi_msg tx_message; /* send message */ -static unsigned char tx_msg_data[IPMI_MAX_MSG_LENGTH + 50]; -static unsigned char rx_msg_data[IPMI_MAX_MSG_LENGTH + 50]; /* sloppy */ -static int rx_msg_data_offset; -static int msgid; /* API to IPMI is long but we'll let i2c-ipmi convert */ -static u16 resid; -static u16 nextrecord; -static int errorcount; - -enum states {STATE_INIT, STATE_RESERVE, STATE_SDR, STATE_SDRPARTIAL, - STATE_READING, STATE_UNCANCEL, STATE_PROCTABLE, STATE_DONE}; -/* YJ : added extra state STATE_PROCTABLE for thread activity */ -static int state; -static int receive_counter; - - -/* IPMI Message defs */ -/* Network Function Codes */ -#define IPMI_NETFN_SENSOR 0x04 -#define IPMI_NETFN_STORAGE 0x0A -/* Commands */ -#define IPMI_RESERVE_SDR 0x22 -#define IPMI_GET_SDR 0x23 -#define IPMI_GET_SENSOR_STATE_READING 0x2D - -/* SDR defs */ -#define STYPE_TEMP 0x01 -#define STYPE_VOLT 0x02 -#define STYPE_CURR 0x03 -#define STYPE_FAN 0x04 - -/* do we really need maximums per-type? */ -#define STYPE_MAX 4 /* the last sensor type we are interested in */ -static u8 bmcs_count[STYPE_MAX + 1]; -static const u8 bmcs_max[STYPE_MAX + 1] = {0, 20, 40, 20, 20}; -/* YJ: on poweredge 1750, we need ^^ */ - -/************************************/ -/* YJ ... */ -static int thread_pid= 0; -static DECLARE_MUTEX_LOCKED(bmc_sem); -/* ... YJ */ -/************************************/ - -/* unpack based on string type, convert to normal, null terminate */ -static void ipmi_sprintf(u8 * to, u8 * from, u8 type, u8 length) -{ - static const u8 *bcdplus = "0123456789 -.:,_"; - int i; - - switch (type) { - case 0: /* unicode */ - for(i = 0; i < length; i++) - *to++ = *from++ & 0x7f; - *to = 0; - break; - case 1: /* BCD Plus */ - for(i = 0; i < length; i++) - *to++ = bcdplus[*from++ & 0x0f]; - *to = 0; - break; - case 2: /* packed ascii */ /* if not a mult. of 3 this will run over */ - for(i = 0; i < length; i += 3) { - *to++ = *from & 0x3f; - *to++ = *from >> 6 | ((*(from+1) & 0xf) << 2); - from++; - *to++ = *from >> 4 | ((*(from+1) & 0x3) << 4); - from++; - *to++ = (*from++ >> 2) & 0x3f; - } - *to = 0; - break; - case 3: /* normal */ - if(length > 1) - memcpy(to, from, length); - to[length] = 0; - break; - } -} - -static const char * threshold_text[] = { - "upper non-recoverable threshold", - "upper critical threshold", - "upper non-critical threshold", - "lower non-recoverable threshold", - "lower critical threshold", - "lower non-critical threshold", - "positive-going hysteresis", - "negative-going hysteresis" /* unused */ -}; - -/* select two out of the 8 possible readable thresholds, and place indexes into the limits - array into lim1 and lim2. Set writable flags */ -static void bmcsensors_select_thresholds(struct sdrdata * sd) -{ - u8 capab = sd->capab; - u16 mask = sd->thresh_mask; - int tmp; - - sd->lim1 = -1; - sd->lim2 = -1; - sd->lim1_write = 0; - sd->lim2_write = 0; - - if(((capab & 0x0c) == 0x04) || /* readable thresholds ? */ - ((capab & 0x0c) == 0x08)) { - /* select upper threshold */ - if(mask & 0x10) { /* upper crit */ - sd->lim1 = 1; - if((capab & 0x0c) == 0x08 && (mask & 0x1000)) - sd->lim1_write = 1; - } - else if(mask & 0x20) { /* upper non-recov */ - sd->lim1 = 0; - if((capab & 0x0c) == 0x08 && (mask & 0x2000)) - sd->lim1_write = 1; - } - else if(mask & 0x08) { /* upper non-crit */ - sd->lim1 = 2; - if((capab & 0x0c) == 0x08 && (mask & 0x0800)) - sd->lim1_write = 1; - } - - /* select lower threshold */ - if((((capab & 0x30) == 0x10) || /* readable ? */ - ((capab & 0x30) == 0x20)) && /* pos hyst */ - sd->stype == STYPE_TEMP) - sd->lim2 = 6; - else if(mask & 0x02) { /* lower crit */ - sd->lim2 = 4; - if((capab & 0x0c) == 0x08 && (mask & 0x0200)) - sd->lim2_write = 1; - } - else if(mask & 0x04) { /* lower non-recov */ - sd->lim2 = 3; - if((capab & 0x0c) == 0x08 && (mask & 0x0400)) - sd->lim2_write = 1; - } - else if(mask & 0x01) { /* lower non-crit */ - sd->lim2 = 5; - if((capab & 0x0c) == 0x08 && (mask & 0x0100)) - sd->lim2_write = 1; - } - } - - /* swap lim1/lim2 if m < 0 or function is 1/x (but not both!) */ - if((sd->m < 0 && sd->linear != 7) || (sd->m >= 0 && sd->linear == 7)) { - tmp = sd->lim1; - sd->lim1 = sd->lim2; - sd->lim2 = tmp; - } - - if(sd->lim1 >= 0) - printk(KERN_INFO "bmcsensors.o: using %s for upper limit\n", - threshold_text[sd->lim1]); -#ifdef DEBUG - else - printk(KERN_INFO "bmcsensors.o: no readable upper limit\n"); -#endif - if(sd->lim2 >= 0) - printk(KERN_INFO "bmcsensors.o: using %s for lower limit\n", - threshold_text[sd->lim2]); -#ifdef DEBUG - else - printk(KERN_INFO "bmcsensors.o: no readable lower limit\n"); -#endif -} - -/* After we have received all the SDR entries and picked out the ones - we are interested in, build a table of the /proc entries and register with i2c. -*/ -static void bmcsensors_build_proc_table() -{ - int i; - int temps = 0, volts = 0, currs = 0, fans = 0; - u8 id[SDR_MAX_UNPACKED_ID_LENGTH]; - - - printk(KERN_INFO "bmcsensors.o: building proc table\n"); - if(!(bmcsensors_dir_table = kmalloc((sdrd_count + 1) * sizeof(struct ctl_table), GFP_KERNEL))) { - printk(KERN_ERR "bmcsensors.o: no memory\n"); - return; /* do more than this */ /* ^^ add 1 or more for alarms, etc. */ - } - if(!(bmcsensors_proc_name_pool = kmalloc((sdrd_count + 0) * MAX_PROCNAME_SIZE, GFP_KERNEL))) { - kfree(bmcsensors_dir_table); - printk(KERN_ERR "bmcsensors.o: no memory\n"); - return; /* do more than this */ /* ^^ add 1 or more for alarms, etc. */ - } - - for(i = 0; i < sdrd_count; i++) { - bmcsensors_dir_table[i].procname = bmcsensors_proc_name_pool + (i * MAX_PROCNAME_SIZE); - bmcsensors_dir_table[i].data = NULL; - bmcsensors_dir_table[i].maxlen = 0; - bmcsensors_dir_table[i].child = NULL; - bmcsensors_dir_table[i].proc_handler = &i2c_proc_real; - bmcsensors_dir_table[i].strategy = &i2c_sysctl_real; - bmcsensors_dir_table[i].de = NULL; - - switch(sdrd[i].stype) { - case(STYPE_TEMP) : - bmcsensors_dir_table[i].ctl_name = BMC_SYSCTL_TEMP1 + temps; - sprintf((char *)bmcsensors_dir_table[i].procname, "temp%d", ++temps); - bmcsensors_dir_table[i].extra1 = &bmcsensors_all; - break; - case(STYPE_VOLT) : - bmcsensors_dir_table[i].ctl_name = BMC_SYSCTL_IN1 + volts; - sprintf((char *)bmcsensors_dir_table[i].procname, "in%d", ++volts); - bmcsensors_dir_table[i].extra1 = &bmcsensors_all; - break; - case(STYPE_CURR) : - bmcsensors_dir_table[i].ctl_name = BMC_SYSCTL_CURR1 + currs; - sprintf((char *)bmcsensors_dir_table[i].procname, "curr%d", ++currs); - bmcsensors_dir_table[i].extra1 = &bmcsensors_all; - break; - case(STYPE_FAN) : - bmcsensors_dir_table[i].ctl_name = BMC_SYSCTL_FAN1 + fans; - sprintf((char *)bmcsensors_dir_table[i].procname, "fan%d", ++fans); - bmcsensors_dir_table[i].extra1 = &bmcsensors_all; - break; - default: /* ?? */ - printk(KERN_INFO "bmcsensors.o: unk stype\n"); - continue; - } - sdrd[i].sysctl = bmcsensors_dir_table[i].ctl_name; - printk(KERN_INFO "bmcsensors.o: registering sensor %d: (type 0x%.2x) " - "(fmt=%d; m=%d; b=%d; k1=%d; k2=%d; cap=0x%.2x; mask=0x%.4x)\n", - i, sdrd[i].stype, sdrd[i].format, - sdrd[i].m, sdrd[i].b,sdrd[i].k & 0xf, sdrd[i].k >> 4, - sdrd[i].capab, sdrd[i].thresh_mask); - if(sdrd[i].id_length > 0) { - ipmi_sprintf(id, sdrd[i].id, sdrd[i].string_type, sdrd[i].id_length); - printk(KERN_INFO "bmcsensors.o: sensors.conf: label %s \"%s\"\n", - bmcsensors_dir_table[i].procname, id); - } - bmcsensors_select_thresholds(sdrd + i); - if(sdrd[i].linear != 0 && sdrd[i].linear != 7) { - printk(KERN_INFO - "bmcsensors.o: sensor %d: nonlinear function 0x%.2x unsupported, expect bad results\n", - i, sdrd[i].linear); - } - if((sdrd[i].format & 0x03) == 0x02) { - printk(KERN_INFO - "bmcsensors.o: sensor %d: 1's complement format unsupported, expect bad results\n", - i); - } else if((sdrd[i].format & 0x03) == 0x03) { - printk(KERN_INFO - "bmcsensors.o: sensor %d: threshold sensor only, no readings available", - i); - } - if(sdrd[i].lim1_write || sdrd[i].lim2_write) - bmcsensors_dir_table[i].mode = 0644; - else - bmcsensors_dir_table[i].mode = 0444; - } - bmcsensors_dir_table[sdrd_count].ctl_name = 0; - - if ((i = i2c_register_entry(&bmc_client, "bmc", - bmcsensors_dir_table, - THIS_MODULE)) < 0) { - printk(KERN_INFO "bmcsensors.o: i2c registration failed.\n"); - kfree(bmcsensors_dir_table); - kfree(bmcsensors_proc_name_pool); - return; - } - bmcsensors_initialized = 3; - bmc_data.sysctl_id = i; - - printk(KERN_INFO "bmcsensors.o: %d reservations cancelled\n", errorcount); - printk(KERN_INFO "bmcsensors.o: registered %d temp, %d volt, %d current, %d fan sensors\n", - temps, volts, currs, fans); -/* - This completes the initialization. The first userspace read - of a /proc value will force the first - bmcsensors_update_client() which starts the - reading of the sensors themselves via IPMI messages. -*/ -} - - -/* Process a sensor reading response */ -static int bmcsensors_rcv_reading_msg(struct ipmi_msg *msg) -{ - if(receive_counter >= sdrd_count) { - /* shouldn't happen */ - receive_counter = 0; - return STATE_DONE; - } - sdrd[receive_counter].reading = msg->data[1]; - sdrd[receive_counter].status = msg->data[2]; - sdrd[receive_counter].thresholds = msg->data[3]; -#ifdef DEBUG - printk(KERN_DEBUG "bmcsensors.o: sensor %d (type %d) reading %d\n", - receive_counter, sdrd[receive_counter].stype, msg->data[1]); -#endif - if(++receive_counter >= sdrd_count) { - receive_counter = 0; - return STATE_DONE; - } - /* don't really need to pass client */ - bmcsensors_get_reading(&bmc_client, receive_counter); - return STATE_READING; -} - -/* Process an SDR response, save the SDR's we like in the sdrd table */ -static int bmcsensors_rcv_sdr_msg(struct ipmi_msg *msg, int state) -{ - u16 record; - int type; - int stype; - int id_length; - int i; - int rstate = STATE_SDR; - int ipmi_ver = 0; - unsigned char * data; - u8 id[SDR_MAX_UNPACKED_ID_LENGTH]; - - - if(msg->data[0] != 0) { - /* cut request in half and try again */ - ipmi_sdr_partial_size /= 2; - if(ipmi_sdr_partial_size < 8) { - printk(KERN_INFO "bmcsensors.o: IPMI buffers too small, giving up\n"); - up (&bmc_sem); /* should wait for thread exit ! */ - return STATE_DONE; - } -#ifdef DEBUG - printk(KERN_INFO "bmcsensors.o: Reducing SDR request size to %d\n", ipmi_sdr_partial_size); -#endif - bmcsensors_get_sdr(0, 0, 0); - return STATE_SDR; - } - if(ipmi_sdr_partial_size < IPMI_SDR_SIZE) { - if(rx_msg_data_offset == 0) { - memcpy(rx_msg_data, msg->data, ipmi_sdr_partial_size + 3); - rx_msg_data_offset = ipmi_sdr_partial_size + 3; - } else { - memcpy(rx_msg_data + rx_msg_data_offset, msg->data + 3, ipmi_sdr_partial_size); - rx_msg_data_offset += ipmi_sdr_partial_size; - } - if(rx_msg_data_offset > rx_msg_data[7] + 7) { - /* got last chunk */ - rx_msg_data_offset = 0; - data = rx_msg_data; - } else { - /* get more */ - record = (rx_msg_data[4] << 8) | rx_msg_data[3]; - bmcsensors_get_sdr(resid, record, rx_msg_data_offset - 3); - return STATE_SDR; - } - } else { - data = msg->data; /* got it in one chunk */ - } - - nextrecord = (data[2] << 8) | data[1]; - /* printk(KERN_INFO "bmcsensors.o: nextrecord %d\n", nextrecord); */ - - - type = data[6]; - if(type == 1 || type == 2) { /* known SDR type */ -/* - version = data[5]; - owner = data[8]; - lun = data[9]; - entity = data[11]; - init = data[13]; -*/ - stype = data[(ipmi_ver == 0x90?16:15)]; - if(stype <= STYPE_MAX) { /* known sensor type */ - if(bmcs_count[stype] >= bmcs_max[stype]) { - if(bmcs_max[stype] > 0) - printk(KERN_INFO - "bmcsensors.o: Limit of %d exceeded for sensor type 0x%x\n", - bmcs_max[stype], stype); -#ifdef DEBUG - else - printk(KERN_INFO - "bmcsensors.o: Ignoring unsupported sensor type 0x%x\n", - stype); -#endif - } else if(sdrd_count >= MAX_SDR_ENTRIES) { - printk(KERN_INFO - "bmcsensors.o: Limit of %d exceeded for total sensors\n", - MAX_SDR_ENTRIES); - nextrecord = 0xffff; - } else if(data[(ipmi_ver == 0x90?17:16)] != 0x01) { - if(type == 1) - ipmi_sprintf(id, &data[51], data[50] >> 6, data[50] & 0x1f); - else - ipmi_sprintf(id, &data[(ipmi_ver == 0x90?30:35)], data[(ipmi_ver == 0x90?29:34)] >> 6, data[(ipmi_ver == 0x90?29:34)] & 0x1f); - printk(KERN_INFO - "bmcsensors.o: skipping non-threshold sensor \"%s\"\n", - id); - } else { - /* add entry to sdrd table */ - sdrd[sdrd_count].stype = stype; - sdrd[sdrd_count].number = data[10]; - sdrd[sdrd_count].capab = data[(ipmi_ver == 0x90?15:14)]; - sdrd[sdrd_count].thresh_mask = (((u16) data[(ipmi_ver == 0x90?21:22)]) << 8) | data[21]; - if(type == 1) { - sdrd[sdrd_count].format = data[(ipmi_ver == 0x90?22:24)] >> 6; - sdrd[sdrd_count].linear = data[(ipmi_ver == 0x90?25:26)] & 0x7f; - sdrd[sdrd_count].m = data[(ipmi_ver == 0x90?26:27)]; - sdrd[sdrd_count].m |= ((u16) (data[(ipmi_ver == 0x90?27:28)] & 0xc0)) << 2; - if(sdrd[sdrd_count].m & 0x0200) - sdrd[sdrd_count].m |= 0xfc00; /* sign extend */ - sdrd[sdrd_count].b = data[(ipmi_ver == 0x90?28:29)]; - sdrd[sdrd_count].b |= ((u16) (data[(ipmi_ver == 0x90?29:30)] & 0xc0)) << 2; - if(sdrd[sdrd_count].b & 0x0200) - sdrd[sdrd_count].b |= 0xfc00; /* sign extend */ - sdrd[sdrd_count].k = data[(ipmi_ver == 0x90?31:32)]; - sdrd[sdrd_count].nominal = data[(ipmi_ver == 0x90?33:34)]; - for(i = 0; i < SDR_LIMITS; i++) /* assume readable */ - sdrd[sdrd_count].limits[i] = data[(ipmi_ver == 0x90?40:39) + i]; - sdrd[sdrd_count].string_type = data[50] >> 6; - id_length = data[50] & 0x1f; - memcpy(sdrd[sdrd_count].id, &data[51], id_length); - sdrd[sdrd_count].id_length = id_length; - } else { - sdrd[sdrd_count].m = 1; - sdrd[sdrd_count].b = 0; - sdrd[sdrd_count].k = 0; - sdrd[sdrd_count].string_type = data[(ipmi_ver == 0x90?29:34)] >> 6; - id_length = data[34] & 0x1f; - if(id_length > 0) - memcpy(sdrd[sdrd_count].id, &data[(ipmi_ver == 0x90?30:35)], id_length); - sdrd[sdrd_count].id_length = id_length; - /* limits?? */ - if(ipmi_ver == 0x90){ - memcpy(sdrd[sdrd_count].id, &data[30], id_length); - sdrd[sdrd_count].id_length = id_length; - } - } - bmcs_count[stype]++; - sdrd_count++; - if (sdrd_count>=MAX_SDR_ENTRIES) nextrecord = 0xffff; /*YJ*/ - - } - } -#ifdef DEBUG - /* peek at the other SDR types */ - } else if(type == 0x10 || type == 0x11 || type == 0x12) { - ipmi_sprintf(id, data + 19, data[18]>>6, data[18] & 0x1f); - if(type == 0x10) { - printk(KERN_INFO "bmcsensors.o: Generic Device acc=0x%x; slv=0x%x; lun=0x%x; type=0x%x; \"%s\"\n", - data[8], data[9], data[10], data[13], id); - } else if(type == 0x11) { - printk(KERN_INFO "bmcsensors.o: FRU Device acc=0x%x; slv=0x%x; log=0x%x; ch=0x%x; type=0x%x; \"%s\"\n", - data[8], data[9], data[10], data[11], data[13], id); - } else { - printk(KERN_INFO "bmcsensors.o: Mgmt Ctllr Device slv=0x%x; \"%s\"\n", - data[8], id); - } - } else if(type == 0x14) { - printk(KERN_INFO "bmcsensors.o: Message Channel Info Records:\n"); - for(i = 0; i < 8; i++) { - printk(KERN_INFO "bmcsensors.o: Channel %d info 0x%x\n", - i, data[9 + i]); - } - } else { - printk(KERN_INFO "bmcsensors.o: Skipping SDR type 0x%x\n", type); -#endif - } - if (nextrecord>=6224) { - nextrecord = 0xffff; /*YJ stop sensor scan on poweredge 1750 */ - } - if (ipmi_ver != 0x90) { - if (nextrecord>=6224) { - nextrecord = 0xffff; /*YJ stop sensor scan on poweredge 1750 */ - } - } - - if(nextrecord == 0xFFFF) { - if(sdrd_count == 0) { - printk(KERN_INFO "bmcsensors.o: No recognized sensors found.\n"); - /* unregister?? */ - rstate = STATE_DONE; - up (&bmc_sem); /* should wait for thread exit !!! */ - } else { - /* YJ ...*/ - printk(KERN_INFO "bmcsensors.o: all sensors detected\n"); - rstate = STATE_PROCTABLE; - /* YJ bmcsensors_build_proc_table() call by thread */ - /* ... YJ */ - } - - } else { - - bmcsensors_get_sdr(0, nextrecord, 0); - } - return rstate; -} - -/* Process incoming messages based on internal state */ -static void bmcsensors_rcv_msg(struct ipmi_msg *msg) -{ - - switch(state) { - case STATE_INIT: - case STATE_RESERVE: - resid = (((u16)msg->data[2]) << 8) | msg->data[1]; -#ifdef DEBUG - printk(KERN_DEBUG "bmcsensors.o: Got first resid 0x%.4x\n", resid); -#endif - bmcsensors_get_sdr(0, 0, 0); - state = STATE_SDR; - break; - - case STATE_SDR: - case STATE_SDRPARTIAL: - state = bmcsensors_rcv_sdr_msg(msg, state); - /*YJ ...*/ - if (state==STATE_PROCTABLE){ - -#ifdef DEBUG - printk(KERN_DEBUG "releasing thread\n"); -#endif - - up (&bmc_sem); - } - /*YJ bmcsensors_build_proc_table() called by thread */ - /* ... YJ */ - break; - - case STATE_READING: - state = bmcsensors_rcv_reading_msg(msg); - break; - - case STATE_UNCANCEL: - resid = (((u16)msg->data[2]) << 8) | msg->data[1]; -#ifdef DEBUG - printk(KERN_DEBUG "bmcsensors.o: Got new resid 0x%.4x\n", resid); -#endif - rx_msg_data_offset = 0; - bmcsensors_get_sdr(0, nextrecord, 0); - state = STATE_SDR; - break; - - case STATE_DONE: - case STATE_PROCTABLE: - break; - - default: - state = STATE_INIT; - } -} - - -/* Incoming message handler */ -static void bmcsensors_msg_handler(struct ipmi_recv_msg *msg, - void * handler_data) -{ - if(state == STATE_SDR && msg->msg.data[0] == 0xc5) { - /* )(*&@(*&#@$ reservation cancelled, get new resid */ - if(++errorcount > 275) { - printk(KERN_ERR - "bmcsensors.o: Too many reservations cancelled, giving up\n"); - state = STATE_DONE; - up (&bmc_sem); /* YJ : should make sure thread exited ! */ - } else { -#ifdef DEBUG - printk(KERN_DEBUG - "bmcsensors.o: resid 0x%04x cancelled, getting new one\n", resid); -#endif - bmcsensors_reserve_sdr(); - state = STATE_UNCANCEL; - } - } else if (msg->msg.data[0] != 0 && msg->msg.data[0] != 0xca && - msg->msg.data[0] != 0xce) { - /* YJ : accept 0xce */ - printk(KERN_ERR - "bmcsensors.o: Error 0x%x on cmd 0x%x/0x%x; state = %d; probably fatal.\n", - msg->msg.data[0], msg->msg.netfn & 0xfe, msg->msg.cmd, state); - } else { - bmcsensors_rcv_msg(&(msg->msg)); - } - ipmi_free_recv_msg(msg); -} - -/* callback from i2c-ipmi */ -static int bmcsensors_command(struct i2c_client *client, unsigned int cmd, void *arg) -{ - bmcsensors_msg_handler((struct ipmi_recv_msg *) arg, NULL); - return 0; -} - -/************** Message Sending **************/ - -/* Send an IPMI message */ -static void bmcsensors_send_message(struct ipmi_msg * msg) -{ -#ifdef DEBUG - printk(KERN_INFO "bmcsensors.o: Send BMC msg, cmd: 0x%x\n", - msg->cmd); -#endif - bmc_client.adapter->algo->slave_send((struct i2c_adapter *) &bmc_client, - (char *) msg, msgid++); - -} - -/* Compose and send a "reserve SDR" message */ -static void bmcsensors_reserve_sdr(void) -{ - tx_message.netfn = IPMI_NETFN_STORAGE; - tx_message.cmd = IPMI_RESERVE_SDR; - tx_message.data_len = 0; - tx_message.data = NULL; - printk(KERN_INFO "bmcsensors.o: reserve_sdr...\n"); - bmcsensors_send_message(&tx_message); -} - -/* Componse and send a "get SDR" message */ -static void bmcsensors_get_sdr(u16 res_id, u16 record, u8 offset) -{ -#ifdef DEBUG - printk(KERN_DEBUG "bmcsensors.o: Get SDR 0x%x 0x%x 0x%x\n", - res_id, record, offset); -#endif - tx_message.netfn = IPMI_NETFN_STORAGE; - tx_message.cmd = IPMI_GET_SDR; - tx_message.data_len = 6; - tx_message.data = tx_msg_data; - tx_msg_data[0] = res_id & 0xff; - tx_msg_data[1] = res_id >> 8; - tx_msg_data[2] = record & 0xff; - tx_msg_data[3] = record >> 8; - tx_msg_data[4] = offset; - tx_msg_data[5] = ipmi_sdr_partial_size; - bmcsensors_send_message(&tx_message); -} - -/* Compose and send a "get sensor reading" message */ -static void bmcsensors_get_reading(struct i2c_client *client, int i) -{ - tx_message.netfn = IPMI_NETFN_SENSOR; - tx_message.cmd = IPMI_GET_SENSOR_STATE_READING; - tx_message.data_len = 1; - tx_message.data = tx_msg_data; - tx_msg_data[0] = sdrd[i].number; - bmcsensors_send_message(&tx_message); -} - -/**************** Initialization ****************/ - -static int bmcsensors_attach_adapter(struct i2c_adapter *adapter) -{ - printk(KERN_INFO "bmcsensors.o: attach_adapter...\n"); - - if(adapter->algo->id != I2C_ALGO_IPMI){ - printk(KERN_INFO "bmcsensors.o: attach_adapter, expected 0x%x, got 0x%x\n", I2C_ALGO_IPMI, adapter->algo->id); - return 0; - } - - if(bmcsensors_initialized >= 2) { - printk(KERN_INFO "bmcsensors.o: Additional IPMI adapter not supported\n"); - return 0; - } - - return bmcsensors_detect(adapter, 0, 0, 0); -} - -static int bmcsensors_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int err, i; - - bmc_client.id = 0; - bmc_client.adapter = adapter; - bmc_data.valid = 0; - - if ((err = i2c_attach_client(&bmc_client))) { - printk(KERN_ERR "attach client error in bmcsensors_detect()\n"); - return err; - } - bmcsensors_initialized = 2; - - state = STATE_INIT; - sdrd_count = 0; - receive_counter = 0; - rx_msg_data_offset = 0; - errorcount = 0; - ipmi_sdr_partial_size = IPMI_CHUNK_SIZE; - for(i = 0; i <= STYPE_MAX; i++) - bmcs_count[i] = 0; - - /* send our first message, which kicks things off */ - printk(KERN_INFO "bmcsensors.o: Registered client, scanning for sensors...\n"); - bmcsensors_reserve_sdr(); - /* don't call i2c_register_entry until we scan the SDR's */ - return 0; -} - -static int bmcsensors_detach_client(struct i2c_client *client) -{ - int err; - - if(bmcsensors_initialized >= 3) { - kfree(bmcsensors_dir_table); - kfree(bmcsensors_proc_name_pool); - i2c_deregister_entry(((struct bmcsensors_data *) (client->data))-> - sysctl_id); - } - - if ((err = i2c_detach_client(client))) { -/* - printk - ("bmcsensors.o: Client deregistration failed, client not detached.\n"); -*/ - return err; - } - - bmcsensors_initialized = 1; - return 0; -} - - -static void bmc_do_pause(unsigned int amount) -{ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(amount); -} - -static void bmcsensors_update_client(struct i2c_client *client) -{ - struct bmcsensors_data *data = client->data; - int j = 0; - -/* - down(&data->update_lock); -*/ - - /* if within 3 seconds you get old data */ - if ((jiffies - data->last_updated > 3 * HZ) || - (jiffies < data->last_updated) || !data->valid) { - /* don't start an update cycle if one already in progress */ - if(state != STATE_READING) { - state = STATE_READING; -#ifdef DEBUG - printk(KERN_DEBUG "bmcsensors.o: starting update\n"); -#endif - bmcsensors_get_reading(client, 0); - } - /* wait 4 seconds max */ - while(state == STATE_READING && j++ < 100) - bmc_do_pause(HZ / 25); -#ifdef DEBUG - printk(KERN_DEBUG "bmcsensors.o: update complete; j = %d\n", j); -#endif - data->last_updated = jiffies; - data->valid = 1; - } - -/* - up(&data->update_lock); -*/ -} - - -/************* /proc callback helper functions *********/ - -/* need better way to map from sysctl to sdrd record number */ -static struct sdrdata * find_sdrd(int sysctl) -{ - int i; - - for(i = 0; i < sdrd_count; i++) - if(sdrd[i].sysctl == sysctl) - return sdrd + i; - return NULL; -} - -/* IPMI V1.5 Section 30 */ -static const int exps[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000}; - -/* Return 0 for fan, 2 for temp, 3 for voltage - We could make it variable based on the accuracy (= log10(m * 10**k2)); - this would work for /proc output, however libsensors resolution - is statically set in lib/chips.c */ -static int decplaces(struct sdrdata *sd) -{ - switch(sd->stype) { - case STYPE_TEMP: - return 2; - case STYPE_CURR: - case STYPE_VOLT: - return 3; - case STYPE_FAN: - default: - return 0; - } -} - -/* convert a raw value to a reading. IMPI V1.5 Section 30 */ -/* 1/x is the only "linearization function" supported */ -static long conv_val(int value, struct sdrdata *sd) -{ - u8 k1, k2; - long r; - - r = value * sd->m; - k1 = sd->k & 0x0f; - k2 = sd->k >> 4; - if(k1 < 8) - r += sd->b * exps[k1]; - else - r += sd->b / exps[16 - k1]; - r *= exps[decplaces(sd)]; - if(k2 < 8) { - if(sd->linear != 7) - r *= exps[k2]; - else - // this will always truncate to 0: r = 1 / (exps[k2] * r); - r = 0; - } else { - if(sd->linear != 7) - r /= exps[16 - k2]; - else { - if(r != 0) - // 1 / x * 10 ** (-m) == 10 ** m / x - r = exps[16 - k2] / r; - else - r = 0; - } - } - return r; -} - - -/************** /proc callbacks *****************/ - -static void bmcsensors_all(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct sdrdata *sd; -/* - struct bmcsensors_data *data = client->data; -*/ - - if((sd = find_sdrd(ctl_name)) == NULL) { - *nrels_mag = 0; - return; - } - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = decplaces(sd); - else if (operation == SENSORS_PROC_REAL_READ) { - bmcsensors_update_client(client); - if(sd->lim2 >= 0) { - if(sd->stype == STYPE_TEMP) /* upper limit first */ - results[0] = - conv_val(sd->limits[sd->lim1], sd); - else /* lower limit first */ - results[0] = - conv_val(sd->limits[sd->lim2], sd); - } else - results[0] = 0; - if(sd->stype == STYPE_FAN) { /* lower limit only */ - results[1] = conv_val(sd->reading, sd); - *nrels_mag = 2; - } else { - if(sd->lim1 >= 0) { - if(sd->stype == STYPE_TEMP) { /* lower 2nd */ - results[1] = - conv_val(sd->limits[sd->lim2], sd); - if(sd->lim2 == 6) /* pos. thresh. */ - results[1] = results[0] - - results[1]; - } else /* upper 2nd */ - results[1] = - conv_val(sd->limits[sd->lim1], sd); - } else - results[1] = 0; - results[2] = conv_val(sd->reading, sd); - *nrels_mag = 3; - } - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - /* unimplemented */ - } - } -} - -#if 0 -static void bmcsensors_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct bmcsensors_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - bmcsensors_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} -#endif - -/* YJ ... */ -static int bmc_thread(void *dummy){ - - lock_kernel(); - daemonize(); - unlock_kernel(); - - strcpy(current->comm, "bmc-sensors"); - - if(down_interruptible(&bmc_sem)) { - - printk("exiting..."); - - thread_pid= 0; - up (&bmc_sem); - - return 0; - } - - if (state == STATE_PROCTABLE){ - - bmcsensors_build_proc_table(); - - state = STATE_DONE; - - printk(KERN_INFO "bmcsensors.o: bmcsensor thread done\n" ); - - } - - thread_pid= 0; - - up (&bmc_sem); - - return 0; -} -/* ... YJ */ - -static int __init sm_bmcsensors_init(void) -{ - printk(KERN_INFO "bmcsensors.o version %s (%s)\n", LM_VERSION, LM_DATE); - /* YJ ... */ - init_MUTEX_LOCKED(&bmc_sem); - - thread_pid= kernel_thread(bmc_thread, NULL, 0); - - if (thread_pid<0){ - printk(KERN_ERR "bmcsensors.o : Could not initialize bmc thread. Aborting\n"); - return 0; - } - /* ... YJ */ - - return i2c_add_driver(&bmcsensors_driver); -} - -static void __exit sm_bmcsensors_exit(void) -{ - int j; - j= 0; - /* YJ ... */ - printk(KERN_INFO "bmcsensors.o sleeping a while\n"); - while( (j++ < 50)){ - bmc_do_pause(HZ / 25); - } - if (thread_pid > 0){ - printk(KERN_INFO "bmcsensors.o stopping kernel thread\n"); - state= STATE_DONE; - j= 0; - up (&bmc_sem); - printk(KERN_INFO "bmcsensors.o waiting...\n"); - /* make sure kernel thread does not access driver memory any more */ - while((thread_pid > 0)&& (j++ < 100)){ - bmc_do_pause(HZ / 25); - } - printk(KERN_INFO "bmcsensors.o OK\n"); - } - j= 0; - /* sleep for debug... not necessary ? */ - printk(KERN_INFO "bmcsensors.o sleeping again\n"); - while( (j++ < 50)){ - bmc_do_pause(HZ / 25); - } - /* ...YJ */ - printk(KERN_INFO "bmcsensors.o i2c cleanup\n"); - i2c_del_driver(&bmcsensors_driver); -} - - - -MODULE_AUTHOR("Mark D. Studebaker "); -MODULE_DESCRIPTION("IPMI BMC sensors"); -MODULE_LICENSE("GPL"); - -module_init(sm_bmcsensors_init); -module_exit(sm_bmcsensors_exit); diff --git a/kernel/chips/bt869.c b/kernel/chips/bt869.c deleted file mode 100644 index aceea8d0..00000000 --- a/kernel/chips/bt869.c +++ /dev/null @@ -1,886 +0,0 @@ -/* - bt869.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - - Copyright (c) 1998, 1999 Frodo Looijaard - Copyright (c) 2001, 2002 Stephen Davies - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - - -#define DEBUG 1 - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; - -/* found only at 0x44 or 0x45 */ -static unsigned short normal_i2c_range[] = { 0x44, 0x45, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(bt869); - -/* Many bt869 constants specified below */ - -/* The bt869 registers */ -/* Coming soon: Many, many registers */ - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ - - /*none */ - -/* Initial values */ -/*none*/ - -/* Each client has this additional data */ -struct bt869_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 status[3]; /* Register values */ - u16 res[2]; /* Resolution XxY */ - u8 ntsc; /* 1=NTSC, 0=PAL */ - u8 half; /* go half res */ - u8 depth; /* screen depth */ - u8 colorbars; /* turn on/off colorbar calibration screen */ - u8 svideo; /* output format: (2=RGB) 1=SVIDEO, 0=Composite */ -}; - -static int bt869_attach_adapter(struct i2c_adapter *adapter); -static int bt869_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void bt869_init_client(struct i2c_client *client); -static int bt869_detach_client(struct i2c_client *client); -static int bt869_read_value(struct i2c_client *client, u8 reg); -static int bt869_write_value(struct i2c_client *client, u8 reg, u16 value); -static void bt869_write_values(struct i2c_client *client, u16 *values); -static void bt869_status(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void bt869_ntsc(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void bt869_res(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void bt869_half(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void bt869_colorbars(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void bt869_svideo(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void bt869_depth(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void bt869_update_client(struct i2c_client *client); - - -/* This is the driver that will be inserted */ -static struct i2c_driver bt869_driver = { - .name = "BT869 video-output chip driver", - .id = I2C_DRIVERID_BT869, - .flags = I2C_DF_NOTIFY, - .attach_adapter = bt869_attach_adapter, - .detach_client = bt869_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define BT869_SYSCTL_STATUS 1000 -#define BT869_SYSCTL_NTSC 1001 -#define BT869_SYSCTL_HALF 1002 -#define BT869_SYSCTL_RES 1003 -#define BT869_SYSCTL_COLORBARS 1004 -#define BT869_SYSCTL_DEPTH 1005 -#define BT869_SYSCTL_SVIDEO 1006 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected bt869. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table bt869_dir_table_template[] = { - {BT869_SYSCTL_STATUS, "status", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &bt869_status}, - {BT869_SYSCTL_NTSC, "ntsc", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &bt869_ntsc}, - {BT869_SYSCTL_RES, "res", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &bt869_res}, - {BT869_SYSCTL_HALF, "half", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &bt869_half}, - {BT869_SYSCTL_COLORBARS, "colorbars", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &bt869_colorbars}, - {BT869_SYSCTL_DEPTH, "depth", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &bt869_depth}, - {BT869_SYSCTL_SVIDEO, "svideo", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &bt869_svideo}, - {0} -}; - -/* ****************** - -720x576, 27.5MHz, PAL, no overscan compensation. - -This mode should be use for digital video, DVD playback etc. - -NOTE: This mode for PAL, see 720x480 for an equivalent NTSC mode -NOTE: -- Steve Davies - - -Compatible X modeline: - - Mode "720x576-BT869" - DotClock 27.5 - HTimings 720 744 800 880 - VTimings 576 581 583 625 - EndMode - - -625LINE=1 625 line output format -BST_AMP[7:0]=x57 87 Burst ampl. multiplication factor (PAL std??) -BY_PLL=0 Use the PLL -CATTENUATE[2:0]=0 No chroma attenuation -CCF1B1[7:0]=0 close caption stuff -CCF1B2[7:0]=0 close caption stuff -CCF2B1[7:0]=0 close caption stuff -CCF2B2[7:0]=0 close caption stuff -CCORING[2:0]=0 Bypass chroma coring -CCR_START[8:0]=0 [CCR_START[8]=0; CCR_START[7:0]=0] Close-caption clock runin start from hsync -CC_ADD[11:0]=xD2 210 [CC_ADD[11:8]=0; CC_ADD[7:0]=xD2] Close-caption DTO increment -CHECK_STAT=0 Don't check monitor status -CLPF[1:0]=0 Hoz chroma lowpass filter=Bypass -DACDISA=1 Disable DACA -DACDISB=0 Don't disable DACB -DACDISC=0 Don't disable DACC -DACOFF=0 Don't disable the DACs -DATDLY = 0 normal -DATSWP=0 normal -DCHROMA=0 Don't blank chroma -DIS_FFILT=1 Disable flickerfilter -DIS_GMSHC=1 Disable chroma psuedo-gamma removal -DIS_GMSHY=1 Disable luma pseudo gamma removal -DIS_GMUSHC=1 Disable chroma anti-pseudo gamma removal -DIS_GMUSHY=1 Disable luma anti-pseudo gamma removal -DIS_SCRESET=0 Normal subcarrier phase resets -DIS_YFLPF=0 Disable Luma initial hoz low pass filter -DIV2=0 Input pixel rate not divided by 2 -ECBAR=0 No colour bars -ECCF1=0 Disable closed caption -ECCF2=0 Disable closed caption -ECCGATE=0 Normal close caption encoding -ECLIP=0 0=disable clipping -EN_ASYNC=0 set to 0 for normal operation -EN_BLANKO=0 BLANK is an input -EN_DOT=0 Disables dot clock sync on BLANK pin -EN_OUT=1 Allows outputs to be enabled -EN_XCLK=1 Use CLKI pin as clock source -ESTATUS[1:0]=0 Used to select readback register -FIELDI=0 Logical 1 on FIELD indicates even field -F_SELC[2:0]=0 5 line chroma flickerfilter -F_SELY[2:0]=0 5 line luma flickerfilter -HBURST_BEGIN[7:0]=x98 152 Chroma burst start point in clocks -HBURST_END[7:0]=x58 88 Chroma burst end point in clocks - 128 -HSYNCI=0 Active low HSYNC -HSYNC_WIDTH[7:0]=x80 128 Analogue sync width in clocks -HSYNOFFSET[9:0]=0 [HSYNOFFSET[9:8]=0; HSYNOFFSET[7:0]=0] hsync in "standard position" -HSYNWIDTH[5:0]=2 2 pixel hsync width -H_ACTIVE[9:0]=x2D0 720 [H_ACTIVE[9:8]=2; H_ACTIVE[7:0]=xD0] Active pixels per line -H_BLANKI[8:0]=x84 132 [H_BLANKI[8]=0; H_BLANKI[7:0]=x84] End of blanking of input video -H_BLANKO[9:0]=x120 288 [H_BLANKO[9:8]=1; H_BLANKO[7:0]=x20] End of blanking from hoz sync leading edge -H_CLKI[10:0]=x378 888 [H_CLKI[10:8]=3; H_CLKI[7:0]=x78] Input line length total in clocks -H_CLKO[11:0]=x6e0 1760 [H_CLKO[11:8]=6; H_CLKO[7:0]=xe0] Output clocks per line -H_FRACT[7:0]=0 0 fractional input clocks per line -IN_MODE[2:0]=0 24Bit RGB muxed -LUMADLY[1:0]=0 0 pixel delay on Y_DLY luma -MCB[7:0]=x49 73 Mult factor for CB prior to subcarrier mod. -MCR[7:0]=x82 130 Mult factor for CR prior to subcarrier mod. -MODE2X=0 Don't divide clock input by 2 -MSC[31:0]=x2945E0B4 692445365 [MSC[31:24]=x29; MSC[23:16]=x45; MSC[15:8]=xE0; MSC[7:0]=xB4] Subcarrier incr. -MY[7:0]=x8C 140 Mult factor for Y -NI_OUT=0 Normal interlaced output -OUT_MODE[1:0]=0 video0-3 is CVBS, Y, C, Y_DLY -OUT_MUXA[1:0]=0 Don't care as DACA is disabled -OUT_MUXB[1:0]=1 Output video[1] (Y) on DACB -OUT_MUXC[1:0]=2 Output video[2] (C) on DACC -PAL_MD=1 Video output in PAL mode -PHASE_OFF[7:0]=0 Subcarrier phase offset -PLL_FRACT[15:0]=x30 48 [PLL_FRACT[15:8]=0x0; PLL_FRACT[7:0]=x30] frac portion of pll multiplier -PLL_INT[5:0]=0x0C 12 Int portion of pll multiplier -SETUP=0 7.5-IRE setup disabled -SLAVER=1 -SRESET=0 Don't do a software reset -SYNC_AMP[7:0]=xF0 240 Sync amp mult. factor (PAL std???) -VBLANKDLY=0 Extra line of blanking in 2nd field? -VSYNCI=0 Active low VSYNC -VSYNC_DUR=0 2.5line VSYNC duration on output -VSYNCOFFSET[10:0]=0 [VSYNOFFSET[10:8]=0; VSYNOFFSET[7:0]=0] VSYNC in standard position -VSYNWIDTH[2:0]=1 1 line of vsync width -V_ACTIVEI[9:0]=x240 576 [V_ACTIVEI[9:0]=2; V_ACTIVEI[7:0]=x40] Active input lines -V_ACTIVEO[8:0]=x122 290 [V_ACTIVE0[8]=1; V_ACTIVEO[7:0]=x22] -V_BLANKI[7:0]=x2A 42 Input lines from vsync to first active line -V_BLANKO[7:0]=x16 22 -V_LINESI[9:0]=x271 625 [V_LINESI[9:8]=2; V_LINESI[7:0]=x71] Number of input lines -V_SCALE[13:0]=x1000 4096 [V_SCALE[13:8]=x10; V_SCALE[7:0]=0] Vert scale coefficient="none"? -YATTENUATE[2:0]=0 no luma attenuation -YCORING[2:0]=0 Luma-coring bypass -YLPF[1:0]=0 Luma hoz low pass filter=bypass - -***************** */ - -static u16 registers_720_576[] = - { - 0x6e, 0x00, /* HSYNOFFSET[7:0]=0 */ - 0x70, 0x02, /* HSYNOFFSET[9:8]=0; HSYNWIDTH[5:0]=2 */ - 0x72, 0x00, /* VSYNOFFSET[7:0]=0 */ - 0x74, 0x01, /* DATDLY = 0; DATSWP=0; VSYNOFFSET[10:8]=0; VSYNWIDTH[2:0]=1 */ - 0x76, 0xe0, /* H_CLKO[7:0]=xe0 */ - 0x78, 0xd0, /* H_ACTIVE[7:0]=xD0 */ - 0x7a, 0x80, /* HSYNC_WIDTH[7:0]=x80 */ - 0x7c, 0x98, /* HBURST_BEGIN[7:0]=x98 */ - 0x7e, 0x58, /* HBURST_END[7:0]=x58 */ - 0x80, 0x20, /* H_BLANKO[7:0]=x20 */ - 0x82, 0x16, /* V_BLANKO[7:0]=x16 */ - 0x84, 0x22, /* V_ACTIVEO[7:0]=x22 */ - 0x86, 0xa6, /* V_ACTIVE0[8]=1; H_ACTIVE[9:8]=2; H_CLKO[11:8]=6 */ - 0x88, 0x00, /* H_FRACT[7:0]=0 */ - 0x8a, 0x78, /* H_CLKI[7:0]=x78 */ - 0x8c, 0x80, /* H_BLANKI[7:0]=x84 */ - 0x8e, 0x03, /* VBLANKDLY=0; H_BLANKI[8]=0; H_CLKI[10:8]=3 */ - 0x90, 0x71, /* V_LINESI[7:0]=x71 */ - 0x92, 0x2a, /* V_BLANKI[7:0]=x2A */ - 0x94, 0x40, /* V_ACTIVEI[7:0]=x40 */ - 0x96, 0x0a, /* CLPF[1:0]=0; YLPF[1:0]=0; V_ACTIVEI[9:0]=2; V_LINESI[9:8]=2 */ - 0x98, 0x00, /* V_SCALE[7:0]=0 */ - 0x9a, 0x50, /* H_BLANKO[9:8]=1; V_SCALE[13:8]=x10 */ - 0x9c, 0x30, /* PLL_FRACT[7:0]=x30 */ - 0x9e, 0x0, /* PLL_FRACT[15:8]=0x0 */ - 0xa0, 0x8c, /* EN_XCLK=1; BY_PLL=0; PLL_INT[5:0]=0x0C */ - 0xa2, 0x24, /* ECLIP=0; PAL_MD=1; DIS_SCRESET=0; VSYNC_DUR=0; 625LINE=1; SETUP=0; NI_OUT=0 */ - 0xa4, 0xf0, /* SYNC_AMP[7:0]=xF0 */ - 0xa6, 0x57, /* BST_AMP[7:0]=x57 */ - 0xa8, 0x82, /* MCR[7:0]=x82 */ - 0xaa, 0x49, /* MCB[7:0]=x49 */ - 0xac, 0x8c, /* MY[7:0]=x8C */ - 0xae, 0xb4, /* MSC[7:0]=xb4 */ - 0xb0, 0xe0, /* MSC[15:8]=xe0 */ - 0xb2, 0x45, /* MSC[23:16]=x45 */ - 0xb4, 0x29, /* MSC[31:24]=x29 */ - 0xb6, 0x00, /* PHASE_OFF[7:0]=0 */ - //0xba, 0x21, /* SRESET=0; CHECK_STAT=0; SLAVER=1; DACOFF=0; DACDISC=0; DACDISB=0; DACDISA=1 */ - 0xc4, 0x01, /* ESTATUS[1:0]=0; ECCF2=0; ECCF1=0; ECCGATE=0; ECBAR=0; DCHROMA=0; EN_OUT=1 */ - 0xc6, 0x00, /* EN_BLANKO=0; EN_DOT=0; FIELDI=0; VSYNCI=0; HSYNCI=0; IN_MODE[2:0]=0(24bRGB) */ - 0xc8, 0x40, /* DIS_YFLPF=0; DIS_FFILT=1; F_SELC[2:0]=0; F_SELY[2:0]=0 */ - 0xca, 0xc0, /* DIS_GMUSHY=1; DIS_GMSHY=1; YCORING[2:0]=0; YATTENUATE[2:0]=0 */ - 0xcc, 0xc0, /* DIS_GMUSHC=1; DIS_GMSHC=1; CCORING[2:0]=0; CATTENUATE[2:0]=0 */ - //0xce, 0x24, /* OUT_MUXC=2 [C]; OUT_MUXB=1 [Y]; OUT_MUXA=0 [CVBS, but disabled]*/ - //0xce, 0x04, /* OUT_MUXC=0 [CVBS]; OUT_MUXB=1 [Y]; OUT_MUXA=0 [CVBS, but disabled]*/ - 0xd6, 0x00, /* OUT_MODE[1:0]=0; LUMADLY[1:0]=0 */ - 0, 0 - }; - - -/* ****************** - -720x480, 27.5MHz, NTSC no overscan compensation. - -This mode should be use for digital video, DVD playback etc. - -NOTE: This mode for NTSC, see 720x576 for an equivalent PAL mode -NOTE: -- Steve Davies - -Compatible X modeline: - - Mode "720x480-BT869" - DotClock 27.5 - HTimings 720 744 800 872 - VTimings 480 483 485 525 - EndMode - - -625LINE=0 not 625 line output format -BST_AMP[7:0]=x74 116 Burst ampl. multiplication factor (NTSC std??) -BY_PLL=0 Use the PLL -CATTENUATE[2:0]=0 No chroma attenuation -CCF1B1[7:0]=0 close caption stuff -CCF1B2[7:0]=0 close caption stuff -CCF2B1[7:0]=0 close caption stuff -CCF2B2[7:0]=0 close caption stuff -CCORING[2:0]=0 Bypass chroma coring -CCR_START[8:0]=0 [CCR_START[8]=0; CCR_START[7:0]=0] Close-caption clock runin start from hsync -CC_ADD[11:0]=xD2 210 [CC_ADD[11:8]=0; CC_ADD[7:0]=xD2] Close-caption DTO increment -CHECK_STAT=0 Don't check monitor status -CLPF[1:0]=0 Hoz chroma lowpass filter=Bypass -DACDISA=1 Disable DACA -DACDISB=0 Don't disable DACB -DACDISC=0 Don't disable DACC -DACOFF=0 Don't disable the DACs -DATDLY = 0 normal -DATSWP=0 normal -DCHROMA=0 Don't blank chroma -DIS_FFILT=1 Disable flickerfilter -DIS_GMSHC=1 Disable chroma psuedo-gamma removal -DIS_GMSHY=1 Disable luma pseudo gamma removal -DIS_GMUSHC=1 Disable chroma anti-pseudo gamma removal -DIS_GMUSHY=1 Disable luma anti-pseudo gamma removal -DIS_SCRESET=0 Normal subcarrier phase resets -DIS_YFLPF=0 Disable Luma initial hoz low pass filter -DIV2=0 Input pixel rate not divided by 2 -ECBAR=0 No colour bars -ECCF1=0 Disable closed caption -ECCF2=0 Disable closed caption -ECCGATE=0 Normal close caption encoding -ECLIP=0 0=disable clipping -EN_ASYNC=0 set to 0 for normal operation -EN_BLANKO=0 BLANK is an input -EN_DOT=0 Disables dot clock sync on BLANK pin -EN_OUT=1 Allows outputs to be enabled -EN_XCLK=1 Use CLKI pin as clock source -ESTATUS[1:0]=0 Used to select readback register -FIELDI=0 Logical 1 on FIELD indicates even field -F_SELC[2:0]=0 5 line chroma flickerfilter -F_SELY[2:0]=0 5 line luma flickerfilter -HBURST_BEGIN[7:0]=x92 146 Chroma burst start point in clocks -HBURST_END[7:0]=x57 87 Chroma burst end point in clocks - 128 -HSYNCI=0 Active low HSYNC -HSYNC_WIDTH[7:0]=x80 128 Analogue sync width in clocks -HSYNOFFSET[9:0]=0 [HSYNOFFSET[9:8]=0; HSYNOFFSET[7:0]=0] hsync in "standard position" -HSYNWIDTH[5:0]=2 2 pixel hsync width -H_ACTIVE[9:0]=x2D0 720 [H_ACTIVE[9:8]=2; H_ACTIVE[7:0]=xD0] Active pixels per line -H_BLANKI[8:0]=x80 128 [H_BLANKI[8]=0; H_BLANKI[7:0]=x80] End of blanking of input video -H_BLANKO[9:0]=x102 258 [H_BLANKO[9:8]=1; H_BLANKO[7:0]=x2] End of blanking from hoz sync leading edge -H_CLKI[10:0]=x368 872 [H_CLKI[10:8]=3; H_CLKI[7:0]=x68] Input line length total in clocks -H_CLKO[11:0]=x6d0 1744 [H_CLKO[11:8]=6; H_CLKO[7:0]=xD0] Output clocks per line -H_FRACT[7:0]=0 0 fractional input clocks per line -IN_MODE[2:0]=0 24Bit RGB muxed -LUMADLY[1:0]=0 0 pixel delay on Y_DLY luma -MCB[7:0]=x43 67 Mult factor for CB prior to subcarrier mod. -MCR[7:0]=x77 119 Mult factor for CR prior to subcarrier mod. -MODE2X=0 Don't divide clock input by 2 -MSC[31:0]=x215282E5 559055589 [MSC[31:24]=x21; MSC[23:16]=x52; MSC[15:8]=x82; MSC[7:0]=xE5] Subcarrier incr. -MY[7:0]=x85 133 Mult factor for Y -NI_OUT=0 Normal interlaced output -OUT_MODE[1:0]=0 video0-3 is CVBS, Y, C, Y_DLY -OUT_MUXA[1:0]=0 Don't care as DACA is disabled -OUT_MUXB[1:0]=1 Output video[1] (Y) on DACB -OUT_MUXC[1:0]=2 Output video[2] (C) on DACC -PAL_MD=0 Video output in PAL mode? No. -PHASE_OFF[7:0]=0 Subcarrier phase offset -PLL_FRACT[15:0]=x30 48 [PLL_FRACT[15:8]=0x0; PLL_FRACT[7:0]=x30] frac portion of pll multiplier -PLL_INT[5:0]=0x0C 12 Int portion of pll multiplier -SETUP=1 7.5-IRE enabled for NTSC -SLAVER=1 -SRESET=0 Don't do a software reset -SYNC_AMP[7:0]=xE5 229 Sync amp mult. factor (PAL std???) -VBLANKDLY=0 Extra line of blanking in 2nd field? -VSYNCI=0 Active low VSYNC -VSYNC_DUR=1 2.5line VSYNC duration on output (Yes for NTSC) -VSYNCOFFSET[10:0]=0 [VSYNOFFSET[10:8]=0; VSYNOFFSET[7:0]=0] VSYNC in standard position -VSYNWIDTH[2:0]=1 1 line of vsync width -V_ACTIVEI[9:0]=x1E0 480 [V_ACTIVEI[9:0]=1; V_ACTIVEI[7:0]=xE0] Active input lines -V_ACTIVEO[8:0]=xF0 240 [V_ACTIVE0[8]=0; V_ACTIVEO[7:0]=xF0] -V_BLANKI[7:0]=x2A 42 Input lines from vsync to first active line -V_BLANKO[7:0]=x16 22 -V_LINESI[9:0]=x20D 525 [V_LINESI[9:8]=2; V_LINESI[7:0]=x0D] Number of input lines -V_SCALE[13:0]=x1000 4096 [V_SCALE[13:8]=x10; V_SCALE[7:0]=0] Vert scale coefficient="none"? -YATTENUATE[2:0]=0 no luma attenuation -YCORING[2:0]=0 Luma-coring bypass -YLPF[1:0]=0 Luma hoz low pass filter=bypass - -***************** */ - -static u16 registers_720_480[] = - { - 0x6e, 0x00, /* HSYNOFFSET[7:0]=0 */ - 0x70, 0x02, /* HSYNOFFSET[9:8]=0; HSYNWIDTH[5:0]=2 */ - 0x72, 0x00, /* VSYNOFFSET[7:0]=0 */ - 0x74, 0x01, /* DATDLY = 0; DATSWP=0; VSYNOFFSET[10:8]=0; VSYNWIDTH[2:0]=1 */ - 0x76, 0xD0, /* H_CLKO[7:0]=xD0 */ - 0x78, 0xD0, /* H_ACTIVE[7:0]=xD0 */ - 0x7a, 0x80, /* HSYNC_WIDTH[7:0]=x80 */ - 0x7c, 0x92, /* HBURST_BEGIN[7:0]=x92 */ - 0x7e, 0x57, /* HBURST_END[7:0]=x57 */ - 0x80, 0x02, /* H_BLANKO[7:0]=x2 */ - 0x82, 0x16, /* V_BLANKO[7:0]=x16 */ - 0x84, 0xF0, /* V_ACTIVEO[7:0]=xF0 */ - 0x86, 0x26, /* V_ACTIVE0[8]=0; H_ACTIVE[9:8]=2; H_CLKO[11:8]=6 */ - 0x88, 0x00, /* H_FRACT[7:0]=0 */ - 0x8a, 0xD0, /* H_CLKI[7:0]=xD0 */ - 0x8c, 0x80, /* H_BLANKI[7:0]=x80 */ - 0x8e, 0x03, /* VBLANKDLY=0; H_BLANKI[8]=0; H_CLKI[10:8]=3 */ - 0x90, 0x0D, /* V_LINESI[7:0]=x0D */ - 0x92, 0x2A, /* V_BLANKI[7:0]=x2A */ - 0x94, 0xE0, /* V_ACTIVEI[7:0]=xE0 */ - 0x96, 0x06, /* CLPF[1:0]=0; YLPF[1:0]=0; V_ACTIVEI[9:8]=1; V_LINESI[9:8]=2 */ - 0x98, 0x00, /* V_SCALE[7:0]=0 */ - 0x9a, 0x50, /* H_BLANKO[9:8]=1; V_SCALE[13:8]=x10 */ - 0x9c, 0x30, /* PLL_FRACT[7:0]=x30 */ - 0x9e, 0x0, /* PLL_FRACT[15:8]=0x0 */ - 0xa0, 0x8c, /* EN_XCLK=1; BY_PLL=0; PLL_INT[5:0]=0x0C */ - 0xa2, 0x0A, /* ECLIP=0; PAL_MD=0; DIS_SCRESET=0; VSYNC_DUR=1; 625LINE=0; SETUP=1; NI_OUT=0 */ - 0xa4, 0xE5, /* SYNC_AMP[7:0]=xE5 */ - 0xa6, 0x74, /* BST_AMP[7:0]=x74 */ - 0xa8, 0x77, /* MCR[7:0]=x77 */ - 0xaa, 0x43, /* MCB[7:0]=x43 */ - 0xac, 0x85, /* MY[7:0]=x85 */ - 0xae, 0xE5, /* MSC[7:0]=xE5 */ - 0xb0, 0x82, /* MSC[15:8]=x82 */ - 0xb2, 0x52, /* MSC[23:16]=x52 */ - 0xb4, 0x21, /* MSC[31:24]=x21 */ - 0xb6, 0x00, /* PHASE_OFF[7:0]=0 */ - //0xba, 0x21, /* SRESET=0; CHECK_STAT=0; SLAVER=1; DACOFF=0; DACDISC=0; DACDISB=0; DACDISA=1 */ - 0xc4, 0x01, /* ESTATUS[1:0]=0; ECCF2=0; ECCF1=0; ECCGATE=0; ECBAR=0; DCHROMA=0; EN_OUT=1 */ - 0xc6, 0x00, /* EN_BLANKO=0; EN_DOT=0; FIELDI=0; VSYNCI=0; HSYNCI=0; IN_MODE[2:0]=0(24bRGB) */ - 0xc8, 0x40, /* DIS_YFLPF=0; DIS_FFILT=1; F_SELC[2:0]=0; F_SELY[2:0]=0 */ - 0xca, 0xc0, /* DIS_GMUSHY=1; DIS_GMSHY=1; YCORING[2:0]=0; YATTENUATE[2:0]=0 */ - 0xcc, 0xc0, /* DIS_GMUSHC=1; DIS_GMSHC=1; CCORING[2:0]=0; CATTENUATE[2:0]=0 */ - //0xce, 0x24, /* OUT_MUXC=2 [C]; OUT_MUXB=1 [Y]; OUT_MUXA=0 [CVBS, but disabled]*/ - //0xce, 0x04, /* OUT_MUXC=0 [CVBS]; OUT_MUXB=1 [Y]; OUT_MUXA=0 [CVBS, but disabled]*/ - 0xd6, 0x00, /* OUT_MODE[1:0]=0; LUMADLY[1:0]=0 */ - 0, 0 - }; - - -static int bt869_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, bt869_detect); -} - -/* This function is called by i2c_detect */ -int bt869_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i, cur; - struct i2c_client *new_client; - struct bt869_data *data; - int err = 0; - const char *type_name, *client_name; - - - printk("bt869.o: probing address %d .\n", address); - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("bt869.o: bt869_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE | - I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access bt869_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct bt869_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &bt869_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. It is lousy. */ - i2c_smbus_write_byte_data(new_client, 0xC4, 0); /* set status bank 0 */ - cur = i2c_smbus_read_byte(new_client); - printk("bt869.o: address 0x%X testing-->0x%X\n", address, cur); - if ((cur & 0xE0) != 0x20) - goto ERROR1; - - /* Determine the chip type */ - kind = ((cur & 0x20) >> 5); - - if (kind) { - type_name = "bt869"; - client_name = "bt869 chip"; - printk("bt869.o: BT869 detected\n"); - } else { - type_name = "bt868"; - client_name = "bt868 chip"; - printk("bt869.o: BT868 detected\n"); - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - bt869_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - bt869_init_client((struct i2c_client *) new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int bt869_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct bt869_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("bt869.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -/* All registers are byte-sized. - bt869 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int bt869_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte(client); -} - -/* All registers are byte-sized. - bt869 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int bt869_write_value(struct i2c_client *client, u8 reg, u16 value) -{ -#ifdef DEBUG - printk("bt869.o: write_value(0x%X, 0x%X)\n", reg, value); -#endif - return i2c_smbus_write_byte_data(client, reg, value); -} - -static void bt869_write_values(struct i2c_client *client, u16 *values) -{ - /* writes set of registers from array. 0,0 marks end of table */ - while (*values) { - bt869_write_value(client, values[0], values[1]); - values += 2; - } -} - -static void bt869_init_client(struct i2c_client *client) -{ - struct bt869_data *data = client->data; - - /* Initialize the bt869 chip */ - bt869_write_value(client, 0x0ba, 0x80); - // bt869_write_value(client,0x0D6, 0x00); - /* Be a slave to the clock on the Voodoo3 */ - bt869_write_value(client, 0xa0, 0x80); - bt869_write_value(client, 0xba, 0x20); - /* depth =16bpp */ - bt869_write_value(client, 0x0C6, 0x001); - bt869_write_value(client, 0xC4, 1); - /* Flicker free enable and config */ - bt869_write_value(client, 0xC8, 0); - data->res[0] = 640; - data->res[1] = 480; - data->ntsc = 1; - data->half = 0; - data->colorbars = 0; - data->svideo = 0; - data->depth = 16; - -} - -static void bt869_update_client(struct i2c_client *client) -{ - struct bt869_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { -#ifdef DEBUG - printk("Starting bt869 update\n"); -#endif - if ((data->res[0] == 800) && (data->res[1] == 600)) { - /* 800x600 built-in mode */ - bt869_write_value(client, 0xB8, - (2 + (!data->ntsc))); - bt869_write_value(client, 0xa0, 0x80 + 0x11); - printk("bt869.o: writing into config -->0x%X\n", - (2 + (!data->ntsc))); - } - else if ((data->res[0] == 720) && (data->res[1] == 576)) { - /* 720x576 no-overscan-compensation mode suitable for PAL DVD playback */ - data->ntsc = 0; /* This mode always PAL */ - bt869_write_values(client, registers_720_576); - } - else if ((data->res[0] == 720) && (data->res[1] == 480)) { - /* 720x480 no-overscan-compensation mode suitable for NTSC DVD playback */ - data->ntsc = 1; /* This mode always NTSC */ - bt869_write_values(client, registers_720_480); - } - else { - /* 640x480 built-in mode */ - bt869_write_value(client, 0xB8, (!data->ntsc)); - bt869_write_value(client, 0xa0, 0x80 + 0x0C); - printk("bt869.o: writing into config -->0x%X\n", - (0 + (!data->ntsc))); - if ((data->res[0] != 640) || (data->res[1] != 480)) { - printk - ("bt869.o: Warning: arbitrary resolutions not supported yet. Using 640x480.\n"); - data->res[0] = 640; - data->res[1] = 480; - } - } - /* Set colour depth */ - if ((data->depth != 24) && (data->depth != 16)) - data->depth = 16; - if (data->depth == 16) - bt869_write_value(client, 0x0C6, 0x001); - if (data->depth == 24) - bt869_write_value(client, 0x0C6, 0x000); - /* set "half" resolution mode */ - bt869_write_value(client, 0xd4, data->half << 6); - /* Set composite/svideo mode, also enable the right dacs */ - switch (data->svideo) { - case 2: /* RGB */ - /* requires hardware mod on Voodoo3 to get all outputs, - untested in practice... Feedback to steve@daviesfam.org please */ - bt869_write_value(client, 0xd6, 0x0c); - bt869_write_value(client, 0xce, 0x24); - bt869_write_value(client, 0xba, 0x20); - break; - case 1: /* Svideo*/ - bt869_write_value(client, 0xce, 0x24); - bt869_write_value(client, 0xba, 0x21); - break; - default: /* Composite */ - bt869_write_value(client, 0xce, 0x0); - bt869_write_value(client, 0xba, 0x21); - break; - } - /* Enable outputs */ - bt869_write_value(client, 0xC4, 1); - /* Issue timing reset */ - bt869_write_value(client, 0x6c, 0x80); - -/* Read back status registers */ - bt869_write_value(client, 0xC4, - 1 | (data->colorbars << 2)); - data->status[0] = bt869_read_value(client, 1); - bt869_write_value(client, 0xC4, - 0x41 | (data->colorbars << 2)); - data->status[1] = bt869_read_value(client, 1); - bt869_write_value(client, 0xC4, - 0x81 | (data->colorbars << 2)); - data->status[2] = bt869_read_value(client, 1); - bt869_write_value(client, 0xC4, - 0x0C1 | (data->colorbars << 2)); - data->last_updated = jiffies; - data->valid = 1; - } - up(&data->update_lock); -} - - -void bt869_status(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct bt869_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - bt869_update_client(client); - results[0] = data->status[0]; - results[1] = data->status[1]; - results[2] = data->status[2]; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - printk - ("bt869.o: Warning: write was requested on read-only proc file: status\n"); - } -} - - -void bt869_ntsc(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct bt869_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - bt869_update_client(client); - results[0] = data->ntsc; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->ntsc = (results[0] > 0); - } - bt869_update_client(client); - } -} - - -void bt869_svideo(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct bt869_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - bt869_update_client(client); - results[0] = data->svideo; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->svideo = results[0]; - } - bt869_update_client(client); - } -} - - -void bt869_res(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct bt869_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - bt869_update_client(client); - results[0] = data->res[0]; - results[1] = data->res[1]; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->res[0] = results[0]; - } - if (*nrels_mag >= 2) { - data->res[1] = results[1]; - } - bt869_update_client(client); - } -} - - -void bt869_half(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct bt869_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - bt869_update_client(client); - results[0] = data->half; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->half = (results[0] > 0); - bt869_update_client(client); - } - } -} - -void bt869_colorbars(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct bt869_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - bt869_update_client(client); - results[0] = data->colorbars; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->colorbars = (results[0] > 0); - bt869_update_client(client); - } - } -} - -void bt869_depth(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct bt869_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - bt869_update_client(client); - results[0] = data->depth; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->depth = results[0]; - bt869_update_client(client); - } - } -} - -static int __init sm_bt869_init(void) -{ - printk("bt869.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&bt869_driver); -} - -static void __exit sm_bt869_exit(void) -{ - i2c_del_driver(&bt869_driver); -} - - - -MODULE_AUTHOR - ("Frodo Looijaard , Philip Edelbrock , Stephen Davies "); -MODULE_DESCRIPTION("bt869 driver"); - -module_init(sm_bt869_init); -module_exit(sm_bt869_exit); diff --git a/kernel/chips/ddcmon.c b/kernel/chips/ddcmon.c deleted file mode 100644 index 45303f4b..00000000 --- a/kernel/chips/ddcmon.c +++ /dev/null @@ -1,586 +0,0 @@ -/* - ddcmon.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999, 2000 Frodo Looijaard , - Philip Edelbrock , - and Mark Studebaker - Copyright (c) 2003 Jean Delvare - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x50, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(ddcmon); - -static int checksum = 0; -MODULE_PARM(checksum, "i"); -MODULE_PARM_DESC(checksum, "Only accept eeproms whose checksum is correct"); - -/* Many constants specified below */ - -/* DDCMON registers */ -/* vendor section */ -#define DDCMON_REG_MAN_ID 0x08 -#define DDCMON_REG_PROD_ID 0x0A -#define DDCMON_REG_SERIAL 0x0C -#define DDCMON_REG_WEEK 0x10 -#define DDCMON_REG_YEAR 0x11 -/* EDID version */ -#define DDCMON_REG_EDID_VER 0x12 -#define DDCMON_REG_EDID_REV 0x13 -/* display information */ -#define DDCMON_REG_HORSIZE 0x15 -#define DDCMON_REG_VERSIZE 0x16 -#define DDCMON_REG_GAMMA 0x17 -#define DDCMON_REG_DPMS_FLAGS 0x18 -/* supported timings */ -#define DDCMON_REG_ESTABLISHED_TIMINGS 0x23 -#define DDCMON_REG_STANDARD_TIMINGS 0x26 -#define DDCMON_REG_TIMBASE 0x36 -#define DDCMON_REG_TIMINCR 18 -#define DDCMON_REG_TIMNUM 4 - -#define DDCMON_REG_CHECKSUM 0x7f - -/* Size of DDCMON in bytes */ -#define DDCMON_SIZE 128 - -/* Each client has this additional data */ -struct ddcmon_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 data[DDCMON_SIZE]; /* Register values */ -}; - - -static int ddcmon_attach_adapter(struct i2c_adapter *adapter); -static int ddcmon_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int ddcmon_detach_client(struct i2c_client *client); - -static void ddcmon_idcall(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_size(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_sync(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_maxclock(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_timings(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_serial(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_time(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_edid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_gamma(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_dpms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_standard_timing(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ddcmon_update_client(struct i2c_client *client); - - -/* This is the driver that will be inserted */ -static struct i2c_driver ddcmon_driver = { - .name = "DDCMON READER", - .id = I2C_DRIVERID_DDCMON, - .flags = I2C_DF_NOTIFY, - .attach_adapter = ddcmon_attach_adapter, - .detach_client = ddcmon_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define DDCMON_SYSCTL_ID 1010 -#define DDCMON_SYSCTL_SIZE 1011 -#define DDCMON_SYSCTL_SYNC 1012 -#define DDCMON_SYSCTL_TIMINGS 1013 -#define DDCMON_SYSCTL_SERIAL 1014 -#define DDCMON_SYSCTL_TIME 1015 -#define DDCMON_SYSCTL_EDID 1016 -#define DDCMON_SYSCTL_GAMMA 1017 -#define DDCMON_SYSCTL_DPMS 1018 -#define DDCMON_SYSCTL_TIMING1 1021 -#define DDCMON_SYSCTL_TIMING2 1022 -#define DDCMON_SYSCTL_TIMING3 1023 -#define DDCMON_SYSCTL_TIMING4 1024 -#define DDCMON_SYSCTL_TIMING5 1025 -#define DDCMON_SYSCTL_TIMING6 1026 -#define DDCMON_SYSCTL_TIMING7 1027 -#define DDCMON_SYSCTL_TIMING8 1028 -#define DDCMON_SYSCTL_MAXCLOCK 1029 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected DDCMON. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table ddcmon_dir_table_template[] = { - {DDCMON_SYSCTL_ID, "id", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &ddcmon_idcall}, - {DDCMON_SYSCTL_SIZE, "size", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &ddcmon_size}, - {DDCMON_SYSCTL_SYNC, "sync", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_sync}, - {DDCMON_SYSCTL_TIMINGS, "timings", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_timings}, - {DDCMON_SYSCTL_SERIAL, "serial", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_serial}, - {DDCMON_SYSCTL_TIME, "time", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_time}, - {DDCMON_SYSCTL_EDID, "edid", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_edid}, - {DDCMON_SYSCTL_GAMMA, "gamma", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_gamma}, - {DDCMON_SYSCTL_DPMS, "dpms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_dpms}, - {DDCMON_SYSCTL_TIMING1, "timing1", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_standard_timing}, - {DDCMON_SYSCTL_TIMING2, "timing2", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_standard_timing}, - {DDCMON_SYSCTL_TIMING3, "timing3", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_standard_timing}, - {DDCMON_SYSCTL_TIMING4, "timing4", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_standard_timing}, - {DDCMON_SYSCTL_TIMING5, "timing5", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_standard_timing}, - {DDCMON_SYSCTL_TIMING6, "timing6", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_standard_timing}, - {DDCMON_SYSCTL_TIMING7, "timing7", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_standard_timing}, - {DDCMON_SYSCTL_TIMING8, "timing8", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_standard_timing}, - {DDCMON_SYSCTL_MAXCLOCK, "maxclock", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ddcmon_maxclock}, - {0} -}; - -static int ddcmon_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, ddcmon_detect); -} - -/* This function is called by i2c_detect */ -int ddcmon_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i, cs; - struct i2c_client *new_client; - struct ddcmon_data *data; - int err = 0; - const char *type_name, *client_name; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access ddcmon_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct ddcmon_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - memset(data->data, 0xff, DDCMON_SIZE); - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &ddcmon_driver; - new_client->flags = 0; - - /* prevent 24RF08 corruption (just in case) */ - i2c_smbus_write_quick(new_client, 0); - - /* Now, we do the remaining detection. */ - if (checksum) { - int cs = 0; - for (i = 0; i < 0x80; i++) - cs += i2c_smbus_read_byte_data(new_client, i); - if ((cs & 0xff) != 0) - goto ERROR1; - } - - /* Verify the first 8 locations 0x00FFFFFFFFFFFF00 */ - /* Allow force and force_ddcmon arguments */ - if(kind < 0) - { - for(i = 0; i < 8; i++) { - cs = i2c_smbus_read_byte_data(new_client, i); - if(i == 0 || i == 7) { - if(cs != 0) - goto ERROR1; - } else if(cs != 0xff) - goto ERROR1; - } - } - - type_name = "ddcmon"; - client_name = "DDC Monitor"; - - /* Fill in the remaining client fields and put it in the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - ddcmon_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - return 0; - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int ddcmon_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct ddcmon_data *) (client->data))-> - sysctl_id); - if ((err = i2c_detach_client(client))) { - printk - ("ddcmon.o: Client deregistration failed, client not detached.\n"); - return err; - } - kfree(client->data); - return 0; -} - -static void ddcmon_update_client(struct i2c_client *client) -{ - struct ddcmon_data *data = client->data; - int i, j; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > 300 * HZ) || - (jiffies < data->last_updated) || !data->valid) { - if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_I2C_BLOCK)) - { - for (i=0; idata + i) - != I2C_SMBUS_I2C_BLOCK_MAX) { - printk(KERN_WARNING "ddcmon.o: block read fail at 0x%.2x!\n", i); - goto DONE; - } - } else { - if (i2c_smbus_write_byte(client, 0)) { - printk(KERN_WARNING "ddcmon.o: read start fail at 0!\n"); - goto DONE; - } - for (i = 0; i < DDCMON_SIZE; i++) { - j = i2c_smbus_read_byte(client); - if (j < 0) { - printk(KERN_WARNING "eeprom.o: read fail at 0x%.2x!\n", i); - goto DONE; - } - data->data[i] = (u8) j; - } - } - data->last_updated = jiffies; - data->valid = 1; - } -DONE: - up(&data->update_lock); -} - - -void ddcmon_idcall(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - results[0] = data->data[DDCMON_REG_MAN_ID + 1] | - (data->data[DDCMON_REG_MAN_ID] << 8); - results[1] = data->data[DDCMON_REG_PROD_ID + 1] | - (data->data[DDCMON_REG_PROD_ID] << 8); - *nrels_mag = 2; - } -} - -void ddcmon_size(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - results[0] = data->data[DDCMON_REG_VERSIZE]; - results[1] = data->data[DDCMON_REG_HORSIZE]; - *nrels_mag = 2; - } -} - -void ddcmon_sync(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - int i, j; - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - *nrels_mag = 4; - /* look for monitor limits entry */ - for(i = DDCMON_REG_TIMBASE; - i < DDCMON_REG_TIMBASE + - (DDCMON_REG_TIMNUM * DDCMON_REG_TIMINCR); - i += DDCMON_REG_TIMINCR) { - if (data->data[i] == 0x00 - && data->data[i + 1] == 0x00 - && data->data[i + 2] == 0x00 - && data->data[i + 3] == 0xfd) { - for(j = 0; j < 4; j++) - results[j] = data->data[i + j + 5]; - return; - } - } - for(j = 0; j < 4; j++) - results[j] = 0; - } -} - -void ddcmon_maxclock(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - int i; - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - *nrels_mag = 1; - /* look for monitor limits entry */ - for(i = DDCMON_REG_TIMBASE; - i < DDCMON_REG_TIMBASE + - (DDCMON_REG_TIMNUM * DDCMON_REG_TIMINCR); - i += DDCMON_REG_TIMINCR) { - if (data->data[i] == 0x00 - && data->data[i + 1] == 0x00 - && data->data[i + 2] == 0x00 - && data->data[i + 3] == 0xfd) { - results[0] = (data->data[i + 9] == 0xff ? - 0 : data->data[i + 9] * 10); - return; - } - } - results[0] = 0; - } -} - -void ddcmon_timings(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - results[0] = data->data[DDCMON_REG_ESTABLISHED_TIMINGS] | - (data->data[DDCMON_REG_ESTABLISHED_TIMINGS + 1] << 8) | - (data->data[DDCMON_REG_ESTABLISHED_TIMINGS + 2] << 16); - *nrels_mag = 1; - } -} - -void ddcmon_serial(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - results[0] = data->data[DDCMON_REG_SERIAL] | - (data->data[DDCMON_REG_SERIAL + 1] << 8) | - (data->data[DDCMON_REG_SERIAL + 2] << 16) | - (data->data[DDCMON_REG_SERIAL + 3] << 24); - *nrels_mag = 1; - } -} - -void ddcmon_time(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - results[0] = data->data[DDCMON_REG_YEAR] + 1990; - results[1] = data->data[DDCMON_REG_WEEK]; - *nrels_mag = 2; - } -} - -void ddcmon_edid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - results[0] = data->data[DDCMON_REG_EDID_VER]; - results[1] = data->data[DDCMON_REG_EDID_REV]; - *nrels_mag = 2; - } -} - -void ddcmon_gamma(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - results[0] = 100 + data->data[DDCMON_REG_GAMMA]; - *nrels_mag = 1; - } -} - -void ddcmon_dpms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ddcmon_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - results[0] = data->data[DDCMON_REG_DPMS_FLAGS]; - *nrels_mag = 1; - } -} - -void ddcmon_standard_timing(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ddcmon_data *data = client->data; - int nr = ctl_name - DDCMON_SYSCTL_TIMING1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ddcmon_update_client(client); - /* If both bytes of the timing are 0x00 or 0x01, then the timing - slot is unused. */ - if ((data->data[DDCMON_REG_STANDARD_TIMINGS + nr * 2] - | data->data[DDCMON_REG_STANDARD_TIMINGS + nr * 2 + 1]) & 0xfe) { - results[0] = (data->data[DDCMON_REG_STANDARD_TIMINGS + nr * 2] + 31) * 8; - switch (data->data[DDCMON_REG_STANDARD_TIMINGS + nr * 2 + 1] >> 6) { - /* We don't care about rounding issues there, it really - should be OK without it. */ - case 0x00: - results[1] = results[0]; /* unconfirmed */ - break; - case 0x01: - results[1] = results[0] * 3 / 4; - break; - case 0x02: - results[1] = results[0] * 4 / 5; - break; - case 0x03: - results[1] = results[0] * 9 / 16; - break; - } - results[2] = (data->data[DDCMON_REG_STANDARD_TIMINGS + nr * 2 + 1] & 0x3f) + 60; - } else { - results[0] = 0; - results[1] = 0; - results[2] = 0; - } - *nrels_mag = 3; - } -} - -static int __init sm_ddcmon_init(void) -{ - printk("ddcmon.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&ddcmon_driver); -} - -static void __exit sm_ddcmon_exit(void) -{ - i2c_del_driver(&ddcmon_driver); -} - - - -MODULE_AUTHOR("Frodo Looijaard , " - "Philip Edelbrock , " - "Mark Studebaker " - "and Jean Delvare "); -MODULE_DESCRIPTION("DDCMON driver"); - -module_init(sm_ddcmon_init); -module_exit(sm_ddcmon_exit); diff --git a/kernel/chips/ds1307.c b/kernel/chips/ds1307.c deleted file mode 100644 index 028e6ceb..00000000 --- a/kernel/chips/ds1307.c +++ /dev/null @@ -1,345 +0,0 @@ - -/* - * linux/drivers/i2c/ds1307.c - * - * Author: Abraham van der Merwe - * - * Linux support for the Dallas Semiconductor DS1307 Serial Real-Time - * Clock. - * - * Based on code from the lm-sensors project which is available - * at http://www.lm-sensors.org/ and Russell King's PCF8583 Real-Time - * Clock driver (linux/drivers/acorn/char/pcf8583.c). - * - * This source code is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "ds1307.h" - -#define BCD_TO_BIN(x) (((x) & 15) + ((x) >> 4) * 10) -#define BIN_TO_BCD(x) ((((x) / 10) << 4) + (x) % 10) - -static struct i2c_driver ds1307; -static DECLARE_MUTEX (mutex); - -/* - * The DS1307 Real-Time Clock wants the address in a different - * message, so we can't use the normal i2c_master_recv() routine - * for receiving data. - */ -static int ds1307_i2c_recv (struct i2c_client *client,char *buf,char addr,int count) -{ - struct i2c_msg msg[] = { - { addr: client->addr, flags: 0, len: 1, buf: &addr }, - { addr: client->addr, flags: I2C_M_RD, len: count, buf: buf } - }; - int result = 0; - - if (down_interruptible (&mutex)) - return (-ERESTARTSYS); - - if (i2c_transfer (client->adapter,msg,2) != 2) - result = -EIO; - - up (&mutex); - - return (result); -} - -/* - * Would've been nice to specify the address to this as well, but then we - * would need to copy the buffer twice - not worth it... - */ -static int ds1307_i2c_send (struct i2c_client *client,const char *buf,int count) -{ - int result = 0; - - if (down_interruptible (&mutex)) - return (-ERESTARTSYS); - - if (i2c_master_send (client,(const char *) buf,count) != count) - result = -EIO; - - up (&mutex); - - return (result); -} - -static int ds1307_attach (struct i2c_adapter *adapter,int addr,unsigned short flags,int kind) -{ - struct i2c_client *client; - int result; - - if ((client = (struct i2c_client *) kmalloc (sizeof (struct i2c_client),GFP_KERNEL)) == NULL) - return (-ENOMEM); - - strcpy (client->name,ds1307.name); - client->flags = I2C_CLIENT_ALLOW_USE | I2C_CLIENT_ALLOW_MULTIPLE_USE; - client->addr = addr; - client->adapter = adapter; - client->driver = &ds1307; - client->data = NULL; - - if ((result = i2c_attach_client (client))) { - kfree (client); - return (result); - } - - return (0); -} - -static int ds1307_attach_adapter (struct i2c_adapter *adapter) -{ - static unsigned short ignore[] = { I2C_CLIENT_END }; - static unsigned short addr[] = { 0x68, I2C_CLIENT_END }; - static struct i2c_client_address_data ds1307_addr_data = { - normal_i2c: addr, - normal_i2c_range: ignore, - probe: ignore, - probe_range: ignore, - ignore: ignore, - ignore_range: ignore, - force: ignore - }; - - return (i2c_probe (adapter,&ds1307_addr_data,ds1307_attach)); -} - -static int ds1307_detach_client (struct i2c_client *client) -{ - int result; - - if ((result = i2c_detach_client (client))) - return (result); - - kfree (client); - - return (0); -} - -static int ds1307_getdate (struct i2c_client *client,void *arg) -{ - struct ds1307_date *date = (struct ds1307_date *) arg; - u8 buf[7]; - - /* this also enables the oscillator */ - memset (buf,0,7); - - /* enable 24-hour mode */ - buf[2] = 0x40; - - if (ds1307_i2c_recv (client,(char *) buf,0,7) < 0) - return (-EIO); - - date->tm_sec = BCD_TO_BIN (buf[0] & ~0x80); - date->tm_min = BCD_TO_BIN (buf[1]); - date->tm_hour = BCD_TO_BIN (buf[2] & 0x3f); - date->tm_wday = BCD_TO_BIN (buf[3]) - 1; - date->tm_mday = BCD_TO_BIN (buf[4]); - date->tm_mon = BCD_TO_BIN (buf[5]) - 1; - date->tm_year = BCD_TO_BIN (buf[6]) + 100; - - return (0); -} - -static int ds1307_setdate (struct i2c_client *client,void *arg) -{ - struct ds1307_date *date = (struct ds1307_date *) arg; - u8 buf[8]; - - /* select address 0 */ - buf[0] = 0; - - buf[1] = BIN_TO_BCD (date->tm_sec); - buf[2] = BIN_TO_BCD (date->tm_min); - buf[3] = BIN_TO_BCD (date->tm_hour) | 0x40; - buf[4] = BIN_TO_BCD (date->tm_wday + 1); - buf[5] = BIN_TO_BCD (date->tm_mday); - buf[6] = BIN_TO_BCD (date->tm_mon + 1); - buf[7] = BIN_TO_BCD (date->tm_year - 100); - - return (ds1307_i2c_send (client,(const char *) buf,8)); -} - -static int ds1307_enable (struct i2c_client *client,void *arg) -{ - u8 buf[2]; - - if (ds1307_i2c_recv (client,(char *) buf + 1,0,1) < 0) - return (-EIO); - - if ((buf[1] & 0x80)) { - buf[0] = 0, buf[1] &= ~0x80; - return (ds1307_i2c_send (client,(const char *) buf,2)); - } - - return (0); -} - -static int ds1307_irqon (struct i2c_client *client,void *arg) -{ - u8 buf[2]; - - if (ds1307_i2c_recv (client,(char *) buf + 1,7,1) < 0) - return (-EIO); - - buf[0] = 7; - buf[1] |= 0x10; - - return (ds1307_i2c_send (client,(const char *) buf,2)); -} - -static int ds1307_irqoff (struct i2c_client *client,void *arg) -{ - u8 buf[2]; - - if (ds1307_i2c_recv (client,(char *) buf + 1,7,1) < 0) - return (-EIO); - - buf[0] = 7; - buf[1] &= ~0x10; - - return (ds1307_i2c_send (client,(const char *) buf,2)); -} - -static int ds1307_getfreq (struct i2c_client *client,void *arg) -{ - u16 *freq = (u16 *) arg; - u8 buf; - static const u16 table[] = { - DS1307_FREQ_1HZ, - DS1307_FREQ_4KHZ, - DS1307_FREQ_8KHZ, - DS1307_FREQ_32KHZ - }; - - if (ds1307_i2c_recv (client,(char *) &buf,7,1) < 0) - return (-EIO); - - *freq = table[buf & 3]; - - return (0); -} - -static int ds1307_setfreq (struct i2c_client *client,void *arg) -{ - u16 *freq = (u16 *) arg; - u8 buf[2]; - - /* select address 7 */ - buf[0] = 7; - - /* default to 1HZ */ - buf[1] = 0; - - switch (*freq) { - case DS1307_FREQ_32KHZ: buf[1]++; - case DS1307_FREQ_8KHZ: buf[1]++; - case DS1307_FREQ_4KHZ: buf[1]++; - case DS1307_FREQ_1HZ: break; - default: - return (-EINVAL); - } - - return (ds1307_i2c_send (client,(const char *) buf,2)); -} - -static int ds1307_read (struct i2c_client *client,void *arg) -{ - struct ds1307_memory *mem = (struct ds1307_memory *) arg; - u8 buf[DS1307_SIZE]; - - if (mem->offset >= DS1307_SIZE || mem->offset + mem->length > DS1307_SIZE) - return (-EINVAL); - - if (ds1307_i2c_recv (client,(char *) buf,mem->offset + 8,mem->length) < 0) - return (-EIO); - - memcpy (mem->buf,buf,mem->length); - - return (0); -} - -static int ds1307_write (struct i2c_client *client,void *arg) -{ - struct ds1307_memory *mem = (struct ds1307_memory *) arg; - u8 buf[DS1307_SIZE + 1]; - - if (mem->offset >= DS1307_SIZE || mem->offset + mem->length > DS1307_SIZE) - return (-EINVAL); - - buf[0] = mem->offset + 8; - - memcpy (buf + 1,mem->buf,mem->length); - - return (ds1307_i2c_send (client,(const char *) buf,mem->length + 1)); -} - -static int ds1307_command (struct i2c_client *client,unsigned int cmd,void *arg) -{ - static const struct { - int cmd; - int (*function) (struct i2c_client *,void *arg); - } ioctl[] = { - { DS1307_ENABLE, ds1307_enable }, - { DS1307_GET_DATE, ds1307_getdate }, - { DS1307_SET_DATE, ds1307_setdate }, - { DS1307_IRQ_ON, ds1307_irqon }, - { DS1307_IRQ_OFF, ds1307_irqoff }, - { DS1307_GET_FREQ, ds1307_getfreq }, - { DS1307_SET_FREQ, ds1307_setfreq }, - { DS1307_READ, ds1307_read }, - { DS1307_WRITE, ds1307_write } - }; - int i; - - for (i = 0; i < sizeof (ioctl) / sizeof (ioctl[0]); i++) - if (ioctl[i].cmd == cmd) - return (ioctl[i].function (client,arg)); - - return (-EINVAL); -} - - -static struct i2c_driver ds1307 = { - .name = "ds1307", - .id = I2C_DRIVERID_DS1307, - .flags = I2C_DF_NOTIFY, - .attach_adapter = ds1307_attach_adapter, - .detach_client = ds1307_detach_client, - .command = ds1307_command, -}; - -static int __init sm_ds1307_init(void) -{ - printk("ds1307.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&ds1307); -} - -static void __exit sm_ds1307_exit(void) -{ - i2c_del_driver(&ds1307); -} - - - -MODULE_AUTHOR ("Abraham van der Merwe "); -MODULE_DESCRIPTION ("Linux support for DS1307 Real-Time Clock"); - -MODULE_LICENSE ("GPL"); - -module_init(sm_ds1307_init); -module_exit(sm_ds1307_exit); - diff --git a/kernel/chips/ds1621.c b/kernel/chips/ds1621.c deleted file mode 100644 index 9586d044..00000000 --- a/kernel/chips/ds1621.c +++ /dev/null @@ -1,537 +0,0 @@ -/* - ds1621.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Christian W. Zuckschwerdt 2000-11-23 - based on lm75.c by Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* Supports DS1621. See doc/chips/ds1621 for details */ - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x48, 0x4f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(ds1621); - -/* Many DS1621 constants specified below */ - -/* Config register used for detection */ -/* 7 6 5 4 3 2 1 0 */ -/* |Done|THF |TLF |NVB | X | X |POL |1SHOT| */ -#define DS1621_REG_CONFIG_NVB 0x10 -#define DS1621_REG_CONFIG_POLARITY 0x02 -#define DS1621_REG_CONFIG_1SHOT 0x01 -#define DS1621_REG_CONFIG_DONE 0x80 - -/* Note: the done bit is always unset if continuous conversion is in progress. - We need to stop the continuous conversion or switch to single shot - before this bit becomes available! - */ - -/* The DS1621 registers */ -#define DS1621_REG_TEMP 0xAA /* word, RO */ -#define DS1621_REG_TEMP_OVER 0xA1 /* word, RW */ -#define DS1621_REG_TEMP_HYST 0xA2 /* word, RW -- it's a low temp trigger */ -#define DS1621_REG_CONF 0xAC /* byte, RW */ -#define DS1621_REG_TEMP_COUNTER 0xA8 /* byte, RO */ -#define DS1621_REG_TEMP_SLOPE 0xA9 /* byte, RO */ -#define DS1621_COM_START 0xEE /* no data */ -#define DS1621_COM_STOP 0x22 /* no data */ - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -#define TEMP_FROM_REG(val) ((((val & 0x7fff) >> 7) * 5) | \ - ((val & 0x8000)?-256:0)) -#define TEMP_TO_REG(val) (SENSORS_LIMIT((val<0 ? (0x200+((val)/5))<<7 : \ - (((val) + 2) / 5) << 7),0,0xffff)) -#define ALARMS_FROM_REG(val) ((val) & \ - (DS1621_ALARM_TEMP_HIGH | DS1621_ALARM_TEMP_LOW)) -#define ITEMP_FROM_REG(val) ((((val & 0x7fff) >> 8)) | \ - ((val & 0x8000)?-256:0)) - -/* Each client has this additional data */ -struct ds1621_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u16 temp, temp_over, temp_hyst; /* Register values, word */ - u8 conf; /* Register encoding, combined */ - - char enable; /* !=0 if we're expected to restart the conversion */ - u8 temp_int, temp_counter, temp_slope; /* Register values, byte */ -}; - -static int ds1621_attach_adapter(struct i2c_adapter *adapter); -static int ds1621_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void ds1621_init_client(struct i2c_client *client); -static int ds1621_detach_client(struct i2c_client *client); - -static int ds1621_read_value(struct i2c_client *client, u8 reg); -static int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value); -static void ds1621_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ds1621_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ds1621_enable(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ds1621_continuous(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ds1621_polarity(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ds1621_update_client(struct i2c_client *client); - - -/* This is the driver that will be inserted */ -static struct i2c_driver ds1621_driver = { - .name = "DS1621 sensor driver", - .id = I2C_DRIVERID_DS1621, - .flags = I2C_DF_NOTIFY, - .attach_adapter = ds1621_attach_adapter, - .detach_client = ds1621_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define DS1621_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ -#define DS1621_SYSCTL_ALARMS 2001 /* bitvector */ -#define DS1621_ALARM_TEMP_HIGH 0x40 -#define DS1621_ALARM_TEMP_LOW 0x20 -#define DS1621_SYSCTL_ENABLE 2002 -#define DS1621_SYSCTL_CONTINUOUS 2003 -#define DS1621_SYSCTL_POLARITY 2004 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected DS1621. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table ds1621_dir_table_template[] = { - {DS1621_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ds1621_temp}, - {DS1621_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ds1621_alarms}, - {DS1621_SYSCTL_ENABLE, "enable", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ds1621_enable}, - {DS1621_SYSCTL_CONTINUOUS, "continuous", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ds1621_continuous}, - {DS1621_SYSCTL_POLARITY, "polarity", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &ds1621_polarity}, - {0} -}; - -static int ds1621_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, ds1621_detect); -} - -/* This function is called by i2c_detect */ -static int ds1621_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i, conf, temp; - struct i2c_client *new_client; - struct ds1621_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("ds1621.o: ds1621_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_WRITE_BYTE)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access ds1621_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct ds1621_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &ds1621_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. It is lousy. */ - if (kind < 0) { - /* The NVB bit should be low if no EEPROM write has been - requested during the latest 10ms, which is highly - improbable in our case. */ - conf = i2c_smbus_read_byte_data(new_client, - DS1621_REG_CONF); - if (conf & DS1621_REG_CONFIG_NVB) - goto ERROR1; - /* The 7 lowest bits of a temperature should always be 0. */ - temp = ds1621_read_value(new_client, - DS1621_REG_TEMP); - if (temp & 0x007f) - goto ERROR1; - temp = ds1621_read_value(new_client, - DS1621_REG_TEMP_HYST); - if (temp & 0x007f) - goto ERROR1; - temp = ds1621_read_value(new_client, - DS1621_REG_TEMP_OVER); - if (temp & 0x007f) - goto ERROR1; - } - - /* Determine the chip type - only one kind supported! */ - if (kind <= 0) - kind = ds1621; - - if (kind == ds1621) { - type_name = "ds1621"; - client_name = "DS1621 chip"; - } else { -#ifdef DEBUG - printk("ds1621.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Fill in remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - ds1621_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - ds1621_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int ds1621_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct ds1621_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("ds1621.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -/* All registers are word-sized, except for the configuration register. - DS1621 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int ds1621_read_value(struct i2c_client *client, u8 reg) -{ - if ((reg == DS1621_REG_CONF) || (reg == DS1621_REG_TEMP_COUNTER) - || (reg == DS1621_REG_TEMP_SLOPE)) - return i2c_smbus_read_byte_data(client, reg); - else - return swab16(i2c_smbus_read_word_data(client, reg)); -} - -/* All registers are word-sized, except for the configuration register. - DS1621 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value) -{ - if ( (reg == DS1621_COM_START) || (reg == DS1621_COM_STOP) ) - return i2c_smbus_write_byte(client, reg); - else - if ((reg == DS1621_REG_CONF) || (reg == DS1621_REG_TEMP_COUNTER) - || (reg == DS1621_REG_TEMP_SLOPE)) - return i2c_smbus_write_byte_data(client, reg, value); - else - return i2c_smbus_write_word_data(client, reg, swab16(value)); -} - -static void ds1621_init_client(struct i2c_client *client) -{ - int reg; - - reg = ds1621_read_value(client, DS1621_REG_CONF); - /* start the continuous conversion */ - if(reg & 0x01) - ds1621_write_value(client, DS1621_REG_CONF, reg & 0xfe); -} - -static void ds1621_update_client(struct i2c_client *client) -{ - struct ds1621_data *data = client->data; - u8 new_conf; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting ds1621 update\n"); -#endif - - data->conf = ds1621_read_value(client, DS1621_REG_CONF); - - data->temp = ds1621_read_value(client, - DS1621_REG_TEMP); - data->temp_over = ds1621_read_value(client, - DS1621_REG_TEMP_OVER); - data->temp_hyst = ds1621_read_value(client, - DS1621_REG_TEMP_HYST); - - /* wait for the DONE bit before reading extended values */ - - if (data->conf & DS1621_REG_CONFIG_DONE) { - data->temp_counter = ds1621_read_value(client, - DS1621_REG_TEMP_COUNTER); - data->temp_slope = ds1621_read_value(client, - DS1621_REG_TEMP_SLOPE); - data->temp_int = ITEMP_FROM_REG(data->temp); - /* restart the conversion */ - if (data->enable) - ds1621_write_value(client, DS1621_COM_START, 0); - } - - /* reset alarms if necessary */ - new_conf = data->conf; - if (data->temp < data->temp_over) - new_conf &= ~DS1621_ALARM_TEMP_HIGH; - if (data->temp > data->temp_hyst) - new_conf &= ~DS1621_ALARM_TEMP_LOW; - if (data->conf != new_conf) - ds1621_write_value(client, DS1621_REG_CONF, - new_conf); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void ds1621_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct ds1621_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - if (!(data->conf & DS1621_REG_CONFIG_DONE) || - (data->temp_counter > data->temp_slope) || - (data->temp_slope == 0)) { - *nrels_mag = 1; - } else { - *nrels_mag = 2; - } - else if (operation == SENSORS_PROC_REAL_READ) { - ds1621_update_client(client); - /* decide wether to calculate more precise temp */ - if (!(data->conf & DS1621_REG_CONFIG_DONE) || - (data->temp_counter > data->temp_slope) || - (data->temp_slope == 0)) { - results[0] = TEMP_FROM_REG(data->temp_over); - results[1] = TEMP_FROM_REG(data->temp_hyst); - results[2] = TEMP_FROM_REG(data->temp); - } else { - results[0] = TEMP_FROM_REG(data->temp_over)*10; - results[1] = TEMP_FROM_REG(data->temp_hyst)*10; - results[2] = data->temp_int * 100 - 25 + - ((data->temp_slope - data->temp_counter) * - 100 / data->temp_slope); - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_over = TEMP_TO_REG(results[0]); - ds1621_write_value(client, DS1621_REG_TEMP_OVER, - data->temp_over); - } - if (*nrels_mag >= 2) { - data->temp_hyst = TEMP_TO_REG(results[1]); - ds1621_write_value(client, DS1621_REG_TEMP_HYST, - data->temp_hyst); - } - } -} - -void ds1621_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct ds1621_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ds1621_update_client(client); - results[0] = ALARMS_FROM_REG(data->conf); - *nrels_mag = 1; - } -} - -void ds1621_enable(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - /* If you really screw up your chip (like I did) this is */ - /* sometimes needed to (re)start the continuous conversion */ - /* there is no data to read so this might hang your SMBus! */ - - struct ds1621_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ds1621_update_client(client); - results[0] = !(data->conf & DS1621_REG_CONFIG_DONE); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (results[0]) { - ds1621_write_value(client, DS1621_COM_START, 0); - data->enable=1; - } else { - ds1621_write_value(client, DS1621_COM_STOP, 0); - data->enable=0; - } - } else { - ds1621_write_value(client, DS1621_COM_START, 0); - data->enable=1; - } - } -} - -void ds1621_continuous(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct ds1621_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ds1621_update_client(client); - results[0] = !(data->conf & DS1621_REG_CONFIG_1SHOT); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - ds1621_update_client(client); - if (*nrels_mag >= 1) { - if (results[0]) { - ds1621_write_value(client, DS1621_REG_CONF, - data->conf & ~DS1621_REG_CONFIG_1SHOT); - } else { - ds1621_write_value(client, DS1621_REG_CONF, - data->conf | DS1621_REG_CONFIG_1SHOT); - } - } else { - ds1621_write_value(client, DS1621_REG_CONF, - data->conf & ~DS1621_REG_CONFIG_1SHOT); - } - } -} - -void ds1621_polarity(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct ds1621_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ds1621_update_client(client); - results[0] = !(!(data->conf & DS1621_REG_CONFIG_POLARITY)); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - ds1621_update_client(client); - if (*nrels_mag >= 1) { - if (results[0]) { - ds1621_write_value(client, DS1621_REG_CONF, - data->conf | DS1621_REG_CONFIG_POLARITY); - } else { - ds1621_write_value(client, DS1621_REG_CONF, - data->conf & ~DS1621_REG_CONFIG_POLARITY); - } - } - } -} - -static int __init sm_ds1621_init(void) -{ - printk("ds1621.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&ds1621_driver); -} - -static void __exit sm_ds1621_exit(void) -{ - i2c_del_driver(&ds1621_driver); -} - - - -MODULE_AUTHOR("Christian W. Zuckschwerdt "); -MODULE_DESCRIPTION("DS1621 driver"); - -module_init(sm_ds1621_init); -module_exit(sm_ds1621_exit); diff --git a/kernel/chips/eeprom.c b/kernel/chips/eeprom.c deleted file mode 100644 index 15f00940..00000000 --- a/kernel/chips/eeprom.c +++ /dev/null @@ -1,370 +0,0 @@ -/* - eeprom.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard and - Philip Edelbrock - - 2003-08-18 Jean Delvare - Divide the eeprom in 2-row (arbitrary) slices. This significantly - speeds sensors up, as well as various scripts using the eeprom - module. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include /* for capable() */ -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x50, 0x57, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(eeprom); - - -/* possible natures */ -#define NATURE_UNKNOWN 0 -#define NATURE_VAIO 1 - -/* Size of EEPROM in bytes */ -#define EEPROM_SIZE 256 - -/* Each client has this additional data */ -struct eeprom_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - u8 valid; /* bitfield, bit!=0 if slice is valid */ - unsigned long last_updated[8]; /* In jiffies, 8 slices */ - - u8 data[EEPROM_SIZE]; /* Register values */ - u8 nature; -}; - - -static int eeprom_attach_adapter(struct i2c_adapter *adapter); -static int eeprom_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int eeprom_detach_client(struct i2c_client *client); - -#if 0 -static int eeprom_write_value(struct i2c_client *client, u8 reg, - u8 value); -#endif - -static void eeprom_contents(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void eeprom_update_client(struct i2c_client *client, u8 slice); - - -/* This is the driver that will be inserted */ -static struct i2c_driver eeprom_driver = { - .name = "EEPROM READER", - .id = I2C_DRIVERID_EEPROM, - .flags = I2C_DF_NOTIFY, - .attach_adapter = eeprom_attach_adapter, - .detach_client = eeprom_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define EEPROM_SYSCTL1 1000 -#define EEPROM_SYSCTL2 1001 -#define EEPROM_SYSCTL3 1002 -#define EEPROM_SYSCTL4 1003 -#define EEPROM_SYSCTL5 1004 -#define EEPROM_SYSCTL6 1005 -#define EEPROM_SYSCTL7 1006 -#define EEPROM_SYSCTL8 1007 -#define EEPROM_SYSCTL9 1008 -#define EEPROM_SYSCTL10 1009 -#define EEPROM_SYSCTL11 1010 -#define EEPROM_SYSCTL12 1011 -#define EEPROM_SYSCTL13 1012 -#define EEPROM_SYSCTL14 1013 -#define EEPROM_SYSCTL15 1014 -#define EEPROM_SYSCTL16 1015 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected EEPROM. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table eeprom_dir_table_template[] = { - {EEPROM_SYSCTL1, "00", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL2, "10", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL3, "20", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL4, "30", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL5, "40", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL6, "50", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL7, "60", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL8, "70", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL9, "80", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL10, "90", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL11, "a0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL12, "b0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL13, "c0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL14, "d0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL15, "e0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {EEPROM_SYSCTL16, "f0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &eeprom_contents}, - {0} -}; - -static int eeprom_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, eeprom_detect); -} - -/* This function is called by i2c_detect */ -static int eeprom_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct eeprom_data *data; - int err = 0; - const char *type_name; - - /* There are three ways we can read the EEPROM data: - (1) I2C block reads (faster, but unsupported by most adapters) - (2) Consecutive byte reads (100% overhead) - (3) Regular byte data reads (200% overhead) - The third method is not implemented by this driver because all - known adapters support at least the second. */ - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA - | I2C_FUNC_SMBUS_BYTE)) - goto ERROR0; - - if (!(data = kmalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - memset(data->data, 0xff, EEPROM_SIZE); - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &eeprom_driver; - new_client->flags = 0; - - /* prevent 24RF08 corruption */ - i2c_smbus_write_quick(new_client, 0); - - type_name = "eeprom"; - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, "EEPROM chip"); - data->valid = 0; - init_MUTEX(&data->update_lock); - data->nature = NATURE_UNKNOWN; - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Detect the Vaio nature of EEPROMs. - We use the "PCG-" prefix as the signature. */ - if (address == 0x57) { - if (i2c_smbus_read_byte_data(new_client, 0x80) == 'P' - && i2c_smbus_read_byte(new_client) == 'C' - && i2c_smbus_read_byte(new_client) == 'G' - && i2c_smbus_read_byte(new_client) == '-') { - printk(KERN_INFO "Vaio EEPROM detected, " - "enabling password protection\n"); - data->nature = NATURE_VAIO; - } - } - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - eeprom_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - return 0; - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - kfree(data); - ERROR0: - return err; -} - -static int eeprom_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct eeprom_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("eeprom.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -#if 0 -/* No writes yet (PAE) */ -static int eeprom_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} -#endif - -static void eeprom_update_client(struct i2c_client *client, u8 slice) -{ - struct eeprom_data *data = client->data; - int i, j; - - down(&data->update_lock); - - if (!(data->valid & (1 << slice)) - || (jiffies - data->last_updated[slice] > 300 * HZ) - || (jiffies < data->last_updated[slice])) { - -#ifdef DEBUG - printk(KERN_DEBUG "eeprom.o: Starting update, slice %u\n", slice); -#endif - - if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_I2C_BLOCK)) - { - for (i = slice << 5; i < (slice + 1) << 5; - i += I2C_SMBUS_I2C_BLOCK_MAX) - if (i2c_smbus_read_i2c_block_data(client, - i, data->data + i) - != I2C_SMBUS_I2C_BLOCK_MAX) { - printk(KERN_WARNING "eeprom.o: block read fail at 0x%.2x!\n", i); - goto DONE; - } - } else { - if (i2c_smbus_write_byte(client, slice << 5)) { - printk(KERN_WARNING "eeprom.o: read start fail at 0x%.2x!\n", slice << 5); - goto DONE; - } - for (i = slice << 5; i < (slice + 1) << 5; i++) { - j = i2c_smbus_read_byte(client); - if (j < 0) { - printk(KERN_WARNING "eeprom.o: read fail at 0x%.2x!\n", i); - goto DONE; - } - data->data[i] = (u8) j; - } - } - data->last_updated[slice] = jiffies; - data->valid |= (1 << slice); - } -DONE: - up(&data->update_lock); -} - - -void eeprom_contents(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - int i; - int nr = ctl_name - EEPROM_SYSCTL1; - struct eeprom_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - eeprom_update_client(client, nr >> 1); - /* Hide Vaio security settings to regular users */ - if (nr == 0 && data->nature == NATURE_VAIO - && !capable(CAP_SYS_ADMIN)) - for (i = 0; i < 16; i++) - results[i] = 0; - else - for (i = 0; i < 16; i++) - results[i] = data->data[i + nr * 16]; -#ifdef DEBUG - printk(KERN_DEBUG "eeprom.o: 0x%X EEPROM contents (row %d):", - client->addr, nr + 1); - if (nr == 0 && data->nature == NATURE_VAIO) - printk(" \n"); - else { - for (i = 0; i < 16; i++) - printk(" 0x%02X", data->data[i + nr * 16]); - printk("\n"); - } -#endif - *nrels_mag = 16; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - -/* No writes to the EEPROM (yet, anyway) (PAE) */ - printk("eeprom.o: No writes to EEPROMs supported!\n"); - } -} - -static int __init sm_eeprom_init(void) -{ - printk("eeprom.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&eeprom_driver); -} - -static void __exit sm_eeprom_exit(void) -{ - i2c_del_driver(&eeprom_driver); -} - - - -MODULE_AUTHOR - ("Frodo Looijaard and Philip Edelbrock "); -MODULE_DESCRIPTION("EEPROM driver"); - -module_init(sm_eeprom_init); -module_exit(sm_eeprom_exit); diff --git a/kernel/chips/f71805f.c b/kernel/chips/f71805f.c deleted file mode 100644 index 39f8694c..00000000 --- a/kernel/chips/f71805f.c +++ /dev/null @@ -1,757 +0,0 @@ -/* - * f71805f.c - driver for the Fintek F71805F Super-I/O chip integrated - * hardware monitoring features - * Copyright (C) 2005 Jean Delvare - * - * The F71805F is a LPC Super-I/O chip made by Fintek. It integrates - * complete hardware monitoring features: voltage, fan and temperature - * sensors, and manual and automatic fan speed control. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" - -/* ISA address is read from Super-I/O configuration space */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -SENSORS_INSMOD_1(f71805f); - -#define DRVNAME "f71805f" - -/* - * Super-I/O constants and functions - */ - -#define F71805F_LD_HWM 0x04 - -#define SIO_REG_LDSEL 0x07 /* Logical device select */ -#define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */ -#define SIO_REG_DEVREV 0x22 /* Device revision */ -#define SIO_REG_MANID 0x23 /* Fintek ID (2 bytes) */ -#define SIO_REG_ENABLE 0x30 /* Logical device enable */ -#define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ - -#define SIO_FINTEK_ID 0x1934 -#define SIO_F71805F_ID 0x0406 - -static inline int -superio_inb(int base, int reg) -{ - outb(reg, base); - return inb(base + 1); -} - -static int -superio_inw(int base, int reg) -{ - int val; - outb(reg++, base); - val = inb(base + 1) << 8; - outb(reg, base); - val |= inb(base + 1); - return val; -} - -static inline void -superio_select(int base, int ld) -{ - outb(SIO_REG_LDSEL, base); - outb(ld, base + 1); -} - -static inline void -superio_enter(int base) -{ - outb(0x87, base); - outb(0x87, base); -} - -static inline void -superio_exit(int base) -{ - outb(0xaa, base); -} - -/* - * ISA constants - */ - -#define REGION_LENGTH 8 -#define ADDR_REG_OFFSET 5 -#define DATA_REG_OFFSET 6 - -/* - * Registers - */ - -/* in nr from 0 to 8 (8-bit values) */ -#define F71805F_REG_IN(nr) (0x10 + (nr)) -#define F71805F_REG_IN_HIGH(nr) (0x40 + 2 * (nr)) -#define F71805F_REG_IN_LOW(nr) (0x41 + 2 * (nr)) -/* fan nr from 0 to 2 (12-bit values, two registers) */ -#define F71805F_REG_FAN(nr) (0x20 + 2 * (nr)) -#define F71805F_REG_FAN_LOW(nr) (0x28 + 2 * (nr)) -#define F71805F_REG_FAN_CTRL(nr) (0x60 + 16 * (nr)) -/* temp nr from 0 to 2 (8-bit values) */ -#define F71805F_REG_TEMP(nr) (0x1B + (nr)) -#define F71805F_REG_TEMP_HIGH(nr) (0x54 + 2 * (nr)) -#define F71805F_REG_TEMP_HYST(nr) (0x55 + 2 * (nr)) -#define F71805F_REG_TEMP_MODE 0x01 - -#define F71805F_REG_START 0x00 -/* status nr from 0 to 2 */ -#define F71805F_REG_STATUS(nr) (0x36 + (nr)) - -/* - * Data structures and manipulation thereof - */ - -struct f71805f_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long last_limits; /* In jiffies */ - - /* Register values */ - u8 in[9]; - u8 in_high[9]; - u8 in_low[9]; - u16 fan[3]; - u16 fan_low[3]; - u8 fan_enabled; /* Read once at init time */ - u8 temp[3]; - u8 temp_high[3]; - u8 temp_hyst[3]; - u8 temp_mode; - u8 alarms[3]; -}; - -static inline long in_from_reg(u8 reg) -{ - return (reg * 8); -} - -/* The 2 least significant bits are not used */ -static inline u8 in_to_reg(long val) -{ - if (val <= 0) - return 0; - if (val >= 2016) - return 0xfc; - return (((val + 16) / 32) << 2); -} - -/* in0 is downscaled by a factor 2 internally */ -static inline long in0_from_reg(u8 reg) -{ - return (reg * 16); -} - -static inline u8 in0_to_reg(long val) -{ - if (val <= 0) - return 0; - if (val >= 4032) - return 0xfc; - return (((val + 32) / 64) << 2); -} - -/* The 4 most significant bits are not used */ -static inline long fan_from_reg(u16 reg) -{ - reg &= 0xfff; - if (!reg || reg == 0xfff) - return 0; - return (1500000 / reg); -} - -static inline u16 fan_to_reg(long rpm) -{ - /* If the low limit is set below what the chip can measure, - store the largest possible 12-bit value in the registers, - so that no alarm will ever trigger. */ - if (rpm < 367) - return 0xfff; - return (1500000 / rpm); -} - -static inline u8 temp_to_reg(long val) -{ - if (val < 0) - val = 0; - else if (val > 0xff) - val = 0xff; - return val; -} - -/* - * Driver and client management - */ - -static u8 f71805f_read8(struct i2c_client *client, u8 reg) -{ - struct f71805f_data *data = client->data; - u8 val; - - down(&data->lock); - outb_p(reg, client->addr + ADDR_REG_OFFSET); - val = inb_p(client->addr + DATA_REG_OFFSET); - up(&data->lock); - - return val; -} - -static void f71805f_write8(struct i2c_client *client, u8 reg, u8 val) -{ - struct f71805f_data *data = client->data; - - down(&data->lock); - outb_p(reg, client->addr + ADDR_REG_OFFSET); - outb_p(val, client->addr + DATA_REG_OFFSET); - up(&data->lock); -} - -/* It is important to read the MSB first, because doing so latches the - value of the LSB, so we are sure both bytes belong to the same value. */ -static u16 f71805f_read16(struct i2c_client *client, u8 reg) -{ - struct f71805f_data *data = client->data; - u16 val; - - down(&data->lock); - outb_p(reg, client->addr + ADDR_REG_OFFSET); - val = inb_p(client->addr + DATA_REG_OFFSET) << 8; - outb_p(++reg, client->addr + ADDR_REG_OFFSET); - val |= inb_p(client->addr + DATA_REG_OFFSET); - up(&data->lock); - - return val; -} - -static void f71805f_write16(struct i2c_client *client, u8 reg, u16 val) -{ - struct f71805f_data *data = client->data; - - down(&data->lock); - outb_p(reg, client->addr + ADDR_REG_OFFSET); - outb_p(val >> 8, client->addr + DATA_REG_OFFSET); - outb_p(++reg, client->addr + ADDR_REG_OFFSET); - outb_p(val & 0xff, client->addr + DATA_REG_OFFSET); - up(&data->lock); -} - -static struct i2c_driver f71805f_driver; -static ctl_table f71805f_dir_table_template[]; - -static void f71805f_init_client(struct i2c_client *client) -{ - struct f71805f_data *data = client->data; - u8 reg; - int i; - - reg = f71805f_read8(client, F71805F_REG_START); - if ((reg & 0x41) != 0x01) { - printk(KERN_DEBUG DRVNAME ": Starting monitoring " - "operations\n"); - f71805f_write8(client, - F71805F_REG_START, (reg | 0x01) & ~0x40); - } - - /* Fan monitoring can be disabled. If it is, we won't be polling - the register values, and instead set the cache to return 0 RPM. */ - for (i = 0; i < 3; i++) { - reg = f71805f_read8(client, F71805F_REG_FAN_CTRL(i)); - if (!(reg & 0x80)) - data->fan_enabled |= (1 << i); - else - data->fan[i] = data->fan_low[i] = 0xfff; - } -} - -static int f71805f_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - struct i2c_client *client; - struct f71805f_data *data; - int err; - - if (!request_region(address, REGION_LENGTH, f71805f_driver.name)) { - err = -EBUSY; - goto exit; - } - - if (!(data = kmalloc(sizeof(struct f71805f_data), GFP_KERNEL))) { - err = -ENOMEM; - goto exit_release; - } - memset(data, 0, sizeof(struct f71805f_data)); - - /* Fill in the client fields */ - client = &data->client; - client->addr = address; - client->data = data; - client->adapter = adapter; - client->driver = &f71805f_driver; - strcpy(client->name, "F71805F chip"); - - init_MUTEX(&data->lock); - init_MUTEX(&data->update_lock); - - /* Tell the i2c core a new client has arrived */ - if ((err = i2c_attach_client(client))) - goto exit_free; - - /* Initialize the F71805F chip */ - f71805f_init_client(client); - - /* Register a new directory entry in /proc */ - err = i2c_register_entry(client, "f71805f", - f71805f_dir_table_template, THIS_MODULE); - if (err < 0) - goto exit_detach; - data->sysctl_id = err; - - return 0; - -exit_detach: - i2c_detach_client(client); -exit_free: - kfree(data); -exit_release: - release_region(address, REGION_LENGTH); -exit: - return err; -} - -static int f71805f_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, f71805f_detect); -} - -static int f71805f_detach_client(struct i2c_client *client) -{ - int err; - struct f71805f_data *data = client->data; - - i2c_deregister_entry(data->sysctl_id); - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR DRVNAME ": Client deregistration failed, " - "client not detached\n"); - return err; - } - - release_region(client->addr, REGION_LENGTH); - kfree(client->data); - - return 0; -} - -static void f71805f_update_client(struct i2c_client *client) -{ - struct f71805f_data *data = client->data; - int nr; - - down(&data->update_lock); - - /* Limit registers cache is refreshed after 60 seconds */ - if ((jiffies - data->last_limits > 60 * HZ) - || (jiffies < data->last_limits) - || !data->valid) { - for (nr = 0; nr < 9; nr++) { - data->in_high[nr] = f71805f_read8(client, - F71805F_REG_IN_HIGH(nr)); - data->in_low[nr] = f71805f_read8(client, - F71805F_REG_IN_LOW(nr)); - } - for (nr = 0; nr < 3; nr++) { - if (data->fan_enabled & (1 << nr)) - data->fan_low[nr] = f71805f_read16(client, - F71805F_REG_FAN_LOW(nr)); - } - for (nr = 0; nr < 3; nr++) { - data->temp_high[nr] = f71805f_read8(client, - F71805F_REG_TEMP_HIGH(nr)); - data->temp_hyst[nr] = f71805f_read8(client, - F71805F_REG_TEMP_HYST(nr)); - } - data->temp_mode = f71805f_read8(client, F71805F_REG_TEMP_MODE); - - data->last_limits = jiffies; - } - - /* Measurement registers cache is refreshed after 1 second */ - if ((jiffies - data->last_updated > HZ) - || (jiffies < data->last_updated) - || !data->valid) { - for (nr = 0; nr < 9; nr++) { - data->in[nr] = f71805f_read8(client, - F71805F_REG_IN(nr)); - } - for (nr = 0; nr < 3; nr++) { - if (data->fan_enabled & (1 << nr)) - data->fan[nr] = f71805f_read16(client, - F71805F_REG_FAN(nr)); - } - for (nr = 0; nr < 3; nr++) { - data->temp[nr] = f71805f_read8(client, - F71805F_REG_TEMP(nr)); - } - for (nr = 0; nr < 3; nr++) { - data->alarms[nr] = f71805f_read8(client, - F71805F_REG_STATUS(nr)); - } - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -/* -- SENSORS SYSCTL START -- */ -#define F71805F_SYSCTL_IN0 1000 -#define F71805F_SYSCTL_IN1 1001 -#define F71805F_SYSCTL_IN2 1002 -#define F71805F_SYSCTL_IN3 1003 -#define F71805F_SYSCTL_IN4 1004 -#define F71805F_SYSCTL_IN5 1005 -#define F71805F_SYSCTL_IN6 1006 -#define F71805F_SYSCTL_IN7 1007 -#define F71805F_SYSCTL_IN8 1008 -#define F71805F_SYSCTL_FAN1 1101 -#define F71805F_SYSCTL_FAN2 1102 -#define F71805F_SYSCTL_FAN3 1103 -#define F71805F_SYSCTL_TEMP1 1201 -#define F71805F_SYSCTL_TEMP2 1202 -#define F71805F_SYSCTL_TEMP3 1203 -#define F71805F_SYSCTL_SENSOR1 1211 -#define F71805F_SYSCTL_SENSOR2 1212 -#define F71805F_SYSCTL_SENSOR3 1213 -#define F71805F_SYSCTL_ALARMS_IN 1090 -#define F71805F_SYSCTL_ALARMS_FAN 1190 -#define F71805F_SYSCTL_ALARMS_TEMP 1290 -/* -- SENSORS SYSCTL END -- */ - -static void f71805f_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct f71805f_data *data = client->data; - int nr = ctl_name - F71805F_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - f71805f_update_client(client); - results[0] = in_from_reg(data->in_low[nr]); - results[1] = in_from_reg(data->in_high[nr]); - results[2] = in_from_reg(data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag < 1) - return; - - down(&data->update_lock); - data->in_low[nr] = in_to_reg(results[0]); - f71805f_write8(client, F71805F_REG_IN_LOW(nr), - data->in_low[nr]); - - if (*nrels_mag >= 2) { - data->in_high[nr] = in_to_reg(results[1]); - f71805f_write8(client, F71805F_REG_IN_HIGH(nr), - data->in_high[nr]); - } - up(&data->update_lock); - } -} - -static void f71805f_in0(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct f71805f_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - f71805f_update_client(client); - results[0] = in0_from_reg(data->in_low[0]); - results[1] = in0_from_reg(data->in_high[0]); - results[2] = in0_from_reg(data->in[0]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag < 1) - return; - - down(&data->update_lock); - data->in_low[0] = in0_to_reg(results[0]); - f71805f_write8(client, F71805F_REG_IN_LOW(0), - data->in_low[0]); - - if (*nrels_mag >= 2) { - data->in_high[0] = in0_to_reg(results[1]); - f71805f_write8(client, F71805F_REG_IN_HIGH(0), - data->in_high[0]); - } - up(&data->update_lock); - } -} - -static void f71805f_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct f71805f_data *data = client->data; - int nr = ctl_name - F71805F_SYSCTL_FAN1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - f71805f_update_client(client); - results[0] = fan_from_reg(data->fan_low[nr]); - results[1] = fan_from_reg(data->fan[nr]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag < 1) - return; - - down(&data->update_lock); - data->fan_low[nr] = fan_to_reg(results[0]); - f71805f_write16(client, F71805F_REG_FAN_LOW(nr), - data->fan_low[nr]); - up(&data->update_lock); - } -} - -static void f71805f_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct f71805f_data *data = client->data; - int nr = ctl_name - F71805F_SYSCTL_TEMP1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - f71805f_update_client(client); - results[0] = data->temp_high[nr]; - results[1] = data->temp_hyst[nr]; - results[2] = data->temp[nr]; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag < 1) - return; - - down(&data->update_lock); - data->temp_high[nr] = temp_to_reg(results[0]); - f71805f_write8(client, F71805F_REG_TEMP_HIGH(nr), - data->temp_high[nr]); - - if (*nrels_mag >= 2) { - data->temp_hyst[nr] = temp_to_reg(results[1]); - f71805f_write8(client, F71805F_REG_TEMP_HYST(nr), - data->temp_hyst[nr]); - } - up(&data->update_lock); - } -} - -static void f71805f_sensor(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct f71805f_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - int nr = ctl_name - F71805F_SYSCTL_SENSOR1; - - f71805f_update_client(client); - results[0] = (data->temp_mode & (1 << nr)) ? 3 : 4; - *nrels_mag = 1; - } -} - -static void f71805f_alarms_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct f71805f_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - f71805f_update_client(client); - results[0] = data->alarms[0] - | ((data->alarms[1] & 0x01) << 8); - *nrels_mag = 1; - } -} - -static void f71805f_alarms_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct f71805f_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - f71805f_update_client(client); - results[0] = data->alarms[2] & 0x07; - *nrels_mag = 1; - } -} - -static void f71805f_alarms_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct f71805f_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - f71805f_update_client(client); - results[0] = (data->alarms[1] >> 3) & 0x07; - *nrels_mag = 1; - } -} - -static ctl_table f71805f_dir_table_template[] = { - { F71805F_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_in0 }, - { F71805F_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_in }, - { F71805F_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_in }, - { F71805F_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_in }, - { F71805F_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_in }, - { F71805F_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_in }, - { F71805F_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_in }, - { F71805F_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_in }, - { F71805F_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_in }, - { F71805F_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_fan }, - { F71805F_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_fan }, - { F71805F_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_fan }, - { F71805F_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_temp }, - { F71805F_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_temp }, - { F71805F_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_temp }, - { F71805F_SYSCTL_SENSOR1, "sensor1", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_sensor }, - { F71805F_SYSCTL_SENSOR2, "sensor2", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_sensor }, - { F71805F_SYSCTL_SENSOR3, "sensor3", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_sensor }, - { F71805F_SYSCTL_ALARMS_IN, "alarms_in", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_alarms_in }, - { F71805F_SYSCTL_ALARMS_FAN, "alarms_fan", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_alarms_fan }, - { F71805F_SYSCTL_ALARMS_TEMP, "alarms_temp", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &f71805f_alarms_temp }, - { 0 } -}; - -static struct i2c_driver f71805f_driver = { - .name = "F71805F sensor driver", - .flags = I2C_DF_NOTIFY, - .attach_adapter = f71805f_attach_adapter, - .detach_client = f71805f_detach_client, -}; - -static int __init f71805f_find(int sioaddr, unsigned int *address) -{ - int err = -ENODEV; - u16 devid; - - superio_enter(sioaddr); - - devid = superio_inw(sioaddr, SIO_REG_MANID); - if (devid != SIO_FINTEK_ID) - goto exit; - - devid = superio_inw(sioaddr, SIO_REG_DEVID); - if (devid != SIO_F71805F_ID) { - printk(KERN_INFO DRVNAME ": Unsupported Fintek device, " - "skipping\n"); - goto exit; - } - - superio_select(sioaddr, F71805F_LD_HWM); - if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) { - printk(KERN_WARNING DRVNAME ": Device not activated, " - "skipping\n"); - goto exit; - } - - *address = superio_inw(sioaddr, SIO_REG_ADDR); - if (*address == 0) { - printk(KERN_WARNING DRVNAME ": Base address not set, " - "skipping\n"); - goto exit; - } - *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ - - err = 0; - printk(KERN_INFO DRVNAME ": Found F71805F chip at %#x, revision %u\n", - *address, superio_inb(sioaddr, SIO_REG_DEVREV)); - -exit: - superio_exit(sioaddr); - return err; -} - -static int __init f71805f_init(void) -{ - printk("%s: Driver version %s (%s)\n", DRVNAME, LM_VERSION, LM_DATE); - - if (f71805f_find(0x2e, &normal_isa[0]) - && f71805f_find(0x4e, &normal_isa[0])) - return -ENODEV; - - return i2c_add_driver(&f71805f_driver); -} - -static void __exit f71805f_exit(void) -{ - i2c_del_driver(&f71805f_driver); -} - -MODULE_AUTHOR("Jean Delvare "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("F71805F hardware monitoring driver"); - -module_init(f71805f_init); -module_exit(f71805f_exit); diff --git a/kernel/chips/fscher.c b/kernel/chips/fscher.c deleted file mode 100644 index 8fd77ada..00000000 --- a/kernel/chips/fscher.c +++ /dev/null @@ -1,729 +0,0 @@ -/* - fscher.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (C) 2003, 2004 Reinhard Nissl - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - fujitsu siemens hermes chip, - module based on fscpos.c - Copyright (C) 2000 Hermann Jung - Copyright (C) 1998, 1999 Frodo Looijaard - and Philip Edelbrock -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -#ifndef I2C_DRIVERID_FSCHER -#define I2C_DRIVERID_FSCHER 1046 -#endif - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x73, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(fscher); - -/* The FSCHER registers */ - -/* chip identification */ -#define FSCHER_REG_IDENT_0 0x00 -#define FSCHER_REG_IDENT_1 0x01 -#define FSCHER_REG_IDENT_2 0x02 -#define FSCHER_REG_REVISION 0x03 - -/* global control and status */ -#define FSCHER_REG_EVENT_STATE 0x04 -#define FSCHER_REG_CONTROL 0x05 - -/* watchdog */ -#define FSCHER_REG_WDOG_PRESET 0x28 -#define FSCHER_REG_WDOG_STATE 0x23 -#define FSCHER_REG_WDOG_CONTROL 0x21 - -/* fan 0 */ -#define FSCHER_REG_FAN0_MIN 0x55 -#define FSCHER_REG_FAN0_ACT 0x0e -#define FSCHER_REG_FAN0_STATE 0x0d -#define FSCHER_REG_FAN0_RIPPLE 0x0f - -/* fan 1 */ -#define FSCHER_REG_FAN1_MIN 0x65 -#define FSCHER_REG_FAN1_ACT 0x6b -#define FSCHER_REG_FAN1_STATE 0x62 -#define FSCHER_REG_FAN1_RIPPLE 0x6f - -/* fan 2 */ -#define FSCHER_REG_FAN2_MIN 0xb5 -#define FSCHER_REG_FAN2_ACT 0xbb -#define FSCHER_REG_FAN2_STATE 0xb2 -#define FSCHER_REG_FAN2_RIPPLE 0xbf - -/* voltage supervision */ -#define FSCHER_REG_VOLT_12 0x45 -#define FSCHER_REG_VOLT_5 0x42 -#define FSCHER_REG_VOLT_BATT 0x48 - -/* temperatures */ -/* sensor 0 */ -#define FSCHER_REG_TEMP0_ACT 0x64 -#define FSCHER_REG_TEMP0_STATE 0x71 - -/* sensor 1 */ -#define FSCHER_REG_TEMP1_ACT 0x32 -#define FSCHER_REG_TEMP1_STATE 0x81 - -/* sensor 2 */ -#define FSCHER_REG_TEMP2_ACT 0x35 -#define FSCHER_REG_TEMP2_STATE 0x91 - - - -/* Initial limits */ - -/* For each registered FSCHER, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new fscher client is - allocated. */ -struct fscher_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 revision; /* revision of chip */ - u8 global_event; /* global event status */ - u8 global_control; /* global control register */ - u8 watchdog[3]; /* watchdog */ - u8 volt[3]; /* 12, 5, battery current */ - u8 temp_act[3]; /* temperature */ - u8 temp_status[3]; /* status of sensor */ - u8 fan_act[3]; /* fans revolutions per second */ - u8 fan_status[3]; /* fan status */ - u8 fan_min[3]; /* fan min value for rps */ - u8 fan_ripple[3]; /* divider for rps */ -}; - - -static int fscher_attach_adapter(struct i2c_adapter *adapter); -static int fscher_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int fscher_detach_client(struct i2c_client *client); - -static int fscher_read_value(struct i2c_client *client, u8 register); -static int fscher_write_value(struct i2c_client *client, u8 register, - u8 value); -static void fscher_update_client(struct i2c_client *client); -static void fscher_init_client(struct i2c_client *client); - - -static void fscher_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void fscher_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscher_pwm_internal(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results, - int nr, int reg_min); -static void fscher_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscher_fan_internal(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results, - int nr, int reg_state, int res_ripple); -static void fscher_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscher_volt(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscher_wdog(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver fscher_driver = { - .name = "FSCHER sensor driver", - .id = I2C_DRIVERID_FSCHER, - .flags = I2C_DF_NOTIFY, - .attach_adapter = fscher_attach_adapter, - .detach_client = fscher_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define FSCHER_SYSCTL_VOLT0 1000 /* 12 volt supply */ -#define FSCHER_SYSCTL_VOLT1 1001 /* 5 volt supply */ -#define FSCHER_SYSCTL_VOLT2 1002 /* batterie voltage */ -#define FSCHER_SYSCTL_FAN0 1101 /* state, ripple, actual value - fan 0 */ -#define FSCHER_SYSCTL_FAN1 1102 /* state, ripple, actual value - fan 1 */ -#define FSCHER_SYSCTL_FAN2 1103 /* state, ripple, actual value - fan 2 */ -#define FSCHER_SYSCTL_TEMP0 1201 /* state and value of sensor 0, - cpu die */ -#define FSCHER_SYSCTL_TEMP1 1202 /* state and value of sensor 1, - motherboard */ -#define FSCHER_SYSCTL_TEMP2 1203 /* state and value of sensor 2, - chassis */ -#define FSCHER_SYSCTL_PWM0 1301 /* min fan 0 */ -#define FSCHER_SYSCTL_PWM1 1302 /* min fan 1 */ -#define FSCHER_SYSCTL_PWM2 1303 /* min fan 2 */ -#define FSCHER_SYSCTL_REV 2000 /* revision */ -#define FSCHER_SYSCTL_EVENT 2001 /* global event status */ -#define FSCHER_SYSCTL_CONTROL 2002 /* global control byte */ -#define FSCHER_SYSCTL_WDOG 2003 /* watch dog preset, state and - control */ -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected FSCHER. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table fscher_dir_table_template[] = { - {FSCHER_SYSCTL_REV, "rev", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_in}, - {FSCHER_SYSCTL_EVENT, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_in}, - {FSCHER_SYSCTL_CONTROL, "control", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_in}, - {FSCHER_SYSCTL_TEMP0, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_temp}, - {FSCHER_SYSCTL_TEMP1, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_temp}, - {FSCHER_SYSCTL_TEMP2, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_temp}, - {FSCHER_SYSCTL_VOLT0, "in0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_volt}, - {FSCHER_SYSCTL_VOLT1, "in1", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_volt}, - {FSCHER_SYSCTL_VOLT2, "in2", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_volt}, - {FSCHER_SYSCTL_FAN0, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_fan}, - {FSCHER_SYSCTL_FAN1, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_fan}, - {FSCHER_SYSCTL_FAN2, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_fan}, - {FSCHER_SYSCTL_PWM0, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_pwm}, - {FSCHER_SYSCTL_PWM1, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_pwm}, - {FSCHER_SYSCTL_PWM2, "pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_pwm}, - {FSCHER_SYSCTL_WDOG, "wdog", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscher_wdog}, - {0} -}; - -static int fscher_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, fscher_detect); -} - -int fscher_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct fscher_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety - check at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk("fscher.o: fscher_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access fscher_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct fscher_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &fscher_driver; - new_client->flags = 0; - - /* Do the remaining detection unless force or force_fscher parameter */ - if (kind < 0) { - if (fscher_read_value(new_client, FSCHER_REG_IDENT_0) != 0x48) /* 'H' */ - goto ERROR1; - if (fscher_read_value(new_client, FSCHER_REG_IDENT_1) != 0x45) /* 'E' */ - goto ERROR1; - if (fscher_read_value(new_client, FSCHER_REG_IDENT_2) != 0x52) /* 'R' */ - goto ERROR1; - } - - kind = fscher; - - type_name = "fscher"; - client_name = "fsc hermes chip"; - - /* Fill in the remaining client fields and put it into the - global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - fscher_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - fscher_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int fscher_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct fscher_data *) (client->data))->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk("fscher.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -static int fscher_read_value(struct i2c_client *client, u8 reg) -{ -#ifdef DEBUG - printk("fscher: read reg 0x%02x\n",reg); -#endif - return i2c_smbus_read_byte_data(client, reg); -} - -static int fscher_write_value(struct i2c_client *client, u8 reg, u8 value) -{ -#ifdef DEBUG - printk("fscher: write reg 0x%02x, val 0x%02x\n",reg, value); -#endif - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* Called when we have found a new FSCHER. */ -static void fscher_init_client(struct i2c_client *client) -{ - struct fscher_data *data = client->data; - - /* read revision from chip */ - data->revision = fscher_read_value(client,FSCHER_REG_REVISION); -} - -static void fscher_update_client(struct i2c_client *client) -{ - struct fscher_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > 2 * HZ) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting fscher update\n"); -#endif - data->temp_act[0] = fscher_read_value(client, FSCHER_REG_TEMP0_ACT); - data->temp_act[1] = fscher_read_value(client, FSCHER_REG_TEMP1_ACT); - data->temp_act[2] = fscher_read_value(client, FSCHER_REG_TEMP2_ACT); - data->temp_status[0] = fscher_read_value(client, FSCHER_REG_TEMP0_STATE); - data->temp_status[1] = fscher_read_value(client, FSCHER_REG_TEMP1_STATE); - data->temp_status[2] = fscher_read_value(client, FSCHER_REG_TEMP2_STATE); - - data->volt[0] = fscher_read_value(client, FSCHER_REG_VOLT_12); - data->volt[1] = fscher_read_value(client, FSCHER_REG_VOLT_5); - data->volt[2] = fscher_read_value(client, FSCHER_REG_VOLT_BATT); - - data->fan_act[0] = fscher_read_value(client, FSCHER_REG_FAN0_ACT); - data->fan_act[1] = fscher_read_value(client, FSCHER_REG_FAN1_ACT); - data->fan_act[2] = fscher_read_value(client, FSCHER_REG_FAN2_ACT); - data->fan_status[0] = fscher_read_value(client, FSCHER_REG_FAN0_STATE); - data->fan_status[1] = fscher_read_value(client, FSCHER_REG_FAN1_STATE); - data->fan_status[2] = fscher_read_value(client, FSCHER_REG_FAN2_STATE); - data->fan_min[0] = fscher_read_value(client, FSCHER_REG_FAN0_MIN); - data->fan_min[1] = fscher_read_value(client, FSCHER_REG_FAN1_MIN); - data->fan_min[2] = fscher_read_value(client, FSCHER_REG_FAN2_MIN); - data->fan_ripple[0] = fscher_read_value(client, FSCHER_REG_FAN0_RIPPLE); - data->fan_ripple[1] = fscher_read_value(client, FSCHER_REG_FAN1_RIPPLE); - data->fan_ripple[2] = fscher_read_value(client, FSCHER_REG_FAN2_RIPPLE); - - data->watchdog[0] = fscher_read_value(client, FSCHER_REG_WDOG_PRESET); - data->watchdog[1] = fscher_read_value(client, FSCHER_REG_WDOG_STATE); - data->watchdog[2] = fscher_read_value(client, FSCHER_REG_WDOG_CONTROL); - - data->global_event = fscher_read_value(client, FSCHER_REG_EVENT_STATE); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void fscher_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscher_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscher_update_client(client); - switch(ctl_name) { - case FSCHER_SYSCTL_REV: - results[0] = data->revision ; - break; - case FSCHER_SYSCTL_EVENT: - /* bits 6, 5 and 2 are reserved => mask with 0x9b */ - results[0] = data->global_event & 0x9b; - break; - case FSCHER_SYSCTL_CONTROL: - results[0] = data->global_control & 0x01; - break; - default: - printk("fscher: ctl_name %d not supported\n", ctl_name); - *nrels_mag = 0; - return; - } - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if((ctl_name == FSCHER_SYSCTL_CONTROL) && (*nrels_mag >= 1)) { - data->global_control = (results[0] & 0x01); - printk("fscher: writing 0x%02x to global_control\n", - data->global_control); - fscher_write_value(client,FSCHER_REG_CONTROL, - data->global_control); - } - else - printk("fscher: writing to chip not supported\n"); - } -} - - -#define TEMP_FROM_REG(val) (val-128) - -void fscher_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscher_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscher_update_client(client); - switch(ctl_name) { - case FSCHER_SYSCTL_TEMP0: - results[0] = data->temp_status[0] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[0]); - break; - case FSCHER_SYSCTL_TEMP1: - results[0] = data->temp_status[1] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[1]); - break; - case FSCHER_SYSCTL_TEMP2: - results[0] = data->temp_status[2] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[2]); - break; - default: - printk("fscher: ctl_name %d not supported\n", ctl_name); - *nrels_mag = 0; - return; - } - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if(*nrels_mag >= 1) { - switch(ctl_name) { - case FSCHER_SYSCTL_TEMP0: - data->temp_status[0] = (data->temp_status[0] & ~0x02) - | (results[0] & 0x02); - printk("fscher: writing value 0x%02x to temp0_status\n", - data->temp_status[0]); - fscher_write_value(client, FSCHER_REG_TEMP0_STATE, - data->temp_status[0] & 0x02); - break; - case FSCHER_SYSCTL_TEMP1: - data->temp_status[1] = (data->temp_status[1] & ~0x02) - | (results[0] & 0x02); - printk("fscher: writing value 0x%02x to temp1_status\n", - data->temp_status[1]); - fscher_write_value(client, FSCHER_REG_TEMP1_STATE, - data->temp_status[1] & 0x02); - break; - case FSCHER_SYSCTL_TEMP2: - data->temp_status[2] = (data->temp_status[2] & ~0x02) - | (results[0] & 0x02); - printk("fscher: writing value 0x%02x to temp2_status\n", - data->temp_status[2]); - fscher_write_value(client, FSCHER_REG_TEMP2_STATE, - data->temp_status[2] & 0x02); - break; - default: - printk("fscher: ctl_name %d not supported\n",ctl_name); - } - } - else - printk("fscher: writing to chip not supported\n"); - } -} - -/* - * The final conversion is specified in sensors.conf, as it depends on - * mainboard specific values. We export the registers contents as - * pseudo-hundredths-of-Volts (range 0V - 2.55V). Not that it makes much - * sense per se, but it minimizes the conversions count and keeps the - * values within a usual range. - */ -void fscher_volt(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscher_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - fscher_update_client(client); - switch(ctl_name) { - case FSCHER_SYSCTL_VOLT0: - results[0] = data->volt[0]; - break; - case FSCHER_SYSCTL_VOLT1: - results[0] = data->volt[1]; - break; - case FSCHER_SYSCTL_VOLT2: - results[0] = data->volt[2]; - break; - default: - printk("fscher: ctl_name %d not supported\n", ctl_name); - *nrels_mag = 0; - return; - } - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - printk("fscher: writing to chip not supported\n"); - } -} - -void fscher_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - - switch(ctl_name) { - case FSCHER_SYSCTL_PWM0: - fscher_pwm_internal(client,operation,ctl_name,nrels_mag,results, - 0,FSCHER_REG_FAN0_MIN); - break; - case FSCHER_SYSCTL_PWM1: - fscher_pwm_internal(client,operation,ctl_name,nrels_mag,results, - 1,FSCHER_REG_FAN1_MIN); - break; - case FSCHER_SYSCTL_PWM2: - fscher_pwm_internal(client,operation,ctl_name,nrels_mag,results, - 2,FSCHER_REG_FAN2_MIN); - break; - default: - printk("fscher: illegal pwm nr %d\n",ctl_name); - } -} - -void fscher_pwm_internal(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results, - int nr, int reg_min) -{ - struct fscher_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscher_update_client(client); - results[0] = data->fan_min[nr]; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if(*nrels_mag >= 1) { - data->fan_min[nr] = results[0]; - printk("fscher: writing value 0x%02x to fan%d_min\n", - data->fan_min[nr],nr); - fscher_write_value(client,reg_min,data->fan_min[nr]); - } - } -} - -void fscher_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - switch(ctl_name) { - case FSCHER_SYSCTL_FAN0: - fscher_fan_internal(client,operation,ctl_name,nrels_mag,results, - 0,FSCHER_REG_FAN0_STATE, FSCHER_REG_FAN0_RIPPLE); - break; - case FSCHER_SYSCTL_FAN1: - fscher_fan_internal(client,operation,ctl_name,nrels_mag,results, - 1,FSCHER_REG_FAN1_STATE, FSCHER_REG_FAN1_RIPPLE); - break; - case FSCHER_SYSCTL_FAN2: - fscher_fan_internal(client,operation,ctl_name,nrels_mag,results, - 2,FSCHER_REG_FAN2_STATE, FSCHER_REG_FAN2_RIPPLE); - break; - default: - printk("fscher: illegal fan nr %d\n",ctl_name); - } -} - -#define RPM_FROM_REG(val) (val*60) - -void fscher_fan_internal(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results, - int nr, int reg_state, int reg_ripple) -{ - struct fscher_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscher_update_client(client); - results[0] = data->fan_status[nr] & 0x04; - results[1] = data->fan_ripple[nr] & 0x03; - results[2] = RPM_FROM_REG(data->fan_act[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if(*nrels_mag >= 1) { - data->fan_status[nr] = results[0] & 0x04; - printk("fscher: writing value 0x%02x to fan%d_status\n", - data->fan_status[nr],nr); - fscher_write_value(client,reg_state,data->fan_status[nr]); - } - if(*nrels_mag >= 2) { - if((results[1] & 0x03) == 0) { - printk("fscher: fan%d ripple 0 not allowed\n",nr); - return; - } - data->fan_ripple[nr] = results[1] & 0x03; - printk("fscher: writing value 0x%02x to fan%d_ripple\n", - data->fan_ripple[nr],nr); - fscher_write_value(client,reg_ripple,data->fan_ripple[nr]); - } - } -} - -void fscher_wdog(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscher_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscher_update_client(client); - results[0] = data->watchdog[0] ; - results[1] = data->watchdog[1] & 0x02; - results[2] = data->watchdog[2] & 0xd0; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->watchdog[0] = results[0] & 0xff; - printk("fscher: writing value 0x%02x to wdog_preset\n", - data->watchdog[0]); - fscher_write_value(client,FSCHER_REG_WDOG_PRESET,data->watchdog[0]); - } - if (*nrels_mag >= 2) { - data->watchdog[1] = results[1] & 0x02; - printk("fscher: writing value 0x%02x to wdog_state\n", - data->watchdog[1]); - fscher_write_value(client,FSCHER_REG_WDOG_STATE,data->watchdog[1]); - } - if (*nrels_mag >= 3) { - data->watchdog[2] = results[2] & 0xf0; - printk("fscher: writing value 0x%02x to wdog_control\n", - data->watchdog[2]); - fscher_write_value(client,FSCHER_REG_WDOG_CONTROL,data->watchdog[2]); - } - } -} - -static int __init sm_fscher_init(void) -{ - printk("fscher.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&fscher_driver); -} - -static void __exit sm_fscher_exit(void) -{ - i2c_del_driver(&fscher_driver); -} - - - -MODULE_AUTHOR("Reinhard Nissl based on work from Hermann" - " Jung , Frodo Looijaard and" - " Philip Edelbrock "); -MODULE_DESCRIPTION("fujitsu siemens hermes chip driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_fscher_init); -module_exit(sm_fscher_exit); diff --git a/kernel/chips/fscpos.c b/kernel/chips/fscpos.c deleted file mode 100644 index 0bb4858e..00000000 --- a/kernel/chips/fscpos.c +++ /dev/null @@ -1,684 +0,0 @@ -/* - fscpos.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2001 Hermann Jung - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - fujitsu siemens poseidon chip, - module based on lm80.c - Copyright (c) 1998, 1999 Frodo Looijaard - and Philip Edelbrock -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x73, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(fscpos); - -/* The FSCPOS registers */ - -/* chip identification */ -#define FSCPOS_REG_IDENT_0 0x00 -#define FSCPOS_REG_IDENT_1 0x01 -#define FSCPOS_REG_IDENT_2 0x02 -#define FSCPOS_REG_REVISION 0x03 - -/* global control and status */ -#define FSCPOS_REG_EVENT_STATE 0x04 -#define FSCPOS_REG_CONTROL 0x05 - -/* watchdog */ -#define FSCPOS_REG_WDOG_PRESET 0x28 -#define FSCPOS_REG_WDOG_STATE 0x23 -#define FSCPOS_REG_WDOG_CONTROL 0x21 - -/* fan 0 */ -#define FSCPOS_REG_FAN0_MIN 0x55 -#define FSCPOS_REG_FAN0_ACT 0x0e -#define FSCPOS_REG_FAN0_STATE 0x0d -#define FSCPOS_REG_FAN0_RIPPLE 0x0f - -/* fan 1 */ -#define FSCPOS_REG_FAN1_MIN 0x65 -#define FSCPOS_REG_FAN1_ACT 0x6b -#define FSCPOS_REG_FAN1_STATE 0x62 -#define FSCPOS_REG_FAN1_RIPPLE 0x6f - -/* fan 2 */ -/* min speed fan2 not supported */ -#define FSCPOS_REG_FAN2_ACT 0xab -#define FSCPOS_REG_FAN2_STATE 0xa2 -#define FSCPOS_REG_FAN2_RIPPLE 0x0af - -/* voltage supervision */ -#define FSCPOS_REG_VOLT_12 0x45 -#define FSCPOS_REG_VOLT_5 0x42 -#define FSCPOS_REG_VOLT_BATT 0x48 - -/* temperatures */ -/* sensor 0 */ -#define FSCPOS_REG_TEMP0_ACT 0x64 -#define FSCPOS_REG_TEMP0_STATE 0x71 - -/* sensor 1 */ -#define FSCPOS_REG_TEMP1_ACT 0x32 -#define FSCPOS_REG_TEMP1_STATE 0x81 - -/* sensor 2 */ -#define FSCPOS_REG_TEMP2_ACT 0x35 -#define FSCPOS_REG_TEMP2_STATE 0x91 - - - - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ - -#define IN_TO_REG(val,nr) (SENSORS_LIMIT((val),0,255)) -#define IN_FROM_REG(val,nr) (val) - -/* Initial limits */ - -/* For each registered FSCPOS, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new fscpos client is - allocated. */ -struct fscpos_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 revision; /* revision of chip */ - u8 global_event; /* global event status */ - u8 global_control; /* global control register */ - u8 watchdog[3]; /* watchdog */ - u8 volt[3]; /* 12, 5, battery current */ - u8 temp_act[3]; /* temperature */ - u8 temp_status[3]; /* status of sensor */ - u8 fan_act[3]; /* fans revolutions per second */ - u8 fan_status[3]; /* fan status */ - u8 fan_min[3]; /* fan min value for rps */ - u8 fan_ripple[3]; /* divider for rps */ -}; - - -static int fscpos_attach_adapter(struct i2c_adapter *adapter); -static int fscpos_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int fscpos_detach_client(struct i2c_client *client); - -static int fscpos_read_value(struct i2c_client *client, u8 register); -static int fscpos_write_value(struct i2c_client *client, u8 register, - u8 value); -static void fscpos_update_client(struct i2c_client *client); -static void fscpos_init_client(struct i2c_client *client); - - -static void fscpos_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void fscpos_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscpos_fan_internal(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results, - int nr, int reg_state, int reg_min, int res_ripple); -static void fscpos_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscpos_volt(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscpos_wdog(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver fscpos_driver = { - .name = "FSCPOS sensor driver", - .id = I2C_DRIVERID_FSCPOS, - .flags = I2C_DF_NOTIFY, - .attach_adapter = fscpos_attach_adapter, - .detach_client = fscpos_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define FSCPOS_SYSCTL_VOLT0 1000 /* 12 volt supply */ -#define FSCPOS_SYSCTL_VOLT1 1001 /* 5 volt supply */ -#define FSCPOS_SYSCTL_VOLT2 1002 /* batterie voltage*/ -#define FSCPOS_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */ -#define FSCPOS_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */ -#define FSCPOS_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */ -#define FSCPOS_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */ -#define FSCPOS_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */ -#define FSCPOS_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */ -#define FSCPOS_SYSCTL_REV 2000 /* Revision */ -#define FSCPOS_SYSCTL_EVENT 2001 /* global event status */ -#define FSCPOS_SYSCTL_CONTROL 2002 /* global control byte */ -#define FSCPOS_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */ -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected FSCPOS. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table fscpos_dir_table_template[] = { - {FSCPOS_SYSCTL_REV, "rev", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_in}, - {FSCPOS_SYSCTL_EVENT, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_in}, - {FSCPOS_SYSCTL_CONTROL, "control", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_in}, - {FSCPOS_SYSCTL_TEMP0, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_temp}, - {FSCPOS_SYSCTL_TEMP1, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_temp}, - {FSCPOS_SYSCTL_TEMP2, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_temp}, - {FSCPOS_SYSCTL_VOLT0, "in0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_volt}, - {FSCPOS_SYSCTL_VOLT1, "in1", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_volt}, - {FSCPOS_SYSCTL_VOLT2, "in2", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_volt}, - {FSCPOS_SYSCTL_FAN0, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_fan}, - {FSCPOS_SYSCTL_FAN1, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_fan}, - {FSCPOS_SYSCTL_FAN2, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_fan}, - {FSCPOS_SYSCTL_WDOG, "wdog", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscpos_wdog}, - {0} -}; - -static int fscpos_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, fscpos_detect); -} - -static int fscpos_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct fscpos_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("fscpos.o: fscpos_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access fscpos_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct fscpos_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &fscpos_driver; - new_client->flags = 0; - - /* Do the remaining detection unless force or force_fscpos parameter */ - if (kind < 0) { - if (fscpos_read_value(new_client, FSCPOS_REG_IDENT_0) != 0x50) - goto ERROR1; - if (fscpos_read_value(new_client, FSCPOS_REG_IDENT_1) != 0x45) - goto ERROR1; - if (fscpos_read_value(new_client, FSCPOS_REG_IDENT_2) != 0x47) - goto ERROR1; - } - - kind = fscpos; - - type_name = "fscpos"; - client_name = "fsc poseidon chip"; - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - fscpos_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - fscpos_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int fscpos_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct fscpos_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("fscpos.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -static int fscpos_read_value(struct i2c_client *client, u8 reg) -{ -#ifdef DEBUG - printk("fscpos: read reg 0x%02x\n",reg); -#endif - return i2c_smbus_read_byte_data(client, reg); -} - -static int fscpos_write_value(struct i2c_client *client, u8 reg, u8 value) -{ -#ifdef DEBUG - printk("fscpos: write reg 0x%02x, val 0x%02x\n",reg, value); -#endif - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* Called when we have found a new FSCPOS. */ -static void fscpos_init_client(struct i2c_client *client) -{ - struct fscpos_data *data = client->data; - - /* read revision from chip */ - data->revision = fscpos_read_value(client,FSCPOS_REG_REVISION); - /* setup missing fan2_min value */ - data->fan_min[2] = 0xff; -} - -static void fscpos_update_client(struct i2c_client *client) -{ - struct fscpos_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > 2 * HZ) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting fscpos update\n"); -#endif - data->temp_act[0] = fscpos_read_value(client, FSCPOS_REG_TEMP0_ACT); - data->temp_act[1] = fscpos_read_value(client, FSCPOS_REG_TEMP1_ACT); - data->temp_act[2] = fscpos_read_value(client, FSCPOS_REG_TEMP2_ACT); - data->temp_status[0] = fscpos_read_value(client, FSCPOS_REG_TEMP0_STATE); - data->temp_status[1] = fscpos_read_value(client, FSCPOS_REG_TEMP1_STATE); - data->temp_status[2] = fscpos_read_value(client, FSCPOS_REG_TEMP2_STATE); - - data->volt[0] = fscpos_read_value(client, FSCPOS_REG_VOLT_12); - data->volt[1] = fscpos_read_value(client, FSCPOS_REG_VOLT_5); - data->volt[2] = fscpos_read_value(client, FSCPOS_REG_VOLT_BATT); - - data->fan_act[0] = fscpos_read_value(client, FSCPOS_REG_FAN0_ACT); - data->fan_act[1] = fscpos_read_value(client, FSCPOS_REG_FAN1_ACT); - data->fan_act[2] = fscpos_read_value(client, FSCPOS_REG_FAN2_ACT); - data->fan_status[0] = fscpos_read_value(client, FSCPOS_REG_FAN0_STATE); - data->fan_status[1] = fscpos_read_value(client, FSCPOS_REG_FAN1_STATE); - data->fan_status[2] = fscpos_read_value(client, FSCPOS_REG_FAN2_STATE); - data->fan_min[0] = fscpos_read_value(client, FSCPOS_REG_FAN0_MIN); - data->fan_min[1] = fscpos_read_value(client, FSCPOS_REG_FAN1_MIN); - /* fan2_min is not supported */ - data->fan_ripple[0] = fscpos_read_value(client, FSCPOS_REG_FAN0_RIPPLE); - data->fan_ripple[1] = fscpos_read_value(client, FSCPOS_REG_FAN1_RIPPLE); - data->fan_ripple[2] = fscpos_read_value(client, FSCPOS_REG_FAN2_RIPPLE); - - data->watchdog[0] = fscpos_read_value(client, FSCPOS_REG_WDOG_PRESET); - data->watchdog[1] = fscpos_read_value(client, FSCPOS_REG_WDOG_STATE); - data->watchdog[2] = fscpos_read_value(client, FSCPOS_REG_WDOG_CONTROL); - - data->global_event = fscpos_read_value(client, FSCPOS_REG_EVENT_STATE); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void fscpos_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscpos_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscpos_update_client(client); - switch(ctl_name) { - case FSCPOS_SYSCTL_REV: - results[0] = data->revision ; - break; - case FSCPOS_SYSCTL_EVENT: - results[0] = data->global_event & 0x1f; - break; - case FSCPOS_SYSCTL_CONTROL: - results[0] = data->global_control & 0x01; - break; - default: - printk("fscpos: ctl_name %d not supported\n", - ctl_name); - *nrels_mag = 0; - return; - } - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if((ctl_name == FSCPOS_SYSCTL_CONTROL) && (*nrels_mag >= 1)) { - data->global_control = (results[0] & 0x01); - printk("fscpos: writing 0x%02x to global_control\n", - data->global_control); - fscpos_write_value(client,FSCPOS_REG_CONTROL, - data->global_control); - } - else - printk("fscpos: writing to chip not supported\n"); - } -} - -#define TEMP_FROM_REG(val) (val-128) - - -void fscpos_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscpos_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscpos_update_client(client); - switch(ctl_name) { - case FSCPOS_SYSCTL_TEMP0: - results[0] = data->temp_status[0] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[0]); - break; - case FSCPOS_SYSCTL_TEMP1: - results[0] = data->temp_status[1] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[1]); - break; - case FSCPOS_SYSCTL_TEMP2: - results[0] = data->temp_status[2] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[2]); - break; - default: - printk("fscpos: ctl_name %d not supported\n", - ctl_name); - *nrels_mag = 0; - return; - } - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if(*nrels_mag >= 1) { - switch(ctl_name) { - case FSCPOS_SYSCTL_TEMP0: - data->temp_status[0] = - (data->temp_status[0] & ~0x02) - | (results[0] & 0x02); - printk("fscpos: writing value 0x%02x " - "to temp0_status\n", - data->temp_status[0]); - fscpos_write_value(client, - FSCPOS_REG_TEMP0_STATE, - data->temp_status[0] & 0x02); - break; - case FSCPOS_SYSCTL_TEMP1: - data->temp_status[1] = (data->temp_status[1] & ~0x02) | (results[0] & 0x02); - printk("fscpos: writing value 0x%02x to temp1_status\n", data->temp_status[1]); - fscpos_write_value(client,FSCPOS_REG_TEMP1_STATE, - data->temp_status[1] & 0x02); - break; - case FSCPOS_SYSCTL_TEMP2: - data->temp_status[2] = (data->temp_status[2] & ~0x02) | (results[0] & 0x02); - printk("fscpos: writing value 0x%02x to temp2_status\n", data->temp_status[2]); - fscpos_write_value(client,FSCPOS_REG_TEMP2_STATE, - data->temp_status[2] & 0x02); - break; - default: - printk("fscpos: ctl_name %d not supported\n",ctl_name); - } - } - else - printk("fscpos: writing to chip not supported\n"); - } -} - -#define VOLT_FROM_REG(val,mult) (val*mult/255) - -void fscpos_volt(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscpos_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - fscpos_update_client(client); - switch(ctl_name) { - case FSCPOS_SYSCTL_VOLT0: - results[0] = VOLT_FROM_REG(data->volt[0],1420); - break; - case FSCPOS_SYSCTL_VOLT1: - results[0] = VOLT_FROM_REG(data->volt[1],660); - break; - case FSCPOS_SYSCTL_VOLT2: - results[0] = VOLT_FROM_REG(data->volt[2],330); - break; - default: - printk("fscpos: ctl_name %d not supported\n", - ctl_name); - *nrels_mag = 0; - return; - } - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - printk("fscpos: writing to chip not supported\n"); - } -} - -void fscpos_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - - switch(ctl_name) { - case FSCPOS_SYSCTL_FAN0: - fscpos_fan_internal(client,operation,ctl_name,nrels_mag,results, - 0,FSCPOS_REG_FAN0_STATE,FSCPOS_REG_FAN0_MIN, - FSCPOS_REG_FAN0_RIPPLE); - break; - case FSCPOS_SYSCTL_FAN1: - fscpos_fan_internal(client,operation,ctl_name,nrels_mag,results, - 1,FSCPOS_REG_FAN1_STATE,FSCPOS_REG_FAN1_MIN, - FSCPOS_REG_FAN1_RIPPLE); - break; - case FSCPOS_SYSCTL_FAN2: - fscpos_fan_internal(client,operation,ctl_name,nrels_mag,results, - 2,FSCPOS_REG_FAN2_STATE,0xff, - FSCPOS_REG_FAN2_RIPPLE); - break; - default: - printk("fscpos: illegal fan nr %d\n",ctl_name); - } -} - -#define RPM_FROM_REG(val) (val*60) - -void fscpos_fan_internal(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results, int nr, - int reg_state, int reg_min, int reg_ripple ) -{ - struct fscpos_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscpos_update_client(client); - results[0] = data->fan_status[nr] & 0x04; - results[1] = data->fan_min[nr]; - results[2] = data->fan_ripple[nr] & 0x03; - results[3] = RPM_FROM_REG(data->fan_act[nr]); - *nrels_mag = 4; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if(*nrels_mag >= 1) { - data->fan_status[nr] = results[0] & 0x04; - printk("fscpos: writing value 0x%02x to fan%d_status\n", - data->fan_status[nr],nr); - fscpos_write_value(client,reg_state, - data->fan_status[nr]); - } - if((*nrels_mag >= 2) && (nr < 2)) { - /* minimal speed for fan2 not supported */ - data->fan_min[nr] = results[1]; - printk("fscpos: writing value 0x%02x to fan%d_min\n", - data->fan_min[nr],nr); - fscpos_write_value(client,reg_min, - data->fan_min[nr]); - } - if(*nrels_mag >= 3) { - if((results[2] & 0x03) == 0) { - printk("fscpos: fan%d ripple 0 not allowed\n",nr); - return; - } - data->fan_ripple[nr] = results[2] & 0x03; - printk("fscpos: writing value 0x%02x to fan%d_ripple\n", - data->fan_ripple[nr],nr); - fscpos_write_value(client,reg_ripple, - data->fan_ripple[nr]); - } - } -} - -void fscpos_wdog(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscpos_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscpos_update_client(client); - results[0] = data->watchdog[0] ; - results[1] = data->watchdog[1] & 0x02; - results[2] = data->watchdog[2] & 0xb0; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->watchdog[0] = results[0] & 0xff; - printk("fscpos: writing value 0x%02x to wdog_preset\n", - data->watchdog[0]); - fscpos_write_value(client,FSCPOS_REG_WDOG_PRESET, - data->watchdog[0]); - } - if (*nrels_mag >= 2) { - data->watchdog[1] = results[1] & 0x02; - printk("fscpos: writing value 0x%02x to wdog_state\n", - data->watchdog[1]); - fscpos_write_value(client,FSCPOS_REG_WDOG_STATE, - data->watchdog[1]); - } - if (*nrels_mag >= 3) { - data->watchdog[2] = results[2] & 0xb0; - printk("fscpos: writing value 0x%02x to wdog_control\n", - data->watchdog[2]); - fscpos_write_value(client,FSCPOS_REG_WDOG_CONTROL, - data->watchdog[2]); - } - } -} - -static int __init sm_fscpos_init(void) -{ - printk("fscpos.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&fscpos_driver); -} - -static void __exit sm_fscpos_exit(void) -{ - i2c_del_driver(&fscpos_driver); -} - - - -MODULE_AUTHOR - ("Hermann Jung based on work from Frodo Looijaard and Philip Edelbrock "); -MODULE_DESCRIPTION("fujitsu siemens poseidon chip driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_fscpos_init); -module_exit(sm_fscpos_exit); diff --git a/kernel/chips/fscscy.c b/kernel/chips/fscscy.c deleted file mode 100644 index 559a106b..00000000 --- a/kernel/chips/fscscy.c +++ /dev/null @@ -1,909 +0,0 @@ -/* - fscscy.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2001 Martin Knoblauch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - fujitsu siemens scylla chip, - module based on lm80.c, fscpos.c - Copyright (c) 1998, 1999 Frodo Looijaard - and Philip Edelbrock -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x73, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(fscscy); - -/* The FSCSCY registers */ - -/* chip identification */ -#define FSCSCY_REG_IDENT_0 0x00 -#define FSCSCY_REG_IDENT_1 0x01 -#define FSCSCY_REG_IDENT_2 0x02 -#define FSCSCY_REG_REVISION 0x03 - -/* global control and status */ -#define FSCSCY_REG_EVENT_STATE 0x04 -#define FSCSCY_REG_CONTROL 0x05 - -/* watchdog */ -#define FSCSCY_REG_WDOG_PRESET 0x28 -#define FSCSCY_REG_WDOG_STATE 0x23 -#define FSCSCY_REG_WDOG_CONTROL 0x21 - -/* -** Fan definitions -** -** _RPMMIN: Minimum speed. Can be set via interface, but only for three of the fans -** FAN1_RPMMIN is wired to Fan 0 (CPU Fans) -** FAN4_RPMMIN is wired to Fan 2 (PS Fans ??) -** FAN5_RPMMIN is wired to Fan 3 (AUX Fans ??) -** _ACT: Actual Fan Speed -** _STATE: Fan status register -** _RIPPLE: Fan speed multiplier -*/ - -/* fan 0 */ -#define FSCSCY_REG_FAN0_RPMMIN 0x65 -#define FSCSCY_REG_FAN0_ACT 0x6b -#define FSCSCY_REG_FAN0_STATE 0x62 -#define FSCSCY_REG_FAN0_RIPPLE 0x6f - -/* fan 1 */ -#define FSCSCY_REG_FAN1_RPMMIN FSCSCY_REG_FAN0_RPMMIN -#define FSCSCY_REG_FAN1_ACT 0x6c -#define FSCSCY_REG_FAN1_STATE 0x61 -#define FSCSCY_REG_FAN1_RIPPLE 0x6f - -/* fan 2 */ -#define FSCSCY_REG_FAN2_RPMMIN 0x55 -#define FSCSCY_REG_FAN2_ACT 0x0e -#define FSCSCY_REG_FAN2_STATE 0x0d -#define FSCSCY_REG_FAN2_RIPPLE 0x0f - -/* fan 3 */ -#define FSCSCY_REG_FAN3_RPMMIN 0xa5 -#define FSCSCY_REG_FAN3_ACT 0xab -#define FSCSCY_REG_FAN3_STATE 0xa2 -#define FSCSCY_REG_FAN3_RIPPLE 0xaf - -/* fan 4 */ -#define FSCSCY_REG_FAN4_RPMMIN FSCSCY_REG_FAN2_RPMMIN -#define FSCSCY_REG_FAN4_ACT 0x5c -#define FSCSCY_REG_FAN4_STATE 0x52 -#define FSCSCY_REG_FAN4_RIPPLE 0x0f - -/* fan 5 */ -#define FSCSCY_REG_FAN5_RPMMIN FSCSCY_REG_FAN3_RPMMIN -#define FSCSCY_REG_FAN5_ACT 0xbb -#define FSCSCY_REG_FAN5_STATE 0xb2 -#define FSCSCY_REG_FAN5_RIPPLE 0xbf - -/* voltage supervision */ -#define FSCSCY_REG_VOLT_12 0x45 -#define FSCSCY_REG_VOLT_5 0x42 -#define FSCSCY_REG_VOLT_BATT 0x48 - -/* temperatures */ -/* sensor 0 */ -#define FSCSCY_REG_TEMP0_ACT 0x64 -#define FSCSCY_REG_TEMP0_STATE 0x71 -#define FSCSCY_REG_TEMP0_LIM 0x76 - -/* sensor 1 */ -#define FSCSCY_REG_TEMP1_ACT 0xD0 -#define FSCSCY_REG_TEMP1_STATE 0xD1 -#define FSCSCY_REG_TEMP1_LIM 0xD6 - -/* sensor 2 */ -#define FSCSCY_REG_TEMP2_ACT 0x32 -#define FSCSCY_REG_TEMP2_STATE 0x81 -#define FSCSCY_REG_TEMP2_LIM 0x86 - -/* sensor3 */ -#define FSCSCY_REG_TEMP3_ACT 0x35 -#define FSCSCY_REG_TEMP3_STATE 0x91 -#define FSCSCY_REG_TEMP3_LIM 0x96 - -/* PCI Load */ -#define FSCSCY_REG_PCILOAD 0x1a - -/* Intrusion Sensor */ -#define FSCSCY_REG_INTR_STATE 0x13 -#define FSCSCY_REG_INTR_CTRL 0x12 - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ - -#define IN_TO_REG(val,nr) (SENSORS_LIMIT((val),0,255)) -#define IN_FROM_REG(val,nr) (val) - -/* Initial limits */ - -/* For each registered FSCSCY, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new fscscy client is - allocated. */ -struct fscscy_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 revision; /* revision of chip */ - u8 global_event; /* global event status */ - u8 global_control; /* global control register */ - u8 watchdog[3]; /* watchdog */ - u8 volt[3]; /* 12, 5, battery current */ - u8 volt_min[3]; /* minimum voltages over module "lifetime" */ - u8 volt_max[3]; /* maximum voltages over module "lifetime" */ - u8 temp_act[4]; /* temperature */ - u8 temp_status[4]; /* status of temp. sensor */ - u8 temp_lim[4]; /* limit temperature of temp. sensor */ - u8 temp_min[4]; /* minimum of temp. sensor, this is just calculated by the module */ - u8 temp_max[4]; /* maximum of temp. sensor, this is just calculsted by the module */ - u8 fan_act[6]; /* fans revolutions per second */ - u8 fan_status[6]; /* fan status */ - u8 fan_rpmmin[6]; /* fan min value for rps */ - u8 fan_ripple[6]; /* divider for rps */ - u8 fan_min[6]; /* minimum RPM over module "lifetime" */ - u8 fan_max[6]; /* maximum RPM over module "lifetime" */ - u8 pciload; /* PCILoad value */ - u8 intr_status; /* Intrusion Status */ - u8 intr_control; /* Intrusion Control */ -}; - - -static int fscscy_attach_adapter(struct i2c_adapter *adapter); -static int fscscy_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int fscscy_detach_client(struct i2c_client *client); - -static int fscscy_read_value(struct i2c_client *client, u8 register); -static int fscscy_write_value(struct i2c_client *client, u8 register, - u8 value); -static void fscscy_update_client(struct i2c_client *client); -static void fscscy_init_client(struct i2c_client *client); - - -static void fscscy_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void fscscy_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscscy_fan_internal(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results, - int nr, int reg_state, int reg_min, int res_ripple); -static void fscscy_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscscy_volt(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscscy_wdog(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscscy_pciload(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void fscscy_intrusion(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver fscscy_driver = { - .name = "FSCSCY sensor driver", - .id = I2C_DRIVERID_FSCSCY, - .flags = I2C_DF_NOTIFY, - .attach_adapter = fscscy_attach_adapter, - .detach_client = fscscy_detach_client, -}; - -/* The /proc/sys entries */ - -/* -- SENSORS SYSCTL START -- */ -#define FSCSCY_SYSCTL_VOLT0 1000 /* 12 volt supply */ -#define FSCSCY_SYSCTL_VOLT1 1001 /* 5 volt supply */ -#define FSCSCY_SYSCTL_VOLT2 1002 /* batterie voltage*/ -#define FSCSCY_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */ -#define FSCSCY_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */ -#define FSCSCY_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */ -#define FSCSCY_SYSCTL_FAN3 1104 /* state, min, ripple, actual value fan 3 */ -#define FSCSCY_SYSCTL_FAN4 1105 /* state, min, ripple, actual value fan 4 */ -#define FSCSCY_SYSCTL_FAN5 1106 /* state, min, ripple, actual value fan 5 */ -#define FSCSCY_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */ -#define FSCSCY_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */ -#define FSCSCY_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */ -#define FSCSCY_SYSCTL_TEMP3 1204 /* state and value of sensor 3, chassis */ -#define FSCSCY_SYSCTL_REV 2000 /* Revision */ -#define FSCSCY_SYSCTL_EVENT 2001 /* global event status */ -#define FSCSCY_SYSCTL_CONTROL 2002 /* global control byte */ -#define FSCSCY_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */ -#define FSCSCY_SYSCTL_PCILOAD 2004 /* PCILoad value */ -#define FSCSCY_SYSCTL_INTRUSION 2005 /* state, control for intrusion sensor */ - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected FSCSCY. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table fscscy_dir_table_template[] = { - {FSCSCY_SYSCTL_REV, "rev", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_in}, - {FSCSCY_SYSCTL_EVENT, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_in}, - {FSCSCY_SYSCTL_CONTROL, "control", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_in}, - {FSCSCY_SYSCTL_TEMP0, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_temp}, - {FSCSCY_SYSCTL_TEMP1, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_temp}, - {FSCSCY_SYSCTL_TEMP2, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_temp}, - {FSCSCY_SYSCTL_TEMP3, "temp4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_temp}, - {FSCSCY_SYSCTL_VOLT0, "in0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_volt}, - {FSCSCY_SYSCTL_VOLT1, "in1", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_volt}, - {FSCSCY_SYSCTL_VOLT2, "in2", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_volt}, - {FSCSCY_SYSCTL_FAN0, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_fan}, - {FSCSCY_SYSCTL_FAN1, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_fan}, - {FSCSCY_SYSCTL_FAN2, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_fan}, - {FSCSCY_SYSCTL_FAN3, "fan4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_fan}, - {FSCSCY_SYSCTL_FAN4, "fan5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_fan}, - {FSCSCY_SYSCTL_FAN5, "fan6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_fan}, - {FSCSCY_SYSCTL_WDOG, "wdog", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_wdog}, - {FSCSCY_SYSCTL_PCILOAD, "pciload", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_pciload}, - {FSCSCY_SYSCTL_INTRUSION, "intrusion", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &fscscy_intrusion}, - {0} -}; - -static int fscscy_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, fscscy_detect); -} - -int fscscy_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct fscscy_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("fscscy.o: fscscy_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access fscscy_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct fscscy_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &fscscy_driver; - new_client->flags = 0; - - /* Do the remaining detection unless force or force_fscscy parameter */ - if (kind < 0) { - if (fscscy_read_value(new_client, FSCSCY_REG_IDENT_0) != 0x53) - goto ERROR1; - if (fscscy_read_value(new_client, FSCSCY_REG_IDENT_1) != 0x43) - goto ERROR1; - if (fscscy_read_value(new_client, FSCSCY_REG_IDENT_2) != 0x59) - goto ERROR1; - } - - kind = fscscy; - - type_name = "fscscy"; - client_name = "fsc scylla chip"; - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - fscscy_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - fscscy_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int fscscy_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct fscscy_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("fscscy.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -static int fscscy_read_value(struct i2c_client *client, u8 reg) -{ -#ifdef DEBUG - printk("fscscy: read reg 0x%02x\n",reg); -#endif - return i2c_smbus_read_byte_data(client, reg); -} - -static int fscscy_write_value(struct i2c_client *client, u8 reg, u8 value) -{ -#ifdef DEBUG - printk("fscscy: write reg 0x%02x, val 0x%02x\n",reg, value); -#endif - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* Called when we have found a new FSCSCY. */ -static void fscscy_init_client(struct i2c_client *client) -{ - struct fscscy_data *data = client->data; - - /* read revision from chip */ - data->revision = fscscy_read_value(client,FSCSCY_REG_REVISION); - - /* Initialize min/max values from chip */ - data->fan_min[0] = data->fan_max[0] = fscscy_read_value(client, FSCSCY_REG_FAN0_ACT); - data->fan_min[1] = data->fan_max[1] = fscscy_read_value(client, FSCSCY_REG_FAN1_ACT); - data->fan_min[2] = data->fan_max[2] = fscscy_read_value(client, FSCSCY_REG_FAN2_ACT); - data->fan_min[3] = data->fan_max[3] = fscscy_read_value(client, FSCSCY_REG_FAN3_ACT); - data->fan_min[4] = data->fan_max[4] = fscscy_read_value(client, FSCSCY_REG_FAN4_ACT); - data->fan_min[4] = data->fan_max[5] = fscscy_read_value(client, FSCSCY_REG_FAN5_ACT); - data->temp_min[0] = data->temp_max[0] = fscscy_read_value(client, FSCSCY_REG_TEMP0_ACT); - data->temp_min[1] = data->temp_max[1] = fscscy_read_value(client, FSCSCY_REG_TEMP1_ACT); - data->temp_min[2] = data->temp_max[2] = fscscy_read_value(client, FSCSCY_REG_TEMP2_ACT); - data->temp_min[3] = data->temp_max[3] = fscscy_read_value(client, FSCSCY_REG_TEMP3_ACT); - data->volt_min[0] = data->volt_max[0] = fscscy_read_value(client, FSCSCY_REG_VOLT_12); - data->volt_min[1] = data->volt_max[1] = fscscy_read_value(client, FSCSCY_REG_VOLT_5); - data->volt_min[2] = data->volt_max[2] = fscscy_read_value(client, FSCSCY_REG_VOLT_BATT); -} - -static void fscscy_update_client(struct i2c_client *client) -{ - struct fscscy_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > 2 * HZ) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting fscscy update\n"); -#endif - data->temp_act[0] = fscscy_read_value(client, FSCSCY_REG_TEMP0_ACT); - if (data->temp_min[0] > data->temp_act[0]) data->temp_min[0] = data->temp_act[0]; - if (data->temp_max[0] < data->temp_act[0]) data->temp_max[0] = data->temp_act[0]; - data->temp_act[1] = fscscy_read_value(client, FSCSCY_REG_TEMP1_ACT); - if (data->temp_min[1] > data->temp_act[1]) data->temp_min[1] = data->temp_act[1]; - if (data->temp_max[1] < data->temp_act[1]) data->temp_max[1] = data->temp_act[1]; - data->temp_act[2] = fscscy_read_value(client, FSCSCY_REG_TEMP2_ACT); - if (data->temp_min[2] > data->temp_act[2]) data->temp_min[2] = data->temp_act[2]; - if (data->temp_max[2] < data->temp_act[2]) data->temp_max[2] = data->temp_act[2]; - data->temp_act[3] = fscscy_read_value(client, FSCSCY_REG_TEMP3_ACT); - if (data->temp_min[3] > data->temp_act[3]) data->temp_min[3] = data->temp_act[3]; - if (data->temp_max[3] < data->temp_act[3]) data->temp_max[3] = data->temp_act[3]; - data->temp_status[0] = fscscy_read_value(client, FSCSCY_REG_TEMP0_STATE); - data->temp_status[1] = fscscy_read_value(client, FSCSCY_REG_TEMP1_STATE); - data->temp_status[2] = fscscy_read_value(client, FSCSCY_REG_TEMP2_STATE); - data->temp_status[3] = fscscy_read_value(client, FSCSCY_REG_TEMP3_STATE); - data->temp_lim[0] = fscscy_read_value(client, FSCSCY_REG_TEMP0_LIM); - data->temp_lim[1] = fscscy_read_value(client, FSCSCY_REG_TEMP1_LIM); - data->temp_lim[2] = fscscy_read_value(client, FSCSCY_REG_TEMP2_LIM); - data->temp_lim[3] = fscscy_read_value(client, FSCSCY_REG_TEMP3_LIM); - - data->volt[0] = fscscy_read_value(client, FSCSCY_REG_VOLT_12); - if (data->volt_min[0] > data->volt[0]) data->volt_min[0] = data->volt[0]; - if (data->volt_max[0] < data->volt[0]) data->volt_max[0] = data->volt[0]; - data->volt[1] = fscscy_read_value(client, FSCSCY_REG_VOLT_5); - if (data->volt_min[1] > data->volt[1]) data->volt_min[1] = data->volt[1]; - if (data->volt_max[1] < data->volt[1]) data->volt_max[1] = data->volt[1]; - data->volt[2] = fscscy_read_value(client, FSCSCY_REG_VOLT_BATT); - if (data->volt_min[2] > data->volt[2]) data->volt_min[2] = data->volt[2]; - if (data->volt_max[2] < data->volt[2]) data->volt_max[2] = data->volt[2]; - - data->fan_act[0] = fscscy_read_value(client, FSCSCY_REG_FAN0_ACT); - if (data->fan_min[0] > data->fan_act[0]) data->fan_min[0] = data->fan_act[0]; - if (data->fan_max[0] < data->fan_act[0]) data->fan_max[0] = data->fan_act[0]; - data->fan_act[1] = fscscy_read_value(client, FSCSCY_REG_FAN1_ACT); - if (data->fan_min[1] > data->fan_act[1]) data->fan_min[1] = data->fan_act[1]; - if (data->fan_max[1] < data->fan_act[1]) data->fan_max[1] = data->fan_act[1]; - data->fan_act[2] = fscscy_read_value(client, FSCSCY_REG_FAN2_ACT); - if (data->fan_min[2] > data->fan_act[2]) data->fan_min[2] = data->fan_act[2]; - if (data->fan_max[2] < data->fan_act[2]) data->fan_max[2] = data->fan_act[2]; - data->fan_act[3] = fscscy_read_value(client, FSCSCY_REG_FAN3_ACT); - if (data->fan_min[3] > data->fan_act[3]) data->fan_min[3] = data->fan_act[3]; - if (data->fan_max[3] < data->fan_act[3]) data->fan_max[3] = data->fan_act[3]; - data->fan_act[4] = fscscy_read_value(client, FSCSCY_REG_FAN4_ACT); - if (data->fan_min[4] > data->fan_act[4]) data->fan_min[4] = data->fan_act[4]; - if (data->fan_max[4] < data->fan_act[4]) data->fan_max[4] = data->fan_act[4]; - data->fan_act[5] = fscscy_read_value(client, FSCSCY_REG_FAN5_ACT); - if (data->fan_min[5] > data->fan_act[5]) data->fan_min[5] = data->fan_act[5]; - if (data->fan_max[5] < data->fan_act[5]) data->fan_max[5] = data->fan_act[5]; - data->fan_status[0] = fscscy_read_value(client, FSCSCY_REG_FAN0_STATE); - data->fan_status[1] = fscscy_read_value(client, FSCSCY_REG_FAN1_STATE); - data->fan_status[2] = fscscy_read_value(client, FSCSCY_REG_FAN2_STATE); - data->fan_status[3] = fscscy_read_value(client, FSCSCY_REG_FAN3_STATE); - data->fan_status[4] = fscscy_read_value(client, FSCSCY_REG_FAN4_STATE); - data->fan_status[5] = fscscy_read_value(client, FSCSCY_REG_FAN5_STATE); - data->fan_rpmmin[0] = fscscy_read_value(client, FSCSCY_REG_FAN0_RPMMIN); - data->fan_rpmmin[1] = fscscy_read_value(client, FSCSCY_REG_FAN1_RPMMIN); - data->fan_rpmmin[2] = fscscy_read_value(client, FSCSCY_REG_FAN2_RPMMIN); - data->fan_rpmmin[3] = fscscy_read_value(client, FSCSCY_REG_FAN3_RPMMIN); - data->fan_rpmmin[4] = fscscy_read_value(client, FSCSCY_REG_FAN4_RPMMIN); - data->fan_rpmmin[5] = fscscy_read_value(client, FSCSCY_REG_FAN5_RPMMIN); - data->fan_ripple[0] = fscscy_read_value(client, FSCSCY_REG_FAN0_RIPPLE); - data->fan_ripple[1] = fscscy_read_value(client, FSCSCY_REG_FAN1_RIPPLE); - data->fan_ripple[2] = fscscy_read_value(client, FSCSCY_REG_FAN2_RIPPLE); - data->fan_ripple[3] = fscscy_read_value(client, FSCSCY_REG_FAN3_RIPPLE); - data->fan_ripple[4] = fscscy_read_value(client, FSCSCY_REG_FAN4_RIPPLE); - data->fan_ripple[5] = fscscy_read_value(client, FSCSCY_REG_FAN5_RIPPLE); - - data->watchdog[0] = fscscy_read_value(client, FSCSCY_REG_WDOG_PRESET); - data->watchdog[1] = fscscy_read_value(client, FSCSCY_REG_WDOG_STATE); - data->watchdog[2] = fscscy_read_value(client, FSCSCY_REG_WDOG_CONTROL); - - data->global_event = fscscy_read_value(client, FSCSCY_REG_EVENT_STATE); - data->global_control = fscscy_read_value(client, FSCSCY_REG_CONTROL); - data->pciload = fscscy_read_value(client, FSCSCY_REG_PCILOAD); - data->intr_status = fscscy_read_value(client, FSCSCY_REG_INTR_STATE); - data->intr_control = fscscy_read_value(client, FSCSCY_REG_INTR_CTRL); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void fscscy_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscscy_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscscy_update_client(client); - switch(ctl_name) { - case FSCSCY_SYSCTL_REV: - results[0] = data->revision ; - break; - case FSCSCY_SYSCTL_EVENT: - results[0] = data->global_event & 0x9f; /* MKN */ - break; - case FSCSCY_SYSCTL_CONTROL: - results[0] = data->global_control & 0x19; /* MKN */ - break; - default: - printk("fscscy: ctl_name %d not supported\n", - ctl_name); - *nrels_mag = 0; - return; - } - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if((ctl_name == FSCSCY_SYSCTL_CONTROL) && (*nrels_mag >= 1)) { - data->global_control = (data->global_control & 0x18) | (results[0] & 0x01); /* MKN */ - printk("fscscy: writing 0x%02x to global_control\n", - data->global_control); - fscscy_write_value(client,FSCSCY_REG_CONTROL, - data->global_control); - } - else - printk("fscscy: writing to chip not supported\n"); - } -} - -#define TEMP_FROM_REG(val) (val-128) - - -void fscscy_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscscy_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscscy_update_client(client); - switch(ctl_name) { - case FSCSCY_SYSCTL_TEMP0: - results[0] = data->temp_status[0] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[0]); - results[2] = TEMP_FROM_REG(data->temp_lim[0]); - results[3] = TEMP_FROM_REG(data->temp_min[0]); - results[4] = TEMP_FROM_REG(data->temp_max[0]); - break; - case FSCSCY_SYSCTL_TEMP1: - results[0] = data->temp_status[1] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[1]); - results[2] = TEMP_FROM_REG(data->temp_lim[1]); - results[3] = TEMP_FROM_REG(data->temp_min[1]); - results[4] = TEMP_FROM_REG(data->temp_max[1]); - break; - case FSCSCY_SYSCTL_TEMP2: - results[0] = data->temp_status[2] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[2]); - results[2] = TEMP_FROM_REG(data->temp_lim[2]); - results[3] = TEMP_FROM_REG(data->temp_min[2]); - results[4] = TEMP_FROM_REG(data->temp_max[2]); - break; - case FSCSCY_SYSCTL_TEMP3: - results[0] = data->temp_status[3] & 0x03; - results[1] = TEMP_FROM_REG(data->temp_act[3]); - results[2] = TEMP_FROM_REG(data->temp_lim[3]); - results[3] = TEMP_FROM_REG(data->temp_min[3]); - results[4] = TEMP_FROM_REG(data->temp_max[3]); - break; - default: - printk("fscscy: ctl_name %d not supported\n", - ctl_name); - *nrels_mag = 0; - return; - } - *nrels_mag = 5; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if(*nrels_mag >= 1) { - switch(ctl_name) { - case FSCSCY_SYSCTL_TEMP0: - data->temp_status[0] = - (data->temp_status[0] & ~0x02) - | (results[0] & 0x02); - printk("fscscy: writing value 0x%02x " - "to temp0_status\n", - data->temp_status[0]); - fscscy_write_value(client, - FSCSCY_REG_TEMP0_STATE, - data->temp_status[0] & 0x02); - break; - case FSCSCY_SYSCTL_TEMP1: - data->temp_status[1] = (data->temp_status[1] & ~0x02) | (results[0] & 0x02); - printk("fscscy: writing value 0x%02x to temp1_status\n", data->temp_status[1]); - fscscy_write_value(client,FSCSCY_REG_TEMP1_STATE, - data->temp_status[1] & 0x02); - break; - case FSCSCY_SYSCTL_TEMP2: - data->temp_status[2] = (data->temp_status[2] & ~0x02) | (results[0] & 0x02); - printk("fscscy: writing value 0x%02x to temp2_status\n", data->temp_status[2]); - fscscy_write_value(client,FSCSCY_REG_TEMP2_STATE, - data->temp_status[2] & 0x02); - break; - case FSCSCY_SYSCTL_TEMP3: - data->temp_status[3] = (data->temp_status[3] & ~0x02) | (results[0] & 0x02); - printk("fscscy: writing value 0x%02x to temp3_status\n", data->temp_status[3]); - fscscy_write_value(client,FSCSCY_REG_TEMP3_STATE, - data->temp_status[3] & 0x02); - break; - default: - printk("fscscy: ctl_name %d not supported\n",ctl_name); - } - } - else - printk("fscscy: writing to chip not supported\n"); - } -} - -#define VOLT_FROM_REG(val,mult) (val*mult/255) - -void fscscy_volt(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscscy_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - fscscy_update_client(client); - switch(ctl_name) { - case FSCSCY_SYSCTL_VOLT0: - results[0] = VOLT_FROM_REG(data->volt[0],1420); - results[1] = VOLT_FROM_REG(data->volt_min[0],1420); - results[2] = VOLT_FROM_REG(data->volt_max[0],1420); - break; - case FSCSCY_SYSCTL_VOLT1: - results[0] = VOLT_FROM_REG(data->volt[1],660); - results[1] = VOLT_FROM_REG(data->volt_min[1],660); - results[2] = VOLT_FROM_REG(data->volt_max[1],660); - break; - case FSCSCY_SYSCTL_VOLT2: - results[0] = VOLT_FROM_REG(data->volt[2],330); - results[1] = VOLT_FROM_REG(data->volt_min[2],330); - results[2] = VOLT_FROM_REG(data->volt_max[2],330); - break; - default: - printk("fscscy: ctl_name %d not supported\n", - ctl_name); - *nrels_mag = 0; - return; - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - printk("fscscy: writing to chip not supported\n"); - } -} - -void fscscy_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - - switch(ctl_name) { - case FSCSCY_SYSCTL_FAN0: - fscscy_fan_internal(client,operation,ctl_name,nrels_mag,results, - 0,FSCSCY_REG_FAN0_STATE,FSCSCY_REG_FAN0_RPMMIN, - FSCSCY_REG_FAN0_RIPPLE); - break; - case FSCSCY_SYSCTL_FAN1: - fscscy_fan_internal(client,operation,ctl_name,nrels_mag,results, - 1,FSCSCY_REG_FAN1_STATE,FSCSCY_REG_FAN1_RPMMIN, - FSCSCY_REG_FAN1_RIPPLE); - break; - case FSCSCY_SYSCTL_FAN2: - fscscy_fan_internal(client,operation,ctl_name,nrels_mag,results, - 2,FSCSCY_REG_FAN2_STATE,FSCSCY_REG_FAN2_RPMMIN, - FSCSCY_REG_FAN2_RIPPLE); - break; - case FSCSCY_SYSCTL_FAN3: - fscscy_fan_internal(client,operation,ctl_name,nrels_mag,results, - 3,FSCSCY_REG_FAN3_STATE,FSCSCY_REG_FAN3_RPMMIN, - FSCSCY_REG_FAN3_RIPPLE); - break; - case FSCSCY_SYSCTL_FAN4: - fscscy_fan_internal(client,operation,ctl_name,nrels_mag,results, - 4,FSCSCY_REG_FAN4_STATE,FSCSCY_REG_FAN4_RPMMIN, - FSCSCY_REG_FAN4_RIPPLE); - break; - case FSCSCY_SYSCTL_FAN5: - fscscy_fan_internal(client,operation,ctl_name,nrels_mag,results, - 5,FSCSCY_REG_FAN5_STATE,FSCSCY_REG_FAN5_RPMMIN, - FSCSCY_REG_FAN5_RIPPLE); - break; - default: - printk("fscscy: illegal fan nr %d\n",ctl_name); - } -} - -#define RPM_FROM_REG(val) (val*60) - -void fscscy_fan_internal(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results, int nr, - int reg_state, int reg_min, int reg_ripple ) -{ - struct fscscy_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscscy_update_client(client); - results[0] = data->fan_status[nr] & 0x0f; /* MKN */ - results[1] = data->fan_rpmmin[nr]; - results[2] = data->fan_ripple[nr] & 0x03; - results[3] = RPM_FROM_REG(data->fan_act[nr]); - results[4] = RPM_FROM_REG(data->fan_min[nr]); - results[5] = RPM_FROM_REG(data->fan_max[nr]); - *nrels_mag = 6; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if(*nrels_mag >= 1) { - data->fan_status[nr] = (data->fan_status[nr] & 0x0b) | (results[0] & 0x04); /* MKN */ - printk("fscscy: writing value 0x%02x to fan%d_status\n", - data->fan_status[nr],nr); - fscscy_write_value(client,reg_state, - data->fan_status[nr]); - } - if(*nrels_mag >= 2) { - if((results[1] & 0xff) == 0) { - printk("fscscy: fan%d rpmmin 0 not allowed for safety reasons\n",nr); - return; - } - data->fan_rpmmin[nr] = results[1]; - printk("fscscy: writing value 0x%02x to fan%d_min\n", - data->fan_rpmmin[nr],nr); - fscscy_write_value(client,reg_min, - data->fan_rpmmin[nr]); - } - if(*nrels_mag >= 3) { - if((results[2] & 0x03) == 0) { - printk("fscscy: fan%d ripple 0 is nonsense/not allowed\n",nr); - return; - } - data->fan_ripple[nr] = results[2] & 0x03; - printk("fscscy: writing value 0x%02x to fan%d_ripple\n", - data->fan_ripple[nr],nr); - fscscy_write_value(client,reg_ripple, - data->fan_ripple[nr]); - } - } -} - -void fscscy_wdog(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscscy_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscscy_update_client(client); - results[0] = data->watchdog[0] ; - results[1] = data->watchdog[1] & 0x02; - results[2] = data->watchdog[2] & 0xb0; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->watchdog[0] = results[0] & 0xff; - printk("fscscy: writing value 0x%02x to wdog_preset\n", - data->watchdog[0]); - fscscy_write_value(client,FSCSCY_REG_WDOG_PRESET, - data->watchdog[0]); - } - if (*nrels_mag >= 2) { - data->watchdog[1] = results[1] & 0x02; - printk("fscscy: writing value 0x%02x to wdog_state\n", - data->watchdog[1]); - fscscy_write_value(client,FSCSCY_REG_WDOG_STATE, - data->watchdog[1]); - } - if (*nrels_mag >= 3) { - data->watchdog[2] = results[2] & 0xb0; - printk("fscscy: writing value 0x%02x to wdog_control\n", - data->watchdog[2]); - fscscy_write_value(client,FSCSCY_REG_WDOG_CONTROL, - data->watchdog[2]); - } - } -} - -void fscscy_pciload(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscscy_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscscy_update_client(client); - results[0] = data->pciload; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - printk("fscscy: writing PCILOAD to chip not supported\n"); - } -} - -void fscscy_intrusion(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct fscscy_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - fscscy_update_client(client); - results[0] = data->intr_control & 0x80; - results[1] = data->intr_status & 0xc0; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->intr_control = results[0] & 0x80; - printk("fscscy: writing value 0x%02x to intr_control\n", - data->intr_control); - fscscy_write_value(client,FSCSCY_REG_INTR_CTRL, - data->intr_control); - } - } -} - -static int __init sm_fscscy_init(void) -{ - printk("fscscy.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&fscscy_driver); -} - -static void __exit sm_fscscy_exit(void) -{ - i2c_del_driver(&fscscy_driver); -} - - - -MODULE_AUTHOR - ("Martin Knoblauch based on work (fscpos) from Hermann Jung "); -MODULE_DESCRIPTION("fujitsu siemens scylla chip driver"); - -module_init(sm_fscscy_init); -module_exit(sm_fscscy_exit); diff --git a/kernel/chips/gl518sm.c b/kernel/chips/gl518sm.c deleted file mode 100644 index 28ab32f2..00000000 --- a/kernel/chips/gl518sm.c +++ /dev/null @@ -1,987 +0,0 @@ -/* - gl518sm.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard , - Kyösti Mälkki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include -#include -#include -#ifdef __SMP__ -#include -#endif -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x2c, 0x2d, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_2(gl518sm_r00, gl518sm_r80); - -/* Defining this will enable debug messages for the voltage iteration - code used with rev 0 ICs */ -#undef DEBUG_VIN - -/* Many GL518 constants specified below */ - -/* The GL518 registers */ -#define GL518_REG_CHIP_ID 0x00 -#define GL518_REG_REVISION 0x01 -#define GL518_REG_VENDOR_ID 0x02 -#define GL518_REG_CONF 0x03 -#define GL518_REG_TEMP 0x04 -#define GL518_REG_TEMP_OVER 0x05 -#define GL518_REG_TEMP_HYST 0x06 -#define GL518_REG_FAN_COUNT 0x07 -#define GL518_REG_FAN_LIMIT 0x08 -#define GL518_REG_VIN1_LIMIT 0x09 -#define GL518_REG_VIN2_LIMIT 0x0a -#define GL518_REG_VIN3_LIMIT 0x0b -#define GL518_REG_VDD_LIMIT 0x0c -#define GL518_REG_VIN3 0x0d -#define GL518_REG_MISC 0x0f -#define GL518_REG_ALARM 0x10 -#define GL518_REG_MASK 0x11 -#define GL518_REG_INT 0x12 -#define GL518_REG_VIN2 0x13 -#define GL518_REG_VIN1 0x14 -#define GL518_REG_VDD 0x15 - - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ - -#define TEMP_TO_REG(val) (SENSORS_LIMIT(((((val)<0?(val)-5:(val)+5) / 10)+119),\ - 0,255)) -#define TEMP_FROM_REG(val) (((val) - 119) * 10) - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((960000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) \ - ( (val)==0 ? 0 : (val)==255 ? 0 : (960000/((val)*(div))) ) - -#define IN_TO_REG(val) (SENSORS_LIMIT((((val)*10+8)/19),0,255)) -#define IN_FROM_REG(val) (((val)*19)/10) - -#define VDD_TO_REG(val) (SENSORS_LIMIT((((val)*10+11)/23),0,255)) -#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)) - -#define ALARMS_FROM_REG(val) val - -#define BEEP_ENABLE_TO_REG(val) ((val)?0:1) -#define BEEP_ENABLE_FROM_REG(val) ((val)?0:1) - -#define BEEPS_TO_REG(val) ((val) & 0x7f) -#define BEEPS_FROM_REG(val) ((val) & 0x7f) - -/* Each client has this additional data */ -struct gl518_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - - int iterate_lock; - int quit_thread; - struct task_struct *thread; - wait_queue_head_t wq; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long last_updated_v00; - /* In jiffies (used only by rev00 chips) */ - - u8 voltage[4]; /* Register values; [0] = VDD */ - u8 voltage_min[4]; /* Register values; [0] = VDD */ - u8 voltage_max[4]; /* Register values; [0] = VDD */ - u8 iter_voltage[4]; /* Register values; [0] = VDD */ - u8 fan[2]; - u8 fan_min[2]; - u8 temp; /* Register values */ - u8 temp_over; /* Register values */ - u8 temp_hyst; /* Register values */ - u8 alarms, beeps; /* Register value */ - u8 alarm_mask; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ - u8 beep_enable; /* Boolean */ - u8 iterate; /* Voltage iteration mode */ -}; - -static int gl518_attach_adapter(struct i2c_adapter *adapter); -static int gl518_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void gl518_init_client(struct i2c_client *client); -static int gl518_detach_client(struct i2c_client *client); - -static int gl518_read_value(struct i2c_client *client, u8 reg); -static int gl518_write_value(struct i2c_client *client, u8 reg, u16 value); -static void gl518_update_client(struct i2c_client *client); - -static void gl518_update_client_rev00(struct i2c_client *client); -static void gl518_update_iterate(struct i2c_client *client); - -static void gl518_vin(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl518_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl518_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl518_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl518_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl518_beep(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl518_fan1off(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl518_iterate(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -/* This is the driver that will be inserted */ -static struct i2c_driver gl518_driver = { - .name = "GL518SM sensor chip driver", - .id = I2C_DRIVERID_GL518, - .flags = I2C_DF_NOTIFY, - .attach_adapter = gl518_attach_adapter, - .detach_client = gl518_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define GL518_SYSCTL_VDD 1000 /* Volts * 100 */ -#define GL518_SYSCTL_VIN1 1001 -#define GL518_SYSCTL_VIN2 1002 -#define GL518_SYSCTL_VIN3 1003 -#define GL518_SYSCTL_FAN1 1101 /* RPM */ -#define GL518_SYSCTL_FAN2 1102 -#define GL518_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ -#define GL518_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define GL518_SYSCTL_ALARMS 2001 /* bitvector */ -#define GL518_SYSCTL_BEEP 2002 /* bitvector */ -#define GL518_SYSCTL_FAN1OFF 2003 -#define GL518_SYSCTL_ITERATE 2004 - -#define GL518_ALARM_VDD 0x01 -#define GL518_ALARM_VIN1 0x02 -#define GL518_ALARM_VIN2 0x04 -#define GL518_ALARM_VIN3 0x08 -#define GL518_ALARM_TEMP 0x10 -#define GL518_ALARM_FAN1 0x20 -#define GL518_ALARM_FAN2 0x40 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected GL518. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table gl518_dir_table_template[] = { - {GL518_SYSCTL_VIN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_vin}, - {GL518_SYSCTL_VIN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_vin}, - {GL518_SYSCTL_VIN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_vin}, - {GL518_SYSCTL_VDD, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_vin}, - {GL518_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_fan}, - {GL518_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_fan}, - {GL518_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_temp}, - {GL518_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_fan_div}, - {GL518_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_alarms}, - {GL518_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_beep}, - {GL518_SYSCTL_FAN1OFF, "fan1off", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_fan1off}, - {GL518_SYSCTL_ITERATE, "iterate", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl518_iterate}, - {0} -}; - -/* I choose here for semi-static GL518SM allocation. Complete dynamic - allocation could also be used; the code needed for this would probably - take more memory than the datastructure takes now. */ -#define MAX_GL518_NR 4 -static struct i2c_client *gl518_list[MAX_GL518_NR]; - -static int gl518_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, gl518_detect); -} - -static int gl518_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct gl518_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("gl518sm.o: gl518_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access gl518_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct gl518_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &gl518_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - if (kind < 0) { - if ( - (gl518_read_value(new_client, GL518_REG_CHIP_ID) != - 0x80) - || (gl518_read_value(new_client, GL518_REG_CONF) & - 0x80)) goto ERROR1; - } - - /* Determine the chip type. */ - if (kind <= 0) { - i = gl518_read_value(new_client, GL518_REG_REVISION); - if (i == 0x00) - kind = gl518sm_r00; - else if (i == 0x80) - kind = gl518sm_r80; - else { - if (kind == 0) - printk - ("gl518sm.o: Ignoring 'force' parameter for unknown chip at " - "adapter %d, address 0x%02x\n", - i2c_adapter_id(adapter), address); - goto ERROR1; - } - } - - type_name = "gl518sm"; - if (kind == gl518sm_r00) { - client_name = "GL518SM Revision 0x00 chip"; - } else if (kind == gl518sm_r80) { - client_name = "GL518SM Revision 0x80 chip"; - } else { -#ifdef DEBUG - printk("gl518sm.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - - for (i = 0; i < MAX_GL518_NR; i++) - if (!gl518_list[i]) - break; - if (i == MAX_GL518_NR) { - printk - ("gl518sm.o: No empty slots left, recompile and heighten " - "MAX_GL518_NR!\n"); - err = -ENOMEM; - goto ERROR2; - } - gl518_list[i] = new_client; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry((struct i2c_client *) new_client, - type_name, - gl518_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the GL518SM chip */ - if (kind == gl518sm_r00) - data->iterate = 0; - else - data->iterate = 3; - data->iterate_lock = 0; - data->quit_thread = 0; - data->thread = NULL; - data->alarm_mask = 0xff; - data->voltage[0]=data->voltage[1]=data->voltage[2]=0; - gl518_init_client((struct i2c_client *) new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - for (i = 0; i < MAX_GL518_NR; i++) - if (new_client == gl518_list[i]) - gl518_list[i] = NULL; - ERROR2: - ERROR1: - kfree(data); - ERROR0: - return err; -} - - -/* Called when we have found a new GL518SM. */ -static void gl518_init_client(struct i2c_client *client) -{ - /* Power-on defaults (bit 7=1) */ - gl518_write_value(client, GL518_REG_CONF, 0x80); - - /* No noisy output (bit 2=1), Comparator mode (bit 3=0), two fans (bit4=0), - standby mode (bit6=0) */ - gl518_write_value(client, GL518_REG_CONF, 0x04); - - /* Never interrupts */ - gl518_write_value(client, GL518_REG_MASK, 0x00); - - /* Clear status register (bit 5=1), start (bit6=1) */ - gl518_write_value(client, GL518_REG_CONF, 0x24); - gl518_write_value(client, GL518_REG_CONF, 0x44); -} - -static int gl518_detach_client(struct i2c_client *client) -{ - int err, i; - struct gl518_data *data = client->data; - - i2c_deregister_entry(((struct gl518_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("gl518sm.o: Client deregistration failed, client not detached.\n"); - return err; - } - - for (i = 0; i < MAX_GL518_NR; i++) - if (client == gl518_list[i]) - break; - if ((i == MAX_GL518_NR)) { - printk("gl518sm.o: Client to detach not found.\n"); - return -ENOENT; - } - gl518_list[i] = NULL; - - if (data->thread) { - data->quit_thread = 1; - wake_up_interruptible(&data->wq); - } - - kfree(client->data); - - return 0; -} - - -/* Registers 0x07 to 0x0c are word-sized, others are byte-sized - GL518 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int gl518_read_value(struct i2c_client *client, u8 reg) -{ - if ((reg >= 0x07) && (reg <= 0x0c)) - return swab16(i2c_smbus_read_word_data(client, reg)); - else - return i2c_smbus_read_byte_data(client, reg); -} - -/* Registers 0x07 to 0x0c are word-sized, others are byte-sized - GL518 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int gl518_write_value(struct i2c_client *client, u8 reg, u16 value) -{ - if ((reg >= 0x07) && (reg <= 0x0c)) - return i2c_smbus_write_word_data(client, reg, swab16(value)); - else - return i2c_smbus_write_byte_data(client, reg, value); -} - -static void gl518_update_client(struct i2c_client *client) -{ - struct gl518_data *data = client->data; - int val; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting gl518 update\n"); -#endif - - data->alarms = gl518_read_value(client, GL518_REG_INT); - data->beeps = gl518_read_value(client, GL518_REG_ALARM); - - val = gl518_read_value(client, GL518_REG_VDD_LIMIT); - data->voltage_min[0] = val & 0xff; - data->voltage_max[0] = (val >> 8) & 0xff; - val = gl518_read_value(client, GL518_REG_VIN1_LIMIT); - data->voltage_min[1] = val & 0xff; - data->voltage_max[1] = (val >> 8) & 0xff; - val = gl518_read_value(client, GL518_REG_VIN2_LIMIT); - data->voltage_min[2] = val & 0xff; - data->voltage_max[2] = (val >> 8) & 0xff; - val = gl518_read_value(client, GL518_REG_VIN3_LIMIT); - data->voltage_min[3] = val & 0xff; - data->voltage_max[3] = (val >> 8) & 0xff; - - val = gl518_read_value(client, GL518_REG_FAN_COUNT); - data->fan[0] = (val >> 8) & 0xff; - data->fan[1] = val & 0xff; - - val = gl518_read_value(client, GL518_REG_FAN_LIMIT); - data->fan_min[0] = (val >> 8) & 0xff; - data->fan_min[1] = val & 0xff; - - data->temp = gl518_read_value(client, GL518_REG_TEMP); - data->temp_over = - gl518_read_value(client, GL518_REG_TEMP_OVER); - data->temp_hyst = - gl518_read_value(client, GL518_REG_TEMP_HYST); - - val = gl518_read_value(client, GL518_REG_MISC); - data->fan_div[0] = (val >> 6) & 0x03; - data->fan_div[1] = (val >> 4) & 0x03; - - data->alarms &= data->alarm_mask; - - val = gl518_read_value(client, GL518_REG_CONF); - data->beep_enable = (val >> 2) & 1; - -#ifndef DEBUG_VIN - if (data->type != gl518sm_r00) { - data->voltage[0] = - gl518_read_value(client, GL518_REG_VDD); - data->voltage[1] = - gl518_read_value(client, GL518_REG_VIN1); - data->voltage[2] = - gl518_read_value(client, GL518_REG_VIN2); - data->voltage[3] = - gl518_read_value(client, GL518_REG_VIN3); - } else - gl518_update_client_rev00(client); -#else - gl518_update_client_rev00(client); -#endif - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -/* Here we decide how to run the iteration code. - When called, we trigger the iteration and report the last - measured voltage. No delay for user apps */ -static void gl518_update_client_rev00(struct i2c_client *client) -{ - struct gl518_data *data = client->data; - int i; - - if (data->iterate == 1) { /* 10 sec delay */ - /* as that update is slow, we consider the data valid for 30 seconds */ - if ( - ((jiffies - data->last_updated_v00 > 30 * HZ) - || (data->alarms & 7) - || (!data->valid)) && (!data->iterate_lock)) { - data->iterate_lock = 1; - gl518_update_iterate(client); - data->iterate_lock = 0; - } - for (i = 0; i < 4; i++) - data->voltage[i] = data->iter_voltage[i]; - } else if (data->iterate == 2) { /* show results of last iteration */ - for (i = 0; i < 4; i++) - data->voltage[i] = data->iter_voltage[i]; - wake_up_interruptible(&data->wq); - } else { /* no iteration */ - data->voltage[3] = - gl518_read_value(client, GL518_REG_VIN3); - } -} - -static int gl518_update_thread(void *c) -{ - struct i2c_client *client = c; - struct gl518_data *data = client->data; - -#ifdef __SMP__ - lock_kernel(); -#endif - exit_mm(current); - current->session = 1; - current->pgrp = 1; - sigfillset(¤t->blocked); - current->fs->umask = 0; - strcpy(current->comm, "gl518sm"); - - init_waitqueue_head(&(data->wq)); - data->thread = current; - -#ifdef __SMP__ - unlock_kernel(); -#endif - - for (;;) { - if (!data->iterate_lock) { - data->iterate_lock = 1; - gl518_update_iterate(client); - data->iterate_lock = 0; - } - - if ((data->quit_thread) || signal_pending(current)) - break; - interruptible_sleep_on(&data->wq); - } - - data->thread = NULL; - data->quit_thread = 0; - return 0; -} - -/* This updates vdd, vin1, vin2 values by doing slow and multiple - comparisons for the GL518SM rev 00 that lacks support for direct - reading of these values. Values are kept in iter_voltage */ - -static void gl518_update_iterate(struct i2c_client *client) -{ - struct gl518_data *data = client->data; - int i, j, loop_more = 1, min[3], max[3], delta[3]; - int alarm, beeps, irqs; - -#define VIN_REG(c) c==0?GL518_REG_VDD_LIMIT:\ - c==1?GL518_REG_VIN1_LIMIT:\ - GL518_REG_VIN2_LIMIT - - /* disable beeps & irqs for vin0-2 */ - beeps = gl518_read_value(client, GL518_REG_ALARM); - irqs = gl518_read_value(client, GL518_REG_MASK); - gl518_write_value(client, GL518_REG_ALARM, beeps & ~0x7); - gl518_write_value(client, GL518_REG_MASK, irqs & ~0x7); - - alarm = data->alarms; - - for (i = 0; i < 3; i++) { - if (alarm & (1 << i)) { - min[i] = 0; - max[i] = 127; - } else { - min[i] = data->voltage_min[i]; - max[i] = - (data->voltage_max[i] + - data->voltage_min[i]) / 2; - } - delta[i] = (max[i] - min[i]) / 2; - } - - for (j = 0; (j < 10 && loop_more); j++) { - - for (i = 0; i < 3; i++) - gl518_write_value(client, VIN_REG(i), - max[i] << 8 | min[i]); - - if ((data->thread) && - ((data->quit_thread) || signal_pending(current))) - goto finish; - - /* we wait now 1.5 seconds before comparing */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(HZ + HZ / 2); - - alarm = gl518_read_value(client, GL518_REG_INT); - -#ifdef DEBUG_VIN - printk("gl518sm: iteration %2d: %4d%c %4d%c %4d%c\n", j, - max[0], (alarm & 1) ? '!' : ' ', - max[1], (alarm & 2) ? '!' : ' ', - max[2], (alarm & 4) ? '!' : ' '); -#endif - - for (loop_more = 0, i = 0; i < 3; i++) { - if (alarm & (1 << i)) - max[i] += delta[i]; - else - max[i] -= delta[i]; - - if (delta[i]) - loop_more++; - delta[i] >>= 1; - } - - } - - for (i = 0; i < 3; i++) - if (alarm & (1 << i)) - max[i]++; - -#ifdef DEBUG_VIN - printk("gl518sm: final :%5d %5d %5d\n", max[0], max[1], - max[2]); - printk("gl518sm: meter :%5d %5d %5d\n", data->voltage[0], - data->voltage[1], data->voltage[2]); -#endif - - /* update values, including vin3 */ - for (i = 0; i < 3; i++) { - data->iter_voltage[i] = max[i]; - } - data->iter_voltage[3] = gl518_read_value(client, GL518_REG_VIN3); - data->last_updated_v00 = jiffies; - - finish: - - /* reset values */ - for (i = 0; i < 3; i++) { - gl518_write_value(client, VIN_REG(i), - data->voltage_max[i] << 8 | data-> - voltage_min[i]); - } - - gl518_write_value(client, GL518_REG_ALARM, beeps); - gl518_write_value(client, GL518_REG_MASK, irqs); - -#undef VIN_REG -} - -void gl518_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl518_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - gl518_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_over); - results[1] = TEMP_FROM_REG(data->temp_hyst); - results[2] = TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_over = TEMP_TO_REG(results[0]); - gl518_write_value(client, GL518_REG_TEMP_OVER, - data->temp_over); - } - if (*nrels_mag >= 2) { - data->temp_hyst = TEMP_TO_REG(results[1]); - gl518_write_value(client, GL518_REG_TEMP_HYST, - data->temp_hyst); - } - } -} - -void gl518_vin(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl518_data *data = client->data; - int nr = ctl_name - GL518_SYSCTL_VDD; - int regnr, old = 0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - gl518_update_client(client); - 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]); - 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 ? GL518_REG_VIN2_LIMIT : GL518_REG_VIN3_LIMIT; - if (*nrels_mag == 1) - old = gl518_read_value(client, regnr) & 0xff00; - if (*nrels_mag >= 2) { - 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] = - nr ? IN_TO_REG(results[0]) : - VDD_TO_REG(results[0]); - old |= data->voltage_min[nr]; - gl518_write_value(client, regnr, old); - } - } -} - - -void gl518_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl518_data *data = client->data; - int nr = ctl_name - GL518_SYSCTL_FAN1; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - gl518_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr], - DIV_FROM_REG(data->fan_div[nr])); - results[1] = - FAN_FROM_REG(data->fan[nr], - DIV_FROM_REG(data->fan_div[nr])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr] = FAN_TO_REG(results[0], - DIV_FROM_REG(data-> - fan_div - [nr])); - old = - gl518_read_value(client, GL518_REG_FAN_LIMIT); - - if (nr == 0) { - old = - (old & 0x00ff) | (data-> - fan_min[0] << 8); - if (results[0] == 0) - data->alarm_mask &= ~0x20; - else - data->alarm_mask |= 0x20; - } else { - old = (old & 0xff00) | data->fan_min[1]; - if (results[0] == 0) - data->alarm_mask &= ~0x40; - else - data->alarm_mask |= 0x40; - } - gl518_write_value(client, GL518_REG_FAN_LIMIT, - old); - } - } -} - - -void gl518_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl518_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - gl518_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -void gl518_beep(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl518_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - gl518_update_client(client); - results[0] = BEEP_ENABLE_FROM_REG(data->beep_enable); - results[1] = BEEPS_FROM_REG(data->beeps); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->beep_enable = BEEP_ENABLE_TO_REG(results[0]); - gl518_write_value(client, GL518_REG_CONF, - (gl518_read_value(client, - GL518_REG_CONF) - & 0xfb) | (data-> - beep_enable << 2)); - } - if (*nrels_mag >= 2) { - data->beeps = - BEEPS_TO_REG(results[1]) & data->alarm_mask; - gl518_write_value(client, GL518_REG_ALARM, - data->beeps); - } - } -} - - -void gl518_fan_div(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl518_data *data = client->data; - int old; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - gl518_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = gl518_read_value(client, GL518_REG_MISC); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0xcf) | (data->fan_div[1] << 4); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0x3f) | (data->fan_div[0] << 6); - } - gl518_write_value(client, GL518_REG_MISC, old); - } -} - -void gl518_fan1off(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - int old; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = - ((gl518_read_value(client, GL518_REG_MISC) & 0x08) != - 0); - results[1] = - ((gl518_read_value(client, GL518_REG_CONF) & 0x10) != - 0); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - old = - gl518_read_value(client, - GL518_REG_MISC) & 0xf7; - if (results[0]) - old |= 0x08; - gl518_write_value(client, GL518_REG_MISC, old); - } - if (*nrels_mag >= 2) { - old = - gl518_read_value(client, - GL518_REG_CONF) & 0xef; - if (results[1]) - old |= 0x10; - gl518_write_value(client, GL518_REG_CONF, old); - } - } -} - -void gl518_iterate(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl518_data *data = client->data; - int i; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->iterate; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE && - data->type == gl518sm_r00 ) { - if ((*nrels_mag >= 1) && (data->iterate != results[0])) { - data->iterate = results[0]; - for (i = 0; i < 4; i++) { - data->voltage[i] = 0; - data->iter_voltage[i] = 0; - } - data->valid = 0; - - if ((data->iterate != 2) && (data->thread)) { - data->quit_thread = 1; - wake_up_interruptible(&data->wq); - } else if ((data->iterate == 2) && (!data->thread)) { - init_waitqueue_head(&(data->wq)); - kernel_thread(gl518_update_thread, - (void *) client, 0); - } - } - } -} - -static int __init sm_gl518sm_init(void) -{ - printk("gl518sm.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&gl518_driver); -} - -static void __exit sm_gl518sm_exit(void) -{ - i2c_del_driver(&gl518_driver); -} - - - -MODULE_AUTHOR - ("Frodo Looijaard and Kyösti Mälkki "); -MODULE_DESCRIPTION("GL518SM driver"); - -module_init(sm_gl518sm_init); -module_exit(sm_gl518sm_exit); diff --git a/kernel/chips/gl520sm.c b/kernel/chips/gl520sm.c deleted file mode 100644 index 39e703c3..00000000 --- a/kernel/chips/gl520sm.c +++ /dev/null @@ -1,804 +0,0 @@ -/* - gl520sm.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard , - Kyösti Mälkki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x2c, 0x2d, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(gl520sm); - -/* Many GL520 constants specified below -One of the inputs can be configured as either temp or voltage. -That's why _TEMP2 and _VIN4 access the same register -*/ - -/* The GL520 registers */ -#define GL520_REG_CHIP_ID 0x00 -#define GL520_REG_REVISION 0x01 -#define GL520_REG_VID 0x02 -#define GL520_REG_CONF 0x03 -#define GL520_REG_TEMP1 0x04 -#define GL520_REG_TEMP1_OVER 0x05 -#define GL520_REG_TEMP1_HYST 0x06 -#define GL520_REG_FAN_COUNT 0x07 -#define GL520_REG_FAN_LIMIT 0x08 -#define GL520_REG_VIN1_LIMIT 0x09 -#define GL520_REG_VIN2_LIMIT 0x0a -#define GL520_REG_VIN3_LIMIT 0x0b -#define GL520_REG_VDD_LIMIT 0x0c -#define GL520_REG_VIN3 0x0d -#define GL520_REG_VIN4 0x0e -#define GL520_REG_TEMP2 0x0e -#define GL520_REG_MISC 0x0f -#define GL520_REG_ALARM 0x10 -#define GL520_REG_MASK 0x11 -#define GL520_REG_INT 0x12 -#define GL520_REG_VIN2 0x13 -#define GL520_REG_VIN1 0x14 -#define GL520_REG_VDD 0x15 -#define GL520_REG_TEMP2_OVER 0x17 -#define GL520_REG_VIN4_MAX 0x17 -#define GL520_REG_TEMP2_HYST 0x18 -#define GL520_REG_VIN4_MIN 0x18 - - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ - -#define TEMP_TO_REG(val) (SENSORS_LIMIT(((((val)<0?(val)-5:(val)+5) / 10)+130),\ - 0,255)) -#define TEMP_FROM_REG(val) (((val) - 130) * 10) - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((960000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) \ - ( (val)==0 ? 0 : (val)==255 ? 0 : (960000/((val)*(div))) ) - -#define IN_TO_REG(val) (SENSORS_LIMIT((((val)*10+8)/19),0,255)) -#define IN_FROM_REG(val) (((val)*19)/10) - -#define VDD_TO_REG(val) (SENSORS_LIMIT((((val)*10+11)/23),0,255)) -#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)) - -#define ALARMS_FROM_REG(val) val - -#define BEEP_ENABLE_TO_REG(val) ((val)?0:1) -#define BEEP_ENABLE_FROM_REG(val) ((val)?0:1) - -#define BEEPS_TO_REG(val) (val) -#define BEEPS_FROM_REG(val) (val) - -#define VID_FROM_REG(val) ((val)==0x1f?0:(val)>=0x10?510-(val)*10:\ - 205-(val)*5) - -/* Each client has this additional data */ -struct gl520_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 voltage[5]; /* Register values; [0] = VDD */ - u8 voltage_min[5]; /* Register values; [0] = VDD */ - u8 voltage_max[5]; /* Register values; [0] = VDD */ - u8 fan[2]; - u8 fan_min[2]; - u8 temp[2]; /* Register values */ - u8 temp_over[2]; /* Register values */ - u8 temp_hyst[2]; /* Register values */ - u8 alarms, beeps, vid; /* Register value */ - u8 alarm_mask; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ - u8 beep_enable; /* Boolean */ - u8 two_temps; /* Boolean */ -}; - -static int gl520_attach_adapter(struct i2c_adapter *adapter); -static int gl520_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void gl520_init_client(struct i2c_client *client); -static int gl520_detach_client(struct i2c_client *client); - -static int gl520_read_value(struct i2c_client *client, u8 reg); -static int gl520_write_value(struct i2c_client *client, u8 reg, u16 value); -static void gl520_update_client(struct i2c_client *client); - -static void gl520_vin(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl520_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl520_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl520_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl520_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl520_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl520_beep(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl520_fan1off(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void gl520_config(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -/* This is the driver that will be inserted */ -static struct i2c_driver gl520_driver = { - .name = "GL520SM sensor chip driver", - .id = I2C_DRIVERID_GL520, - .flags = I2C_DF_NOTIFY, - .attach_adapter = gl520_attach_adapter, - .detach_client = gl520_detach_client, -}; -/* -- SENSORS SYSCTL START -- */ - -#define GL520_SYSCTL_VDD 1000 /* Volts * 100 */ -#define GL520_SYSCTL_VIN1 1001 -#define GL520_SYSCTL_VIN2 1002 -#define GL520_SYSCTL_VIN3 1003 -#define GL520_SYSCTL_VIN4 1004 -#define GL520_SYSCTL_FAN1 1101 /* RPM */ -#define GL520_SYSCTL_FAN2 1102 -#define GL520_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define GL520_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define GL520_SYSCTL_VID 1300 -#define GL520_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define GL520_SYSCTL_ALARMS 2001 /* bitvector */ -#define GL520_SYSCTL_BEEP 2002 /* bitvector */ -#define GL520_SYSCTL_FAN1OFF 2003 -#define GL520_SYSCTL_CONFIG 2004 - -#define GL520_ALARM_VDD 0x01 -#define GL520_ALARM_VIN1 0x02 -#define GL520_ALARM_VIN2 0x04 -#define GL520_ALARM_VIN3 0x08 -#define GL520_ALARM_TEMP1 0x10 -#define GL520_ALARM_FAN1 0x20 -#define GL520_ALARM_FAN2 0x40 -#define GL520_ALARM_TEMP2 0x80 -#define GL520_ALARM_VIN4 0x80 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected GL520. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table gl520_dir_table_template[] = { - {GL520_SYSCTL_VIN1, "vin1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_vin}, - {GL520_SYSCTL_VIN2, "vin2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_vin}, - {GL520_SYSCTL_VIN3, "vin3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_vin}, - {GL520_SYSCTL_VIN4, "vin4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_vin}, - {GL520_SYSCTL_VDD, "vdd", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_vin}, - {GL520_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_vid}, - {GL520_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_fan}, - {GL520_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_fan}, - {GL520_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_temp}, - {GL520_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_temp}, - {GL520_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_fan_div}, - {GL520_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_alarms}, - {GL520_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_beep}, - {GL520_SYSCTL_FAN1OFF, "fan1off", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_fan1off}, - {GL520_SYSCTL_CONFIG, "config", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &gl520_config}, - {0} -}; - -static int gl520_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, gl520_detect); -} - -static int gl520_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct gl520_data *data; - int err = 0; - const char *type_name = ""; - char client_name[32]; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("gl520sm.o: gl520_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access gl520_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct gl520_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &gl520_driver; - new_client->flags = 0; - - /* Determine the chip type. */ - - if (gl520_read_value(new_client, GL520_REG_CHIP_ID) != 0x20) { - printk - ("gl520sm.o: Ignoring 'force' parameter for unknown chip at " - "adapter %d, address 0x%02x\n", - i2c_adapter_id(adapter), address); - goto ERROR1; - } else { - kind = gl520sm; - } - - i = gl520_read_value(new_client, GL520_REG_REVISION); - if (kind == gl520sm) { - type_name = "gl520sm"; - sprintf(client_name, "GL520SM Revision %02x chip", i); - } else { -#ifdef DEBUG - printk("gl520sm.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - gl520_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the GL520SM chip */ - data->alarm_mask = 0xff; - gl520_init_client(new_client); - if (data->two_temps) - data->voltage_max[4] = data->voltage_min[4] = - data->voltage[4] = 0; - else - data->temp_hyst[1] = data->temp_over[1] = - data->temp[1] = 0; - - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - - -/* Called when we have found a new GL520SM. */ -static void gl520_init_client(struct i2c_client *client) -{ - struct gl520_data *data = (struct gl520_data *)(client->data); - u8 oldconf, conf; - - conf = oldconf = gl520_read_value(client, GL520_REG_CONF); - data->two_temps = !(conf & 0x10); - - /* If IRQ# is disabled, we can safely force comparator mode */ - if (!(conf & 0x20)) - conf &= 0xf7; - - /* Enable monitoring if needed */ - conf |= 0x40; - - if (conf != oldconf) - gl520_write_value(client, GL520_REG_CONF, conf); -} - -static int gl520_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct gl520_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("gl520sm.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -/* Registers 0x07 to 0x0c are word-sized, others are byte-sized - GL520 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int gl520_read_value(struct i2c_client *client, u8 reg) -{ - if ((reg >= 0x07) && (reg <= 0x0c)) - return swab16(i2c_smbus_read_word_data(client, reg)); - else - return i2c_smbus_read_byte_data(client, reg); -} - -/* Registers 0x07 to 0x0c are word-sized, others are byte-sized - GL520 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int gl520_write_value(struct i2c_client *client, u8 reg, u16 value) -{ - if ((reg >= 0x07) && (reg <= 0x0c)) - return i2c_smbus_write_word_data(client, reg, swab16(value)); - else - return i2c_smbus_write_byte_data(client, reg, value); -} - -static void gl520_update_client(struct i2c_client *client) -{ - struct gl520_data *data = client->data; - int val; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting gl520 update\n"); -#endif - - data->alarms = gl520_read_value(client, GL520_REG_INT); - data->beeps = gl520_read_value(client, GL520_REG_ALARM); - data->vid = gl520_read_value(client, GL520_REG_VID) & 0x1f; - - val = gl520_read_value(client, GL520_REG_VDD_LIMIT); - data->voltage_min[0] = val & 0xff; - data->voltage_max[0] = (val >> 8) & 0xff; - val = gl520_read_value(client, GL520_REG_VIN1_LIMIT); - data->voltage_min[1] = val & 0xff; - data->voltage_max[1] = (val >> 8) & 0xff; - val = gl520_read_value(client, GL520_REG_VIN2_LIMIT); - data->voltage_min[2] = val & 0xff; - data->voltage_max[2] = (val >> 8) & 0xff; - val = gl520_read_value(client, GL520_REG_VIN3_LIMIT); - data->voltage_min[3] = val & 0xff; - data->voltage_max[3] = (val >> 8) & 0xff; - - val = gl520_read_value(client, GL520_REG_FAN_COUNT); - data->fan[0] = (val >> 8) & 0xff; - data->fan[1] = val & 0xff; - - val = gl520_read_value(client, GL520_REG_FAN_LIMIT); - data->fan_min[0] = (val >> 8) & 0xff; - data->fan_min[1] = val & 0xff; - - data->temp[0] = gl520_read_value(client, GL520_REG_TEMP1); - data->temp_over[0] = - gl520_read_value(client, GL520_REG_TEMP1_OVER); - data->temp_hyst[0] = - gl520_read_value(client, GL520_REG_TEMP1_HYST); - - val = gl520_read_value(client, GL520_REG_MISC); - data->fan_div[0] = (val >> 6) & 0x03; - data->fan_div[1] = (val >> 4) & 0x03; - - data->alarms &= data->alarm_mask; - - val = gl520_read_value(client, GL520_REG_CONF); - data->beep_enable = (val >> 2) & 1; - - data->voltage[0] = gl520_read_value(client, GL520_REG_VDD); - data->voltage[1] = - gl520_read_value(client, GL520_REG_VIN1); - data->voltage[2] = - gl520_read_value(client, GL520_REG_VIN2); - data->voltage[3] = - gl520_read_value(client, GL520_REG_VIN3); - - /* Temp1 and Vin4 are the same input */ - if (data->two_temps) { - data->temp[1] = - gl520_read_value(client, GL520_REG_TEMP2); - data->temp_over[1] = - gl520_read_value(client, GL520_REG_TEMP2_OVER); - data->temp_hyst[1] = - gl520_read_value(client, GL520_REG_TEMP2_HYST); - } else { - data->voltage[4] = - gl520_read_value(client, GL520_REG_VIN4); - data->voltage_min[4] = - gl520_read_value(client, GL520_REG_VIN4_MIN); - data->voltage_max[4] = - gl520_read_value(client, GL520_REG_VIN4_MAX); - } - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -void gl520_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl520_data *data = client->data; - int nr = ctl_name - GL520_SYSCTL_TEMP1; - int regnr; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - gl520_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_over[nr]); - results[1] = TEMP_FROM_REG(data->temp_hyst[nr]); - results[2] = TEMP_FROM_REG(data->temp[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if ((nr == 1) && (!data->two_temps)) - return; - regnr = - nr == 0 ? GL520_REG_TEMP1_OVER : GL520_REG_TEMP2_OVER; - if (*nrels_mag >= 1) { - data->temp_over[nr] = TEMP_TO_REG(results[0]); - gl520_write_value(client, regnr, - data->temp_over[nr]); - } - regnr = - nr == 0 ? GL520_REG_TEMP1_HYST : GL520_REG_TEMP2_HYST; - if (*nrels_mag >= 2) { - data->temp_hyst[nr] = TEMP_TO_REG(results[1]); - gl520_write_value(client, regnr, - data->temp_hyst[nr]); - } - } -} - -void gl520_vin(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl520_data *data = client->data; - int nr = ctl_name - GL520_SYSCTL_VDD; - int regnr, old = 0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - gl520_update_client(client); - 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]); - 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) { - if (nr != 4) { - regnr = - nr == 0 ? GL520_REG_VDD_LIMIT : nr == - 1 ? GL520_REG_VIN1_LIMIT : nr == - 2 ? GL520_REG_VIN2_LIMIT : - GL520_REG_VIN3_LIMIT; - if (*nrels_mag == 1) - old = - gl520_read_value(client, - regnr) & 0xff00; - if (*nrels_mag >= 2) { - 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] = - nr ? IN_TO_REG(results[0]) : - VDD_TO_REG(results[0]); - old |= data->voltage_min[nr]; - gl520_write_value(client, regnr, old); - } - } else if (!data->two_temps) { - if (*nrels_mag == 1) - gl520_write_value(client, - GL520_REG_VIN4_MIN, - IN_TO_REG(results[0])); - if (*nrels_mag >= 2) - gl520_write_value(client, - GL520_REG_VIN4_MAX, - IN_TO_REG(results[1])); - } - } -} - - -void gl520_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl520_data *data = client->data; - int nr = ctl_name - GL520_SYSCTL_FAN1; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - gl520_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr], - DIV_FROM_REG(data->fan_div[nr])); - results[1] = - FAN_FROM_REG(data->fan[nr], - DIV_FROM_REG(data->fan_div[nr])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr] = FAN_TO_REG(results[0], - DIV_FROM_REG(data-> - fan_div - [nr])); - old = - gl520_read_value(client, GL520_REG_FAN_LIMIT); - - if (nr == 0) { - old = - (old & 0x00ff) | (data-> - fan_min[nr] << 8); - if (results[0] == 0) - data->alarm_mask &= ~0x20; - else - data->alarm_mask |= 0x20; - } else { - old = (old & 0xff00) | data->fan_min[nr]; - if (results[0] == 0) - data->alarm_mask &= ~0x40; - else - data->alarm_mask |= 0x40; - } - gl520_write_value(client, GL520_REG_FAN_LIMIT, - old); - } - } -} - - -void gl520_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl520_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - gl520_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -void gl520_beep(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl520_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - gl520_update_client(client); - results[0] = BEEP_ENABLE_FROM_REG(data->beep_enable); - results[1] = BEEPS_FROM_REG(data->beeps); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->beep_enable = BEEP_ENABLE_TO_REG(results[0]); - gl520_write_value(client, GL520_REG_CONF, - (gl520_read_value(client, - GL520_REG_CONF) - & 0xfb) | (data-> - beep_enable << 2)); - } - if (*nrels_mag >= 2) { - data->beeps = - BEEPS_TO_REG(results[1]) & data->alarm_mask; - gl520_write_value(client, GL520_REG_ALARM, - data->beeps); - } - } -} - - -void gl520_fan_div(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl520_data *data = client->data; - int old; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - gl520_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = gl520_read_value(client, GL520_REG_MISC); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0xcf) | (data->fan_div[1] << 4); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0x3f) | (data->fan_div[0] << 6); - } - gl520_write_value(client, GL520_REG_MISC, old); - } -} - -void gl520_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl520_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - gl520_update_client(client); - results[0] = VID_FROM_REG(data->vid); - *nrels_mag = 1; - } -} - -void gl520_fan1off(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - int old; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = - ((gl520_read_value(client, GL520_REG_MISC) & 0x04) != - 0); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - old = - gl520_read_value(client, - GL520_REG_MISC) & 0xfb; - if (results[0]) - old |= 0x04; - gl520_write_value(client, GL520_REG_MISC, old); - } - } -} - -void gl520_config(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct gl520_data *data = client->data; - int old; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = - ((gl520_read_value(client, GL520_REG_CONF) & 0x10) == - 0); - data->two_temps = results[0]; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - old = - gl520_read_value(client, - GL520_REG_CONF) & 0xef; - if (!results[1]) { - old |= 0x10; - data->two_temps = 0; - data->temp_hyst[1] = data->temp_over[1] = - data->temp[1] = 0; - } else { - data->two_temps = 1; - data->voltage_max[4] = data->voltage_min[4] = - data->voltage[4] = 0; - } - gl520_write_value(client, GL520_REG_CONF, old); - } - } -} - -static int __init sm_gl520sm_init(void) -{ - printk("gl520sm.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&gl520_driver); -} - -static void __exit sm_gl520sm_exit(void) -{ - i2c_del_driver(&gl520_driver); -} - - - -MODULE_AUTHOR - ("Frodo Looijaard and Kyösti Mälkki "); -MODULE_DESCRIPTION("GL520SM driver"); - -module_init(sm_gl520sm_init); -module_exit(sm_gl520sm_exit); diff --git a/kernel/chips/it87.c b/kernel/chips/it87.c deleted file mode 100644 index 01286a7e..00000000 --- a/kernel/chips/it87.c +++ /dev/null @@ -1,1130 +0,0 @@ -/* - it87.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring. - - Supports: IT8705F Super I/O chip w/LPC interface - IT8712F Super I/O chip w/LPC interface & SMBus - SiS950 A clone of the IT8705F - - Copyright (c) 2001 Chris Gauthron - Largely inspired by lm78.c of the same package - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - djg@pdp8.net David Gesswein 7/18/01 - Modified to fix bug with not all alarms enabled. - Added ability to read battery voltage and select temperature sensor - type at module load time. -*/ - -/* - michael.hufer@gmx.de Michael Hufer 09/07/03 - Modified configure (enable/disable) chip reset at module load time. - Added ability to read and set fan pwm registers and the smart - guardian (sg) features of the chip. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x28, 0x2f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0x0290, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_2(it87, it8712); - - -#define REG 0x2e /* The register to read/write */ -#define DEV 0x07 /* Register: Logical device select */ -#define VAL 0x2f /* The value to read/write */ -#define PME 0x04 /* The device with the fan registers in it */ -#define DEVID 0x20 /* Register: Device ID */ -#define DEVREV 0x22 /* Register: Device Revision */ - -static inline int -superio_inb(int reg) -{ - outb(reg, REG); - return inb(VAL); -} - -static int superio_inw(int reg) -{ - int val; - outb(reg++, REG); - val = inb(VAL) << 8; - outb(reg, REG); - val |= inb(VAL); - return val; -} - -static inline void -superio_select(void) -{ - outb(DEV, REG); - outb(PME, VAL); -} - -static inline void -superio_enter(void) -{ - outb(0x87, REG); - outb(0x01, REG); - outb(0x55, REG); - outb(0x55, REG); -} - -static inline void -superio_exit(void) -{ - outb(0x02, REG); - outb(0x02, VAL); -} - -#define IT87_DEVID_MATCH(id) ((id) == 0x8712 || (id) == 0x8705) - -#define IT87_ACT_REG 0x30 -#define IT87_BASE_REG 0x60 - -/* Update battery voltage after every reading if true */ -static int update_vbat = 0; - -/* Reset the registers on init */ -static int reset = 0; - -/* Many IT87 constants specified below */ - -/* Length of ISA address segment */ -#define IT87_EXTENT 8 - -/* Where are the ISA address/data registers relative to the base address */ -#define IT87_ADDR_REG_OFFSET 5 -#define IT87_DATA_REG_OFFSET 6 - -/*----- The IT87 registers -----*/ - -#define IT87_REG_CONFIG 0x00 - -#define IT87_REG_ALARM1 0x01 -#define IT87_REG_ALARM2 0x02 -#define IT87_REG_ALARM3 0x03 - -#define IT87_REG_VID 0x0a -#define IT87_REG_FAN_DIV 0x0b - -#define IT87_REG_FAN(nr) (0x0c + (nr)) -#define IT87_REG_FAN_MIN(nr) (0x0f + (nr)) -#define IT87_REG_FAN_CTRL 0x13 - -/* pwm and smart guardian registers */ - -#define IT87_REG_FAN_ONOFF 0x14 -#define IT87_REG_PWM(nr) (0x14 + (nr)) -#define IT87_REG_SG_TL_OFF(nr) (0x58 + (nr)*8) -#define IT87_REG_SG_TL_LOW(nr) (0x59 + (nr)*8) -#define IT87_REG_SG_TL_MED(nr) (0x5a + (nr)*8) -#define IT87_REG_SG_TL_HI(nr) (0x5b + (nr)*8) -#define IT87_REG_SG_TL_OVR(nr) (0x5c + (nr)*8) -#define IT87_REG_SG_PWM_LOW(nr) (0x5d + (nr)*8) -#define IT87_REG_SG_PWM_MED(nr) (0x5e + (nr)*8) -#define IT87_REG_SG_PWM_HI(nr) (0x5f + (nr)*8) - -/* Monitors: 9 voltage (0 to 7, battery), 3 temp (1 to 3), 3 fan (1 to 3) */ - -#define IT87_REG_VIN(nr) (0x20 + (nr)) -#define IT87_REG_TEMP(nr) (0x28 + (nr)) - -#define IT87_REG_VIN_MAX(nr) (0x30 + (nr) * 2) -#define IT87_REG_VIN_MIN(nr) (0x31 + (nr) * 2) -#define IT87_REG_TEMP_HIGH(nr) (0x3e + (nr) * 2) -#define IT87_REG_TEMP_LOW(nr) (0x3f + (nr) * 2) - -#define IT87_REG_I2C_ADDR 0x48 - -#define IT87_REG_VIN_ENABLE 0x50 -#define IT87_REG_TEMP_ENABLE 0x51 - -#define IT87_REG_CHIPID 0x58 -#define IT87_REG_CHIPID2 0x5b /* IT8712F only */ - -/* sensor pin types */ -#define UNUSED 0 -#define THERMISTOR 2 -#define PIIDIODE 3 - -/* Conversions. Limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255)) -#define IN_FROM_REG(val) (((val) * 16 + 5) / 10) - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==255?0:1350000/((val)*(div))) - -#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-5)/10):\ - ((val)+5)/10),-127,127)) -#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*10) - -#define VID_FROM_REG(val) ((val)==0x1f?0:(val)>=0x10?510-(val)*10:\ - 205-(val)*5) -#define ALARMS_FROM_REG(val) (val) - -extern inline u8 DIV_TO_REG(long val) -{ - u8 i; - for( i = 0; i <= 7; i++ ) - { - if( val>>i == 1 ) - return i; - } - return 1; -} -#define DIV_FROM_REG(val) (1 << (val)) - -/* For each registered IT87, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new it87 client is - allocated. */ -struct it87_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[9]; /* Register value */ - u8 in_max[9]; /* Register value */ - u8 in_min[9]; /* Register value */ - u8 fan[3]; /* Register value */ - u8 fan_min[3]; /* Register value */ - u8 temp[3]; /* Register value */ - u8 temp_high[3]; /* Register value */ - u8 temp_low[3]; /* Register value */ - u8 fan_div[3]; /* Register encoding, shifted right */ - u8 vid; /* Register encoding, combined */ - u32 alarms; /* Register encoding, combined */ - u8 pwm[3]; /* Register value */ - u8 fan_ctl[2]; /* Register encoding */ - u8 sg_tl[3][5]; /* Register value */ - u8 sg_pwm[3][3]; /* Register value */ - u8 sens[3]; /* 2 = Thermistor, - 3 = PII/Celeron diode */ -}; - - -static int it87_attach_adapter(struct i2c_adapter *adapter); -static int it87_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int it87_detach_client(struct i2c_client *client); - -static int it87_read_value(struct i2c_client *client, u8 register); -static int it87_write_value(struct i2c_client *client, u8 register, - u8 value); -static void it87_update_client(struct i2c_client *client); -static void it87_init_client(struct i2c_client *client); - - -static void it87_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void it87_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void it87_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void it87_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void it87_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void it87_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void it87_fan_ctl(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void it87_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void it87_sgpwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void it87_sgtl(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void it87_sens(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver it87_driver = { - .name = "IT87xx sensor driver", - .id = I2C_DRIVERID_IT87, - .flags = I2C_DF_NOTIFY, - .attach_adapter = it87_attach_adapter, - .detach_client = it87_detach_client, -}; - -/* The /proc/sys entries */ - -/* -- SENSORS SYSCTL START -- */ -#define IT87_SYSCTL_IN0 1000 /* Volts * 100 */ -#define IT87_SYSCTL_IN1 1001 -#define IT87_SYSCTL_IN2 1002 -#define IT87_SYSCTL_IN3 1003 -#define IT87_SYSCTL_IN4 1004 -#define IT87_SYSCTL_IN5 1005 -#define IT87_SYSCTL_IN6 1006 -#define IT87_SYSCTL_IN7 1007 -#define IT87_SYSCTL_IN8 1008 -#define IT87_SYSCTL_FAN1 1101 /* Rotations/min */ -#define IT87_SYSCTL_FAN2 1102 -#define IT87_SYSCTL_FAN3 1103 -#define IT87_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define IT87_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define IT87_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ -#define IT87_SYSCTL_VID 1300 /* Volts * 100 */ -#define IT87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define IT87_SYSCTL_ALARMS 2004 /* bitvector */ - -#define IT87_SYSCTL_PWM1 1401 -#define IT87_SYSCTL_PWM2 1402 -#define IT87_SYSCTL_PWM3 1403 -#define IT87_SYSCTL_FAN_CTL 1501 -#define IT87_SYSCTL_FAN_ON_OFF 1502 -#define IT87_SYSCTL_SENS1 1601 /* 1, 2, or Beta (3000-5000) */ -#define IT87_SYSCTL_SENS2 1602 -#define IT87_SYSCTL_SENS3 1603 - -#define IT87_ALARM_IN0 0x000100 -#define IT87_ALARM_IN1 0x000200 -#define IT87_ALARM_IN2 0x000400 -#define IT87_ALARM_IN3 0x000800 -#define IT87_ALARM_IN4 0x001000 -#define IT87_ALARM_IN5 0x002000 -#define IT87_ALARM_IN6 0x004000 -#define IT87_ALARM_IN7 0x008000 -#define IT87_ALARM_FAN1 0x0001 -#define IT87_ALARM_FAN2 0x0002 -#define IT87_ALARM_FAN3 0x0004 -#define IT87_ALARM_TEMP1 0x00010000 -#define IT87_ALARM_TEMP2 0x00020000 -#define IT87_ALARM_TEMP3 0x00040000 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected IT87. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table it87_dir_table_template[] = { - {IT87_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_in}, - {IT87_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_in}, - {IT87_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_in}, - {IT87_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_in}, - {IT87_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_in}, - {IT87_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_in}, - {IT87_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_in}, - {IT87_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_in}, - {IT87_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_in}, - {IT87_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_fan}, - {IT87_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_fan}, - {IT87_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_fan}, - {IT87_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_temp}, - {IT87_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_temp}, - {IT87_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_temp}, - {IT87_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_vid}, - {IT87_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_fan_div}, - {IT87_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_alarms}, - {IT87_SYSCTL_FAN_CTL, "fan_ctl", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_fan_ctl}, - {IT87_SYSCTL_FAN_ON_OFF, "fan_on_off", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_fan_ctl}, - {IT87_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_pwm}, - {IT87_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_pwm}, - {IT87_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_pwm}, - {IT87_SYSCTL_PWM1, "sg_pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_sgpwm}, - {IT87_SYSCTL_PWM2, "sg_pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_sgpwm}, - {IT87_SYSCTL_PWM3, "sg_pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_sgpwm}, - {IT87_SYSCTL_PWM1, "sg_tl1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_sgtl}, - {IT87_SYSCTL_PWM2, "sg_tl2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_sgtl}, - {IT87_SYSCTL_PWM3, "sg_tl3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_sgtl}, - {IT87_SYSCTL_SENS1, "sensor1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_sens}, - {IT87_SYSCTL_SENS2, "sensor2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_sens}, - {IT87_SYSCTL_SENS3, "sensor3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &it87_sens}, - {0} -}; - - -/* This function is called when: - * it87_driver is inserted (when this module is loaded), for each - available adapter - * when a new adapter is inserted (and it87_driver is still present) */ -static int it87_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, it87_detect); -} - -static int __init it87_find(int *address) -{ - int err = -ENODEV; - u16 devid; - - superio_enter(); - devid = superio_inw(DEVID); - if (!IT87_DEVID_MATCH(devid)) - goto exit; - - superio_select(); - if (!(superio_inb(IT87_ACT_REG) & 0x01)) { - printk(KERN_INFO "it87: Device not activated, skipping\n"); - goto exit; - } - - *address = superio_inw(IT87_BASE_REG) & ~(IT87_EXTENT - 1); - if (*address == 0) { - printk(KERN_INFO "it87: Base address not set, skipping\n"); - goto exit; - } - - err = 0; - printk(KERN_INFO "it87: Found IT%04xF chip at 0x%x, revision %d\n", - devid, *address, superio_inb(DEVREV) & 0x0f); - -exit: - superio_exit(); - return err; -} - -/* This function is called by i2c_detect */ -static int it87_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct it87_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - int is_isa = i2c_is_isa_adapter(adapter); - - if (!is_isa - && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return 0; - - if (is_isa - && check_region(address, IT87_EXTENT)) - return 0; - - /* Probe whether there is anything available on this address. Already - done for SMBus clients */ - if (is_isa && kind < 0) { -#define REALLY_SLOW_IO - /* We need the timeouts for at least some IT87-like chips. - But only if we read 'undefined' registers. */ - i = inb_p(address + 1); - if (inb_p(address + 2) != i - || inb_p(address + 3) != i - || inb_p(address + 7) != i) - return 0; -#undef REALLY_SLOW_IO - - /* Let's just hope nothing breaks here */ - i = inb_p(address + 5) & 0x7f; - outb_p(~i & 0x7f, address + 5); - if ((inb_p(address + 5) & 0x7f) != (~i & 0x7f)) { - outb_p(i, address + 5); - return 0; - } - } - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access it87_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct it87_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - if (is_isa) - init_MUTEX(&data->lock); - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &it87_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - if (kind < 0) { - if ((it87_read_value(new_client, IT87_REG_CONFIG) & 0x80) - || (!is_isa - && it87_read_value(new_client, IT87_REG_I2C_ADDR) != address)) - goto ERROR1; - } - - /* Determine the chip type. */ - if (kind <= 0) { - i = it87_read_value(new_client, IT87_REG_CHIPID); - if (i == 0x90) { - kind = it87; - i = it87_read_value(new_client, IT87_REG_CHIPID2); - if (i == 0x12) - kind = it8712; - } - else { - if (kind == 0) - printk - ("it87.o: Ignoring 'force' parameter for unknown chip at " - "adapter %d, address 0x%02x\n", - i2c_adapter_id(adapter), address); - goto ERROR1; - } - } - - if (kind == it87) { - type_name = "it87"; - client_name = "IT87 chip"; - } else if (kind == it8712) { - type_name = "it8712"; - client_name = "IT8712 chip"; - } else { -#ifdef DEBUG - printk("it87.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Reserve the ISA region */ - if (is_isa) - request_region(address, IT87_EXTENT, type_name); - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* The IT8705F doesn't have VID capability */ - data->vid = 0x1f; - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - it87_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the IT87 chip */ - it87_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - if (is_isa) - release_region(address, IT87_EXTENT); - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int it87_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct it87_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("it87.o: Client deregistration failed, client not detached.\n"); - return err; - } - - if(i2c_is_isa_client(client)) - release_region(client->addr, IT87_EXTENT); - kfree(client->data); - - return 0; -} - -/* The SMBus locks itself, but ISA access must be locked explicitly! - We don't want to lock the whole ISA bus, so we lock each client - separately. - We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks, - would slow down the IT87 access and should not be necessary. - There are some ugly typecasts here, but the good new is - they should - nowhere else be necessary! */ -static int it87_read_value(struct i2c_client *client, u8 reg) -{ - int res; - if (i2c_is_isa_client(client)) { - down(&(((struct it87_data *) (client->data))->lock)); - outb_p(reg, client->addr + IT87_ADDR_REG_OFFSET); - res = inb_p(client->addr + IT87_DATA_REG_OFFSET); - up(&(((struct it87_data *) (client->data))->lock)); - return res; - } else - return i2c_smbus_read_byte_data(client, reg); -} - -/* The SMBus locks itself, but ISA access muse be locked explicitly! - We don't want to lock the whole ISA bus, so we lock each client - separately. - We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks, - would slow down the IT87 access and should not be necessary. - There are some ugly typecasts here, but the good new is - they should - nowhere else be necessary! */ -static int it87_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - if (i2c_is_isa_client(client)) { - down(&(((struct it87_data *) (client->data))->lock)); - outb_p(reg, client->addr + IT87_ADDR_REG_OFFSET); - outb_p(value, client->addr + IT87_DATA_REG_OFFSET); - up(&(((struct it87_data *) (client->data))->lock)); - return 0; - } else - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* Called when we have found a new IT87. */ -static void it87_init_client(struct i2c_client *client) -{ - int tmp; - - if (reset) { - /* Reset all except Watchdog values and last conversion values - This sets fan-divs to 2, among others */ - it87_write_value(client, IT87_REG_CONFIG, 0x80); - } - - /* Check if temperature channnels are reset manually or by some reason */ - tmp = it87_read_value(client, IT87_REG_TEMP_ENABLE); - if ((tmp & 0x3f) == 0) { - /* Temp1,Temp3=thermistor; Temp2=thermal diode */ - tmp = (tmp & 0xc0) | 0x2a; - it87_write_value(client, IT87_REG_TEMP_ENABLE, tmp); - } - - /* Check if voltage monitors are reset manually or by some reason */ - tmp = it87_read_value(client, IT87_REG_VIN_ENABLE); - if ((tmp & 0xff) == 0) { - /* Enable all voltage monitors */ - it87_write_value(client, IT87_REG_VIN_ENABLE, 0xff); - } - - /* Check if tachometers are reset manually or by some reason */ - tmp = it87_read_value(client, IT87_REG_FAN_CTRL); - if ((tmp & 0x70) == 0) { - /* Enable all fan tachometers */ - tmp = (tmp & 0x8f) | 0x70; - it87_write_value(client, IT87_REG_FAN_CTRL, tmp); - } - - /* Start monitoring */ - it87_write_value(client, IT87_REG_CONFIG, - (it87_read_value(client, IT87_REG_CONFIG) & 0x36) - | (update_vbat ? 0x41 : 0x01)); -} - -static void it87_update_client(struct i2c_client *client) -{ - struct it87_data *data = client->data; - int i, tmp, tmp2; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - - if (update_vbat) { - /* Cleared after each update, so reenable. Value - returned by this read will be previous value */ - it87_write_value(client, IT87_REG_CONFIG, - it87_read_value(client, IT87_REG_CONFIG) | 0x40); - } - for (i = 0; i <= 7; i++) { - data->in[i] = - it87_read_value(client, IT87_REG_VIN(i)); - data->in_min[i] = - it87_read_value(client, IT87_REG_VIN_MIN(i)); - data->in_max[i] = - it87_read_value(client, IT87_REG_VIN_MAX(i)); - } - data->in[8] = - it87_read_value(client, IT87_REG_VIN(8)); - /* VBAT sensor doesn't have limit registers, set - to min and max value */ - data->in_min[8] = 0; - data->in_max[8] = 255; - - for (i = 1; i <= 3; i++) { - data->fan[i - 1] = - it87_read_value(client, IT87_REG_FAN(i)); - data->fan_min[i - 1] = - it87_read_value(client, IT87_REG_FAN_MIN(i)); - } - for (i = 1; i <= 3; i++) { - data->temp[i - 1] = - it87_read_value(client, IT87_REG_TEMP(i)); - data->temp_high[i - 1] = - it87_read_value(client, IT87_REG_TEMP_HIGH(i)); - data->temp_low[i - 1] = - it87_read_value(client, IT87_REG_TEMP_LOW(i)); - } - - if (data->type == it8712) { - data->vid = it87_read_value(client, IT87_REG_VID); - data->vid &= 0x1f; - } - - i = it87_read_value(client, IT87_REG_FAN_DIV); - data->fan_div[0] = i & 0x07; - data->fan_div[1] = (i >> 3) & 0x07; - data->fan_div[2] = ( (i&0x40)==0x40 ? 3 : 1 ); - - for( i = 1; i <= 3; i++ ) { - data->pwm[i-1] = it87_read_value(client, IT87_REG_PWM(i)); - data->sg_tl[i-1][0] = it87_read_value(client, IT87_REG_SG_TL_OFF(i)); - data->sg_tl[i-1][1] = it87_read_value(client, IT87_REG_SG_TL_LOW(i)); - data->sg_tl[i-1][2] = it87_read_value(client, IT87_REG_SG_TL_MED(i)); - data->sg_tl[i-1][3] = it87_read_value(client, IT87_REG_SG_TL_HI(i)); - data->sg_tl[i-1][4] = it87_read_value(client, IT87_REG_SG_TL_OVR(i)); - data->sg_pwm[i-1][0] = it87_read_value(client, IT87_REG_SG_PWM_LOW(i)); - data->sg_pwm[i-1][1] = it87_read_value(client, IT87_REG_SG_PWM_MED(i)); - data->sg_pwm[i-1][2] = it87_read_value(client, IT87_REG_SG_PWM_HI(i)); - } - data->alarms = - it87_read_value(client, IT87_REG_ALARM1) | - (it87_read_value(client, IT87_REG_ALARM2) << 8) | - (it87_read_value(client, IT87_REG_ALARM3) << 16); - data->fan_ctl[0] = it87_read_value(client, IT87_REG_FAN_CTRL); - data->fan_ctl[1] = it87_read_value(client, IT87_REG_FAN_ONOFF); - - tmp = it87_read_value(client, IT87_REG_TEMP_ENABLE); - for(i = 0; i < 3; i++) { - tmp2 = (tmp >> i) & 0x09; - if(tmp2 == 0x01) - data->sens[i] = PIIDIODE; - else if(tmp2 == 0x08) - data->sens[i] = THERMISTOR; - else - data->sens[i] = UNUSED; - } - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - - Each function must return the magnitude (power of 10 to divide the - data with) if it is called with operation==SENSORS_PROC_REAL_INFO. - - It must put a maximum of *nrels elements in results reflecting the - data of this file, and set *nrels to the number it actually put - in it, if operation==SENSORS_PROC_REAL_READ. - - Finally, it must get upto *nrels elements from results and write them - to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void it87_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - int nr = ctl_name - IT87_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = IN_FROM_REG(data->in_min[nr]); - results[1] = IN_FROM_REG(data->in_max[nr]); - results[2] = IN_FROM_REG(data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0]); - it87_write_value(client, IT87_REG_VIN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1]); - it87_write_value(client, IT87_REG_VIN_MAX(nr), - data->in_max[nr]); - } - } -} - -void it87_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - int nr = ctl_name - IT87_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - results[1] = FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = FAN_TO_REG(results[0], - DIV_FROM_REG(data->fan_div[nr - 1])); - it87_write_value(client, IT87_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } - } -} - - -void it87_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - int nr = ctl_name - IT87_SYSCTL_TEMP1 + 1; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_high[nr - 1]); - results[1] = TEMP_FROM_REG(data->temp_low[nr - 1]); - results[2] = TEMP_FROM_REG(data->temp[nr - 1]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_high[nr - 1] = TEMP_TO_REG(results[0]); - it87_write_value(client, IT87_REG_TEMP_HIGH(nr), - data->temp_high[nr - 1]); - } - if (*nrels_mag >= 2) { - data->temp_low[nr - 1] = TEMP_TO_REG(results[1]); - it87_write_value(client, IT87_REG_TEMP_LOW(nr), - data->temp_low[nr - 1]); - } - } -} - -void it87_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - int nr = ctl_name - IT87_SYSCTL_PWM1 + 1; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = data->pwm[nr - 1]; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->pwm[nr - 1] = results[0]; - it87_write_value(client, IT87_REG_PWM(nr), data->pwm[nr - 1]); - } - } -} - -void it87_sgpwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - int nr = ctl_name - IT87_SYSCTL_PWM1 + 1; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = data->sg_pwm[nr - 1][0]; - results[1] = data->sg_pwm[nr - 1][1]; - results[2] = data->sg_pwm[nr - 1][2]; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->sg_pwm[nr - 1][0] = results[0]; - it87_write_value(client, IT87_REG_SG_PWM_LOW(nr), data->sg_pwm[nr - 1][0]); - } - if (*nrels_mag >= 2) { - data->sg_pwm[nr - 1][1] = results[1]; - it87_write_value(client, IT87_REG_SG_PWM_MED(nr), data->sg_pwm[nr - 1][1]); - } - if (*nrels_mag >= 3) { - data->sg_pwm[nr - 1][2] = results[2]; - it87_write_value(client, IT87_REG_SG_PWM_HI(nr), data->sg_pwm[nr - 1][2]); - } - } -} - -void it87_sgtl(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - int nr = ctl_name - IT87_SYSCTL_PWM1 + 1; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = TEMP_FROM_REG(data->sg_tl[nr - 1][0]); - results[1] = TEMP_FROM_REG(data->sg_tl[nr - 1][1]); - results[2] = TEMP_FROM_REG(data->sg_tl[nr - 1][2]); - results[3] = TEMP_FROM_REG(data->sg_tl[nr - 1][3]); - results[4] = TEMP_FROM_REG(data->sg_tl[nr - 1][4]); - *nrels_mag = 5; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->sg_tl[nr - 1][0] = TEMP_TO_REG(results[0]); - it87_write_value(client, IT87_REG_SG_TL_OFF(nr), data->sg_tl[nr - 1][0]); - } - if (*nrels_mag >= 2) { - data->sg_tl[nr - 1][1] = TEMP_TO_REG(results[1]); - it87_write_value(client, IT87_REG_SG_TL_LOW(nr), data->sg_tl[nr - 1][1]); - } - if (*nrels_mag >= 3) { - data->sg_tl[nr - 1][2] = TEMP_TO_REG(results[2]); - it87_write_value(client, IT87_REG_SG_TL_MED(nr), data->sg_tl[nr - 1][2]); - } - if (*nrels_mag >= 4) { - data->sg_tl[nr - 1][3] = TEMP_TO_REG(results[3]); - it87_write_value(client, IT87_REG_SG_TL_HI(nr), data->sg_tl[nr - 1][3]); - } - if (*nrels_mag >= 5) { - data->sg_tl[nr - 1][4] = TEMP_TO_REG(results[4]); - it87_write_value(client, IT87_REG_SG_TL_OVR(nr), data->sg_tl[nr - 1][4]); - } - } -} - -void it87_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = VID_FROM_REG(data->vid); - *nrels_mag = 1; - } -} - -void it87_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -void it87_fan_div(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - results[2] = DIV_FROM_REG(data->fan_div[2]);; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = it87_read_value(client, IT87_REG_FAN_DIV); - if (*nrels_mag >= 3) { - data->fan_div[2] = DIV_TO_REG(results[2]); - if (data->fan_div[2] != 3) { - data->fan_div[2] = 1; - old = (old & 0xbf); - } else { - old = (old | 0x40); - } - } - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0xc3) | (data->fan_div[1] << 3); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xf8) | data->fan_div[0]; - it87_write_value(client, IT87_REG_FAN_DIV, old); - } - } -} - -void it87_fan_ctl(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - int index = ctl_name - IT87_SYSCTL_FAN_CTL; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - it87_update_client(client); - results[0] = data->fan_ctl[index]; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_ctl[index] = results[0]; - if( index == 0 ) - it87_write_value(client, IT87_REG_FAN_CTRL, data->fan_ctl[index] ); - else - it87_write_value(client, IT87_REG_FAN_ONOFF, data->fan_ctl[index] ); - } - } -} - -void it87_sens(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct it87_data *data = client->data; - int nr = 1 + ctl_name - IT87_SYSCTL_SENS1; - u8 tmp, val1, val2; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->sens[nr - 1]; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - val1 = 0x01 << (nr - 1); - val2 = 0x08 << (nr - 1); - tmp = it87_read_value(client, IT87_REG_TEMP_ENABLE); - switch (results[0]) { - case PIIDIODE: - tmp &= ~ val2; - tmp |= val1; - break; - case THERMISTOR: - tmp &= ~ val1; - tmp |= val2; - break; - case UNUSED: - tmp &= ~ val1; - tmp &= ~ val2; - break; - default: - printk(KERN_ERR "it87.o: Invalid sensor type %ld; " - "must be 0 (unused), 2 (thermistor) " - "or 3 (diode)\n", results[0]); - return; - } - it87_write_value(client, - IT87_REG_TEMP_ENABLE, tmp); - data->sens[nr - 1] = results[0]; - } - } -} - -static int __init sm_it87_init(void) -{ - int addr; - - printk("it87.o version %s (%s)\n", LM_VERSION, LM_DATE); - if (!it87_find(&addr)) { - normal_isa[0] = addr; - } - return i2c_add_driver(&it87_driver); -} - -static void __exit sm_it87_exit(void) -{ - i2c_del_driver(&it87_driver); -} - - -MODULE_AUTHOR("Chris Gauthron "); -MODULE_DESCRIPTION("IT8705F, IT8712F, Sis950 driver"); -MODULE_PARM(update_vbat, "i"); -MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value"); -MODULE_PARM(reset, "i"); -MODULE_PARM_DESC(reset, "Reset the chip's registers, default no"); - -module_init(sm_it87_init); -module_exit(sm_it87_exit); diff --git a/kernel/chips/lm63.c b/kernel/chips/lm63.c deleted file mode 100644 index 1f126477..00000000 --- a/kernel/chips/lm63.c +++ /dev/null @@ -1,645 +0,0 @@ -/* - * lm63.c - driver for the National Semiconductor LM63 temperature sensor - * with integrated fan control - * Copyright (C) 2004 Jean Delvare - * Based on the lm90 driver. - * - * The LM63 is a sensor chip made by National Semiconductor. It measures - * two temperatures (its own and one external one) and the speed of one - * fan, those speed it can additionally control. Complete datasheet can be - * obtained from National's website at: - * http://www.national.com/pf/LM/LM63.html - * - * The LM63 is basically an LM86 with fan speed monitoring and control - * capabilities added. It misses some of the LM86 features though: - * - No low limit for local temperature. - * - No critical limit for local temperature. - * - Critical limit for remote temperature can be changed only once. We - * will consider that the critical limit is read-only. - * - * The datasheet isn't very clear about what the tachometer reading is. - * I had a explanation from National Semiconductor though. The two lower - * bits of the read value have to be masked out. The value is still 16 bit - * in width. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include "version.h" - -/* - * Addresses to scan - * Address is fully defined internally and cannot be changed. - */ - -static unsigned short normal_i2c[] = { 0x4c, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; -/* - * Insmod parameters - */ - -SENSORS_INSMOD_1(lm63); - -/* - * The LM63 registers - */ - -#define LM63_REG_CONFIG1 0x03 -#define LM63_REG_CONFIG2 0xBF -#define LM63_REG_CONFIG_FAN 0x4A - -#define LM63_REG_TACH_COUNT_MSB 0x47 -#define LM63_REG_TACH_COUNT_LSB 0x46 -#define LM63_REG_TACH_LIMIT_MSB 0x49 -#define LM63_REG_TACH_LIMIT_LSB 0x48 - -#define LM63_REG_PWM_VALUE 0x4C -#define LM63_REG_PWM_FREQ 0x4D - -#define LM63_REG_LOCAL_TEMP 0x00 -#define LM63_REG_LOCAL_HIGH 0x05 - -#define LM63_REG_REMOTE_TEMP_MSB 0x01 -#define LM63_REG_REMOTE_TEMP_LSB 0x10 -#define LM63_REG_REMOTE_OFFSET_MSB 0x11 -#define LM63_REG_REMOTE_OFFSET_LSB 0x12 -#define LM63_REG_REMOTE_HIGH_MSB 0x07 -#define LM63_REG_REMOTE_HIGH_LSB 0x13 -#define LM63_REG_REMOTE_LOW_MSB 0x08 -#define LM63_REG_REMOTE_LOW_LSB 0x14 -#define LM63_REG_REMOTE_TCRIT 0x19 -#define LM63_REG_REMOTE_TCRIT_HYST 0x21 - -#define LM63_REG_ALERT_STATUS 0x02 -#define LM63_REG_ALERT_MASK 0x16 - -#define LM63_REG_MAN_ID 0xFE -#define LM63_REG_CHIP_ID 0xFF - -/* - * Conversions and various macros - * For tachometer counts, the LM63 uses 16-bit values. - * For local temperature and high limit, remote critical limit and hysteresis - * value, it uses signed 8-bit values with LSB = 1 degree Celsius. - * For remote temperature, low and high limits, it uses signed 11-bit values - * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers. - */ - -#define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \ - 5400000 / (reg)) -#define FAN_TO_REG(val) ((val) <= 82 ? 0xFFFF : \ - (5400000 / (val)) & 0xFFFC) -#define TEMP8_FROM_REG(reg) (reg) -#define TEMP8_TO_REG(val) ((val) <= -128 ? -128 : \ - (val) >= 127 ? 127 : \ - val) -#define TEMP11_FROM_REG(reg) ((reg) / 32 * 125) -#define TEMP11_TO_REG(val) ((val) <= -128000 ? 0x8000 : \ - (val) >= 127875 ? 0x7FE0 : \ - (val) < 0 ? ((val) - 62) / 125 * 32 : \ - ((val) + 62) / 125 * 32) -#define HYST_TO_REG(val) ((val) <= 0 ? 0 : \ - (val) >= 127 ? 127 : \ - val) - -/* - * Functions declaration - */ - -static int lm63_attach_adapter(struct i2c_adapter *adapter); -static int lm63_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void lm63_init_client(struct i2c_client *client); -static int lm63_detach_client(struct i2c_client *client); - -static void lm63_local_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm63_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm63_remote_tcrit(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm63_remote_tcrit_hyst(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm63_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm63_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm63_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -/* - * Driver data (common to all clients) - */ - -static struct i2c_driver lm63_driver = { - .name = "LM63 sensor driver", - .flags = I2C_DF_NOTIFY, - .attach_adapter = lm63_attach_adapter, - .detach_client = lm63_detach_client, -}; - -/* - * Client data (each client gets its own) - */ - -struct lm63_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* zero until following fields are valid */ - unsigned long last_updated; /* in jiffies */ - - /* registers values */ - u8 config, config_fan; - u16 fan1_input; - u16 fan1_low; - u8 pwm1_freq; - u8 pwm1_value; - s8 temp1_input; - s8 temp1_high; - s16 temp2_input; - s16 temp2_high; - s16 temp2_low; - s8 temp2_crit; - u8 temp2_crit_hyst; - u8 alarms; -}; - -/* - * Proc entries - * These files are created for each detected LM63. - */ - -/* -- SENSORS SYSCTL START -- */ - -#define LM63_SYSCTL_TEMP1 1200 -#define LM63_SYSCTL_TEMP2 1201 -#define LM63_SYSCTL_TEMP2_TCRIT 1205 -#define LM63_SYSCTL_TEMP2_TCRIT_HYST 1208 -#define LM63_SYSCTL_ALARMS 1210 -#define LM63_SYSCTL_FAN1 1220 -#define LM63_SYSCTL_PWM1 1230 - -#define LM63_ALARM_LOCAL_HIGH 0x40 -#define LM63_ALARM_REMOTE_HIGH 0x10 -#define LM63_ALARM_REMOTE_LOW 0x08 -#define LM63_ALARM_REMOTE_CRIT 0x02 -#define LM63_ALARM_REMOTE_OPEN 0x04 -#define LM63_ALARM_FAN_LOW 0x01 - -/* -- SENSORS SYSCTL END -- */ - -static ctl_table lm63_dir_table_template[] = -{ - {LM63_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm63_local_temp}, - {LM63_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm63_remote_temp}, - {LM63_SYSCTL_TEMP2_TCRIT, "temp2_crit", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm63_remote_tcrit}, - {LM63_SYSCTL_TEMP2_TCRIT_HYST, "temp2_crit_hyst", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm63_remote_tcrit_hyst}, - {LM63_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm63_alarms}, - {LM63_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm63_fan}, - {LM63_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm63_pwm}, - {0} -}; - -/* - * Real code - */ - -static int lm63_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, lm63_detect); -} - -/* - * The following function does more than just detection. If detection - * succeeds, it also registers the new chip. - */ -static int lm63_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - struct i2c_client *new_client; - struct lm63_data *data; - int err = 0; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { -#ifdef DEBUG - printk(KERN_DEBUG "lm63: adapter doesn't support SMBus byte " - "data mode, skipping.\n"); -#endif - return 0; - } - - if (!(data = kmalloc(sizeof(struct lm63_data), GFP_KERNEL))) { - printk(KERN_ERR "lm63: Out of memory in lm63_detect\n"); - return -ENOMEM; - } - - /* - * The common I2C client data is placed right before the - * LM63-specific data. The LM63-specific data is pointed to by the - * data field from the i2c_client structure. - */ - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &lm63_driver; - new_client->flags = 0; - - /* Default to an LM63 if forced */ - if (kind == 0) - kind = lm63; - - if (kind < 0) { /* must identify */ - u8 man_id, chip_id, reg_config1, reg_config2; - u8 reg_alert_status, reg_alert_mask; - - man_id = i2c_smbus_read_byte_data(new_client, - LM63_REG_MAN_ID); - chip_id = i2c_smbus_read_byte_data(new_client, - LM63_REG_CHIP_ID); - reg_config1 = i2c_smbus_read_byte_data(new_client, - LM63_REG_CONFIG1); - reg_config2 = i2c_smbus_read_byte_data(new_client, - LM63_REG_CONFIG2); - reg_alert_status = i2c_smbus_read_byte_data(new_client, - LM63_REG_ALERT_STATUS); - reg_alert_mask = i2c_smbus_read_byte_data(new_client, - LM63_REG_ALERT_MASK); - - if (man_id == 0x01 /* National Semiconductor */ - && chip_id == 0x41 /* LM63 */ - && (reg_config1 & 0x18) == 0x00 - && (reg_config2 & 0xF8) == 0x00 - && (reg_alert_status & 0x20) == 0x00 - && (reg_alert_mask & 0xA4) == 0xA4) { - kind = lm63; - } else { -#ifdef DEBUG - printk(KERN_DEBUG "lm63: Unsupported chip " - "(man_id=0x%02X, chip_id=0x%02X)\n", - man_id, chip_id); -#endif - goto ERROR1; - } - } - - /* Fill in the remaining client fields */ - strcpy(new_client->name, "LM63 chip"); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) { - printk(KERN_ERR "lm63: Failed attaching client\n"); - goto ERROR1; - } - - /* Register a new directory entry */ - if ((err = i2c_register_entry(new_client, "lm63", - lm63_dir_table_template, THIS_MODULE)) < 0) { - printk(KERN_ERR "lm63: Failed registering directory entry\n"); - goto ERROR2; - } - data->sysctl_id = err; - - - /* Initialize the LM63 chip */ - lm63_init_client(new_client); - - return 0; - -ERROR2: - i2c_detach_client(new_client); -ERROR1: - kfree(data); - return err; -} - -/* Idealy we shouldn't have to initialize anything, since the BIOS - should have taken care of everything */ -static void lm63_init_client(struct i2c_client *client) -{ - struct lm63_data *data = client->data; - - data->config = i2c_smbus_read_byte_data(client, LM63_REG_CONFIG1); - data->config_fan = i2c_smbus_read_byte_data(client, - LM63_REG_CONFIG_FAN); - - /* Start converting if needed */ - if (data->config & 0x40) { /* standby */ -#ifdef DEBUG - printk(KERN_DEBUG "lm63: Switching to operational mode"); -#endif - data->config &= 0xA7; - i2c_smbus_write_byte_data(client, LM63_REG_CONFIG1, - data->config); - } - - /* We may need pwm1_freq before ever updating the client data */ - data->pwm1_freq = i2c_smbus_read_byte_data(client, LM63_REG_PWM_FREQ); - if (data->pwm1_freq == 0) - data->pwm1_freq = 1; - -#ifdef DEBUG - /* Show some debug info about the LM63 configuration */ - printk(KERN_DEBUG "lm63: Alert/tach pin configured for %s\n", - (data->config & 0x04) ? "tachometer input" : - "alert output"); - printk(KERN_DEBUG "lm63: PWM clock %s kHz, output frequency %u Hz\n", - (data->config_fan & 0x08) ? "1.4" : "360", - ((data->config_fan & 0x08) ? 700 : 180000) / data->pwm1_freq); - printk(KERN_DEBUG "lm63: PWM output active %s, %s mode\n", - (data->config_fan & 0x10) ? "low" : "high", - (data->config_fan & 0x20) ? "manual" : "auto"); -#endif -} - -static int lm63_detach_client(struct i2c_client *client) -{ - struct lm63_data *data = client->data; - int err; - - i2c_deregister_entry(data->sysctl_id); - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR "lm63: Client deregistration failed, client " - "not detached.\n"); - return err; - } - - kfree(data); - return 0; -} - -static void lm63_update_client(struct i2c_client *client) -{ - struct lm63_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ) || - (jiffies < data->last_updated) || - !data->valid) { - if (data->config & 0x04) { /* tachometer enabled */ - /* order matters for fan1_input */ - data->fan1_input = i2c_smbus_read_byte_data(client, - LM63_REG_TACH_COUNT_LSB) & 0xFC; - data->fan1_input |= i2c_smbus_read_byte_data(client, - LM63_REG_TACH_COUNT_MSB) << 8; - data->fan1_low = (i2c_smbus_read_byte_data(client, - LM63_REG_TACH_LIMIT_LSB) & 0xFC) - | (i2c_smbus_read_byte_data(client, - LM63_REG_TACH_LIMIT_MSB) << 8); - } - - data->pwm1_freq = i2c_smbus_read_byte_data(client, - LM63_REG_PWM_FREQ); - if (data->pwm1_freq == 0) - data->pwm1_freq = 1; - data->pwm1_value = i2c_smbus_read_byte_data(client, - LM63_REG_PWM_VALUE); - - data->temp1_input = i2c_smbus_read_byte_data(client, - LM63_REG_LOCAL_TEMP); - data->temp1_high = i2c_smbus_read_byte_data(client, - LM63_REG_LOCAL_HIGH); - - /* order matters for temp2_input */ - data->temp2_input = i2c_smbus_read_byte_data(client, - LM63_REG_REMOTE_TEMP_MSB) << 8; - data->temp2_input |= i2c_smbus_read_byte_data(client, - LM63_REG_REMOTE_TEMP_LSB); - data->temp2_high = (i2c_smbus_read_byte_data(client, - LM63_REG_REMOTE_HIGH_MSB) << 8) - | i2c_smbus_read_byte_data(client, - LM63_REG_REMOTE_HIGH_LSB); - data->temp2_low = (i2c_smbus_read_byte_data(client, - LM63_REG_REMOTE_LOW_MSB) << 8) - | i2c_smbus_read_byte_data(client, - LM63_REG_REMOTE_LOW_LSB); - data->temp2_crit = i2c_smbus_read_byte_data(client, - LM63_REG_REMOTE_TCRIT); - data->temp2_crit_hyst = i2c_smbus_read_byte_data(client, - LM63_REG_REMOTE_TCRIT_HYST); - - /* Mask out Busy bit in status register */ - data->alarms = i2c_smbus_read_byte_data(client, - LM63_REG_ALERT_STATUS) & 0x7F; - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -static void lm63_local_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm63_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm63_update_client(client); - results[0] = TEMP8_FROM_REG(data->temp1_high); - results[1] = TEMP8_FROM_REG(data->temp1_input); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp1_high = TEMP8_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, LM63_REG_LOCAL_HIGH, - data->temp1_high); - } - } -} - -static void lm63_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm63_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm63_update_client(client); - results[0] = TEMP11_FROM_REG(data->temp2_high); - results[1] = TEMP11_FROM_REG(data->temp2_low); - results[2] = TEMP11_FROM_REG(data->temp2_input); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp2_high = TEMP11_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, - LM63_REG_REMOTE_HIGH_MSB, - data->temp2_high >> 8); - i2c_smbus_write_byte_data(client, - LM63_REG_REMOTE_HIGH_LSB, - data->temp2_high & 0xFF); - } - if (*nrels_mag >= 2) { - data->temp2_low = TEMP11_TO_REG(results[1]); - i2c_smbus_write_byte_data(client, - LM63_REG_REMOTE_LOW_MSB, - data->temp2_low >> 8); - i2c_smbus_write_byte_data(client, - LM63_REG_REMOTE_LOW_LSB, - data->temp2_low & 0xFF); - } - } -} - -static void lm63_remote_tcrit(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm63_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm63_update_client(client); - results[0] = TEMP8_FROM_REG(data->temp2_crit); - *nrels_mag = 1; - } -} - -static void lm63_remote_tcrit_hyst(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm63_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm63_update_client(client); - results[0] = TEMP8_FROM_REG(data->temp2_crit) - - TEMP8_FROM_REG(data->temp2_crit_hyst); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp2_crit_hyst = HYST_TO_REG(data->temp2_crit - - results[0]); - i2c_smbus_write_byte_data(client, - LM63_REG_REMOTE_TCRIT_HYST, - data->temp2_crit_hyst); - } - } -} - -static void lm63_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm63_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm63_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -static void lm63_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm63_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - if (!(data->config & 0x04)) { /* tachometer disabled */ - results[0] = 0; - *nrels_mag = 1; - return; - } - - lm63_update_client(client); - results[0] = FAN_FROM_REG(data->fan1_low); - results[1] = FAN_FROM_REG(data->fan1_input); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (!(data->config & 0x04)) /* tachometer disabled */ - return; - - if (*nrels_mag >= 1) { - data->fan1_low = FAN_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, - LM63_REG_TACH_LIMIT_LSB, - data->fan1_low & 0xFF); - i2c_smbus_write_byte_data(client, - LM63_REG_TACH_LIMIT_MSB, - data->fan1_low >> 8); - } - } -} - -static void lm63_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm63_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm63_update_client(client); - results[0] = data->pwm1_value >= 2 * data->pwm1_freq ? 255 : - (data->pwm1_value * 255 + data->pwm1_freq) / - (2 * data->pwm1_freq); - results[1] = data->config_fan & 0x20 ? 1 : 2; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1 && (data->config_fan & 0x20)) { - data->pwm1_value = results[0] <= 0 ? 0 : - results[0] >= 255 ? 2 * data->pwm1_freq : - (results[0] * data->pwm1_freq * 2 + 127) / 255; - i2c_smbus_write_byte_data(client, LM63_REG_PWM_VALUE, - data->pwm1_value); - } - } -} - -static int __init lm63_init(void) -{ - printk(KERN_INFO "lm63 version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&lm63_driver); -} - -static void __exit lm63_exit(void) -{ - i2c_del_driver(&lm63_driver); -} - -MODULE_AUTHOR("Jean Delvare "); -MODULE_DESCRIPTION("LM63 sensor driver"); -MODULE_LICENSE("GPL"); - -module_init(lm63_init); -module_exit(lm63_exit); diff --git a/kernel/chips/lm75.c b/kernel/chips/lm75.c deleted file mode 100644 index 1c8f539d..00000000 --- a/kernel/chips/lm75.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - lm75.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "version.h" -#include "lm75.h" - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x48, 0x4f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(lm75); - -/* Many LM75 constants specified below */ - -/* The LM75 registers */ -#define LM75_REG_TEMP 0x00 -#define LM75_REG_CONF 0x01 -#define LM75_REG_TEMP_HYST 0x02 -#define LM75_REG_TEMP_OS 0x03 - -/* Each client has this additional data */ -struct lm75_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u16 temp, temp_os, temp_hyst; /* Register values */ -}; - -static int lm75_attach_adapter(struct i2c_adapter *adapter); -static int lm75_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void lm75_init_client(struct i2c_client *client); -static int lm75_detach_client(struct i2c_client *client); - -static int lm75_read_value(struct i2c_client *client, u8 reg); -static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value); -static void lm75_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm75_update_client(struct i2c_client *client); - - -/* This is the driver that will be inserted */ -static struct i2c_driver lm75_driver = { - .name = "LM75 sensor chip driver", - .id = I2C_DRIVERID_LM75, - .flags = I2C_DF_NOTIFY, - .attach_adapter = lm75_attach_adapter, - .detach_client = lm75_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define LM75_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected LM75. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table lm75_dir_table_template[] = { - {LM75_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm75_temp}, - {0} -}; - -static int lm75_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, lm75_detect); -} - -/* This function is called by i2c_detect */ -static int lm75_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct lm75_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("lm75.o: lm75_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA)) - goto error0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access lm75_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct lm75_data), GFP_KERNEL))) { - err = -ENOMEM; - goto error0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &lm75_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. There is no identification- - dedicated register so we have to rely on several tricks: - unused bits, registers cycling over 8-address boundaries, - addresses 0x04-0x07 returning the last read value. - The cycling+unused addresses combination is not tested, - since it would significantly slow the detection down and would - hardly add any value. */ - if (kind < 0) { - int cur, conf, hyst, os; - - /* Unused addresses */ - cur = i2c_smbus_read_word_data(new_client, 0); - conf = i2c_smbus_read_byte_data(new_client, 1); - hyst = i2c_smbus_read_word_data(new_client, 2); - if (i2c_smbus_read_word_data(new_client, 4) != hyst - || i2c_smbus_read_word_data(new_client, 5) != hyst - || i2c_smbus_read_word_data(new_client, 6) != hyst - || i2c_smbus_read_word_data(new_client, 7) != hyst) - goto error1; - os = i2c_smbus_read_word_data(new_client, 3); - if (i2c_smbus_read_word_data(new_client, 4) != os - || i2c_smbus_read_word_data(new_client, 5) != os - || i2c_smbus_read_word_data(new_client, 6) != os - || i2c_smbus_read_word_data(new_client, 7) != os) - goto error1; - - /* Unused bits */ - if (conf & 0xe0) - goto error1; - - /* Addresses cycling */ - for (i = 8; i < 0xff; i += 8) - if (i2c_smbus_read_byte_data(new_client, i + 1) != conf - || i2c_smbus_read_word_data(new_client, i + 2) != hyst - || i2c_smbus_read_word_data(new_client, i + 3) != os) - goto error1; - } - - /* Determine the chip type - only one kind supported! */ - if (kind <= 0) - kind = lm75; - - if (kind == lm75) { - type_name = "lm75"; - client_name = "LM75 chip"; - } else { - pr_debug("lm75.o: Internal error: unknown kind (%d)?!?", kind); - goto error1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto error3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - lm75_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto error4; - } - data->sysctl_id = i; - - lm75_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - error4: - i2c_detach_client(new_client); - error3: - error1: - kfree(data); - error0: - return err; -} - -static int lm75_detach_client(struct i2c_client *client) -{ - struct lm75_data *data = client->data; - - i2c_deregister_entry(data->sysctl_id); - i2c_detach_client(client); - kfree(client->data); - return 0; -} - -/* All registers are word-sized, except for the configuration register. - LM75 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int lm75_read_value(struct i2c_client *client, u8 reg) -{ - if (reg == LM75_REG_CONF) - return i2c_smbus_read_byte_data(client, reg); - else - return swab16(i2c_smbus_read_word_data(client, reg)); -} - -/* All registers are word-sized, except for the configuration register. - LM75 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) -{ - if (reg == LM75_REG_CONF) - return i2c_smbus_write_byte_data(client, reg, value); - else - return i2c_smbus_write_word_data(client, reg, swab16(value)); -} - -static void lm75_init_client(struct i2c_client *client) -{ - int i; - - /* Enable if in shutdown mode */ - i = lm75_read_value(client, LM75_REG_CONF); - if (i >= 0 && (i & 0x01)) - lm75_write_value(client, LM75_REG_CONF, i & 0xfe); -} - -static void lm75_update_client(struct i2c_client *client) -{ - struct lm75_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - pr_debug("Starting lm75 update\n"); - - data->temp = lm75_read_value(client, LM75_REG_TEMP); - data->temp_os = lm75_read_value(client, LM75_REG_TEMP_OS); - data->temp_hyst = - lm75_read_value(client, LM75_REG_TEMP_HYST); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void lm75_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm75_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - lm75_update_client(client); - results[0] = LM75_TEMP_FROM_REG(data->temp_os); - results[1] = LM75_TEMP_FROM_REG(data->temp_hyst); - results[2] = LM75_TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_os = LM75_TEMP_TO_REG(results[0]); - lm75_write_value(client, LM75_REG_TEMP_OS, - data->temp_os); - } - if (*nrels_mag >= 2) { - data->temp_hyst = LM75_TEMP_TO_REG(results[1]); - lm75_write_value(client, LM75_REG_TEMP_HYST, - data->temp_hyst); - } - } -} - -static int __init sm_lm75_init(void) -{ - printk(KERN_INFO "lm75.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&lm75_driver); -} - -static void __exit sm_lm75_exit(void) -{ - i2c_del_driver(&lm75_driver); -} - -MODULE_AUTHOR("Frodo Looijaard "); -MODULE_DESCRIPTION("LM75 driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_lm75_init); -module_exit(sm_lm75_exit); diff --git a/kernel/chips/lm75.h b/kernel/chips/lm75.h deleted file mode 100644 index 2180f976..00000000 --- a/kernel/chips/lm75.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - lm75.h - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2003 Mark M. Hoffman - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - This file contains common code for encoding/decoding LM75 type - temperature readings, which are emulated by many of the chips - we support. As the user is unlikely to load more than one driver - which contains this code, we don't worry about the wasted space. -*/ - -#include - -/* straight from the datasheet */ -#define LM75_TEMP_MIN (-550) -#define LM75_TEMP_MAX 1250 - -/* TEMP: 0.1C/bit (-55C to +125C) - REG: (0.5C/bit, two's complement) << 7 */ -static inline u16 LM75_TEMP_TO_REG(int temp) -{ - int ntemp = SENSORS_LIMIT(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); - ntemp += (ntemp<0 ? -2 : 2); - return (u16)((ntemp / 5) << 7); -} - -static inline int LM75_TEMP_FROM_REG(u16 reg) -{ - /* use integer division instead of equivalent right shift to - guarantee arithmetic shift and preserve the sign */ - return ((s16)reg / 128) * 5; -} - diff --git a/kernel/chips/lm78.c b/kernel/chips/lm78.c deleted file mode 100644 index 6598170a..00000000 --- a/kernel/chips/lm78.c +++ /dev/null @@ -1,721 +0,0 @@ -/* - lm78.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x20, 0x2f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0x0290, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_3(lm78, lm78j, lm79); - -/* Many LM78 constants specified below */ - -/* Length of ISA address segment */ -#define LM78_EXTENT 8 - -/* Where are the ISA address/data registers relative to the base address */ -#define LM78_ADDR_REG_OFFSET 5 -#define LM78_DATA_REG_OFFSET 6 - -/* The LM78 registers */ -#define LM78_REG_IN_MAX(nr) (0x2b + (nr) * 2) -#define LM78_REG_IN_MIN(nr) (0x2c + (nr) * 2) -#define LM78_REG_IN(nr) (0x20 + (nr)) - -#define LM78_REG_FAN_MIN(nr) (0x3a + (nr)) -#define LM78_REG_FAN(nr) (0x27 + (nr)) - -#define LM78_REG_TEMP 0x27 -#define LM78_REG_TEMP_OVER 0x39 -#define LM78_REG_TEMP_HYST 0x3a - -#define LM78_REG_ALARM1 0x41 -#define LM78_REG_ALARM2 0x42 - -#define LM78_REG_VID_FANDIV 0x47 - -#define LM78_REG_CONFIG 0x40 -#define LM78_REG_CHIPID 0x49 -#define LM78_REG_I2C_ADDR 0x48 - - -/* Conversions. Limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255)) -#define IN_FROM_REG(val) (((val) * 16 + 5) / 10) - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm <= 0) - return 255; - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==255?0:1350000/((val)*(div))) - -#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-5)/10):\ - ((val)+5)/10), -128, 127)) -#define TEMP_FROM_REG(val) ((val)*10) - -#define VID_FROM_REG(val) ((val)==0x1f?0:(val)>=0x10?510-(val)*10:\ - 205-(val)*5) - -#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) -#define DIV_FROM_REG(val) (1 << (val)) - -/* There are some complications in a module like this. First off, LM78 chips - may be both present on the SMBus and the ISA bus, and we have to handle - those cases separately at some places. Second, there might be several - LM78 chips available (well, actually, that is probably never done; but - it is a clean illustration of how to handle a case like that). Finally, - a specific chip may be attached to *both* ISA and SMBus, and we would - not like to detect it double. Fortunately, in the case of the LM78 at - least, a register tells us what SMBus address we are on, so that helps - a bit - except if there could be more than one SMBus. Groan. No solution - for this yet. */ - -/* This module may seem overly long and complicated. In fact, it is not so - bad. Quite a lot of bookkeeping is done. A real driver can often cut - some corners. */ - -/* For each registered LM78, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new lm78 client is - allocated. */ -struct lm78_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[7]; /* Register value */ - u8 in_max[7]; /* Register value */ - u8 in_min[7]; /* Register value */ - u8 fan[3]; /* Register value */ - u8 fan_min[3]; /* Register value */ - s8 temp; /* Register value */ - s8 temp_over; /* Register value */ - s8 temp_hyst; /* Register value */ - u8 fan_div[3]; /* Register encoding, shifted right */ - u8 vid; /* Register encoding, combined */ - u16 alarms; /* Register encoding, combined */ -}; - - -static int lm78_attach_adapter(struct i2c_adapter *adapter); -static int lm78_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int lm78_detach_client(struct i2c_client *client); - -static int lm78_read_value(struct i2c_client *client, u8 register); -static int lm78_write_value(struct i2c_client *client, u8 register, - u8 value); -static void lm78_update_client(struct i2c_client *client); -static void lm78_init_client(struct i2c_client *client); - - -static void lm78_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void lm78_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm78_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm78_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm78_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm78_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver lm78_driver = { - .name = "LM78(-J) and LM79 sensor driver", - .id = I2C_DRIVERID_LM78, - .flags = I2C_DF_NOTIFY, - .attach_adapter = lm78_attach_adapter, - .detach_client = lm78_detach_client, -}; - -/* The /proc/sys entries */ - -/* -- SENSORS SYSCTL START -- */ -#define LM78_SYSCTL_IN0 1000 /* Volts * 100 */ -#define LM78_SYSCTL_IN1 1001 -#define LM78_SYSCTL_IN2 1002 -#define LM78_SYSCTL_IN3 1003 -#define LM78_SYSCTL_IN4 1004 -#define LM78_SYSCTL_IN5 1005 -#define LM78_SYSCTL_IN6 1006 -#define LM78_SYSCTL_FAN1 1101 /* Rotations/min */ -#define LM78_SYSCTL_FAN2 1102 -#define LM78_SYSCTL_FAN3 1103 -#define LM78_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ -#define LM78_SYSCTL_VID 1300 /* Volts * 100 */ -#define LM78_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define LM78_SYSCTL_ALARMS 2001 /* bitvector */ - -#define LM78_ALARM_IN0 0x0001 -#define LM78_ALARM_IN1 0x0002 -#define LM78_ALARM_IN2 0x0004 -#define LM78_ALARM_IN3 0x0008 -#define LM78_ALARM_IN4 0x0100 -#define LM78_ALARM_IN5 0x0200 -#define LM78_ALARM_IN6 0x0400 -#define LM78_ALARM_FAN1 0x0040 -#define LM78_ALARM_FAN2 0x0080 -#define LM78_ALARM_FAN3 0x0800 -#define LM78_ALARM_TEMP 0x0010 -#define LM78_ALARM_BTI 0x0020 -#define LM78_ALARM_CHAS 0x1000 -#define LM78_ALARM_FIFO 0x2000 -#define LM78_ALARM_SMI_IN 0x4000 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected LM78. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table lm78_dir_table_template[] = { - {LM78_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_in}, - {LM78_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_in}, - {LM78_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_in}, - {LM78_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_in}, - {LM78_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_in}, - {LM78_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_in}, - {LM78_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_in}, - {LM78_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_fan}, - {LM78_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_fan}, - {LM78_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_fan}, - {LM78_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_temp}, - {LM78_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_vid}, - {LM78_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_fan_div}, - {LM78_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm78_alarms}, - {0} -}; - - -/* This function is called when: - * lm78_driver is inserted (when this module is loaded), for each - available adapter - * when a new adapter is inserted (and lm78_driver is still present) */ -static int lm78_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, lm78_detect); -} - -/* This function is called by i2c_detect */ -static int lm78_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct lm78_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - int is_isa = i2c_is_isa_adapter(adapter); - - if (!is_isa - && !i2c_check_functionality(adapter, - I2C_FUNC_SMBUS_BYTE_DATA)) goto - ERROR0; - - if (is_isa) { - if (check_region(address, LM78_EXTENT)) - goto ERROR0; - } - - /* Probe whether there is anything available on this address. Already - done for SMBus clients */ - if (kind < 0) { - if (is_isa) { - -#define REALLY_SLOW_IO - /* We need the timeouts for at least some LM78-like chips. But only - if we read 'undefined' registers. */ - i = inb_p(address + 1); - if (inb_p(address + 2) != i) - goto ERROR0; - if (inb_p(address + 3) != i) - goto ERROR0; - if (inb_p(address + 7) != i) - goto ERROR0; -#undef REALLY_SLOW_IO - - /* Let's just hope nothing breaks here */ - i = inb_p(address + 5) & 0x7f; - outb_p(~i & 0x7f, address + 5); - if ((inb_p(address + 5) & 0x7f) != (~i & 0x7f)) { - outb_p(i, address + 5); - return 0; - } - } - } - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access lm78_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct lm78_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - if (is_isa) - init_MUTEX(&data->lock); - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &lm78_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - if (kind < 0) { - if (lm78_read_value(new_client, LM78_REG_CONFIG) & 0x80) - goto ERROR1; - if (!is_isa - && (lm78_read_value(new_client, LM78_REG_I2C_ADDR) != - address)) goto ERROR1; - } - - /* Determine the chip type. */ - if (kind <= 0) { - i = lm78_read_value(new_client, LM78_REG_CHIPID); - if (i == 0x00 || i == 0x20) - kind = lm78; - else if (i == 0x40) - kind = lm78j; - else if ((i & 0xfe) == 0xc0) - kind = lm79; - else { - if (kind == 0) - printk - ("lm78.o: Ignoring 'force' parameter for unknown chip at " - "adapter %d, address 0x%02x\n", - i2c_adapter_id(adapter), address); - goto ERROR1; - } - } - - if (kind == lm78) { - type_name = "lm78"; - client_name = "LM78 chip"; - } else if (kind == lm78j) { - type_name = "lm78-j"; - client_name = "LM78-J chip"; - } else if (kind == lm79) { - type_name = "lm79"; - client_name = "LM79 chip"; - } else { -#ifdef DEBUG - printk("lm78.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Reserve the ISA region */ - if (is_isa) - request_region(address, LM78_EXTENT, type_name); - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - lm78_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the LM78 chip */ - lm78_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - if (is_isa) - release_region(address, LM78_EXTENT); - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int lm78_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct lm78_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("lm78.o: Client deregistration failed, client not detached.\n"); - return err; - } - - if(i2c_is_isa_client(client)) - release_region(client->addr, LM78_EXTENT); - kfree(client->data); - - return 0; -} - -/* The SMBus locks itself, but ISA access must be locked explicitly! - We don't want to lock the whole ISA bus, so we lock each client - separately. - We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks, - would slow down the LM78 access and should not be necessary. - There are some ugly typecasts here, but the good new is - they should - nowhere else be necessary! */ -static int lm78_read_value(struct i2c_client *client, u8 reg) -{ - int res; - if (i2c_is_isa_client(client)) { - down(&(((struct lm78_data *) (client->data))->lock)); - outb_p(reg, client->addr + LM78_ADDR_REG_OFFSET); - res = inb_p(client->addr + LM78_DATA_REG_OFFSET); - up(&(((struct lm78_data *) (client->data))->lock)); - return res; - } else - return i2c_smbus_read_byte_data(client, reg); -} - -/* The SMBus locks itself, but ISA access muse be locked explicitly! - We don't want to lock the whole ISA bus, so we lock each client - separately. - We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks, - would slow down the LM78 access and should not be necessary. - There are some ugly typecasts here, but the good new is - they should - nowhere else be necessary! */ -static int lm78_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - if (i2c_is_isa_client(client)) { - down(&(((struct lm78_data *) (client->data))->lock)); - outb_p(reg, client->addr + LM78_ADDR_REG_OFFSET); - outb_p(value, client->addr + LM78_DATA_REG_OFFSET); - up(&(((struct lm78_data *) (client->data))->lock)); - return 0; - } else - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* Called when we have found a new LM78. */ -static void lm78_init_client(struct i2c_client *client) -{ - u8 config = lm78_read_value(client, LM78_REG_CONFIG); - - /* Start monitoring */ - if (!(config & 0x01)) - lm78_write_value(client, LM78_REG_CONFIG, - (config & 0xf7) | 0x01); -} - -static void lm78_update_client(struct i2c_client *client) -{ - struct lm78_data *data = client->data; - int i; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting lm78 update\n"); -#endif - for (i = 0; i <= 6; i++) { - data->in[i] = - lm78_read_value(client, LM78_REG_IN(i)); - data->in_min[i] = - lm78_read_value(client, LM78_REG_IN_MIN(i)); - data->in_max[i] = - lm78_read_value(client, LM78_REG_IN_MAX(i)); - } - for (i = 1; i <= 3; i++) { - data->fan[i - 1] = - lm78_read_value(client, LM78_REG_FAN(i)); - data->fan_min[i - 1] = - lm78_read_value(client, LM78_REG_FAN_MIN(i)); - } - data->temp = lm78_read_value(client, LM78_REG_TEMP); - data->temp_over = - lm78_read_value(client, LM78_REG_TEMP_OVER); - data->temp_hyst = - lm78_read_value(client, LM78_REG_TEMP_HYST); - i = lm78_read_value(client, LM78_REG_VID_FANDIV); - data->vid = i & 0x0f; - if (data->type == lm79) - data->vid |= - (lm78_read_value(client, LM78_REG_CHIPID) & - 0x01) << 4; - else - data->vid |= 0x10; - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = i >> 6; - data->alarms = lm78_read_value(client, LM78_REG_ALARM1) + - (lm78_read_value(client, LM78_REG_ALARM2) << 8); - data->last_updated = jiffies; - data->valid = 1; - - data->fan_div[2] = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void lm78_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm78_data *data = client->data; - int nr = ctl_name - LM78_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - lm78_update_client(client); - results[0] = IN_FROM_REG(data->in_min[nr]); - results[1] = IN_FROM_REG(data->in_max[nr]); - results[2] = IN_FROM_REG(data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0]); - lm78_write_value(client, LM78_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1]); - lm78_write_value(client, LM78_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void lm78_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm78_data *data = client->data; - int nr = ctl_name - LM78_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm78_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data-> - fan_div[nr - 1])); - results[1] = - FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = FAN_TO_REG(results[0], - DIV_FROM_REG - (data-> - fan_div[nr - - 1])); - lm78_write_value(client, LM78_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } - } -} - - -void lm78_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm78_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - lm78_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_over); - results[1] = TEMP_FROM_REG(data->temp_hyst); - results[2] = TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_over = TEMP_TO_REG(results[0]); - lm78_write_value(client, LM78_REG_TEMP_OVER, - data->temp_over); - } - if (*nrels_mag >= 2) { - data->temp_hyst = TEMP_TO_REG(results[1]); - lm78_write_value(client, LM78_REG_TEMP_HYST, - data->temp_hyst); - } - } -} - -void lm78_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm78_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - lm78_update_client(client); - results[0] = VID_FROM_REG(data->vid); - *nrels_mag = 1; - } -} - -void lm78_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm78_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm78_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -/* Note: we save and restore the fan minimum here, because its value is - determined in part by the fan divisor. This follows the principle of - least surprise: the user doesn't expect the fan minimum to change just - because the divisor changed. */ -void lm78_fan_div(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm78_data *data = client->data; - int old, min; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm78_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - results[2] = 2; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = lm78_read_value(client, LM78_REG_VID_FANDIV); - if (*nrels_mag >= 2) { - min = FAN_FROM_REG(data->fan_min[1], - DIV_FROM_REG(data->fan_div[1])); - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) | (data->fan_div[1] << 6); - data->fan_min[1] = FAN_TO_REG(min, - DIV_FROM_REG(data->fan_div[1])); - lm78_write_value(client, LM78_REG_FAN_MIN(2), - data->fan_min[1]); - } - if (*nrels_mag >= 1) { - min = FAN_FROM_REG(data->fan_min[0], - DIV_FROM_REG(data->fan_div[0])); - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan_div[0] << 4); - data->fan_min[0] = FAN_TO_REG(min, - DIV_FROM_REG(data->fan_div[0])); - lm78_write_value(client, LM78_REG_FAN_MIN(1), - data->fan_min[0]); - lm78_write_value(client, LM78_REG_VID_FANDIV, old); - } - } -} - -static int __init sm_lm78_init(void) -{ - printk("lm78.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&lm78_driver); -} - -static void __exit sm_lm78_exit(void) -{ - i2c_del_driver(&lm78_driver); -} - - - -MODULE_AUTHOR("Frodo Looijaard "); -MODULE_DESCRIPTION("LM78, LM78-J and LM79 driver"); - -module_init(sm_lm78_init); -module_exit(sm_lm78_exit); diff --git a/kernel/chips/lm80.c b/kernel/chips/lm80.c deleted file mode 100644 index 7584306b..00000000 --- a/kernel/chips/lm80.c +++ /dev/null @@ -1,599 +0,0 @@ -/* - lm80.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - and Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x20, 0x2f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(lm80); - -/* Many LM80 constants specified below */ - -/* The LM80 registers */ -#define LM80_REG_IN_MAX(nr) (0x2a + (nr) * 2) -#define LM80_REG_IN_MIN(nr) (0x2b + (nr) * 2) -#define LM80_REG_IN(nr) (0x20 + (nr)) - -#define LM80_REG_FAN1_MIN 0x3c -#define LM80_REG_FAN2_MIN 0x3d -#define LM80_REG_FAN1 0x28 -#define LM80_REG_FAN2 0x29 - -#define LM80_REG_TEMP 0x27 -#define LM80_REG_TEMP_HOT_MAX 0x38 -#define LM80_REG_TEMP_HOT_HYST 0x39 -#define LM80_REG_TEMP_OS_MAX 0x3a -#define LM80_REG_TEMP_OS_HYST 0x3b - -#define LM80_REG_CONFIG 0x00 -#define LM80_REG_ALARM1 0x01 -#define LM80_REG_ALARM2 0x02 -#define LM80_REG_MASK1 0x03 -#define LM80_REG_MASK2 0x04 -#define LM80_REG_FANDIV 0x05 -#define LM80_REG_RES 0x06 - - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ - -#define IN_TO_REG(val) (SENSORS_LIMIT((val),0,255)) -#define IN_FROM_REG(val) (val) - -static inline unsigned char FAN_TO_REG(unsigned rpm, unsigned div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) ((val)==0?-1:\ - (val)==255?0:1350000/((div)*(val))) - -static inline long TEMP_FROM_REG(u16 temp) -{ - long res; - - temp >>= 4; - if (temp < 0x0800) - res = 625 * (long) temp; - else - res = ((long) temp - 0x01000) * 625; - - return res / 100; -} - -#define TEMP_LIMIT_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*100) - -#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT(((val)<0?(((val)-50)/100):\ - ((val)+50)/100), \ - 0,255) - -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) - -struct lm80_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[7]; /* Register value */ - u8 in_max[7]; /* Register value */ - u8 in_min[7]; /* Register value */ - u8 fan[2]; /* Register value */ - u8 fan_min[2]; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ - u16 temp; /* Register values, shifted right */ - u8 temp_hot_max; /* Register value */ - u8 temp_hot_hyst; /* Register value */ - u8 temp_os_max; /* Register value */ - u8 temp_os_hyst; /* Register value */ - u16 alarms; /* Register encoding, combined */ -}; - - - -static int lm80_attach_adapter(struct i2c_adapter *adapter); -static int lm80_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int lm80_detach_client(struct i2c_client *client); - -static int lm80_read_value(struct i2c_client *client, u8 reg); -static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value); -static void lm80_update_client(struct i2c_client *client); -static void lm80_init_client(struct i2c_client *client); - - -static void lm80_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void lm80_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm80_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm80_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm80_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver lm80_driver = { - .name = "LM80 sensor driver", - .id = I2C_DRIVERID_LM80, - .flags = I2C_DF_NOTIFY, - .attach_adapter = lm80_attach_adapter, - .detach_client = lm80_detach_client, -}; - -/* The /proc/sys entries */ - -/* -- SENSORS SYSCTL START -- */ - -#define LM80_SYSCTL_IN0 1000 /* Volts * 100 */ -#define LM80_SYSCTL_IN1 1001 -#define LM80_SYSCTL_IN2 1002 -#define LM80_SYSCTL_IN3 1003 -#define LM80_SYSCTL_IN4 1004 -#define LM80_SYSCTL_IN5 1005 -#define LM80_SYSCTL_IN6 1006 -#define LM80_SYSCTL_FAN1 1101 /* Rotations/min */ -#define LM80_SYSCTL_FAN2 1102 -#define LM80_SYSCTL_TEMP 1250 /* Degrees Celsius * 100 */ -#define LM80_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define LM80_SYSCTL_ALARMS 2001 /* bitvector */ - -#define LM80_ALARM_IN0 0x0001 -#define LM80_ALARM_IN1 0x0002 -#define LM80_ALARM_IN2 0x0004 -#define LM80_ALARM_IN3 0x0008 -#define LM80_ALARM_IN4 0x0010 -#define LM80_ALARM_IN5 0x0020 -#define LM80_ALARM_IN6 0x0040 -#define LM80_ALARM_FAN1 0x0400 -#define LM80_ALARM_FAN2 0x0800 -#define LM80_ALARM_TEMP_HOT 0x0100 -#define LM80_ALARM_TEMP_OS 0x2000 -#define LM80_ALARM_CHAS 0x1000 -#define LM80_ALARM_BTI 0x0200 -#define LM80_ALARM_INT_IN 0x0080 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected LM80. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table lm80_dir_table_template[] = { - {LM80_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_in}, - {LM80_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_in}, - {LM80_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_in}, - {LM80_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_in}, - {LM80_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_in}, - {LM80_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_in}, - {LM80_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_in}, - {LM80_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_fan}, - {LM80_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_fan}, - {LM80_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_temp}, - {LM80_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_fan_div}, - {LM80_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm80_alarms}, - {0} -}; - -static int lm80_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, lm80_detect); -} - -static int lm80_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i, cur; - struct i2c_client *new_client; - struct lm80_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("lm80.o: lm80_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access lm80_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct lm80_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &lm80_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. It is lousy. */ - if (lm80_read_value(new_client, LM80_REG_ALARM2) & 0xc0) - goto ERROR1; - for (i = 0x2a; i <= 0x3d; i++) { - cur = i2c_smbus_read_byte_data(new_client, i); - if ((i2c_smbus_read_byte_data(new_client, i + 0x40) != cur) - || (i2c_smbus_read_byte_data(new_client, i + 0x80) != - cur) - || (i2c_smbus_read_byte_data(new_client, i + 0xc0) != - cur)) goto ERROR1; - } - - /* Determine the chip type - only one kind supported! */ - if (kind <= 0) - kind = lm80; - - if (kind == lm80) { - type_name = "lm80"; - client_name = "LM80 chip"; - } else { -#ifdef DEBUG - printk("lm80.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - lm80_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - lm80_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int lm80_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct lm80_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("lm80.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -static int lm80_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* Called when we have found a new LM80. */ -static void lm80_init_client(struct i2c_client *client) -{ - /* Reset all except Watchdog values and last conversion values - This sets fan-divs to 2, among others. This makes most other - initializations unnecessary */ - lm80_write_value(client, LM80_REG_CONFIG, 0x80); - /* Set 11-bit temperature resolution */ - lm80_write_value(client, LM80_REG_RES, 0x08); - - /* Start monitoring */ - lm80_write_value(client, LM80_REG_CONFIG, 0x01); -} - -static void lm80_update_client(struct i2c_client *client) -{ - struct lm80_data *data = client->data; - int i; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > 2 * HZ) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting lm80 update\n"); -#endif - for (i = 0; i <= 6; i++) { - data->in[i] = - lm80_read_value(client, LM80_REG_IN(i)); - data->in_min[i] = - lm80_read_value(client, LM80_REG_IN_MIN(i)); - data->in_max[i] = - lm80_read_value(client, LM80_REG_IN_MAX(i)); - } - data->fan[0] = lm80_read_value(client, LM80_REG_FAN1); - data->fan_min[0] = - lm80_read_value(client, LM80_REG_FAN1_MIN); - data->fan[1] = lm80_read_value(client, LM80_REG_FAN2); - data->fan_min[1] = - lm80_read_value(client, LM80_REG_FAN2_MIN); - - data->temp = - (lm80_read_value(client, LM80_REG_TEMP) << 8) | - (lm80_read_value(client, LM80_REG_RES) & 0xf0); - data->temp_os_max = - lm80_read_value(client, LM80_REG_TEMP_OS_MAX); - data->temp_os_hyst = - lm80_read_value(client, LM80_REG_TEMP_OS_HYST); - data->temp_hot_max = - lm80_read_value(client, LM80_REG_TEMP_HOT_MAX); - data->temp_hot_hyst = - lm80_read_value(client, LM80_REG_TEMP_HOT_HYST); - - i = lm80_read_value(client, LM80_REG_FANDIV); - data->fan_div[0] = (i >> 2) & 0x03; - data->fan_div[1] = (i >> 4) & 0x03; - data->alarms = lm80_read_value(client, LM80_REG_ALARM1) + - (lm80_read_value(client, LM80_REG_ALARM2) << 8); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void lm80_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm80_data *data = client->data; - int nr = ctl_name - LM80_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - lm80_update_client(client); - results[0] = IN_FROM_REG(data->in_min[nr]); - results[1] = IN_FROM_REG(data->in_max[nr]); - results[2] = IN_FROM_REG(data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0]); - lm80_write_value(client, LM80_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1]); - lm80_write_value(client, LM80_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void lm80_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm80_data *data = client->data; - int nr = ctl_name - LM80_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm80_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data-> - fan_div[nr - 1])); - results[1] = - FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = FAN_TO_REG(results[0], - DIV_FROM_REG - (data-> - fan_div[nr - - 1])); - lm80_write_value(client, - nr == - 1 ? LM80_REG_FAN1_MIN : - LM80_REG_FAN2_MIN, - data->fan_min[nr - 1]); - } - } -} - - -void lm80_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm80_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - lm80_update_client(client); - results[0] = TEMP_LIMIT_FROM_REG(data->temp_hot_max); - results[1] = TEMP_LIMIT_FROM_REG(data->temp_hot_hyst); - results[2] = TEMP_LIMIT_FROM_REG(data->temp_os_max); - results[3] = TEMP_LIMIT_FROM_REG(data->temp_os_hyst); - results[4] = TEMP_FROM_REG(data->temp); - *nrels_mag = 5; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_hot_max = TEMP_LIMIT_TO_REG(results[0]); - lm80_write_value(client, LM80_REG_TEMP_HOT_MAX, - data->temp_hot_max); - } - if (*nrels_mag >= 2) { - data->temp_hot_hyst = - TEMP_LIMIT_TO_REG(results[1]); - lm80_write_value(client, LM80_REG_TEMP_HOT_HYST, - data->temp_hot_hyst); - } - if (*nrels_mag >= 3) { - data->temp_os_max = TEMP_LIMIT_TO_REG(results[2]); - lm80_write_value(client, LM80_REG_TEMP_OS_MAX, - data->temp_os_max); - } - if (*nrels_mag >= 4) { - data->temp_os_hyst = TEMP_LIMIT_TO_REG(results[3]); - lm80_write_value(client, LM80_REG_TEMP_OS_HYST, - data->temp_os_hyst); - } - } -} - -void lm80_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm80_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm80_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -void lm80_fan_div(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm80_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm80_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - results[2] = 2; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = lm80_read_value(client, LM80_REG_FANDIV); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0xcf) | (data->fan_div[1] << 4); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xf3) | (data->fan_div[0] << 2); - lm80_write_value(client, LM80_REG_FANDIV, old); - } - } -} - -static int __init sm_lm80_init(void) -{ - printk("lm80.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&lm80_driver); -} - -static void __exit sm_lm80_exit(void) -{ - i2c_del_driver(&lm80_driver); -} - - - -MODULE_AUTHOR - ("Frodo Looijaard and Philip Edelbrock "); -MODULE_DESCRIPTION("LM80 driver"); - -module_init(sm_lm80_init); -module_exit(sm_lm80_exit); diff --git a/kernel/chips/lm83.c b/kernel/chips/lm83.c deleted file mode 100644 index d58d5c9d..00000000 --- a/kernel/chips/lm83.c +++ /dev/null @@ -1,528 +0,0 @@ -/* - * lm83.c - Part of lm_sensors, Linux kernel modules for hardware - * monitoring - * Copyright (C) 2003 Jean Delvare - * - * Heavily inspired from the lm78, lm75 and adm1021 drivers. The LM83 is - * a sensor chip made by National Semiconductor. It reports up to four - * temperatures (its own plus up to three external ones) with a 1 deg - * resolution and a 3-4 deg accuracy. Complete datasheet can be obtained - * from National's website at: - * http://www.national.com/pf/LM/LM83.html - * Since the datasheet omits to give the chip stepping code, I give it - * here: 0x03 (at register 0xff). - * - * Also supports the LM82 temp sensor, which is basically a stripped down - * model of the LM83. Datasheet is here: - * http://www.national.com/pf/LM/LM82.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include "version.h" - -/* - * Addresses to scan - * Address is selected using 2 three-level pins, resulting in 9 possible - * addresses. - */ - -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x18, 0x1a, 0x29, 0x2b, - 0x4c, 0x4e, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* - * Insmod parameters - */ - -SENSORS_INSMOD_2(lm83, lm82); - -/* - * The LM83 registers - * Manufacturer ID is 0x01 for National Semiconductor. - */ - -#define LM83_REG_R_MAN_ID 0xFE -#define LM83_REG_R_CHIP_ID 0xFF -#define LM83_REG_R_CONFIG 0x03 -#define LM83_REG_W_CONFIG 0x09 -#define LM83_REG_R_STATUS1 0x02 -#define LM83_REG_R_STATUS2 0x35 -#define LM83_REG_R_LOCAL_TEMP 0x00 -#define LM83_REG_R_LOCAL_HIGH 0x05 -#define LM83_REG_W_LOCAL_HIGH 0x0B -#define LM83_REG_R_REMOTE1_TEMP 0x30 -#define LM83_REG_R_REMOTE1_HIGH 0x38 -#define LM83_REG_W_REMOTE1_HIGH 0x50 -#define LM83_REG_R_REMOTE2_TEMP 0x01 -#define LM83_REG_R_REMOTE2_HIGH 0x07 -#define LM83_REG_W_REMOTE2_HIGH 0x0D -#define LM83_REG_R_REMOTE3_TEMP 0x31 -#define LM83_REG_R_REMOTE3_HIGH 0x3A -#define LM83_REG_W_REMOTE3_HIGH 0x52 -#define LM83_REG_R_TCRIT 0x42 -#define LM83_REG_W_TCRIT 0x5A - -/* - * Conversions and various macros - * The LM83 uses signed 8-bit values with LSB = 1 degree Celsius. - */ - -#define TEMP_FROM_REG(val) (val) -#define TEMP_TO_REG(val) ((val) <= -50 ? -50 : \ - (val) >= 127 ? 127 : (val)) - -static const u8 LM83_REG_R_TEMP[] = { - LM83_REG_R_LOCAL_TEMP, - LM83_REG_R_REMOTE1_TEMP, - LM83_REG_R_REMOTE2_TEMP, - LM83_REG_R_REMOTE3_TEMP -}; - -static const u8 LM83_REG_R_HIGH[] = { - LM83_REG_R_LOCAL_HIGH, - LM83_REG_R_REMOTE1_HIGH, - LM83_REG_R_REMOTE2_HIGH, - LM83_REG_R_REMOTE3_HIGH -}; - -static const u8 LM83_REG_W_HIGH[] = { - LM83_REG_W_LOCAL_HIGH, - LM83_REG_W_REMOTE1_HIGH, - LM83_REG_W_REMOTE2_HIGH, - LM83_REG_W_REMOTE3_HIGH -}; - -/* - * Functions declaration - */ - -static int lm83_attach_adapter(struct i2c_adapter *adapter); -static int lm83_detect(struct i2c_adapter *adapter, int address, unsigned - short flags, int kind); -static int lm83_detach_client(struct i2c_client *client); -static void lm83_update_client(struct i2c_client *client); -static void lm83_temp(struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results); -static void lm83_tcrit(struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results); -static void lm83_alarms(struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results); - -/* - * Driver data (common to all clients) - */ - -static struct i2c_driver lm83_driver = { - .name = "LM83 sensor driver", - .id = I2C_DRIVERID_LM83, - .flags = I2C_DF_NOTIFY, - .attach_adapter = lm83_attach_adapter, - .detach_client = lm83_detach_client, -}; - -/* - * Client data (each client gets its own) - */ - -struct lm83_data -{ - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* zero until following fields are valid */ - unsigned long last_updated; /* in jiffies */ - - /* registers values */ - s8 temp[4], temp_high[4], tcrit; - u16 alarms; /* bitvector, combined */ -}; - -/* - * Proc entries - * These files are created for each detected LM83. - */ - -/* -- SENSORS SYSCTL START -- */ - -#define LM83_SYSCTL_LOCAL_TEMP 1200 -#define LM83_SYSCTL_REMOTE1_TEMP 1201 -#define LM83_SYSCTL_REMOTE2_TEMP 1202 -#define LM83_SYSCTL_REMOTE3_TEMP 1203 -#define LM83_SYSCTL_TCRIT 1208 -#define LM83_SYSCTL_ALARMS 1210 - -#define LM83_ALARM_LOCAL_HIGH 0x0040 -#define LM83_ALARM_LOCAL_CRIT 0x0001 -#define LM83_ALARM_REMOTE1_HIGH 0x8000 -#define LM83_ALARM_REMOTE1_CRIT 0x0100 -#define LM83_ALARM_REMOTE1_OPEN 0x2000 -#define LM83_ALARM_REMOTE2_HIGH 0x0010 -#define LM83_ALARM_REMOTE2_CRIT 0x0002 -#define LM83_ALARM_REMOTE2_OPEN 0x0004 -#define LM83_ALARM_REMOTE3_HIGH 0x1000 -#define LM83_ALARM_REMOTE3_CRIT 0x0200 -#define LM83_ALARM_REMOTE3_OPEN 0x0400 - -/* -- SENSORS SYSCTL END -- */ - - -static ctl_table lm83_dir_table_template[] = -{ - {LM83_SYSCTL_LOCAL_TEMP, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_temp}, - {LM83_SYSCTL_REMOTE1_TEMP, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_temp}, - {LM83_SYSCTL_REMOTE2_TEMP, "temp3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_temp}, - {LM83_SYSCTL_REMOTE3_TEMP, "temp4", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_temp}, - {LM83_SYSCTL_TCRIT, "tcrit", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_tcrit}, - {LM83_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_alarms}, - {0} -}; - -static ctl_table lm82_dir_table_template[] = -{ - {LM83_SYSCTL_LOCAL_TEMP, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_temp}, - {LM83_SYSCTL_REMOTE2_TEMP, "temp3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_temp}, - {LM83_SYSCTL_TCRIT, "tcrit", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_tcrit}, - {LM83_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm83_alarms}, - {0} -}; - -/* - * Real code - */ - -static int lm83_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, lm83_detect); -} - -/* - * The following function does more than just detection. If detection - * succeeds, it also registers the new chip. - */ -static int lm83_detect(struct i2c_adapter *adapter, int address, unsigned - short flags, int kind) -{ - struct i2c_client *new_client; - struct lm83_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) - { - printk("lm83.o: Called for an ISA bus adapter, aborting.\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - { -#ifdef DEBUG - printk("lm83.o: I2C bus doesn't support byte read mode, " - "skipping.\n"); -#endif - return 0; - } - - if (!(data = kmalloc(sizeof(struct lm83_data), GFP_KERNEL))) - { - printk("lm83.o: Out of memory in lm83_detect (new_client).\n"); - return -ENOMEM; - } - - /* - * The common I2C client data is placed right before the - * LM83-specific data. The LM83-specific data is pointed to by the - * data field from the I2C client data. - */ - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &lm83_driver; - new_client->flags = 0; - - /* - * Now we do the remaining detection. A negative kind means that - * the driver was loaded with no force parameter (default), so we - * must both detect and identify the chip (actually there is only - * one possible kind of chip for now, LM83). A zero kind means that - * the driver was loaded with the force parameter, the detection - * step shall be skipped. A positive kind means that the driver - * was loaded with the force parameter and a given kind of chip is - * requested, so both the detection and the identification steps - * are skipped. - */ - - /* Default to an LM83 if forced */ - if (kind == 0) - kind = lm83; - - if (kind < 0) /* detection */ - { - if (((i2c_smbus_read_byte_data(new_client, LM83_REG_R_STATUS1) - & 0xA8) != 0x00) - || ((i2c_smbus_read_byte_data(new_client, LM83_REG_R_STATUS2) - & 0x48) != 0x00) - || ((i2c_smbus_read_byte_data(new_client, LM83_REG_R_CONFIG) - & 0x41) != 0x00)) - { -#ifdef DEBUG - printk(KERN_DEBUG "lm83.o: Detection failed at 0x%02x.\n", - address); -#endif - goto ERROR1; - } - } - - if (kind <= 0) /* identification */ - { - u8 man_id, chip_id; - - man_id = i2c_smbus_read_byte_data(new_client, LM83_REG_R_MAN_ID); - chip_id = i2c_smbus_read_byte_data(new_client, LM83_REG_R_CHIP_ID); - if (man_id == 0x01) /* National Semiconductor */ - { - if (chip_id == 0x03) - kind = lm83; - else if (chip_id == 0x01) - kind = lm82; - } - } - - if (kind <= 0) /* identification failed */ - { - printk("lm83.o: Unsupported chip.\n"); - goto ERROR1; - } - - if (kind == lm83) - { - type_name = "lm83"; - client_name = "LM83 chip"; - } - else if (kind == lm82) - { - type_name = "lm82"; - client_name = "LM82 chip"; - } - else - { - printk("lm83.o: Unknown kind %d.\n", kind); - goto ERROR1; - } - - /* - * OK, we got a valid chip so we can fill in the remaining client - * fields. - */ - - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* - * Tell the I2C layer a new client has arrived. - */ - - if ((err = i2c_attach_client(new_client))) - { -#ifdef DEBUG - printk("lm83.o: Failed attaching client.\n"); -#endif - goto ERROR1; - } - - /* - * Register a new directory entry. - */ - - if ((kind == lm83 && (err = i2c_register_entry(new_client, type_name, - lm83_dir_table_template, THIS_MODULE)) < 0) || - (kind == lm82 && (err = i2c_register_entry(new_client, type_name, - lm82_dir_table_template, THIS_MODULE)) < 0)) - { -#ifdef DEBUG - printk("lm83.o: Failed registering directory entry.\n"); -#endif - goto ERROR2; - } - data->sysctl_id = err; - - /* - * Initialize the LM83 chip - * (Nothing to do for this one.) - */ - - return 0; - - ERROR2: - i2c_detach_client(new_client); - ERROR1: - kfree(data); - return err; -} - -static int lm83_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct lm83_data *) (client->data))->sysctl_id); - if ((err = i2c_detach_client(client))) - { - printk("lm83.o: Client deregistration failed, client not " - "detached.\n"); - return err; - } - - kfree(client->data); - return 0; -} - -static void lm83_update_client(struct i2c_client *client) -{ - struct lm83_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ * 2) || - (jiffies < data->last_updated) || !data->valid) - { - int nr; -#ifdef DEBUG - printk("lm83.o: Updating LM83 data.\n"); -#endif - for (nr = 0; nr < 4 ; nr++) - { - data->temp[nr] = - i2c_smbus_read_byte_data(client, LM83_REG_R_TEMP[nr]); - data->temp_high[nr] = - i2c_smbus_read_byte_data(client, LM83_REG_R_HIGH[nr]); - } - data->tcrit = i2c_smbus_read_byte_data(client, LM83_REG_R_TCRIT); - data->alarms = - i2c_smbus_read_byte_data(client, LM83_REG_R_STATUS1) + - (i2c_smbus_read_byte_data(client, LM83_REG_R_STATUS2) << 8); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -static void lm83_temp(struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results) -{ - struct lm83_data *data = client->data; - int nr = ctl_name - LM83_SYSCTL_LOCAL_TEMP; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) - { - lm83_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_high[nr]); - results[1] = TEMP_FROM_REG(data->temp[nr]); - *nrels_mag = 2; - } - else if (operation == SENSORS_PROC_REAL_WRITE) - { - if (*nrels_mag >= 1) - { - data->temp_high[nr] = TEMP_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, LM83_REG_W_HIGH[nr], - data->temp_high[nr]); - } - } -} - -static void lm83_tcrit(struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results) -{ - struct lm83_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) - { - lm83_update_client(client); - results[0] = TEMP_FROM_REG(data->tcrit); - *nrels_mag = 1; - } - else if (operation == SENSORS_PROC_REAL_WRITE) - { - if (*nrels_mag >= 1) - { - data->tcrit = TEMP_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, LM83_REG_W_TCRIT, - data->tcrit); - } - } -} - -static void lm83_alarms(struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results) -{ - struct lm83_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) - { - lm83_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -static int __init sm_lm83_init(void) -{ - printk(KERN_INFO "lm83.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&lm83_driver); -} - -static void __exit sm_lm83_exit(void) -{ - i2c_del_driver(&lm83_driver); -} - -MODULE_AUTHOR("Jean Delvare "); -MODULE_DESCRIPTION("LM83 sensor driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_lm83_init); -module_exit(sm_lm83_exit); diff --git a/kernel/chips/lm85.c b/kernel/chips/lm85.c deleted file mode 100644 index 4f45e892..00000000 --- a/kernel/chips/lm85.c +++ /dev/null @@ -1,2037 +0,0 @@ -/* - lm85.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - Copyright (c) 2002, 2003 Philip Pokorny - Copyright (c) 2003 Margit Schubert-While - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - CHANGELOG - - 2002-11-13 First patch for LM85 functionality - 2002-11-18 LM85 functionality mostly done - 2002-12-02 Adding ADM1027 functionality - 2002-12-06 Adding ADT7463 functionality - 2003-01-09 Code cleanup. - Save reserved bits in case they are implemented - in a future chip. (Solve problem with lockups - on ADM1027 due to chip initialization) - Added chip initialization bypass option - 2003-02-12 Add THERM asserted counts for ADT7463 - Added #ifdef so we can compile against 2.6.5 - without updating i2c-ids.h - 2003-02-17 Prepare for switch to 2.7.0 development - Implement tmin_control for ADT7463 - Expose THERM asserted counts to /proc - Code cleanup - 2003-02-19 Working with Margit and LM_SENSORS developers - 2003-02-23 Removed chip initialization entirely - Scale voltages in driver at Margit's request - Change PWM from 0-100% to 0-255 per LM sensors standard - 2003-02-27 Documentation and code cleanups - Added this CHANGELOG - Print additional precision for temperatures and voltages - Many thanks to Margit Schubert-While and Brandt xxxxxx - for help testing this version - 2003-02-28 More diagnostic messages regarding BIOS setup - 2003-03-01 Added Interrupt mask register support. - 2003-03-08 Fixed problem with pseudo 16-bit registers - Cleaned up some compiler warnings. - Fixed problem with Operating Point and THERM counting - 2003-03-21 Initial support for EMC6D100 and EMC6D101 chips - 2003-06-30 Add support for EMC6D100 extra voltage inputs. -*/ - -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" - -#ifndef I2C_DRIVERID_LM85 -#define I2C_DRIVERID_LM85 1039 -#endif - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102); - -/* Many LM85 constants specified below */ - -/* The LM85 registers */ -#define LM85_REG_IN(nr) (0x20 + (nr)) -#define LM85_REG_IN_MIN(nr) (0x44 + (nr) * 2) -#define LM85_REG_IN_MAX(nr) (0x45 + (nr) * 2) - -#define LM85_REG_TEMP(nr) (0x25 + (nr)) -#define LM85_REG_TEMP_MIN(nr) (0x4e + (nr) * 2) -#define LM85_REG_TEMP_MAX(nr) (0x4f + (nr) * 2) - -/* Fan speeds are LSB, MSB (2 bytes) */ -#define LM85_REG_FAN(nr) (0x28 + (nr) *2) -#define LM85_REG_FAN_MIN(nr) (0x54 + (nr) *2) - -#define LM85_REG_PWM(nr) (0x30 + (nr)) - -#define ADT7463_REG_OPPOINT(nr) (0x33 + (nr)) - -#define ADT7463_REG_TMIN_CTL1 0x36 -#define ADT7463_REG_TMIN_CTL2 0x37 -#define ADT7463_REG_TMIN_CTL 0x0136 - -#define LM85_REG_DEVICE 0x3d -#define LM85_REG_COMPANY 0x3e -#define LM85_REG_VERSTEP 0x3f -/* These are the recognized values for the above regs */ -#define LM85_DEVICE_ADX 0x27 -#define LM85_COMPANY_NATIONAL 0x01 -#define LM85_COMPANY_ANALOG_DEV 0x41 -#define LM85_COMPANY_SMSC 0x5c -#define LM85_VERSTEP_VMASK 0xf0 -#define LM85_VERSTEP_SMASK 0x0f -#define LM85_VERSTEP_GENERIC 0x60 -#define LM85_VERSTEP_LM85C 0x60 -#define LM85_VERSTEP_LM85B 0x62 -#define LM85_VERSTEP_ADM1027 0x60 -#define LM85_VERSTEP_ADT7463 0x62 -#define LM85_VERSTEP_ADT7463C 0x6A -#define LM85_VERSTEP_EMC6D100_A0 0x60 -#define LM85_VERSTEP_EMC6D100_A1 0x61 -#define LM85_VERSTEP_EMC6D102 0x65 - -#define LM85_REG_CONFIG 0x40 - -#define LM85_REG_ALARM1 0x41 -#define LM85_REG_ALARM2 0x42 -#define LM85_REG_ALARM 0x0141 - -#define LM85_REG_VID 0x43 - -/* Automated FAN control */ -#define LM85_REG_AFAN_CONFIG(nr) (0x5c + (nr)) -#define LM85_REG_AFAN_RANGE(nr) (0x5f + (nr)) -#define LM85_REG_AFAN_SPIKE1 0x62 -#define LM85_REG_AFAN_SPIKE2 0x63 -#define LM85_REG_AFAN_MINPWM(nr) (0x64 + (nr)) -#define LM85_REG_AFAN_LIMIT(nr) (0x67 + (nr)) -#define LM85_REG_AFAN_CRITICAL(nr) (0x6a + (nr)) -#define LM85_REG_AFAN_HYST1 0x6d -#define LM85_REG_AFAN_HYST2 0x6e - -#define LM85_REG_TACH_MODE 0x74 -#define LM85_REG_SPINUP_CTL 0x75 - -#define ADM1027_REG_TEMP_OFFSET(nr) (0x70 + (nr)) -#define ADM1027_REG_CONFIG2 0x73 -#define ADM1027_REG_INTMASK1 0x74 -#define ADM1027_REG_INTMASK2 0x75 -#define ADM1027_REG_INTMASK 0x0174 -#define ADM1027_REG_EXTEND_ADC1 0x76 -#define ADM1027_REG_EXTEND_ADC2 0x77 -#define ADM1027_REG_EXTEND_ADC 0x0176 -#define ADM1027_REG_CONFIG3 0x78 -#define ADM1027_REG_FAN_PPR 0x7b - -#define ADT7463_REG_THERM 0x79 -#define ADT7463_REG_THERM_LIMIT 0x7A -#define ADT7463_REG_CONFIG4 0x7D - -#define EMC6D100_REG_SFR 0x7c -#define EMC6D100_REG_ALARM3 0x7d -#define EMC6D100_REG_CONF 0x7f -#define EMC6D100_REG_INT_EN 0x80 -/* IN5, IN6 and IN7 */ -#define EMC6D100_REG_IN(nr) (0x70 + ((nr)-5)) -#define EMC6D100_REG_IN_MIN(nr) (0x73 + ((nr)-5) * 2) -#define EMC6D100_REG_IN_MAX(nr) (0x74 + ((nr)-5) * 2) - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - */ - -/* IN are scaled 1.000 == 0xc0, mag = 3 */ -#define IN_TO_REG(val) (SENSORS_LIMIT((((val)*0xc0+500)/1000),0,255)) -#define INEXT_FROM_REG(val,ext) (((val)*1000 + (ext)*250 + 96)/0xc0) -#define IN_FROM_REG(val) (INEXT_FROM_REG(val,0)) - -/* IN are scaled acording to built-in resistors */ -static int lm85_scaling[] = { /* .001 Volts */ - 2500, 2250, 3300, 5000, 12000, - 3300, 1500, 1800, /* EMC6D100 */ - }; -#define SCALE(val,from,to) (((val)*(to) + ((from)/2))/(from)) -#define INS_TO_REG(n,val) (SENSORS_LIMIT(SCALE(val,lm85_scaling[n],192),0,255)) -#define INSEXT_FROM_REG(n,val,ext) (SCALE((val)*4 + (ext),192*4,lm85_scaling[n])) -#define INS_FROM_REG(n,val) (INSEXT_FROM_REG(n,val,0)) - -/* FAN speed is measured using 90kHz clock */ -#define FAN_TO_REG(val) (SENSORS_LIMIT( (val)<=0?0: 5400000/(val),0,65534)) -#define FAN_FROM_REG(val) ((val)==0?-1:(val)==0xffff?0:5400000/(val)) - -/* Temperature is reported in .01 degC increments */ -#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)+50)/100,-127,127)) -#define TEMPEXT_FROM_REG(val,ext) ((val)*100 + (ext)*25) -#define TEMP_FROM_REG(val) (TEMPEXT_FROM_REG(val,0)) -#define EXTTEMP_TO_REG(val) (SENSORS_LIMIT((val)/25,-127,127)) -#define OPPOINT_TO_REG(val) (SENSORS_LIMIT(val,-127,127)) -#define OPPOINT_FROM_REG(val) (val) - -#define PWM_TO_REG(val) (SENSORS_LIMIT(val,0,255)) -#define PWM_FROM_REG(val) (val) - -#define EXT_FROM_REG(val,sensor) (((val)>>(sensor * 2))&0x03) - -/* ZONEs have the following parameters: - * Limit (low) temp, 1. degC - * Hysteresis (below limit), 1. degC (0-15) - * Range of speed control, .1 degC (2-80) - * Critical (high) temp, 1. degC - * - * FAN PWMs have the following parameters: - * Reference Zone, 1, 2, 3, etc. - * Spinup time, .05 sec - * PWM value at limit/low temp, 1 count - * PWM Frequency, 1. Hz - * PWM is Min or OFF below limit, flag - * Invert PWM output, flag - * - * Some chips filter the temp, others the fan. - * Filter constant (or disabled) .1 seconds - */ - -/* These are the zone temperature range encodings */ -static int lm85_range_map[] = { /* .1 degC */ - 20, 25, 33, 40, 50, 66, - 80, 100, 133, 160, 200, 266, - 320, 400, 533, 800 - }; -static int RANGE_TO_REG( int range ) -{ - int i; - - if( range >= lm85_range_map[15] ) { return 15 ; } - for( i = 0 ; i < 15 ; ++i ) - if( range <= lm85_range_map[i] ) - break ; - return( i & 0x0f ); -} -#define RANGE_FROM_REG(val) (lm85_range_map[(val)&0x0f]) - -/* These are the Acoustic Enhancement, or Temperature smoothing encodings - * NOTE: The enable/disable bit is INCLUDED in these encodings as the - * MSB (bit 3, value 8). If the enable bit is 0, the encoded value - * is ignored, or set to 0. - */ -static int lm85_smooth_map[] = { /* .1 sec */ - 350, 176, 118, 70, 44, 30, 16, 8 -/* 35.4 * 1/1, 1/2, 1/3, 1/5, 1/8, 1/12, 1/24, 1/48 */ - }; -static int SMOOTH_TO_REG( int smooth ) -{ - int i; - - if( smooth <= 0 ) { return 0 ; } /* Disabled */ - for( i = 0 ; i < 7 ; ++i ) - if( smooth >= lm85_smooth_map[i] ) - break ; - return( (i & 0x07) | 0x08 ); -} -#define SMOOTH_FROM_REG(val) ((val)&0x08?lm85_smooth_map[(val)&0x07]:0) - -/* These are the fan spinup delay time encodings */ -static int lm85_spinup_map[] = { /* .1 sec */ - 0, 1, 2, 4, 7, 10, 20, 40 - }; -static int SPINUP_TO_REG( int spinup ) -{ - int i; - - if( spinup >= lm85_spinup_map[7] ) { return 7 ; } - for( i = 0 ; i < 7 ; ++i ) - if( spinup <= lm85_spinup_map[i] ) - break ; - return( i & 0x07 ); -} -#define SPINUP_FROM_REG(val) (lm85_spinup_map[(val)&0x07]) - -/* These are the PWM frequency encodings */ -static int lm85_freq_map[] = { /* .1 Hz */ - 100, 150, 230, 300, 380, 470, 620, 980 - }; -static int FREQ_TO_REG( int freq ) -{ - int i; - - if( freq >= lm85_freq_map[7] ) { return 7 ; } - for( i = 0 ; i < 7 ; ++i ) - if( freq <= lm85_freq_map[i] ) - break ; - return( i & 0x07 ); -} -#define FREQ_FROM_REG(val) (lm85_freq_map[(val)&0x07]) - -/* Since we can't use strings, I'm abusing these numbers - * to stand in for the following meanings: - * 1 -- PWM responds to Zone 1 - * 2 -- PWM responds to Zone 2 - * 3 -- PWM responds to Zone 3 - * 23 -- PWM responds to the higher temp of Zone 2 or 3 - * 123 -- PWM responds to highest of Zone 1, 2, or 3 - * 0 -- PWM is always at 0% (ie, off) - * -1 -- PWM is always at 100% - * -2 -- PWM responds to manual control - */ -static int lm85_zone_map[] = { 1, 2, 3, -1, 0, 23, 123, -2 }; -static int ZONE_TO_REG( int zone ) -{ - int i; - - for( i = 0 ; i <= 7 ; ++i ) - if( zone == lm85_zone_map[i] ) - break ; - if( i > 7 ) /* Not found. */ - i = 3; /* Always 100% */ - return( (i & 0x07)<<5 ); -} -#define ZONE_FROM_REG(val) (lm85_zone_map[((val)>>5)&0x07]) - -#define HYST_TO_REG(val) (SENSORS_LIMIT((-(val)+5)/10,0,15)) -#define HYST_FROM_REG(val) (-(val)*10) - -#define OFFSET_TO_REG(val) (SENSORS_LIMIT((val)/25,-127,127)) -#define OFFSET_FROM_REG(val) ((val)*25) - -#define PPR_MASK(fan) (0x03<<(fan *2)) -#define PPR_TO_REG(val,fan) (SENSORS_LIMIT((val)-1,0,3)<<(fan *2)) -#define PPR_FROM_REG(val,fan) ((((val)>>(fan * 2))&0x03)+1) - -/* When converting to REG, we need to fixup the carry-over bit */ -#define INTMASK_FROM_REG(val) (val) -#define INTMASK_TO_REG(val) (SENSORS_LIMIT((val)|((val)&0xff00?0x80:0),0,65535)) - -/* Typically used with Pentium 4 systems v9.1 VRM spec */ -#define LM85_INIT_VRM 91 - -/* Chip sampling rates - * - * Some sensors are not updated more frequently than once per second - * so it doesn't make sense to read them more often than that. - * We cache the results and return the saved data if the driver - * is called again before a second has elapsed. - * - * Also, there is significant configuration data for this chip - * given the automatic PWM fan control that is possible. There - * are about 47 bytes of config data to only 22 bytes of actual - * readings. So, we keep the config data up to date in the cache - * when it is written and only sample it once every 5 *minutes* - */ -#define LM85_DATA_INTERVAL (1 * HZ) -#define LM85_CONFIG_INTERVAL (5 * 60 * HZ) - -/* For each registered LM85, we need to keep some data in memory. That - data is pointed to by client->data. The structure itself is - dynamically allocated, when a new lm85 client is allocated. */ - -/* LM85 can automatically adjust fan speeds based on temperature - * This structure encapsulates an entire Zone config. There are - * three zones (one for each temperature input) on the lm85 - */ -struct lm85_zone { - s8 limit; /* Low temp limit */ - u8 hyst; /* Low limit hysteresis. (0-15) */ - u8 range; /* Temp range, encoded */ - s8 critical; /* "All fans ON" temp limit */ -}; - -struct lm85_autofan { - u8 config; /* Register value */ - u8 freq; /* PWM frequency, encoded */ - u8 min_pwm; /* Minimum PWM value, encoded */ - u8 min_off; /* Min PWM or OFF below "limit", flag */ -}; - -struct lm85_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - int valid; /* !=0 if following fields are valid */ - unsigned long last_reading; /* In jiffies */ - unsigned long last_config; /* In jiffies */ - - u8 in[8]; /* Register value */ - u8 in_max[8]; /* Register value */ - u8 in_min[8]; /* Register value */ - s8 temp[3]; /* Register value */ - s8 temp_min[3]; /* Register value */ - s8 temp_max[3]; /* Register value */ - s8 temp_offset[3]; /* Register value */ - u16 fan[4]; /* Register value */ - u16 fan_min[4]; /* Register value */ - u8 pwm[3]; /* Register value */ - u8 spinup_ctl; /* Register encoding, combined */ - u8 tach_mode; /* Register encoding, combined */ - u16 extend_adc; /* Register value */ - u8 fan_ppr; /* Register value */ - u8 smooth[3]; /* Register encoding */ - u8 vid; /* Register value */ - u8 vrm; /* VRM version */ - u8 syncpwm3; /* Saved PWM3 for TACH 2,3,4 config */ - s8 oppoint[3]; /* Register value */ - u16 tmin_ctl; /* Register value */ - long therm_total; /* Cummulative therm count */ - long therm_ovfl; /* Count of therm overflows */ - u8 therm_limit; /* Register value */ - u32 alarms; /* Register encoding, combined */ - u32 alarm_mask; /* Register encoding, combined */ - struct lm85_autofan autofan[3]; - struct lm85_zone zone[3]; -}; - -static int lm85_attach_adapter(struct i2c_adapter *adapter); -static int lm85_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int lm85_detach_client(struct i2c_client *client); -static int lm85_read_value(struct i2c_client *client, u16 register); -static int lm85_write_value(struct i2c_client *client, u16 register, int value); -static void lm85_update_client(struct i2c_client *client); -static void lm85_init_client(struct i2c_client *client); - - -static void lm85_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void lm85_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_zone(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_pwm_config(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_pwm_zone(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_smooth(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static void lm85_spinup_ctl(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm85_tach_mode(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static void adm1027_tach_mode(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1027_temp_offset(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1027_fan_ppr(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1027_alarm_mask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static void adt7463_tmin_ctl(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adt7463_therm_signal(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static void emc6d100_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver lm85_driver = { - .name = "LM85 compatible sensor driver", - .id = I2C_DRIVERID_LM85, - .flags = I2C_DF_NOTIFY, - .attach_adapter = &lm85_attach_adapter, - .detach_client = &lm85_detach_client, -}; - -/* Unique ID assigned to each LM85 detected */ -static int lm85_id = 0; - -/* -- SENSORS SYSCTL START -- */ -/* Common parameters */ -#define LM85_SYSCTL_IN0 1000 -#define LM85_SYSCTL_IN1 1001 -#define LM85_SYSCTL_IN2 1002 -#define LM85_SYSCTL_IN3 1003 -#define LM85_SYSCTL_IN4 1004 -#define LM85_SYSCTL_FAN1 1005 -#define LM85_SYSCTL_FAN2 1006 -#define LM85_SYSCTL_FAN3 1007 -#define LM85_SYSCTL_FAN4 1008 -#define LM85_SYSCTL_TEMP1 1009 -#define LM85_SYSCTL_TEMP2 1010 -#define LM85_SYSCTL_TEMP3 1011 -#define LM85_SYSCTL_VID 1012 -#define LM85_SYSCTL_ALARMS 1013 -#define LM85_SYSCTL_PWM1 1014 -#define LM85_SYSCTL_PWM2 1015 -#define LM85_SYSCTL_PWM3 1016 -#define LM85_SYSCTL_VRM 1017 -#define LM85_SYSCTL_PWM_CFG1 1019 -#define LM85_SYSCTL_PWM_CFG2 1020 -#define LM85_SYSCTL_PWM_CFG3 1021 -#define LM85_SYSCTL_PWM_ZONE1 1022 -#define LM85_SYSCTL_PWM_ZONE2 1023 -#define LM85_SYSCTL_PWM_ZONE3 1024 -#define LM85_SYSCTL_ZONE1 1025 -#define LM85_SYSCTL_ZONE2 1026 -#define LM85_SYSCTL_ZONE3 1027 -#define LM85_SYSCTL_SMOOTH1 1028 -#define LM85_SYSCTL_SMOOTH2 1029 -#define LM85_SYSCTL_SMOOTH3 1030 - -/* Vendor specific values */ -#define LM85_SYSCTL_SPINUP_CTL 1100 -#define LM85_SYSCTL_TACH_MODE 1101 - -/* Analog Devices variant of the LM85 */ -#define ADM1027_SYSCTL_TACH_MODE 1200 -#define ADM1027_SYSCTL_TEMP_OFFSET1 1201 -#define ADM1027_SYSCTL_TEMP_OFFSET2 1202 -#define ADM1027_SYSCTL_TEMP_OFFSET3 1203 -#define ADM1027_SYSCTL_FAN_PPR 1204 -#define ADM1027_SYSCTL_ALARM_MASK 1205 - -/* Analog Devices variant of the LM85/ADM1027 */ -#define ADT7463_SYSCTL_TMIN_CTL1 1300 -#define ADT7463_SYSCTL_TMIN_CTL2 1301 -#define ADT7463_SYSCTL_TMIN_CTL3 1302 -#define ADT7463_SYSCTL_THERM_SIGNAL 1303 - -/* SMSC variant of the LM85 */ -#define EMC6D100_SYSCTL_IN5 1400 -#define EMC6D100_SYSCTL_IN6 1401 -#define EMC6D100_SYSCTL_IN7 1402 - -#define LM85_ALARM_IN0 0x0001 -#define LM85_ALARM_IN1 0x0002 -#define LM85_ALARM_IN2 0x0004 -#define LM85_ALARM_IN3 0x0008 -#define LM85_ALARM_TEMP1 0x0010 -#define LM85_ALARM_TEMP2 0x0020 -#define LM85_ALARM_TEMP3 0x0040 -#define LM85_ALARM_ALARM2 0x0080 -#define LM85_ALARM_IN4 0x0100 -#define LM85_ALARM_RESERVED 0x0200 -#define LM85_ALARM_FAN1 0x0400 -#define LM85_ALARM_FAN2 0x0800 -#define LM85_ALARM_FAN3 0x1000 -#define LM85_ALARM_FAN4 0x2000 -#define LM85_ALARM_TEMP1_FAULT 0x4000 -#define LM85_ALARM_TEMP3_FAULT 0x08000 -#define LM85_ALARM_IN6 0x10000 -#define LM85_ALARM_IN7 0x20000 -#define LM85_ALARM_IN5 0x40000 -/* -- SENSORS SYSCTL END -- */ - -/* The /proc/sys entries */ -/* These files are created for each detected LM85. This is just a template; - * The actual list is built from this and additional per-chip - * custom lists below. Note the XXX_LEN macros. These must be - * compile time constants because they will be used to allocate - * space for the final template passed to i2c_register_entry. - * We depend on the ability of GCC to evaluate expressions at - * compile time to turn these expressions into compile time - * constants, but this can generate a warning. - */ -static ctl_table lm85_common[] = { - {LM85_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_in}, - {LM85_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_in}, - {LM85_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_in}, - {LM85_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_in}, - {LM85_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_in}, - {LM85_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_fan}, - {LM85_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_fan}, - {LM85_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_fan}, - {LM85_SYSCTL_FAN4, "fan4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_fan}, - {LM85_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_temp}, - {LM85_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_temp}, - {LM85_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_temp}, - {LM85_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_vid}, - {LM85_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_vrm}, - {LM85_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_alarms}, - {LM85_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_pwm}, - {LM85_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_pwm}, - {LM85_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_pwm}, - {LM85_SYSCTL_PWM_CFG1, "pwm1_cfg", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_pwm_config}, - {LM85_SYSCTL_PWM_CFG2, "pwm2_cfg", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_pwm_config}, - {LM85_SYSCTL_PWM_CFG3, "pwm3_cfg", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_pwm_config}, - {LM85_SYSCTL_PWM_ZONE1, "pwm1_zone", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm85_pwm_zone}, - {LM85_SYSCTL_PWM_ZONE2, "pwm2_zone", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm85_pwm_zone}, - {LM85_SYSCTL_PWM_ZONE3, "pwm3_zone", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm85_pwm_zone}, - {LM85_SYSCTL_ZONE1, "zone1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_zone}, - {LM85_SYSCTL_ZONE2, "zone2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_zone}, - {LM85_SYSCTL_ZONE3, "zone3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_zone}, - {LM85_SYSCTL_SMOOTH1, "smooth1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_smooth}, - {LM85_SYSCTL_SMOOTH2, "smooth2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_smooth}, - {LM85_SYSCTL_SMOOTH3, "smooth3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm85_smooth}, - {0} -}; -#define CTLTBL_COMMON (sizeof(lm85_common)/sizeof(lm85_common[0])) - -/* NOTE: tach_mode is a shared name, but implemented with - * different functions - */ -static ctl_table lm85_specific[] = { - {LM85_SYSCTL_SPINUP_CTL, "spinup_ctl", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm85_spinup_ctl}, - {LM85_SYSCTL_TACH_MODE, "tach_mode", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm85_tach_mode}, -/* {0} The doc generator needs this. */ -}; -#define CTLTBL_LM85 (sizeof(lm85_specific)/sizeof(lm85_specific[0])) - -static ctl_table adm1027_specific[] = { - {ADM1027_SYSCTL_TACH_MODE, "tach_mode", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1027_tach_mode}, - {ADM1027_SYSCTL_TEMP_OFFSET1, "temp1_offset", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1027_temp_offset}, - {ADM1027_SYSCTL_TEMP_OFFSET2, "temp2_offset", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1027_temp_offset}, - {ADM1027_SYSCTL_TEMP_OFFSET3, "temp3_offset", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1027_temp_offset}, - {ADM1027_SYSCTL_FAN_PPR, "fan_ppr", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1027_fan_ppr}, - {ADM1027_SYSCTL_ALARM_MASK, "alarm_mask", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1027_alarm_mask}, -/* {0} The doc generator needs this. */ -}; -#define CTLTBL_ADM1027 (sizeof(adm1027_specific)/sizeof(adm1027_specific[0])) - -static ctl_table adt7463_specific[] = { - {ADT7463_SYSCTL_TMIN_CTL1, "tmin_ctl1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adt7463_tmin_ctl}, - {ADT7463_SYSCTL_TMIN_CTL2, "tmin_ctl2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adt7463_tmin_ctl}, - {ADT7463_SYSCTL_TMIN_CTL3, "tmin_ctl3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adt7463_tmin_ctl}, - {ADT7463_SYSCTL_THERM_SIGNAL, "therm_signal", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adt7463_therm_signal}, -/* {0} The doc generator needs this. */ -}; -#define CTLTBL_ADT7463 (sizeof(adt7463_specific)/sizeof(adt7463_specific[0])) - -static ctl_table emc6d100_specific[] = { - {EMC6D100_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &emc6d100_in}, - {EMC6D100_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &emc6d100_in}, - {EMC6D100_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &emc6d100_in}, -/* {0} The doc generator needs this. */ -}; -#define CTLTBL_EMC6D100 (sizeof(emc6d100_specific)/sizeof(emc6d100_specific[0])) - - -#define MAX2(a,b) ((a)>(b)?(a):(b)) -#define MAX3(a,b,c) ((a)>(b)?MAX2((a),(c)):MAX2((b),(c))) -#define MAX4(a,b,c,d) ((a)>(b)?MAX3((a),(c),(d)):MAX3((b),(c),(d))) - -#define CTLTBL_MAX (CTLTBL_COMMON + MAX3(CTLTBL_LM85, CTLTBL_ADM1027+CTLTBL_ADT7463, CTLTBL_EMC6D100)) - -/* This function is called when: - * lm85_driver is inserted (when this module is loaded), for each - available adapter - * when a new adapter is inserted (and lm85_driver is still present) */ -static int lm85_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, lm85_detect); -} - -/* This function is called by i2c_detect */ -static int lm85_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - int company, verstep ; - struct i2c_client *new_client; - struct lm85_data *data; - int err = 0; - const char *type_name = ""; - struct ctl_table template[CTLTBL_MAX] ; - int template_used ; - - if (i2c_is_isa_adapter(adapter)) { - /* This chip has no ISA interface */ - goto ERROR0 ; - }; - - if (!i2c_check_functionality(adapter, - I2C_FUNC_SMBUS_BYTE_DATA)) { - /* We need to be able to do byte I/O */ - goto ERROR0 ; - }; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access lm85_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct lm85_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &lm85_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - company = lm85_read_value(new_client, LM85_REG_COMPANY); - verstep = lm85_read_value(new_client, LM85_REG_VERSTEP); - -#ifdef DEBUG - printk("lm85: Detecting device at %d,0x%02x with" - " COMPANY: 0x%02x and VERSTEP: 0x%02x\n", - i2c_adapter_id(new_client->adapter), new_client->addr, - company, verstep - ); -#endif - - /* If auto-detecting, Determine the chip type. */ - if (kind <= 0) { -#ifdef DEBUG - printk("lm85: Autodetecting device at %d,0x%02x ...\n", - i2c_adapter_id(adapter), address ); -#endif - if( company == LM85_COMPANY_NATIONAL - && verstep == LM85_VERSTEP_LM85C ) { - kind = lm85c ; - } else if( company == LM85_COMPANY_NATIONAL - && verstep == LM85_VERSTEP_LM85B ) { - kind = lm85b ; - } else if( company == LM85_COMPANY_NATIONAL - && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) { - printk("lm85: Detected National Semiconductor chip\n"); - printk("lm85: Unrecgonized version/stepping 0x%02x" - " Defaulting to Generic LM85.\n", verstep ); - kind = any_chip ; - } else if( company == LM85_COMPANY_ANALOG_DEV - && verstep == LM85_VERSTEP_ADM1027 ) { - kind = adm1027 ; - } else if( company == LM85_COMPANY_ANALOG_DEV - && (verstep == LM85_VERSTEP_ADT7463 - || verstep == LM85_VERSTEP_ADT7463C) ) { - kind = adt7463 ; - } else if( company == LM85_COMPANY_ANALOG_DEV - && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) { - printk("lm85: Detected Analog Devices chip\n"); - printk("lm85: Unrecgonized version/stepping 0x%02x" - " Defaulting to Generic LM85.\n", verstep ); - kind = any_chip ; - } else if( company == LM85_COMPANY_SMSC - && verstep == LM85_VERSTEP_EMC6D102) { - kind = emc6d102; - } else if( company == LM85_COMPANY_SMSC - && (verstep == LM85_VERSTEP_EMC6D100_A0 - || verstep == LM85_VERSTEP_EMC6D100_A1) ) { - /* Unfortunately, we can't tell a '100 from a '101 - * from the registers. Since a '101 is a '100 - * in a package with fewer pins and therefore no - * 3.3V, 1.5V or 1.8V inputs, perhaps if those - * inputs read 0, then it's a '101. - */ - kind = emc6d100 ; - } else if( company == LM85_COMPANY_SMSC - && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) { - printk("lm85: Detected SMSC chip\n"); - printk("lm85: Unrecognized version/stepping 0x%02x" - " Defaulting to Generic LM85.\n", verstep ); - kind = any_chip ; - } else if( kind == any_chip - && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) { - printk("lm85: Generic LM85 Version 6 detected\n"); - /* Leave kind as "any_chip" */ - } else { -#ifdef DEBUG - printk("lm85: Autodetection failed\n"); -#endif - /* Not an LM85 ... */ - if( kind == any_chip ) { /* User used force=x,y */ - printk("lm85: Generic LM85 Version 6 not" - " found at %d,0x%02x. Try force_lm85c.\n", - i2c_adapter_id(adapter), address ); - } - goto ERROR1; - } - } - - /* Fill in the chip specific driver values */ - switch (kind) { - case any_chip : - type_name = "lm85"; - strcpy(new_client->name, "Generic LM85"); - template_used = 0 ; - break ; - case lm85b : - type_name = "lm85b"; - strcpy(new_client->name, "National LM85-B"); - memcpy( template, lm85_specific, sizeof(lm85_specific) ); - template_used = CTLTBL_LM85 ; - break ; - case lm85c : - type_name = "lm85c"; - strcpy(new_client->name, "National LM85-C"); - memcpy( template, lm85_specific, sizeof(lm85_specific) ); - template_used = CTLTBL_LM85 ; - break ; - case adm1027 : - type_name = "adm1027"; - strcpy(new_client->name, "Analog Devices ADM1027"); - memcpy( template, adm1027_specific, sizeof(adm1027_specific) ); - template_used = CTLTBL_ADM1027 ; - break ; - case adt7463 : - type_name = "adt7463"; - strcpy(new_client->name, "Analog Devices ADT7463"); - memcpy( template, adt7463_specific, sizeof(adt7463_specific) ); - template_used = CTLTBL_ADT7463 ; - memcpy( template+template_used, adm1027_specific, sizeof(adm1027_specific) ); - template_used += CTLTBL_ADM1027 ; - break ; - case emc6d100 : - type_name = "emc6d100"; - strcpy(new_client->name, "SMSC EMC6D100"); - memcpy(template, emc6d100_specific, sizeof(emc6d100_specific)); - template_used = CTLTBL_EMC6D100 ; - break ; - case emc6d102 : - type_name = "emc6d102"; - strcpy(new_client->name, "SMSC EMC6D102"); - template_used = 0; - break; - default : - printk("lm85: Internal error, invalid kind (%d)!", kind); - err = -EFAULT ; - goto ERROR1; - } - - /* Fill in the remaining client fields */ - new_client->id = lm85_id++; - printk("lm85: Assigning ID %d to %s at %d,0x%02x\n", - new_client->id, new_client->name, - i2c_adapter_id(new_client->adapter), - new_client->addr - ); - - /* Housekeeping values */ - data->type = kind; - data->valid = 0; - - /* Set the VRM version */ - data->vrm = LM85_INIT_VRM ; - - /* Zero the accumulators */ - data->therm_total = 0; - data->therm_ovfl = 0; - - init_MUTEX(&data->update_lock); - - /* Initialize the LM85 chip */ - lm85_init_client(new_client); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR1; - - /* Finish out the template */ - memcpy( template + template_used, lm85_common, sizeof(lm85_common) ); - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR2; - } - data->sysctl_id = i; - - return 0; - - /* Error out and cleanup code */ - ERROR2: - i2c_detach_client(new_client); - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int lm85_detach_client(struct i2c_client *client) -{ - int err; - int id ; - - id = client->id; - i2c_deregister_entry(((struct lm85_data *)(client->data))->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk("lm85(%d): Client deregistration failed," - " client not detached.\n", id ); - return err; - } - - kfree(client->data); - - return 0; -} - -static int lm85_read_value(struct i2c_client *client, u16 reg) -{ - int res; - - /* What size location is it? */ - switch( reg ) { - case LM85_REG_FAN(0) : /* Read WORD data */ - case LM85_REG_FAN(1) : - case LM85_REG_FAN(2) : - case LM85_REG_FAN(3) : - case LM85_REG_FAN_MIN(0) : - case LM85_REG_FAN_MIN(1) : - case LM85_REG_FAN_MIN(2) : - case LM85_REG_FAN_MIN(3) : - case LM85_REG_ALARM : /* Read ALARM1 and ALARM2 */ - case ADM1027_REG_INTMASK : /* Read MASK1 and MASK2 */ - case ADM1027_REG_EXTEND_ADC : /* Read ADC1 and ADC2 */ - reg &= 0xff ; /* Pseudo words have address + 0x0100 */ - res = i2c_smbus_read_byte_data(client, reg) & 0xff ; - res |= (i2c_smbus_read_byte_data(client, reg+1) & 0xff) << 8 ; - break ; - case ADT7463_REG_TMIN_CTL : /* Read WORD MSB, LSB */ - reg &= 0xff ; /* Pseudo words have address + 0x0100 */ - res = (i2c_smbus_read_byte_data(client, reg) & 0xff) << 8 ; - res |= i2c_smbus_read_byte_data(client, reg+1) & 0xff ; - break ; - default: /* Read BYTE data */ - res = i2c_smbus_read_byte_data(client, reg & 0xff) & 0xff ; - break ; - } - - return res ; -} - -static int lm85_write_value(struct i2c_client *client, u16 reg, int value) -{ - int res ; - - switch( reg ) { - case LM85_REG_FAN(0) : /* Write WORD data */ - case LM85_REG_FAN(1) : - case LM85_REG_FAN(2) : - case LM85_REG_FAN(3) : - case LM85_REG_FAN_MIN(0) : - case LM85_REG_FAN_MIN(1) : - case LM85_REG_FAN_MIN(2) : - case LM85_REG_FAN_MIN(3) : - case ADM1027_REG_INTMASK : - /* NOTE: ALARM and ADC are read only, so not included here */ - reg &= 0xff ; /* Pseudo words have address + 0x0100 */ - res = i2c_smbus_write_byte_data(client, reg, value & 0xff) ; - res |= i2c_smbus_write_byte_data(client, reg+1, (value>>8) & 0xff) ; - break ; - case ADT7463_REG_TMIN_CTL : /* Write WORD MSB, LSB */ - reg &= 0xff ; /* Pseudo words have address + 0x0100 */ - res = i2c_smbus_write_byte_data(client, reg, (value>>8) & 0xff); - res |= i2c_smbus_write_byte_data(client, reg+1, value & 0xff) ; - break ; - default: /* Write BYTE data */ - res = i2c_smbus_write_byte_data(client, reg & 0xff, value); - break ; - } - - return res ; -} - -/* Called when we have found a new LM85. */ -static void lm85_init_client(struct i2c_client *client) -{ - int value; - struct lm85_data *data = client->data; - -#ifdef DEBUG - printk("lm85(%d): Initializing device\n", client->id); -#endif - - /* Warn if part was not "READY" */ - value = lm85_read_value(client, LM85_REG_CONFIG); -#ifdef DEBUG - printk("lm85(%d): LM85_REG_CONFIG is: 0x%02x\n", client->id, value ); -#endif - if( value & 0x02 ) { - printk("lm85(%d): Client (%d,0x%02x) config is locked.\n", - client->id, - i2c_adapter_id(client->adapter), client->addr ); - }; - if( ! (value & 0x04) ) { - printk("lm85(%d): Client (%d,0x%02x) is not ready.\n", - client->id, - i2c_adapter_id(client->adapter), client->addr ); - }; - if( (data->type == adm1027 || data->type == adt7463) - && (value & 0x10) - ) { - printk("lm85(%d): Client (%d,0x%02x) VxI mode is set. " - "Please report this to the lm85 maintainer.\n", - client->id, - i2c_adapter_id(client->adapter), client->addr ); - }; - - /* See if SYNC to PWM3 is set */ - if( data->type == adt7463 - && (lm85_read_value(client, LM85_REG_AFAN_SPIKE1) & 0x10) - ) { - printk("lm85(%d): Sync to PWM3 is set. Expect PWM3 " - "to control fans 2, 3, and 4\n", - client->id ); - }; - - /* See if PWM2 is #SMBALERT */ - if( (data->type == adm1027 || data->type == adt7463) - && (lm85_read_value(client, ADM1027_REG_CONFIG3) & 0x01) - ) { - printk("lm85(%d): PWM2 is SMBALERT. PWM2 not available.\n", - client->id ); - }; - - /* Check if 2.5V and 5V inputs are reconfigured */ - if( data->type == adt7463 ) { - value = lm85_read_value(client, ADT7463_REG_CONFIG4); - if( value & 0x01 ) { - printk("lm85(%d): 2.5V input (in0) is SMBALERT. " - "in0 not available.\n", client->id ); - }; - if( value & 0x02 ) { - printk("lm85(%d): 5V input (in3) is THERM. " - "in3 not available.\n", client->id ); - } - }; - - /* FIXME? Display EMC6D100 config info? */ - - /* WE INTENTIONALLY make no changes to the limits, - * offsets, pwms, fans and zones. If they were - * configured, we don't want to mess with them. - * If they weren't, the default is 100% PWM, no - * control and will suffice until 'sensors -s' - * can be run by the user. - */ - - /* Start monitoring */ - value = lm85_read_value(client, LM85_REG_CONFIG); - /* Try to clear LOCK, Set START, save everything else */ - value = ((value & ~ 0x02) | 0x01) & 0xff ; -#ifdef DEBUG - printk("lm85(%d): Setting CONFIG to: 0x%02x\n", client->id, value ); -#endif - lm85_write_value(client, LM85_REG_CONFIG, value); - -} - -static void lm85_update_client(struct i2c_client *client) -{ - struct lm85_data *data = client->data; - int i; - - down(&data->update_lock); - - if (!data->valid - || (jiffies - data->last_reading > LM85_DATA_INTERVAL )) { - /* Things that change quickly */ - -#ifdef DEBUG - printk("lm85(%d): Reading sensor values\n", client->id); -#endif - /* Have to read extended bits first to "freeze" the - * more significant bits that are read later. - */ - switch( data->type ) { - case adm1027 : - case adt7463 : - data->extend_adc = - lm85_read_value(client, ADM1027_REG_EXTEND_ADC); - break ; - default : - data->extend_adc = 0 ; - break ; - } - - for (i = 0; i <= 4; ++i) { - data->in[i] = - lm85_read_value(client, LM85_REG_IN(i)); - } - - for (i = 0; i <= 3; ++i) { - data->fan[i] = - lm85_read_value(client, LM85_REG_FAN(i)); - } - - for (i = 0; i <= 2; ++i) { - data->temp[i] = - lm85_read_value(client, LM85_REG_TEMP(i)); - } - - for (i = 0; i <= 2; ++i) { - data->pwm[i] = - lm85_read_value(client, LM85_REG_PWM(i)); - } - - data->alarms = lm85_read_value(client, LM85_REG_ALARM); - - switch( ((struct lm85_data *)(client->data))->type ) { - case adt7463 : - /* REG_THERM code duplicated in therm_signal() */ - i = lm85_read_value(client, ADT7463_REG_THERM); - if( data->therm_total < LONG_MAX - 256 ) { - data->therm_total += i ; - } - if( i >= 255 ) { - ++data->therm_ovfl ; - } - break ; - case emc6d100 : - /* Three more voltage sensors */ - for (i = 5; i <= 7; ++i) { - data->in[i] = - lm85_read_value(client, EMC6D100_REG_IN(i)); - } - /* More alarm bits */ - data->alarms |= - lm85_read_value(client, EMC6D100_REG_ALARM3) << 16; - - break ; - default : break ; /* no warnings */ - } - - data->last_reading = jiffies ; - }; /* last_reading */ - - if (!data->valid - || (jiffies - data->last_config > LM85_CONFIG_INTERVAL) ) { - /* Things that don't change often */ - -#ifdef DEBUG - printk("lm85(%d): Reading config values\n", client->id); -#endif - for (i = 0; i <= 4; ++i) { - data->in_min[i] = - lm85_read_value(client, LM85_REG_IN_MIN(i)); - data->in_max[i] = - lm85_read_value(client, LM85_REG_IN_MAX(i)); - } - - for (i = 0; i <= 3; ++i) { - data->fan_min[i] = - lm85_read_value(client, LM85_REG_FAN_MIN(i)); - } - - for (i = 0; i <= 2; ++i) { - data->temp_min[i] = - lm85_read_value(client, LM85_REG_TEMP_MIN(i)); - data->temp_max[i] = - lm85_read_value(client, LM85_REG_TEMP_MAX(i)); - } - - data->vid = lm85_read_value(client, LM85_REG_VID); - - for (i = 0; i <= 2; ++i) { - int val ; - data->autofan[i].config = - lm85_read_value(client, LM85_REG_AFAN_CONFIG(i)); - val = lm85_read_value(client, LM85_REG_AFAN_RANGE(i)); - data->autofan[i].freq = val & 0x07 ; - data->zone[i].range = (val >> 4) & 0x0f ; - data->autofan[i].min_pwm = - lm85_read_value(client, LM85_REG_AFAN_MINPWM(i)); - data->zone[i].limit = - lm85_read_value(client, LM85_REG_AFAN_LIMIT(i)); - data->zone[i].critical = - lm85_read_value(client, LM85_REG_AFAN_CRITICAL(i)); - } - - i = lm85_read_value(client, LM85_REG_AFAN_SPIKE1); - data->smooth[0] = i & 0x0f ; - data->syncpwm3 = i & 0x10 ; /* Save PWM3 config */ - data->autofan[0].min_off = i & 0x20 ; - data->autofan[1].min_off = i & 0x40 ; - data->autofan[2].min_off = i & 0x80 ; - i = lm85_read_value(client, LM85_REG_AFAN_SPIKE2); - data->smooth[1] = (i>>4) & 0x0f ; - data->smooth[2] = i & 0x0f ; - - i = lm85_read_value(client, LM85_REG_AFAN_HYST1); - data->zone[0].hyst = (i>>4) & 0x0f ; - data->zone[1].hyst = i & 0x0f ; - - i = lm85_read_value(client, LM85_REG_AFAN_HYST2); - data->zone[2].hyst = (i>>4) & 0x0f ; - - switch( ((struct lm85_data *)(client->data))->type ) { - case lm85b : - case lm85c : - data->tach_mode = lm85_read_value(client, - LM85_REG_TACH_MODE ); - data->spinup_ctl = lm85_read_value(client, - LM85_REG_SPINUP_CTL ); - break ; - case adt7463 : - for (i = 0; i <= 2; ++i) { - data->oppoint[i] = lm85_read_value(client, - ADT7463_REG_OPPOINT(i) ); - } - data->tmin_ctl = lm85_read_value(client, - ADT7463_REG_TMIN_CTL ); - data->therm_limit = lm85_read_value(client, - ADT7463_REG_THERM_LIMIT ); - /* FALL THROUGH */ - case adm1027 : - for (i = 0; i <= 2; ++i) { - data->temp_offset[i] = lm85_read_value(client, - ADM1027_REG_TEMP_OFFSET(i) ); - } - data->tach_mode = lm85_read_value(client, - ADM1027_REG_CONFIG3 ); - data->fan_ppr = lm85_read_value(client, - ADM1027_REG_FAN_PPR ); - data->alarm_mask = lm85_read_value(client, - ADM1027_REG_INTMASK ); - break ; - case emc6d100 : - for (i = 5; i <= 7; ++i) { - data->in_min[i] = - lm85_read_value(client, EMC6D100_REG_IN_MIN(i)); - data->in_max[i] = - lm85_read_value(client, EMC6D100_REG_IN_MAX(i)); - } - break ; - default : break ; /* no warnings */ - } - - data->last_config = jiffies; - }; /* last_config */ - - data->valid = 1; - - up(&data->update_lock); -} - - -/* The next functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the data - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - */ -void lm85_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - LM85_SYSCTL_IN0; - - if (nr < 0 || nr > 4) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; /* 1.000 */ - else if (operation == SENSORS_PROC_REAL_READ) { - int ext = 0 ; - lm85_update_client(client); - ext = EXT_FROM_REG(data->extend_adc, nr); - results[0] = INS_FROM_REG(nr,data->in_min[nr]); - results[1] = INS_FROM_REG(nr,data->in_max[nr]); - results[2] = INSEXT_FROM_REG(nr,data->in[nr],ext); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 1) { - data->in_max[nr] = INS_TO_REG(nr,results[1]); - lm85_write_value(client, LM85_REG_IN_MAX(nr), - data->in_max[nr]); - } - if (*nrels_mag > 0) { - data->in_min[nr] = INS_TO_REG(nr,results[0]); - lm85_write_value(client, LM85_REG_IN_MIN(nr), - data->in_min[nr]); - } - up(&data->update_lock); - } -} - -void lm85_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - LM85_SYSCTL_FAN1 ; - - if (nr < 0 || nr > 3) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr]); - results[1] = FAN_FROM_REG(data->fan[nr]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->fan_min[nr] = FAN_TO_REG(results[0]); - lm85_write_value(client, LM85_REG_FAN_MIN(nr), - data->fan_min[nr]); - } - up(&data->update_lock); - } -} - - -void lm85_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - LM85_SYSCTL_TEMP1 ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - int ext = 0 ; - lm85_update_client(client); - - /* +5 for offset of temp data in ext reg */ - ext = EXT_FROM_REG(data->extend_adc, nr+5); - - results[0] = TEMP_FROM_REG(data->temp_min[nr]); - results[1] = TEMP_FROM_REG(data->temp_max[nr]); - results[2] = TEMPEXT_FROM_REG(data->temp[nr],ext); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 1) { - data->temp_max[nr] = TEMP_TO_REG(results[1]); - lm85_write_value(client, LM85_REG_TEMP_MAX(nr), - data->temp_max[nr]); - } - if (*nrels_mag > 0) { - data->temp_min[nr] = TEMP_TO_REG(results[0]); - lm85_write_value(client, LM85_REG_TEMP_MIN(nr), - data->temp_min[nr]); - } - up(&data->update_lock); - } -} - -void lm85_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - LM85_SYSCTL_PWM1 ; - int pwm_zone ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = PWM_FROM_REG(data->pwm[nr]); - pwm_zone = ZONE_FROM_REG(data->autofan[nr].config); - /* PWM "enabled" if not off (0) nor on (-1) */ - results[1] = pwm_zone != 0 && pwm_zone != -1 ; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - /* PWM enable is read-only */ - if (*nrels_mag > 0) { - data->pwm[nr] = PWM_TO_REG(results[0]); - lm85_write_value(client, LM85_REG_PWM(nr), - data->pwm[nr]); - } - up(&data->update_lock); - } -} - -void lm85_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - - if( ctl_name != LM85_SYSCTL_VID ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = vid_from_reg((data->vid)&0x3f, data->vrm); - *nrels_mag = 1; - } -} - -void lm85_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - - if( ctl_name != LM85_SYSCTL_VRM ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm ; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->vrm = results[0] ; - } - up(&data->update_lock); - } -} - -void lm85_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - - if( ctl_name != LM85_SYSCTL_ALARMS ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -void lm85_spinup_ctl(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int old; - - if( ctl_name != LM85_SYSCTL_SPINUP_CTL ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = (data->spinup_ctl & 1) != 0 ; - results[1] = (data->spinup_ctl & 2) != 0 ; - results[2] = (data->spinup_ctl & 4) != 0 ; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - old = data->spinup_ctl ; - if (*nrels_mag > 2) { - old = (old & (~4)) | (results[2]?4:0) ; - } - if (*nrels_mag > 1) { - old = (old & (~2)) | (results[1]?2:0) ; - } - if (*nrels_mag > 0) { - old = (old & (~1)) | (results[0]?1:0) ; - lm85_write_value(client, LM85_REG_SPINUP_CTL, old); - data->spinup_ctl = old ; - } - up(&data->update_lock); - } -} - -void lm85_tach_mode(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int old; - - /* Tach Mode 1, Tach Mode 2, Tach Mode 3 & 4 */ - - if( ctl_name != LM85_SYSCTL_TACH_MODE ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = (data->tach_mode & 0x03) ; - results[1] = (data->tach_mode & 0x0c) >> 2 ; - results[2] = (data->tach_mode & 0x30) >> 4 ; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - old = data->tach_mode ; - if (*nrels_mag > 2) { - old = (old & (~0x30)) | ((results[2]&3) << 4) ; - } - if (*nrels_mag > 1) { - old = (old & (~0x0c)) | ((results[1]&3) << 2) ; - } - if (*nrels_mag > 0) { - old = (old & (~0x03)) | (results[0]&3) ; - lm85_write_value(client, LM85_REG_TACH_MODE, old); - data->tach_mode = old ; - } - up(&data->update_lock); - } -} - -void adm1027_tach_mode(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int old; - - /* Tach/DC 1, Tach/DC 2, Tach/DC 3, Tach/DC 4 */ - - if( ctl_name != ADM1027_SYSCTL_TACH_MODE ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = (data->tach_mode & 0x10) != 0 ; - results[1] = (data->tach_mode & 0x20) != 0 ; - results[2] = (data->tach_mode & 0x40) != 0 ; - results[3] = (data->tach_mode & 0x80) != 0 ; - *nrels_mag = 4; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - old = data->tach_mode ; - if (*nrels_mag > 3) { - old = (old & (~0x80)) | (results[3] ? 0x80 : 0) ; - } - if (*nrels_mag > 2) { - old = (old & (~0x40)) | (results[2] ? 0x40 : 0) ; - } - if (*nrels_mag > 1) { - old = (old & (~0x20)) | (results[1] ? 0x20 : 0) ; - } - if (*nrels_mag > 0) { - old = (old & (~0x10)) | (results[0] ? 0x10 : 0) ; - - /* Enable fast measurements if any TACH's are DC */ - old = (old & (~0x08)) | ((old&0xf0) ? 0x08 : 0) ; - - lm85_write_value(client, ADM1027_REG_CONFIG3, old); - data->tach_mode = old ; - } - up(&data->update_lock); - } -} - -void lm85_pwm_config(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - LM85_SYSCTL_PWM_CFG1 ; - - /* Spinup, min PWM, PWM Frequency, min below limit, Invert */ - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - - results[0] = SPINUP_FROM_REG(data->autofan[nr].config); - results[1] = PWM_FROM_REG(data->autofan[nr].min_pwm)*10; - results[2] = FREQ_FROM_REG(data->autofan[nr].freq); - results[3] = data->autofan[nr].min_off ? 10 : 0 ; - results[4] = (data->autofan[nr].config & 0x10) ? 10 : 0 ; - *nrels_mag = 5; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - int old_config ; - - down(&data->update_lock); - old_config = data->autofan[nr].config ; - if (*nrels_mag > 4) { - old_config = (old_config & (~0x10)) | (results[4]?0x10:0) ; - } - if (*nrels_mag > 3) { - data->autofan[nr].min_off = results[3] != 0 ; - lm85_write_value(client, LM85_REG_AFAN_SPIKE1, - data->smooth[0] - | data->syncpwm3 - | (data->autofan[0].min_off ? 0x20 : 0) - | (data->autofan[1].min_off ? 0x40 : 0) - | (data->autofan[2].min_off ? 0x80 : 0) - ); - } - if (*nrels_mag > 2) { - data->autofan[nr].freq = FREQ_TO_REG(results[2]) ; - lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), - (data->zone[nr].range << 4) - | data->autofan[nr].freq - ); - } - if (*nrels_mag > 1) { - data->autofan[nr].min_pwm = PWM_TO_REG((results[1]+5)/10); - lm85_write_value(client, LM85_REG_AFAN_MINPWM(nr), - data->autofan[nr].min_pwm - ); - } - if (*nrels_mag > 0) { - old_config = (old_config & (~0x07)) | SPINUP_TO_REG(results[0]) ; - lm85_write_value(client, LM85_REG_AFAN_CONFIG(nr), old_config); - data->autofan[nr].config = old_config ; - } - up(&data->update_lock); - } -} - -void lm85_smooth(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - LM85_SYSCTL_SMOOTH1 ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = SMOOTH_FROM_REG(data->smooth[nr]); - *nrels_mag = 1; - - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if( *nrels_mag > 0 ) { - data->smooth[nr] = SMOOTH_TO_REG(results[0]); - } - if( nr == 0 ) { - lm85_write_value(client, LM85_REG_AFAN_SPIKE1, - data->smooth[0] - | data->syncpwm3 - | (data->autofan[0].min_off ? 0x20 : 0) - | (data->autofan[1].min_off ? 0x40 : 0) - | (data->autofan[2].min_off ? 0x80 : 0) - ); - } else { - lm85_write_value(client, LM85_REG_AFAN_SPIKE2, - (data->smooth[1] << 4) | data->smooth[2]); - } - up(&data->update_lock); - } -} - -void lm85_zone(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - LM85_SYSCTL_ZONE1 ; - - /* Limit, Hysteresis (neg), Range, Critical */ - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - - results[0] = TEMP_FROM_REG(data->zone[nr].limit) / 10; - results[1] = HYST_FROM_REG(data->zone[nr].hyst); - results[2] = RANGE_FROM_REG(data->zone[nr].range); - results[3] = TEMP_FROM_REG(data->zone[nr].critical) / 10; - *nrels_mag = 4; - - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 3) { - data->zone[nr].critical = TEMP_TO_REG(results[3]*10); - lm85_write_value(client, LM85_REG_AFAN_CRITICAL(nr), - data->zone[nr].critical ); - } - if (*nrels_mag > 2) { - data->zone[nr].range = RANGE_TO_REG(results[2]); - lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), - (data->zone[nr].range << 4) - | data->autofan[nr].freq - ); - } - if (*nrels_mag > 1) { - data->zone[nr].hyst = HYST_TO_REG(results[1]); - if( nr == 0 || nr == 1 ) { - lm85_write_value(client, LM85_REG_AFAN_HYST1, - (data->zone[0].hyst << 4) - | data->zone[1].hyst - ); - } else { - lm85_write_value(client, LM85_REG_AFAN_HYST2, - (data->zone[2].hyst << 4) - ); - } - } - if (*nrels_mag > 0) { - data->zone[nr].limit = TEMP_TO_REG(results[0]*10); - lm85_write_value(client, LM85_REG_AFAN_LIMIT(nr), - data->zone[nr].limit - ); - } - up(&data->update_lock); - } -} - -void lm85_pwm_zone(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - LM85_SYSCTL_PWM_ZONE1 ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = ZONE_FROM_REG(data->autofan[nr].config); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->autofan[nr].config = - (data->autofan[nr].config & (~0xe0)) - | ZONE_TO_REG(results[0]) ; - lm85_write_value(client, LM85_REG_AFAN_CONFIG(nr), - data->autofan[nr].config); - } - up(&data->update_lock); - } -} - -void adm1027_temp_offset(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - ADM1027_SYSCTL_TEMP_OFFSET1 ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - switch( data->type ) { - case adm1027 : - default : - results[0] = TEMP_FROM_REG(data->temp_offset[nr]); - break ; - case adt7463 : - results[0] = TEMPEXT_FROM_REG(0,data->temp_offset[nr]); - break ; - } - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - switch( data->type ) { - case adm1027 : - default : - data->temp_offset[nr] = TEMP_TO_REG(results[0]); - break ; - case adt7463 : - data->temp_offset[nr] = EXTTEMP_TO_REG(results[0]); - break ; - }; - lm85_write_value(client, ADM1027_REG_TEMP_OFFSET(nr), - data->temp_offset[nr]); - } - up(&data->update_lock); - } -} - -void adm1027_fan_ppr(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int old ; - - if (ctl_name != ADM1027_SYSCTL_FAN_PPR) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = PPR_FROM_REG(data->fan_ppr,0); - results[1] = PPR_FROM_REG(data->fan_ppr,1); - results[2] = PPR_FROM_REG(data->fan_ppr,2); - results[3] = PPR_FROM_REG(data->fan_ppr,3); - *nrels_mag = 4; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - old = data->fan_ppr ; - if (*nrels_mag > 3) { - old = (old & ~PPR_MASK(3)) | PPR_TO_REG(results[3],3); - }; - if (*nrels_mag > 2) { - old = (old & ~PPR_MASK(2)) | PPR_TO_REG(results[2],2); - }; - if (*nrels_mag > 1) { - old = (old & ~PPR_MASK(1)) | PPR_TO_REG(results[1],1); - }; - if (*nrels_mag > 0) { - old = (old & ~PPR_MASK(0)) | PPR_TO_REG(results[0],0); - lm85_write_value(client, ADM1027_REG_FAN_PPR, old); - data->fan_ppr = old ; - } - up(&data->update_lock); - } -} - -void adm1027_alarm_mask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - - if( ctl_name != ADM1027_SYSCTL_ALARM_MASK ) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = INTMASK_FROM_REG(data->alarm_mask); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 0) { - data->alarm_mask = INTMASK_TO_REG(results[0]); - lm85_write_value(client, ADM1027_REG_INTMASK, - data->alarm_mask); - } - up(&data->update_lock); - } -} - -void adt7463_tmin_ctl(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - ADT7463_SYSCTL_TMIN_CTL1 ; - u16 old ; - - if (nr < 0 || nr > 2) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - old = data->tmin_ctl ; - results[0] = (old & ( 0x2000 << nr )) != 0 ; - results[1] = (old >> (nr*3)) & 0x07 ; - results[2] = (old & ( 0x0400 << nr )) != 0 ; - results[3] = OPPOINT_FROM_REG(data->oppoint[nr]); - *nrels_mag = 4; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - old = data->tmin_ctl ; - if (*nrels_mag > 3) { - data->oppoint[nr] = OPPOINT_TO_REG(results[3]); - lm85_write_value(client, ADT7463_REG_OPPOINT(nr), - data->oppoint[nr]); - }; - if (*nrels_mag > 2) { - if( results[2] ) { - old |= (0x0400 << nr) ; - } else { - old &= ~(0x0400 << nr) ; - } - }; - if (*nrels_mag > 1) { - old &= ~(0x07 << (nr*3)) ; - old |= (results[1] & 0x07) << (nr*3) ; - }; - if (*nrels_mag > 0) { - if( results[0] ) { - old |= 0x2000 << nr ; - } else { - old &= ~(0x2000 << nr) ; - } - lm85_write_value(client, ADT7463_REG_TMIN_CTL, old); - data->tmin_ctl = old ; - } - up(&data->update_lock); - } -} - -void adt7463_therm_signal(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int counts ; - - if (ctl_name != ADT7463_SYSCTL_THERM_SIGNAL) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - /* Don't call update_client here because - * ADT7463_REG_THERM has to be read every - * 5 seconds to prevent lost counts - */ - down(&data->update_lock); - counts = lm85_read_value(client, ADT7463_REG_THERM) & 0xff; - if( data->therm_total < LONG_MAX - 256 ) { - data->therm_total += counts ; - } - if( counts >= 255 ) { - ++data->therm_ovfl ; - } - up(&data->update_lock); - - results[0] = data->therm_limit ; - results[1] = data->therm_total ; - results[2] = data->therm_ovfl ; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - /* therm_total and therm_ovfl are read only */ - if (*nrels_mag > 0) { - data->therm_limit = SENSORS_LIMIT(results[0],0,255); - lm85_write_value(client, ADT7463_REG_THERM_LIMIT, - data->therm_limit); - }; - up(&data->update_lock); - } -} - - -void emc6d100_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm85_data *data = client->data; - int nr = ctl_name - EMC6D100_SYSCTL_IN5 +5; - - if (nr < 5 || nr > 7) - return ; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; /* 1.000 */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm85_update_client(client); - results[0] = INS_FROM_REG(nr,data->in_min[nr]); - results[1] = INS_FROM_REG(nr,data->in_max[nr]); - results[2] = INS_FROM_REG(nr,data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag > 1) { - data->in_max[nr] = INS_TO_REG(nr,results[1]); - lm85_write_value(client, EMC6D100_REG_IN_MAX(nr), - data->in_max[nr]); - } - if (*nrels_mag > 0) { - data->in_min[nr] = INS_TO_REG(nr,results[0]); - lm85_write_value(client, EMC6D100_REG_IN_MIN(nr), - data->in_min[nr]); - } - up(&data->update_lock); - } -} - - -static int __init sm_lm85_init(void) -{ - printk("lm85: Version %s (%s)\n", LM_VERSION, LM_DATE); - printk("lm85: See http://www.penguincomputing.com/lm_sensors for more info.\n" ); - return i2c_add_driver(&lm85_driver); -} - -static void __exit sm_lm85_exit(void) -{ - i2c_del_driver(&lm85_driver); -} - -/* Thanks to Richard Barrington for adding the LM85 to sensors-detect. - * Thanks to Margit Schubert-While for help with - * post 2.7.0 CVS changes - */ -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Philip Pokorny - Philip Edelbrock - Stephen Rousset - Dan Eaton - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - - -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" - -/* Chip configuration settings. These should be set to reflect the -HARDWARE configuration of your chip. By default (read: when all of -these are left commented out), this driver assumes that the -configuration is the same as National's defaults for the Channel Mode -register. - -Set to '1' the appropriate defines, as nessesary: - - - External temp sensors 2 (possible second CPU temp) - This will disable the 2.5V and Vccp2 readings. - Ironically, National decided that you can read the - temperature of a second CPU or it's core voltage, - but not both! Comment out if FAULT is reported. */ - -/* #define LM87_EXT2 1 */ - -/* Aux analog input. When enabled, the Fan 1 reading - will be disabled */ - -/* #define LM87_AIN1 1 */ - -/* Aux analog input 2. When enabled, the Fan 2 reading - will be disabled */ - -/* #define LM87_AIN2 1 */ - -/* Internal Vcc is 5V instead of 3.3V */ - -/* #define LM87_5V_VCC 1 */ - -/* That's the end of the hardware config defines. I would have made - them insmod params, but it would be too much work. ;') */ - - - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x2c, 0x2e, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(lm87); - -/* The following is the calculation for the register offset - * for the monitored items minimum and maximum locations. - */ -#define LM87_REG_IN_MAX(nr) (0x2b + ((nr) * 2)) -#define LM87_REG_IN_MIN(nr) (0x2c + ((nr) * 2)) -#define LM87_REG_IN(nr) (0x20 + (nr)) - -/* Initial limits */ - -/* - * LM87 register definition - * - */ - - /* The LM87 registers */ -#define LM87_INT_TEMP_HI_LIMIT_LOCKABLE 0x13 -#define LM87_EXT_TEMP_HI_LIMIT_LOCKABLE 0x14 -#define LM87_REG_TEST 0x15 -#define LM87_REG_CHANNEL_MODE 0x16 -#define LM87_REG_INT_TEMP_HI_LIMIT 0x17 -#define LM87_REG_EXT_TEMP_HI_LIMIT 0x18 -#define LM87_REG_ANALOG_OUT 0x19 - - /* These are all read-only */ -#define LM87_REG_2_5V_EXT_TEMP_2 0x20 -#define LM87_REG_VCCP1 0x21 -#define LM87_REG_3_3V 0x22 -#define LM87_REG_5V 0x23 -#define LM87_REG_12V 0x24 -#define LM87_REG_VCCP2 0x25 -#define LM87_REG_EXT_TEMP_1 0x26 -#define LM87_REG_INT_TEMP 0x27 /* LM87 temp. */ -#define LM87_REG_FAN1_AIN1 0x28 -#define LM87_REG_FAN2_AIN2 0x29 - -/* These are read/write */ -#define LM87_REG_AIN1_LOW 0x1A -#define LM87_REG_AIN2_LOW 0x1B -#define LM87_REG_2_5V_EXT_TEMP_2_HIGH 0x2B -#define LM87_REG_2_5V_EXT_TEMP_2_LOW 0x2C -#define LM87_REG_VCCP1_HIGH 0x2D -#define LM87_REG_VCCP1_LOW 0x2E -#define LM87_REG_3_3V_HIGH 0x2F -#define LM87_REG_3_3V_LOW 0x30 -#define LM87_REG_5V_HIGH 0x31 -#define LM87_REG_5V_LOW 0x32 -#define LM87_REG_12V_HIGH 0x33 -#define LM87_REG_12V_LOW 0x34 -#define LM87_REG_VCCP2_HIGH 0x35 -#define LM87_REG_VCCP2_LOW 0x36 -#define LM87_REG_EXT_TEMP_1_HIGH 0x37 -#define LM87_REG_EXT_TEMP_1_LOW 0x38 -#define LM87_REG_INT_TEMP_HIGH 0x39 -#define LM87_REG_INT_TEMP_LOW 0x3A -#define LM87_REG_FAN1_AIN1_LIMIT 0x3B -#define LM87_REG_FAN2_AIN2_LIMIT 0x3C -#define LM87_REG_COMPANY_ID 0x3E -#define LM87_REG_DIE_REV 0x3F - -#define LM87_REG_CONFIG 0x40 -#define LM87_REG_INT1_STAT 0x41 -#define LM87_REG_INT2_STAT 0x42 -#define LM87_REG_INT1_MASK 0x43 -#define LM87_REG_INT2_MASK 0x44 -#define LM87_REG_CHASSIS_CLEAR 0x46 -#define LM87_REG_VID_FAN_DIV 0x47 -#define LM87_REG_VID4 0x49 -#define LM87_REG_CONFIG_2 0x4A -#define LM87_REG_INTRPT_STATUS_1_MIRROR 0x4C -#define LM87_REG_INTRPT_STATUS_2_MIRROR 0x4D -#define LM87_REG_SMBALERT_NUM_ENABLE 0x80 - - - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) ((val)==0?-1:\ - (val)==255?0:1350000/((div)*(val))) - -#define TEMP_FROM_REG(val) ((val)*10) - -#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT(((val)<0?(val)-5:\ - (val)+5)/10,-128,127) - -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val)==1?0:((val)==8?3:((val)==4?2:1))) - -/* For each registered LM87, we need to keep some data in memory. The - structure is dynamically allocated whenever a new LM87 client is - found. */ -struct lm87_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[6]; /* Scaled Register value */ - u8 in_max[6]; /* Scaled Register value */ - u8 in_min[6]; /* Scaled Register value */ - u8 ain1; /* Register value */ - u8 ain1_min; /* Register value */ - u8 ain1_max; /* Register value */ - u8 ain2; /* Register value */ - u8 ain2_min; /* Register value */ - u8 ain2_max; /* Register value */ - u8 fan; /* Register value */ - u8 fan_min; /* Register value */ - u8 fan_div; /* Register encoding, shifted right */ - u8 fan2; /* Register value */ - u8 fan2_min; /* Register value */ - u8 fan2_div; /* Register encoding, shifted right */ - s8 ext2_temp; /* Register value */ - s8 ext_temp; /* Register value */ - s8 int_temp; /* Register value */ - u8 ext_temp_max; /* Register value */ - u8 ext_temp_min; /* Register value */ - u8 ext2_temp_max; /* Register value */ - u8 ext2_temp_min; /* Register value */ - u8 int_temp_max; /* Register value */ - u8 int_temp_min; /* Register value */ - u16 alarms; /* Register encoding, combined */ - u8 analog_out; /* Register value */ - u8 vid; /* Register value combined */ - u8 vrm; /* VRM version * 10 */ -}; - -static int lm87_attach_adapter(struct i2c_adapter *adapter); -static int lm87_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int lm87_detach_client(struct i2c_client *client); - -static int lm87_read_value(struct i2c_client *client, u8 register); -static int lm87_write_value(struct i2c_client *client, u8 register, - u8 value); -static void lm87_update_client(struct i2c_client *client); -static void lm87_init_client(struct i2c_client *client); - - -static void lm87_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -#if defined (LM87_AIN1) || defined (LM87_AIN2) -static void lm87_ain(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -#endif -static void lm87_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm87_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm87_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm87_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm87_analog_out(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, - long *results); -static void lm87_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm87_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver LM87_driver = { - .name = "LM87 sensor driver", - .id = I2C_DRIVERID_LM87, - .flags = I2C_DF_NOTIFY, - .attach_adapter = lm87_attach_adapter, - .detach_client = lm87_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define LM87_SYSCTL_IN0 1000 /* Volts * 100 */ -#define LM87_SYSCTL_IN1 1001 -#define LM87_SYSCTL_IN2 1002 -#define LM87_SYSCTL_IN3 1003 -#define LM87_SYSCTL_IN4 1004 -#define LM87_SYSCTL_IN5 1005 -#define LM87_SYSCTL_AIN1 1006 -#define LM87_SYSCTL_AIN2 1007 -#define LM87_SYSCTL_FAN1 1102 -#define LM87_SYSCTL_FAN2 1103 -#define LM87_SYSCTL_TEMP1 1250 /* Degrees Celsius * 10 */ -#define LM87_SYSCTL_TEMP2 1251 /* Degrees Celsius * 10 */ -#define LM87_SYSCTL_TEMP3 1252 /* Degrees Celsius * 10 */ -#define LM87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define LM87_SYSCTL_ALARMS 2001 /* bitvector */ -#define LM87_SYSCTL_ANALOG_OUT 2002 -#define LM87_SYSCTL_VID 2003 -#define LM87_SYSCTL_VRM 2004 - -#define LM87_ALARM_IN0 0x0001 -#define LM87_ALARM_IN1 0x0002 -#define LM87_ALARM_IN2 0x0004 -#define LM87_ALARM_IN3 0x0008 -#define LM87_ALARM_TEMP1 0x0010 -#define LM87_ALARM_TEMP2 0x0020 -#define LM87_ALARM_TEMP3 0x0020 /* same?? */ -#define LM87_ALARM_FAN1 0x0040 -#define LM87_ALARM_FAN2 0x0080 -#define LM87_ALARM_IN4 0x0100 -#define LM87_ALARM_IN5 0x0200 -#define LM87_ALARM_RESERVED1 0x0400 -#define LM87_ALARM_RESERVED2 0x0800 -#define LM87_ALARM_CHAS 0x1000 -#define LM87_ALARM_THERM_SIG 0x2000 -#define LM87_ALARM_TEMP2_FAULT 0x4000 -#define LM87_ALARM_TEMP3_FAULT 0x08000 - -/* -- SENSORS SYSCTL END -- */ - -/* The /proc/sys entries */ -/* These files are created for each detected LM87. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ - -static ctl_table LM87_dir_table_template[] = { -#ifdef LM87_AIN1 - {LM87_SYSCTL_AIN1, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_ain}, -#endif -#ifdef LM87_AIN2 - {LM87_SYSCTL_AIN2, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_ain}, -#endif -#ifndef LM87_EXT2 - {LM87_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_in}, - {LM87_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_in}, -#endif - {LM87_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_in}, - {LM87_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_in}, - {LM87_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_in}, - {LM87_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_in}, -#ifndef LM87_AIN1 - {LM87_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_fan}, - {LM87_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_fan_div}, -#define LM87_FANDIV_FLAG -#endif -#ifndef LM87_AIN2 - {LM87_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_fan}, -#ifndef LM87_FANDIV_FLAG - {LM87_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_fan_div}, -#endif /* LM87_FANDIV_FLAG */ -#endif /* LM87_AIN2 */ -#ifdef LM87_EXT2 - {LM87_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_temp}, -#endif - {LM87_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_temp}, - {LM87_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_temp}, - {LM87_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_alarms}, - {LM87_SYSCTL_ANALOG_OUT, "analog_out", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_analog_out}, - {LM87_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_vid}, - {LM87_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm87_vrm}, - {0} -}; - -static int lm87_attach_adapter(struct i2c_adapter *adapter) -{ - int error; - struct i2c_client_address_data lm87_client_data; - - lm87_client_data.normal_i2c = addr_data.normal_i2c; - lm87_client_data.normal_i2c_range = addr_data.normal_i2c_range; - lm87_client_data.probe = addr_data.probe; - lm87_client_data.probe_range = addr_data.probe_range; - lm87_client_data.ignore = addr_data.ignore; - lm87_client_data.ignore_range = addr_data.ignore_range; - lm87_client_data.force = addr_data.forces->force; - - error = i2c_probe(adapter, &lm87_client_data, lm87_detect); - i2c_detect(adapter, &addr_data, lm87_detect); - - return error; -} - -static int lm87_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct lm87_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access LM87_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct lm87_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &LM87_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - if (kind < 0) { - if (((lm87_read_value(new_client, LM87_REG_CONFIG) & 0x80) - != 0x00) || - (lm87_read_value(new_client, LM87_REG_COMPANY_ID) != 0x02)) - goto ERROR1; - } - - /* Fill in the remaining client fields and put into the global list */ - type_name = "lm87"; - client_name = "LM87 chip"; - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - LM87_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the LM87 chip */ - lm87_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int lm87_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct lm87_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR "lm87.o: Client deregistration failed, " - "client not detached\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -#define MAX_RETRIES 5 - -static int lm87_read_value(struct i2c_client *client, u8 reg) -{ - int value, i; - - /* Retry in case of read errors */ - for (i = 1; i <= MAX_RETRIES; i++) { - if ((value = i2c_smbus_read_byte_data(client, reg)) >= 0) - return value; - - printk(KERN_WARNING "lm87.o: Read byte data failed, " - "address 0x%02x\n", reg); - mdelay(i + 3); - } - - /* what to return in case of error? */ - printk(KERN_ERR "lm87.o: All read byte retries failed!!\n"); - return 0; -} - -static int lm87_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* Called when we have found a new LM87. */ -static void lm87_init_client(struct i2c_client *client) -{ - struct lm87_data *data = client->data; - u8 reg; - - /* Setup Channel Mode register for configuration of monitoring - * Default is 00000000b - * bit 0 - Configures Fan 1/AIN 1 input (1 = AIN) - * bit 1 - Configures Fan 2/AIN 2 input (1 = AIN) - * bit 2 - Configures 2.5V&Vccp2/D2 input (1 = 2nd Therm.) - * bit 3 - Configures Vcc for 5V/3.3V reading (0 = 3.3V) - * bit 4 - Configures IRQ0 Enable if = 1 - * bit 5 - Configures IRQ1 Enable if = 1 - * bit 6 - Configures IRQ2 Enable if = 1 - * bit 7 - Configures VID/IRQ input as interrupts if = 1 - */ - - /* Preserve 4 MSB */ - reg = lm87_read_value(client, LM87_REG_CHANNEL_MODE); -/* I know, not clean, but it works. :'p */ - lm87_write_value(client, LM87_REG_CHANNEL_MODE, (reg & 0xf0) | -#ifdef LM87_AIN1 - 0x01 -#else -0 -#endif - | -#ifdef LM87_AIN2 - 0x02 -#else -0 -#endif - | -#ifdef LM87_EXT2 - 0x04 -#else -0 -#endif - | -#ifdef LM87_5V_VCC -0x08 -#else -0 -#endif - ); - - data->vrm = 82; - - /* Start monitoring */ - reg = lm87_read_value(client, LM87_REG_CONFIG); - if (!(reg & 0x01)) { - printk(KERN_INFO "lm87.o: Monitoring starts\n"); - lm87_write_value(client, LM87_REG_CONFIG, - (reg & 0x7e) | 0x01); - } -} - -static void lm87_update_client(struct i2c_client *client) -{ - struct lm87_data *data = client->data; - int i; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ) || /* 1 sec cache */ - (jiffies < data->last_updated) || - !data->valid) { - for (i = 0; i <= 5; i++) { - data->in[i] = - lm87_read_value(client,LM87_REG_IN(i)); - data->in_min[i] = - lm87_read_value(client,LM87_REG_IN_MIN(i)); - data->in_max[i] = - lm87_read_value(client,LM87_REG_IN_MAX(i)); - } - data->ain1 = - lm87_read_value(client,LM87_REG_FAN1_AIN1); - data->ain1_min = - lm87_read_value(client,LM87_REG_AIN1_LOW); - data->ain1_max = - lm87_read_value(client,LM87_REG_FAN1_AIN1_LIMIT); - data->ain2 = - lm87_read_value(client,LM87_REG_FAN2_AIN2); - data->ain2_min = - lm87_read_value(client,LM87_REG_AIN2_LOW); - data->ain2_max = - lm87_read_value(client,LM87_REG_FAN2_AIN2_LIMIT); - - data->fan = - lm87_read_value(client, LM87_REG_FAN1_AIN1); - data->fan_min = - lm87_read_value(client, LM87_REG_FAN1_AIN1_LIMIT); - data->fan2 = - lm87_read_value(client, LM87_REG_FAN2_AIN2); - data->fan2_min = - lm87_read_value(client, LM87_REG_FAN2_AIN2_LIMIT); - - data->ext2_temp = - lm87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2); - data->ext_temp = - lm87_read_value(client, LM87_REG_EXT_TEMP_1); - data->int_temp = - lm87_read_value(client, LM87_REG_INT_TEMP); - - data->ext2_temp_max = - lm87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH); - data->ext2_temp_min = - lm87_read_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW); - - data->ext_temp_max = - lm87_read_value(client, LM87_REG_EXT_TEMP_1_HIGH); - data->ext_temp_min = - lm87_read_value(client, LM87_REG_EXT_TEMP_1_LOW); - - data->int_temp_max = - lm87_read_value(client, LM87_REG_INT_TEMP_HIGH); - data->int_temp_min = - lm87_read_value(client, LM87_REG_INT_TEMP_LOW); - - i = lm87_read_value(client, LM87_REG_VID_FAN_DIV); - data->fan_div = (i >> 4) & 0x03; - data->fan2_div = (i >> 6) & 0x03; - data->vid = i & 0x0f; - data->vid |= - (lm87_read_value(client, LM87_REG_VID4) & 0x01) - << 4; - data->alarms = - lm87_read_value(client, LM87_REG_INT1_STAT) + - (lm87_read_value(client, LM87_REG_INT2_STAT) << 8); - data->analog_out = - lm87_read_value(client, LM87_REG_ANALOG_OUT); - data->last_updated = jiffies; - data->valid = 1; - } - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void lm87_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - long scales[6] = { 250, 270, -#ifdef LM87_5V_VCC -500, -#else -330, -#endif - 500, 1200, 270 }; - - struct lm87_data *data = client->data; - int nr = ctl_name - LM87_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - lm87_update_client(client); - results[0] = (data->in_min[nr] * scales[nr] + 96) / 192; - results[1] = (data->in_max[nr] * scales[nr] + 96) / 192; - results[2] = (data->in[nr] * scales[nr] + 96) / 192; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = (results[0] * 192 + scales[nr] / 2) - / scales[nr]; - lm87_write_value(client, LM87_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = (results[1] * 192 + scales[nr] / 2) - / scales[nr]; - lm87_write_value(client, LM87_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -#if defined (LM87_AIN1) || defined (LM87_AIN2) -void lm87_ain(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm87_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm87_update_client(client); - if (ctl_name == LM87_SYSCTL_AIN1) { - results[0] = data->ain1_min; - results[1] = data->ain1_max; - results[2] = data->ain1; - } else { - results[0] = data->ain2_min; - results[1] = data->ain2_max; - results[2] = data->ain2; - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (ctl_name == LM87_SYSCTL_AIN1) { - data->ain1_min = results[0]; - lm87_write_value(client, LM87_REG_AIN1_LOW, - data->ain1_min); - } else { - data->ain2_min = results[0]; - lm87_write_value(client, LM87_REG_AIN2_LOW, - data->ain2_min); - } - } - if (*nrels_mag >= 2) { - if (ctl_name == LM87_SYSCTL_AIN1) { - data->ain1_max = results[1]; - lm87_write_value(client, LM87_REG_FAN1_AIN1_LIMIT, - data->ain1_max); - } else { - data->ain2_max = results[1]; - lm87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, - data->ain2_max); - } - } - } -} -#endif - -void lm87_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm87_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm87_update_client(client); - if (ctl_name == LM87_SYSCTL_FAN1) { - results[0] = FAN_FROM_REG(data->fan_min, - DIV_FROM_REG(data->fan_div)); - results[1] = FAN_FROM_REG(data->fan, - DIV_FROM_REG(data->fan_div)); - } else { - results[0] = FAN_FROM_REG(data->fan2_min, - DIV_FROM_REG(data->fan2_div)); - results[1] = FAN_FROM_REG(data->fan2, - DIV_FROM_REG(data->fan2_div)); - } - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 0) { - if (ctl_name == LM87_SYSCTL_FAN1) { - data->fan_min = FAN_TO_REG(results[0], - DIV_FROM_REG - (data->fan_div)); - lm87_write_value(client, LM87_REG_FAN1_AIN1_LIMIT, - data->fan_min); - } else { - data->fan2_min = FAN_TO_REG(results[0], - DIV_FROM_REG - (data->fan2_div)); - lm87_write_value(client, LM87_REG_FAN2_AIN2_LIMIT, - data->fan2_min); - } - } - } -} - - -void lm87_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm87_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) - { - lm87_update_client(client); - - /* find out which temp. is being requested */ - if (ctl_name == LM87_SYSCTL_TEMP3) - { - results[0] = TEMP_FROM_REG(data->ext2_temp_max); - results[1] = TEMP_FROM_REG(data->ext2_temp_min); - results[2] = TEMP_FROM_REG(data->ext2_temp); - } - else if(ctl_name == LM87_SYSCTL_TEMP2) - { - results[0] = TEMP_FROM_REG(data->ext_temp_max); - results[1] = TEMP_FROM_REG(data->ext_temp_min); - results[2] = TEMP_FROM_REG(data->ext_temp); - } - else if(ctl_name == LM87_SYSCTL_TEMP1) - { - results[0] = TEMP_FROM_REG(data->int_temp_max); - results[1] = TEMP_FROM_REG(data->int_temp_min); - results[2] = TEMP_FROM_REG(data->int_temp); - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (ctl_name == LM87_SYSCTL_TEMP3) { - data->ext2_temp_max = TEMP_LIMIT_TO_REG(results[0]); - lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_HIGH, - data->ext2_temp_max); - } - if (ctl_name == LM87_SYSCTL_TEMP2) { - data->ext_temp_max = TEMP_LIMIT_TO_REG(results[0]); - lm87_write_value(client, LM87_REG_EXT_TEMP_1_HIGH, - data->ext_temp_max); - } - if (ctl_name == LM87_SYSCTL_TEMP1) { - data->int_temp_max = TEMP_LIMIT_TO_REG(results[0]); - lm87_write_value(client, LM87_REG_INT_TEMP_HIGH, - data->int_temp_max); - } - } - if (*nrels_mag >= 2) { - if (ctl_name == LM87_SYSCTL_TEMP3) { - data->ext2_temp_min = TEMP_LIMIT_TO_REG(results[1]); - lm87_write_value(client, LM87_REG_2_5V_EXT_TEMP_2_LOW, - data->ext2_temp_min); - } - if (ctl_name == LM87_SYSCTL_TEMP2) { - data->ext_temp_min = TEMP_LIMIT_TO_REG(results[1]); - lm87_write_value(client, LM87_REG_EXT_TEMP_1_LOW, - data->ext_temp_min); - } - if (ctl_name == LM87_SYSCTL_TEMP1) { - data->int_temp_min = TEMP_LIMIT_TO_REG(results[1]); - lm87_write_value(client, LM87_REG_INT_TEMP_LOW, - data->int_temp_min); - } - } - } -} - -void lm87_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm87_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm87_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -void lm87_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ -/* This gets a little hairy depending on the hardware config */ - - struct lm87_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm87_update_client(client); -#ifndef LM87_AIN1 - results[0] = DIV_FROM_REG(data->fan_div); -# ifndef LM87_AIN2 - results[1] = DIV_FROM_REG(data->fan2_div); - *nrels_mag = 2; -# else - *nrels_mag = 1; -# endif -#else /* Must be referring to fan 2 */ - results[0] = DIV_FROM_REG(data->fan2_div); - *nrels_mag = 1; -#endif - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = lm87_read_value(client, LM87_REG_VID_FAN_DIV); -/* Note: it's OK to change fan2 div even if fan2 isn't enabled */ -#ifndef LM87_AIN1 - if (*nrels_mag >= 2) { - data->fan2_div = DIV_TO_REG(results[1]); - old = (old & 0x3f) | (data->fan2_div << 6); - } - if (*nrels_mag >= 1) { - data->fan_div = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan_div << 4); - lm87_write_value(client, LM87_REG_VID_FAN_DIV, old); - } -#else /* Must be referring to fan 2 */ - if (*nrels_mag >= 1) { - data->fan2_div = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan2_div << 6); - lm87_write_value(client, LM87_REG_VID_FAN_DIV, old); - } -#endif - } -} - -void lm87_analog_out(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm87_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm87_update_client(client); - results[0] = data->analog_out; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->analog_out = results[0]; - lm87_write_value(client, LM87_REG_ANALOG_OUT, - data->analog_out); - } - } -} - -void lm87_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm87_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - lm87_update_client(client); - results[0] = vid_from_reg(data->vid, data->vrm); - *nrels_mag = 1; - } -} - -void lm87_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm87_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) - data->vrm = results[0]; - } -} - -static int __init sm_lm87_init(void) -{ - printk(KERN_INFO "lm87.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&LM87_driver); -} - -static void __exit sm_lm87_exit(void) -{ - i2c_del_driver(&LM87_driver); -} - - - -MODULE_LICENSE("GPL"); - -MODULE_AUTHOR - ("Frodo Looijaard , Philip Edelbrock , " - "Mark Studebaker , and Stephen Rousset "); - -MODULE_DESCRIPTION("LM87 driver"); - -module_init(sm_lm87_init); -module_exit(sm_lm87_exit); diff --git a/kernel/chips/lm90.c b/kernel/chips/lm90.c deleted file mode 100644 index 9e5e38d1..00000000 --- a/kernel/chips/lm90.c +++ /dev/null @@ -1,858 +0,0 @@ -/* - * lm90.c - Part of lm_sensors, Linux kernel modules for hardware - * monitoring - * Copyright (C) 2003-2005 Jean Delvare - * - * Based on the lm83 driver. The LM90 is a sensor chip made by National - * Semiconductor. It reports up to two temperatures (its own plus up to - * one external one) with a 0.125 deg resolution (1 deg for local - * temperature) and a 3-4 deg accuracy. Complete datasheet can be - * obtained from National's website at: - * http://www.national.com/pf/LM/LM90.html - * - * This driver also supports the LM89 and LM99, two other sensor chips - * made by National Semiconductor. Both have an increased remote - * temperature measurement accuracy (1 degree), and the LM99 - * additionally shifts remote temperatures (measured and limits) by 16 - * degrees, which allows for higher temperatures measurement. The - * driver doesn't handle it since it can be done easily in user-space. - * Complete datasheets can be obtained from National's website at: - * http://www.national.com/pf/LM/LM89.html - * http://www.national.com/pf/LM/LM99.html - * Note that there is no way to differentiate between both chips. - * - * This driver also supports the LM86, another sensor chip made by - * National Semiconductor. It is exactly similar to the LM90 except it - * has a higher accuracy. - * Complete datasheet can be obtained from National's website at: - * http://www.national.com/pf/LM/LM86.html - * - * This driver also supports the ADM1032, a sensor chip made by Analog - * Devices. That chip is similar to the LM90, with a few differences - * that are not handled by this driver. Complete datasheet can be - * obtained from Analog's website at: - * http://products.analog.com/products/info.asp?product=ADM1032 - * Among others, it has a higher accuracy than the LM90, much like the - * LM86 does. - * - * This driver also supports the MAX6657, MAX6658 and MAX6659 sensor - * chips made by Maxim. These chips are similar to the LM86. Complete - * datasheet can be obtained at Maxim's website at: - * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 - * Note that there is no easy way to differentiate between the three - * variants. The extra address and features of the MAX6659 are not - * supported by this driver. - * - * This driver also supports the ADT7461 chip from Analog Devices but - * only in its "compatability mode". If an ADT7461 chip is found but - * is configured in non-compatible mode (where its temperature - * register values are decoded differently) it is ignored by this - * driver. Complete datasheet can be obtained from Analog's website - * at: - * http://products.analog.com/products/info.asp?product=ADT7461 - * - * Since the LM90 was the first chipset supported by this driver, most - * comments will refer to this chipset, but are actually general and - * concern all supported chipsets, unless mentioned otherwise. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include "version.h" - -#ifndef I2C_DRIVERID_LM90 -#define I2C_DRIVERID_LM90 1042 -#endif - -/* - * Addresses to scan - * Address is fully defined internally and cannot be changed except for - * MAX6659. - * LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, MAX6657 and MAX6658 - * have address 0x4c. - * ADM1032-2, ADT7461-2, LM89-1, and LM99-1 have address 0x4d. - * MAX6659 can have address 0x4c, 0x4d or 0x4e (unsupported). - */ - -static unsigned short normal_i2c[] = { 0x4c, 0x4d, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* - * Insmod parameters - */ - -SENSORS_INSMOD_6(lm90, adm1032, lm99, lm86, max6657, adt7461); - -/* - * The LM90 registers - */ - -#define LM90_REG_R_MAN_ID 0xFE -#define LM90_REG_R_CHIP_ID 0xFF -#define LM90_REG_R_CONFIG1 0x03 -#define LM90_REG_W_CONFIG1 0x09 -#define LM90_REG_R_CONFIG2 0xBF -#define LM90_REG_W_CONFIG2 0xBF -#define LM90_REG_R_CONVRATE 0x04 -#define LM90_REG_W_CONVRATE 0x0A -#define LM90_REG_R_STATUS 0x02 -#define LM90_REG_R_LOCAL_TEMP 0x00 -#define LM90_REG_R_LOCAL_HIGH 0x05 -#define LM90_REG_W_LOCAL_HIGH 0x0B -#define LM90_REG_R_LOCAL_LOW 0x06 -#define LM90_REG_W_LOCAL_LOW 0x0C -#define LM90_REG_R_LOCAL_CRIT 0x20 -#define LM90_REG_W_LOCAL_CRIT 0x20 -#define LM90_REG_R_REMOTE_TEMPH 0x01 -#define LM90_REG_R_REMOTE_TEMPL 0x10 -#define LM90_REG_R_REMOTE_OFFSH 0x11 -#define LM90_REG_W_REMOTE_OFFSH 0x11 -#define LM90_REG_R_REMOTE_OFFSL 0x12 -#define LM90_REG_W_REMOTE_OFFSL 0x12 -#define LM90_REG_R_REMOTE_HIGHH 0x07 -#define LM90_REG_W_REMOTE_HIGHH 0x0D -#define LM90_REG_R_REMOTE_HIGHL 0x13 -#define LM90_REG_W_REMOTE_HIGHL 0x13 -#define LM90_REG_R_REMOTE_LOWH 0x08 -#define LM90_REG_W_REMOTE_LOWH 0x0E -#define LM90_REG_R_REMOTE_LOWL 0x14 -#define LM90_REG_W_REMOTE_LOWL 0x14 -#define LM90_REG_R_REMOTE_CRIT 0x19 -#define LM90_REG_W_REMOTE_CRIT 0x19 -#define LM90_REG_R_TCRIT_HYST 0x21 -#define LM90_REG_W_TCRIT_HYST 0x21 - -/* - * Conversions and various macros - * For local temperatures and limits, critical limits and the hysteresis - * value, the LM90 uses signed 8-bit values with LSB = 1 degree Celsius. - * For remote temperatures and limits, it uses signed 11-bit values with - * LSB = 0.125 degree Celsius, left-justified in 16-bit registers. - */ - -#define TEMP1_FROM_REG(val) (val) -#define TEMP1_TO_REG(val) ((val) <= -128 ? -128 : \ - (val) >= 127 ? 127 : (val)) -#define TEMP2_FROM_REG(val) ((val) / 32 * 125 / 100) -#define TEMP2_TO_REG(val) ((val) <= -1280 ? 0x8000 : \ - (val) >= 1270 ? 0x7FE0 : \ - ((val) * 100 / 125 * 32)) -#define HYST_TO_REG(val) ((val) <= 0 ? 0 : \ - (val) >= 31 ? 31 : (val)) - -/* - * ADT7461 is almost identical to LM90 except that attempts to write - * values that are outside the range 0 < temp < 127 are treated as - * the boundary value. - */ - -#define TEMP1_TO_REG_ADT7461(val) ((val) <= 0 ? 0 : \ - (val) >= 127 ? 127 : (val)) -#define TEMP2_TO_REG_ADT7461(val) ((val) <= 0 ? 0 : \ - (val) >= 1277 ? 0x7FC0 : \ - ((val) * 100 / 250 * 64)) - -/* - * Functions declaration - */ - -static int lm90_attach_adapter(struct i2c_adapter *adapter); -static int lm90_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void lm90_init_client(struct i2c_client *client); -static int lm90_detach_client(struct i2c_client *client); -static void lm90_local_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm90_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm90_local_tcrit(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm90_remote_tcrit(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm90_local_hyst(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm90_remote_hyst(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void lm90_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void adm1032_pec(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -/* - * Driver data (common to all clients) - */ - -static struct i2c_driver lm90_driver = { - .name = "LM90/ADM1032 sensor driver", - .id = I2C_DRIVERID_LM90, - .flags = I2C_DF_NOTIFY, - .attach_adapter = lm90_attach_adapter, - .detach_client = lm90_detach_client -}; - -/* - * Client data (each client gets its own) - */ - -struct lm90_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* zero until following fields are valid */ - unsigned long last_updated; /* in jiffies */ - int kind; - - /* registers values */ - s8 local_temp, local_high, local_low; - s16 remote_temp, remote_high, remote_low; /* combined */ - s8 local_crit, remote_crit; - u8 hyst; /* linked to two sysctl files (hyst1 RW, hyst2 RO) */ - u8 alarms; /* bitvector */ -}; - -/* - * Proc entries - * These files are created for each detected LM90. - */ - -/* -- SENSORS SYSCTL START -- */ - -#define LM90_SYSCTL_LOCAL_TEMP 1200 -#define LM90_SYSCTL_REMOTE_TEMP 1201 -#define LM90_SYSCTL_LOCAL_TCRIT 1204 -#define LM90_SYSCTL_REMOTE_TCRIT 1205 -#define LM90_SYSCTL_LOCAL_HYST 1207 -#define LM90_SYSCTL_REMOTE_HYST 1208 -#define LM90_SYSCTL_ALARMS 1210 -#define LM90_SYSCTL_PEC 1214 - -#define LM90_ALARM_LOCAL_HIGH 0x40 -#define LM90_ALARM_LOCAL_LOW 0x20 -#define LM90_ALARM_LOCAL_CRIT 0x01 -#define LM90_ALARM_REMOTE_HIGH 0x10 -#define LM90_ALARM_REMOTE_LOW 0x08 -#define LM90_ALARM_REMOTE_CRIT 0x02 -#define LM90_ALARM_REMOTE_OPEN 0x04 - -/* -- SENSORS SYSCTL END -- */ - - -static ctl_table lm90_dir_table_template[] = -{ - {LM90_SYSCTL_LOCAL_TEMP, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_local_temp}, - {LM90_SYSCTL_REMOTE_TEMP, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_remote_temp}, - {LM90_SYSCTL_LOCAL_TCRIT, "tcrit1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_local_tcrit}, - {LM90_SYSCTL_REMOTE_TCRIT, "tcrit2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_remote_tcrit}, - {LM90_SYSCTL_LOCAL_HYST, "hyst1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_local_hyst}, - {LM90_SYSCTL_REMOTE_HYST, "hyst2", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_remote_hyst}, - {LM90_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_alarms}, - {0} -}; - -static ctl_table adm1032_dir_table_template[] = -{ - {LM90_SYSCTL_LOCAL_TEMP, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_local_temp}, - {LM90_SYSCTL_REMOTE_TEMP, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_remote_temp}, - {LM90_SYSCTL_LOCAL_TCRIT, "tcrit1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_local_tcrit}, - {LM90_SYSCTL_REMOTE_TCRIT, "tcrit2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_remote_tcrit}, - {LM90_SYSCTL_LOCAL_HYST, "hyst1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_local_hyst}, - {LM90_SYSCTL_REMOTE_HYST, "hyst2", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_remote_hyst}, - {LM90_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm90_alarms}, - {LM90_SYSCTL_PEC, "pec", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &adm1032_pec}, - {0} -}; - -/* - * Real code - */ - -/* The ADM1032 supports PEC but not on write byte transactions, so we need - to explicitly ask for a transaction without PEC. */ -static inline s32 adm1032_write_byte(struct i2c_client *client, u8 value) -{ - return i2c_smbus_xfer(client->adapter, client->addr, - client->flags & ~I2C_CLIENT_PEC, - I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); -} - -/* It is assumed that client->update_lock is held (unless we are in - detection or initialization steps). This matters when PEC is enabled, - because we don't want the address pointer to change between the write - byte and the read byte transactions. */ -static int lm90_read_reg(struct i2c_client* client, u8 reg, u8 *value) -{ - int err; - - if (client->flags & I2C_CLIENT_PEC) { - err = adm1032_write_byte(client, reg); - if (err >= 0) - err = i2c_smbus_read_byte(client); - } else - err = i2c_smbus_read_byte_data(client, reg); - - if (err < 0) { - printk(KERN_WARNING "lm90: Register 0x%02x read failed (%d)\n", - reg, err); - return err; - } - *value = err; - - return 0; -} - -static int lm90_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, lm90_detect); -} - -/* - * The following function does more than just detection. If detection - * succeeds, it also registers the new chip. - */ -static int lm90_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - struct i2c_client *new_client; - struct lm90_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { -#ifdef DEBUG - printk(KERN_DEBUG "lm90: adapter doesn't support byte mode, " - "skipping\n"); -#endif - return 0; - } - - if (!(data = kmalloc(sizeof(struct lm90_data), GFP_KERNEL))) { - printk(KERN_ERR "lm90: Out of memory in lm90_detect\n"); - return -ENOMEM; - } - - /* - * The common I2C client data is placed right before the - * LM90-specific data. The LM90-specific data is pointed to by the - * data field from the I2C client data. - */ - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &lm90_driver; - new_client->flags = 0; - - /* - * Now we do the remaining detection. A negative kind means that - * the driver was loaded with no force parameter (default), so we - * must both detect and identify the chip. A zero kind means that - * the driver was loaded with the force parameter, the detection - * step shall be skipped. A positive kind means that the driver - * was loaded with the force parameter and a given kind of chip is - * requested, so both the detection and the identification steps - * are skipped. - */ - - /* Default to an LM90 if forced */ - if (kind == 0) - kind = lm90; - - if (kind < 0) { /* detection and identification */ - u8 man_id, chip_id, reg_config1, reg_convrate; - - if (lm90_read_reg(new_client, LM90_REG_R_MAN_ID, - &man_id) < 0 - || lm90_read_reg(new_client, LM90_REG_R_CHIP_ID, - &chip_id) < 0 - || lm90_read_reg(new_client, LM90_REG_R_CONFIG1, - ®_config1) < 0 - || lm90_read_reg(new_client, LM90_REG_R_CONVRATE, - ®_convrate) < 0) - goto exit_free; - - if (man_id == 0x01) { /* National Semiconductor */ - u8 reg_config2; - - if (lm90_read_reg(new_client, LM90_REG_R_CONFIG2, - ®_config2) < 0) - goto exit_free; - - if ((reg_config1 & 0x2A) == 0x00 - && (reg_config2 & 0xF8) == 0x00 - && reg_convrate <= 0x09) { - if (address == 0x4C - && (chip_id & 0xF0) == 0x20) /* LM90 */ - kind = lm90; - else if ((chip_id & 0xF0) == 0x30) /* LM89/LM99 */ - kind = lm99; - else if (address == 0x4C - && (chip_id & 0xF0) == 0x10) /* LM86 */ - kind = lm99; - } - } else - if (man_id == 0x41) { /* Analog Devices */ - if ((chip_id & 0xF0) == 0x40 /* ADM1032 */ - && (reg_config1 & 0x3F) == 0x00 - && reg_convrate <= 0x0A) - kind = adm1032; - else - if (chip_id == 0x51 /* ADT7461 */ - && (reg_config1 & 0x1F) == 0x00 /* check compat mode */ - && reg_convrate <= 0x0A) - kind = adt7461; - } else - if (man_id == 0x4D) { /* Maxim */ - /* - * The Maxim variants do NOT have a chip_id register. - * Reading from that address will return the last read - * value, which in our case is those of the man_id - * register. Likewise, the config1 register seems to - * lack a low nibble, so the value will be those of the - * previous read, so in our case those of the man_id - * register. - */ - if (chip_id == man_id - && (reg_config1 & 0x1F) == (man_id & 0x0F) - && reg_convrate <= 0x09) - kind = max6657; - } - } - - if (kind <= 0) { /* identification failed */ - printk(KERN_INFO "lm90: Unsupported chip\n"); - goto exit_free; - } - - if (kind == lm90) { - type_name = "lm90"; - client_name = "LM90 chip"; - } else if (kind == adm1032) { - type_name = "adm1032"; - client_name = "ADM1032 chip"; - /* The ADM1032 supports PEC, but only if combined - transactions are not used. */ - if (i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) { - new_client->flags |= I2C_CLIENT_PEC; - printk(KERN_DEBUG "lm90: Enabling PEC for ADM1032\n"); - } - } else if (kind == lm99) { - type_name = "lm99"; - client_name = "LM99 chip"; - } else if (kind == lm86) { - type_name = "lm86"; - client_name = "LM86 chip"; - } else if (kind == max6657) { - type_name = "max6657"; - client_name = "MAX6657 chip"; - } else if (kind == adt7461) { - type_name = "adt7461"; - client_name = "ADT7561 chip"; - } else { - printk(KERN_ERR "lm90: Unknown kind %d\n", kind); - goto exit_free; - } - - /* - * OK, we got a valid chip so we can fill in the remaining client - * fields. - */ - - strcpy(new_client->name, client_name); - data->valid = 0; - data->kind = kind; - init_MUTEX(&data->update_lock); - - /* - * Tell the I2C layer a new client has arrived. - */ - - if ((err = i2c_attach_client(new_client))) { - printk(KERN_ERR "lm90: Failed to attach client (%d)\n", err); - goto exit_free; - } - - /* - * Register a new directory entry. - */ - - if ((err = i2c_register_entry(new_client, type_name, - (new_client->flags & I2C_CLIENT_PEC) ? - adm1032_dir_table_template : - lm90_dir_table_template, THIS_MODULE)) < 0) { - printk(KERN_ERR "lm90: Failed to register directory entry " - "(%d)\n", err); - goto exit_detach; - } - data->sysctl_id = err; - - /* - * Initialize the LM90 chip. - */ - - lm90_init_client(new_client); - return 0; - -exit_detach: - i2c_detach_client(new_client); -exit_free: - kfree(data); - return err; -} - -static void lm90_init_client(struct i2c_client *client) -{ - u8 config; - - /* - * Start the conversions. - */ - - i2c_smbus_write_byte_data(client, LM90_REG_W_CONVRATE, - 5); /* 2 Hz */ - if (lm90_read_reg(client, LM90_REG_R_CONFIG1, &config) < 0) { - printk(KERN_ERR "lm90: Initialization failed!\n"); - return; - } - if (config & 0x40) - i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, - config & 0xBF); /* run */ -} - - -static int lm90_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct lm90_data *) (client->data))->sysctl_id); - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR "lm90: Client deregistration failed, client " - "not detached (%d)\n", err); - return err; - } - - kfree(client->data); - return 0; -} - -static void lm90_update_client(struct i2c_client *client) -{ - struct lm90_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ * 2) || - (jiffies < data->last_updated) || !data->valid) { - u8 oldh, newh, l; -#ifdef DEBUG - printk(KERN_DEBUG "lm90: Updating register values\n"); -#endif - - lm90_read_reg(client, LM90_REG_R_LOCAL_TEMP, - &data->local_temp); - lm90_read_reg(client, LM90_REG_R_LOCAL_HIGH, - &data->local_high); - lm90_read_reg(client, LM90_REG_R_LOCAL_LOW, - &data->local_low); - lm90_read_reg(client, LM90_REG_R_LOCAL_CRIT, - &data->local_crit); - lm90_read_reg(client, LM90_REG_R_REMOTE_CRIT, - &data->remote_crit); - lm90_read_reg(client, LM90_REG_R_TCRIT_HYST, - &data->hyst); - - /* - * There is a trick here. We have to read two registers to - * have the remote sensor temperature, but we have to beware - * a conversion could occur inbetween the readings. The - * datasheet says we should either use the one-shot - * conversion register, which we don't want to do (disables - * hardware monitoring) or monitor the busy bit, which is - * impossible (we can't read the values and monitor that bit - * at the exact same time). So the solution used here is to - * read the high byte once, then the low byte, then the high - * byte again. If the new high byte matches the old one, - * then we have a valid reading. Else we have to read the low - * byte again, and now we believe we have a correct reading. - */ - - if (lm90_read_reg(client, LM90_REG_R_REMOTE_TEMPH, &oldh) == 0 - && lm90_read_reg(client, LM90_REG_R_REMOTE_TEMPL, &l) == 0 - && lm90_read_reg(client, LM90_REG_R_REMOTE_TEMPH, &newh) == 0 - && (newh == oldh - || lm90_read_reg(client, LM90_REG_R_REMOTE_TEMPL, &l) == 0)) - data->remote_temp = (newh << 8) | l; - - if (lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH, &newh) == 0 - && lm90_read_reg(client, LM90_REG_R_REMOTE_LOWL, &l) == 0) - data->remote_low = (newh << 8) | l; - if (lm90_read_reg(client, LM90_REG_R_REMOTE_HIGHH, &newh) == 0 - && lm90_read_reg(client, LM90_REG_R_REMOTE_HIGHL, &l) == 0) - data->remote_high = (newh << 8) | l; - lm90_read_reg(client, LM90_REG_R_STATUS, &data->alarms); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -static void lm90_local_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm90_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm90_update_client(client); - results[0] = TEMP1_FROM_REG(data->local_high); - results[1] = TEMP1_FROM_REG(data->local_low); - results[2] = TEMP1_FROM_REG(data->local_temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (data->kind == adt7461) - data->local_high = TEMP1_TO_REG_ADT7461(results[0]); - else - data->local_high = TEMP1_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, LM90_REG_W_LOCAL_HIGH, - data->local_high); - } - if (*nrels_mag >= 2) { - if (data->kind == adt7461) - data->local_low = TEMP1_TO_REG_ADT7461(results[1]); - else - data->local_low = TEMP1_TO_REG(results[1]); - i2c_smbus_write_byte_data(client, LM90_REG_W_LOCAL_LOW, - data->local_low); - } - } -} - -static void lm90_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm90_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm90_update_client(client); - results[0] = TEMP2_FROM_REG(data->remote_high); - results[1] = TEMP2_FROM_REG(data->remote_low); - results[2] = TEMP2_FROM_REG(data->remote_temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (data->kind == adt7461) - data->remote_high = TEMP2_TO_REG_ADT7461(results[0]); - else - data->remote_high = TEMP2_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, LM90_REG_W_REMOTE_HIGHH, - data->remote_high >> 8); - i2c_smbus_write_byte_data(client, LM90_REG_W_REMOTE_HIGHL, - data->remote_high & 0xFF); - } - if (*nrels_mag >= 2) { - if (data->kind == adt7461) - data->remote_low = TEMP2_TO_REG_ADT7461(results[1]); - else - data->remote_low = TEMP2_TO_REG(results[1]); - i2c_smbus_write_byte_data(client, LM90_REG_W_REMOTE_LOWH, - data->remote_low >> 8); - i2c_smbus_write_byte_data(client, LM90_REG_W_REMOTE_LOWL, - data->remote_low & 0xFF); - } - } -} - -static void lm90_local_tcrit(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm90_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm90_update_client(client); - results[0] = TEMP1_FROM_REG(data->local_crit); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (data->kind == adt7461) - data->local_crit = TEMP1_TO_REG_ADT7461(results[0]); - else - data->local_crit = TEMP1_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, LM90_REG_W_LOCAL_CRIT, - data->local_crit); - } - } -} - -static void lm90_remote_tcrit(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm90_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm90_update_client(client); - results[0] = TEMP1_FROM_REG(data->remote_crit); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (data->kind == adt7461) - data->remote_crit = TEMP1_TO_REG_ADT7461(results[0]); - else - data->remote_crit = TEMP1_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, LM90_REG_W_REMOTE_CRIT, - data->remote_crit); - } - } -} - -/* - * One quick note about hysteresis. Internally, the hysteresis value - * is held in a single register by the LM90, as a relative value. - * This relative value applies to both the local critical temperature - * and the remote critical temperature. Since all temperatures exported - * through procfs have to be absolute, we have to do some conversions. - * The solution retained here is to export two absolute values, one for - * each critical temperature. In order not to confuse the users too - * much, only one file is writable. Would we fail to do so, users - * would probably attempt to write to both files, as if they were - * independant, and since they aren't, they wouldn't understand why - * setting one affects the other one (and would probably claim there's - * a bug in the driver). - */ - -static void lm90_local_hyst(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm90_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm90_update_client(client); - results[0] = TEMP1_FROM_REG(data->local_crit) - - TEMP1_FROM_REG(data->hyst); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->hyst = HYST_TO_REG(data->local_crit - results[0]); - i2c_smbus_write_byte_data(client, LM90_REG_W_TCRIT_HYST, - data->hyst); - } - } -} - -static void lm90_remote_hyst(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm90_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm90_update_client(client); - results[0] = TEMP1_FROM_REG(data->remote_crit) - - TEMP1_FROM_REG(data->hyst); - *nrels_mag = 1; - } -} - -static void lm90_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm90_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - lm90_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -/* pec used for ADM1032 only */ -static void adm1032_pec(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = !!(client->flags & I2C_CLIENT_PEC); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - switch (results[0]) { - case 0: - client->flags &= ~I2C_CLIENT_PEC; - break; - case 1: - client->flags |= I2C_CLIENT_PEC; - break; - } - } - } -} - -static int __init sm_lm90_init(void) -{ - printk(KERN_INFO "lm90 driver version %s (%s)\n", LM_VERSION, - LM_DATE); - return i2c_add_driver(&lm90_driver); -} - -static void __exit sm_lm90_exit(void) -{ - i2c_del_driver(&lm90_driver); -} - -MODULE_AUTHOR("Jean Delvare "); -MODULE_DESCRIPTION("LM90/ADM1032 sensor driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_lm90_init); -module_exit(sm_lm90_exit); diff --git a/kernel/chips/lm92.c b/kernel/chips/lm92.c deleted file mode 100644 index 73154fcb..00000000 --- a/kernel/chips/lm92.c +++ /dev/null @@ -1,416 +0,0 @@ - -/* - * LM92 - Part of lm_sensors, Linux kernel modules for hardware - * monitoring - * - * Author: Abraham van der Merwe - * - * Linux support for the National Semiconductor LM92 Temperature - * Sensor. - * - * Based on code from the lm-sensors project which is available - * at http://www.lm-sensors.org/. lm87.c have been particularly - * helpful (: - * - * This source code is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" - -/* if defined, 4 faults must occur consecutively to set alarm flags */ -/* #define ENABLE_FAULT_QUEUE */ - -#define LM92_REG_TEMPERATURE 0x00 /* ro, 16-bit */ -#define LM92_REG_CONFIGURATION 0x01 /* rw, 8-bit */ -#define LM92_REG_TRIP_HYSTERESIS 0x02 /* rw, 16-bit */ -#define LM92_REG_TRIP_CRITICAL 0x03 /* rw, 16-bit */ -#define LM92_REG_TRIP_LOW 0x04 /* rw, 16-bit */ -#define LM92_REG_TRIP_HIGH 0x05 /* rw, 16-bit */ -#define LM92_REG_MANUFACTURER 0x07 /* ro, 16-bit */ - -#define LM92_MANUFACTURER_ID 0x8001 - -#define TEMP_MIN (-4096) -#define TEMP_MAX 4095 - -#define LIMIT(x) do { \ - if ((x) < TEMP_MIN) (x) = TEMP_MIN; \ - if ((x) > TEMP_MAX) (x) = TEMP_MAX; \ - } while (0) - -#define PROC_TO_NATIVE(x) ((x) / 625) -#define NATIVE_TO_PROC(x) ((x) * 625) -#define CELSIUS(x) ((x) * 16) - -static void lm92_temp (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results); -static void lm92_alarms (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results); - -/* -- SENSORS SYSCTL START -- */ -#define LM92_SYSCTL_ALARMS 2001 /* high, low, critical */ -#define LM92_SYSCTL_TEMP 1200 /* high, low, critical, hysteresis, input */ - -#define LM92_ALARM_TEMP_HIGH 0x01 -#define LM92_ALARM_TEMP_LOW 0x02 -#define LM92_ALARM_TEMP_CRIT 0x04 -#define LM92_TEMP_HIGH 0x08 -#define LM92_TEMP_LOW 0x10 -#define LM92_TEMP_CRIT 0x20 -#define LM92_TEMP_HYST 0x40 -#define LM92_TEMP_INPUT 0x80 - -/* -- SENSORS SYSCTL END -- */ - -static ctl_table lm92_dir_table[] = { - {LM92_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm92_temp, NULL}, - {LM92_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm92_alarms, NULL}, - {0} -}; - -/* NOTE: all temperatures are degrees centigrade * 16 */ -typedef struct { - struct i2c_client client; - int sysctl_id; - unsigned long timestamp; - struct { - long high; - long low; - long crit; - long hyst; - long input; - } temp; - struct { - long low; - long high; - long crit; - } alarms; -} lm92_t; - -/* this is needed for each client driver method */ -static struct i2c_driver lm92_driver; - -/* ensure exclusive access to chip and static variables */ -static DECLARE_MUTEX (mutex); - -/* addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x48, 0x4f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* insmod parameters */ -SENSORS_INSMOD_1 (lm92); - -static inline int lm92_write8 (struct i2c_client *client,u8 reg,u8 value) -{ - return (i2c_smbus_write_byte_data (client,reg,value) < 0 ? -EIO : 0); -} - -static inline int lm92_read16 (struct i2c_client *client,u8 reg,u16 *value) -{ - s32 tmp = i2c_smbus_read_word_data (client,reg); - - if (tmp < 0) return (-EIO); - - /* convert the data to little endian format */ - *value = swab16((u16) tmp); - - return (0); -} - -static inline int lm92_write16 (struct i2c_client *client,u8 reg,u16 value) -{ - /* convert the data to big endian format */ - if (i2c_smbus_write_word_data(client, reg, swab16(value)) < 0) - return -EIO; - - return 0; -} - -static int lm92_read (struct i2c_client *client) -{ - lm92_t *data = (lm92_t *) client->data; - u16 value[5]; - - if ((jiffies - data->timestamp) > HZ) { - if (lm92_read16 (client,LM92_REG_TEMPERATURE,value) < 0 || - lm92_read16 (client,LM92_REG_TRIP_HYSTERESIS,value + 1) < 0 || - lm92_read16 (client,LM92_REG_TRIP_CRITICAL,value + 2) < 0 || - lm92_read16 (client,LM92_REG_TRIP_LOW,value + 3) < 0 || - lm92_read16 (client,LM92_REG_TRIP_HIGH,value + 4) < 0) - return (-EIO); - - data->temp.input = (s16) value[0] >> 3; - data->temp.hyst = (s16) value[1] >> 3; - data->temp.crit = (s16) value[2] >> 3; - data->temp.low = (s16) value[3] >> 3; - data->temp.high = (s16) value[4] >> 3; - - data->alarms.low = value[0] & 1; - data->alarms.high = (value[0] & 2) >> 1; - data->alarms.crit = (value[0] & 4) >> 2; - - data->timestamp = jiffies; - } - - return (0); -} - -static int lm92_write (struct i2c_client *client) -{ - lm92_t *data = (lm92_t *) client->data; - - LIMIT (data->temp.hyst); - LIMIT (data->temp.crit); - LIMIT (data->temp.low); - LIMIT (data->temp.high); - - if (lm92_write16 (client,LM92_REG_TRIP_HYSTERESIS,((s16) data->temp.hyst << 3)) < 0 || - lm92_write16 (client,LM92_REG_TRIP_CRITICAL,((s16) data->temp.crit << 3)) < 0 || - lm92_write16 (client,LM92_REG_TRIP_LOW,((s16) data->temp.low << 3)) < 0 || - lm92_write16 (client,LM92_REG_TRIP_HIGH,((s16) data->temp.high << 3)) < 0) - return (-EIO); - - return (0); -} - -static void lm92_temp (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results) -{ - if (!down_interruptible (&mutex)) { - lm92_t *data = (lm92_t *) client->data; - - if (operation == SENSORS_PROC_REAL_READ) { - lm92_read (client); - results[0] = NATIVE_TO_PROC (data->temp.input); - results[1] = NATIVE_TO_PROC (data->temp.high); - results[2] = NATIVE_TO_PROC (data->temp.low); - results[3] = NATIVE_TO_PROC (data->temp.crit); - results[4] = NATIVE_TO_PROC (data->temp.hyst); - *nrels_mag = 5; - } else if (operation == SENSORS_PROC_REAL_WRITE && *nrels_mag == 4) { - data->temp.high = PROC_TO_NATIVE (results[0]); - data->temp.low = PROC_TO_NATIVE (results[1]); - data->temp.crit = PROC_TO_NATIVE (results[2]); - data->temp.hyst = PROC_TO_NATIVE (results[3]); - lm92_write (client); - } else if (operation == SENSORS_PROC_REAL_INFO) { - *nrels_mag = 4; - } - - up (&mutex); - } -} - -static void lm92_alarms (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results) -{ - if (!down_interruptible (&mutex)) { - lm92_t *data = (lm92_t *) client->data; - - if (operation == SENSORS_PROC_REAL_READ) { - lm92_read (client); - results[0] = data->alarms.high || (data->alarms.low << 1) || (data->alarms.crit << 2); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_INFO) { - *nrels_mag = 0; - } - - up (&mutex); - } -} - -static int max6635_check(struct i2c_client *client) -{ - int i; - u16 temp_low, temp_high, temp_hyst, temp_crit; - u8 conf; - - temp_low = i2c_smbus_read_word_data(client, LM92_REG_TRIP_LOW); - temp_high = i2c_smbus_read_word_data(client, LM92_REG_TRIP_HIGH); - temp_hyst = i2c_smbus_read_word_data(client, LM92_REG_TRIP_HYSTERESIS); - temp_crit = i2c_smbus_read_word_data(client, LM92_REG_TRIP_CRITICAL); - - if ((temp_low & 0x7f00) || (temp_high & 0x7f00) - || (temp_hyst & 0x7f00) || (temp_crit & 0x7f00)) - return 0; - - conf = i2c_smbus_read_byte_data(client, LM92_REG_CONFIGURATION); - - for (i=0; i<128; i+=16) { - if (temp_low != i2c_smbus_read_word_data(client, LM92_REG_TRIP_LOW + i) - || temp_high != i2c_smbus_read_word_data(client, LM92_REG_TRIP_HIGH + i) - || temp_hyst != i2c_smbus_read_word_data(client, LM92_REG_TRIP_HYSTERESIS + i) - || temp_crit != i2c_smbus_read_word_data(client, LM92_REG_TRIP_CRITICAL + i) - || conf != i2c_smbus_read_byte_data(client, LM92_REG_CONFIGURATION + i)) - return 0; - } - - return 1; -} - -static int lm92_init_client (struct i2c_client *client) -{ - lm92_t *data = (lm92_t *) client->data; - u8 value = 0; - int result; - - /* force reads to query the chip */ - data->timestamp = 0; - - /* setup the configuration register */ - -#ifdef ENABLE_FAULT_QUEUE - value |= 0x10; -#endif /* #ifdef ENABLE_FAULT_QUEUE */ - - if (lm92_write8 (client,LM92_REG_CONFIGURATION,value) < 0) - return (-ENODEV); - - /* set default alarm trigger values */ - - data->temp.high = CELSIUS (64); - data->temp.low = CELSIUS (10); - data->temp.crit = CELSIUS (80); - data->temp.hyst = CELSIUS (2); - - if ((result = lm92_write (client)) < 0) - return (result); - - /* read everything once so that our cached data is updated */ - - if ((result = lm92_read (client)) < 0) - return (result); - - return (0); -} - -static int lm92_detect (struct i2c_adapter *adapter,int address,unsigned short flags,int kind) -{ - struct i2c_client *client; - lm92_t *data; - int result = 0; - u16 manufacturer; - - if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA)) - return 0; - - if (!(data = kmalloc(sizeof(lm92_t), GFP_KERNEL))) - return (-ENOMEM); - - client = &data->client; - client->addr = address; - client->data = data; - client->adapter = adapter; - client->driver = &lm92_driver; - client->flags = 0; - strcpy (client->name,lm92_driver.name); - - if (down_interruptible (&mutex)) { - result = -ERESTARTSYS; - goto ERROR1; - } - - if (kind < 0) { - /* Is it an lm92? */ - if (address < 0x4c - && (lm92_read16(client,LM92_REG_MANUFACTURER,&manufacturer) < 0 - || manufacturer != LM92_MANUFACTURER_ID)) { - /* Is it a MAX6635/MAX6635/MAX6635? */ - if (!max6635_check(client)) { - goto ERROR2; - } - } - } - - if ((result = i2c_attach_client (client))) { - goto ERROR2; - } - - if ((result = i2c_register_entry(client, client->name, lm92_dir_table, - THIS_MODULE)) < 0) { - goto ERROR3; - } - data->sysctl_id = result; - - if ((result = lm92_init_client (client)) < 0) { - goto ERROR4; - } - - up (&mutex); - - return (0); - -ERROR4: - i2c_deregister_entry(data->sysctl_id); -ERROR3: - i2c_detach_client(client); -ERROR2: - up(&mutex); -ERROR1: - kfree(data); - return result; -} - -static int lm92_attach_adapter (struct i2c_adapter *adapter) -{ - return i2c_detect (adapter,&addr_data,lm92_detect); -} - -static int lm92_detach_client (struct i2c_client *client) -{ - int result; - - i2c_deregister_entry (((lm92_t *) (client->data))->sysctl_id); - - if ((result = i2c_detach_client (client))) - return (result); - - kfree(client->data); - - return (0); -} - - -static struct i2c_driver lm92_driver = { - .name = "lm92", - .id = I2C_DRIVERID_LM92, - .flags = I2C_DF_NOTIFY, - .attach_adapter = lm92_attach_adapter, - .detach_client = lm92_detach_client, -}; - -static int __init sm_lm92_init(void) -{ - printk ("lm92.o version %s (%s)\n",LM_VERSION,LM_DATE); - return i2c_add_driver(&lm92_driver); -} - - -static void __exit sm_lm92_exit(void) -{ - i2c_del_driver(&lm92_driver); -} - - - -MODULE_AUTHOR ("Abraham van der Merwe "); -MODULE_DESCRIPTION ("Linux support for LM92 Temperature Sensor"); - -MODULE_LICENSE ("GPL"); - -module_init(sm_lm92_init); -module_exit(sm_lm92_exit); - diff --git a/kernel/chips/lm93.c b/kernel/chips/lm93.c deleted file mode 100644 index fe1e3b63..00000000 --- a/kernel/chips/lm93.c +++ /dev/null @@ -1,2343 +0,0 @@ -/* - lm93.c - Part of lm_sensors, Linux kernel modules for hardware monitoring - - Author/Maintainer: Mark M. Hoffman - Copyright (c) 2004 Utilitek Systems, Inc. - - derived in part from lm78.c: - Copyright (c) 1998, 1999 Frodo Looijaard - - derived in part from lm85.c: - Copyright (c) 2002, 2003 Philip Pokorny - Copyright (c) 2003 Margit Schubert-While - - derived in part from w83l785ts.c: - Copyright (c) 2003-2004 Jean Delvare - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#define DEBUG 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" -#include "lm93.h" - -#ifndef I2C_DRIVERID_LM93 -#define I2C_DRIVERID_LM93 1049 -#endif - -/* I2C addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x2c, 0x2e, SENSORS_I2C_END }; - -/* ISA addresses to scan (none) */ -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* module parameters */ -SENSORS_INSMOD_1(lm93); - -static int disable_block /* = 0 */ ; -MODULE_PARM(disable_block, "i"); -MODULE_PARM_DESC(disable_block, - "Set to non-zero to disable SMBus block data transactions."); - -static int init = 1; -MODULE_PARM(init, "i"); -MODULE_PARM_DESC(init, "Set to zero to bypass most chip initialization"); - -static int vccp_limit_type[2] /* = {0,0} */ ; -MODULE_PARM(vccp_limit_type, "2-2i"); -MODULE_PARM_DESC(vccp_limit_type, "Configures in7 and in8 limit modes"); - -static int vid_agtl = 0; -MODULE_PARM(vid_agtl, "i"); -MODULE_PARM_DESC(vid_agtl, "Configures VID pin input thresholds"); - -/* -- SENSORS SYSCTL START -- */ -/* volts * 100 */ -#define LM93_SYSCTL_IN1 1001 -#define LM93_SYSCTL_IN2 1002 -#define LM93_SYSCTL_IN3 1003 -#define LM93_SYSCTL_IN4 1004 -#define LM93_SYSCTL_IN5 1005 -#define LM93_SYSCTL_IN6 1006 -#define LM93_SYSCTL_IN7 1007 -#define LM93_SYSCTL_IN8 1008 -#define LM93_SYSCTL_IN9 1009 -#define LM93_SYSCTL_IN10 1010 -#define LM93_SYSCTL_IN11 1011 -#define LM93_SYSCTL_IN12 1012 -#define LM93_SYSCTL_IN13 1013 -#define LM93_SYSCTL_IN14 1014 -#define LM93_SYSCTL_IN15 1015 -#define LM93_SYSCTL_IN16 1016 - -/* degrees Celsius * 10 */ -#define LM93_SYSCTL_TEMP1 1101 -#define LM93_SYSCTL_TEMP2 1102 -#define LM93_SYSCTL_TEMP3 1103 - -#define LM93_SYSCTL_TEMP1_AUTO_BASE 1111 -#define LM93_SYSCTL_TEMP2_AUTO_BASE 1112 -#define LM93_SYSCTL_TEMP3_AUTO_BASE 1113 - -#define LM93_SYSCTL_TEMP1_AUTO_OFFSETS 1121 -#define LM93_SYSCTL_TEMP2_AUTO_OFFSETS 1122 -#define LM93_SYSCTL_TEMP3_AUTO_OFFSETS 1123 - -#define LM93_SYSCTL_TEMP1_AUTO_BOOST 1131 -#define LM93_SYSCTL_TEMP2_AUTO_BOOST 1132 -#define LM93_SYSCTL_TEMP3_AUTO_BOOST 1133 - -#define LM93_SYSCTL_TEMP1_AUTO_BOOST_HYST 1141 -#define LM93_SYSCTL_TEMP2_AUTO_BOOST_HYST 1142 -#define LM93_SYSCTL_TEMP3_AUTO_BOOST_HYST 1143 - -/* 0 => off, 255 => 100% */ -#define LM93_SYSCTL_TEMP1_AUTO_PWM_MIN 1151 -#define LM93_SYSCTL_TEMP2_AUTO_PWM_MIN 1152 -#define LM93_SYSCTL_TEMP3_AUTO_PWM_MIN 1153 - -/* degrees Celsius * 10 */ -#define LM93_SYSCTL_TEMP1_AUTO_OFFSET_HYST 1161 -#define LM93_SYSCTL_TEMP2_AUTO_OFFSET_HYST 1162 -#define LM93_SYSCTL_TEMP3_AUTO_OFFSET_HYST 1163 - -/* rotations/minute */ -#define LM93_SYSCTL_FAN1 1201 -#define LM93_SYSCTL_FAN2 1202 -#define LM93_SYSCTL_FAN3 1203 -#define LM93_SYSCTL_FAN4 1204 - -/* 1-2 => enable smart tach mode associated with this pwm #, or disable */ -#define LM93_SYSCTL_FAN1_SMART_TACH 1205 -#define LM93_SYSCTL_FAN2_SMART_TACH 1206 -#define LM93_SYSCTL_FAN3_SMART_TACH 1207 -#define LM93_SYSCTL_FAN4_SMART_TACH 1208 - -/* volts * 1000 */ -#define LM93_SYSCTL_VID1 1301 -#define LM93_SYSCTL_VID2 1302 - -/* 0 => off, 255 => 100% */ -#define LM93_SYSCTL_PWM1 1401 -#define LM93_SYSCTL_PWM2 1402 - -/* Hz */ -#define LM93_SYSCTL_PWM1_FREQ 1411 -#define LM93_SYSCTL_PWM2_FREQ 1412 - -/* bitvector */ -#define LM93_SYSCTL_PWM1_AUTO_CHANNELS 1421 -#define LM93_SYSCTL_PWM2_AUTO_CHANNELS 1422 - -/* Hz */ -#define LM93_SYSCTL_PWM1_AUTO_SPINUP_MIN 1431 -#define LM93_SYSCTL_PWM2_AUTO_SPINUP_MIN 1432 - -/* seconds */ -#define LM93_SYSCTL_PWM1_AUTO_SPINUP_TIME 1441 -#define LM93_SYSCTL_PWM2_AUTO_SPINUP_TIME 1442 - -/* seconds */ -#define LM93_SYSCTL_PWM_AUTO_PROCHOT_RAMP 1451 -#define LM93_SYSCTL_PWM_AUTO_VRDHOT_RAMP 1452 - -/* 0 => 0%, 255 => > 99.6% */ -#define LM93_SYSCTL_PROCHOT1 1501 -#define LM93_SYSCTL_PROCHOT2 1502 - -/* !0 => enable #PROCHOT logical short */ -#define LM93_SYSCTL_PROCHOT_SHORT 1503 - -/* 2 boolean enable/disable, 3rd value indicates duty cycle */ -#define LM93_SYSCTL_PROCHOT_OVERRIDE 1504 - -/* 2 values, 0-9 */ -#define LM93_SYSCTL_PROCHOT_INTERVAL 1505 - -/* GPIO input (bitmask) */ -#define LM93_SYSCTL_GPIO 1601 - -/* #VRDHOT input (boolean) */ -#define LM93_SYSCTL_VRDHOT1 1701 -#define LM93_SYSCTL_VRDHOT2 1702 - -/* alarms (bitmask) */ -#define LM93_SYSCTL_ALARMS 2001 - -/* alarm bitmask definitions - The LM93 has nearly 64 bits of error status... I've pared that down to - what I think is a useful subset in order to fit it into 32 bits. - - Especially note that the #VRD_HOT alarms are missing because we provide - that information as values in another /proc file. - - If libsensors is extended to support 64 bit values, this could be revisited. -*/ -#define LM93_ALARM_IN1 0x00000001 -#define LM93_ALARM_IN2 0x00000002 -#define LM93_ALARM_IN3 0x00000004 -#define LM93_ALARM_IN4 0x00000008 -#define LM93_ALARM_IN5 0x00000010 -#define LM93_ALARM_IN6 0x00000020 -#define LM93_ALARM_IN7 0x00000040 -#define LM93_ALARM_IN8 0x00000080 -#define LM93_ALARM_IN9 0x00000100 -#define LM93_ALARM_IN10 0x00000200 -#define LM93_ALARM_IN11 0x00000400 -#define LM93_ALARM_IN12 0x00000800 -#define LM93_ALARM_IN13 0x00001000 -#define LM93_ALARM_IN14 0x00002000 -#define LM93_ALARM_IN15 0x00004000 -#define LM93_ALARM_IN16 0x00008000 -#define LM93_ALARM_FAN1 0x00010000 -#define LM93_ALARM_FAN2 0x00020000 -#define LM93_ALARM_FAN3 0x00040000 -#define LM93_ALARM_FAN4 0x00080000 -#define LM93_ALARM_PH1_ERR 0x00100000 -#define LM93_ALARM_PH2_ERR 0x00200000 -#define LM93_ALARM_SCSI1_ERR 0x00400000 -#define LM93_ALARM_SCSI2_ERR 0x00800000 -#define LM93_ALARM_DVDDP1_ERR 0x01000000 -#define LM93_ALARM_DVDDP2_ERR 0x02000000 -#define LM93_ALARM_D1_ERR 0x04000000 -#define LM93_ALARM_D2_ERR 0x08000000 -#define LM93_ALARM_TEMP1 0x10000000 -#define LM93_ALARM_TEMP2 0x20000000 -#define LM93_ALARM_TEMP3 0x40000000 - -/* -- SENSORS SYSCTL END -- */ - -/* SMBus capabilities */ -#define LM93_SMBUS_FUNC_FULL (I2C_FUNC_SMBUS_BYTE_DATA | \ - I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA) -#define LM93_SMBUS_FUNC_MIN (I2C_FUNC_SMBUS_BYTE_DATA | \ - I2C_FUNC_SMBUS_WORD_DATA) - -/* LM93 BLOCK READ COMMANDS */ -static const struct { u8 cmd; u8 len; } lm93_block_read_cmds[12] = { - { 0xf2, 8 }, - { 0xf3, 8 }, - { 0xf4, 6 }, - { 0xf5, 16 }, - { 0xf6, 4 }, - { 0xf7, 8 }, - { 0xf8, 12 }, - { 0xf9, 32 }, - { 0xfa, 8 }, - { 0xfb, 8 }, - { 0xfc, 16 }, - { 0xfd, 9 }, -}; - -/* ALARMS: SYSCTL format described further below - REG: 64 bits in 8 registers, as immediately below */ -struct block1_t { - u8 host_status_1; - u8 host_status_2; - u8 host_status_3; - u8 host_status_4; - u8 p1_prochot_status; - u8 p2_prochot_status; - u8 gpi_status; - u8 fan_status; -}; - -/* unique ID for each LM93 detected */ -static int lm93_id = 0; - -/* For each registered client, we need to keep some data in memory. That - data is pointed to by client->data. The structure itself is dynamically - allocated, at the same time the client itself is allocated. */ - -struct lm93_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - unsigned long last_updated; /* In jiffies */ - - /* client update function */ - void (*update)(struct lm93_data *, struct i2c_client *); - - char valid; /* !=0 if following fields are valid */ - - /* register values, arranged by block read groups */ - struct block1_t block1; - - /* temp1 - temp4: unfiltered readings - temp1 - temp2: filtered readings */ - u8 block2[6]; - - /* vin1 - vin16: readings */ - u8 block3[16]; - - /* prochot1 - prochot2: readings */ - struct { u8 cur; u8 avg; } block4[2]; - - /* fan counts 1-4 => 14-bits, LE, *left* justified */ - u16 block5[4]; - - /* block6 has a lot of data we don't need */ - struct { u8 min; u8 max; } temp_lim[3]; - - /* vin1 - vin16: low and high limits */ - struct { u8 min; u8 max; } block7[16]; - - /* fan count limits 1-4 => same format as block5 */ - u16 block8[4]; - - /* pwm control registers (2 pwms, 4 regs) */ - u8 block9[2][4]; - - /* auto/pwm base temp and offset temp registers */ - struct { u8 base[4]; u8 offset[12]; } block10; - - /* master config register */ - u8 config; - - /* VID1 & VID2 => register format, 6-bits, right justified */ - u8 vid[2]; - - /* prochot1 - prochot2: limits */ - u8 prochot_max[2]; - - /* vccp1 & vccp2 (in7 & in8): VID relative limits (register format) */ - u8 vccp_limits[2]; - - /* GPIO input state (register format, i.e. inverted) */ - u8 gpi; - - /* #PROCHOT override (register format) */ - u8 prochot_override; - - /* #PROCHOT intervals (register format) */ - u8 prochot_interval; - - /* Fan Boost Temperatures (register format) */ - u8 boost[4]; - - /* Fan Boost Hysteresis (register format) */ - u8 boost_hyst[2]; - - /* Temperature Zone Min. PWM & Hysteresis (register format) */ - u8 auto_pwm_min_hyst[2]; - - /* #PROCHOT & #VRDHOT PWM Ramp Control */ - u8 pwm_ramp_ctl; - - /* miscellaneous setup regs */ - u8 sfc1; - u8 sfc2; - u8 sf_tach_to_pwm; - - /* The two PWM CTL2 registers can read something other than what was - last written for the OVR_DC field (duty cycle override). So, we - save the user-commanded value here. */ - u8 pwm_override[2]; -}; - -#define MAX_RETRIES 5 - -static u8 lm93_read_byte(struct i2c_client *client, u8 reg) -{ - int value, i; - - /* retry in case of read errors */ - for (i=1; i<=MAX_RETRIES; i++) { - if ((value = i2c_smbus_read_byte_data(client, reg)) >= 0) { - return value; - } else { - printk(KERN_WARNING "lm93.o: read byte data failed, " - "address 0x%02x.\n", reg); - mdelay(i + 3); - } - - } - - /* what to return in case of error? */ - printk(KERN_ERR "lm93.o: All read byte retries failed!!\n"); - return 0; -} - -static int lm93_write_byte(struct i2c_client *client, u8 reg, u8 value) -{ - int result; - - /* how to handle write errors? */ - result = i2c_smbus_write_byte_data(client, reg, value); - - if (result < 0) - printk(KERN_WARNING "lm93.o: write byte data failed, " - "0x%02x at address 0x%02x.\n", value, reg); - - return result; -} - -static u16 lm93_read_word(struct i2c_client *client, u8 reg) -{ - int value, i; - - /* retry in case of read errors */ - for (i=1; i<=MAX_RETRIES; i++) { - if ((value = i2c_smbus_read_word_data(client, reg)) >= 0) { - return value; - } else { - printk(KERN_WARNING "lm93.o: read word data failed, " - "address 0x%02x.\n", reg); - mdelay(i + 3); - } - - } - - /* what to return in case of error? */ - printk(KERN_ERR "lm93.o: All read word retries failed!!\n"); - return 0; -} - -static int lm93_write_word(struct i2c_client *client, u8 reg, u16 value) -{ - int result; - - /* how to handle write errors? */ - result = i2c_smbus_write_word_data(client, reg, value); - - if (result < 0) - printk(KERN_WARNING "lm93.o: write word data failed, " - "0x%04x at address 0x%02x.\n", value, reg); - - return result; -} - -static u8 lm93_block_buffer[I2C_SMBUS_BLOCK_MAX]; - -/* - read block data into values, retry if not expected length - fbn => index to lm93_block_read_cmds table - (Fixed Block Number - section 14.5.2 of LM93 datasheet) -*/ -static void lm93_read_block(struct i2c_client *client, u8 fbn, u8 *values) -{ - int i, result=0; - - for (i = 1; i <= MAX_RETRIES; i++) { - result = i2c_smbus_read_block_data(client, - lm93_block_read_cmds[fbn].cmd, lm93_block_buffer); - - if (result == lm93_block_read_cmds[fbn].len) { - break; - } else { - printk(KERN_WARNING "lm93.o: block read data failed, " - "command 0x%02x.\n", - lm93_block_read_cmds[fbn].cmd); - mdelay(i + 3); - } - } - - if (result == lm93_block_read_cmds[fbn].len) { - memcpy(values,lm93_block_buffer,lm93_block_read_cmds[fbn].len); - } else { - /* what to do in case of error? */ - } -} - -static void lm93_update_client(struct i2c_client *client) -{ - struct lm93_data *data = client->data; - - down(&data->update_lock); - - if (time_after(jiffies - data->last_updated, HZ + HZ / 2) || - time_before(jiffies, data->last_updated) || !data->valid) { - - data->update(data, client); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -/* update routine for data that has no corresponding SMBus block data command */ -static void lm93_update_client_common(struct lm93_data *data, - struct i2c_client *client) -{ - int i; - u8 *ptr; - - /* temp1 - temp4: limits */ - for (i = 0; i < 4; i++) { - data->temp_lim[i].min = - lm93_read_byte(client, LM93_REG_TEMP_MIN(i)); - data->temp_lim[i].max = - lm93_read_byte(client, LM93_REG_TEMP_MAX(i)); - } - - /* config register */ - data->config = lm93_read_byte(client, LM93_REG_CONFIG); - - /* vid1 - vid2: values */ - for (i = 0; i < 2; i++) - data->vid[i] = lm93_read_byte(client, LM93_REG_VID(i)); - - /* prochot1 - prochot2: limits */ - for (i = 0; i < 2; i++) - data->prochot_max[i] = lm93_read_byte(client, - LM93_REG_PROCHOT_MAX(i)); - - /* vccp1 - vccp2: VID relative limits */ - for (i = 0; i < 2; i++) - data->vccp_limits[i] = lm93_read_byte(client, - LM93_REG_VCCP_LIMIT_OFF(i)); - - /* GPIO input state */ - data->gpi = lm93_read_byte(client, LM93_REG_GPI); - - /* #PROCHOT override state */ - data->prochot_override = lm93_read_byte(client, - LM93_REG_PROCHOT_OVERRIDE); - - /* #PROCHOT intervals */ - data->prochot_interval = lm93_read_byte(client, - LM93_REG_PROCHOT_INTERVAL); - - /* Fan Boost Termperature registers */ - for (i = 0; i < 4; i++) - data->boost[i] = lm93_read_byte(client, LM93_REG_BOOST(i)); - - /* Fan Boost Temperature Hyst. registers */ - data->boost_hyst[0] = lm93_read_byte(client, LM93_REG_BOOST_HYST_12); - data->boost_hyst[1] = lm93_read_byte(client, LM93_REG_BOOST_HYST_34); - - /* Temperature Zone Min. PWM & Hysteresis registers */ - data->auto_pwm_min_hyst[0] = - lm93_read_byte(client, LM93_REG_PWM_MIN_HYST_12); - data->auto_pwm_min_hyst[1] = - lm93_read_byte(client, LM93_REG_PWM_MIN_HYST_34); - - /* #PROCHOT & #VRDHOT PWM Ramp Control register */ - data->pwm_ramp_ctl = lm93_read_byte(client, LM93_REG_PWM_RAMP_CTL); - - /* misc setup registers */ - data->sfc1 = lm93_read_byte(client, LM93_REG_SFC1); - data->sfc2 = lm93_read_byte(client, LM93_REG_SFC2); - data->sf_tach_to_pwm = lm93_read_byte(client, - LM93_REG_SF_TACH_TO_PWM); - - /* write back alarm values to clear */ - for (i = 0, ptr = (u8 *)(&data->block1); i < 8; i++) - lm93_write_byte(client, LM93_REG_HOST_ERROR_1 + i, *(ptr + i)); -} - -/* update routine which uses SMBus block data commands */ -static void lm93_update_client_full(struct lm93_data *data, - struct i2c_client *client) -{ - pr_debug("lm93.o: starting device update (block data enabled)\n"); - - /* in1 - in16: values & limits */ - lm93_read_block(client, 3, (u8 *)(data->block3)); - lm93_read_block(client, 7, (u8 *)(data->block7)); - - /* temp1 - temp4: values */ - lm93_read_block(client, 2, (u8 *)(data->block2)); - - /* prochot1 - prochot2: values */ - lm93_read_block(client, 4, (u8 *)(data->block4)); - - /* fan1 - fan4: values & limits */ - lm93_read_block(client, 5, (u8 *)(data->block5)); - lm93_read_block(client, 8, (u8 *)(data->block8)); - - /* pmw control registers */ - lm93_read_block(client, 9, (u8 *)(data->block9)); - - /* alarm values */ - lm93_read_block(client, 1, (u8 *)(&data->block1)); - - /* auto/pwm registers */ - lm93_read_block(client, 10, (u8 *)(&data->block10)); - - lm93_update_client_common(data, client); -} - -/* update routine which uses SMBus byte/word data commands only */ -static void lm93_update_client_min(struct lm93_data *data, - struct i2c_client *client) -{ - int i,j; - u8 *ptr; - - pr_debug("lm93.o: starting device update (block data disabled)\n"); - - /* in1 - in16: values & limits */ - for (i = 0; i < 16; i++) { - data->block3[i] = - lm93_read_byte(client, LM93_REG_IN(i)); - data->block7[i].min = - lm93_read_byte(client, LM93_REG_IN_MIN(i)); - data->block7[i].max = - lm93_read_byte(client, LM93_REG_IN_MAX(i)); - } - - /* temp1 - temp4: values */ - for (i = 0; i < 4; i++) { - data->block2[i] = - lm93_read_byte(client, LM93_REG_TEMP(i)); - } - - /* prochot1 - prochot2: values */ - for (i = 0; i < 2; i++) { - data->block4[i].cur = - lm93_read_byte(client, LM93_REG_PROCHOT_CUR(i)); - data->block4[i].avg = - lm93_read_byte(client, LM93_REG_PROCHOT_AVG(i)); - } - - /* fan1 - fan4: values & limits */ - for (i = 0; i < 4; i++) { - data->block5[i] = - lm93_read_word(client, LM93_REG_FAN(i)); - data->block8[i] = - lm93_read_word(client, LM93_REG_FAN_MIN(i)); - } - - /* pwm control registers */ - for (i = 0; i < 2; i++) { - for (j = 0; j < 4; j++) { - data->block9[i][j] = - lm93_read_byte(client, LM93_REG_PWM_CTL(i,j)); - } - } - - /* alarm values */ - for (i = 0, ptr = (u8 *)(&data->block1); i < 8; i++) { - *(ptr + i) = - lm93_read_byte(client, LM93_REG_HOST_ERROR_1 + i); - } - - /* auto/pwm (base temp) registers */ - for (i = 0; i < 4; i++) { - data->block10.base[i] = - lm93_read_byte(client, LM93_REG_TEMP_BASE(i)); - } - - /* auto/pwm (offset temp) registers */ - for (i = 0; i < 12; i++) { - data->block10.offset[i] = - lm93_read_byte(client, LM93_REG_TEMP_OFFSET(i)); - } - - lm93_update_client_common(data, client); -} - -/* VID: mV - REG: 6-bits, right justified, *always* using Intel VRM/VRD 10 */ -static int LM93_VID_FROM_REG(u8 reg) -{ - return vid_from_reg((reg & 0x3f), 100); -} - -static void lm93_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_VID1; - - if (0 > nr || nr > 1) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = LM93_VID_FROM_REG(data->vid[nr]); - *nrels_mag = 1; - } -} - -/* min, max, and nominal voltage readings, per channel (mV)*/ -static const unsigned long lm93_vin_val_min[16] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3000, -}; -static const unsigned long lm93_vin_val_max[16] = { - 1236, 1236, 1236, 1600, 2000, 2000, 1600, 1600, - 4400, 6500, 3333, 2625, 1312, 1312, 1236, 3600, -}; -/* -static const unsigned long lm93_vin_val_nom[16] = { - 927, 927, 927, 1200, 1500, 1500, 1200, 1200, - 3300, 5000, 2500, 1969, 984, 984, 309, 3300, -}; -*/ - -/* min, max, and nominal register values, per channel (u8) */ -static const u8 lm93_vin_reg_min[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, -}; -static const u8 lm93_vin_reg_max[16] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd1, -}; -/* -static const u8 lm93_vin_reg_nom[16] = { - 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, - 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x40, 0xc0, -}; -*/ - -/* IN: 1/100 V, limits determined by channel nr - REG: scaling determined by channel nr */ -static u8 LM93_IN_TO_REG(int nr, unsigned val) -{ - /* range limit */ - const long mV = SENSORS_LIMIT(val * 10, - lm93_vin_val_min[nr], lm93_vin_val_max[nr]); - - /* try not to lose too much precision here */ - const long uV = mV * 1000; - const long uV_max = lm93_vin_val_max[nr] * 1000; - const long uV_min = lm93_vin_val_min[nr] * 1000; - - /* convert */ - const long slope = (uV_max - uV_min) / - (lm93_vin_reg_max[nr] - lm93_vin_reg_min[nr]); - const long intercept = uV_min - slope * lm93_vin_reg_min[nr]; - - u8 result = ((uV - intercept + (slope/2)) / slope); - result = SENSORS_LIMIT(result, - lm93_vin_reg_min[nr], lm93_vin_reg_max[nr]); - return result; -} - -static unsigned LM93_IN_FROM_REG(int nr, u8 reg) -{ - const long uV_max = lm93_vin_val_max[nr] * 1000; - const long uV_min = lm93_vin_val_min[nr] * 1000; - - const long slope = (uV_max - uV_min) / - (lm93_vin_reg_max[nr] - lm93_vin_reg_min[nr]); - const long intercept = uV_min - slope * lm93_vin_reg_min[nr]; - - return (slope * reg + intercept + 5000) / 10000; -} - -/* vid in mV , upper == 0 indicates low limit, otherwise upper limit - upper also determines which nibble of the register is returned - (the other nibble will be 0x0) */ -static u8 LM93_IN_REL_TO_REG(unsigned val, int upper, int vid) -{ - long uV_offset = vid * 1000 - val * 10000; - if (upper) { - uV_offset = SENSORS_LIMIT(uV_offset, 12500, 200000); - return (u8)((uV_offset / 12500 - 1) << 4); - } else { - uV_offset = SENSORS_LIMIT(uV_offset, -400000, -25000); - return (u8)((uV_offset / -25000 - 1) << 0); - } -} - -/* vid in mV, upper == 0 indicates low limit, otherwise upper limit */ -static unsigned LM93_IN_REL_FROM_REG(u8 reg, int upper, int vid) -{ - const long uV_offset = upper ? (((reg >> 4 & 0x0f) + 1) * 12500) : - (((reg >> 0 & 0x0f) + 1) * -25000); - const long uV_vid = vid * 1000; - return (uV_vid + uV_offset + 5000) / 10000; -} - -static void lm93_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_IN1; /* 0 <= nr <= 15 */ - int vccp = ctl_name - LM93_SYSCTL_IN7; /* 0 <= vccp <= 1 if relevant */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - - lm93_update_client(client); - - /* for limits, check in7 and in8 for VID relative mode */ - if ((ctl_name==LM93_SYSCTL_IN7 || ctl_name==LM93_SYSCTL_IN8) && - (vccp_limit_type[vccp])) { - long vid = LM93_VID_FROM_REG(data->vid[vccp]); - results[0] = LM93_IN_REL_FROM_REG( - data->vccp_limits[vccp], 0, vid); - results[1] = LM93_IN_REL_FROM_REG( - data->vccp_limits[vccp], 1, vid); - - /* otherwise, use absolute limits */ - } else { - results[0] = LM93_IN_FROM_REG(nr, - data->block7[nr].min); - results[1] = LM93_IN_FROM_REG(nr, - data->block7[nr].max); - } - - results[2] = LM93_IN_FROM_REG(nr, data->block3[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - - /* for limits, check in7 and in8 for VID relative mode */ - if ((ctl_name==LM93_SYSCTL_IN7 || ctl_name==LM93_SYSCTL_IN8) && - (vccp_limit_type[vccp])) { - - long vid = LM93_VID_FROM_REG(data->vid[vccp]); - if (*nrels_mag >= 2) { - data->vccp_limits[vccp] = - (data->vccp_limits[vccp] & 0x0f) | - LM93_IN_REL_TO_REG(results[1], 1, vid); - } - if (*nrels_mag >= 1) { - data->vccp_limits[vccp] = - (data->vccp_limits[vccp] & 0xf0) | - LM93_IN_REL_TO_REG(results[0], 0, vid); - lm93_write_byte(client, - LM93_REG_VCCP_LIMIT_OFF(vccp), - data->vccp_limits[vccp]); - } - - /* otherwise, use absolute limits */ - } else { - if (*nrels_mag >= 1) { - data->block7[nr].min = LM93_IN_TO_REG(nr, - results[0]); - lm93_write_byte(client, LM93_REG_IN_MIN(nr), - data->block7[nr].min); - } - if (*nrels_mag >= 2) { - data->block7[nr].max = LM93_IN_TO_REG(nr, - results[1]); - lm93_write_byte(client, LM93_REG_IN_MAX(nr), - data->block7[nr].max); - } - } - up(&data->update_lock); - } -} - -static unsigned LM93_ALARMS_FROM_REG(struct block1_t b1) -{ - unsigned result; - result = b1.host_status_2 & 0x3f; - - if (vccp_limit_type[0]) - result |= (b1.host_status_4 & 0x10) << 2; - else - result |= b1.host_status_2 & 0x40; - - if (vccp_limit_type[1]) - result |= (b1.host_status_4 & 0x20) << 2; - else - result |= b1.host_status_2 & 0x80; - - result |= b1.host_status_3 << 8; - result |= (b1.fan_status & 0x0f) << 16; - result |= (b1.p1_prochot_status & 0x80) << 13; - result |= (b1.p2_prochot_status & 0x80) << 14; - result |= (b1.host_status_4 & 0xfc) << 20; - result |= (b1.host_status_1 & 0x07) << 28; - return result; -} - -static void lm93_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = LM93_ALARMS_FROM_REG(data->block1); - *nrels_mag = 1; - } -} - -#define LM93_TEMP_MIN (-1280) -#define LM93_TEMP_MAX ( 1270) - -/* TEMP: 1/10 degrees C (-128C to +127C) - REG: 1C/bit, two's complement */ -static u8 LM93_TEMP_TO_REG(int temp) -{ - int ntemp = SENSORS_LIMIT(temp, LM93_TEMP_MIN, LM93_TEMP_MAX); - ntemp += (ntemp<0 ? -5 : 5); - return (u8)(ntemp / 10); -} - -static int LM93_TEMP_FROM_REG(u8 reg) -{ - return (s8)reg * 10; -} - -static void lm93_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_TEMP1; - - if (0 > nr || nr > 2) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = LM93_TEMP_FROM_REG(data->temp_lim[nr].max); - results[1] = LM93_TEMP_FROM_REG(data->temp_lim[nr].min); - results[2] = LM93_TEMP_FROM_REG(data->block2[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag >= 1) { - data->temp_lim[nr].max = LM93_TEMP_TO_REG(results[0]); - lm93_write_byte(client, LM93_REG_TEMP_MAX(nr), - data->temp_lim[nr].max); - } - if (*nrels_mag >= 2) { - data->temp_lim[nr].min = LM93_TEMP_TO_REG(results[1]); - lm93_write_byte(client, LM93_REG_TEMP_MIN(nr), - data->temp_lim[nr].min); - } - up(&data->update_lock); - } -} - -/* Determine 4-bit temperature offset resolution */ -static int LM93_TEMP_OFFSET_MODE_FROM_REG(u8 sfc2, int nr) -{ - /* mode: 0 => 1C/bit, nonzero => 0.5C/bit */ - return sfc2 & (nr < 2 ? 0x10 : 0x20); -} - -#define LM93_TEMP_OFFSET_MIN ( 0) -#define LM93_TEMP_OFFSET_MAX0 (150) -#define LM93_TEMP_OFFSET_MAX1 ( 75) - -/* This function is common to all 4-bit temperature offsets - returns 4 bits right justified - mode 0 => 1C/bit, mode !0 => 0.5C/bit */ -static u8 LM93_TEMP_OFFSET_TO_REG(int off, int mode) -{ - int factor = mode ? 5 : 10; - - off = SENSORS_LIMIT(off, LM93_TEMP_OFFSET_MIN, - mode ? LM93_TEMP_OFFSET_MAX1 : LM93_TEMP_OFFSET_MAX0); - return (u8)((off + factor/2) / factor); -} - -/* This function is common to all 4-bit temperature offsets - reg is 4 bits right justified - mode 0 => 1C/bit, mode !0 => 0.5C/bit */ -static int LM93_TEMP_OFFSET_FROM_REG(u8 reg, int mode) -{ - return (reg & 0x0f) * (mode ? 5 : 10); -} - -/* TEMP: 1/10 degrees C (0C to +15C (mode 0) or +7.5C (mode non-zero)) - REG: 1.0C/bit (mode 0) or 0.5C/bit (mode non-zero) - 0 <= nr <= 3 */ -static u8 LM93_TEMP_AUTO_OFFSET_TO_REG(u8 old, int off, int nr, int mode) -{ - u8 new = LM93_TEMP_OFFSET_TO_REG(off, mode); - - /* temp1-temp2 (nr=0,1) use lower nibble */ - if (nr < 2) - return (old & 0xf0) | (new & 0x0f); - - /* temp3-temp4 (nr=2,3) use upper nibble */ - else - return (new << 4 & 0xf0) | (old & 0x0f); -} - -/* 0 <= nr <= 3 */ -static int LM93_TEMP_AUTO_OFFSET_FROM_REG(u8 reg, int nr, int mode) -{ - /* temp1-temp2 (nr=0,1) use lower nibble */ - if (nr < 2) - return LM93_TEMP_OFFSET_FROM_REG(reg & 0x0f, mode); - - /* temp3-temp4 (nr=2,3) use upper nibble */ - else - return LM93_TEMP_OFFSET_FROM_REG(reg >> 4 & 0x0f, mode); -} - -static void lm93_temp_auto_offsets(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_TEMP1_AUTO_OFFSETS; - int ii; - - if (0 > nr || nr > 2) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - int mode; - lm93_update_client(client); - - /* mode: 0 => 1C/bit, nonzero => 0.5C/bit */ - mode = LM93_TEMP_OFFSET_MODE_FROM_REG(data->sfc2, nr); - - for (ii = 0; ii < 12; ii++) { - results[ii] = LM93_TEMP_AUTO_OFFSET_FROM_REG( - data->block10.offset[ii], nr, mode); - } - *nrels_mag = 12; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - /* we only care about the first 12 values */ - int nrels = *nrels_mag > 12 ? 12 : *nrels_mag; - - down(&data->update_lock); - - /* force 0.5C/bit mode */ - data->sfc2 = lm93_read_byte(client, LM93_REG_SFC2); - data->sfc2 |= ((nr < 2) ? 0x10 : 0x20); - lm93_write_byte(client, LM93_REG_SFC2, data->sfc2); - - for (ii = 0; ii < nrels; ii++) { - data->block10.offset[ii] = LM93_TEMP_AUTO_OFFSET_TO_REG( - data->block10.offset[ii], results[ii], nr, 1); - lm93_write_byte(client, LM93_REG_TEMP_OFFSET(ii), - data->block10.offset[ii]); - } - up(&data->update_lock); - } -} - -/* RPM: (82.5 to 1350000) - REG: 14-bits, LE, *left* justified */ -static u16 LM93_FAN_TO_REG(long rpm) -{ - u16 count, regs; - - if (rpm == 0) { - count = 0x3fff; - } else { - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - count = SENSORS_LIMIT((1350000 + rpm) / rpm, 1, 0x3ffe); - } - - regs = count << 2; - return cpu_to_le16(regs); -} - -static int LM93_FAN_FROM_REG(u16 regs) -{ - const u16 count = le16_to_cpu(regs) >> 2; - return count==0 ? -1 : count==0x3fff ? 0: 1350000 / count; -} - -static void lm93_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_FAN1; - - if (0 > nr || nr > 3) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = LM93_FAN_FROM_REG(data->block8[nr]); /* min */ - results[1] = LM93_FAN_FROM_REG(data->block5[nr]); /* val */ - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - down(&data->update_lock); - data->block8[nr] = LM93_FAN_TO_REG(results[0]); - lm93_write_word(client, LM93_REG_FAN_MIN(nr), - data->block8[nr]); - up(&data->update_lock); - } - } -} - -/* PROCHOT: 0-255, 0 => 0%, 255 => > 96.6% - * REG: (same) */ -static u8 LM93_PROCHOT_TO_REG(long prochot) -{ - prochot = SENSORS_LIMIT(prochot, 0, 255); - return (u8)prochot; -} - -static void lm93_prochot(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_PROCHOT1; - - if (0 > nr || nr > 1) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = data->prochot_max[nr]; - results[1] = data->block4[nr].avg; - results[2] = data->block4[nr].avg; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag >= 1) { - data->prochot_max[nr] = LM93_PROCHOT_TO_REG(results[0]); - lm93_write_byte(client, LM93_REG_PROCHOT_MAX(nr), - data->prochot_max[nr]); - } - up(&data->update_lock); - } -} - -/* PROCHOT-OVERRIDE; 0-15, 0 is 6.25%, 15 is 99.88% - * REG: (same) */ -static u8 LM93_PROCHOT_OVERRIDE_TO_REG(int force1, int force2, long prochot) -{ - u8 result = 0; - - result |= force1 ? 0x80 : 0x00; - result |= force2 ? 0x40 : 0x00; - prochot = SENSORS_LIMIT(prochot, 0, 15); - result |= prochot; - return result; -} - -static void lm93_prochot_override(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - - if (ctl_name != LM93_SYSCTL_PROCHOT_OVERRIDE) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = (data->prochot_override & 0x80) ? 1 : 0; - results[1] = (data->prochot_override & 0x40) ? 1 : 0; - results[2] = data->prochot_override & 0x0f; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - - /* grab old values */ - int force2 = (data->prochot_override & 0x40) ? 1 : 0; - int prochot = data->prochot_override & 0x0f; - - down(&data->update_lock); - if (*nrels_mag >= 3) { - data->prochot_override = LM93_PROCHOT_OVERRIDE_TO_REG( - results[0], results[1], results[2]); - } - if (*nrels_mag == 2) { - data->prochot_override = LM93_PROCHOT_OVERRIDE_TO_REG( - results[0], results[1], prochot); - } - if (*nrels_mag == 1) { - data->prochot_override = LM93_PROCHOT_OVERRIDE_TO_REG( - results[0], force2, prochot); - } - if (*nrels_mag >= 1) { - lm93_write_byte(client, LM93_REG_PROCHOT_OVERRIDE, - data->prochot_override); - } - up(&data->update_lock); - } -} - -/* PROCHOT-INTERVAL: 73 - 37200 (1/100 seconds) - * REG: 0-9 as mapped below */ -static int lm93_interval_map[10] = { - 73, 146, 290, 580, 1170, 2330, 4660, 9320, 18600, 37200, -}; - -static int LM93_INTERVAL_FROM_REG(u8 reg) -{ - return lm93_interval_map[reg & 0x0f]; -} - -/* round up to nearest match */ -static u8 LM93_INTERVAL_TO_REG(long interval) -{ - int i; - for (i = 0; i < 9; i++) - if (interval <= lm93_interval_map[i]) - break; - - /* can fall through with i==9 */ - return (u8)i; -} - -static void lm93_prochot_interval(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - - if (ctl_name != LM93_SYSCTL_PROCHOT_INTERVAL) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = LM93_INTERVAL_FROM_REG( - data->prochot_interval & 0x0f); - results[1] = LM93_INTERVAL_FROM_REG( - (data->prochot_interval & 0xf0) >> 4); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - data->prochot_interval = lm93_read_byte(client, - LM93_REG_PROCHOT_INTERVAL); - if (*nrels_mag >= 2) { - data->prochot_interval = - (LM93_INTERVAL_TO_REG(results[1]) << 4) | - (data->prochot_interval & 0x0f); - } - if (*nrels_mag >= 1) { - data->prochot_interval = - (data->prochot_interval & 0xf0) | - LM93_INTERVAL_TO_REG(results[0]); - lm93_write_byte(client, LM93_REG_PROCHOT_INTERVAL, - data->prochot_interval); - } - up(&data->update_lock); - } -} - -/* PWM: 0-255 per sensors documentation - REG: 0-13 as mapped below... right justified */ -typedef enum { LM93_PWM_MAP_HI_FREQ, LM93_PWM_MAP_LO_FREQ } pwm_freq_t; -static int lm93_pwm_map[2][14] = { - { - 0x00, /* 0.00% */ 0x40, /* 25.00% */ - 0x50, /* 31.25% */ 0x60, /* 37.50% */ - 0x70, /* 43.75% */ 0x80, /* 50.00% */ - 0x90, /* 56.25% */ 0xa0, /* 62.50% */ - 0xb0, /* 68.75% */ 0xc0, /* 75.00% */ - 0xd0, /* 81.25% */ 0xe0, /* 87.50% */ - 0xf0, /* 93.75% */ 0xff, /* 100.00% */ - }, - { - 0x00, /* 0.00% */ 0x40, /* 25.00% */ - 0x49, /* 28.57% */ 0x52, /* 32.14% */ - 0x5b, /* 35.71% */ 0x64, /* 39.29% */ - 0x6d, /* 42.86% */ 0x76, /* 46.43% */ - 0x80, /* 50.00% */ 0x89, /* 53.57% */ - 0x92, /* 57.14% */ 0xb6, /* 71.43% */ - 0xdb, /* 85.71% */ 0xff, /* 100.00% */ - }, -}; - -static int LM93_PWM_FROM_REG(u8 reg, pwm_freq_t freq) -{ - return lm93_pwm_map[freq][reg & 0x0f]; -} - -/* round up to nearest match */ -static u8 LM93_PWM_TO_REG(int pwm, pwm_freq_t freq) -{ - int i; - for (i = 0; i < 13; i++) - if (pwm <= lm93_pwm_map[freq][i]) - break; - - /* can fall through with i==13 */ - return (u8)i; -} - -static void lm93_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_PWM1; - u8 ctl2, ctl4; - - if (0 > nr || nr > 1) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - ctl2 = data->block9[nr][LM93_PWM_CTL2]; - ctl4 = data->block9[nr][LM93_PWM_CTL4]; - results[1] = (ctl2 & 0x01) ? 1 : 0; - ctl2 = ctl2 >> 4 & 0x0f; - if (results[1]) /* show user commanded value if enabled */ - results[0] = data->pwm_override[nr]; - else /* show present h/w value if manual pwm disabled */ - results[0] = LM93_PWM_FROM_REG(ctl2, (ctl4 & 0x07) ? - LM93_PWM_MAP_LO_FREQ : LM93_PWM_MAP_HI_FREQ); - *nrels_mag = 2; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - down(&data->update_lock); - ctl2 = lm93_read_byte( - client, LM93_REG_PWM_CTL(nr,LM93_PWM_CTL2)); - ctl4 = lm93_read_byte( - client, LM93_REG_PWM_CTL(nr,LM93_PWM_CTL4)); - ctl2 = (ctl2 & 0x0f) | - LM93_PWM_TO_REG(results[0], (ctl4 & 0x07) ? - LM93_PWM_MAP_LO_FREQ : - LM93_PWM_MAP_HI_FREQ) << 4; - if (*nrels_mag >= 2) { - if (results[1]) - ctl2 |= 0x01; - else - ctl2 &= ~0x01; - } - /* save user commanded value */ - data->pwm_override[nr] = - LM93_PWM_FROM_REG(ctl2 >> 4 & 0x0f, - (ctl4 & 0x07) ? LM93_PWM_MAP_LO_FREQ : - LM93_PWM_MAP_HI_FREQ); - lm93_write_byte(client, - LM93_REG_PWM_CTL(nr,LM93_PWM_CTL2), ctl2); - up(&data->update_lock); - } - } -} - -/* PWM FREQ: HZ - REG: 0-7 as mapped below */ -static int lm93_pwm_freq_map[8] = { - 22500, 96, 84, 72, 60, 48, 36, 12 -}; - -static int LM93_PWM_FREQ_FROM_REG(u8 reg) -{ - return lm93_pwm_freq_map[reg & 0x07]; -} - -/* round up to nearest match */ -static u8 LM93_PWM_FREQ_TO_REG(int freq) -{ - int i; - for (i = 7; i > 0; i--) - if (freq <= lm93_pwm_freq_map[i]) - break; - - /* can fall through with i==0 */ - return (u8)i; -} - -/* helper function - must grab data->update_lock before calling - fan is 0-3, indicating fan1-fan4 */ -static void lm93_write_fan_smart_tach(struct i2c_client *client, - struct lm93_data *data, int fan, long value) -{ - /* insert the new mapping and write it out */ - data->sf_tach_to_pwm = lm93_read_byte(client, LM93_REG_SF_TACH_TO_PWM); - data->sf_tach_to_pwm &= ~(0x3 << fan * 2); - data->sf_tach_to_pwm |= value << fan * 2; - lm93_write_byte(client, LM93_REG_SF_TACH_TO_PWM, data->sf_tach_to_pwm); - - /* insert the enable bit and write it out */ - data->sfc2 = lm93_read_byte(client, LM93_REG_SFC2); - if (value) - data->sfc2 |= 1 << fan; - else - data->sfc2 &= ~(1 << fan); - lm93_write_byte(client, LM93_REG_SFC2, data->sfc2); -} - -/* helper function - must grab data->update_lock before calling - pwm is 0-1, indicating pwm1-pwm2 - this disables smart tach for all tach channels bound to the given pwm */ -static void lm93_disable_fan_smart_tach(struct i2c_client *client, - struct lm93_data *data, int pwm) -{ - int mapping = lm93_read_byte(client, LM93_REG_SF_TACH_TO_PWM); - int mask; - - /* collapse the mapping into a mask of enable bits */ - mapping = (mapping >> pwm) & 0x55; - mask = mapping & 0x01; - mask |= (mapping & 0x04) >> 1; - mask |= (mapping & 0x10) >> 2; - mask |= (mapping & 0x40) >> 3; - - /* disable smart tach according to the mask */ - data->sfc2 = lm93_read_byte(client, LM93_REG_SFC2); - data->sfc2 &= ~mask; - lm93_write_byte(client, LM93_REG_SFC2, data->sfc2); -} - -static void lm93_pwm_freq(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_PWM1_FREQ; - u8 ctl4; - - if (0 > nr || nr > 1) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - ctl4 = data->block9[nr][LM93_PWM_CTL4]; - results[0] = LM93_PWM_FREQ_FROM_REG(ctl4); - *nrels_mag = 1; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - down(&data->update_lock); - ctl4 = lm93_read_byte( client, - LM93_REG_PWM_CTL(nr,LM93_PWM_CTL4)); - ctl4 = (ctl4 & 0xf8) | LM93_PWM_FREQ_TO_REG(results[0]); - data->block9[nr][LM93_PWM_CTL4] = ctl4; - - /* ctl4 == 0 -> 22.5KHz -> disable smart tach */ - if (!ctl4) - lm93_disable_fan_smart_tach(client, data, nr); - - lm93_write_byte(client, - LM93_REG_PWM_CTL(nr,LM93_PWM_CTL4), ctl4); - up(&data->update_lock); - } - } -} - -/* GPIO: 0-255, GPIO0 is LSB - * REG: inverted */ -static unsigned LM93_GPI_FROM_REG(u8 reg) -{ - return ~reg & 0xff; -} - -static void lm93_gpio(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - - if (ctl_name != LM93_SYSCTL_GPIO) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = LM93_GPI_FROM_REG(data->gpi); - *nrels_mag = 1; - } -} - -static void lm93_temp_auto_base(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_TEMP1_AUTO_BASE; - - if (0 > nr || nr > 2) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = LM93_TEMP_FROM_REG(data->block10.base[nr]); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag >= 1) { - data->block10.base[nr] = LM93_TEMP_TO_REG(results[0]); - lm93_write_byte(client, LM93_REG_TEMP_BASE(nr), - data->block10.base[nr]); - } - up(&data->update_lock); - } -} - -static void lm93_temp_auto_boost(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_TEMP1_AUTO_BOOST; - - if (0 > nr || nr > 2) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = LM93_TEMP_FROM_REG(data->boost[nr]); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag >= 1) { - data->boost[nr] = LM93_TEMP_TO_REG(results[0]); - lm93_write_byte(client, LM93_REG_BOOST(nr), - data->boost[nr]); - } - up(&data->update_lock); - } - -} - -static u8 LM93_AUTO_BOOST_HYST_TO_REG(struct lm93_data *data, long hyst, - int nr, int mode) -{ - u8 reg = LM93_TEMP_OFFSET_TO_REG( - (LM93_TEMP_FROM_REG(data->boost[nr]) - hyst), mode); - - switch (nr) { - case 0: - reg = (data->boost_hyst[0] & 0xf0) | (reg & 0x0f); - break; - case 1: - reg = (reg << 4 & 0xf0) | (data->boost_hyst[0] & 0x0f); - break; - case 2: - reg = (data->boost_hyst[1] & 0xf0) | (reg & 0x0f); - break; - case 3: - default: - reg = (reg << 4 & 0xf0) | (data->boost_hyst[1] & 0x0f); - break; - } - - return reg; -} - -static int LM93_AUTO_BOOST_HYST_FROM_REGS(struct lm93_data *data, int nr, - int mode) -{ - u8 reg; - - switch (nr) { - case 0: - reg = data->boost_hyst[0] & 0x0f; - break; - case 1: - reg = data->boost_hyst[0] >> 4 & 0x0f; - break; - case 2: - reg = data->boost_hyst[1] & 0x0f; - break; - case 3: - default: - reg = data->boost_hyst[1] >> 4 & 0x0f; - break; - } - - return LM93_TEMP_FROM_REG(data->boost[nr]) - - LM93_TEMP_OFFSET_FROM_REG(reg, mode); -} - -static void lm93_temp_auto_boost_hyst(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_TEMP1_AUTO_BOOST_HYST; - - if (0 > nr || nr > 2) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - int mode; - lm93_update_client(client); - - /* mode: 0 => 1C/bit, nonzero => 0.5C/bit */ - mode = LM93_TEMP_OFFSET_MODE_FROM_REG(data->sfc2, nr); - - results[0] = LM93_AUTO_BOOST_HYST_FROM_REGS(data, nr, mode); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - down(&data->update_lock); - - /* force 0.5C/bit mode */ - data->sfc2 = lm93_read_byte(client, LM93_REG_SFC2); - data->sfc2 |= ((nr < 2) ? 0x10 : 0x20); - lm93_write_byte(client, LM93_REG_SFC2, data->sfc2); - - data->boost_hyst[nr/2] = - LM93_AUTO_BOOST_HYST_TO_REG(data, - results[0], nr, 1); - lm93_write_byte(client, LM93_REG_BOOST_HYST(nr), - data->boost_hyst[nr/2]); - up(&data->update_lock); - } - } -} - -static void lm93_temp_auto_pwm_min(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_TEMP1_AUTO_PWM_MIN; - u8 reg, ctl4; - - if (0 > nr || nr > 2) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - reg = data->auto_pwm_min_hyst[nr/2] >> 4 & 0x0f; - ctl4 = data->block9[nr][LM93_PWM_CTL4]; - results[0] = LM93_PWM_FROM_REG(reg, (ctl4 & 0x07) ? - LM93_PWM_MAP_LO_FREQ : LM93_PWM_MAP_HI_FREQ); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - down(&data->update_lock); - reg = lm93_read_byte(client, LM93_REG_PWM_MIN_HYST(nr)); - ctl4 = lm93_read_byte( - client, LM93_REG_PWM_CTL(nr,LM93_PWM_CTL4)); - reg = (reg & 0x0f) | - LM93_PWM_TO_REG(results[0], (ctl4 & 0x07) ? - LM93_PWM_MAP_LO_FREQ : - LM93_PWM_MAP_HI_FREQ) << 4; - - data->auto_pwm_min_hyst[nr/2] = reg; - lm93_write_byte(client, LM93_REG_PWM_MIN_HYST(nr), reg); - up(&data->update_lock); - } - } -} - -static void lm93_temp_auto_offset_hyst(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_TEMP1_AUTO_OFFSET_HYST; - - if (0 > nr || nr > 2) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - int mode; - lm93_update_client(client); - - /* mode: 0 => 1C/bit, nonzero => 0.5C/bit */ - mode = LM93_TEMP_OFFSET_MODE_FROM_REG(data->sfc2, nr); - - results[0] = LM93_TEMP_OFFSET_FROM_REG( - data->auto_pwm_min_hyst[nr/2], mode); - - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - u8 reg; - down(&data->update_lock); - - /* force 0.5C/bit mode */ - data->sfc2 = lm93_read_byte(client, LM93_REG_SFC2); - data->sfc2 |= ((nr < 2) ? 0x10 : 0x20); - lm93_write_byte(client, LM93_REG_SFC2, data->sfc2); - - reg = data->auto_pwm_min_hyst[nr/2]; - reg = (reg & 0xf0) | - (LM93_TEMP_OFFSET_TO_REG(results[0], 1) & 0x0f); - - data->auto_pwm_min_hyst[nr/2] = reg; - lm93_write_byte(client, LM93_REG_PWM_MIN_HYST(nr), reg); - up(&data->update_lock); - } - } -} - -/* some tedious bit-twiddling here to deal with the register format: - - data->sf_tach_to_pwm: (tach to pwm mapping bits) - - bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 - T4:P2 T4:P1 T3:P2 T3:P1 T2:P2 T2:P1 T1:P2 T1:P1 - - data->sfc2: (enable bits) - - bit | 3 | 2 | 1 | 0 - T4 T3 T2 T1 -*/ - -static void lm93_fan_smart_tach(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_FAN1_SMART_TACH; - - if (0 > nr || nr > 3) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - int mapping; - - lm93_update_client(client); - - /* extract the relevant mapping */ - mapping = (data->sf_tach_to_pwm >> (nr * 2)) & 0x03; - - /* if there's a mapping and it's enabled */ - if (mapping && ((data->sfc2 >> nr) & 0x01)) - results[0] = mapping; - else - results[0] = 0; - - *nrels_mag = 1; - - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - down(&data->update_lock); - - /* sanity test, ignore the write otherwise */ - if (0 <= results[0] && results[0] <= 2) { - - /* can't enable if pwm freq is 22.5KHz */ - if (results[0]) { - u8 ctl4 = lm93_read_byte(client, - LM93_REG_PWM_CTL(results[0]-1, - LM93_PWM_CTL4)); - if ((ctl4 & 0x07) == 0) - results[0] = 0; - } - - lm93_write_fan_smart_tach(client, data, nr, - results[0]); - } - up(&data->update_lock); - } - } -} - -static void lm93_prochot_short(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - - if (ctl_name != LM93_SYSCTL_PROCHOT_SHORT) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = (data->config & 0x10) ? 1 : 0; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - down(&data->update_lock); - if (*nrels_mag >= 1) { - if (results[0]) - data->config |= 0x10; - else - data->config &= ~0x10; - lm93_write_byte(client, LM93_REG_CONFIG, data->config); - } - up(&data->update_lock); - } -} - -static void lm93_vrdhot(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_VRDHOT1; - - if (0 > nr || nr > 1) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = data->block1.host_status_1 & (1 << (nr+4)) ? 1 : 0; - *nrels_mag = 1; - } -} - -static void lm93_pwm_auto_chan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_PWM1_AUTO_CHANNELS; - - if (0 > nr || nr > 1) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = data->block9[nr][LM93_PWM_CTL1]; - *nrels_mag = 1; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - down(&data->update_lock); - data->block9[nr][LM93_PWM_CTL1] = - SENSORS_LIMIT(results[0], 0, 255); - lm93_write_byte(client, - LM93_REG_PWM_CTL(nr,LM93_PWM_CTL1), - data->block9[nr][LM93_PWM_CTL1]); - up(&data->update_lock); - } - } -} - -static void lm93_pwm_auto_spinup_min(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_PWM1_AUTO_SPINUP_MIN; - u8 ctl3, ctl4; - - if (0 > nr || nr > 1) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - ctl3 = data->block9[nr][LM93_PWM_CTL3]; - ctl4 = data->block9[nr][LM93_PWM_CTL4]; - results[0] = LM93_PWM_FROM_REG(ctl3 & 0x0f, (ctl4 & 0x07) ? - LM93_PWM_MAP_LO_FREQ : LM93_PWM_MAP_HI_FREQ); - *nrels_mag = 1; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - down(&data->update_lock); - ctl3 = lm93_read_byte(client, - LM93_REG_PWM_CTL(nr, LM93_PWM_CTL3)); - ctl4 = lm93_read_byte(client, - LM93_REG_PWM_CTL(nr, LM93_PWM_CTL4)); - ctl3 = (ctl3 & 0xf0) | - LM93_PWM_TO_REG(results[0], (ctl4 & 0x07) ? - LM93_PWM_MAP_LO_FREQ : - LM93_PWM_MAP_HI_FREQ); - data->block9[nr][LM93_PWM_CTL3] = ctl3; - lm93_write_byte(client, - LM93_REG_PWM_CTL(nr, LM93_PWM_CTL3), ctl3); - up(&data->update_lock); - } - } -} - -/* TIME: 1/100 seconds - * REG: 0-7 as mapped below */ -static int lm93_spinup_time_map[8] = { - 0, 10, 25, 40, 70, 100, 200, 400, -}; - -static int LM93_SPINUP_TIME_FROM_REG(u8 reg) -{ - return lm93_spinup_time_map[reg >> 5 & 0x07]; -} - -/* round up to nearest match */ -static u8 LM93_SPINUP_TIME_TO_REG(int time) -{ - int i; - for (i = 0; i < 7; i++) - if (time <= lm93_spinup_time_map[i]) - break; - - /* can fall through with i==8 */ - return (u8)i; -} - -static void lm93_pwm_auto_spinup_time(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - int nr = ctl_name - LM93_SYSCTL_PWM1_AUTO_SPINUP_TIME; - - if (0 > nr || nr > 1) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - results[0] = LM93_SPINUP_TIME_FROM_REG( - data->block9[nr][LM93_PWM_CTL3]); - *nrels_mag = 1; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - u8 ctl3; - down(&data->update_lock); - ctl3 = lm93_read_byte(client, - LM93_REG_PWM_CTL(nr, LM93_PWM_CTL3)); - ctl3 = (ctl3 & 0x1f) | (LM93_SPINUP_TIME_TO_REG( - results[0]) << 5 & 0xe0); - data->block9[nr][LM93_PWM_CTL3] = ctl3; - lm93_write_byte(client, - LM93_REG_PWM_CTL(nr, LM93_PWM_CTL3), ctl3); - up(&data->update_lock); - } - } -} - -#define LM93_RAMP_MIN 0 -#define LM93_RAMP_MAX 75 - -/* RAMP: 1/100 seconds - REG: 50mS/bit 4-bits right justified */ -static u8 LM93_RAMP_TO_REG(int ramp) -{ - ramp = SENSORS_LIMIT(ramp, LM93_RAMP_MIN, LM93_RAMP_MAX); - return (u8)((ramp + 2) / 5); -} - -static int LM93_RAMP_FROM_REG(u8 reg) -{ - return (reg & 0x0f) * 5; -} - -static void lm93_pwm_auto_ramp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct lm93_data *data = client->data; - - if (!(ctl_name == LM93_SYSCTL_PWM_AUTO_PROCHOT_RAMP || - ctl_name == LM93_SYSCTL_PWM_AUTO_VRDHOT_RAMP)) - return; /* ERROR */ - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - lm93_update_client(client); - if (ctl_name == LM93_SYSCTL_PWM_AUTO_PROCHOT_RAMP) - results[0] = LM93_RAMP_FROM_REG( - data->pwm_ramp_ctl >> 4 & 0x0f); - else - results[0] = LM93_RAMP_FROM_REG( - data->pwm_ramp_ctl & 0x0f); - *nrels_mag = 1; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - u8 ramp; - down(&data->update_lock); - ramp = lm93_read_byte(client, LM93_REG_PWM_RAMP_CTL); - if (ctl_name == LM93_SYSCTL_PWM_AUTO_PROCHOT_RAMP) - ramp = (ramp & 0x0f) | (LM93_RAMP_TO_REG( - results[0]) << 4 & 0xf0); - else - ramp = (ramp & 0xf0) | (LM93_RAMP_TO_REG( - results[0]) & 0x0f); - lm93_write_byte(client, LM93_REG_PWM_RAMP_CTL, ramp); - up(&data->update_lock); - } - } -} - -/* These files are created for each detected LM93. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ - -#define LM93_SYSCTL_IN(nr) {LM93_SYSCTL_IN##nr, "in" #nr, NULL, 0, \ - 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_in} -#define LM93_SYSCTL_TEMP(nr) {LM93_SYSCTL_TEMP##nr, "temp" #nr, NULL, 0, \ - 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_temp} -#define LM93_SYSCTL_TEMP_AUTO_BASE(nr) {LM93_SYSCTL_TEMP##nr##_AUTO_BASE, \ - "temp" #nr "_auto_base", NULL, 0, 0644, NULL, &i2c_proc_real, \ - &i2c_sysctl_real, NULL, &lm93_temp_auto_base} -#define LM93_SYSCTL_TEMP_AUTO_OFFSETS(nr) {LM93_SYSCTL_TEMP##nr##_AUTO_OFFSETS,\ - "temp" #nr "_auto_offsets", NULL, 0, 0644, NULL, &i2c_proc_real, \ - &i2c_sysctl_real, NULL, &lm93_temp_auto_offsets} -#define LM93_SYSCTL_TEMP_AUTO_BOOST(nr) { LM93_SYSCTL_TEMP##nr##_AUTO_BOOST, \ - "temp" #nr "_auto_boost", NULL, 0, 0644, NULL, &i2c_proc_real, \ - &i2c_sysctl_real, NULL, &lm93_temp_auto_boost} -#define LM93_SYSCTL_TEMP_AUTO_BOOST_HYST(nr) { \ - LM93_SYSCTL_TEMP##nr##_AUTO_BOOST_HYST, "temp" #nr "_auto_boost_hyst", \ - NULL, 0, 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, \ - &lm93_temp_auto_boost_hyst} -#define LM93_SYSCTL_TEMP_AUTO_PWM_MIN(nr) { \ - LM93_SYSCTL_TEMP##nr##_AUTO_PWM_MIN, "temp" #nr "_auto_pwm_min", \ - NULL, 0, 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, \ - &lm93_temp_auto_pwm_min} -#define LM93_SYSCTL_TEMP_AUTO_OFFSET_HYST(nr) { \ - LM93_SYSCTL_TEMP##nr##_AUTO_OFFSET_HYST,"temp" #nr "_auto_offset_hyst",\ - NULL, 0, 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, \ - &lm93_temp_auto_offset_hyst} -#define LM93_SYSCTL_PWM(nr) {LM93_SYSCTL_PWM##nr, "pwm" #nr, NULL, 0, \ - 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_pwm} -#define LM93_SYSCTL_PWM_FREQ(nr) {LM93_SYSCTL_PWM##nr##_FREQ, \ - "pwm" #nr "_freq", NULL, 0, 0644, NULL, &i2c_proc_real, \ - &i2c_sysctl_real, NULL, &lm93_pwm_freq} -#define LM93_SYSCTL_PWM_AUTO_CHAN(nr) {LM93_SYSCTL_PWM##nr##_AUTO_CHANNELS, \ - "pwm" #nr "_auto_channels", NULL, 0, 0644, NULL, &i2c_proc_real, \ - &i2c_sysctl_real, NULL, &lm93_pwm_auto_chan} -#define LM93_SYSCTL_PWM_AUTO_SPINUP_MIN(nr) { \ - LM93_SYSCTL_PWM##nr##_AUTO_SPINUP_MIN, "pwm" #nr "_auto_spinup_min", \ - NULL, 0, 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, \ - &lm93_pwm_auto_spinup_min} -#define LM93_SYSCTL_PWM_AUTO_SPINUP_TIME(nr) { \ - LM93_SYSCTL_PWM##nr##_AUTO_SPINUP_TIME, "pwm" #nr "_auto_spinup_time", \ - NULL, 0, 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, \ - &lm93_pwm_auto_spinup_time} -#define LM93_SYSCTL_FAN(nr) {LM93_SYSCTL_FAN##nr, "fan" #nr, NULL, 0, \ - 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_fan} -#define LM93_SYSCTL_VID(nr) {LM93_SYSCTL_VID##nr, "vid" #nr, NULL, 0, \ - 0444, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_vid} -#define LM93_SYSCTL_PROCHOT(nr) {LM93_SYSCTL_PROCHOT##nr, "prochot" #nr, NULL, \ - 0, 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_prochot} -#define LM93_SYSCTL_VRDHOT(nr) {LM93_SYSCTL_VRDHOT##nr, "vrdhot" #nr, NULL, \ - 0, 0444, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_vrdhot} -#define LM93_SYSCTL_FAN_SMART_TACH(nr) {LM93_SYSCTL_FAN##nr##_SMART_TACH, \ - "fan" #nr "_smart_tach", NULL, 0, 0644, NULL, &i2c_proc_real, \ - &i2c_sysctl_real, NULL, &lm93_fan_smart_tach} -static ctl_table lm93_dir_table_template[] = { - LM93_SYSCTL_IN(1), - LM93_SYSCTL_IN(2), - LM93_SYSCTL_IN(3), - LM93_SYSCTL_IN(4), - LM93_SYSCTL_IN(5), - LM93_SYSCTL_IN(6), - LM93_SYSCTL_IN(7), - LM93_SYSCTL_IN(8), - LM93_SYSCTL_IN(9), - LM93_SYSCTL_IN(10), - LM93_SYSCTL_IN(11), - LM93_SYSCTL_IN(12), - LM93_SYSCTL_IN(13), - LM93_SYSCTL_IN(14), - LM93_SYSCTL_IN(15), - LM93_SYSCTL_IN(16), - - LM93_SYSCTL_TEMP(1), - LM93_SYSCTL_TEMP(2), - LM93_SYSCTL_TEMP(3), - - LM93_SYSCTL_TEMP_AUTO_BASE(1), - LM93_SYSCTL_TEMP_AUTO_BASE(2), - LM93_SYSCTL_TEMP_AUTO_BASE(3), - - LM93_SYSCTL_TEMP_AUTO_OFFSETS(1), - LM93_SYSCTL_TEMP_AUTO_OFFSETS(2), - LM93_SYSCTL_TEMP_AUTO_OFFSETS(3), - - LM93_SYSCTL_TEMP_AUTO_BOOST(1), - LM93_SYSCTL_TEMP_AUTO_BOOST(2), - LM93_SYSCTL_TEMP_AUTO_BOOST(3), - - LM93_SYSCTL_TEMP_AUTO_BOOST_HYST(1), - LM93_SYSCTL_TEMP_AUTO_BOOST_HYST(2), - LM93_SYSCTL_TEMP_AUTO_BOOST_HYST(3), - - LM93_SYSCTL_TEMP_AUTO_PWM_MIN(1), - LM93_SYSCTL_TEMP_AUTO_PWM_MIN(2), - LM93_SYSCTL_TEMP_AUTO_PWM_MIN(3), - - LM93_SYSCTL_TEMP_AUTO_OFFSET_HYST(1), - LM93_SYSCTL_TEMP_AUTO_OFFSET_HYST(2), - LM93_SYSCTL_TEMP_AUTO_OFFSET_HYST(3), - - LM93_SYSCTL_FAN(1), - LM93_SYSCTL_FAN(2), - LM93_SYSCTL_FAN(3), - LM93_SYSCTL_FAN(4), - - LM93_SYSCTL_FAN_SMART_TACH(1), - LM93_SYSCTL_FAN_SMART_TACH(2), - LM93_SYSCTL_FAN_SMART_TACH(3), - LM93_SYSCTL_FAN_SMART_TACH(4), - - LM93_SYSCTL_PWM(1), - LM93_SYSCTL_PWM(2), - - LM93_SYSCTL_PWM_FREQ(1), - LM93_SYSCTL_PWM_FREQ(2), - - LM93_SYSCTL_PWM_AUTO_CHAN(1), - LM93_SYSCTL_PWM_AUTO_CHAN(2), - - LM93_SYSCTL_PWM_AUTO_SPINUP_MIN(1), - LM93_SYSCTL_PWM_AUTO_SPINUP_MIN(2), - - LM93_SYSCTL_PWM_AUTO_SPINUP_TIME(1), - LM93_SYSCTL_PWM_AUTO_SPINUP_TIME(2), - - {LM93_SYSCTL_PWM_AUTO_PROCHOT_RAMP, "pwm_auto_prochot_ramp", NULL, 0, - 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, - &lm93_pwm_auto_ramp}, - - {LM93_SYSCTL_PWM_AUTO_VRDHOT_RAMP, "pwm_auto_vrdhot_ramp", NULL, 0, - 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, - &lm93_pwm_auto_ramp}, - - LM93_SYSCTL_VID(1), - LM93_SYSCTL_VID(2), - - LM93_SYSCTL_PROCHOT(1), - LM93_SYSCTL_PROCHOT(2), - - {LM93_SYSCTL_PROCHOT_SHORT, "prochot_short", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_prochot_short}, - - {LM93_SYSCTL_PROCHOT_OVERRIDE, "prochot_override", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_prochot_override}, - - {LM93_SYSCTL_PROCHOT_INTERVAL, "prochot_interval", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_prochot_interval}, - - LM93_SYSCTL_VRDHOT(1), - LM93_SYSCTL_VRDHOT(2), - - {LM93_SYSCTL_GPIO, "gpio", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &lm93_gpio}, - - {LM93_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &lm93_alarms}, - - {0} -}; - -static void lm93_init_client(struct i2c_client *client) -{ - int i; - u8 reg; - - /* configure VID pin input thresholds */ - reg = lm93_read_byte(client, LM93_REG_GPI_VID_CTL); - lm93_write_byte(client, LM93_REG_GPI_VID_CTL, - reg | (vid_agtl ? 0x03 : 0x00)); - - if (init) { - /* enable #ALERT pin */ - reg = lm93_read_byte(client, LM93_REG_CONFIG); - lm93_write_byte(client, LM93_REG_CONFIG, reg | 0x08); - - /* enable ASF mode for BMC status registers */ - reg = lm93_read_byte(client, LM93_REG_STATUS_CONTROL); - lm93_write_byte(client, LM93_REG_STATUS_CONTROL, reg | 0x02); - - /* set sleep state to S0 */ - lm93_write_byte(client, LM93_REG_SLEEP_CONTROL, 0); - - /* unmask #VRDHOT and dynamic VCCP (if nec) error events */ - reg = lm93_read_byte(client, LM93_REG_MISC_ERR_MASK); - reg &= ~0x03; - reg &= ~(vccp_limit_type[0] ? 0x10 : 0); - reg &= ~(vccp_limit_type[1] ? 0x20 : 0); - lm93_write_byte(client, LM93_REG_MISC_ERR_MASK, reg); - } - - /* start monitoring */ - reg = lm93_read_byte(client, LM93_REG_CONFIG); - lm93_write_byte(client, LM93_REG_CONFIG, reg | 0x01); - - /* spin until ready */ - for (i=0; i<20; i++) { - mdelay(10); - if ((lm93_read_byte(client, LM93_REG_CONFIG) & 0x80) == 0x80) - return; - } - - printk(KERN_WARNING "lm93.o: timed out waiting for sensor " - "chip to signal ready!\n"); -} - -/* forward declaration */ -static struct i2c_driver lm93_driver; - -/* This function is called by i2c_detect */ -static int lm93_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int err = 0, func; - struct lm93_data *data; - struct i2c_client *client; - void (*update)(struct lm93_data *, struct i2c_client *); - - /* lm93 is SMBus only */ - if (i2c_is_isa_adapter(adapter)) { - pr_debug("lm93.o: detect failed, " - "cannot attach to legacy adapter!\n"); - goto ERROR0; - } - - /* choose update routine based on bus capabilities */ - func = i2c_get_functionality(adapter); - - if ( ((LM93_SMBUS_FUNC_FULL & func) == LM93_SMBUS_FUNC_FULL) && - (!disable_block) ) { - pr_debug("lm93.o: using SMBus block data transactions\n"); - update = lm93_update_client_full; - } else if ((LM93_SMBUS_FUNC_MIN & func) == LM93_SMBUS_FUNC_MIN) { - pr_debug("lm93.o: disabled SMBus block data transactions\n"); - update = lm93_update_client_min; - } else { - pr_debug("lm93.o: detect failed, " - "smbus byte and/or word data not supported!\n"); - goto ERROR0; - } - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access lm78_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct lm93_data), GFP_KERNEL))) { - pr_debug("lm93.o: detect failed, kmalloc failed!\n"); - err = -ENOMEM; - goto ERROR0; - } - - client = &data->client; - client->addr = address; - client->data = data; - client->adapter = adapter; - client->driver = &lm93_driver; - client->flags = 0; - - /* detection */ - if (kind < 0) { - int mfr = lm93_read_byte(client, LM93_REG_MFR_ID); - - if (mfr != 0x01) { - pr_debug("lm93.o: detect failed, " - "bad manufacturer id 0x%02x!\n", mfr); - goto ERROR1; - } - } - - if (kind <= 0) { - int ver = lm93_read_byte(client, LM93_REG_VER); - - if ((ver == LM93_MFR_ID) || (ver == LM93_MFR_ID_PROTOTYPE)) { - kind = lm93; - } else { - pr_debug("lm93.o: detect failed, " - "bad version id 0x%02x!\n", ver); - if (kind == 0) - pr_debug("lm93.o: " - "(ignored 'force' parameter)\n"); - goto ERROR1; - } - } - - /* fill in remaining client fields */ - strcpy(client->name, "LM93 chip"); - client->id = lm93_id++; - pr_debug("lm93.o: assigning ID %d to %s at %d,0x%02x\n", client->id, - client->name, i2c_adapter_id(client->adapter), client->addr); - - /* housekeeping */ - data->valid = 0; - data->update = update; - init_MUTEX(&data->update_lock); - - /* tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(client))) - goto ERROR1; - - /* initialize the chip */ - lm93_init_client(client); - - /* register a new directory entry with module sensors */ - if ((data->sysctl_id = i2c_register_entry(client, "lm93", - lm93_dir_table_template, THIS_MODULE)) < 0) { - err = data->sysctl_id; - goto ERROR2; - } - - return 0; - -ERROR2: - i2c_detach_client(client); -ERROR1: - kfree(data); -ERROR0: - return err; -} - -/* This function is called when: - * lm93_driver is inserted (when this module is loaded), for each - available adapter - * when a new adapter is inserted (and lm93_driver is still present) */ -static int lm93_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, lm93_detect); -} - -static int lm93_detach_client(struct i2c_client *client) -{ - int err; - struct lm93_data *data = client->data; - - i2c_deregister_entry(data->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk (KERN_ERR "lm93.o: Client deregistration failed; " - "client not detached.\n"); - return err; - } - kfree(data); - return 0; -} - -static struct i2c_driver lm93_driver = { - .name = "LM93 sensor driver", - .id = I2C_DRIVERID_LM93, - .flags = I2C_DF_NOTIFY, - .attach_adapter = lm93_attach_adapter, - .detach_client = lm93_detach_client, -}; - -static int __init lm93_init(void) -{ - printk(KERN_INFO "lm93.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&lm93_driver); -} - -static void __exit lm93_exit(void) -{ - i2c_del_driver(&lm93_driver); -} - -MODULE_AUTHOR("Mark M. Hoffman "); -MODULE_DESCRIPTION("LM93 driver"); -MODULE_LICENSE("GPL"); - -module_init(lm93_init); -module_exit(lm93_exit); diff --git a/kernel/chips/lm93.h b/kernel/chips/lm93.h deleted file mode 100644 index c61a4c81..00000000 --- a/kernel/chips/lm93.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - lm93.h - Part of lm_sensors, Linux kernel modules for hardware monitoring - - Author/Maintainer: Mark M. Hoffman - Copyright (c) 2004 Utilitek Systems, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef LM93_H -#define LM93_H - -/* LM93 REGISTER ADDRESSES */ - -/* miscellaneous */ -#define LM93_REG_MFR_ID 0x3e -#define LM93_REG_VER 0x3f -#define LM93_REG_STATUS_CONTROL 0xe2 -#define LM93_REG_CONFIG 0xe3 -#define LM93_REG_SLEEP_CONTROL 0xe4 - -/* alarm values start here */ -#define LM93_REG_HOST_ERROR_1 0x48 - -/* voltage inputs: in1-in16 (nr => 0-15) */ -#define LM93_REG_IN(nr) (0x56 + (nr)) -#define LM93_REG_IN_MIN(nr) (0x90 + (nr) * 2) -#define LM93_REG_IN_MAX(nr) (0x91 + (nr) * 2) - -/* temperature inputs: temp1-temp4 (nr => 0-3) */ -#define LM93_REG_TEMP(nr) (0x50 + (nr)) -#define LM93_REG_TEMP_MIN(nr) (0x78 + (nr) * 2) -#define LM93_REG_TEMP_MAX(nr) (0x79 + (nr) * 2) - -/* temp[1-4]_auto_boost (nr => 0-3) */ -#define LM93_REG_BOOST(nr) (0x80 + (nr)) - -/* #PROCHOT inputs: prochot1-prochot2 (nr => 0-1) */ -#define LM93_REG_PROCHOT_CUR(nr) (0x67 + (nr) * 2) -#define LM93_REG_PROCHOT_AVG(nr) (0x68 + (nr) * 2) -#define LM93_REG_PROCHOT_MAX(nr) (0xb0 + (nr)) - -/* fan tach inputs: fan1-fan4 (nr => 0-3) */ -#define LM93_REG_FAN(nr) (0x6e + (nr) * 2) -#define LM93_REG_FAN_MIN(nr) (0xb4 + (nr) * 2) - -/* pwm outputs: pwm1-pwm2 (nr => 0-1, reg => 0-3) */ -#define LM93_REG_PWM_CTL(nr,reg) (0xc8 + (reg) + (nr) * 4) -#define LM93_PWM_CTL1 0 -#define LM93_PWM_CTL2 1 -#define LM93_PWM_CTL3 2 -#define LM93_PWM_CTL4 3 - -/* GPIO input state */ -#define LM93_REG_GPI 0x6b - -/* vid inputs: vid1-vid2 (nr => 0-1) */ -#define LM93_REG_VID(nr) (0x6c + (nr)) - -/* vccp1 & vccp2: VID relative inputs (nr => 0-1) */ -#define LM93_REG_VCCP_LIMIT_OFF(nr) (0xb2 + (nr)) - -/* temp[1-4]_auto_boost_hyst */ -#define LM93_REG_BOOST_HYST_12 0xc0 -#define LM93_REG_BOOST_HYST_34 0xc1 -#define LM93_REG_BOOST_HYST(nr) (0xc0 + (nr)/2) - -/* temp[1-4]_auto_pwm_[min|hyst] */ -#define LM93_REG_PWM_MIN_HYST_12 0xc3 -#define LM93_REG_PWM_MIN_HYST_34 0xc4 -#define LM93_REG_PWM_MIN_HYST(nr) (0xc3 + (nr)/2) - -/* prochot_override & prochot_interval */ -#define LM93_REG_PROCHOT_OVERRIDE 0xc6 -#define LM93_REG_PROCHOT_INTERVAL 0xc7 - -/* temp[1-4]_auto_base (nr => 0-3) */ -#define LM93_REG_TEMP_BASE(nr) (0xd0 + (nr)) - -/* temp[1-4]_auto_offsets (step => 0-11) */ -#define LM93_REG_TEMP_OFFSET(step) (0xd4 + (step)) - -/* #PROCHOT & #VRDHOT PWM ramp control */ -#define LM93_REG_PWM_RAMP_CTL 0xbf - -/* miscellaneous */ -#define LM93_REG_SFC1 0xbc -#define LM93_REG_SFC2 0xbd -#define LM93_REG_GPI_VID_CTL 0xbe -#define LM93_REG_SF_TACH_TO_PWM 0xe0 - -/* error masks */ -#define LM93_REG_GPI_ERR_MASK 0xec -#define LM93_REG_MISC_ERR_MASK 0xed - -/* LM93 REGISTER VALUES */ -#define LM93_MFR_ID 0x73 -#define LM93_MFR_ID_PROTOTYPE 0x72 - -#endif /* !defined LM93_H */ - diff --git a/kernel/chips/ltc1710.c b/kernel/chips/ltc1710.c deleted file mode 100644 index 80417983..00000000 --- a/kernel/chips/ltc1710.c +++ /dev/null @@ -1,313 +0,0 @@ -/* - ltc1710.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1999 Frodo Looijaard and - Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* A few notes about the LTC1710: - -* The LTC1710 is a dual programmable switch. It can be used to turn - anything on or off anything which consumes less than 300mA of - current and up to 5.5V - -* The LTC1710 is a very, very simple SMBus device with three possible - SMBus addresses (0x58,0x59, or 0x5A). Only SMBus byte writes - (command writes) are supported. - -* Since only writes are supported, READS DON'T WORK! The device - plays dead in the event of a read, so this makes detection a - bit tricky. - -* BTW- I can safely say that this driver has been tested under - every possible case, so there should be no bugs. :') - - --Phil - -*/ - - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x58, 0x5a, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(ltc1710); - -/* The LTC1710 registers */ - -/* (No registers. [Wow! This thing is SIMPLE!] ) */ - -/* Initial values */ -#define LTC1710_INIT 0 /* Both off */ - -/* Each client has this additional data */ -struct ltc1710_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 status; /* Register values */ -}; - -static int ltc1710_attach_adapter(struct i2c_adapter *adapter); -static int ltc1710_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int ltc1710_detach_client(struct i2c_client *client); - -static void ltc1710_switch1(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ltc1710_switch2(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void ltc1710_update_client(struct i2c_client *client); - - -/* This is the driver that will be inserted */ -static struct i2c_driver ltc1710_driver = { - .name = "LTC1710 sensor chip driver", - .id = I2C_DRIVERID_LTC1710, - .flags = I2C_DF_NOTIFY, - .attach_adapter = ltc1710_attach_adapter, - .detach_client = ltc1710_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define LTC1710_SYSCTL_SWITCH_1 1000 -#define LTC1710_SYSCTL_SWITCH_2 1001 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected LTC1710. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table ltc1710_dir_table_template[] = { - {LTC1710_SYSCTL_SWITCH_1, "switch1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, <c1710_switch1}, - {LTC1710_SYSCTL_SWITCH_2, "switch2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, <c1710_switch2}, - {0} -}; - -static int ltc1710_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, ltc1710_detect); -} - -/* This function is called by i2c_detect */ -int ltc1710_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct ltc1710_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("ltc1710.o: ltc1710_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access ltc1710_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct ltc1710_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = <c1710_driver; - new_client->flags = 0; - - /* Now, we would do the remaining detection. But the LTC1710 is plainly - impossible to detect! Stupid chip. */ - - /* Determine the chip type - only one kind supported! */ - if (kind <= 0) - kind = ltc1710; - - if (kind == ltc1710) { - type_name = "ltc1710"; - client_name = "LTC1710 chip"; - } else { -#ifdef DEBUG - printk("ltc1710.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - ltc1710_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - - -static int ltc1710_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct ltc1710_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("ltc1710.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; - -} - -static void ltc1710_update_client(struct i2c_client *client) -{ - struct ltc1710_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting ltc1710 update\n"); -#endif - - /* data->status = i2c_smbus_read_byte(client); - Unfortunately, reads always fail! */ - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void ltc1710_switch1(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ltc1710_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ltc1710_update_client(client); - results[0] = data->status & 1; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->status = (data->status & 2) | results[0]; - i2c_smbus_write_byte(client, data->status); - } - } -} - -void ltc1710_switch2(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct ltc1710_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - ltc1710_update_client(client); - results[0] = (data->status & 2) >> 1; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->status = - (data->status & 1) | (results[0] << 1); - i2c_smbus_write_byte(client, data->status); - } - } -} - -static int __init sm_ltc1710_init(void) -{ - printk("ltc1710.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(<c1710_driver); -} - -static void __exit sm_ltc1710_exit(void) -{ - i2c_del_driver(<c1710_driver); -} - - - -MODULE_AUTHOR - ("Frodo Looijaard and Philip Edelbrock "); -MODULE_DESCRIPTION("LTC1710 driver"); - -module_init(sm_ltc1710_init); -module_exit(sm_ltc1710_exit); diff --git a/kernel/chips/matorb.c b/kernel/chips/matorb.c deleted file mode 100644 index 1e6de8a7..00000000 --- a/kernel/chips/matorb.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - matorb.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - and Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - - -#define DEBUG 1 - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x2E, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(matorb); - -/* Many MATORB constants specified below */ - - -/* Each client has this additional data */ -struct matorb_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - -}; - -static int matorb_attach_adapter(struct i2c_adapter *adapter); -static int matorb_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void matorb_init_client(struct i2c_client *client); -static int matorb_detach_client(struct i2c_client *client); - -static int matorb_write_value(struct i2c_client *client, u8 reg, - u16 value); -static void matorb_disp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void matorb_update_client(struct i2c_client *client); - - -/* This is the driver that will be inserted */ -static struct i2c_driver matorb_driver = { - .name = "Matrix Orbital LCD driver", - .id = I2C_DRIVERID_MATORB, - .flags = I2C_DF_NOTIFY, - .attach_adapter = matorb_attach_adapter, - .detach_client = matorb_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define MATORB_SYSCTL_DISP 1000 -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected MATORB. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table matorb_dir_table_template[] = { - {MATORB_SYSCTL_DISP, "disp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &matorb_disp}, - {0} -}; - -static int matorb_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, matorb_detect); -} - -/* This function is called by i2c_detect */ -int matorb_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i, cur; - struct i2c_client *new_client; - struct matorb_data *data; - int err = 0; - const char *type_name = "matorb"; - const char *client_name = "matorb"; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("matorb.o: matorb_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE | - I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) - goto ERROR0; - - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access matorb_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct matorb_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &matorb_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. It is lousy. */ - cur = i2c_smbus_write_byte_data(new_client, 0x0FE, 0x58); /* clear screen */ - - printk("matorb.o: debug detect 0x%X\n", cur); - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - matorb_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - matorb_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - kfree(data); - ERROR0: - return err; -} - -static int matorb_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct matorb_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("matorb.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -#if 0 -/* All registers are word-sized, except for the configuration register. - MATORB uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int matorb_read_value(struct i2c_client *client, u8 reg) -{ - return -1; /* Doesn't support reads */ -} -#endif - -/* All registers are word-sized, except for the configuration register. - MATORB uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int matorb_write_value(struct i2c_client *client, u8 reg, u16 value) -{ - if (reg == 0) { - return i2c_smbus_write_byte(client, value); - } else { - return i2c_smbus_write_byte_data(client, reg, value); - } -} - -static void matorb_init_client(struct i2c_client *client) -{ - /* Initialize the MATORB chip */ -} - -static void matorb_update_client(struct i2c_client *client) -{ - struct matorb_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting matorb update\n"); -#endif - -/* nothing yet */ - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void matorb_disp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - int i; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - matorb_update_client(client); - results[0] = 0; - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - for (i = 1; i <= *nrels_mag; i++) { - matorb_write_value(client, 0, results[i - 1]); - } - } -} - -static int __init sm_matorb_init(void) -{ - printk("matorb.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&matorb_driver); -} - -static void __exit sm_matorb_exit(void) -{ - i2c_del_driver(&matorb_driver); -} - - - -MODULE_AUTHOR - ("Frodo Looijaard and Philip Edelbrock "); -MODULE_DESCRIPTION("MATORB driver"); - -module_init(sm_matorb_init); -module_exit(sm_matorb_exit); diff --git a/kernel/chips/max1619.c b/kernel/chips/max1619.c deleted file mode 100644 index 86943983..00000000 --- a/kernel/chips/max1619.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * max1619.c - Part of lm_sensors, Linux kernel modules for hardware - * monitoring - * Copyright (C) 2004 Alexey Fisher - * Jean Delvare - * - * Copied from lm90.c: - * Copyright (C) 2003-2004 Jean Delvare - * - * The MAX1619 is a sensor chip made by Maxim. It reports up to two - * temperatures (its own plus up to one external one). - * Complete datasheet can be obtained from Maxim's website at: - * http://pdfserv.maxim-ic.com/en/ds/MAX1619.pdf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include "version.h" - -/* - * Addresses to scan - */ - -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = {0x18, 0x1a, 0x29, 0x2b, - 0x4c, 0x4e, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* - * Insmod parameters - */ - -SENSORS_INSMOD_1(max1619); - -/* - * The max1619 registers - */ - -#define MAX1619_REG_R_CONFIG 0x03 -#define MAX1619_REG_W_CONFIG 0x09 -#define MAX1619_REG_R_CONVRATE 0x04 -#define MAX1619_REG_W_CONVRATE 0x0A -#define MAX1619_REG_R_STATUS 0x02 -#define MAX1619_REG_R_LOCAL_TEMP 0x00 -#define MAX1619_REG_R_REMOTE_TEMP 0x01 -#define MAX1619_REG_R_REMOTE_THIGH 0x07 -#define MAX1619_REG_W_REMOTE_THIGH 0x0d -#define MAX1619_REG_R_REMOTE_TLOW 0x08 -#define MAX1619_REG_W_REMOTE_TLOW 0x0E -#define MAX1619_REG_R_REMOTE_TMAX 0x10 -#define MAX1619_REG_W_REMOTE_TMAX 0x12 -#define MAX1619_REG_R_REMOTE_THYST 0x11 -#define MAX1619_REG_W_REMOTE_THYST 0x13 -#define MAX1619_REG_R_MAN_ID 0xFE -#define MAX1619_REG_R_CHIP_ID 0xFF - -/* - * Conversions and various macros - */ - -#define TEMP_FROM_REG(val) ((val) & 0x80 ? (val)-0x100 : (val)) -#define TEMP_TO_REG(val) ((val) < 0 ? (val)+0x100 : (val)) - -/* - * Functions declaration - */ - -static int max1619_attach_adapter(struct i2c_adapter *adapter); -static int max1619_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void max1619_init_client(struct i2c_client *client); -static int max1619_detach_client(struct i2c_client *client); -static void max1619_local_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void max1619_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void max1619_remote_crit(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void max1619_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -/* - * Driver data (common to all clients) - */ - -static struct i2c_driver max1619_driver = { - .name = "MAX1619 sensor driver", - .flags = I2C_DF_NOTIFY, - .attach_adapter = max1619_attach_adapter, - .detach_client = max1619_detach_client -}; - -/* - * Client data (each client gets its own) - */ - -struct max1619_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* zero until following fields are valid */ - unsigned long last_updated; /* in jiffies */ - - /* register values */ - u8 local_temp; - u8 remote_temp, remote_high, remote_low; - u8 remote_hyst, remote_max; - u8 alarms; -}; - -/* - * Proc entries - * These files are created for each detected max1619. - */ - -/* -- SENSORS SYSCTL START -- */ - -#define MAX1619_SYSCTL_LOCAL_TEMP 1200 -#define MAX1619_SYSCTL_REMOTE_TEMP 1201 -#define MAX1619_SYSCTL_REMOTE_CRIT 1202 -#define MAX1619_SYSCTL_ALARMS 1203 - -#define MAX1619_ALARM_REMOTE_THIGH 0x10 -#define MAX1619_ALARM_REMOTE_TLOW 0x08 -#define MAX1619_ALARM_REMOTE_OPEN 0x04 -#define MAX1619_ALARM_REMOTE_OVERT 0x02 - -/* -- SENSORS SYSCTL END -- */ - - -static ctl_table max1619_dir_table_template[] = -{ - {MAX1619_SYSCTL_LOCAL_TEMP, "temp1", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max1619_local_temp}, - {MAX1619_SYSCTL_REMOTE_TEMP, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max1619_remote_temp}, - {MAX1619_SYSCTL_REMOTE_CRIT,"temp2_crit", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max1619_remote_crit}, - {MAX1619_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max1619_alarms}, - {0} -}; - -/* - * Real code - */ - -static int max1619_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, max1619_detect); -} - -/* - * The following function does more than just detection. If detection - * succeeds, it also registers the new chip. - */ -static int max1619_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - struct i2c_client *new_client; - struct max1619_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk(KERN_DEBUG "max1619.o: Called for an ISA bus " - "adapter, aborting.\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { -#ifdef DEBUG - printk(KERN_DEBUG "max1619.o: I2C bus doesn't support " - "byte read mode, skipping.\n"); -#endif - return 0; - } - - if (!(data = kmalloc(sizeof(struct max1619_data), GFP_KERNEL))) { - printk(KERN_ERR "max1619.o: Out of memory in " - "max1619_detect (new_client).\n"); - return -ENOMEM; - } - - /* - * The common I2C client data is placed right before the - * MAX1619-specific data. The MAX1619-specific data is pointed to - * by the data field from the I2C client da1ta. - */ - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &max1619_driver; - new_client->flags = 0; - - /* - * Now we do the remaining detection. A negative kind means that - * the driver was loaded with no force parameter (default), so we - * must both detect and identify the chip. A zero kind means that - * the driver was loaded with the force parameter, the detection - * step shall be skipped. A positive kind means that the driver - * was loaded with the force parameter and a given kind of chip is - * requested, so both the detection and the identification steps - * are skipped. - */ - - if (kind < 0) { - u8 reg_config, reg_convrate, reg_status; - - reg_config = i2c_smbus_read_byte_data(new_client, - MAX1619_REG_R_CONFIG); - reg_convrate = i2c_smbus_read_byte_data(new_client, - MAX1619_REG_R_CONVRATE); - reg_status = i2c_smbus_read_byte_data(new_client, - MAX1619_REG_R_STATUS); - - if ((reg_config & 0x03) != 0x00 - || reg_convrate > 0x07 - || (reg_status & 0x61) != 0x00) { -#ifdef DEBUG - printk(KERN_DEBUG "max1619.o: Detection failed at " - "0x%02x.\n", address); -#endif - goto ERROR1; - } - } - - if (kind <= 0) { - u8 man_id, chip_id; - - man_id = i2c_smbus_read_byte_data(new_client, - MAX1619_REG_R_MAN_ID); - chip_id = i2c_smbus_read_byte_data(new_client, - MAX1619_REG_R_CHIP_ID); - - if ((man_id == 0x4D) && (chip_id == 0x04)) { - kind = max1619; - } - } - - if (kind <= 0) { - printk(KERN_INFO "max1619.o: Unsupported chip.\n"); - goto ERROR1; - } - - if (kind == max1619) { - type_name = "max1619"; - client_name = "MAX1619 chip"; - } else { - printk(KERN_ERR "max1619.o: Unknown kind %d.\n", kind); - goto ERROR1; - } - - /* - * OK, we got a valid chip so we can fill in the remaining client - * fields. - */ - - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* - * Tell the I2C layer a new client has arrived. - */ - - if ((err = i2c_attach_client(new_client))) { - printk(KERN_ERR "max1619.o: Failed attaching client.\n"); - goto ERROR1; - } - - /* - * Register a new directory entry. - */ - - if ((err = i2c_register_entry(new_client, type_name, - max1619_dir_table_template, THIS_MODULE)) < 0) { - printk(KERN_ERR "max1619.o: Failed registering directory " - "entry.\n"); - goto ERROR2; - } - data->sysctl_id = err; - - /* - * Initialize the MAX1619 chip. - */ - - max1619_init_client(new_client); - return 0; - -ERROR2: - i2c_detach_client(new_client); -ERROR1: - kfree(data); - return err; -} - -static void max1619_init_client(struct i2c_client *client) -{ - u8 config; - - /* - * Start the conversions. - */ - - /* Set conversion rate to 2 Hz */ - i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONVRATE, 5); - - /* Start monitoring */ - config = i2c_smbus_read_byte_data(client, MAX1619_REG_R_CONFIG); - if (config & 0x40) - i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONFIG, - config & 0xBF); -} - - -static int max1619_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct max1619_data *) - (client->data))->sysctl_id); - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR "max1619.o: Client deregistration failed, " - "client not detached.\n"); - return err; - } - - kfree(client->data); - return 0; -} - -static void max1619_update_client(struct i2c_client *client) -{ - struct max1619_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ * 2) || - (jiffies < data->last_updated) || !data->valid) { -#ifdef DEBUG - printk(KERN_DEBUG "max1619.o: Updating data.\n"); -#endif - - data->local_temp = i2c_smbus_read_byte_data(client, - MAX1619_REG_R_LOCAL_TEMP); - data->remote_temp = i2c_smbus_read_byte_data(client, - MAX1619_REG_R_REMOTE_TEMP); - data->remote_high = i2c_smbus_read_byte_data(client, - MAX1619_REG_R_REMOTE_THIGH); - data->remote_low = i2c_smbus_read_byte_data(client, - MAX1619_REG_R_REMOTE_TLOW); - data->remote_max = i2c_smbus_read_byte_data(client, - MAX1619_REG_R_REMOTE_TMAX); - data->remote_hyst = i2c_smbus_read_byte_data(client, - MAX1619_REG_R_REMOTE_THYST); - data->alarms = i2c_smbus_read_byte_data(client, - MAX1619_REG_R_STATUS); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -static void max1619_local_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct max1619_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - max1619_update_client(client); - results[0] = TEMP_FROM_REG(data->local_temp); - *nrels_mag = 1; - } - -} - -static void max1619_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct max1619_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - max1619_update_client(client); - results[0] = TEMP_FROM_REG(data->remote_high); - results[1] = TEMP_FROM_REG(data->remote_low); - results[2] = TEMP_FROM_REG(data->remote_temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->remote_high = TEMP_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, - MAX1619_REG_W_REMOTE_THIGH, data->remote_high); - } - if (*nrels_mag >= 2) { - data->remote_low = TEMP_TO_REG(results[1]); - i2c_smbus_write_byte_data(client, - MAX1619_REG_W_REMOTE_TLOW, data->remote_low); - - } - } -} - -static void max1619_remote_crit(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct max1619_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - max1619_update_client(client); - results[0] = TEMP_FROM_REG(data->remote_max); - results[1] = TEMP_FROM_REG(data->remote_hyst); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->remote_max = TEMP_TO_REG(results[0]); - i2c_smbus_write_byte_data(client, - MAX1619_REG_W_REMOTE_TMAX, data->remote_max); - } - if (*nrels_mag >= 2) { - data->remote_hyst = TEMP_TO_REG(results[1]); - i2c_smbus_write_byte_data(client, - MAX1619_REG_W_REMOTE_THYST, data->remote_hyst); - } - } -} - -static void max1619_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct max1619_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; /* magnitude */ - else if (operation == SENSORS_PROC_REAL_READ) { - max1619_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - - -static int __init sm_max1619_init(void) -{ - printk(KERN_INFO "max1619.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&max1619_driver); -} - -static void __exit sm_max1619_exit(void) -{ - i2c_del_driver(&max1619_driver); -} - -MODULE_AUTHOR("Alexey Fisher "); -MODULE_DESCRIPTION("MAX1619 sensor driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_max1619_init); -module_exit(sm_max1619_exit); diff --git a/kernel/chips/max6650.c b/kernel/chips/max6650.c deleted file mode 100644 index c7975a90..00000000 --- a/kernel/chips/max6650.c +++ /dev/null @@ -1,537 +0,0 @@ -/* - * max6650.c - Part of lm_sensors, Linux kernel modules for hardware - * monitoring. - * - * Author: John Morris - * - * Copyright (c) 2003 Spirent Communications - * - * This module has only been tested with the MAX6651 chip. It should - * work with the MAX6650 also, though with reduced functionality. It - * does not yet distinguish max6650 and max6651 chips. - * - * Tha datasheet was last seen at: - * - * http://pdfserv.maxim-ic.com/en/ds/MAX6650-MAX6651.pdf - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include "version.h" - -#ifndef I2C_DRIVERID_MAX6650 -#define I2C_DRIVERID_MAX6650 1044 -#endif - -/* - * Addresses to scan. There are four disjoint possibilities, by pin config. - */ - -static unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b, SENSORS_I2C_END}; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* - * Insmod parameters - */ - -SENSORS_INSMOD_1(max6650); - -/* - * MAX 6650/6651 registers - */ - -#define MAX6650_REG_SPEED 0x00 -#define MAX6650_REG_CONFIG 0x02 -#define MAX6650_REG_GPIO_DEF 0x04 -#define MAX6650_REG_DAC 0x06 -#define MAX6650_REG_ALARM_EN 0x08 -#define MAX6650_REG_ALARM 0x0A -#define MAX6650_REG_TACH0 0x0C -#define MAX6650_REG_TACH1 0x0E -#define MAX6650_REG_TACH2 0x10 -#define MAX6650_REG_TACH3 0x12 -#define MAX6650_REG_GPIO_STAT 0x14 -#define MAX6650_REG_COUNT 0x16 - -/* - * Config register bits - */ - -#define MAX6650_CFG_MODE_MASK 0x30 -#define MAX6650_CFG_MODE_ON 0x00 -#define MAX6650_CFG_MODE_OFF 0x10 -#define MAX6650_CFG_MODE_CLOSED_LOOP 0x20 -#define MAX6650_CFG_MODE_OPEN_LOOP 0x30 - -static const u8 tach_reg[] = -{ - MAX6650_REG_TACH0, MAX6650_REG_TACH1, - MAX6650_REG_TACH2, MAX6650_REG_TACH3 -}; - -#define MAX6650_INT_CLK 254000 /* Default clock speed - 254 kHz */ - -/* - * Functions declaration - */ - -static void max6650_fan (struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results); -static void max6650_speed (struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results); -static void max6650_xdump (struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results); -static int max6650_detect(struct i2c_adapter *adapter, int address, unsigned - short flags, int kind); -static int max6650_attach_adapter(struct i2c_adapter *adapter); -static int max6650_detach_client(struct i2c_client *client); -static void max6650_init_client(struct i2c_client *client); -static int max6650_read(struct i2c_client *client, u8 reg); - -/* - * Driver data (common to all clients) - */ - - -static struct i2c_driver max6650_driver = { - .name = "MAX6650/1 sensor driver", - .id = I2C_DRIVERID_MAX6650, - .flags = I2C_DF_NOTIFY, - .attach_adapter = max6650_attach_adapter, - .detach_client = max6650_detach_client -}; - -/* - * Client data (each client gets its own) - */ - -struct max6650_data -{ - struct i2c_client client; - int sysctl_id; - struct semaphore update_lock; - char valid; /* zero until following fields are valid */ - unsigned long last_updated; /* in jiffies */ - - /* register values */ - - u8 speed; - u8 config; - u8 tach[4]; - u8 count; -}; - -/* - * Proc entries - * These files are created for each detected max6650. - */ - -/* -- SENSORS SYSCTL START -- */ - -#define MAX6650_SYSCTL_FAN1 1101 -#define MAX6650_SYSCTL_FAN2 1102 -#define MAX6650_SYSCTL_FAN3 1103 -#define MAX6650_SYSCTL_FAN4 1104 -#define MAX6650_SYSCTL_SPEED 1105 -#define MAX6650_SYSCTL_XDUMP 1106 - - -/* -- SENSORS SYSCTL END -- */ - - -static ctl_table max6650_dir_table_template[] = -{ - {MAX6650_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max6650_fan}, - {MAX6650_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max6650_fan}, - {MAX6650_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max6650_fan}, - {MAX6650_SYSCTL_FAN4, "fan4", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max6650_fan}, - {MAX6650_SYSCTL_SPEED, "speed", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max6650_speed}, - {MAX6650_SYSCTL_XDUMP, "xdump", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &max6650_xdump}, - {0} -}; - -/* - * Real code - */ - -static int max6650_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, max6650_detect); -} - -/* - * The following function does more than just detection. If detection - * succeeds, it also registers the new chip. - */ - -static int max6650_detect(struct i2c_adapter *adapter, int address, unsigned - short flags, int kind) -{ - struct i2c_client *new_client; - struct max6650_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk("max6650.o: Called for an ISA bus adapter, aborting.\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { -#ifdef DEBUG - printk("max6650.o: I2C bus doesn't support byte read mode, skipping.\n"); -#endif - return 0; - } - - if (!(data = kmalloc(sizeof(struct max6650_data), GFP_KERNEL))) { - printk("max6650.o: Out of memory in max6650_detect (new_client).\n"); - return -ENOMEM; - } - - /* - * The common I2C client data is placed right before the - * max6650-specific data. The max6650-specific data is pointed to by the - * data field from the I2C client data. - */ - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &max6650_driver; - new_client->flags = 0; - - /* - * Now we do the remaining detection. A negative kind means that - * the driver was loaded with no force parameter (default), so we - * must both detect and identify the chip (actually there is only - * one possible kind of chip for now, max6650). A zero kind means that - * the driver was loaded with the force parameter, the detection - * step shall be skipped. A positive kind means that the driver - * was loaded with the force parameter and a given kind of chip is - * requested, so both the detection and the identification steps - * are skipped. - * - * Currently I can find no way to distinguish between a MAX6650 and - * a MAX6651. This driver has only been tried on the latter. - */ - - if (kind < 0) { /* detection */ - if ( - (max6650_read(new_client, MAX6650_REG_CONFIG) & 0xC0) || - (max6650_read(new_client, MAX6650_REG_GPIO_STAT) & 0xE0) || - (max6650_read(new_client, MAX6650_REG_ALARM_EN) & 0xE0) || - (max6650_read(new_client, MAX6650_REG_ALARM) & 0xE0) || - (max6650_read(new_client, MAX6650_REG_COUNT) & 0xFC) - ) - { -#ifdef DEBUG - printk("max6650.o: max6650 detection failed at 0x%02x.\n", - address); -#endif - goto ERROR1; - } - } - - if (kind <= 0) { /* identification */ - kind = max6650; - } - - if (kind <= 0) { /* identification failed */ - printk("max6650.o: Unsupported chip.\n"); - goto ERROR1; - } - - if (kind == max6650) { - type_name = "max6650"; - client_name = "max6650 chip"; - } else { - printk("max6650.o: Unknown kind %d.\n", kind); - goto ERROR1; - } - - /* - * OK, we got a valid chip so we can fill in the remaining client - * fields. - */ - - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* - * Tell the I2C layer a new client has arrived. - */ - - if ((err = i2c_attach_client(new_client))) { -#ifdef DEBUG - printk("max6650.o: Failed attaching client.\n"); -#endif - goto ERROR1; - } - - /* - * Register a new directory entry. - */ - if ((err = i2c_register_entry(new_client, type_name, - max6650_dir_table_template, - THIS_MODULE)) < 0) { -#ifdef DEBUG - printk("max6650.o: Failed registering directory entry.\n"); -#endif - goto ERROR2; - } - data->sysctl_id = err; - - /* - * Initialize the max6650 chip - */ - max6650_init_client(new_client); - return 0; - -ERROR2: - i2c_detach_client(new_client); -ERROR1: - kfree(data); - return err; -} - -static void max6650_init_client(struct i2c_client *client) -{ - /* Nothing to do here - assume the BIOS has initialized the chip */ -} - -static int max6650_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct max6650_data *) (client->data))->sysctl_id); - if ((err = i2c_detach_client(client))) { - printk("max6650.o: Client deregistration failed, " - "client not detached.\n"); - return err; - } - - kfree(client->data); - return 0; -} - -static int max6650_read(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -static int max6650_write(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -static void max6650_update_client(struct i2c_client *client) -{ - int i; - struct max6650_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ) || - (jiffies < data->last_updated) || !data->valid) { -#ifdef DEBUG - printk("max6650.o: Updating max6650 data.\n"); -#endif - data->speed = max6650_read (client, MAX6650_REG_SPEED); - data->config = max6650_read (client, MAX6650_REG_CONFIG); - for (i = 0; i < 4; i++) { - data->tach[i] = max6650_read(client, tach_reg[i]); - } - data->count = max6650_read (client, MAX6650_REG_COUNT); - data->last_updated = jiffies; - data->valid = 1; - } - up(&data->update_lock); -} - -static void max6650_fan (struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results) -{ - int index = ctl_name - MAX6650_SYSCTL_FAN1; - struct max6650_data *data = client->data; - int tcount; /* Tachometer count time, 0.25 second units */ - - if (operation == SENSORS_PROC_REAL_INFO) { - *nrels_mag = 0; - } else if (operation == SENSORS_PROC_REAL_READ) { - max6650_update_client(client); - - /* - * Calculation details: - * - * Each tachometer counts over an interval given by the "count" - * register (0.25, 0.5, 1 or 2 seconds). This module assumes - * that the fans produce two pulses per revolution (this seems - * to be the most common). - */ - - tcount = 1 << data->count; /* 0.25 second units */ - results[0] = (data->tach[index] * 240) / tcount; /* counts per min */ - results[0] /= 2; /* Assume two counts per rev */ - *nrels_mag = 1; - } -} - -/* - * Set the fan speed to the specified RPM (or read back the RPM setting). - * - * The MAX6650/1 will automatically control fan speed when in closed loop - * mode. - * - * Assumptions: - * - * 1) The MAX6650/1 is running from its internal 254kHz clock (perhaps - * this should be made a module parameter). - * - * 2) The prescaler (low three bits of the config register) has already - * been set to an appropriate value. - * - * The relevant equations are given on pages 21 and 22 of the datasheet. - * - * From the datasheet, the relevant equation when in regulation is: - * - * [fCLK / (128 x (KTACH + 1))] = 2 x FanSpeed / KSCALE - * - * where: - * - * fCLK is the oscillator frequency (either the 254kHz internal - * oscillator or the externally applied clock) - * - * KTACH is the value in the speed register - * - * FanSpeed is the speed of the fan in rps - * - * KSCALE is the prescaler value (1, 2, 4, 8, or 16) - * - * When reading, we need to solve for FanSpeed. When writing, we need to - * solve for KTACH. - * - * Note: this tachometer is completely separate from the tachometers - * used to measure the fan speeds. Only one fan's speed (fan1) is - * controlled. - */ - -static void max6650_speed (struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results) -{ - struct max6650_data *data = client->data; - int kscale, ktach, fclk, rpm; - - if (operation == SENSORS_PROC_REAL_INFO) { - *nrels_mag = 0; - } else if (operation == SENSORS_PROC_REAL_READ) { - /* - * Use the datasheet equation: - * - * FanSpeed = KSCALE x fCLK / [256 x (KTACH + 1)] - * - * then multiply by 60 to give rpm. - */ - - max6650_update_client(client); - - kscale = 1 << (data->config & 7); - ktach = data->speed; - fclk = MAX6650_INT_CLK; - rpm = 60 * kscale * fclk / (256 * (ktach + 1)); - - results[0] = rpm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE && *nrels_mag >= 1) { - /* - * Divide the required speed by 60 to get from rpm to rps, then - * use the datasheet equation: - * - * KTACH = [(fCLK x KSCALE) / (256 x FanSpeed)] - 1 - */ - - max6650_update_client(client); - - rpm = results[0]; - kscale = 1 << (data->config & 7); - fclk = MAX6650_INT_CLK; - ktach = ((fclk * kscale) / (256 * rpm / 60)) - 1; - - data->speed = ktach; - data->config = (data->config & ~MAX6650_CFG_MODE_MASK) | - MAX6650_CFG_MODE_CLOSED_LOOP; - max6650_write (client, MAX6650_REG_CONFIG, data->config); - max6650_write (client, MAX6650_REG_SPEED, data->speed); - } -} - -/* - * Debug - dump all registers except the tach counts. - */ - -static void max6650_xdump (struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results) -{ - if (operation == SENSORS_PROC_REAL_INFO) { - *nrels_mag = 0; - } else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = max6650_read (client, MAX6650_REG_SPEED); - results[1] = max6650_read (client, MAX6650_REG_CONFIG); - results[2] = max6650_read (client, MAX6650_REG_GPIO_DEF); - results[3] = max6650_read (client, MAX6650_REG_DAC); - results[4] = max6650_read (client, MAX6650_REG_ALARM_EN); - results[5] = max6650_read (client, MAX6650_REG_ALARM); - results[6] = max6650_read (client, MAX6650_REG_GPIO_STAT); - results[7] = max6650_read (client, MAX6650_REG_COUNT); - *nrels_mag = 8; - } -} - -static int __init sm_max6650_init(void) -{ - printk(KERN_INFO "max6650.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&max6650_driver); -} - -static void __exit sm_max6650_exit(void) -{ - i2c_del_driver(&max6650_driver); -} - -MODULE_AUTHOR("john.morris@spirentcom.com"); -MODULE_DESCRIPTION("max6650 sensor driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_max6650_init); -module_exit(sm_max6650_exit); diff --git a/kernel/chips/maxilife.c b/kernel/chips/maxilife.c deleted file mode 100644 index 7eab4be5..00000000 --- a/kernel/chips/maxilife.c +++ /dev/null @@ -1,1379 +0,0 @@ -/* - maxilife.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1999-2000 Fons Rademakers - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* The is the driver for the HP MaxiLife Health monitoring system - as used in the line of HP Kayak Workstation PC's. - - The driver supports the following MaxiLife firmware versions: - - 0) HP KAYAK XU/XAs (Dual Pentium II Slot 1, Deschutes/Klamath) - 1) HP KAYAK XU (Dual Xeon [Slot 2] 400/450 Mhz) - 2) HP KAYAK XA (Pentium II Slot 1, monoprocessor) - - Currently firmware auto detection is not implemented. To use the - driver load it with the correct option for you Kayak. For example: - - insmod maxilife.o maxi_version=0 | 1 | 2 - - maxi_version=0 is the default - - This version of MaxiLife is called MaxiLife'98 and has been - succeeded by MaxiLife'99, see below. - - The new version of the driver also supports MaxiLife NBA (New BIOS - Architecture). This new MaxiLife controller provides a much cleaner - machine independent abstraction layer to the MaxiLife controller. - Instead of accessing directly registers (different for each revision) - one now accesses the sensors via unique mailbox tokens that do not - change between revisions. Also the quantities are already in physical - units (degrees, rpms, voltages, etc.) and don't need special conversion - formulas. This new MaxiLife is available on the new 2000 machines, - like the Kayak XU800 and XM600. This hardware is also autodetected. -*/ - -static const char *version_str = "2.00 29/2/2000 Fons Rademakers"; - - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -#undef AUTODETECT /* try to autodetect MaxiLife version */ -/*#define AUTODETECT*/ -#define NOWRITE /* don't allow writing to MaxiLife registers */ - -#ifdef AUTODETECT -#include -#include -#endif - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x10, 0x14, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(maxilife); - -/* Macro definitions */ -#define LOW(MyWord) ((u8) (MyWord)) -#define HIGH(MyWord) ((u8) (((u16)(MyWord) >> 8) & 0xFF)) - -/*----------------- MaxiLife'98 registers and conversion formulas ------------*/ -#define MAXI_REG_TEMP(nr) (0x60 + (nr)) - -#define MAXI_REG_FAN(nr) (0x65 + (nr)) -#define MAXI_REG_FAN_MIN(nr) ((nr)==0 ? 0xb3 : (nr)==1 ? 0xb3 : 0xab) -#define MAXI_REG_FAN_MINAS(nr) ((nr)==0 ? 0xb3 : (nr)==1 ? 0xab : 0xb3) -#define MAXI_REG_FAN_SPEED(nr) ((nr)==0 ? 0xe4 : (nr)==1 ? 0xe5 : 0xe9) - -#define MAXI_REG_PLL 0xb9 -#define MAXI_REG_PLL_MIN 0xba -#define MAXI_REG_PLL_MAX 0xbb - -#define MAXI_REG_VID(nr) ((nr)==0 ? 0xd1 : (nr)==1 ? 0xd9 : \ - (nr)==2 ? 0xd4 : 0xc5) -#define MAXI_REG_VID_MIN(nr) MAXI_REG_VID(nr)+1 -#define MAXI_REG_VID_MAX(nr) MAXI_REG_VID(nr)+2 - -#define MAXI_REG_DIAG_RT1 0x2c -#define MAXI_REG_DIAG_RT2 0x2d - -#define MAXI_REG_BIOS_CTRL 0x2a - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ - - /* 0xfe: fan off, 0xff: stopped (alarm) */ - /* 19531 / val * 60 == 1171860 / val */ -#define FAN_FROM_REG(val) ((val)==0xfe ? 0 : (val)==0xff ? -1 : \ - (val)==0x00 ? -1 : (1171860 / (val))) - -static inline u8 FAN_TO_REG(long rpm) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1171860 + rpm / 2) / (rpm), 1, 254); -} - -#define TEMP_FROM_REG(val) ((val) * 5) -#define TEMP_TO_REG(val) (SENSORS_LIMIT((val+2) / 5),0,0xff) -#define PLL_FROM_REG(val) (((val) * 1000) / 32) -#define PLL_TO_REG(val) (SENSORS_LIMIT((((val) * 32 + 500) / 1000),\ - 0,0xff)) -#define VID_FROM_REG(val) ((val) ? (((val) * 27390) / 256) + 3208 : 0) -#define VID_TO_REG(val) (SENSORS_LIMIT((((val) - 3208) * 256) / 27390, \ - 0,255)) -#define ALARMS_FROM_REG(val) (val) - -/*----------------- MaxiLife'99 mailbox and token definitions ----------------*/ -/* MaxiLife mailbox data register map */ -#define MAXI_REG_MBX_STATUS 0x5a -#define MAXI_REG_MBX_CMD 0x5b -#define MAXI_REG_MBX_TOKEN_H 0x5c -#define MAXI_REG_MBX_TOKEN_L 0x5d -#define MAXI_REG_MBX_DATA 0x60 - -/* Mailbox status register definition */ -#define MAXI_STAT_IDLE 0xff -#define MAXI_STAT_OK 0x00 -#define MAXI_STAT_BUSY 0x0b -/* other values not used */ - -/* Mailbox command register opcodes */ -#define MAXI_CMD_READ 0x02 -#define MAXI_CMD_WRITE 0x03 -/* other values not used */ - -/* MaxiLife NBA Hardware monitoring tokens */ - -/* Alarm tokens (0x1xxx) */ -#define MAXI_TOK_ALARM(nr) (0x1000 + (nr)) -#define MAXI_TOK_ALARM_EVENT 0x1000 -#define MAXI_TOK_ALARM_FAN 0x1001 -#define MAXI_TOK_ALARM_TEMP 0x1002 -#define MAXI_TOK_ALARM_VID 0x1003 /* voltages */ -#define MAXI_TOK_ALARM_AVID 0x1004 /* additional voltages */ -#define MAXI_TOK_ALARM_PWR 0x1101 /* power supply glitch */ - -/* Fan status tokens (0x20xx) */ -#define MAXI_TOK_FAN(nr) (0x2000 + (nr)) -#define MAXI_TOK_FAN_CPU 0x2000 -#define MAXI_TOK_FAN_PCI 0x2001 -#define MAXI_TOK_FAN_HDD 0x2002 /* hard disk bay fan */ -#define MAXI_TOK_FAN_SINK 0x2003 /* heatsink */ - -/* Temperature status tokens (0x21xx) */ -#define MAXI_TOK_TEMP(nr) (0x2100 + (nr)) -#define MAXI_TOK_TEMP_CPU1 0x2100 -#define MAXI_TOK_TEMP_CPU2 0x2101 -#define MAXI_TOK_TEMP_PCI 0x2102 /* PCI/ambient temp */ -#define MAXI_TOK_TEMP_HDD 0x2103 /* hard disk bay temp */ -#define MAXI_TOK_TEMP_MEM 0x2104 /* mother board temp */ -#define MAXI_TOK_TEMP_CPU 0x2105 /* CPU reference temp */ - -/* Voltage status tokens (0x22xx) */ -#define MAXI_TOK_VID(nr) (0x2200 + (nr)) -#define MAXI_TOK_VID_12 0x2200 /* +12 volt */ -#define MAXI_TOK_VID_CPU1 0x2201 /* cpu 1 voltage */ -#define MAXI_TOK_VID_CPU2 0x2202 /* cpu 2 voltage */ -#define MAXI_TOK_VID_L2 0x2203 /* level 2 cache voltage */ -#define MAXI_TOK_VID_M12 0x2204 /* -12 volt */ - -/* Additive voltage status tokens (0x23xx) */ -#define MAXI_TOK_AVID(nr) (0x2300 + (nr)) -#define MAXI_TOK_AVID_15 0x2300 /* 1.5 volt */ -#define MAXI_TOK_AVID_18 0x2301 /* 1.8 volt */ -#define MAXI_TOK_AVID_25 0x2302 /* 2.5 volt */ -#define MAXI_TOK_AVID_33 0x2303 /* 3.3 volt */ -#define MAXI_TOK_AVID_5 0x2304 /* 5 volt */ -#define MAXI_TOK_AVID_M5 0x2305 /* -5 volt */ -#define MAXI_TOK_AVID_BAT 0x2306 /* battery voltage */ - -/* Threshold tokens (0x3xxx) */ -#define MAXI_TOK_MIN(token) ((token) + 0x1000) -#define MAXI_TOK_MAX(token) ((token) + 0x1800) - -/* LCD Panel (0x4xxx) */ -#define MAXI_TOK_LCD(nr) (0x4000 + (nr)) -#define MAXI_TOK_LCD_LINE1 0x4000 -#define MAXI_TOK_LCD_LINE2 0x4001 -#define MAXI_TOK_LCD_LINE3 0x4002 -#define MAXI_TOK_LCD_LINE4 0x4003 - - /* 0xfe: fan off, 0xff: stopped (alarm) */ - /* or not available */ -#define FAN99_FROM_REG(val) ((val)==0xfe ? 0 : (val)==0xff ? -1 : ((val)*39)) - - /* when no CPU2 temp is 127 (0x7f) */ -#define TEMP99_FROM_REG(val) ((val)==0x7f ? -1 : (val)==0xff ? -1 : (val)) - -#define VID99_FROM_REG(nr,val) ((val)==0xff ? 0 : \ - (nr)==1 ? ((val) * 608) : \ - (nr)==2 ? ((val) * 160) : \ - (nr)==3 ? ((val) * 160) : \ - (nr)==4 ? (val) /* no formula spcified */ : \ - (nr)==5 ? ((val) * 823 - 149140) : 0) - - -/* The following product codenames apply: - Cristal/Geronimo: HP KAYAK XU/XAs - (Dual Pentium II Slot 1, Deschutes/Klamath) - Cognac: HP KAYAK XU (Dual Xeon [Slot 2] 400/450 Mhz) - Ashaki: HP KAYAK XA (Pentium II Slot 1, monoprocessor) - NBA: New BIOS Architecture, Kayak XU800, XM600, ... */ - -enum maxi_type { cristal, cognac, ashaki, nba }; -enum sensor_type { fan, temp, vid, pll, lcd, alarm }; - -/* For each registered MaxiLife controller, we need to keep some data in - memory. It is dynamically allocated, at the same time when a new MaxiLife - client is allocated. We assume MaxiLife will only be present on the - SMBus and not on the ISA bus. */ -struct maxi_data { - struct i2c_client client; - int sysctl_id; - enum maxi_type type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 fan[4]; /* Register value */ - u8 fan_min[4]; /* Register value */ - u8 fan_speed[4]; /* Register value */ - u8 fan_div[4]; /* Static value */ - u8 temp[6]; /* Register value */ - u8 temp_max[6]; /* Static value */ - u8 temp_hyst[6]; /* Static value */ - u8 pll; /* Register value */ - u8 pll_min; /* Register value */ - u8 pll_max; /* register value */ - u8 vid[5]; /* Register value */ - u8 vid_min[5]; /* Register value */ - u8 vid_max[5]; /* Register value */ - u8 lcd[4][17]; /* Four LCD lines */ - u16 alarms; /* Register encoding, combined */ -}; - - -static int maxi_attach_adapter(struct i2c_adapter *adapter); -static int maxi_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int maxi_detach_client(struct i2c_client *client); - -static int maxi_read_value(struct i2c_client *client, u8 register); -static int maxi_read_token(struct i2c_client *client, u16 token); -#ifndef NOWRITE -static int maxi_write_value(struct i2c_client *client, u8 register, - u8 value); -#endif -static int maxi_write_token_loop(struct i2c_client *client, u16 token, - u8 len, u8 * values); - -static void maxi_update_client(struct i2c_client *client); -static void maxi99_update_client(struct i2c_client *client, - enum sensor_type sensor, int which); -static void maxi_init_client(struct i2c_client *client); - -static void maxi_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void maxi99_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void maxi_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void maxi99_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void maxi_pll(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void maxi_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void maxi99_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void maxi_lcd(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void maxi_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -/* The driver. I choose to use type i2c_driver, as at is identical to - the smbus_driver. */ -static struct i2c_driver maxi_driver = { - .name = "HP MaxiLife driver", - .id = I2C_DRIVERID_MAXILIFE, - .flags = I2C_DF_NOTIFY, - .attach_adapter = maxi_attach_adapter, - .detach_client = maxi_detach_client, -}; - -/* Default firmware version. Use module option "maxi_version" - to set desired version. Auto detect is not yet working */ -static int maxi_version = cristal; - -/* The /proc/sys entries */ - -/* -- SENSORS SYSCTL START -- */ -#define MAXI_SYSCTL_FAN1 1101 /* Rotations/min */ -#define MAXI_SYSCTL_FAN2 1102 /* Rotations/min */ -#define MAXI_SYSCTL_FAN3 1103 /* Rotations/min */ -#define MAXI_SYSCTL_FAN4 1104 /* Rotations/min */ -#define MAXI_SYSCTL_TEMP1 1201 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP2 1202 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP3 1203 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP4 1204 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP5 1205 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP6 1206 /* Degrees Celsius */ -#define MAXI_SYSCTL_PLL 1301 /* MHz */ -#define MAXI_SYSCTL_VID1 1401 /* Volts / 6.337, for nba just Volts */ -#define MAXI_SYSCTL_VID2 1402 /* Volts */ -#define MAXI_SYSCTL_VID3 1403 /* Volts */ -#define MAXI_SYSCTL_VID4 1404 /* Volts */ -#define MAXI_SYSCTL_VID5 1405 /* Volts */ -#define MAXI_SYSCTL_LCD1 1501 /* Line 1 of LCD */ -#define MAXI_SYSCTL_LCD2 1502 /* Line 2 of LCD */ -#define MAXI_SYSCTL_LCD3 1503 /* Line 3 of LCD */ -#define MAXI_SYSCTL_LCD4 1504 /* Line 4 of LCD */ -#define MAXI_SYSCTL_ALARMS 2001 /* Bitvector (see below) */ - -#define MAXI_ALARM_VID4 0x0001 -#define MAXI_ALARM_TEMP2 0x0002 -#define MAXI_ALARM_VID1 0x0004 -#define MAXI_ALARM_VID2 0x0008 -#define MAXI_ALARM_VID3 0x0010 -#define MAXI_ALARM_PLL 0x0080 -#define MAXI_ALARM_TEMP4 0x0100 -#define MAXI_ALARM_TEMP5 0x0200 -#define MAXI_ALARM_FAN1 0x1000 -#define MAXI_ALARM_FAN2 0x2000 -#define MAXI_ALARM_FAN3 0x4000 - -#define MAXI_ALARM_FAN 0x0100 /* To be used with MaxiLife'99 */ -#define MAXI_ALARM_VID 0x0200 /* The MSB specifies which sensor */ -#define MAXI_ALARM_TEMP 0x0400 /* in the alarm group failed, i.e.: */ -#define MAXI_ALARM_VADD 0x0800 /* 0x0402 = TEMP2 failed = CPU2 temp */ - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected MaxiLife processor. - This is just a template; though at first sight, you might think we - could use a statically allocated list, we need some way to get back - to the parent - which is done through one of the 'extra' fields - which are initialized when a new copy is allocated. */ -static ctl_table maxi_dir_table_template[] = { - {MAXI_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_fan}, - {MAXI_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_fan}, - {MAXI_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_fan}, - {MAXI_SYSCTL_FAN4, "fan4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_fan}, - {MAXI_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_temp}, - {MAXI_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_temp}, - {MAXI_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_temp}, - {MAXI_SYSCTL_TEMP4, "temp4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_temp}, - {MAXI_SYSCTL_TEMP5, "temp5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_temp}, - {MAXI_SYSCTL_TEMP6, "temp6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_temp}, - {MAXI_SYSCTL_PLL, "pll", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_pll}, - {MAXI_SYSCTL_VID1, "vid1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_vid}, - {MAXI_SYSCTL_VID2, "vid2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_vid}, - {MAXI_SYSCTL_VID3, "vid3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_vid}, - {MAXI_SYSCTL_VID4, "vid4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_vid}, - {MAXI_SYSCTL_VID5, "vid5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_vid}, - {MAXI_SYSCTL_LCD1, "lcd1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_lcd}, - {MAXI_SYSCTL_LCD2, "lcd2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_lcd}, - {MAXI_SYSCTL_LCD3, "lcd3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_lcd}, - {MAXI_SYSCTL_LCD4, "lcd4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_lcd}, - {MAXI_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &maxi_alarms}, - {0} -}; - -/* This function is called when: - - maxi_driver is inserted (when this module is loaded), for each - available adapter - - when a new adapter is inserted (and maxi_driver is still present) */ -static int maxi_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, maxi_detect); -} - -/* This function is called by i2c_detect */ -int maxi_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - struct i2c_client *new_client; - struct maxi_data *data; - enum maxi_type type = 0; - int i, j, err = 0; - const char *type_name = NULL, *client_name = NULL; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access maxi_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct maxi_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - /* Fill the new client structure with data */ - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &maxi_driver; - new_client->flags = 0; - - /* Now we do the remaining detection. */ - if (kind < 0) { - if (i2c_smbus_read_byte_data - (new_client, MAXI_REG_MBX_STATUS) < 0) - goto ERROR2; - } - - /* Determine the chip type - only one kind supported */ - if (kind <= 0) - kind = maxilife; - - if (kind == maxilife) { - /* Detect if the machine has a MaxiLife NBA controller. - The right way to perform this check is to do a read/modify/write - on register MbxStatus (5A): - - Read 5A (value 0 for non-NBA firmware, FF (MbxIdle on NBA-firmware) - - Write 55 on 5A, then read back 5A - Non-NBA firmware: value is 55 (reg 5A is a standard writable reg) - NBA firmaware: value is FF (write-protect on MbxStatus active) */ - int stat; - i2c_smbus_write_byte_data(new_client, MAXI_REG_MBX_STATUS, - 0x55); - stat = - i2c_smbus_read_byte_data(new_client, - MAXI_REG_MBX_STATUS); - - /*if (stat == MAXI_STAT_IDLE || stat == MAXI_STAT_OK) */ - if (stat != 0x55) - maxi_version = nba; -#ifdef AUTODETECT - else { - /* The right way to get the platform info is to read the firmware - revision from serial EEPROM (addr=0x54), at offset 0x0045. - This is a string as: - "CG 00.04" -> Cristal [XU] / Geronimo [XAs] - "CO 00.03" -> Cognac [XU] - "AS 00.01" -> Ashaki [XA] */ -#if 0 - int biosctl; - biosctl = - i2c_smbus_read_byte_data(new_client, - MAXI_REG_BIOS_CTRL); - i2c_smbus_write_byte_data(new_client, - MAXI_REG_BIOS_CTRL, - biosctl | 4); - err = eeprom_read_byte_data(adapter, 0x54, 0x45); - i2c_smbus_write_byte_data(new_client, - MAXI_REG_BIOS_CTRL, - biosctl); -#endif - int i; - char *biosmem, *bm; - bm = biosmem = ioremap(0xe0000, 0x20000); - if (biosmem) { - printk("begin of bios search\n"); - for (i = 0; i < 0x20000; i++) { - if (*bm == 'C') { - char *s = bm; - while (s && isprint(*s)) { - printk("%c", *s); - s++; - } - printk("\n"); - if (!strncmp - (bm, "CG 00.04", 8)) { - maxi_version = - cristal; - printk - ("maxilife: found MaxiLife Rev CG 00.04\n"); - break; - } - if (!strncmp - (bm, "CO 00.03", 8)) { - maxi_version = - cognac; - printk - ("maxilife: found MaxiLife Rev CO 00.03\n"); - break; - } - } - if (*bm == 'A' && *(bm + 1) == 'S') { - char *s = bm; - while (s && isprint(*s)) { - printk("%c", *s); - s++; - } - printk("\n"); - if (!strncmp - (bm, "AS 00.01", 8)) { - maxi_version = - ashaki; - printk - ("maxilife: found MaxiLife Rev AS 00.01\n"); - break; - } - } - bm++; - } - printk("end of bios search\n"); - } else - printk("could not map bios memory\n"); - } -#endif - - if (maxi_version == cristal) { - type = cristal; - type_name = "maxilife-cg"; - client_name = "HP MaxiLife Rev CG 00.04"; - printk - ("maxilife: HP KAYAK XU/XAs (Dual Pentium II Slot 1)\n"); - } else if (maxi_version == cognac) { - type = cognac; - type_name = "maxilife-co"; - client_name = "HP MaxiLife Rev CO 00.03"; - printk - ("maxilife: HP KAYAK XU (Dual Xeon Slot 2 400/450 Mhz)\n"); - } else if (maxi_version == ashaki) { - type = ashaki; - type_name = "maxilife-as"; - client_name = "HP MaxiLife Rev AS 00.01"; - printk - ("maxilife: HP KAYAK XA (Pentium II Slot 1, monoprocessor)\n"); - } else if (maxi_version == nba) { - type = nba; - type_name = "maxilife-nba"; - client_name = "HP MaxiLife NBA"; - printk("maxilife: HP KAYAK XU800/XM600\n"); - } else { -#ifdef AUTODETECT - printk - ("maxilife: Warning: probed non-maxilife chip?!? (%x)\n", - err); -#else - printk - ("maxilife: Error: specified wrong maxi_version (%d)\n", - maxi_version); -#endif - goto ERROR2; - } - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - ((struct maxi_data *) (new_client->data))->type = type; - - for (i = 0; i < 4; i++) - for (j = 0; j < 17; j++) - ((struct maxi_data *) (new_client->data))-> - lcd[i][j] = (u8) 0; - - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell i2c-core that a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR2; - - /* Register a new directory entry with module sensors */ - if ((err = i2c_register_entry(new_client, type_name, - maxi_dir_table_template, - THIS_MODULE)) < 0) - goto ERROR4; - data->sysctl_id = err; - - /* Initialize the MaxiLife chip */ - maxi_init_client(new_client); - return 0; - - /* OK, this is not exactly good programming practice, usually. - But it is very code-efficient in this case. */ - ERROR4: - i2c_detach_client(new_client); - ERROR2: - kfree(data); - ERROR0: - return err; -} - -/* This function is called whenever a client should be removed: - - maxi_driver is removed (when this module is unloaded) - - when an adapter is removed which has a maxi client (and maxi_driver - is still present). */ -static int maxi_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct maxi_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("maxilife: Client deregistration failed, client not detached.\n"); - return err; - } - kfree(client->data); - return 0; -} - -/* Read byte from specified register (-1 in case of error, value otherwise). */ -static int maxi_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -/* Read the byte value for a MaxiLife token (-1 in case of error, value otherwise */ -static int maxi_read_token(struct i2c_client *client, u16 token) -{ - u8 lowToken, highToken; - int error, value; - - lowToken = LOW(token); - highToken = HIGH(token); - - /* Set mailbox status register to idle state. */ - error = - i2c_smbus_write_byte_data(client, MAXI_REG_MBX_STATUS, - MAXI_STAT_IDLE); - if (error < 0) - return error; - - /* Check for mailbox idle state. */ - error = i2c_smbus_read_byte_data(client, MAXI_REG_MBX_STATUS); - if (error != MAXI_STAT_IDLE) - return -1; - - /* Write the most significant byte of the token we want to read. */ - error = - i2c_smbus_write_byte_data(client, MAXI_REG_MBX_TOKEN_H, - highToken); - if (error < 0) - return error; - - /* Write the least significant byte of the token we want to read. */ - error = - i2c_smbus_write_byte_data(client, MAXI_REG_MBX_TOKEN_L, - lowToken); - if (error < 0) - return error; - - /* Write the read token opcode to the mailbox. */ - error = - i2c_smbus_write_byte_data(client, MAXI_REG_MBX_CMD, - MAXI_CMD_READ); - if (error < 0) - return error; - - /* Check for transaction completion */ - do { - error = - i2c_smbus_read_byte_data(client, MAXI_REG_MBX_STATUS); - } while (error == MAXI_STAT_BUSY); - if (error != MAXI_STAT_OK) - return -1; - - /* Read the value of the token. */ - value = i2c_smbus_read_byte_data(client, MAXI_REG_MBX_DATA); - if (value == -1) - return -1; - - /* set mailbox status to idle to complete transaction. */ - error = - i2c_smbus_write_byte_data(client, MAXI_REG_MBX_STATUS, - MAXI_STAT_IDLE); - if (error < 0) - return error; - - return value; -} - -#ifndef NOWRITE -/* Write byte to specified register (-1 in case of error, 0 otherwise). */ -static int maxi_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} -#endif - -/* Write a set of len byte values to MaxiLife token (-1 in case of error, 0 otherwise). */ -int maxi_write_token_loop(struct i2c_client *client, u16 token, u8 len, - u8 * values) -{ - u8 lowToken, highToken, bCounter; - int error; - - lowToken = LOW(token); - highToken = HIGH(token); - - /* Set mailbox status register to idle state. */ - error = - i2c_smbus_write_byte_data(client, MAXI_REG_MBX_STATUS, - MAXI_STAT_IDLE); - if (error < 0) - return error; - - /* Check for mailbox idle state. */ - error = i2c_smbus_read_byte_data(client, MAXI_REG_MBX_STATUS); - if (error != MAXI_STAT_IDLE) - return -1; - - for (bCounter = 0; (bCounter < len && bCounter < 32); bCounter++) { - error = - i2c_smbus_write_byte_data(client, - (u8) (MAXI_REG_MBX_DATA + - bCounter), - values[bCounter]); - if (error < 0) - return error; - } - - /* Write the most significant byte of the token we want to read. */ - error = - i2c_smbus_write_byte_data(client, MAXI_REG_MBX_TOKEN_H, - highToken); - if (error < 0) - return error; - - /* Write the least significant byte of the token we want to read. */ - error = - i2c_smbus_write_byte_data(client, MAXI_REG_MBX_TOKEN_L, - lowToken); - if (error < 0) - return error; - - /* Write the write token opcode to the mailbox. */ - error = - i2c_smbus_write_byte_data(client, MAXI_REG_MBX_CMD, - MAXI_CMD_WRITE); - if (error < 0) - return error; - - /* Check for transaction completion */ - do { - error = - i2c_smbus_read_byte_data(client, MAXI_REG_MBX_STATUS); - } while (error == MAXI_STAT_BUSY); - if (error != MAXI_STAT_OK) - return -1; - - /* set mailbox status to idle to complete transaction. */ - return i2c_smbus_write_byte_data(client, MAXI_REG_MBX_STATUS, - MAXI_STAT_IDLE); -} - -/* Called when we have found a new MaxiLife. */ -static void maxi_init_client(struct i2c_client *client) -{ - struct maxi_data *data = client->data; - - if (data->type == nba) { - strcpy(data->lcd[2], " Linux MaxiLife"); - maxi_write_token_loop(client, MAXI_TOK_LCD(2), - strlen(data->lcd[2]) + 1, - data->lcd[2]); - } -} - -static void maxi_update_client(struct i2c_client *client) -{ - struct maxi_data *data = client->data; - int i; - - if (data->type == nba) { - printk - ("maxi_update_client should never be called by nba\n"); - return; - } - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("maxilife: Starting MaxiLife update\n"); -#endif - for (i = 0; i < 5; i++) - data->temp[i] = - maxi_read_value(client, MAXI_REG_TEMP(i)); - switch (data->type) { - case cristal: - data->temp[0] = 0; /* not valid */ - data->temp_max[0] = 0; - data->temp_hyst[0] = 0; - data->temp_max[1] = 110; /* max PCI slot temp */ - data->temp_hyst[1] = 100; - data->temp_max[2] = 120; /* max BX chipset temp */ - data->temp_hyst[2] = 110; - data->temp_max[3] = 100; /* max HDD temp */ - data->temp_hyst[3] = 90; - data->temp_max[4] = 120; /* max CPU temp */ - data->temp_hyst[4] = 110; - break; - - case cognac: - data->temp_max[0] = 120; /* max CPU1 temp */ - data->temp_hyst[0] = 110; - data->temp_max[1] = 110; /* max PCI slot temp */ - data->temp_hyst[1] = 100; - data->temp_max[2] = 120; /* max CPU2 temp */ - data->temp_hyst[2] = 110; - data->temp_max[3] = 100; /* max HDD temp */ - data->temp_hyst[3] = 90; - data->temp_max[4] = 120; /* max reference CPU temp */ - data->temp_hyst[4] = 110; - break; - - case ashaki: - data->temp[0] = 0; /* not valid */ - data->temp_max[0] = 0; - data->temp_hyst[0] = 0; - data->temp_max[1] = 110; /* max PCI slot temp */ - data->temp_hyst[1] = 100; - data->temp[2] = 0; /* not valid */ - data->temp_max[2] = 0; - data->temp_hyst[2] = 0; - data->temp_max[3] = 100; /* max HDD temp */ - data->temp_hyst[3] = 90; - data->temp_max[4] = 120; /* max CPU temp */ - data->temp_hyst[4] = 110; - break; - - default: - printk("maxilife: Unknown MaxiLife chip\n"); - } - data->temp[5] = 0; /* only used by MaxiLife'99 */ - data->temp_max[5] = 0; - data->temp_hyst[5] = 0; - - for (i = 0; i < 3; i++) { - data->fan[i] = - maxi_read_value(client, MAXI_REG_FAN(i)); - data->fan_speed[i] = - maxi_read_value(client, MAXI_REG_FAN_SPEED(i)); - data->fan_div[i] = 4; - if (data->type == ashaki) - data->fan_min[i] = - maxi_read_value(client, - MAXI_REG_FAN_MINAS(i)); - else - data->fan_min[i] = - maxi_read_value(client, - MAXI_REG_FAN_MIN(i)); - } - data->fan[3] = 0xff; /* only used by MaxiLife'99 */ - data->fan_speed[3] = 0; - data->fan_div[3] = 4; /* avoid possible /0 */ - data->fan_min[3] = 0; - - data->pll = maxi_read_value(client, MAXI_REG_PLL); - data->pll_min = maxi_read_value(client, MAXI_REG_PLL_MIN); - data->pll_max = maxi_read_value(client, MAXI_REG_PLL_MAX); - - for (i = 0; i < 4; i++) { - data->vid[i] = - maxi_read_value(client, MAXI_REG_VID(i)); - data->vid_min[i] = - maxi_read_value(client, MAXI_REG_VID_MIN(i)); - data->vid_max[i] = - maxi_read_value(client, MAXI_REG_VID_MAX(i)); - } - switch (data->type) { - case cristal: - data->vid[3] = 0; /* no voltage cache L2 */ - data->vid_min[3] = 0; - data->vid_max[3] = 0; - break; - - case cognac: - break; - - case ashaki: - data->vid[1] = 0; /* no voltage CPU 2 */ - data->vid_min[1] = 0; - data->vid_max[1] = 0; - data->vid[3] = 0; /* no voltage cache L2 */ - data->vid_min[3] = 0; - data->vid_max[3] = 0; - break; - - default: - printk("maxilife: Unknown MaxiLife chip\n"); - } - data->vid[4] = 0; /* only used by MaxliLife'99 */ - data->vid_min[4] = 0; - data->vid_max[4] = 0; - - data->alarms = maxi_read_value(client, MAXI_REG_DIAG_RT1) + - (maxi_read_value(client, MAXI_REG_DIAG_RT2) << 8); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -void maxi99_update_client(struct i2c_client *client, - enum sensor_type sensor, int which) -{ - static unsigned long last_updated[6][6]; /* sensor, which */ - struct maxi_data *data = client->data; - - down(&data->update_lock); - - /*maxi_write_token_loop(client, MAXI_TOK_LCD_LINE3, 13, "Linux 2.2.13"); */ - - if ((jiffies - last_updated[sensor][which] > 2 * HZ) || - (jiffies < last_updated[sensor][which] - || !last_updated[sensor][which])) { - - int tmp, i; - - switch (sensor) { - case fan: - for (i = 0; i < 4; i++) { - if (i == which) { - tmp = - maxi_read_token(client, - MAXI_TOK_FAN - (i)); - data->fan[i] = - maxi_read_token(client, - MAXI_TOK_FAN - (i)); - data->fan_speed[i] = - maxi_read_token(client, - MAXI_TOK_MAX - (MAXI_TOK_FAN - (i))); - data->fan_div[i] = 1; - data->fan_min[i] = 0; - } - } - break; - - case temp: - for (i = 0; i < 6; i++) { - if (i == which) { - data->temp[i] = - maxi_read_token(client, - MAXI_TOK_TEMP - (i)); - data->temp_max[i] = - maxi_read_token(client, - MAXI_TOK_MAX - (MAXI_TOK_TEMP - (i))); - data->temp_hyst[i] = - data->temp_max[i] - 5; - } - } - break; - - case vid: - for (i = 0; i < 5; i++) { - if (i == which) { - data->vid[i] = - maxi_read_token(client, - MAXI_TOK_VID - (i)); - data->vid_min[i] = - maxi_read_token(client, - MAXI_TOK_MIN - (MAXI_TOK_VID - (i))); - data->vid_max[i] = - maxi_read_token(client, - MAXI_TOK_MAX - (MAXI_TOK_VID - (i))); - } - } - break; - - case pll: - data->pll = 0; - data->pll_min = 0; - data->pll_max = 0; - break; - - case alarm: - data->alarms = - (maxi_read_token(client, MAXI_TOK_ALARM_EVENT) - << 8); - if (data->alarms) - data->alarms += - data->alarms == - (1 << 8) ? maxi_read_token(client, - MAXI_TOK_ALARM_FAN) - : data->alarms == - (2 << 8) ? maxi_read_token(client, - MAXI_TOK_ALARM_VID) - : data->alarms == - (4 << 8) ? maxi_read_token(client, - MAXI_TOK_ALARM_TEMP) - : data->alarms == - (8 << 8) ? maxi_read_token(client, - MAXI_TOK_ALARM_FAN) - : 0; - break; - - default: - printk("maxilife: Unknown sensor type\n"); - } - - last_updated[sensor][which] = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the data - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void maxi_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct maxi_data *data = client->data; - int nr; - - if (data->type == nba) { - maxi99_fan(client, operation, ctl_name, nrels_mag, - results); - return; - } - - nr = ctl_name - MAXI_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - maxi_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1]); - results[1] = data->fan_div[nr - 1]; - results[2] = FAN_FROM_REG(data->fan[nr - 1]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { -#ifndef NOWRITE - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = FAN_TO_REG(results[0]); - maxi_write_value(client, MAXI_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } -#endif - } -} - -void maxi99_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct maxi_data *data = client->data; - int nr; - - nr = ctl_name - MAXI_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - maxi99_update_client(client, fan, nr - 1); - results[0] = FAN99_FROM_REG(data->fan_min[nr - 1]); /* min rpm */ - results[1] = data->fan_div[nr - 1]; /* divisor */ - results[2] = FAN99_FROM_REG(data->fan[nr - 1]); /* rpm */ - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { -#ifndef NOWRITE - /* still to do */ - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = FAN_TO_REG(results[0]); - maxi_write_value(client, MAXI_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } -#endif - } -} - -void maxi_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct maxi_data *data = client->data; - int nr; - - if (data->type == nba) { - maxi99_temp(client, operation, ctl_name, nrels_mag, - results); - return; - } - - nr = ctl_name - MAXI_SYSCTL_TEMP1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - maxi_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_max[nr - 1]); - results[1] = TEMP_FROM_REG(data->temp_hyst[nr - 1]); - results[2] = TEMP_FROM_REG(data->temp[nr - 1]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - /* temperature range can not be changed */ - } -} - -void maxi99_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct maxi_data *data = client->data; - int nr; - - nr = ctl_name - MAXI_SYSCTL_TEMP1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - maxi99_update_client(client, temp, nr - 1); - results[0] = TEMP99_FROM_REG(data->temp_max[nr - 1]); - results[1] = TEMP99_FROM_REG(data->temp_hyst[nr - 1]); - results[2] = TEMP99_FROM_REG(data->temp[nr - 1]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - /* temperature range can not be changed */ - } -} - -void maxi_pll(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct maxi_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - if (data->type == nba) - maxi99_update_client(client, pll, 0); - else - maxi_update_client(client); - results[0] = PLL_FROM_REG(data->pll_min); - results[1] = PLL_FROM_REG(data->pll_max); - results[2] = PLL_FROM_REG(data->pll); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { -#ifndef NOWRITE - if (*nrels_mag >= 1) { - data->pll_min = PLL_TO_REG(results[0]); - maxi_write_value(client, MAXI_REG_PLL_MIN, - data->pll_min); - } - if (*nrels_mag >= 2) { - data->pll_max = PLL_TO_REG(results[1]); - maxi_write_value(client, MAXI_REG_PLL_MAX, - data->pll_max); - } -#endif - } -} - -void maxi_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct maxi_data *data = client->data; - int nr; - - if (data->type == nba) { - maxi99_vid(client, operation, ctl_name, nrels_mag, - results); - return; - } - - nr = ctl_name - MAXI_SYSCTL_VID1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 4; - else if (operation == SENSORS_PROC_REAL_READ) { - maxi_update_client(client); - results[0] = VID_FROM_REG(data->vid_min[nr - 1]); - results[1] = VID_FROM_REG(data->vid_max[nr - 1]); - results[2] = VID_FROM_REG(data->vid[nr - 1]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { -#ifndef NOWRITE - if (*nrels_mag >= 1) { - data->vid_min[nr - 1] = VID_TO_REG(results[0]); - maxi_write_value(client, MAXI_REG_VID_MIN(nr), - data->vid_min[nr - 1]); - } - if (*nrels_mag >= 2) { - data->vid_max[nr - 1] = VID_TO_REG(results[1]); - maxi_write_value(client, MAXI_REG_VID_MAX(nr), - data->vid_max[nr - 1]); - } -#endif - } -} - -void maxi99_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct maxi_data *data = client->data; - int nr = ctl_name - MAXI_SYSCTL_VID1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 4; - else if (operation == SENSORS_PROC_REAL_READ) { - maxi99_update_client(client, vid, nr - 1); - results[0] = VID99_FROM_REG(nr, data->vid_min[nr - 1]); - results[1] = VID99_FROM_REG(nr, data->vid_max[nr - 1]); - results[2] = VID99_FROM_REG(nr, data->vid[nr - 1]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { -#ifndef NOWRITE - /* still to do */ - if (*nrels_mag >= 1) { - data->vid_min[nr - 1] = VID_TO_REG(results[0]); - maxi_write_value(client, MAXI_REG_VID_MIN(nr), - data->vid_min[nr - 1]); - } - if (*nrels_mag >= 2) { - data->vid_max[nr - 1] = VID_TO_REG(results[1]); - maxi_write_value(client, MAXI_REG_VID_MAX(nr), - data->vid_max[nr - 1]); - } -#endif - } -} - -void maxi_lcd(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - /* Allows writing and reading from LCD display */ - - struct maxi_data *data = client->data; - int nr; - - if (data->type != nba) - return; - - nr = ctl_name - MAXI_SYSCTL_LCD1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = *((long *) &data->lcd[nr - 1][0]); - results[1] = *((long *) &data->lcd[nr - 1][4]); - results[2] = *((long *) &data->lcd[nr - 1][8]); - results[3] = *((long *) &data->lcd[nr - 1][12]); - *nrels_mag = 4; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - /* - Writing a string to line 3 of the LCD can be done like: - echo -n "Linux MaxiLife" | od -A n -l > \ - /proc/sys/dev/sensors/maxilife-nba-i2c-0-14/lcd3 - */ - if (*nrels_mag >= 1) - *((long *) &data->lcd[nr - 1][0]) = results[0]; - if (*nrels_mag >= 2) - *((long *) &data->lcd[nr - 1][4]) = results[1]; - if (*nrels_mag >= 3) - *((long *) &data->lcd[nr - 1][8]) = results[2]; - if (*nrels_mag >= 4) - *((long *) &data->lcd[nr - 1][12]) = results[3]; - maxi_write_token_loop(client, MAXI_TOK_LCD(nr - 1), - strlen(data->lcd[nr - 1]) + 1, - data->lcd[nr - 1]); -#if 0 - if (*nrels_mag >= 1) - printk("nr=%d, result[0] = %.4s\n", nr, - (char *) &results[0]); - if (*nrels_mag >= 2) - printk("nr=%d, result[1] = %.4s\n", nr, - (char *) &results[1]); - if (*nrels_mag >= 3) - printk("nr=%d, result[2] = %.4s\n", nr, - (char *) &results[2]); - if (*nrels_mag >= 4) - printk("nr=%d, result[3] = %.4s\n", nr, - (char *) &results[3]); -#endif - } - -} - -void maxi_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct maxi_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - if (data->type == nba) - maxi99_update_client(client, alarm, 0); - else - maxi_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -static int __init sm_maxilife_init(void) -{ - printk("maxilife: Version %s (lm_sensors %s (%s))\n", version_str, - LM_VERSION, LM_DATE); - return i2c_add_driver(&maxi_driver); -} - -static void __exit sm_maxilife_exit(void) -{ - i2c_del_driver(&maxi_driver); -} - - - -MODULE_AUTHOR("Fons Rademakers "); -MODULE_DESCRIPTION("HP MaxiLife driver"); -MODULE_PARM(maxi_version, "i"); -MODULE_PARM_DESC(maxi_version, "MaxiLife firmware version"); - -module_init(sm_maxilife_init); -module_exit(sm_maxilife_exit); diff --git a/kernel/chips/mic74.c b/kernel/chips/mic74.c deleted file mode 100644 index b04a6bbe..00000000 --- a/kernel/chips/mic74.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - mic74.c - Intended to become part of lm_sensors, Linux - kernel modules for hardware monitoring - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* Supports Micrel MIC74 */ - -/* - A couple notes about the MIC74: -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x20, 0x27, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(mic74); - -/* The mic74 registers */ - -#define MIC74_REG_CONFIG 0x00 -#define MIC74_REG_DATA_DIR 0x01 -#define MIC74_REG_OUT_CFG 0x02 -#define MIC74_REG_STATUS 0x03 -#define MIC74_REG_INT_MASK 0x04 -#define MIC74_REG_DATA 0x05 -#define MIC74_REG_FAN_SPEED 0x06 - -/* Initial values */ -/* All registers are 0, except for MIC74_REG_DATA which is 0xFF */ - -/* For each registered MIC74, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new mic74 client is - allocated. */ -struct mic74_data { - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 config; /* Register value */ - u8 dataDir; /* Register value */ - u8 outCfg; /* Register value */ - u8 status; /* Register value */ - u8 intMask; /* Register value */ - u8 data; /* Register value */ - u8 fanSpeed; /* Register value */ -}; - -static int mic74_attach_adapter(struct i2c_adapter *adapter); -static int mic74_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int mic74_detach_client(struct i2c_client *client); - -static int mic74_read_value(struct i2c_client *client, u8 register); -static int mic74_write_value(struct i2c_client *client, u8 register, - u8 value); -static void mic74_update_client(struct i2c_client *client); -static void mic74_init_client(struct i2c_client *client); - -static void mic74_reg_rw(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -static void mic74_reg_ro(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); - -/* I choose here for semi-static MIC74 allocation. Complete dynamic - allocation could also be used; the code needed for this would probably - take more memory than the datastructure takes now. */ -static int mic74_id; - -static struct i2c_driver mic74_driver = { - .name = "MIC74 sensor driver", - .flags = I2C_DF_NOTIFY, - .attach_adapter = mic74_attach_adapter, - .detach_client = mic74_detach_client -}; - -/* -- SENSORS SYSCTL START -- */ -#define MIC74_SYSCTL_REG0 1000 -#define MIC74_SYSCTL_REG1 1001 -#define MIC74_SYSCTL_REG2 1002 -#define MIC74_SYSCTL_REG3 1003 -#define MIC74_SYSCTL_REG4 1004 -#define MIC74_SYSCTL_REG5 1005 -#define MIC74_SYSCTL_REG6 1006 -/* -- SENSORS SYSCTL END -- */ - -/* The /proc/sys entries */ -/* These files are created for each detected MIC74. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table mic74_dir_table_template[] = { - {MIC74_SYSCTL_REG0, /* ctl_name */ - "dev_cfg", /* procname */ - NULL, /* data */ - 0, /* maxlen */ - 0644, /* mode */ - NULL, /* child */ - &i2c_proc_real, /* proc_handler */ - &i2c_sysctl_real, /* strategy */ - NULL, /* de */ - &mic74_reg_rw }, /* extra1, extra2 is by default NULL? */ - {MIC74_SYSCTL_REG1, "dir", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &mic74_reg_rw }, - {MIC74_SYSCTL_REG2, "out_cfg", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &mic74_reg_rw }, - {MIC74_SYSCTL_REG3, "status", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &mic74_reg_ro }, - {MIC74_SYSCTL_REG4, "int_mask", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &mic74_reg_rw }, - {MIC74_SYSCTL_REG5, "data", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &mic74_reg_rw }, - {MIC74_SYSCTL_REG6, "fan_speed", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &mic74_reg_rw }, - {0} -}; - -int mic74_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, mic74_detect); -} - -static int mic74_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct mic74_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access mic74_{read,write}_value. */ - - if (!(new_client = kmalloc(sizeof(struct i2c_client) + - sizeof(struct mic74_data), - GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - data = (struct mic74_data *) (new_client + 1); - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &mic74_driver; - new_client->flags = 0; -#ifdef CONFIG_AMAZON - /* make sure we can search for the client later */ - new_client->flags |= I2C_CLIENT_ALLOW_USE; -#endif - - /* Determine the chip type - only one kind */ - if (kind <= 0) - kind = mic74; - - if (kind == mic74) { - type_name = "mic74"; - client_name = "MIC74 chip"; - } - else { - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - - new_client->id = mic74_id++; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - mic74_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the MIC74 chip */ - mic74_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(new_client); - ERROR0: - printk("mic74.o: mic74_detect failed\n"); - return err; -} - -int mic74_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct mic74_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("mic74.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client); - return 0; -} - -int mic74_read_value(struct i2c_client *client, u8 reg) -{ - return 0xFF & i2c_smbus_read_byte_data(client, reg); -} - -int mic74_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* Called when we have found a new MIC74. */ -void mic74_init_client(struct i2c_client *client) -{ - /* don't init, defaults are fine */ -} - -void mic74_update_client(struct i2c_client *client) -{ - struct mic74_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ) || - (jiffies < data->last_updated) || - !data->valid) { - -#ifdef DEBUG - printk("Starting mic74 update\n"); -#endif - data->config = mic74_read_value(client, MIC74_REG_CONFIG); - data->dataDir = mic74_read_value(client, MIC74_REG_DATA_DIR); - data->outCfg = mic74_read_value(client, MIC74_REG_OUT_CFG); - data->status = mic74_read_value(client, MIC74_REG_STATUS); - data->intMask = mic74_read_value(client, MIC74_REG_INT_MASK); - data->data = mic74_read_value(client, MIC74_REG_DATA); - data->fanSpeed = mic74_read_value(client, MIC74_REG_FAN_SPEED); - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void mic74_reg_rw(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct mic74_data *data = client->data; - - int nr = ctl_name - MIC74_SYSCTL_REG0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - - mic74_update_client(client); - - switch (nr) { - case 0: - results[0] = data->config; - break; - case 1: - results[0] = data->dataDir; - break; - case 2: - results[0] = data->outCfg; - break; - case 3: - results[0] = data->status; - break; - case 4: - results[0] = data->intMask; - break; - case 5: - results[0] = data->data; - break; - case 6: - results[0] = data->fanSpeed; - break; - } - - *nrels_mag = 1; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - - if (*nrels_mag >= 1) - mic74_write_value(client, - (u8)nr, - (u8)(results[0] & 0xFF)); - } -} - -/* This is identical to the above except that it has now - WRITE code and it calls the _rw routine above for a READ */ -void mic74_reg_ro(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - - mic74_reg_rw(client, operation, ctl_name, - nrels_mag, results); - *nrels_mag = 1; - } -} - -static int __init sensors_mic74_init(void) -{ - printk("mic74.o version %s (%s)\n", LM_VERSION, LM_DATE); - return(i2c_add_driver(&mic74_driver)); -} - -static void __init mic74_cleanup(void) -{ - i2c_del_driver(&mic74_driver); -} - -MODULE_AUTHOR("zebo25/MDS"); -MODULE_DESCRIPTION("MIC74 driver"); - -module_init(sensors_mic74_init); -module_exit(mic74_cleanup); diff --git a/kernel/chips/mtp008.c b/kernel/chips/mtp008.c deleted file mode 100644 index 2d1d9de7..00000000 --- a/kernel/chips/mtp008.c +++ /dev/null @@ -1,1098 +0,0 @@ -/* - mtp008.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (C) 2001, 2004 Kris Van Hees - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = {SENSORS_I2C_END}; -static unsigned short normal_i2c_range[] = {0x2c, 0x2e, SENSORS_I2C_END}; -static unsigned int normal_isa[] = {SENSORS_ISA_END}; -static unsigned int normal_isa_range[] = {SENSORS_ISA_END}; - -/* Insmod parameters */ -SENSORS_INSMOD_1(mtp008); - -/* The MTP008 registers */ -/* in0 .. in6 */ -#define MTP008_REG_IN(nr) (0x20 + (nr)) -#define MTP008_REG_IN_MAX(nr) (0x2b + (nr) * 2) -#define MTP008_REG_IN_MIN(nr) (0x2c + (nr) * 2) - -/* temp1 */ -#define MTP008_REG_TEMP 0x27 -#define MTP008_REG_TEMP_MAX 0x39 -#define MTP008_REG_TEMP_MIN 0x3a - -/* fan1 .. fan3 */ -#define MTP008_REG_FAN(nr) (0x27 + (nr)) -#define MTP008_REG_FAN_MIN(nr) (0x3a + (nr)) - -#define MTP008_REG_CONFIG 0x40 -#define MTP008_REG_INT_STAT1 0x41 -#define MTP008_REG_INT_STAT2 0x42 - -#define MTP008_REG_SMI_MASK1 0x43 -#define MTP008_REG_SMI_MASK2 0x44 - -#define MTP008_REG_NMI_MASK1 0x45 -#define MTP008_REG_NMI_MASK2 0x46 - -#define MTP008_REG_VID_FANDIV 0x47 - -#define MTP008_REG_I2C_ADDR 0x48 - -#define MTP008_REG_RESET_VID4 0x49 - -#define MTP008_REG_OVT_PROP 0x50 - -#define MTP008_REG_BEEP_CTRL1 0x51 -#define MTP008_REG_BEEP_CTRL2 0x52 - -/* pwm1 .. pwm3 nr range 1-3 */ -#define MTP008_REG_PWM_CTRL(nr) (0x52 + (nr)) - -#define MTP008_REG_PIN_CTRL1 0x56 -#define MTP008_REG_PIN_CTRL2 0x57 - -#define MTP008_REG_CHIPID 0x58 - -/* - * Pin control register configuration constants. - */ -#define MTP008_CFG_VT1_PII 0x08 -#define MTP008_CFG_VT2_AIN 0x00 -#define MTP008_CFG_VT2_VT 0x03 -#define MTP008_CFG_VT2_PII 0x04 -#define MTP008_CFG_VT2_MASK 0x06 -#define MTP008_CFG_VT3_VT 0x01 - -/* sensor pin types */ -#define VOLTAGE 1 -#define THERMISTOR 2 -#define PIIDIODE 3 - -/* - * Conversion routines and macros. Limit checking is only done on - * the TO_REG variants. - * - * Note that IN values are expressed as 100 times the actual voltage to avoid - * having to use floating point values. As such, IN values are between 0 and - * 409 (0V to 4.096V). - */ -#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8) / 16), 0, 255)) -#define IN_FROM_REG(val) (((val) * 16 + 5) / 10) - -/* - * The fan cotation count (as stored in the register) is calculated using the - * following formula: - * count = (22.5K * 60) / (rpm * div) = 1350000 / (rpm * div) - * and the rpm is therefore: - * rpm = 1350000 / (count * div) - */ -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - - return SENSORS_LIMIT( - (1350000 + rpm * div / 2) / (rpm * div), - 1, 254 - ); -} - -#define FAN_FROM_REG(val, div) ((val) == 0 ? -1 \ - : (val) == 255 ? 0 \ - : 1350000 / \ - ((val) * (div)) \ - ) - -/* - * Temperatures are stored as two's complement values of the Celsius value. It - * actually uses 10 times the Celsius value to avoid using floating point - * values. - */ -#define TEMP_TO_REG(val) ( \ - (val) < 0 \ - ? SENSORS_LIMIT(((val) - 5) / 10, 0, 255) \ - : SENSORS_LIMIT(((val) + 5) / 10, 0, 255) \ - ) -#define TEMP_FROM_REG(val) ( \ - ( \ - (val) > 0x80 ? (val) - 0x100 \ - : (val) \ - ) * 10 \ - ) - -/* - * VCORE voltage: - * 0x00 to 0x0f = 2.05 to 1.30 (0.05 per unit) - * 0x10 to 0x1e = 3.50 to 2.10 (0.10 per unit) - * 0x1f = No CPU - */ -#define VID_FROM_REG(val) ((val) == 0x1f \ - ? 0 \ - : (val) < 0x10 ? 205 - (val) * 5 \ - : 510 - (val) * 10) - -/* - * Fan divider. - */ -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val) == 8 ? 3 \ - : (val) == 4 ? 2 \ - : (val) == 2 ? 1 \ - : 0) - -/* - * Alarms (interrupt status). - */ -#define ALARMS_FROM_REG(val) (val) - -/* - * Beep controls. - */ -#define BEEPS_FROM_REG(val) (val) -#define BEEPS_TO_REG(val) (val) - -/* - * PWM control. nr range 1 to 3 - */ -#define PWM_FROM_REG(val) (val) -#define PWM_TO_REG(val) (val) -#define PWMENABLE_FROM_REG(nr, val) (((val) >> ((nr) + 3)) & 1) - -/* - * For each registered MTP008, we need to keep some data in memory. The - * structure itself is dynamically allocated, at the same time when a new - * mtp008 client is allocated. - */ -struct mtp008_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[7]; /* Register value */ - u8 in_max[7]; /* Register value */ - u8 in_min[7]; /* Register value */ - u8 temp; /* Register value */ - u8 temp_max; /* Register value */ - u8 temp_min; /* Register value */ - u8 fan[3]; /* Register value */ - u8 fan_min[3]; /* Register value */ - u8 vid; /* Register encoding */ - u8 fan_div[3]; /* Register encoding */ - u16 alarms; /* Register encoding */ - u16 beeps; /* Register encoding */ - u8 pwm[4]; /* Register value */ - u8 sens[3]; /* 1 = Analog input, - 2 = Thermistor, - 3 = PII/Celeron diode */ - u8 pwmenable; /* Register 0x57 value */ -}; - -static int mtp008_attach_adapter(struct i2c_adapter *adapter); -static int mtp008_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int mtp008_detach_client(struct i2c_client *client); - -static int mtp008_read_value(struct i2c_client *client, u8 register); -static int mtp008_write_value(struct i2c_client *client, u8 register, u8 value); -static void mtp008_update_client(struct i2c_client *client); -static void mtp008_init_client(struct i2c_client *client); - -static void mtp008_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_temp_add(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_beep(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_sens(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void mtp008_getsensortype(struct mtp008_data *data, u8 inp); - -static struct i2c_driver mtp008_driver = -{ - .name = "MTP008 sensor driver", - .id = I2C_DRIVERID_MTP008, - .flags = I2C_DF_NOTIFY, - .attach_adapter = mtp008_attach_adapter, - .detach_client = mtp008_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define MTP008_SYSCTL_IN0 1000 /* Volts * 100 */ -#define MTP008_SYSCTL_IN1 1001 -#define MTP008_SYSCTL_IN2 1002 -#define MTP008_SYSCTL_IN3 1003 -#define MTP008_SYSCTL_IN4 1004 -#define MTP008_SYSCTL_IN5 1005 -#define MTP008_SYSCTL_IN6 1006 -#define MTP008_SYSCTL_FAN1 1101 /* Rotations/min */ -#define MTP008_SYSCTL_FAN2 1102 -#define MTP008_SYSCTL_FAN3 1103 -#define MTP008_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define MTP008_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define MTP008_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ -#define MTP008_SYSCTL_VID 1300 /* Volts * 100 */ -#define MTP008_SYSCTL_PWM1 1401 -#define MTP008_SYSCTL_PWM2 1402 -#define MTP008_SYSCTL_PWM3 1403 -#define MTP008_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ -#define MTP008_SYSCTL_SENS2 1502 -#define MTP008_SYSCTL_SENS3 1503 -#define MTP008_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define MTP008_SYSCTL_ALARMS 2001 /* bitvector */ -#define MTP008_SYSCTL_BEEP 2002 /* bitvector */ - -#define MTP008_ALARM_IN0 0x0001 -#define MTP008_ALARM_IN1 0x0002 -#define MTP008_ALARM_IN2 0x0004 -#define MTP008_ALARM_IN3 0x0008 -#define MTP008_ALARM_IN4 0x0100 -#define MTP008_ALARM_IN5 0x0200 -#define MTP008_ALARM_IN6 0x0400 -#define MTP008_ALARM_FAN1 0x0040 -#define MTP008_ALARM_FAN2 0x0080 -#define MTP008_ALARM_FAN3 0x0800 -#define MTP008_ALARM_TEMP1 0x0010 -#define MTP008_ALARM_TEMP2 0x0100 -#define MTP008_ALARM_TEMP3 0x0200 - -/* -- SENSORS SYSCTL END -- */ - -/* The /proc/sys entries */ -/* These files are created for each detected chip. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ - -static ctl_table mtp008_dir_table_template[] = -{ - {MTP008_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_in}, - {MTP008_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_in}, - {MTP008_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_in}, - {MTP008_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_in}, - {MTP008_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_in}, - {MTP008_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_in}, - {MTP008_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_in}, - {MTP008_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_fan}, - {MTP008_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_fan}, - {MTP008_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_fan}, - {MTP008_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_temp}, - {MTP008_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_temp_add}, - {MTP008_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_temp_add}, - {MTP008_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_vid}, - {MTP008_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_fan_div}, - {MTP008_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_alarms}, - {MTP008_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_beep}, - {MTP008_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_pwm}, - {MTP008_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_pwm}, - {MTP008_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_pwm}, - {MTP008_SYSCTL_SENS1, "sensor1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_sens}, - {MTP008_SYSCTL_SENS2, "sensor2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_sens}, - {MTP008_SYSCTL_SENS3, "sensor3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &mtp008_sens}, - {0} -}; - -/* This function is called when: - * mtp008_driver is inserted (when this module is loaded), for each available - * adapter when a new adapter is inserted (and mtp008_driver is still present) - */ -static int mtp008_attach_adapter(struct i2c_adapter *adapter) -{ - struct i2c_client_address_data mtp008_addr_data; - - mtp008_addr_data.normal_i2c = addr_data.normal_i2c; - mtp008_addr_data.normal_i2c_range = addr_data.normal_i2c_range; - mtp008_addr_data.probe = addr_data.probe; - mtp008_addr_data.probe_range = addr_data.probe_range; - mtp008_addr_data.ignore = addr_data.ignore; - mtp008_addr_data.ignore_range = addr_data.ignore_range; - mtp008_addr_data.force = addr_data.forces->force; - - return i2c_probe(adapter, &mtp008_addr_data, mtp008_detect); -} - -int mtp008_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - const char *type_name = ""; - const char *client_name = ""; - int is_isa, err, sysid; - struct i2c_client *new_client; - struct mtp008_data *data; - - err = 0; - - is_isa = i2c_is_isa_adapter(adapter); - if (is_isa || - !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* - * We presume we have a valid client. We now create the client - * structure, even though we cannot fill it completely yet. But it - * allows us to use mtp008_(read|write)_value(). - */ - if (!(data = kmalloc(sizeof(struct mtp008_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &mtp008_driver; - new_client->flags = 0; - - /* - * Remaining detection. - */ - if (kind < 0) { - if (mtp008_read_value(new_client, MTP008_REG_CHIPID) != 0xac) - goto ERROR1; - } - /* - * Fill in the remaining client fields and put it into the global list. - */ - type_name = "mtp008"; - client_name = "MTP008 chip"; - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* - * Tell the I2C layer that a new client has arrived. - */ - if ((err = i2c_attach_client(new_client))) - goto ERROR1; - - /* - * Register a new directory entry with the sensors module. - */ - if ((sysid = i2c_register_entry(new_client, type_name, - mtp008_dir_table_template, - THIS_MODULE)) < 0) { - err = sysid; - goto ERROR2; - } - data->sysctl_id = sysid; - - /* - * Initialize the MTP008 chip. - */ - mtp008_init_client(new_client); - - return 0; - - /* - * Error handling. Bad programming practise but very code efficient. - */ - ERROR2: - i2c_detach_client(new_client); - ERROR1: - kfree(data); - - ERROR0: - return err; -} - -static int mtp008_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry( - ((struct mtp008_data *) (client->data))->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk("mtp008.o: Deregistration failed, " - "client not detached.\n"); - return err; - } - kfree(client->data); - - return 0; -} - - -static int mtp008_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg) & 0xff; -} - -static int mtp008_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -/* Called when we have found a new MTP008. */ -static void mtp008_init_client(struct i2c_client *client) -{ - u8 save1, save2; - struct mtp008_data *data; - - data = client->data; - - /* - * Initialize the Myson MTP008 hardware monitoring chip. - * Save the pin settings that the BIOS hopefully set. - */ - save1 = mtp008_read_value(client, MTP008_REG_PIN_CTRL1); - save2 = mtp008_read_value(client, MTP008_REG_PIN_CTRL2); - mtp008_write_value(client, MTP008_REG_CONFIG, - (mtp008_read_value(client, MTP008_REG_CONFIG) & 0x7f) | 0x80); - mtp008_write_value(client, MTP008_REG_PIN_CTRL1, save1); - mtp008_write_value(client, MTP008_REG_PIN_CTRL2, save2); - - mtp008_getsensortype(data, save2); - - - /* - * Start monitoring. - */ - mtp008_write_value( - client, MTP008_REG_CONFIG, - (mtp008_read_value(client, MTP008_REG_CONFIG) & 0xf7) | 0x01 - ); -} - -static void mtp008_update_client(struct i2c_client *client) -{ - int i; - u8 inp; - struct mtp008_data *data; - - data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { -#ifdef DEBUG - printk("Starting MTP008 update\n"); -#endif - - /* - * Read in the analog inputs. We're reading AIN4 and AIN5 as - * regular analog inputs, even though they may have been - * configured as temperature readings instead. Interpretation - * of these values is done elsewhere. - */ - for (i = 0; i < 7; i++) { - data->in[i] = - mtp008_read_value(client, MTP008_REG_IN(i)); - data->in_max[i] = - mtp008_read_value(client, MTP008_REG_IN_MAX(i)); - data->in_min[i] = - mtp008_read_value(client, MTP008_REG_IN_MIN(i)); - } - - /* - * Read the temperature sensor. - */ - data->temp = mtp008_read_value(client, MTP008_REG_TEMP); - data->temp_max = mtp008_read_value(client, MTP008_REG_TEMP_MAX); - data->temp_min = mtp008_read_value(client, MTP008_REG_TEMP_MIN); - - /* - * Read the first 2 fan dividers and the VID setting. Read the - * third fan divider from a different register. - */ - inp = mtp008_read_value(client, MTP008_REG_VID_FANDIV); - data->vid = inp & 0x0f; - data->vid |= (mtp008_read_value(client, - MTP008_REG_RESET_VID4) & 0x01) << 4; - - data->fan_div[0] = (inp >> 4) & 0x03; - data->fan_div[1] = inp >> 6; - data->fan_div[2] = - mtp008_read_value(client, MTP008_REG_PIN_CTRL1) >> 6; - - /* - * Read the interrupt status registers. - */ - data->alarms = - (mtp008_read_value(client, - MTP008_REG_INT_STAT1) & 0xdf) | - (mtp008_read_value(client, - MTP008_REG_INT_STAT2) & 0x0f) << 8; - - /* - * Read the beep control registers. - */ - data->beeps = - (mtp008_read_value(client, - MTP008_REG_BEEP_CTRL1) & 0xdf) | - (mtp008_read_value(client, - MTP008_REG_BEEP_CTRL2) & 0x8f) << 8; - - /* - * Read the sensor configuration. - */ - inp = mtp008_read_value(client, MTP008_REG_PIN_CTRL2); - mtp008_getsensortype(data, inp); - data->pwmenable = inp; - - /* - * Read the PWM registers if enabled. - */ - for (i = 1; i <= 3; i++) - { - if(PWMENABLE_FROM_REG(i, inp)) - data->pwm[i-1] = mtp008_read_value(client, - MTP008_REG_PWM_CTRL(i)); - else - data->pwm[i-1] = 255; - } - - /* - * Read the fan sensors. Skip 3 if PWM1 enabled. - */ - for (i = 1; i <= 3; i++) { - if(i == 3 && PWMENABLE_FROM_REG(1, inp)) { - data->fan[2] = 0; - data->fan_min[2] = 0; - } else { - data->fan[i-1] = mtp008_read_value(client, - MTP008_REG_FAN(i)); - data->fan_min[i-1] = mtp008_read_value(client, - MTP008_REG_FAN_MIN(i)); - } - } - - data->last_updated = jiffies; - data->valid = 1; - } - up(&data->update_lock); -} - -static void mtp008_getsensortype(struct mtp008_data *data, u8 inp) -{ - inp &= 0x0f; - data->sens[0] = (inp >> 3) + 2; /* 2 or 3 */ - data->sens[1] = ((inp >> 1) & 0x03) + 1; /* 1, 2 or 3 */ - data->sens[2] = (inp & 0x01) + 1; /* 1 or 2 */ -} - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -void mtp008_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - int nr; - struct mtp008_data *data; - - nr = ctl_name - MTP008_SYSCTL_IN0; - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 2; - - break; - case SENSORS_PROC_REAL_READ: - mtp008_update_client(client); - - if((nr != 4 && nr != 5) || data->sens[nr - 3] == VOLTAGE) { - results[0] = IN_FROM_REG(data->in_min[nr]); - results[1] = IN_FROM_REG(data->in_max[nr]); - results[2] = IN_FROM_REG(data->in[nr]); - } else { - results[0] = 0; - results[1] = 0; - results[2] = 0; - } - - *nrels_mag = 3; - - break; - case SENSORS_PROC_REAL_WRITE: - if((nr != 4 && nr != 5) || data->sens[nr - 3] == VOLTAGE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0]); - mtp008_write_value(client, MTP008_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1]); - mtp008_write_value(client, MTP008_REG_IN_MAX(nr), - data->in_max[nr]); - } - } - } -} - -void mtp008_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - int nr; - struct mtp008_data *data; - - nr = ctl_name - MTP008_SYSCTL_FAN1; - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 0; - - break; - case SENSORS_PROC_REAL_READ: - mtp008_update_client(client); - - results[0] = FAN_FROM_REG(data->fan_min[nr], - DIV_FROM_REG(data->fan_div[nr])); - results[1] = FAN_FROM_REG(data->fan[nr], - DIV_FROM_REG(data->fan_div[nr])); - - *nrels_mag = 2; - - break; - case SENSORS_PROC_REAL_WRITE: - if (*nrels_mag >= 1) { - data->fan_min[nr] = - FAN_TO_REG(results[0], - DIV_FROM_REG(data->fan_div[nr])); - mtp008_write_value(client, MTP008_REG_FAN_MIN(nr + 1), - data->fan_min[nr]); - } - } -} - -void mtp008_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct mtp008_data *data; - - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 1; - - break; - case SENSORS_PROC_REAL_READ: - mtp008_update_client(client); - - results[0] = TEMP_FROM_REG(data->temp_max); - results[1] = TEMP_FROM_REG(data->temp_min); - results[2] = TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - - break; - case SENSORS_PROC_REAL_WRITE: - if (*nrels_mag >= 1) { - data->temp_max = TEMP_TO_REG(results[0]); - mtp008_write_value(client, MTP008_REG_TEMP_MAX, - data->temp_max); - } - if (*nrels_mag >= 2) { - data->temp_min = TEMP_TO_REG(results[1]); - mtp008_write_value(client, MTP008_REG_TEMP_MIN, - data->temp_min); - } - } -} - -void mtp008_temp_add(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - int nr; - struct mtp008_data *data; - - nr = 3 + ctl_name - MTP008_SYSCTL_TEMP1; /* AIN4 or AIN5 */ - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 1; - - break; - case SENSORS_PROC_REAL_READ: - mtp008_update_client(client); - - if(data->sens[nr - 3] != VOLTAGE) { - results[0] = TEMP_FROM_REG(data->in_max[nr]); - results[1] = TEMP_FROM_REG(data->in_min[nr]); - results[2] = TEMP_FROM_REG(data->in[nr]); - } else { - results[0] = 0; - results[1] = 0; - results[2] = 0; - } - *nrels_mag = 3; - - break; - case SENSORS_PROC_REAL_WRITE: - if(data->sens[nr - 3] != VOLTAGE) { - if (*nrels_mag >= 1) { - data->in_max[nr] = TEMP_TO_REG(results[0]); - mtp008_write_value(client, - MTP008_REG_IN_MAX(nr), - data->in_max[nr]); - } - if (*nrels_mag >= 2) { - data->in_min[nr] = TEMP_TO_REG(results[1]); - mtp008_write_value(client, - MTP008_REG_IN_MIN(nr), - data->in_min[nr]); - } - } - } -} - -void mtp008_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct mtp008_data *data; - - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 2; - - break; - case SENSORS_PROC_REAL_READ: - mtp008_update_client(client); - - results[0] = VID_FROM_REG(data->vid); - - *nrels_mag = 1; - } -} - -void mtp008_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct mtp008_data *data; - u8 val; - - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 0; - - break; - case SENSORS_PROC_REAL_READ: - mtp008_update_client(client); - - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - results[2] = DIV_FROM_REG(data->fan_div[2]); - - *nrels_mag = 3; - - break; - case SENSORS_PROC_REAL_WRITE: - if (*nrels_mag >= 3) { - data->fan_div[2] = DIV_TO_REG(results[2]); - val = mtp008_read_value(client, MTP008_REG_PIN_CTRL1); - val = (val & 0x3f) | (data->fan_div[2] & 0x03) << 6; - mtp008_write_value(client, MTP008_REG_PIN_CTRL1, val); - } - if (*nrels_mag >= 1) { - val = mtp008_read_value(client, MTP008_REG_VID_FANDIV); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - val = (val & 0x3f) | - (data->fan_div[1] & 0x03) << 6; - } - data->fan_div[0] = DIV_TO_REG(results[0]); - val = (val & 0xcf) | (data->fan_div[0] & 0x03) << 4; - mtp008_write_value(client, MTP008_REG_VID_FANDIV, val); - } - } -} - -void mtp008_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct mtp008_data *data; - - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 0; - - break; - case SENSORS_PROC_REAL_READ: - mtp008_update_client(client); - - results[0] = ALARMS_FROM_REG(data->alarms); - - *nrels_mag = 1; - } -} - -void mtp008_beep(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct mtp008_data *data; - - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 0; - - break; - case SENSORS_PROC_REAL_READ: - mtp008_update_client(client); - - results[0] = BEEPS_FROM_REG(data->beeps); - - *nrels_mag = 1; - - break; - case SENSORS_PROC_REAL_WRITE: - if (*nrels_mag >= 1) { - data->beeps = BEEPS_TO_REG(results[0]) & 0xdf8f; - - mtp008_write_value(client, MTP008_REG_BEEP_CTRL1, - data->beeps & 0xff); - mtp008_write_value(client, MTP008_REG_BEEP_CTRL2, - data->beeps >> 8); - } - } -} - -void mtp008_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - int nr; - struct mtp008_data *data; - - nr = ctl_name - MTP008_SYSCTL_PWM1; - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 0; - - break; - case SENSORS_PROC_REAL_READ: - mtp008_update_client(client); - - results[0] = PWM_FROM_REG(data->pwm[nr]); - results[1] = PWMENABLE_FROM_REG(nr + 1, data->pwmenable); - *nrels_mag = 2; - - break; - case SENSORS_PROC_REAL_WRITE: - if (*nrels_mag >= 1) { - if (*nrels_mag >= 2) { - if(results[1]) - data->pwmenable |= 0x10 << nr; - else - data->pwmenable &= ~(0x10 << nr); - mtp008_write_value(client, MTP008_REG_PIN_CTRL2, - data->pwmenable); - } - data->pwm[nr] = PWM_TO_REG(results[0]); - mtp008_write_value(client, MTP008_REG_PWM_CTRL(nr), - data->pwm[nr]); - } - } -} - -void mtp008_sens(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - const char *opts = ""; - int nr; - u8 tmp; - struct mtp008_data *data; - - nr = 1 + ctl_name - MTP008_SYSCTL_SENS1; - data = client->data; - - switch (operation) { - case SENSORS_PROC_REAL_INFO: - *nrels_mag = 0; - - break; - case SENSORS_PROC_REAL_READ: - results[0] = data->sens[nr - 1]; - - *nrels_mag = 1; - - break; - case SENSORS_PROC_REAL_WRITE: - if (*nrels_mag >= 1) { - tmp = mtp008_read_value(client, MTP008_REG_PIN_CTRL2); - - switch (nr) { - case 1: /* VT or PII */ - opts = "2 or 3"; - - switch (results[0]) { - case THERMISTOR: - mtp008_write_value( - client, MTP008_REG_PIN_CTRL2, - tmp & ~MTP008_CFG_VT1_PII); - data->sens[0] = 2; - return; - case PIIDIODE: - mtp008_write_value( - client, MTP008_REG_PIN_CTRL2, - tmp | MTP008_CFG_VT1_PII); - data->sens[0] = 3; - return; - } - - break; - case 2: /* AIN, VT or PII */ - tmp &= ~MTP008_CFG_VT2_MASK; - opts = "1, 2 or 3"; - - switch (results[0]) { - case VOLTAGE: - mtp008_write_value( - client, MTP008_REG_PIN_CTRL2, - tmp | MTP008_CFG_VT2_AIN); - data->sens[1] = 1; - return; - case THERMISTOR: - mtp008_write_value( - client, MTP008_REG_PIN_CTRL2, - tmp | MTP008_CFG_VT2_VT); - data->sens[1] = 2; - return; - case PIIDIODE: - mtp008_write_value( - client, MTP008_REG_PIN_CTRL2, - tmp | MTP008_CFG_VT2_PII); - data->sens[1] = 3; - return; - } - - break; - case 3: /* AIN or VT */ - opts = "1 or 2"; - - switch (results[0]) { - case VOLTAGE: - mtp008_write_value( - client, MTP008_REG_PIN_CTRL2, - tmp & ~MTP008_CFG_VT3_VT); - data->sens[2] = 1; - return; - case THERMISTOR: - mtp008_write_value( - client, MTP008_REG_PIN_CTRL2, - tmp | MTP008_CFG_VT3_VT); - data->sens[2] = 2; - return; - } - - break; - } - - printk("mtp008.o: Invalid sensor type %ld " - "for sensor %d; must be %s.\n", - results[0], nr, opts); - } - } -} - -static int __init sm_mtp008_init(void) -{ - printk("mtp008.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&mtp008_driver); -} - -static void __exit sm_mtp008_exit(void) -{ - i2c_del_driver(&mtp008_driver); -} - - - -MODULE_AUTHOR("Frodo Looijaard , " - "Philip Edelbrock , " - "and Kris Van Hees "); -MODULE_DESCRIPTION("MTP008 driver"); - -module_init(sm_mtp008_init); -module_exit(sm_mtp008_exit); diff --git a/kernel/chips/pc87360.c b/kernel/chips/pc87360.c deleted file mode 100644 index 19f1d279..00000000 --- a/kernel/chips/pc87360.c +++ /dev/null @@ -1,1350 +0,0 @@ -/* - * pc87360.c - Part of lm_sensors, Linux kernel modules - * for hardware monitoring - * Copyright (C) 2004 Jean Delvare - * - * Copied from smsc47m1.c: - * Copyright (C) 2002 Mark D. Studebaker - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Supports the following chips: - * - * Chip #vin #fan #pwm #temp devid - * PC87360 - 2 2 - 0xE1 - * PC87363 - 2 2 - 0xE8 - * PC87364 - 3 3 - 0xE4 - * PC87365 11 3 3 2 0xE5 - * PC87366 11 3 3 3-4 0xE9 - * - * This driver assumes that no more than one chip is present, and the - * standard Super-I/O address is used (0x2E/0x2F). - */ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" - -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0x0000, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; -static struct i2c_force_data forces[] = {{NULL}}; -static u8 devid; -static unsigned int extra_isa[] = { 0x0000, 0x0000, 0x0000 }; -static u8 confreg[4]; - -enum chips { any_chip, pc87360, pc87363, pc87364, pc87365, pc87366 }; -static struct i2c_address_data addr_data = { - .normal_i2c = normal_i2c, - .normal_i2c_range = normal_i2c_range, - .normal_isa = normal_isa, - .normal_isa_range = normal_isa_range, - .probe = normal_i2c, /* cheat */ - .probe_range = normal_i2c_range, /* cheat */ - .ignore = normal_i2c, /* cheat */ - .ignore_range = normal_i2c_range, /* cheat */ - .forces = forces, -}; - -static int init = 1; -MODULE_PARM(init, "i"); -MODULE_PARM_DESC(init, - "Chip initialization level:\n" - " 0: None\n" - "*1: Forcibly enable internal voltage and temperature channels, except in9\n" - " 2: Forcibly enable all voltage and temperature channels, except in9\n" - " 3: Forcibly enable all voltage and temperature channels, including in9"); - -/* - * Super-I/O registers and operations - */ - -#define DEV 0x07 /* Register: Logical device select */ -#define DEVID 0x20 /* Register: Device ID */ -#define ACT 0x30 /* Register: Device activation */ -#define BASE 0x60 /* Register: Base address */ - -#define FSCM 0x09 /* Logical device: fans */ -#define VLM 0x0d /* Logical device: voltages */ -#define TMS 0x0e /* Logical device: temperatures */ -static const u8 logdev[3] = { FSCM, VLM, TMS }; - -#define LD_FAN 0 -#define LD_IN 1 -#define LD_TEMP 2 - -static inline void superio_outb(int sioaddr, int reg, int val) -{ - outb(reg, sioaddr); - outb(val, sioaddr+1); -} - -static inline int superio_inb(int sioaddr, int reg) -{ - outb(reg, sioaddr); - return inb(sioaddr+1); -} - -static inline void superio_exit(int sioaddr) -{ - outb(0x02, sioaddr); - outb(0x02, sioaddr+1); -} - -/* - * Logical devices - */ - -#define PC87360_EXTENT 0x10 -#define PC87365_REG_BANK 0x09 -#define NO_BANK 0xff - -/* - * Fan registers and conversions - */ - -/* nr has to be 0 or 1 (PC87360/87363) or 2 (PC87364/87365/87366) */ -#define PC87360_REG_PRESCALE(nr) (0x00 + 2 * (nr)) -#define PC87360_REG_PWM(nr) (0x01 + 2 * (nr)) -#define PC87360_REG_FAN_MIN(nr) (0x06 + 3 * (nr)) -#define PC87360_REG_FAN(nr) (0x07 + 3 * (nr)) -#define PC87360_REG_FAN_STATUS(nr) (0x08 + 3 * (nr)) - -#define FAN_FROM_REG(val,div) ((val)==0?0: \ - 480000/((val)*(div))) -#define FAN_TO_REG(val,div) ((val)<=100?0: \ - 480000/((val)*(div))) -#define FAN_DIV_FROM_REG(val) (1 << ((val >> 5) & 0x03)) -#define FAN_DIV_TO_REG(val) ((val)==8?0x60:(val)==4?0x40: \ - (val)==1?0x00:0x20) -#define FAN_STATUS_FROM_REG(val) ((val) & 0x07) - -#define FAN_CONFIG_MONITOR(val,nr) (((val) >> (2 + nr * 3)) & 1) -#define FAN_CONFIG_CONTROL(val,nr) (((val) >> (3 + nr * 3)) & 1) -#define FAN_CONFIG_INVERT(val,nr) (((val) >> (4 + nr * 3)) & 1) - -#define PWM_FROM_REG(val,inv) ((inv) ? 255 - (val) : (val)) -static inline u8 PWM_TO_REG(int val, int inv) -{ - if (inv) - val = 255 - val; - if (val < 0) - return 0; - if (val > 255) - return 255; - return val; -} - -/* - * Voltage registers and conversions - */ - -#define PC87365_REG_IN_CONVRATE 0x07 -#define PC87365_REG_IN_CONFIG 0x08 -#define PC87365_REG_IN 0x0B -#define PC87365_REG_IN_MIN 0x0D -#define PC87365_REG_IN_MAX 0x0C -#define PC87365_REG_IN_STATUS 0x0A -#define PC87365_REG_IN_ALARMS1 0x00 -#define PC87365_REG_IN_ALARMS2 0x01 -#define PC87365_REG_VID 0x06 - -#define IN_FROM_REG(val,ref) (((val) * (ref) + 128) / 256) -#define IN_TO_REG(val,ref) ((val)<0 ? 0 : \ - (val)*256>=(ref)*255 ? 255: \ - ((val) * 256 + (ref) / 2) / (ref)) - -/* - * Temperature registers and conversions - */ - -#define PC87365_REG_TEMP_CONFIG 0x08 -#define PC87365_REG_TEMP 0x0B -#define PC87365_REG_TEMP_MIN 0x0D -#define PC87365_REG_TEMP_MAX 0x0C -#define PC87365_REG_TEMP_CRIT 0x0E -#define PC87365_REG_TEMP_STATUS 0x0A -#define PC87365_REG_TEMP_ALARMS 0x00 - -#define TEMP_FROM_REG(val) ((val)&0x80 ? (val) - 0x100 : (val)) -#define TEMP_TO_REG(val) ((val)<-55 ? 201 : (val)>127 ? 0x7F : \ - (val)<0 ? (val) + 0x100 : (val)) - -struct pc87360_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - int address[3]; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 fannr, innr, tempnr; - - u8 fan[3]; /* Register value */ - u8 fan_min[3]; /* Register value */ - u8 fan_status[3]; /* Register value */ - u8 pwm[3]; /* Register value */ - u16 fan_conf; /* Configuration register values, combined */ - - u16 in_vref; /* 10mV/bit */ - u8 in[14]; /* Register value */ - u8 in_min[14]; /* Register value */ - u8 in_max[14]; /* Register value */ - u8 in_crit[3]; /* Register value */ - u8 in_status[14]; /* Register value */ - u16 in_alarms; /* Register values, combined, masked */ - u8 vid_conf; /* Configuration register value */ - u8 vrm; - u8 vid; /* Register value */ - - u8 temp[3]; /* Register value */ - u8 temp_min[3]; /* Register value */ - u8 temp_max[3]; /* Register value */ - u8 temp_crit[3]; /* Register value */ - u8 temp_status[3]; /* Register value */ - u8 temp_alarms; /* Register value, masked */ -}; - - -static int pc87360_attach_adapter(struct i2c_adapter *adapter); -static int pc87360_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int pc87360_detach_client(struct i2c_client *client); - -static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank, - u8 reg); -static void pc87360_write_value(struct pc87360_data *data, u8 ldi, u8 bank, - u8 reg, u8 value); -static void pc87360_init_client(struct i2c_client *client, int use_thermistors); -static void pc87360_update_client(struct i2c_client *client); - - -void pc87365_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); - -static void pc87360_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pc87360_fan_status(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pc87360_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pc87360_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -void pc87365_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -void pc87365_in_status(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -void pc87365_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -void pc87365_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); - -void pc87365_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); -void pc87365_temp_status(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results); - -static struct i2c_driver pc87360_driver = { - .name = "PC8736x hardware monitor", - .flags = I2C_DF_NOTIFY, - .attach_adapter = pc87360_attach_adapter, - .detach_client = pc87360_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define PC87365_SYSCTL_ALARMS 100 /* bit field */ - -#define PC87360_SYSCTL_FAN1 1101 /* Rotations/min */ -#define PC87360_SYSCTL_FAN2 1102 -#define PC87360_SYSCTL_FAN3 1103 /* not for PC87360/PC87363 */ -#define PC87360_SYSCTL_FAN_DIV 1201 /* 1, 2, 4 or 8 */ -#define PC87360_SYSCTL_FAN1_STATUS 1301 /* bit field */ -#define PC87360_SYSCTL_FAN2_STATUS 1302 -#define PC87360_SYSCTL_FAN3_STATUS 1303 /* not for PC87360/PC87363 */ -#define PC87360_SYSCTL_PWM1 1401 /* 0-255 */ -#define PC87360_SYSCTL_PWM2 1402 -#define PC87360_SYSCTL_PWM3 1403 /* not for PC87360/PC87363 */ - -#define PC87360_STATUS_FAN_READY 0x01 -#define PC87360_STATUS_FAN_LOW 0x02 -#define PC87360_STATUS_FAN_OVERFLOW 0x04 - -#define PC87365_SYSCTL_IN0 2100 /* mV */ -#define PC87365_SYSCTL_IN1 2101 -#define PC87365_SYSCTL_IN2 2102 -#define PC87365_SYSCTL_IN3 2103 -#define PC87365_SYSCTL_IN4 2104 -#define PC87365_SYSCTL_IN5 2105 -#define PC87365_SYSCTL_IN6 2106 -#define PC87365_SYSCTL_IN7 2107 -#define PC87365_SYSCTL_IN8 2108 -#define PC87365_SYSCTL_IN9 2109 -#define PC87365_SYSCTL_IN10 2110 -#define PC87365_SYSCTL_TEMP4 2111 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP5 2112 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP6 2113 /* not for PC87365 */ -#define PC87365_SYSCTL_IN0_STATUS 2300 /* bit field */ -#define PC87365_SYSCTL_IN1_STATUS 2301 -#define PC87365_SYSCTL_IN2_STATUS 2302 -#define PC87365_SYSCTL_IN3_STATUS 2303 -#define PC87365_SYSCTL_IN4_STATUS 2304 -#define PC87365_SYSCTL_IN5_STATUS 2305 -#define PC87365_SYSCTL_IN6_STATUS 2306 -#define PC87365_SYSCTL_IN7_STATUS 2307 -#define PC87365_SYSCTL_IN8_STATUS 2308 -#define PC87365_SYSCTL_IN9_STATUS 2309 -#define PC87365_SYSCTL_IN10_STATUS 2310 -#define PC87365_SYSCTL_TEMP4_STATUS 2311 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP5_STATUS 2312 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP6_STATUS 2313 /* not for PC87365 */ - -#define PC87365_SYSCTL_VID 2400 -#define PC87365_SYSCTL_VRM 2401 - -#define PC87365_STATUS_IN_MIN 0x02 -#define PC87365_STATUS_IN_MAX 0x04 - -#define PC87365_SYSCTL_TEMP1 3101 /* degrees Celsius */ -#define PC87365_SYSCTL_TEMP2 3102 -#define PC87365_SYSCTL_TEMP3 3103 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP1_STATUS 3301 /* bit field */ -#define PC87365_SYSCTL_TEMP2_STATUS 3302 -#define PC87365_SYSCTL_TEMP3_STATUS 3303 /* not for PC87365 */ - -#define PC87365_STATUS_TEMP_MIN 0x02 -#define PC87365_STATUS_TEMP_MAX 0x04 -#define PC87365_STATUS_TEMP_CRIT 0x08 -#define PC87365_STATUS_TEMP_OPEN 0x40 - -/* -- SENSORS SYSCTL END -- */ - -static ctl_table pc87360_dir_table_template[] = { /* PC87363 and PC87364 too */ - {PC87360_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, - {PC87360_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, - {PC87360_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, - {PC87360_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_div}, - {PC87360_SYSCTL_FAN1_STATUS, "fan1_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_status}, - {PC87360_SYSCTL_FAN2_STATUS, "fan2_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_status}, - {PC87360_SYSCTL_FAN3_STATUS, "fan3_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_status}, - {PC87360_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, - {PC87360_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, - {PC87360_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, - {0} -}; - -static ctl_table pc87365_dir_table_template[] = { /* PC87366 too */ - {PC87365_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_alarms}, - {PC87360_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, - {PC87360_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, - {PC87360_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan}, - {PC87360_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_div}, - {PC87360_SYSCTL_FAN1_STATUS, "fan1_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_status}, - {PC87360_SYSCTL_FAN2_STATUS, "fan2_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_status}, - {PC87360_SYSCTL_FAN3_STATUS, "fan3_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_fan_status}, - {PC87360_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, - {PC87360_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, - {PC87360_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87360_pwm}, - {PC87365_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN9, "in9", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN10, "in10", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_IN0_STATUS, "in0_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN1_STATUS, "in1_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN2_STATUS, "in2_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN3_STATUS, "in3_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN4_STATUS, "in4_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN5_STATUS, "in5_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN6_STATUS, "in6_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN7_STATUS, "in7_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN8_STATUS, "in8_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN9_STATUS, "in9_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_IN10_STATUS, "in10_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_temp}, - {PC87365_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_temp}, - {PC87365_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_temp}, - {PC87365_SYSCTL_TEMP4, "temp4", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_TEMP5, "temp5", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_TEMP6, "temp6", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in}, - {PC87365_SYSCTL_TEMP1_STATUS, "temp1_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_temp_status}, - {PC87365_SYSCTL_TEMP2_STATUS, "temp2_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_temp_status}, - {PC87365_SYSCTL_TEMP3_STATUS, "temp3_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_temp_status}, - {PC87365_SYSCTL_TEMP4_STATUS, "temp4_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_TEMP5_STATUS, "temp5_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_TEMP6_STATUS, "temp6_status", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_in_status}, - {PC87365_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_vid}, - {PC87365_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &pc87365_vrm}, - {0} -}; - -static int pc87360_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, pc87360_detect); -} - -static int __init pc87360_find(int sioaddr, u8 *devid, int *address) -{ - u16 val; - int i; - int nrdev; /* logical device count */ - - /* No superio_enter */ - - /* Identify device */ - val = superio_inb(sioaddr, DEVID); - switch (val) { - case 0xE1: /* PC87360 */ - case 0xE8: /* PC87363 */ - case 0xE4: /* PC87364 */ - nrdev = 1; - break; - case 0xE5: /* PC87365 */ - case 0xE9: /* PC87366 */ - nrdev = 3; - break; - default: - superio_exit(sioaddr); - return -ENODEV; - } - /* Remember the device id */ - *devid = val; - - for (i = 0; i < nrdev; i++) { - /* select logical device */ - superio_outb(sioaddr, DEV, logdev[i]); - - val = superio_inb(sioaddr, ACT); - if (!(val & 0x01)) { - printk(KERN_INFO "pc87360.o: Device 0x%02x not " - "activated\n", logdev[i]); - continue; - } - - val = (superio_inb(sioaddr, BASE) << 8) - | superio_inb(sioaddr, BASE + 1); - if (!val) { - printk(KERN_INFO "pc87360.o: Base address not set for " - "device 0x%02x\n", logdev[i]); - continue; - } - - address[i] = val; - - if (i==0) { /* Fans */ - confreg[0] = superio_inb(sioaddr, 0xF0); - confreg[1] = superio_inb(sioaddr, 0xF1); - -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Fan 1: mon=%d " - "ctrl=%d inv=%d\n", (confreg[0]>>2)&1, - (confreg[0]>>3)&1, (confreg[0]>>4)&1); - printk(KERN_DEBUG "pc87360.o: Fan 2: mon=%d " - "ctrl=%d inv=%d\n", (confreg[0]>>5)&1, - (confreg[0]>>6)&1, (confreg[0]>>7)&1); - printk(KERN_DEBUG "pc87360.o: Fan 3: mon=%d " - "ctrl=%d inv=%d\n", confreg[1]&1, - (confreg[1]>>1)&1, (confreg[1]>>2)&1); -#endif - } else if (i==1) { /* Voltages */ - /* Are we using thermistors? */ - if (*devid == 0xE9) { /* PC87366 */ - /* These registers are not logical-device - specific, just that we won't need them if - we don't use the VLM device */ - confreg[2] = superio_inb(sioaddr, 0x2B); - confreg[3] = superio_inb(sioaddr, 0x25); - - if (confreg[2] & 0x40) { - printk(KERN_INFO "pc87360.o: Using " - "thermistors for temperature " - "monitoring\n"); - } - if (confreg[3] & 0xE0) { - printk(KERN_INFO "pc87360.o: VID " - "inputs routed (mode %u)\n", - confreg[3] >> 5); - } - } - } - } - - superio_exit(sioaddr); - return 0; -} - -/* We don't really care about the address. - Read from extra_isa instead. */ -int pc87360_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct pc87360_data *data; - int err = 0; - const char *type_name = "pc87360"; - const char *client_name = "PC8736x chip"; - ctl_table *template = pc87360_dir_table_template; - int use_thermistors = 0; - - if (!i2c_is_isa_adapter(adapter)) { - return 0; - } - - for (i = 0; i < 3; i++) { - if (extra_isa[i] - && check_region(extra_isa[i], PC87360_EXTENT)) { - printk(KERN_ERR "pc87360.o: Region 0x%x-0x%x already " - "in use!\n", extra_isa[i], - extra_isa[i]+PC87360_EXTENT-1); - return -ENODEV; - } - } - - if (!(data = kmalloc(sizeof(struct pc87360_data), GFP_KERNEL))) { - return -ENOMEM; - } - memset(data, 0x00, sizeof(struct pc87360_data)); - - new_client = &data->client; - new_client->addr = address; - init_MUTEX(&data->lock); - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &pc87360_driver; - new_client->flags = 0; - - data->fannr = 2; - data->innr = 0; - data->tempnr = 0; - - switch (devid) { - case 0xe8: - type_name = "pc87363"; - break; - case 0xe4: - type_name = "pc87364"; - data->fannr = 3; - break; - case 0xe5: - type_name = "pc87365"; - template = pc87365_dir_table_template; - data->fannr = extra_isa[0] ? 3 : 0; - data->innr = extra_isa[1] ? 11 : 0; - data->tempnr = extra_isa[2] ? 2 : 0; - break; - case 0xe9: - type_name = "pc87366"; - template = pc87365_dir_table_template; - data->fannr = extra_isa[0] ? 3 : 0; - data->innr = extra_isa[1] ? 14 : 0; - data->tempnr = extra_isa[2] ? 3 : 0; - break; - } - - /* Retrieve the fans configuration from Super-I/O space */ - if (data->fannr) - data->fan_conf = confreg[0] | (confreg[1] << 8); - - for (i = 0; i < 3; i++) { - if ((data->address[i] = extra_isa[i])) { - request_region(extra_isa[i], PC87360_EXTENT, "pc87360"); - } - } - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - if ((err = i2c_attach_client(new_client))) - goto ERROR1; - - /* Use the correct reference voltage - Unless both the VLM and the TMS logical devices agree to - use an external Vref, the internal one is used. */ - if (data->innr) { - i = pc87360_read_value(data, LD_IN, NO_BANK, - PC87365_REG_IN_CONFIG); - if (data->tempnr) { - i &= pc87360_read_value(data, LD_TEMP, NO_BANK, - PC87365_REG_TEMP_CONFIG); - } - data->in_vref = (i&0x02) ? 3025 : 2966; -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Using %s reference voltage\n", - (i&0x02) ? "external" : "internal"); -#endif - - data->vid_conf = confreg[3]; - data->vrm = 90; - } - - /* Fan clock dividers may be needed before any data is read */ - for (i = 0; i < data->fannr; i++) { - if (FAN_CONFIG_MONITOR(data->fan_conf, i)) - data->fan_status[i] = pc87360_read_value(data, - LD_FAN, NO_BANK, - PC87360_REG_FAN_STATUS(i)); - } - - if (init > 0) { - if (devid == 0xe9 && data->address[1]) /* PC87366 */ - use_thermistors = confreg[2] & 0x40; - - pc87360_init_client(new_client, use_thermistors); - } - - if ((i = i2c_register_entry((struct i2c_client *) new_client, - type_name, template, THIS_MODULE)) < 0) { - err = i; - goto ERROR2; - } - data->sysctl_id = i; - - return 0; - -ERROR2: - i2c_detach_client(new_client); -ERROR1: - for (i = 0; i < 3; i++) { - if (data->address[i]) { - release_region(data->address[i], PC87360_EXTENT); - } - } - kfree(data); - return err; -} - -static int pc87360_detach_client(struct i2c_client *client) -{ - struct pc87360_data *data = client->data; - int i, err; - - i2c_deregister_entry(data->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR "pc87360.o: Client deregistration failed, " - "client not detached.\n"); - return err; - } - - for (i = 0; i < 3; i++) { - if (data->address[i]) { - release_region(data->address[i], PC87360_EXTENT); - } - } - kfree(client->data); - - return 0; -} - -/* ldi is the logical device index - bank is for voltages and temperatures only */ -static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank, - u8 reg) -{ - int res; - - down(&(data->lock)); - if (bank != NO_BANK) { - outb_p(bank, data->address[ldi] + PC87365_REG_BANK); - } - res = inb_p(data->address[ldi] + reg); - up(&(data->lock)); - return res; -} - -static void pc87360_write_value(struct pc87360_data *data, u8 ldi, u8 bank, - u8 reg, u8 value) -{ - down(&(data->lock)); - if (bank != NO_BANK) { - outb_p(bank, data->address[ldi] + PC87365_REG_BANK); - } - outb_p(value, data->address[ldi] + reg); - up(&(data->lock)); -} - -static void pc87360_init_client(struct i2c_client *client, int use_thermistors) -{ - struct pc87360_data *data = client->data; - int i, nr; - const u8 init_in[14] = { 2, 2, 2, 2, 2, 2, 2, 1, 1, 3, 1, 2, 2, 2 }; - const u8 init_temp[3] = { 2, 2, 1 }; - u8 reg; - - if (init >= 2 && data->innr) { - reg = pc87360_read_value(data, LD_IN, NO_BANK, - PC87365_REG_IN_CONVRATE); - printk(KERN_INFO "pc87360.o: VLM conversion set to " - "1s period, 160us delay\n"); - pc87360_write_value(data, LD_IN, NO_BANK, - PC87365_REG_IN_CONVRATE, - (reg & 0xC0) | 0x11); - } - - nr = data->innr < 11 ? data->innr : 11; - for (i=0; i= init_in[i]) { - /* Forcibly enable voltage channel */ - reg = pc87360_read_value(data, LD_IN, i, - PC87365_REG_IN_STATUS); - if (!(reg & 0x01)) { -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Forcibly " - "enabling in%d\n", i); -#endif - pc87360_write_value(data, LD_IN, i, - PC87365_REG_IN_STATUS, - (reg & 0x68) | 0x87); - } - } - } - - /* We can't blindly trust the Super-I/O space configuration bit, - most BIOS won't set it properly */ - for (i=11; iinnr; i++) { - reg = pc87360_read_value(data, LD_IN, i, - PC87365_REG_TEMP_STATUS); - use_thermistors = use_thermistors || (reg & 0x01); - } - - i = use_thermistors ? 2 : 0; - for (; itempnr; i++) { - if (init >= init_temp[i]) { - /* Forcibly enable temperature channel */ - reg = pc87360_read_value(data, LD_TEMP, i, - PC87365_REG_TEMP_STATUS); - if (!(reg & 0x01)) { -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Forcibly " - "enabling temp%d\n", i+1); -#endif - pc87360_write_value(data, LD_TEMP, i, - PC87365_REG_TEMP_STATUS, - 0xCF); - } - } - } - - if (use_thermistors) { - for (i=11; iinnr; i++) { - if (init >= init_in[i]) { - /* The pin may already be used by thermal - diodes */ - reg = pc87360_read_value(data, LD_TEMP, (i-11)/2, - PC87365_REG_TEMP_STATUS); - if (reg & 0x01) { -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Skipping " - "temp%d, pin already in use by " - "temp%d\n", i-7, (i-11)/2); -#endif - continue; - } - - /* Forcibly enable thermistor channel */ - reg = pc87360_read_value(data, LD_IN, i, - PC87365_REG_IN_STATUS); - if (!(reg & 0x01)) { -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Forcibly " - "enabling temp%d\n", i-7); -#endif - pc87360_write_value(data, LD_IN, i, - PC87365_REG_TEMP_STATUS, - (reg & 0x60) | 0x8F); - } - } - } - } - - if (data->innr) { - reg = pc87360_read_value(data, LD_IN, NO_BANK, - PC87365_REG_IN_CONFIG); - if (reg & 0x01) { -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Forcibly " - "enabling monitoring (VLM)\n"); -#endif - pc87360_write_value(data, LD_IN, NO_BANK, - PC87365_REG_IN_CONFIG, - reg & 0xFE); - } - } - - if (data->tempnr) { - reg = pc87360_read_value(data, LD_TEMP, NO_BANK, - PC87365_REG_TEMP_CONFIG); - if (reg & 0x01) { -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Forcibly " - "enabling monitoring (TMS)\n"); -#endif - pc87360_write_value(data, LD_TEMP, NO_BANK, - PC87365_REG_TEMP_CONFIG, - reg & 0xFE); - } - - if (init >= 2) { - /* Chip config as documented by National Semi. */ - pc87360_write_value(data, LD_TEMP, 0xF, 0xA, 0x08); - /* We voluntarily omit the bank here, in case the - sequence itself matters. It shouldn't be a problem, - since nobody else is supposed to access the - device at that point. */ - pc87360_write_value(data, LD_TEMP, NO_BANK, 0xB, 0x04); - pc87360_write_value(data, LD_TEMP, NO_BANK, 0xC, 0x35); - pc87360_write_value(data, LD_TEMP, NO_BANK, 0xD, 0x05); - pc87360_write_value(data, LD_TEMP, NO_BANK, 0xE, 0x05); - } - } -} - -static void pc87360_autodiv(struct pc87360_data *data, int nr) -{ - u8 old_min = data->fan_min[nr]; - - /* Increase clock divider if needed and possible */ - if ((data->fan_status[nr] & 0x04) /* overflow flag */ - || (data->fan[nr] >= 224)) { /* next to overflow */ - if ((data->fan_status[nr] & 0x60) != 0x60) { - data->fan_status[nr] += 0x20; - data->fan_min[nr] >>= 1; - data->fan[nr] >>= 1; -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Increasing " - "clock divider to %d for fan %d\n", - FAN_DIV_FROM_REG(data->fan_status[nr]), - nr+1); -#endif - } - } else { - /* Decrease clock divider if possible */ - while (!(data->fan_min[nr] & 0x80) /* fan min "nails" divider */ - && data->fan[nr] < 85 /* bad accuracy */ - && (data->fan_status[nr] & 0x60) != 0x00) { - data->fan_status[nr] -= 0x20; - data->fan_min[nr] <<= 1; - data->fan[nr] <<= 1; -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Decreasing " - "clock divider to %d for fan %d\n", - FAN_DIV_FROM_REG(data->fan_status[nr]), - nr+1); -#endif - } - } - - /* Write new fan min if it changed */ - if (old_min != data->fan_min[nr]) { - pc87360_write_value(data, LD_FAN, NO_BANK, - PC87360_REG_FAN_MIN(nr), - data->fan_min[nr]); - } -} - -static void pc87360_update_client(struct i2c_client *client) -{ - struct pc87360_data *data = client->data; - u8 i; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ * 2) || - (jiffies < data->last_updated) || !data->valid) { -#ifdef DEBUG - printk(KERN_DEBUG "pc87360.o: Data update\n"); -#endif - - /* Fans */ - for (i = 0; i < data->fannr; i++) { - if (FAN_CONFIG_MONITOR(data->fan_conf, i)) { - data->fan_status[i] = pc87360_read_value(data, - LD_FAN, NO_BANK, - PC87360_REG_FAN_STATUS(i)); - data->fan[i] = pc87360_read_value(data, LD_FAN, - NO_BANK, PC87360_REG_FAN(i)); - data->fan_min[i] = pc87360_read_value(data, - LD_FAN, NO_BANK, - PC87360_REG_FAN_MIN(i)); - /* Change clock divider if needed */ - pc87360_autodiv(data, i); - /* Clear bits and write new divider */ - pc87360_write_value(data, LD_FAN, NO_BANK, - PC87360_REG_FAN_STATUS(i), - data->fan_status[i]); - } - data->pwm[i] = pc87360_read_value(data, LD_FAN, - NO_BANK, PC87360_REG_PWM(i)); - } - - /* Voltages */ - for (i = 0; i < data->innr; i++) { - data->in_status[i] = pc87360_read_value(data, LD_IN, i, - PC87365_REG_IN_STATUS); - /* Clear bits */ - pc87360_write_value(data, LD_IN, i, - PC87365_REG_IN_STATUS, - data->in_status[i]); - if ((data->in_status[i] & 0x81) == 0x81) { - data->in[i] = pc87360_read_value(data, LD_IN, - i, PC87365_REG_IN); - } - if (data->in_status[i] & 0x01) { - data->in_min[i] = pc87360_read_value(data, - LD_IN, i, - PC87365_REG_IN_MIN); - data->in_max[i] = pc87360_read_value(data, - LD_IN, i, - PC87365_REG_IN_MAX); - if (i >= 11) - data->in_crit[i-11] = - pc87360_read_value(data, LD_IN, - i, PC87365_REG_TEMP_CRIT); - } - } - if (data->innr) { - data->in_alarms = pc87360_read_value(data, LD_IN, - NO_BANK, PC87365_REG_IN_ALARMS1) - | ((pc87360_read_value(data, LD_IN, - NO_BANK, PC87365_REG_IN_ALARMS2) - & 0x07) << 8); - data->vid = (data->vid_conf & 0xE0) ? - pc87360_read_value(data, LD_IN, - NO_BANK, PC87365_REG_VID) : 0x1F; - } - - /* Temperatures */ - for (i = 0; i < data->tempnr; i++) { - data->temp_status[i] = pc87360_read_value(data, - LD_TEMP, i, - PC87365_REG_TEMP_STATUS); - /* Clear bits */ - pc87360_write_value(data, LD_TEMP, i, - PC87365_REG_TEMP_STATUS, - data->temp_status[i]); - if ((data->temp_status[i] & 0x81) == 0x81) { - data->temp[i] = pc87360_read_value(data, - LD_TEMP, i, - PC87365_REG_TEMP); - } - if (data->temp_status[i] & 0x01) { - data->temp_min[i] = pc87360_read_value(data, - LD_TEMP, i, - PC87365_REG_TEMP_MIN); - data->temp_max[i] = pc87360_read_value(data, - LD_TEMP, i, - PC87365_REG_TEMP_MAX); - data->temp_crit[i] = pc87360_read_value(data, - LD_TEMP, i, - PC87365_REG_TEMP_CRIT); - } - } - if (data->tempnr) { - data->temp_alarms = pc87360_read_value(data, LD_TEMP, - NO_BANK, PC87365_REG_TEMP_ALARMS) - & 0x3F; - } - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void pc87365_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - results[0] = data->in_alarms; - results[1] = data->temp_alarms; - *nrels_mag = 2; - } -} - -void pc87360_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - int nr = ctl_name - PC87360_SYSCTL_FAN1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr], - FAN_DIV_FROM_REG(data->fan_status[nr])); - results[1] = FAN_FROM_REG(data->fan[nr], - FAN_DIV_FROM_REG(data->fan_status[nr])); - *nrels_mag = 2; - } - /* We ignore National's recommendation */ - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (nr >= data->fannr) - return; - if (*nrels_mag >= 1) { - int fan_min = FAN_TO_REG(results[0], - FAN_DIV_FROM_REG(data->fan_status[nr])); - /* If it wouldn't fit, change clock divisor */ - while (fan_min > 255 - && (data->fan_status[nr] & 0x60) != 0x60) { - fan_min >>= 1; - data->fan[nr] >>= 1; - data->fan_status[nr] += 0x20; - } - data->fan_min[nr] = fan_min > 255 ? 255 : fan_min; - pc87360_write_value(data, LD_FAN, NO_BANK, - PC87360_REG_FAN_MIN(nr), - data->fan_min[nr]); - /* Write new divider, preserve alarm bits */ - pc87360_write_value(data, LD_FAN, NO_BANK, - PC87360_REG_FAN_STATUS(nr), - data->fan_status[nr] & 0xF9); - } - } -} - -void pc87360_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - int i; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - for (i = 0; i < data->fannr; i++) { - results[i] = FAN_DIV_FROM_REG(data->fan_status[i]); - } - for (; i < 3; i++) { - results[i] = 0; - } - *nrels_mag = 3; - } -} - -void pc87360_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - int nr = ctl_name - PC87360_SYSCTL_PWM1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - results[0] = PWM_FROM_REG(data->pwm[nr], - FAN_CONFIG_INVERT(data->fan_conf, nr)); - results[1] = FAN_CONFIG_CONTROL(data->fan_conf, nr); - *nrels_mag = 2; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (nr >= data->fannr) - return; - if (*nrels_mag >= 1) { - data->pwm[nr] = PWM_TO_REG(results[0], - FAN_CONFIG_INVERT(data->fan_conf, nr)); - pc87360_write_value(data, LD_FAN, NO_BANK, - PC87360_REG_PWM(nr), - data->pwm[nr]); - } - } -} - -void pc87360_fan_status(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - int nr = ctl_name - PC87360_SYSCTL_FAN1_STATUS; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - results[0] = FAN_STATUS_FROM_REG(data->fan_status[nr]); - *nrels_mag = 1; - } -} - -void pc87365_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - int nr = ctl_name - PC87365_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - results[0] = IN_FROM_REG(data->in_min[nr], data->in_vref); - results[1] = IN_FROM_REG(data->in_max[nr], data->in_vref); - if (nr < 11) { - *nrels_mag = 3; - } else { - results[2] = IN_FROM_REG(data->in_crit[nr-11], - data->in_vref); - *nrels_mag = 4; - } - results[(*nrels_mag)-1] = IN_FROM_REG(data->in[nr], - data->in_vref); - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0], - data->in_vref); - pc87360_write_value(data, LD_IN, nr, - PC87365_REG_IN_MIN, - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1], - data->in_vref); - pc87360_write_value(data, LD_IN, nr, - PC87365_REG_IN_MAX, - data->in_max[nr]); - } - if (*nrels_mag >= 3 && nr >= 11) { - data->in_crit[nr-11] = IN_TO_REG(results[2], - data->in_vref); - pc87360_write_value(data, LD_IN, nr, - PC87365_REG_TEMP_CRIT, - data->in_crit[nr-11]); - } - } -} - -void pc87365_in_status(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - int nr = ctl_name - PC87365_SYSCTL_IN0_STATUS; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - results[0] = data->in_status[nr]; - *nrels_mag = 1; - } -} - -void pc87365_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - results[0] = vid_from_reg(data->vid & 0x1f, data->vrm); - *nrels_mag = 1; - } -} - -void pc87365_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) - data->vrm = results[0]; - } -} - -void pc87365_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - int nr = ctl_name - PC87365_SYSCTL_TEMP1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_max[nr]); - results[1] = TEMP_FROM_REG(data->temp_min[nr]); - results[2] = TEMP_FROM_REG(data->temp_crit[nr]); - results[3] = TEMP_FROM_REG(data->temp[nr]); - *nrels_mag = 4; - } - else if (operation == SENSORS_PROC_REAL_WRITE) { - if (nr >= data->tempnr) - return; - if (*nrels_mag >= 1) { - data->temp_max[nr] = TEMP_TO_REG(results[0]); - pc87360_write_value(data, LD_TEMP, nr, - PC87365_REG_TEMP_MAX, - data->temp_max[nr]); - } - if (*nrels_mag >= 2) { - data->temp_min[nr] = TEMP_TO_REG(results[1]); - pc87360_write_value(data, LD_TEMP, nr, - PC87365_REG_TEMP_MIN, - data->temp_min[nr]); - } - if (*nrels_mag >= 3) { - data->temp_crit[nr] = TEMP_TO_REG(results[2]); - pc87360_write_value(data, LD_TEMP, nr, - PC87365_REG_TEMP_CRIT, - data->temp_crit[nr]); - } - } -} - -void pc87365_temp_status(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pc87360_data *data = client->data; - int nr = ctl_name - PC87365_SYSCTL_TEMP1_STATUS; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pc87360_update_client(client); - results[0] = data->temp_status[nr]; - *nrels_mag = 1; - } -} - - -static int __init pc87360_init(void) -{ - int i; - - printk(KERN_INFO "pc87360.o version %s (%s)\n", LM_VERSION, LM_DATE); - - if (pc87360_find(0x2e, &devid, extra_isa) - && pc87360_find(0x4e, &devid, extra_isa)) { - printk(KERN_WARNING "pc87360.o: PC8736x not detected, " - "module not inserted.\n"); - return -ENODEV; - } - - /* Arbitrarily pick one of the addresses */ - for (i = 0; i < 3; i++) { - if (extra_isa[i] != 0x0000) { - normal_isa[0] = extra_isa[i]; - break; - } - } - - if (normal_isa[0] == 0x0000) { - printk(KERN_WARNING "pc87360.o: No active logical device, " - "module not inserted.\n"); - return -ENODEV; - - } - - return i2c_add_driver(&pc87360_driver); -} - -static void __exit pc87360_exit(void) -{ - i2c_del_driver(&pc87360_driver); -} - - -MODULE_AUTHOR("Jean Delvare "); -MODULE_DESCRIPTION("PC8736x hardware monitor"); -MODULE_LICENSE("GPL"); - -module_init(pc87360_init); -module_exit(pc87360_exit); diff --git a/kernel/chips/pca9540.c b/kernel/chips/pca9540.c deleted file mode 100644 index 8ec5c29b..00000000 --- a/kernel/chips/pca9540.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * pca9540.c - Part of lm_sensors, Linux kernel modules for hardware - * monitoring - * Copyright (c) 2004 Jean Delvare - * - * Based on pcf8574.c from the same project by Frodo Looijaard, - * Philip Edelbrock, Dan Eaton and Aurelien Jarno. - * - * The PCA9540 is a 2-channel I2C multiplexer made by Philips - * Semiconductors. It is controlled via the I2C bus itself. - * The SCL/SDA upstream pair fans out to two SCL/SDA downstream - * pairs, or channels. Only one SCL/SDA channel is selected at a - * time, determined by the contents of the programmable control - * register. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x70, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(pca9540); - -/* Each client has this additional data */ -struct pca9540_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - - u8 control; /* Register value */ -}; - -static int pca9540_attach_adapter(struct i2c_adapter *adapter); -static int pca9540_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int pca9540_detach_client(struct i2c_client *client); -static void pca9540_update_client(struct i2c_client *client); - -static void pca9540_channel(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -/* This is the driver that will be inserted */ -static struct i2c_driver pca9540_driver = { - .name = "PCA9540 chip driver", - .flags = I2C_DF_NOTIFY, - .attach_adapter = pca9540_attach_adapter, - .detach_client = pca9540_detach_client, -}; - - -/* -- SENSORS SYSCTL START -- */ - -#define PCA9540_SYSCTL_CHANNEL 1000 - -/* -- SENSORS SYSCTL END -- */ - -static ctl_table pca9540_dir_table_template[] = { - {PCA9540_SYSCTL_CHANNEL, "channel", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pca9540_channel}, - {0} -}; - -static int pca9540_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, pca9540_detect); -} - -/* This function is called by i2c_detect. */ -int pca9540_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct pca9540_data *data; - int err = 0; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. */ - if (!(data = kmalloc(sizeof(struct pca9540_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &pca9540_driver; - new_client->flags = 0; - - /* The detection is very weak. */ - if (kind < 0) { - u8 reg = i2c_smbus_read_byte(new_client); - if ((reg & 0xfa) != 0x00 - || reg != i2c_smbus_read_byte(new_client) - || reg != i2c_smbus_read_byte(new_client) - || reg != i2c_smbus_read_byte(new_client)) - goto ERROR1; - } - - kind = pca9540; - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, "PCA9540 chip"); - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR1; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, "pca9540", - pca9540_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR2; - } - data->sysctl_id = i; - - /* Initialize the PCA9540 chip: nothing needed */ - - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR2: - i2c_detach_client(new_client); - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int pca9540_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct pca9540_data *) (client->data))->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR "pca9540.o: Client deregistration failed, " - "client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -static void pca9540_update_client(struct i2c_client *client) -{ - struct pca9540_data *data = client->data; - - down(&data->update_lock); - -#ifdef DEBUG - printk(KERN_DEBUG "pca9540.o: Starting update.\n"); -#endif - data->control = i2c_smbus_read_byte(client) & 0x07; - - up(&data->update_lock); -} - - -void pca9540_channel(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct pca9540_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pca9540_update_client(client); - switch(data->control) { - case 4: results[0] = 1; break; - case 5: results[0] = 2; break; - default: results[0] = 0; - } - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - switch(results[0]) { - case 1: data->control = 4; break; - case 2: data->control = 5; break; - case 0: data->control = 0; break; - default: return; /* invalid value */ - } - i2c_smbus_write_byte(client, data->control); - } - } -} - - -static int __init pca9540_init(void) -{ - printk("pca9540.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&pca9540_driver); -} - -static void __exit pca9540_exit(void) -{ - i2c_del_driver(&pca9540_driver); -} - - -MODULE_AUTHOR("Jean Delvare "); -MODULE_DESCRIPTION("PCA9540 driver"); - -module_init(pca9540_init); -module_exit(pca9540_exit); diff --git a/kernel/chips/pcf8574.c b/kernel/chips/pcf8574.c deleted file mode 100644 index 7026065b..00000000 --- a/kernel/chips/pcf8574.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - pcf8574.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2000 Frodo Looijaard , - Philip Edelbrock , - Dan Eaton - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* A few notes about the PCF8574: - -* The PCF8574 is an 8-bit I/O expander for the I2C bus produced by - Philips Semiconductors. It is designed to provide a byte I2C - interface to up to 8 separate devices. - -* The PCF8574 appears as a very simple SMBus device which can be - read from or written to with SMBUS byte read/write accesses. - -* Because of the general purpose nature of this device, it will most - likely be necessary to customize the /proc interface to suit the - specific application. - - --Dan - -*/ - - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x20, 0x27, 0x38, 0x3f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_2(pcf8574, pcf8574a); - -/* The PCF8574 registers */ - -/* (No registers. [Wow! This thing is SIMPLE!] ) */ - -/* Initial values */ -#define PCF8574_INIT 255 /* All outputs on (input mode) */ - -/* Each client has this additional data */ -struct pcf8574_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - - u8 read, write; /* Register values */ -}; - -static int pcf8574_attach_adapter(struct i2c_adapter *adapter); -static int pcf8574_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int pcf8574_detach_client(struct i2c_client *client); - -static void pcf8574_read(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pcf8574_write(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pcf8574_update_client(struct i2c_client *client); -static void pcf8574_init_client(struct i2c_client *client); - -/* This is the driver that will be inserted */ -static struct i2c_driver pcf8574_driver = { - .name = "PCF8574 sensor chip driver", - .id = I2C_DRIVERID_PCF8574, - .flags = I2C_DF_NOTIFY, - .attach_adapter = pcf8574_attach_adapter, - .detach_client = pcf8574_detach_client, -}; - - -/* -- SENSORS SYSCTL START -- */ -#define PCF8574_SYSCTL_READ 1000 -#define PCF8574_SYSCTL_WRITE 1001 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected PCF8574. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table pcf8574_dir_table_template[] = { - {PCF8574_SYSCTL_READ, "read", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pcf8574_read}, - {PCF8574_SYSCTL_WRITE, "write", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pcf8574_write}, - {0} -}; - -static int pcf8574_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, pcf8574_detect); -} - -/* This function is called by i2c_detect */ -static int pcf8574_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct pcf8574_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("pcf8574.o: pcf8574_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. */ - if (!(data = kmalloc(sizeof(struct pcf8574_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &pcf8574_driver; - new_client->flags = 0; - - /* Now, we would do the remaining detection. But the PCF8574 is plainly - impossible to detect! Stupid chip. */ - - /* Determine the chip type */ - if (kind <= 0) { - if (address >= 0x38 && address <= 0x3f) - kind = pcf8574a; - else - kind = pcf8574; - } - - if (kind == pcf8574a) { - type_name = "pcf8574a"; - client_name = "PCF8574A chip"; - } else { - type_name = "pcf8574"; - client_name = "PCF8574 chip"; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR1; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - pcf8574_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR2; - } - data->sysctl_id = i; - - /* Initialize the PCF8574 chip */ - pcf8574_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR2: - i2c_detach_client(new_client); - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int pcf8574_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct pcf8574_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk("pcf8574.o: Client deregistration failed, " - "client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -/* Called when we have found a new PCF8574. */ -static void pcf8574_init_client(struct i2c_client *client) -{ - struct pcf8574_data *data = client->data; - data->write = PCF8574_INIT; - i2c_smbus_write_byte(client, data->write); -} - - -static void pcf8574_update_client(struct i2c_client *client) -{ - struct pcf8574_data *data = client->data; - - down(&data->update_lock); - -#ifdef DEBUG - printk("Starting pcf8574 update\n"); -#endif - - data->read = i2c_smbus_read_byte(client); - - up(&data->update_lock); -} - - -void pcf8574_read(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct pcf8574_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pcf8574_update_client(client); - results[0] = data->read; - *nrels_mag = 1; - } -} -void pcf8574_write(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct pcf8574_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->write; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->write = results[0]; - i2c_smbus_write_byte(client, data->write); - } - } -} - - -static int __init sm_pcf8574_init(void) -{ - printk("pcf8574.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&pcf8574_driver); -} - -static void __exit sm_pcf8574_exit(void) -{ - i2c_del_driver(&pcf8574_driver); -} - - -MODULE_AUTHOR("Frodo Looijaard , " - "Philip Edelbrock , " - "Dan Eaton and " - "Aurelien Jarno "); -MODULE_DESCRIPTION("PCF8574 driver"); - -module_init(sm_pcf8574_init); -module_exit(sm_pcf8574_exit); diff --git a/kernel/chips/pcf8591.c b/kernel/chips/pcf8591.c deleted file mode 100644 index 6f6de4c9..00000000 --- a/kernel/chips/pcf8591.c +++ /dev/null @@ -1,443 +0,0 @@ -/* - pcf8591.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2001 Aurelien Jarno - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x48, 0x4f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(pcf8591); - -/* The PCF8591 control byte */ -/* 7 6 5 4 3 2 1 0 */ -/* | 0 |AOEF| AIP | 0 |AINC| AICH | */ - -#define PCF8591_CONTROL_BYTE_AOEF 0x40 /* Analog Output Enable Flag */ - /* (analog output active if 1) */ - -#define PCF8591_CONTROL_BYTE_AIP 0x30 /* Analog Input Programming */ - /* 0x00 = four single ended inputs */ - /* 0x10 = three differential inputs */ - /* 0x20 = single ended and differential mixed */ - /* 0x30 = two differential inputs */ - -#define PCF8591_CONTROL_BYTE_AINC 0x04 /* Autoincrement Flag */ - /* (switch on if 1) */ - -#define PCF8591_CONTROL_BYTE_AICH 0x03 /* Analog Output Enable Flag */ - /* 0x00 = channel 0 */ - /* 0x01 = channel 1 */ - /* 0x02 = channel 2 */ - /* 0x03 = channel 3 */ - - -/* Initial values */ -#define PCF8591_INIT_CONTROL_BYTE (PCF8591_CONTROL_BYTE_AOEF | PCF8591_CONTROL_BYTE_AINC) - /* DAC out enabled, four single ended inputs, autoincrement */ - -#define PCF8591_INIT_AOUT 0 /* DAC out = 0 */ - - -/* Conversions. */ -#define REG_TO_SIGNED(reg) (reg & 0x80)?(reg - 256):(reg) - /* Convert signed 8 bit value to signed value */ - - -struct pcf8591_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 control_byte; - u8 ch[4]; - u8 aout; -}; - -static int pcf8591_attach_adapter(struct i2c_adapter *adapter); -static int pcf8591_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int pcf8591_detach_client(struct i2c_client *client); - -static void pcf8591_update_client(struct i2c_client *client); -static void pcf8591_init_client(struct i2c_client *client); - -static void pcf8591_ain_conf(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pcf8591_ain(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pcf8591_aout_enable(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void pcf8591_aout(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - - -/* This is the driver that will be inserted */ -static struct i2c_driver pcf8591_driver = { - .name = "PCF8591 sensor chip driver", - .id = I2C_DRIVERID_PCF8591, - .flags = I2C_DF_NOTIFY, - .attach_adapter = pcf8591_attach_adapter, - .detach_client = pcf8591_detach_client, -}; - -/* The /proc/sys entries */ - -/* -- SENSORS SYSCTL START -- */ -#define PCF8591_SYSCTL_AIN_CONF 1000 /* Analog input configuration */ -#define PCF8591_SYSCTL_CH0 1001 /* Input channel 1 */ -#define PCF8591_SYSCTL_CH1 1002 /* Input channel 2 */ -#define PCF8591_SYSCTL_CH2 1003 /* Input channel 3 */ -#define PCF8591_SYSCTL_CH3 1004 /* Input channel 4 */ -#define PCF8591_SYSCTL_AOUT_ENABLE 1005 /* Analog output enable flag */ -#define PCF8591_SYSCTL_AOUT 1006 /* Analog output */ -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected PCF8591. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table pcf8591_dir_table_template[] = { - {PCF8591_SYSCTL_AIN_CONF, "ain_conf", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pcf8591_ain_conf}, - {PCF8591_SYSCTL_CH0, "ch0", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pcf8591_ain}, - {PCF8591_SYSCTL_CH1, "ch1", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pcf8591_ain}, - {PCF8591_SYSCTL_CH2, "ch2", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pcf8591_ain}, - {PCF8591_SYSCTL_CH3, "ch3", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pcf8591_ain}, - {PCF8591_SYSCTL_AOUT_ENABLE, "aout_enable", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pcf8591_aout_enable}, - {PCF8591_SYSCTL_AOUT, "aout", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &pcf8591_aout}, - {0} -}; - - -/* This function is called when: - * pcf8591_driver is inserted (when this module is loaded), for each - available adapter - * when a new adapter is inserted (and pcf8591_driver is still present) */ -static int pcf8591_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, pcf8591_detect); -} - -/* This function is called by i2c_detect */ -static int pcf8591_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct pcf8591_data *data; - int err = 0; - - const char *type_name = ""; - const char *client_name = ""; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - (KERN_ERR "pcf8591.o: pcf8591_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE - | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. */ - if (!(data = kmalloc(sizeof(struct pcf8591_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &pcf8591_driver; - new_client->flags = 0; - - /* Now, we would do the remaining detection. But the PCF8591 is plainly - impossible to detect! Stupid chip. */ - - /* Determine the chip type - only one kind supported! */ - if (kind <= 0) - kind = pcf8591; - - type_name = "pcf8591"; - client_name = "PCF8591 chip"; - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - pcf8591_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the PCF8591 chip */ - pcf8591_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - kfree(data); - ERROR0: - return err; -} - -static int pcf8591_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct pcf8591_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - (KERN_ERR "pcf8591.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -/* Called when we have found a new PCF8591. */ -static void pcf8591_init_client(struct i2c_client *client) -{ - struct pcf8591_data *data = client->data; - data->control_byte = PCF8591_INIT_CONTROL_BYTE; - data->aout = PCF8591_INIT_AOUT; - - i2c_smbus_write_byte_data(client, data->control_byte, data->aout); -} - -static void pcf8591_update_client(struct i2c_client *client) -{ - struct pcf8591_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk(KERN_DEBUG "Starting pcf8591 update\n"); -#endif - - i2c_smbus_write_byte(client, data->control_byte); - i2c_smbus_read_byte(client); /* The first byte transmitted contains the */ - /* conversion code of the previous read cycled */ - /* FLUSH IT ! */ - - - /* Number of byte to read to signed depend on the analog input mode */ - data->ch[0] = i2c_smbus_read_byte(client); - data->ch[1] = i2c_smbus_read_byte(client); - /* In all case, read at least two values */ - - if ((data->control_byte & PCF8591_CONTROL_BYTE_AIP) != 0x30) - data->ch[2] = i2c_smbus_read_byte(client); - /* Read the third value if not in "two differential inputs" mode */ - - if ((data->control_byte & PCF8591_CONTROL_BYTE_AIP) == 0x00) - data->ch[3] = i2c_smbus_read_byte(client); - /* Read the fourth value only in "four single ended inputs" mode */ - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. */ -void pcf8591_ain_conf(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pcf8591_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = (data->control_byte & PCF8591_CONTROL_BYTE_AIP) >> 4; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (results[0] >= 0 && results[0] <= 3) - { - data->control_byte &= ~PCF8591_CONTROL_BYTE_AIP; - data->control_byte |= (results[0] << 4); - i2c_smbus_write_byte(client, data->control_byte); - data->valid = 0; - } - } - } -} - -void pcf8591_ain(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pcf8591_data *data = client->data; - int nr = ctl_name - PCF8591_SYSCTL_CH0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - pcf8591_update_client(client); - - /* Number of data to show and conversion to signed depend on */ - /* the analog input mode */ - - switch(nr) { - case 0: - if (((data->control_byte & PCF8591_CONTROL_BYTE_AIP) == 0) - | ((data->control_byte & PCF8591_CONTROL_BYTE_AIP) == 2)) - results[0] = data->ch[0]; /* single ended */ - else - results[0] = REG_TO_SIGNED(data->ch[0]);/* differential */ - break; - case 1: - if (((data->control_byte & PCF8591_CONTROL_BYTE_AIP) == 0) - | ((data->control_byte & PCF8591_CONTROL_BYTE_AIP) == 2)) - results[0] = data->ch[1]; /* single ended */ - else - results[0] = REG_TO_SIGNED(data->ch[1]);/* differential */ - break; - case 2: - if ((data->control_byte & PCF8591_CONTROL_BYTE_AIP) == 3) - results[0] = 0; /* channel not used */ - else if ((data->control_byte & PCF8591_CONTROL_BYTE_AIP) == 0) - results[0] = data->ch[2]; /* single ended */ - else - results[0] = REG_TO_SIGNED(data->ch[2]);/* differential */ - break; - case 3: - if (((data->control_byte & PCF8591_CONTROL_BYTE_AIP) == 0) - | ((data->control_byte & PCF8591_CONTROL_BYTE_AIP) == 2)) - results[0] = data->ch[3]; /* single ended */ - else - results[0] = 0; /* channel not used */ - break; - } - *nrels_mag = 1; - } -} - -void pcf8591_aout_enable(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pcf8591_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = !(!(data->control_byte & PCF8591_CONTROL_BYTE_AOEF)); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (results[0]) - data->control_byte |= PCF8591_CONTROL_BYTE_AOEF; - else - data->control_byte &= ~PCF8591_CONTROL_BYTE_AOEF; - - i2c_smbus_write_byte(client, data->control_byte); - } - } -} - -void pcf8591_aout(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct pcf8591_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->aout; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (results[0] >= 0 && results[0] <= 255) /* ignore values outside DAC range */ - { - data->aout = results[0]; - i2c_smbus_write_byte_data(client, data->control_byte, data->aout); - } - } - } -} - -static int __init sm_pcf8591_init(void) -{ - printk(KERN_INFO "pcf8591.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&pcf8591_driver); -} - -static void __exit sm_pcf8591_exit(void) -{ - i2c_del_driver(&pcf8591_driver); -} - - - -MODULE_AUTHOR("Aurelien Jarno "); -MODULE_DESCRIPTION("PCF8591 driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_pcf8591_init); -module_exit(sm_pcf8591_exit); diff --git a/kernel/chips/saa1064.c b/kernel/chips/saa1064.c deleted file mode 100644 index 500c740c..00000000 --- a/kernel/chips/saa1064.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - saa1064.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2003 Sascha Volkenandt - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* A few notes about the SAA1064: - -* The SAA1064 is a driver for 4-digit led displays produced by Philips - Semiconductors. It can be found in HiFi equipment with such displays. - I've found it inside a Kathrein analogue sat-receiver :-). - -* The SAA1064 is quite simple to handle, it receives an address byte, - telling which register is addressed, followed by up to five data - bytes (according to the data sheet), while with each byte the register - address is increased by one, wrapping from 7 to 0. - -* NOTE: This device doesn NOT have eight read-write registers, but eight - write-only registers, and one read-only status byte (with no register - address). - -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x38, 0x3b, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(saa1064); - -/* The SAA1064 registers - Registers: - 0 Control register - 1 Digit 1 - 2 Digit 2 - 3 Digit 3 - 4 Digit 4 -*/ - -#define SAA1064_REG_CONTROL 0x00 -#define SAA1064_REG_DIGIT0 0x01 -#define SAA1064_REG_DIGIT1 0x02 -#define SAA1064_REG_DIGIT2 0x03 -#define SAA1064_REG_DIGIT3 0x04 - -/* Control byte: - Bit 0 Dynamic mode - 1 Blank digits 1+3 (reversed) - 2 Blank digits 2+4 (reversed) - 3 Testmode (all digits on) - 4 Add 3mA output current to led's - 5 Add 6mA output current to led's - 6 Add 12mA output current to led's - 7 Unused, set to 0 -*/ - -#define SAA1064_CTRL_DYNAMIC 0x01 -#define SAA1064_CTRL_BLANK13 0x02 -#define SAA1064_CTRL_BLANK24 0x04 -#define SAA1064_CTRL_TEST 0x08 -#define SAA1064_CTRL_BRIGHT 0x70 - -/* Status byte: - The MSB set to 1 indicates powerloss since last read-out */ -#define SAA1064_STAT_PWRLOSS 0x80 - -/* Get a bit from the control-byte. Except for BRIGHT, these return - zero/non-zero in a boolean fashion. BRIGHT returns a 3-bit value - specifying the brightness */ -#define SAA1064_CTRL_GET_DYNAMIC(c) (((c) & SAA1064_CTRL_DYNAMIC)>0) -#define SAA1064_CTRL_GET_BLANK13(c) (((c) & SAA1064_CTRL_BLANK13)>0) -#define SAA1064_CTRL_GET_BLANK24(c) (((c) & SAA1064_CTRL_BLANK24)>0) -#define SAA1064_CTRL_GET_TEST(c) (((c) & SAA1064_CTRL_TEST)>0) -#define SAA1064_CTRL_GET_BRIGHT(c) (((c) & SAA1064_CTRL_BRIGHT)>>4) - -/* Get THE bit from the status byte. The LSB set to 1 indicates powerloss - since last read-out */ -#define SAA1064_STAT_GET_PWRLOSS(s) (((s) & SAA1064_STAT_PWRLOSS)>0) - -/* Set a bit in the control-byte to val and return the modified byte. - Except for BRIGHT, val is evaluated in a boolean fashion. */ -#define SAA1064_CTRL_SET_DYNAMIC(c,val) ((val)>0 \ - ? (c) | SAA1064_CTRL_DYNAMIC : (c) & ~SAA1064_CTRL_DYNAMIC) -#define SAA1064_CTRL_SET_BLANK13(c,val) ((val)>0 \ - ? (c) | SAA1064_CTRL_BLANK13 : (c) & ~SAA1064_CTRL_BLANK13) -#define SAA1064_CTRL_SET_BLANK24(c,val) ((val)>0 \ - ? (c) | SAA1064_CTRL_BLANK24 : (c) & ~SAA1064_CTRL_BLANK24) -#define SAA1064_CTRL_SET_TEST(c,val) ((val)>0 \ - ? (c) | SAA1064_CTRL_TEST : (c) & ~SAA1064_CTRL_TEST) -#define SAA1064_CTRL_SET_BRIGHT(c,val) (((c) & ~SAA1064_CTRL_BRIGHT) \ - | (((val) << 4) & SAA1064_CTRL_BRIGHT)) - -/* Initial values */ -#define SAA1064_INIT 0x7f /* All digits on (testmode), full brightness */ - -/* Each client has this additional data */ -struct saa1064_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 control; /* Control reg */ - u8 digits[4]; /* Digits regs */ - u8 status; /* Status byte (read) */ -}; - -static int saa1064_attach_adapter(struct i2c_adapter *adapter); -static int saa1064_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int saa1064_detach_client(struct i2c_client *client); - -static void saa1064_bright(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void saa1064_test(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void saa1064_disp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void saa1064_refresh(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void saa1064_update_client(struct i2c_client *client); -static void saa1064_init_client(struct i2c_client *client); - -/* This is the driver that will be inserted */ -static struct i2c_driver saa1064_driver = { - .name = "SAA1064 sensor chip driver", - .id = I2C_DRIVERID_SAA1064, - .flags = I2C_DF_NOTIFY, - .attach_adapter = saa1064_attach_adapter, - .detach_client = saa1064_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define SAA1064_SYSCTL_BRIGHT 1000 /* Brightness, 0-7 */ -#define SAA1064_SYSCTL_TEST 1001 /* Testmode (on = all digits lit) */ -#define SAA1064_SYSCTL_DISP 1005 /* four eight bit values */ -#define SAA1064_SYSCTL_REFRESH 1006 /* refresh digits in case of powerloss */ - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected SAA1064. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table saa1064_dir_table_template[] = { - {SAA1064_SYSCTL_BRIGHT, "bright", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &saa1064_bright}, - {SAA1064_SYSCTL_TEST, "test", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &saa1064_test}, - {SAA1064_SYSCTL_DISP, "disp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &saa1064_disp}, - {SAA1064_SYSCTL_REFRESH, "refresh", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &saa1064_refresh}, - {0} -}; - -static int saa1064_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, saa1064_detect); -} - -/* This function is called by i2c_detect */ -static int saa1064_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct saa1064_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("saa1064.o: saa1064_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE - | I2C_FUNC_SMBUS_WRITE_BYTE_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access i2c_smbus_read_byte */ - if (!(data = kmalloc(sizeof(struct saa1064_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &saa1064_driver; - new_client->flags = 0; - - if (kind < 0) { - if ((i2c_smbus_read_byte(new_client) & ~SAA1064_STAT_PWRLOSS) != 0x00 - || i2c_smbus_read_byte(new_client) != 0x00 - || i2c_smbus_read_byte(new_client) != 0x00 - || i2c_smbus_read_byte(new_client) != 0x00) - goto ERROR1; - } - - /* If detection was requested, it has also passed til now. Only one chip, - so no further evaluation of kind. */ - kind = saa1064; - type_name = "saa1064"; - client_name = "SAA1064 chip"; - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - saa1064_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - -#ifdef DEBUG - printk("saa1064.o: Module initialization complete.\n"); -#endif - - /* Initialize the SAA1064 chip */ - saa1064_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - - -int saa1064_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct saa1064_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("saa1064.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -/* Called when we have found a new SAA1064. */ -void saa1064_init_client(struct i2c_client *client) -{ - struct saa1064_data *data = client->data; - data->control = SAA1064_INIT; - memset(data->digits, 0x00, 4); - - i2c_smbus_write_byte_data(client, SAA1064_REG_CONTROL, data->control); - i2c_smbus_write_i2c_block_data(client, SAA1064_REG_DIGIT0, 4, data->digits); -} - -/* Update status byte, and write registers in case a powerloss occurred */ -static void saa1064_update_client(struct i2c_client *client) -{ - struct saa1064_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > 5*HZ) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("saa1064.o: starting saa1064 update\n"); -#endif - - data->status = i2c_smbus_read_byte(client); - if (SAA1064_STAT_GET_PWRLOSS(data->status)) { - i2c_smbus_write_byte_data(client, SAA1064_REG_CONTROL, data->control); - i2c_smbus_write_i2c_block_data(client, SAA1064_REG_DIGIT0, 4, data->digits); - } - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -static void saa1064_bright(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct saa1064_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = SAA1064_CTRL_GET_BRIGHT(data->control); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->control = SAA1064_CTRL_SET_BRIGHT(data->control, results[0]); - i2c_smbus_write_byte_data(client, SAA1064_REG_CONTROL, data->control); - } - } -} - - -static void saa1064_test(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct saa1064_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = SAA1064_CTRL_GET_TEST(data->control); - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->control = SAA1064_CTRL_SET_TEST(data->control, results[0]); - i2c_smbus_write_byte_data(client, SAA1064_REG_CONTROL, data->control); - } - } -} - - -static void saa1064_disp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct saa1064_data *data = client->data; - int i; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - for (i = 0; i < 4; ++i) - results[i] = (long)data->digits[i]; - *nrels_mag = 4; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - for (i = 0; i < max(*nrels_mag, 4); ++i) - data->digits[i] = (u8)results[i]; - i2c_smbus_write_i2c_block_data(client, SAA1064_REG_DIGIT0, 4, data->digits); - } -} - - -static void saa1064_refresh(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - saa1064_update_client(client); - *nrels_mag = 0; - } -} - - -static int __init sensors_saa1064_init(void) -{ - printk("saa1064.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&saa1064_driver); -} - - -static void __exit sensors_saa1064_exit(void) -{ - i2c_del_driver(&saa1064_driver); -} - - - -MODULE_AUTHOR("Sascha Volkenandt "); -MODULE_DESCRIPTION("SAA1064 driver"); - -module_init(sensors_saa1064_init); -module_exit(sensors_saa1064_exit); - diff --git a/kernel/chips/sis5595.c b/kernel/chips/sis5595.c deleted file mode 100644 index 6c2e58ec..00000000 --- a/kernel/chips/sis5595.c +++ /dev/null @@ -1,721 +0,0 @@ -/* - sis5595.c - Part of lm_sensors, Linux kernel modules - for hardware monitoring - - Copyright (c) 1998 - 2001 Frodo Looijaard , - Kyösti Mälkki , and - Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - SiS southbridge has a LM78-like chip integrated on the same IC. - This driver is a customized copy of lm78.c - - Supports following revisions: - Version PCI ID PCI Revision - 1 1039/0008 AF or less - 2 1039/0008 B0 or greater - - Note: these chips contain a 0008 device which is incompatible with the - 5595. We recognize these by the presence of the listed - "blacklist" PCI ID and refuse to load. - - NOT SUPPORTED PCI ID BLACKLIST PCI ID - 540 0008 0540 - 550 0008 0550 - 5513 0008 5511 - 5581 0008 5597 - 5582 0008 5597 - 5597 0008 5597 - 5598 0008 5597/5598 - 630 0008 0630 - 645 0008 0645 - 730 0008 0730 - 735 0008 0735 -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* If force_addr is set to anything different from 0, we forcibly enable - the device at the given address. */ -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Initialize the base address of the sensors"); - -/* Addresses to scan. - Note that we can't determine the ISA address until we have initialized - our module */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0x0000, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(sis5595); - -static int blacklist[] = { - PCI_DEVICE_ID_SI_540, - PCI_DEVICE_ID_SI_550, - PCI_DEVICE_ID_SI_630, - PCI_DEVICE_ID_SI_645, - PCI_DEVICE_ID_SI_730, - PCI_DEVICE_ID_SI_735, - PCI_DEVICE_ID_SI_5511, /* 5513 chip has the 0008 device but - that ID shows up in other chips so we - use the 5511 ID for recognition */ - PCI_DEVICE_ID_SI_5597, - PCI_DEVICE_ID_SI_5598, - 0 }; - -/* Many SIS5595 constants specified below */ - -/* Length of ISA address segment */ -#define SIS5595_EXTENT 8 -/* PCI Config Registers */ -#define SIS5595_REVISION_REG 0x08 -#define SIS5595_BASE_REG 0x68 -#define SIS5595_PIN_REG 0x7A -#define SIS5595_ENABLE_REG 0x7B - -/* Where are the ISA address/data registers relative to the base address */ -#define SIS5595_ADDR_REG_OFFSET 5 -#define SIS5595_DATA_REG_OFFSET 6 - -/* The SIS5595 registers */ -#define SIS5595_REG_IN_MAX(nr) (0x2b + (nr) * 2) -#define SIS5595_REG_IN_MIN(nr) (0x2c + (nr) * 2) -#define SIS5595_REG_IN(nr) (0x20 + (nr)) - -#define SIS5595_REG_FAN_MIN(nr) (0x3a + (nr)) -#define SIS5595_REG_FAN(nr) (0x27 + (nr)) - -/* On the first version of the chip, the temp registers are separate. - On the second version, - TEMP pin is shared with IN4, configured in PCI register 0x7A. - The registers are the same as well. - OVER and HYST are really MAX and MIN. */ - -#define REV2MIN 0xb0 -#define SIS5595_REG_TEMP (( data->revision) >= REV2MIN) ? \ - SIS5595_REG_IN(4) : 0x27 -#define SIS5595_REG_TEMP_OVER (( data->revision) >= REV2MIN) ? \ - SIS5595_REG_IN_MAX(4) : 0x39 -#define SIS5595_REG_TEMP_HYST (( data->revision) >= REV2MIN) ? \ - SIS5595_REG_IN_MIN(4) : 0x3a - -#define SIS5595_REG_CONFIG 0x40 -#define SIS5595_REG_ALARM1 0x41 -#define SIS5595_REG_ALARM2 0x42 -#define SIS5595_REG_FANDIV 0x47 - -/* Conversions. Limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ - -#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255)) -#define IN_FROM_REG(val) (((val) * 16 + 5) / 10) - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm <= 0) - return 255; - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==255?0:1350000/((val)*(div))) - -/* Version 1 datasheet temp=.83*reg + 52.12 */ -#define TEMP_FROM_REG(val) (((((val)>=0x80?(val)-0x100:(val))*83)+5212)/10) -/* inverse 1.20*val - 62.77 */ -#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?\ - ((((val)*12)-6327)/100):\ - ((((val)*12)-6227)/100)),0,255)) - -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) - -/* For the SIS5595, we need to keep some data in memory. It is - dynamically allocated, at the time when the new sis5595 client is - allocated. */ -struct sis5595_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - char maxins; /* == 3 if temp enabled, otherwise == 4 */ - u8 revision; /* Reg. value */ - - u8 in[5]; /* Register value */ - u8 in_max[5]; /* Register value */ - u8 in_min[5]; /* Register value */ - u8 fan[2]; /* Register value */ - u8 fan_min[2]; /* Register value */ - u8 temp; /* Register value */ - u8 temp_over; /* Register value */ - u8 temp_hyst; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ - u16 alarms; /* Register encoding, combined */ -}; - -static struct pci_dev *s_bridge; /* pointer to the (only) sis5595 */ - -static int sis5595_attach_adapter(struct i2c_adapter *adapter); -static int sis5595_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int sis5595_detach_client(struct i2c_client *client); - -static int sis5595_read_value(struct i2c_client *client, u8 register); -static int sis5595_write_value(struct i2c_client *client, u8 register, - u8 value); -static void sis5595_update_client(struct i2c_client *client); -static void sis5595_init_client(struct i2c_client *client); - - -static void sis5595_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void sis5595_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void sis5595_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void sis5595_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void sis5595_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -/* The driver. I choose to use type i2c_driver, as at is identical to both - smbus_driver and isa_driver, and clients could be of either kind */ -static struct i2c_driver sis5595_driver = { - .name = "SiS 5595", - .id = I2C_DRIVERID_SIS5595, - .flags = I2C_DF_NOTIFY, - .attach_adapter = sis5595_attach_adapter, - .detach_client = sis5595_detach_client, -}; - -/* The /proc/sys entries */ - -/* -- SENSORS SYSCTL START -- */ -#define SIS5595_SYSCTL_IN0 1000 /* Volts * 100 */ -#define SIS5595_SYSCTL_IN1 1001 -#define SIS5595_SYSCTL_IN2 1002 -#define SIS5595_SYSCTL_IN3 1003 -#define SIS5595_SYSCTL_IN4 1004 -#define SIS5595_SYSCTL_FAN1 1101 /* Rotations/min */ -#define SIS5595_SYSCTL_FAN2 1102 -#define SIS5595_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ -#define SIS5595_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define SIS5595_SYSCTL_ALARMS 2001 /* bitvector */ - -#define SIS5595_ALARM_IN0 0x01 -#define SIS5595_ALARM_IN1 0x02 -#define SIS5595_ALARM_IN2 0x04 -#define SIS5595_ALARM_IN3 0x08 -#define SIS5595_ALARM_BTI 0x20 -#define SIS5595_ALARM_FAN1 0x40 -#define SIS5595_ALARM_FAN2 0x80 -#define SIS5595_ALARM_IN4 0x8000 -#define SIS5595_ALARM_TEMP 0x8000 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected SIS5595. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table sis5595_dir_table_template[] = { - {SIS5595_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_in}, - {SIS5595_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_in}, - {SIS5595_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_in}, - {SIS5595_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_in}, - {SIS5595_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_in}, - {SIS5595_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_fan}, - {SIS5595_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_fan}, - {SIS5595_SYSCTL_TEMP, "temp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_temp}, - {SIS5595_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_fan_div}, - {SIS5595_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &sis5595_alarms}, - {0} -}; - -/* This is called when the module is loaded */ -static int sis5595_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, sis5595_detect); -} - -/* Locate SiS bridge and correct base address for SIS5595 */ -static int __init sis5595_find_sis(int *address) -{ - u16 val; - int *i; - - if (!pci_present()) - return -ENODEV; - - if (!(s_bridge = - pci_find_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, - NULL))) - return -ENODEV; - - /* Look for imposters */ - for(i = blacklist; *i != 0; i++) { - if (pci_find_device(PCI_VENDOR_ID_SI, *i, NULL)) { - printk("sis5595.o: Error: Looked for SIS5595 but found unsupported device %.4X\n", *i); - return -ENODEV; - } - } - - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(s_bridge, SIS5595_BASE_REG, &val)) - return -ENODEV; - - *address = val & ~(SIS5595_EXTENT - 1); - if (*address == 0 && force_addr == 0) { - printk("sis5595.o: base address not set - upgrade BIOS or use force_addr=0xaddr\n"); - return -ENODEV; - } - if (force_addr) - *address = force_addr; /* so detect will get called */ - - return 0; -} - -int sis5595_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct sis5595_data *data; - int err = 0; - const char *type_name = "sis5595"; - const char *client_name = "SIS5595 chip"; - char val; - u16 a; - - /* Make sure we are probing the ISA bus!! */ - if (!i2c_is_isa_adapter(adapter)) { - printk - ("sis5595.o: sis5595_detect called for an I2C bus adapter?!?\n"); - return 0; - } - - if(force_addr) - address = force_addr & ~(SIS5595_EXTENT - 1); - if (check_region(address, SIS5595_EXTENT)) { - printk("sis5595.o: region 0x%x already in use!\n", address); - return -ENODEV; - } - if(force_addr) { - printk("sis5595.o: forcing ISA address 0x%04X\n", address); - if (PCIBIOS_SUCCESSFUL != - pci_write_config_word(s_bridge, SIS5595_BASE_REG, address)) - return -ENODEV; - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(s_bridge, SIS5595_BASE_REG, &a)) - return -ENODEV; - if ((a & ~(SIS5595_EXTENT - 1)) != address) { - /* doesn't work for some chips? */ - printk("sis5595.o: force address failed\n"); - return -ENODEV; - } - } - - if (PCIBIOS_SUCCESSFUL != - pci_read_config_byte(s_bridge, SIS5595_ENABLE_REG, &val)) - return -ENODEV; - if((val & 0x80) == 0) { - printk("sis5595.o: enabling sensors\n"); - if (PCIBIOS_SUCCESSFUL != - pci_write_config_byte(s_bridge, SIS5595_ENABLE_REG, - val | 0x80)) - return -ENODEV; - if (PCIBIOS_SUCCESSFUL != - pci_read_config_byte(s_bridge, SIS5595_ENABLE_REG, &val)) - return -ENODEV; - if((val & 0x80) == 0) { /* doesn't work for some chips! */ - printk("sis5595.o: sensors enable failed - not supported?\n"); - return -ENODEV; - } - } - - if (!(data = kmalloc(sizeof(struct sis5595_data), GFP_KERNEL))) { - return -ENOMEM; - } - - new_client = &data->client; - new_client->addr = address; - init_MUTEX(&data->lock); - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &sis5595_driver; - new_client->flags = 0; - - /* Reserve the ISA region */ - request_region(address, SIS5595_EXTENT, type_name); - - /* Check revision and pin registers to determine whether 4 or 5 voltages */ - pci_read_config_byte(s_bridge, SIS5595_REVISION_REG, &(data->revision)); - /* 4 voltages, 1 temp */ - data->maxins = 3; - if (data->revision >= REV2MIN) { - pci_read_config_byte(s_bridge, SIS5595_PIN_REG, &val); - if (!(val & 0x80)) - /* 5 voltages, no temp */ - data->maxins = 4; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry((struct i2c_client *) new_client, - type_name, - sis5595_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the SIS5595 chip */ - sis5595_init_client(new_client); - return 0; - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - release_region(address, SIS5595_EXTENT); - kfree(data); - return err; -} - -static int sis5595_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct sis5595_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("sis5595.o: Client deregistration failed, client not detached.\n"); - return err; - } - - release_region(client->addr, SIS5595_EXTENT); - kfree(client->data); - - return 0; -} - - -/* ISA access must be locked explicitly. - There are some ugly typecasts here, but the good news is - they should - nowhere else be necessary! */ -static int sis5595_read_value(struct i2c_client *client, u8 reg) -{ - int res; - - down(&(((struct sis5595_data *) (client->data))->lock)); - outb_p(reg, client->addr + SIS5595_ADDR_REG_OFFSET); - res = inb_p(client->addr + SIS5595_DATA_REG_OFFSET); - up(&(((struct sis5595_data *) (client->data))->lock)); - return res; -} - -static int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - down(&(((struct sis5595_data *) (client->data))->lock)); - outb_p(reg, client->addr + SIS5595_ADDR_REG_OFFSET); - outb_p(value, client->addr + SIS5595_DATA_REG_OFFSET); - up(&(((struct sis5595_data *) (client->data))->lock)); - return 0; -} - -/* Called when we have found a new SIS5595. */ -static void sis5595_init_client(struct i2c_client *client) -{ - u8 reg; - - /* Start monitoring */ - reg = i2c_smbus_read_byte_data(client, SIS5595_REG_CONFIG); - sis5595_write_value(client, SIS5595_REG_CONFIG, (reg|0x01)&0x7F); -} - -static void sis5595_update_client(struct i2c_client *client) -{ - struct sis5595_data *data = client->data; - int i; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - - for (i = 0; i <= data->maxins; i++) { - data->in[i] = - sis5595_read_value(client, SIS5595_REG_IN(i)); - data->in_min[i] = - sis5595_read_value(client, - SIS5595_REG_IN_MIN(i)); - data->in_max[i] = - sis5595_read_value(client, - SIS5595_REG_IN_MAX(i)); - } - for (i = 1; i <= 2; i++) { - data->fan[i - 1] = - sis5595_read_value(client, SIS5595_REG_FAN(i)); - data->fan_min[i - 1] = - sis5595_read_value(client, - SIS5595_REG_FAN_MIN(i)); - } - if(data->maxins == 3) { - data->temp = - sis5595_read_value(client, SIS5595_REG_TEMP); - data->temp_over = - sis5595_read_value(client, SIS5595_REG_TEMP_OVER); - data->temp_hyst = - sis5595_read_value(client, SIS5595_REG_TEMP_HYST); - } - i = sis5595_read_value(client, SIS5595_REG_FANDIV); - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = i >> 6; - data->alarms = - sis5595_read_value(client, SIS5595_REG_ALARM1) | - (sis5595_read_value(client, SIS5595_REG_ALARM2) << 8); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ - -/* Return 0 for in4 and disallow writes if pin used for temp */ -void sis5595_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct sis5595_data *data = client->data; - int nr = ctl_name - SIS5595_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - if(nr <= 3 || data->maxins == 4) { - sis5595_update_client(client); - results[0] = IN_FROM_REG(data->in_min[nr]); - results[1] = IN_FROM_REG(data->in_max[nr]); - results[2] = IN_FROM_REG(data->in[nr]); - } else { - results[0] = 0; - results[1] = 0; - results[2] = 0; - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if(nr <= 3 || data->maxins == 4) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0]); - sis5595_write_value(client, - SIS5595_REG_IN_MIN(nr), data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1]); - sis5595_write_value(client, - SIS5595_REG_IN_MAX(nr), data->in_max[nr]); - } - } - } -} - -void sis5595_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct sis5595_data *data = client->data; - int nr = ctl_name - SIS5595_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - sis5595_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - results[1] = FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = FAN_TO_REG(results[0], - DIV_FROM_REG - (data-> - fan_div[nr-1])); - sis5595_write_value(client, - SIS5595_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } - } -} - - -/* Return 0 for temp and disallow writes if pin used for in4 */ -void sis5595_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct sis5595_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - if(data->maxins == 3) { - sis5595_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_over); - results[1] = TEMP_FROM_REG(data->temp_hyst); - results[2] = TEMP_FROM_REG(data->temp); - } else { - results[0] = 0; - results[1] = 0; - results[2] = 0; - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if(data->maxins == 3) { - if (*nrels_mag >= 1) { - data->temp_over = TEMP_TO_REG(results[0]); - sis5595_write_value(client, - SIS5595_REG_TEMP_OVER, data->temp_over); - } - if (*nrels_mag >= 2) { - data->temp_hyst = TEMP_TO_REG(results[1]); - sis5595_write_value(client, - SIS5595_REG_TEMP_HYST, data->temp_hyst); - } - } - } -} - -void sis5595_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct sis5595_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - sis5595_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -void sis5595_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct sis5595_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - sis5595_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = sis5595_read_value(client, SIS5595_REG_FANDIV); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) | (data->fan_div[1] << 6); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan_div[0] << 4); - sis5595_write_value(client, SIS5595_REG_FANDIV, old); - } - } -} - -static int __init sm_sis5595_init(void) -{ - int addr; - - printk("sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE); - - if (sis5595_find_sis(&addr)) { - printk("sis5595.o: SIS5595 not detected, module not inserted.\n"); - return -ENODEV; - } - normal_isa[0] = addr; - - return i2c_add_driver(&sis5595_driver); -} - -static void __exit sm_sis5595_exit(void) -{ - i2c_del_driver(&sis5595_driver); -} - - - -MODULE_AUTHOR("Kyösti Mälkki "); -MODULE_DESCRIPTION("SiS 5595 Sensor device"); - -module_init(sm_sis5595_init); -module_exit(sm_sis5595_exit); diff --git a/kernel/chips/smartbatt.c b/kernel/chips/smartbatt.c deleted file mode 100644 index 7dd145de..00000000 --- a/kernel/chips/smartbatt.c +++ /dev/null @@ -1,546 +0,0 @@ -/* - smartbatt.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2002 M. D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - With GPL code from: - battery.c - Copyright (C) 2000 Linuxcare, Inc. - battery.h - Copyright (C) 2000 Hypercore Software Design, Ltd. -*/ - -#include -#include -#include -#include -#include -#include "version.h" - - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x0b, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(smartbatt); - -/* The SMARTBATT registers */ -#define SMARTBATT_REG_MODE 0x03 -#define SMARTBATT_REG_TEMP 0x08 -#define SMARTBATT_REG_V 0x09 -#define SMARTBATT_REG_I 0x0a -#define SMARTBATT_REG_AVGI 0x0b -#define SMARTBATT_REG_RELCHG 0x0d -#define SMARTBATT_REG_ABSCHG 0x0e -#define SMARTBATT_REG_REMCAP 0x0f -#define SMARTBATT_REG_CHGCAP 0x10 -#define SMARTBATT_REG_RUNTIME_E 0x11 -#define SMARTBATT_REG_AVGTIME_E 0x12 -#define SMARTBATT_REG_AVGTIME_F 0x13 -#define SMARTBATT_REG_CHGI 0x14 -#define SMARTBATT_REG_CHGV 0x15 -#define SMARTBATT_REG_STATUS 0x16 -#define SMARTBATT_REG_CYCLECT 0x17 -#define SMARTBATT_REG_DESCAP 0x18 -#define SMARTBATT_REG_DESV 0x19 -#define SMARTBATT_REG_DATE 0x1b -#define SMARTBATT_REG_SERIAL 0x1c -#define SMARTBATT_REG_MANUF 0x20 -#define SMARTBATT_REG_NAME 0x21 -#define SMARTBATT_REG_CHEM 0x22 - -#define BATTERY_STRING_MAX 64 -#define COMM_TIMEOUT 16 - - -/* Each client has this additional data */ -struct smartbatt_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ -#if 0 - char manufacturer[BATTERY_STRING_MAX]; - char device[BATTERY_STRING_MAX]; - char chemistry[BATTERY_STRING_MAX]; -#endif - int serial; - struct { - unsigned int day:5; /* Day (1-31) */ - unsigned int month:4; /* Month (1-12) */ - unsigned int year:7; /* Year (1980 + 0-127) */ - } manufacture_date; - u16 mode, temp, v, i, avgi; /* Register values */ - u16 relchg, abschg, remcap, chgcap; /* Register values */ - u16 rte, ate, atf, chgi, chgv; /* Register values */ - u16 status, cyclect, descap, desv; /* Register values */ -}; - -static int smartbatt_attach_adapter(struct i2c_adapter *adapter); -static int smartbatt_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void smartbatt_init_client(struct i2c_client *client); -static int smartbatt_detach_client(struct i2c_client *client); - -static int smartbatt_read(struct i2c_client *client, u8 reg); -#if 0 -static int smartbatt_write_value(struct i2c_client *client, u8 reg, u16 value); -#endif -static void smartbatt_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smartbatt_i(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smartbatt_v(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smartbatt_time(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smartbatt_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smartbatt_charge(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smartbatt_status(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smartbatt_error(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smartbatt_update_client(struct i2c_client *client); - - -/* This is the driver that will be inserted */ -static struct i2c_driver smartbatt_driver = { - .name = "Smart Battery chip driver", - .id = I2C_DRIVERID_SMARTBATT, - .flags = I2C_DF_NOTIFY, - .attach_adapter = smartbatt_attach_adapter, - .detach_client = smartbatt_detach_client, -}; - - -/* -- SENSORS SYSCTL START -- */ - -/* Status Register Bits */ -/* * * * * * Alarm Bits * * * * */ -#define SMARTBATT_OVER_CHARGED_ALARM 0x8000 -#define SMARTBATT_TERMINATE_CHARGE_ALARM 0x4000 -#define SMARTBATT_OVER_TEMP_ALARM 0x1000 -#define SMARTBATT_TERMINATE_DISCHARGE_ALARM 0x0800 -#define SMARTBATT_REMAINING_CAPACITY_ALARM 0x0200 -#define SMARTBATT_REMAINING_TIME_ALARM 0x0100 -/* * * * * * Status Bits * * * * */ -#define SMARTBATT_INITIALIZED 0x0080 -#define SMARTBATT_DISCHARGING 0x0040 -#define SMARTBATT_FULLY_CHARGED 0x0020 -#define SMARTBATT_FULLY_DISCHARGED 0x0010 -/* * * * * * Error Bits * * * * */ -#define SMARTBATT_OK 0x0000 -#define SMARTBATT_BUSY 0x0001 -#define SMARTBATT_RESERVED_COMMAND 0x0002 -#define SMARTBATT_UNSUPPORTED_COMMAND 0x0003 -#define SMARTBATT_ACCESS_DENIED 0x0004 -#define SMARTBATT_OVER_UNDERFLOW 0x0005 -#define SMARTBATT_BAD_SIZE 0x0006 -#define SMARTBATT_UNKNOWN_ERROR 0x0007 - -#define SMARTBATT_ALARM (SMARTBATT_OVER_CHARGED_ALARM \ - | SMARTBATT_TERMINATE_CHARGE_ALARM | SMARTBATT_OVER_TEMP_ALARM \ - | SMARTBATT_TERMINATE_DISCHARGE_ALARM \ - | SMARTBATT_REMAINING_CAPACITY_ALARM \ - | SMARTBATT_REMAINING_TIME_ALARM) - -#define SMARTBATT_STATUS (SMARTBATT_INITIALIZED | SMARTBATT_DISCHARGING \ - | SMARTBATT_FULLY_CHARGED | SMARTBATT_FULLY_DISCHARGED ) - -#define SMARTBATT_ERROR (SMARTBATT_BUSY | SMARTBATT_RESERVED_COMMAND \ - | SMARTBATT_UNSUPPORTED_COMMAND | SMARTBATT_ACCESS_DENIED \ - | SMARTBATT_OVER_UNDERFLOW | SMARTBATT_BAD_SIZE\ - | SMARTBATT_UNKNOWN_ERROR) - - -#define SMARTBATT_SYSCTL_I 1001 -#define SMARTBATT_SYSCTL_V 1002 -#define SMARTBATT_SYSCTL_TEMP 1003 -#define SMARTBATT_SYSCTL_TIME 1004 -#define SMARTBATT_SYSCTL_ALARMS 1005 -#define SMARTBATT_SYSCTL_STATUS 1006 -#define SMARTBATT_SYSCTL_ERROR 1007 -#define SMARTBATT_SYSCTL_CHARGE 1008 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected SMARTBATT. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table smartbatt_dir_table_template[] = { - {SMARTBATT_SYSCTL_I, "i", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smartbatt_i}, - {SMARTBATT_SYSCTL_V, "v", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smartbatt_v}, - {SMARTBATT_SYSCTL_TEMP, "temp", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smartbatt_temp}, - {SMARTBATT_SYSCTL_TIME, "time", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smartbatt_time}, - {SMARTBATT_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smartbatt_alarms}, - {SMARTBATT_SYSCTL_STATUS, "status", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smartbatt_status}, - {SMARTBATT_SYSCTL_ERROR, "error", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smartbatt_error}, - {SMARTBATT_SYSCTL_CHARGE, "charge", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smartbatt_charge}, - {0} -}; - -static int smartbatt_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, smartbatt_detect); -} - -/* This function is called by i2c_detect */ -int smartbatt_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct smartbatt_data *data; - int err = 0; - const char *type_name, *client_name; - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("smartbatt.o: smartbatt_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access smartbatt_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct smartbatt_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &smartbatt_driver; - new_client->flags = 0; - - /* Lousy detection. Check the temp, voltage, and current registers */ - if (kind < 0) { - for (i = 0x08; i <= 0x0a; i++) - if (i2c_smbus_read_word_data(new_client, i) == 0xffff) - goto ERROR1; - } - - kind = smartbatt; - type_name = "smartbatt"; - client_name = "Smart Battery"; - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - smartbatt_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - smartbatt_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int smartbatt_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct smartbatt_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("smartbatt.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - -static int smartbatt_read(struct i2c_client *client, u8 reg) -{ - int n = COMM_TIMEOUT; - int val; - do { - val = i2c_smbus_read_word_data(client, reg); - } while ((val == -1) && (n-- > 0)); - return val; -} - -#if 0 -static int smartbatt_write_value(struct i2c_client *client, u8 reg, u16 value) -{ - /* Why swap bytes? */ - return i2c_smbus_write_word_data(client, reg, swab16(value)); -} -#endif - -#define COMM_TIMEOUT 16 -static void get_battery_info(struct i2c_client *client) -{ - struct smartbatt_data *data = client->data; - int val; - - down(&data->update_lock); - data->chgcap = smartbatt_read(client, SMARTBATT_REG_CHGCAP); - data->descap = smartbatt_read(client, SMARTBATT_REG_DESCAP); - data->desv = smartbatt_read(client, SMARTBATT_REG_DESV); - /* ManufactureDate */ - val = smartbatt_read(client, SMARTBATT_REG_DATE); - data->manufacture_date.day=val & 0x1F; - data->manufacture_date.month=(val >> 5) & 0x0F; - data->manufacture_date.year=(val >> 9) & 0x7F; - - /* SerialNumber */ - data->serial = smartbatt_read(client, SMARTBATT_REG_SERIAL); -#if 0 - /* ManufacturerName */ - n=COMM_TIMEOUT; - do { - val = i2c_smbus_read_block_data(client, 0x20, data->manufacturer); - } while ((val == -1) && (n-- > 0)); - data->manufacturer[val]=0; - - /* DeviceName */ - n=COMM_TIMEOUT; - do { - val = i2c_smbus_read_block_data(client, 0x21, data->device); - } while ((val == -1) && (n-- > 0)); - data->device[val]=0; - - /* DeviceChemistry */ - n=COMM_TIMEOUT; - do { - val = i2c_smbus_read_block_data(client, 0x22, data->chemistry); - } while ((val == -1) && (n-- > 0)); - data->chemistry[val]=0; -#endif - up(&data->update_lock); - -} - -static void smartbatt_init_client(struct i2c_client *client) -{ - get_battery_info( client ); -} - -static void smartbatt_update_client(struct i2c_client *client) -{ - struct smartbatt_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - data->mode = smartbatt_read(client, SMARTBATT_REG_MODE); - data->temp = smartbatt_read(client, SMARTBATT_REG_TEMP); - data->i = smartbatt_read(client, SMARTBATT_REG_I); - data->avgi = smartbatt_read(client, SMARTBATT_REG_AVGI); - data->v = smartbatt_read(client, SMARTBATT_REG_V); - data->chgi = smartbatt_read(client, SMARTBATT_REG_CHGI); - data->chgv = smartbatt_read(client, SMARTBATT_REG_CHGV); - data->ate = smartbatt_read(client, SMARTBATT_REG_AVGTIME_E); - data->atf = smartbatt_read(client, SMARTBATT_REG_AVGTIME_F); - data->rte = smartbatt_read(client, SMARTBATT_REG_RUNTIME_E); - data->status = smartbatt_read(client, SMARTBATT_REG_STATUS); - data->cyclect = smartbatt_read(client, SMARTBATT_REG_CYCLECT); - data->relchg = smartbatt_read(client, SMARTBATT_REG_RELCHG); - data->abschg = smartbatt_read(client, SMARTBATT_REG_ABSCHG); - data->remcap = smartbatt_read(client, SMARTBATT_REG_REMCAP); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void smartbatt_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smartbatt_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - smartbatt_update_client(client); - results[0] = data->temp - 2731; /* convert from Kelvin */ - *nrels_mag = 1; - } -} - -void smartbatt_i(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smartbatt_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - smartbatt_update_client(client); - results[0] = data->chgi; - results[1] = data->avgi; - results[2] = data->i; - *nrels_mag = 3; - } -} - -void smartbatt_v(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smartbatt_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - smartbatt_update_client(client); - results[0] = data->chgv; - results[1] = data->v; - *nrels_mag = 2; - } -} - -void smartbatt_time(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smartbatt_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - smartbatt_update_client(client); - results[0] = data->ate; - results[1] = data->atf; - results[2] = data->rte; - *nrels_mag = 3; - } -} - -void smartbatt_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smartbatt_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - smartbatt_update_client(client); - results[0] = data->status & SMARTBATT_ALARM; - *nrels_mag = 1; - } -} - -void smartbatt_status(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smartbatt_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - smartbatt_update_client(client); - results[0] = data->status & SMARTBATT_STATUS; - *nrels_mag = 1; - } -} - -void smartbatt_error(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smartbatt_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - smartbatt_update_client(client); - results[0] = data->status & SMARTBATT_ERROR; - *nrels_mag = 1; - } -} - -void smartbatt_charge(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smartbatt_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - smartbatt_update_client(client); - results[0] = data->relchg; - results[1] = data->abschg; - results[2] = data->chgi; - results[3] = data->chgv; - *nrels_mag = 4; - } -} - -static int __init sm_smartbatt_init(void) -{ - printk("smartbatt.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&smartbatt_driver); -} - -static void __exit sm_smartbatt_exit(void) -{ - i2c_del_driver(&smartbatt_driver); -} - - - -MODULE_AUTHOR("M. Studebaker "); -MODULE_DESCRIPTION("Smart Battery driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_smartbatt_init); -module_exit(sm_smartbatt_exit); diff --git a/kernel/chips/smbus-arp.c b/kernel/chips/smbus-arp.c deleted file mode 100644 index e4610078..00000000 --- a/kernel/chips/smbus-arp.c +++ /dev/null @@ -1,478 +0,0 @@ -/* - smbus-arp.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2002 Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "version.h" - -#define DEBUG 1 - -/* So that the module will still compile without i2c-2.6.4; - if inserted, it will just put out a message and exit in that case */ -#ifdef I2C_CLIENT_PEC -#define I2C_PEC_SUPPORTED -#else -#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ -#endif - -/* Addresses to scan */ -#define ARP_ADDRESS 0x61 -static unsigned short normal_i2c[] = { ARP_ADDRESS, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(arp); - -static int reset; -MODULE_PARM(reset, "i"); -MODULE_PARM_DESC(reset, - "Send an ARP Reset Device message to each bus"); - -/* ARP Commands */ -#define ARP_PREPARE 0x01 -#define ARP_RESET_DEV 0x02 -#define ARP_GET_UDID_GEN 0x03 -#define ARP_ASSIGN_ADDR 0x04 - -/* UDID Fields */ -#define ARP_CAPAB 0 -#define ARP_VER 1 -#define ARP_VEND 2 -#define ARP_DEV 4 -#define ARP_INT 6 -#define ARP_SUBVEND 8 -#define ARP_SUBDEV 10 -#define ARP_SPECID 12 - -#define UDID_LENGTH 0x11 - -static u8 reserved[] = -/* As defined by SMBus Spec. Appendix C */ - {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x28, - 0x37, ARP_ADDRESS, -/* As defined by SMBus Spec. Sect. 5.2 */ - 0x01, 0x02, 0x03, 0x04, 0x05, - 0x06, 0x07, 0x78, 0x79, 0x7a, 0x7b, - 0x7c, 0x7d, 0x7e, 0x7f, -/* Common PC addresses (bad idea) */ - 0x2d, 0x48, 0x49, /* sensors */ - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* eeproms */ - 0x69, /* clock chips */ -/* Must end in 0 which is also reserved */ - 0x00}; - -#define SMBUS_ADDRESS_SIZE 0x80 -#define ARP_FREE 0 -#define ARP_RESERVED 1 -#define ARP_BUSY 2 - -#define ARP_MAX_DEVICES 8 -struct arp_device { - int status; - u8 udid[UDID_LENGTH]; - u8 dev_cap; - u8 dev_ver; - u16 dev_vid; - u16 dev_did; - u16 dev_int; - u16 dev_svid; - u16 dev_sdid; - u32 dev_vsid; - u8 saddr; -}; - -/* Each client has this additional data */ -struct arp_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 address_pool[SMBUS_ADDRESS_SIZE]; - struct arp_device dev[ARP_MAX_DEVICES]; -}; - - -static int smbusarp_attach_adapter(struct i2c_adapter *adapter); -static int smbusarp_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int smbusarp_detach_client(struct i2c_client *client); - -static int smbusarp_init_client(struct i2c_client *client); -static void smbusarp_contents(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver smbusarp_driver = { - .name = "SMBUS ARP", - .id = I2C_DRIVERID_ARP, - .flags = I2C_DF_NOTIFY, - .attach_adapter = smbusarp_attach_adapter, - .detach_client = smbusarp_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define ARP_SYSCTL1 1000 -#define ARP_SYSCTL2 1001 -#define ARP_SYSCTL3 1002 -#define ARP_SYSCTL4 1003 -#define ARP_SYSCTL5 1004 -#define ARP_SYSCTL6 1005 -#define ARP_SYSCTL7 1006 -#define ARP_SYSCTL8 1007 - -/* -- SENSORS SYSCTL END -- */ - -static ctl_table smbusarp_dir_table_template[] = { - {ARP_SYSCTL1, "0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smbusarp_contents}, - {ARP_SYSCTL2, "1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smbusarp_contents}, - {ARP_SYSCTL3, "2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smbusarp_contents}, - {ARP_SYSCTL4, "3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smbusarp_contents}, - {ARP_SYSCTL5, "4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smbusarp_contents}, - {ARP_SYSCTL6, "5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smbusarp_contents}, - {ARP_SYSCTL7, "6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smbusarp_contents}, - {ARP_SYSCTL8, "7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smbusarp_contents}, - {0} -}; - -static int smbusarp_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, smbusarp_detect); -} - -/* This function is called by i2c_detect */ -int smbusarp_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct arp_data *data; - int err = 0; - const char *type_name, *client_name; - - /* must support block data w/ HW PEC or SW PEC */ - if ((!i2c_check_functionality(adapter, - I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_HWPEC_CALC)) && - (!i2c_check_functionality(adapter, - I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_I2C))) - return(0); - - if (!(data = kmalloc(sizeof(struct arp_data), GFP_KERNEL))) { - return(-ENOMEM); - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &smbusarp_driver; -#ifdef I2C_PEC_SUPPORTED - new_client->flags = I2C_CLIENT_PEC; -#else - new_client->flags = 0; -#endif - - type_name = "arp"; - client_name = "SMBUS ARP client"; - - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - if ((err = i2c_attach_client(new_client))) - goto ERROR1; - - if ((i = i2c_register_entry(new_client, type_name, - smbusarp_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - smbusarp_init_client(new_client); - return 0; - - ERROR4: - i2c_detach_client(new_client); - ERROR1: - kfree(data); - return err; -} - -static int smbusarp_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct arp_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - (KERN_ERR "smbus-arp.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -static u8 choose_addr(u8 * pool) -{ - int i; - - for(i = 0; i < 0x7f; i++) { - if(pool[i] == ARP_FREE) - return ((u8) i); - } - return 0xff; -} - -static int smbusarp_init_client(struct i2c_client *client) -{ - int ret = -1; -#ifdef I2C_PEC_SUPPORTED - struct arp_data *data = client->data; - u8 blk[I2C_SMBUS_BLOCK_MAX]; - u8 *r; - u8 addr; - int i; - int found = 0; - int newdev = 0; - - for(i = 0; i < ARP_MAX_DEVICES; i++) - data->dev[i].status = ARP_FREE; - - for(i = 0; i < SMBUS_ADDRESS_SIZE; i++) - data->address_pool[i] = ARP_FREE; - - r = reserved; - do { - data->address_pool[*r] = ARP_RESERVED; - } while(*r++); - - for (i = 0; i < I2C_CLIENT_MAX ; i++) - if (client->adapter->clients[i]) - data->address_pool[client->adapter->clients[i]->addr] = - ARP_BUSY; - - if(reset) - i2c_smbus_write_byte(client, ARP_RESET_DEV); - ret = i2c_smbus_write_byte(client, ARP_PREPARE); - if(ret < 0) { -#ifdef DEBUG - printk(KERN_DEBUG "smbus-arp.o: No ARP response on adapter 0x%X\n", client->adapter->id); -#endif - return(-1); /* Packet wasn't acked */ - } - while(1) { - ret = i2c_smbus_read_block_data(client, ARP_GET_UDID_GEN, blk); - if(ret != UDID_LENGTH) { -#ifdef DEBUG - printk(KERN_DEBUG "smbus-arp.o: No/Bad UDID response %d on adapter 0x%X\n", ret, client->adapter->id); -#endif - if(found) - return(found); - else - return(-1); /* Bad response */ - } -#ifdef DEBUG - printk(KERN_DEBUG "smbus-arp.o: Good UDID response on adapter 0x%X\n", client->adapter->id); - printk(KERN_DEBUG " Cap. 0x%02x Rev. 0x%02x Vend. 0x%02x%02x Dev. 0x%02x%02x\n", blk[0], blk[1], blk[2], blk[3], blk[4], blk[5]); - printk(KERN_DEBUG " Int. 0x%02x%02x Subvend. 0x%02x%02x Subdev. 0x%02x%02x Spec. 0x%02x%02x%02x%02x\n", blk[6], blk[7], blk[8], blk[9], blk[10], blk[11], blk[12], blk[13], blk[14], blk[15]); -#endif -/* clean up this... */ - found++; - do{ - if(data->dev[newdev].status == ARP_FREE) - break; - } while(++newdev < ARP_MAX_DEVICES); - if(newdev == ARP_MAX_DEVICES) { - printk(KERN_WARNING "smbus-arp.o: No more slots available\n"); - return(-1); - } - - /* check device slave addr */ - addr = blk[16]; - if(addr != 0xFF) { - addr >>= 1; - if(blk[0] & 0xC0) { - if(data->address_pool[addr] == ARP_FREE) { -#ifdef DEBUG - printk(KERN_DEBUG " Requested free Non-fixed Address 0x%02x\n", addr); -#endif - } else { -#ifdef DEBUG - printk(KERN_DEBUG " Requested busy Non-fixed Address 0x%02x\n", addr); -#endif - if((addr = - choose_addr(data->address_pool)) == - 0xff) { - printk(KERN_WARNING "smbus-arp.o: Address pool exhausted\n"); - return(-1); - } - } - } else { -#ifdef DEBUG - printk(KERN_DEBUG " Fixed Address 0x%02x\n", addr); -#endif - } - } else { -#ifdef DEBUG - printk(KERN_DEBUG " No Address\n"); -#endif - if((addr = choose_addr(data->address_pool)) == 0xff) { - printk(KERN_WARNING "smbus-arp.o: Address pool exhausted\n"); - return(-1); - } - - } - /* store things both ways */ - for(i = 0; i < UDID_LENGTH; i++) - data->dev[newdev].udid[i] = blk[i]; - data->dev[newdev].saddr = addr; - data->dev[newdev].status = ARP_BUSY; - data->dev[newdev].dev_cap = blk[0]; - data->dev[newdev].dev_ver = blk[1]; - data->dev[newdev].dev_vid = (blk[2] << 8) | blk[3]; - data->dev[newdev].dev_did = (blk[4] << 8) | blk[5]; - data->dev[newdev].dev_int = (blk[6] << 8) | blk[7]; - data->dev[newdev].dev_svid = (blk[8] << 8) | blk[9]; - data->dev[newdev].dev_sdid = (blk[10] << 8) | blk[11]; - data->dev[newdev].dev_vsid = (blk[12] << 24) | (blk[13] << 16) | - (blk[14] << 8) | blk[15] ; - - blk[16] = addr << 1; - ret = i2c_smbus_write_block_data(client, ARP_ASSIGN_ADDR, - UDID_LENGTH, blk); - if(ret) { -#ifdef DEBUG - printk(KERN_DEBUG " Bad response, address 0x%02x not assigned\n", addr); -#endif - } else { - data->address_pool[addr] = ARP_BUSY; -#ifdef DEBUG - printk(KERN_DEBUG " Assigned address 0x%02x\n", addr); -#endif - } - /* retry? */ - - } /* while 1 */ -#else - printk(KERN_WARNING "smbus-arp.o: A client responded to the ARP address but " - "your kernel does not support SMBus ARP/PEC!\n"); - ret = -EPERM; -#endif - return(ret); -} - - -/* reassign address on writex */ -void smbusarp_contents(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - int nr = ctl_name - ARP_SYSCTL1; - struct arp_data *data = client->data; - int ret; - u8 save; - u8 a; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - if(data->dev[nr].status == ARP_BUSY) { - results[0] = data->dev[nr].saddr; - results[1] = data->dev[nr].dev_cap; - results[2] = data->dev[nr].dev_ver; - results[3] = data->dev[nr].dev_vid; - results[4] = data->dev[nr].dev_did; - results[5] = data->dev[nr].dev_int; - results[6] = data->dev[nr].dev_svid; - results[7] = data->dev[nr].dev_sdid; - results[8] = data->dev[nr].dev_vsid; - *nrels_mag = 9; - } else { - *nrels_mag = 0; - } - } else if (operation == SENSORS_PROC_REAL_WRITE) { - a = results[0]; - if(*nrels_mag >= 1 && - a < SMBUS_ADDRESS_SIZE && - data->dev[nr].status == ARP_BUSY && - data->address_pool[a] == ARP_FREE) { - save = data->dev[nr].udid[16]; - data->dev[nr].udid[16] = a << 1; - ret = i2c_smbus_write_block_data(client, ARP_ASSIGN_ADDR, - UDID_LENGTH, data->dev[nr].udid); - if(ret) { - data->dev[nr].udid[16] = save; -#ifdef DEBUG - printk(KERN_DEBUG "smbus-arp Bad response, address 0x%02x not assigned\n", a); -#endif - } else { - data->dev[nr].saddr = a; - data->address_pool[a] = ARP_BUSY; -#ifdef DEBUG - printk(KERN_DEBUG "smbus-arp Assigned address 0x%02x\n", a); -#endif - } - } else { - printk(KERN_WARNING "smbus-arp Bad address 0x%02x\n", a); - } - } -} - -static int __init sm_smbusarp_init(void) -{ - printk("smbus-arp.o version %s (%s)\n", LM_VERSION, LM_DATE); -/* magic force invocation */ - force_arp[0] = -1; - force_arp[1] = ARP_ADDRESS; - return i2c_add_driver(&smbusarp_driver); -} - -static void __exit sm_smbusarp_exit(void) -{ - i2c_del_driver(&smbusarp_driver); -} - - - -MODULE_AUTHOR("Mark D. Studebaker "); -MODULE_DESCRIPTION("SMBUS ARP Driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_smbusarp_init); -module_exit(sm_smbusarp_exit); diff --git a/kernel/chips/smsc47m1.c b/kernel/chips/smsc47m1.c deleted file mode 100644 index e464e9c9..00000000 --- a/kernel/chips/smsc47m1.c +++ /dev/null @@ -1,603 +0,0 @@ -/* - smsc47m1.c - Part of lm_sensors, Linux kernel modules - for hardware monitoring - - Copyright (c) 2002 Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" - -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Initialize the base address of the sensors"); - -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0x0000, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -SENSORS_INSMOD_2(smsc47m1, smsc47m2); -static u8 devid; - -/* modified from kernel/include/traps.c */ -#define REG 0x2e /* The register to read/write */ -#define DEV 0x07 /* Register: Logical device select */ -#define VAL 0x2f /* The value to read/write */ -#define PME 0x0a /* The device with the fan registers in it */ -#define DEVID 0x20 /* Register: Device ID */ - -static inline void -superio_outb(int reg, int val) -{ - outb(reg, REG); - outb(val, VAL); -} - -static inline int -superio_inb(int reg) -{ - outb(reg, REG); - return inb(VAL); -} - -static inline void -superio_select(void) -{ - outb(DEV, REG); - outb(PME, VAL); -} - -static inline void -superio_enter(void) -{ - outb(0x55, REG); -} - -static inline void -superio_exit(void) -{ - outb(0xAA, REG); -} - -/* - * SMSC LPC47M10x/LPC47M112/LPC47M13x (device id 0x59), LPC47M14x - * (device id 0x5F) and LPC47B27x (device id 0x51) have fan control. - * The 47M15x and 47M192 chips "with hardware monitoring block" - * can do much more besides (device id 0x60). - * The LPC47M997 is undocumented, but seems to be compatible with - * the LPC47M192, and has the same device id. - * The LPC47M292 (device id 0x6B) is somewhat compatible, but it - * supports a 3rd fan, and the pin configuration registers are - * unfortunately different. - */ -#define SMSC_DEVID_MATCH(id) ((id) == 0x51 || (id) == 0x59 || \ - (id) == 0x5F || (id) == 0x60 || \ - (id) == 0x6B) - -#define SMSC_ACT_REG 0x30 -#define SMSC_BASE_REG 0x60 - -#define SMSC_EXTENT 0x80 - -#define SMSC47M1_REG_ALARM1 0x04 -#define SMSC47M1_REG_TPIN2 0x33 -#define SMSC47M1_REG_TPIN1 0x34 -#define SMSC47M1_REG_PPIN(nr) (0x37 - (nr)) -#define SMSC47M1_REG_FANDIV 0x58 - -static const u8 SMSC47M1_REG_PWM[3] = { 0x56, 0x57, 0x69 }; -static const u8 SMSC47M1_REG_FAN[3] = { 0x59, 0x5a, 0x6b }; -static const u8 SMSC47M1_REG_FAN_MIN[3] = { 0x5b, 0x5c, 0x6c }; - -#define SMSC47M2_REG_ALARM6 0x09 -#define SMSC47M2_REG_TPIN3 0x2d -#define SMSC47M2_REG_TPIN2 0x37 -#define SMSC47M2_REG_TPIN1 0x38 -#define SMSC47M2_REG_FANDIV3 0x6a - -static inline u8 MIN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 0; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT(192 - ((983040 + rpm * div / 2) / (rpm * div)), - 0, 191); -} - -#define MIN_FROM_REG(val,div) ((val)>=192?0: \ - 983040/((192-(val))*(div))) -#define FAN_FROM_REG(val,div,preload) ((val)==0?-1:(val)==255?0: \ - 983040/(((val)-preload)*(div))) -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) -/* reg is 6 middle bits; /proc is 8 bits */ -#define PWM_FROM_REG(val) (((val) << 1) & 0xfc) -#define PWM_TO_REG(val) (((SENSORS_LIMIT((val), 0, 255)) >> 1) & 0x7e) - -struct smsc47m1_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 fan[3]; /* Register value */ - u8 fan_min[3]; /* Register value */ - u8 fan_div[3]; /* Register encoding, shifted right */ - u8 alarms; /* Register encoding */ - u8 pwm[3]; /* Register value (bit 0 is disable) */ -}; - - -static int smsc47m1_attach_adapter(struct i2c_adapter *adapter); -static int smsc47m1_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int smsc47m1_detach_client(struct i2c_client *client); -static void smsc47m1_update_client(struct i2c_client *client); -static void smsc47m1_init_client(struct i2c_client *client); - - -static void smsc47m1_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smsc47m1_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smsc47m1_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void smsc47m1_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver smsc47m1_driver = { - .name = "SMSC 47M1xx fan monitor", - .id = I2C_DRIVERID_SMSC47M1, - .flags = I2C_DF_NOTIFY, - .attach_adapter = smsc47m1_attach_adapter, - .detach_client = smsc47m1_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define SMSC47M1_SYSCTL_FAN1 1101 /* Rotations/min */ -#define SMSC47M1_SYSCTL_FAN2 1102 -#define SMSC47M1_SYSCTL_FAN3 1103 -#define SMSC47M1_SYSCTL_PWM1 1401 -#define SMSC47M1_SYSCTL_PWM2 1402 -#define SMSC47M1_SYSCTL_PWM3 1403 -#define SMSC47M1_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define SMSC47M1_SYSCTL_ALARMS 2004 /* bitvector */ - -#define SMSC47M1_ALARM_FAN1 0x0001 -#define SMSC47M1_ALARM_FAN2 0x0002 -#define SMSC47M1_ALARM_FAN3 0x0004 - -/* -- SENSORS SYSCTL END -- */ - -static ctl_table smsc47m1_dir_table_template[] = { - {SMSC47M1_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_fan}, - {SMSC47M1_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_fan}, - {SMSC47M1_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_fan_div}, - {SMSC47M1_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_alarms}, - {SMSC47M1_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_pwm}, - {SMSC47M1_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_pwm}, - {0} -}; - -static ctl_table smsc47m2_dir_table_template[] = { - {SMSC47M1_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_fan}, - {SMSC47M1_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_fan}, - {SMSC47M1_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_fan}, - {SMSC47M1_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_fan_div}, - {SMSC47M1_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_alarms}, - {SMSC47M1_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_pwm}, - {SMSC47M1_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_pwm}, - {SMSC47M1_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &smsc47m1_pwm}, - {0} -}; - -static int smsc47m1_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, smsc47m1_detect); -} - -static int __init smsc47m1_find(int *address) -{ - u16 val; - - superio_enter(); - devid = superio_inb(DEVID); - if (!SMSC_DEVID_MATCH(devid)) { - superio_exit(); - return -ENODEV; - } - - superio_select(); - val = (superio_inb(SMSC_BASE_REG) << 8) | - superio_inb(SMSC_BASE_REG + 1); - *address = val & ~(SMSC_EXTENT - 1); - if (*address == 0 && force_addr == 0) { - printk("smsc47m1.o: base address not set - use force_addr=0xaddr\n"); - superio_exit(); - return -ENODEV; - } - if (force_addr) - *address = force_addr; /* so detect will get called */ - - superio_exit(); - return 0; -} - -int smsc47m1_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct smsc47m1_data *data; - int err = 0; - const char *type_name; - const char *client_name; - - if (!i2c_is_isa_adapter(adapter)) { - return 0; - } - - if(force_addr) - address = force_addr & ~(SMSC_EXTENT - 1); - if (check_region(address, SMSC_EXTENT)) { - printk("smsc47m1.o: region 0x%x already in use!\n", address); - return -ENODEV; - } - if(force_addr) { - printk("smsc47m1.o: forcing ISA address 0x%04X\n", address); - superio_enter(); - superio_select(); - superio_outb(SMSC_BASE_REG, address >> 8); - superio_outb(SMSC_BASE_REG+1, address & 0xff); - superio_exit(); - } - - if (!(data = kmalloc(sizeof(struct smsc47m1_data), GFP_KERNEL))) { - return -ENOMEM; - } - - switch (devid) { - case 0x51: - kind = smsc47m1; - type_name = "smsc47m1"; - client_name = "LPC47B27x chip"; - break; - case 0x5F: - kind = smsc47m1; - type_name = "smsc47m1"; - client_name = "LPC47M14x chip"; - break; - case 0x60: - kind = smsc47m1; - type_name = "smsc47m1"; - client_name = "LPC47M192 chip"; - break; - case 0x6B: - kind = smsc47m2; - type_name = "smsc47m2"; - client_name = "LPC47M292 chip"; - break; - default: - kind = smsc47m1; - type_name = "smsc47m1"; - client_name = "LPC47M1xx chip"; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &smsc47m1_driver; - new_client->flags = 0; - - request_region(address, SMSC_EXTENT, "smsc47m1-fans"); - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - if ((i = i2c_register_entry((struct i2c_client *) new_client, - type_name, - kind == smsc47m2 ? - smsc47m2_dir_table_template : - smsc47m1_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - smsc47m1_init_client(new_client); - return 0; - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - release_region(address, SMSC_EXTENT); - kfree(data); - return err; -} - -static int smsc47m1_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct smsc47m1_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("smsc47m1.o: Client deregistration failed, client not detached.\n"); - return err; - } - - release_region(client->addr, SMSC_EXTENT); - kfree(client->data); - - return 0; -} - -static inline int smsc47m1_read_value(struct i2c_client *client, u8 reg) -{ - return inb_p(client->addr + reg); -} - -static inline void smsc47m1_write_value(struct i2c_client *client, u8 reg, - u8 value) -{ - outb_p(value, client->addr + reg); -} - -static void smsc47m1_init_client(struct i2c_client *client) -{ - struct smsc47m1_data *data = client->data; - u8 reg; - - switch (data->type) { - case smsc47m2: - /* For the new LPC47M292 chip, I prefer to play it safe and - only report the pin configuration */ - reg = smsc47m1_read_value(client, SMSC47M2_REG_TPIN1); - if ((reg & 0x0d) != 0x09) - printk(KERN_NOTICE "smsc47m1: GP35 not configured for " - "fan input, ignore fan1 values\n"); - reg = smsc47m1_read_value(client, SMSC47M2_REG_TPIN2); - if ((reg & 0x0d) != 0x09) - printk(KERN_NOTICE "smsc47m1: GP34 not configured for " - "fan input, ignore fan2 values\n"); - reg = smsc47m1_read_value(client, SMSC47M2_REG_TPIN3); - if ((reg & 0x0d) != 0x0d) - printk(KERN_NOTICE "smsc47m1: GP33 not configured for " - "fan input, ignore fan3 values\n"); - break; - default: - /* configure pins for tach function */ - smsc47m1_write_value(client, SMSC47M1_REG_TPIN1, 0x05); - smsc47m1_write_value(client, SMSC47M1_REG_TPIN2, 0x05); - } -} - -static void smsc47m1_update_client(struct i2c_client *client) -{ - struct smsc47m1_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - int i, fan_nr; - fan_nr = data->type == smsc47m2 ? 3 : 2; - - for (i = 0; i < fan_nr; i++) { - data->fan[i] = - smsc47m1_read_value(client, SMSC47M1_REG_FAN[i]); - data->fan_min[i] = - smsc47m1_read_value(client, SMSC47M1_REG_FAN_MIN[i]); - data->pwm[i] = - smsc47m1_read_value(client, SMSC47M1_REG_PWM[i]); - } - - i = smsc47m1_read_value(client, SMSC47M1_REG_FANDIV); - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = i >> 6; - data->alarms = - smsc47m1_read_value(client, SMSC47M1_REG_ALARM1) >> 6; - if(data->alarms) - smsc47m1_write_value(client, SMSC47M1_REG_ALARM1, 0xc0); - - if (fan_nr >= 3) { - data->fan_div[2] = (smsc47m1_read_value(client, - SMSC47M2_REG_FANDIV3) >> 4) & 0x03; - data->alarms |= (smsc47m1_read_value(client, - SMSC47M2_REG_ALARM6) & 0x40) >> 4; - if (data->alarms & 0x04) - smsc47m1_write_value(client, - SMSC47M2_REG_ALARM6, - 0x40); - } - - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void smsc47m1_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smsc47m1_data *data = client->data; - int nr = ctl_name - SMSC47M1_SYSCTL_FAN1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - smsc47m1_update_client(client); - results[0] = MIN_FROM_REG(data->fan_min[nr], - DIV_FROM_REG(data->fan_div[nr])); - results[1] = FAN_FROM_REG(data->fan[nr], - DIV_FROM_REG(data->fan_div[nr]), - data->fan_min[nr]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr] = MIN_TO_REG(results[0], - DIV_FROM_REG(data->fan_div[nr])); - smsc47m1_write_value(client, SMSC47M1_REG_FAN_MIN[nr], - data->fan_min[nr]); - } - } -} - - -void smsc47m1_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smsc47m1_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - smsc47m1_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -void smsc47m1_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct smsc47m1_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - smsc47m1_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = smsc47m1_read_value(client, SMSC47M1_REG_FANDIV); - if (*nrels_mag >= 3 && data->type == smsc47m2) { - data->fan_div[2] = DIV_TO_REG(results[2]); - smsc47m1_write_value(client, SMSC47M2_REG_FANDIV3, - (smsc47m1_read_value(client, - SMSC47M2_REG_FANDIV3) & 0xcf) - | (data->fan_div[2] << 4)); - } - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) | (data->fan_div[1] << 6); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan_div[0] << 4); - smsc47m1_write_value(client, SMSC47M1_REG_FANDIV, old); - } - } -} - -void smsc47m1_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct smsc47m1_data *data = client->data; - int nr = ctl_name - SMSC47M1_SYSCTL_PWM1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - smsc47m1_update_client(client); - results[0] = PWM_FROM_REG(data->pwm[nr]); - results[1] = !(data->pwm[nr] & 0x01); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->pwm[nr] = smsc47m1_read_value(client, - SMSC47M1_REG_PWM[nr]) & 0x81; - data->pwm[nr] |= PWM_TO_REG(results[0]); - if (*nrels_mag >= 2) { - if (results[1]) { - /* enable PWM */ - data->pwm[nr] &= 0xfe; - } else { - /* disable PWM */ - data->pwm[nr] |= 0x01; - } - } - smsc47m1_write_value(client, SMSC47M1_REG_PWM[nr], - data->pwm[nr]); - } - } -} - -static int __init sm_smsc47m1_init(void) -{ - int addr; - - printk("smsc47m1.o version %s (%s)\n", LM_VERSION, LM_DATE); - - if (smsc47m1_find(&addr)) { - printk("smsc47m1.o: SMSC 47M1xx not detected, module not inserted.\n"); - return -ENODEV; - } - normal_isa[0] = addr; - - return i2c_add_driver(&smsc47m1_driver); -} - -static void __exit sm_smsc47m1_exit(void) -{ - i2c_del_driver(&smsc47m1_driver); -} - - - -MODULE_AUTHOR("Mark D. Studebaker "); -MODULE_DESCRIPTION("SMSC 47M1xx Fan sensors"); -MODULE_LICENSE("GPL"); - -module_init(sm_smsc47m1_init); -module_exit(sm_smsc47m1_exit); diff --git a/kernel/chips/thmc50.c b/kernel/chips/thmc50.c deleted file mode 100644 index a0c50e7f..00000000 --- a/kernel/chips/thmc50.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - thmc50.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard and - Philip Edelbrock - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#define DEBUG 1 - -#include -#include -#include -#include -#include -#include "version.h" - -MODULE_LICENSE("GPL"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x2D, 0x2E, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(thmc50); - -/* Many THMC50 constants specified below */ - -/* The THMC50 registers */ -#define THMC50_REG_TEMP 0x27 -#define THMC50_REG_CONF 0x40 -#define THMC50_REG_TEMP_HYST 0x3A -#define THMC50_REG_TEMP_OS 0x39 - -#define THMC50_REG_TEMP_TRIP 0x13 -#define THMC50_REG_TEMP_REMOTE_TRIP 0x14 -#define THMC50_REG_TEMP_DEFAULT_TRIP 0x17 -#define THMC50_REG_TEMP_REMOTE_DEFAULT_TRIP 0x18 -#define THMC50_REG_ANALOG_OUT 0x19 -#define THMC50_REG_REMOTE_TEMP 0x26 -#define THMC50_REG_REMOTE_TEMP_HYST 0x38 -#define THMC50_REG_REMOTE_TEMP_OS 0x37 - -#define THMC50_REG_INTER 0x41 -#define THMC50_REG_INTER_MIRROR 0x4C -#define THMC50_REG_INTER_MASK 0x43 - -#define THMC50_REG_COMPANY_ID 0x3E -#define THMC50_REG_DIE_CODE 0x3F - - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -#define TEMP_FROM_REG(val) ((val>127)?val - 0x0100:val) -#define TEMP_TO_REG(val) ((val<0)?0x0100+val:val) - -/* Each client has this additional data */ -struct thmc50_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u16 temp, temp_os, temp_hyst, - remote_temp, remote_temp_os, remote_temp_hyst, - inter, inter_mask, die_code, analog_out; /* Register values */ -}; - -static int thmc50_attach_adapter(struct i2c_adapter *adapter); -static int thmc50_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void thmc50_init_client(struct i2c_client *client); -static int thmc50_detach_client(struct i2c_client *client); - -static int thmc50_read_value(struct i2c_client *client, u8 reg); -static int thmc50_write_value(struct i2c_client *client, u8 reg, - u16 value); -static void thmc50_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void thmc50_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, - long *results); -static void thmc50_inter(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void thmc50_inter_mask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void thmc50_die_code(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void thmc50_analog_out(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void thmc50_update_client(struct i2c_client *client); - - -/* This is the driver that will be inserted */ -static struct i2c_driver thmc50_driver = { - .name = "THMC50 sensor chip driver", - .id = I2C_DRIVERID_THMC50, - .flags = I2C_DF_NOTIFY, - .attach_adapter = thmc50_attach_adapter, - .detach_client = thmc50_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define THMC50_SYSCTL_TEMP 1200 /* Degrees Celsius */ -#define THMC50_SYSCTL_REMOTE_TEMP 1201 /* Degrees Celsius */ -#define THMC50_SYSCTL_INTER 1202 -#define THMC50_SYSCTL_INTER_MASK 1203 -#define THMC50_SYSCTL_DIE_CODE 1204 -#define THMC50_SYSCTL_ANALOG_OUT 1205 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected THMC50. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table thmc50_dir_table_template[] = { - {THMC50_SYSCTL_TEMP, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &thmc50_temp}, - {THMC50_SYSCTL_REMOTE_TEMP, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &thmc50_remote_temp}, - {THMC50_SYSCTL_INTER, "inter", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &thmc50_inter}, - {THMC50_SYSCTL_INTER_MASK, "inter_mask", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &thmc50_inter_mask}, - {THMC50_SYSCTL_DIE_CODE, "die_code", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &thmc50_die_code}, - {THMC50_SYSCTL_ANALOG_OUT, "analog_out", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &thmc50_analog_out}, - {0} -}; - - -static int thmc50_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, thmc50_detect); -} - -/* This function is called by i2c_detect */ -int thmc50_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int company, i; - struct i2c_client *new_client; - struct thmc50_data *data; - int err = 0; - const char *type_name, *client_name; - -#ifdef DEBUG - printk("thmc50.o: Probing for THMC50 at 0x%2X on bus %d\n", - address, adapter->id); -#endif - - /* Make sure we aren't probing the ISA bus!! This is just a safety check - at this moment; i2c_detect really won't call us. */ -#ifdef DEBUG - if (i2c_is_isa_adapter(adapter)) { - printk - ("thmc50.o: thmc50_detect called for an ISA bus adapter?!?\n"); - return 0; - } -#endif - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto ERROR0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access thmc50_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct thmc50_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &thmc50_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - company = - i2c_smbus_read_byte_data(new_client, THMC50_REG_COMPANY_ID); - - if (company != 0x49) { -#ifdef DEBUG - printk - ("thmc50.o: Detect of THMC50 failed (reg 3E: 0x%X)\n", - company); -#endif - goto ERROR1; - } - - /* Determine the chip type - only one kind supported! */ - kind = thmc50; - - if (kind == thmc50) { - type_name = "thmc50"; - client_name = "THMC50 chip"; - } else { -#ifdef DEBUG - printk("thmc50.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - thmc50_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - thmc50_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int thmc50_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct thmc50_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("thmc50.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; -} - - -/* All registers are word-sized, except for the configuration register. - THMC50 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int thmc50_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -/* All registers are word-sized, except for the configuration register. - THMC50 uses a high-byte first convention, which is exactly opposite to - the usual practice. */ -static int thmc50_write_value(struct i2c_client *client, u8 reg, u16 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -static void thmc50_init_client(struct i2c_client *client) -{ - thmc50_write_value(client, THMC50_REG_CONF, 1); -} - -static void thmc50_update_client(struct i2c_client *client) -{ - struct thmc50_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting thmc50 update\n"); -#endif - - data->temp = thmc50_read_value(client, THMC50_REG_TEMP); - data->temp_os = - thmc50_read_value(client, THMC50_REG_TEMP_OS); - data->temp_hyst = - thmc50_read_value(client, THMC50_REG_TEMP_HYST); - data->remote_temp = - thmc50_read_value(client, THMC50_REG_REMOTE_TEMP); - data->remote_temp_os = - thmc50_read_value(client, THMC50_REG_REMOTE_TEMP_OS); - data->remote_temp_hyst = - thmc50_read_value(client, THMC50_REG_REMOTE_TEMP_HYST); - data->inter = thmc50_read_value(client, THMC50_REG_INTER); - data->inter_mask = - thmc50_read_value(client, THMC50_REG_INTER_MASK); - data->die_code = - thmc50_read_value(client, THMC50_REG_DIE_CODE); - data->analog_out = - thmc50_read_value(client, THMC50_REG_ANALOG_OUT); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void thmc50_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct thmc50_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - thmc50_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_os); - results[1] = TEMP_FROM_REG(data->temp_hyst); - results[2] = TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_os = TEMP_TO_REG(results[0]); - thmc50_write_value(client, THMC50_REG_TEMP_OS, - data->temp_os); - } - if (*nrels_mag >= 2) { - data->temp_hyst = TEMP_TO_REG(results[1]); - thmc50_write_value(client, THMC50_REG_TEMP_HYST, - data->temp_hyst); - } - } -} - - -void thmc50_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct thmc50_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - thmc50_update_client(client); - results[0] = TEMP_FROM_REG(data->remote_temp_os); - results[1] = TEMP_FROM_REG(data->remote_temp_hyst); - results[2] = TEMP_FROM_REG(data->remote_temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->remote_temp_os = TEMP_TO_REG(results[0]); - thmc50_write_value(client, - THMC50_REG_REMOTE_TEMP_OS, - data->remote_temp_os); - } - if (*nrels_mag >= 2) { - data->remote_temp_hyst = TEMP_TO_REG(results[1]); - thmc50_write_value(client, - THMC50_REG_REMOTE_TEMP_HYST, - data->remote_temp_hyst); - } - } -} - - -void thmc50_inter(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct thmc50_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - thmc50_update_client(client); - results[0] = data->inter; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - printk("thmc50.o: No writes to Interrupt register!\n"); - } -} - - -void thmc50_inter_mask(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct thmc50_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - thmc50_update_client(client); - results[0] = data->inter_mask; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->inter_mask = results[0]; - thmc50_write_value(client, THMC50_REG_INTER_MASK, - data->inter_mask); - } - } -} - - -void thmc50_die_code(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct thmc50_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - thmc50_update_client(client); - results[0] = data->die_code; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - printk("thmc50.o: No writes to Die-Code register!\n"); - } -} - - -void thmc50_analog_out(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct thmc50_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - thmc50_update_client(client); - results[0] = data->analog_out; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->analog_out = results[0]; - thmc50_write_value(client, THMC50_REG_ANALOG_OUT, - data->analog_out); - } - } -} - - - - -static int __init sm_thmc50_init(void) -{ - printk("thmc50.o version %s (%s)\n", LM_VERSION, LM_DATE); - - return i2c_add_driver(&thmc50_driver); -} - -static void __exit sm_thmc50_exit(void) -{ - i2c_del_driver(&thmc50_driver); -} - - - -MODULE_AUTHOR - ("Frodo Looijaard and Philip Edelbrock "); -MODULE_DESCRIPTION("THMC50 driver"); - -module_init(sm_thmc50_init); -module_exit(sm_thmc50_exit); diff --git a/kernel/chips/via686a.c b/kernel/chips/via686a.c deleted file mode 100644 index 34321ee5..00000000 --- a/kernel/chips/via686a.c +++ /dev/null @@ -1,840 +0,0 @@ -/* - via686a.c - Part of lm_sensors, Linux kernel modules - for hardware monitoring - - Copyright (c) 1998 - 2002 Frodo Looijaard , - Kyösti Mälkki , - Mark Studebaker , - and Bob Dougherty - (Some conversion-factor data were contributed by Jonathan Teh Soon Yew - and Alex van Kaam .) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - Supports the Via VT82C686A, VT82C686B south bridges. - Reports all as a 686A. - See doc/chips/via686a for details. - Warning - only supports a single device. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_compat.h" - - -/* If force_addr is set to anything different from 0, we forcibly enable - the device at the given address. */ -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Initialize the base address of the sensors"); - -/* Addresses to scan. - Note that we can't determine the ISA address until we have initialized - our module */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0x0000, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(via686a); - -/* - The Via 686a southbridge has a LM78-like chip integrated on the same IC. - This driver is a customized copy of lm78.c -*/ - -/* Many VIA686A constants specified below */ - -/* Length of ISA address segment */ -#define VIA686A_EXTENT 0x80 -#define VIA686A_BASE_REG 0x70 -#define VIA686A_ENABLE_REG 0x74 - -/* The VIA686A registers */ -/* ins numbered 0-4 */ -#define VIA686A_REG_IN_MAX(nr) (0x2b + ((nr) * 2)) -#define VIA686A_REG_IN_MIN(nr) (0x2c + ((nr) * 2)) -#define VIA686A_REG_IN(nr) (0x22 + (nr)) - -/* fans numbered 1-2 */ -#define VIA686A_REG_FAN_MIN(nr) (0x3a + (nr)) -#define VIA686A_REG_FAN(nr) (0x28 + (nr)) - -// the following values are as speced by VIA: -static const u8 regtemp[] = { 0x20, 0x21, 0x1f }; -static const u8 regover[] = { 0x39, 0x3d, 0x1d }; -static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e }; - -/* temps numbered 1-3 */ -#define VIA686A_REG_TEMP(nr) (regtemp[(nr) - 1]) -#define VIA686A_REG_TEMP_OVER(nr) (regover[(nr) - 1]) -#define VIA686A_REG_TEMP_HYST(nr) (reghyst[(nr) - 1]) -#define VIA686A_REG_TEMP_LOW1 0x4b // bits 7-6 -#define VIA686A_REG_TEMP_LOW23 0x49 // 2 = bits 5-4, 3 = bits 7-6 - -#define VIA686A_REG_ALARM1 0x41 -#define VIA686A_REG_ALARM2 0x42 -#define VIA686A_REG_FANDIV 0x47 -#define VIA686A_REG_CONFIG 0x40 -// The following register sets temp interrupt mode (bits 1-0 for temp1, -// 3-2 for temp2, 5-4 for temp3). Modes are: -// 00 interrupt stays as long as value is out-of-range -// 01 interrupt is cleared once register is read (default) -// 10 comparator mode- like 00, but ignores hysteresis -// 11 same as 00 -#define VIA686A_REG_TEMP_MODE 0x4b -// We'll just assume that you want to set all 3 simultaneously: -#define VIA686A_TEMP_MODE_MASK 0x3F -#define VIA686A_TEMP_MODE_CONTINUOUS (0x00) - -/* Conversions. Limit checking is only done on the TO_REG - variants. */ - -/********* VOLTAGE CONVERSIONS (Bob Dougherty) ********/ -// From HWMon.cpp (Copyright 1998-2000 Jonathan Teh Soon Yew): -// voltagefactor[0]=1.25/2628; (2628/1.25=2102.4) // Vccp -// voltagefactor[1]=1.25/2628; (2628/1.25=2102.4) // +2.5V -// voltagefactor[2]=1.67/2628; (2628/1.67=1573.7) // +3.3V -// voltagefactor[3]=2.6/2628; (2628/2.60=1010.8) // +5V -// voltagefactor[4]=6.3/2628; (2628/6.30=417.14) // +12V -// in[i]=(data[i+2]*25.0+133)*voltagefactor[i]; -// That is: -// volts = (25*regVal+133)*factor -// regVal = (volts/factor-133)/25 -// (These conversions were contributed by Jonathan Teh Soon Yew -// ) -static inline u8 IN_TO_REG(long val, int inNum) -{ - /* To avoid floating point, we multiply constants by 10 (100 for +12V). - Rounding is done (120500 is actually 133000 - 12500). - Remember that val is expressed in 0.01V/bit, which is why we divide - by an additional 1000 (10000 for +12V): 100 for val and 10 (100) - for the constants. */ - if (inNum <= 1) - return (u8) - SENSORS_LIMIT((val * 21024 - 120500) / 25000, 0, 255); - else if (inNum == 2) - return (u8) - SENSORS_LIMIT((val * 15737 - 120500) / 25000, 0, 255); - else if (inNum == 3) - return (u8) - SENSORS_LIMIT((val * 10108 - 120500) / 25000, 0, 255); - else - return (u8) - SENSORS_LIMIT((val * 41714 - 1205000) / 250000, 0, 255); -} - -static inline long IN_FROM_REG(u8 val, int inNum) -{ - /* To avoid floating point, we multiply constants by 10 (100 for +12V). - We also multiply them by 100 because we want 0.01V/bit for the - output value. Rounding is done. */ - if (inNum <= 1) - return (long) ((25000 * val + 133000 + 21024 / 2) / 21024); - else if (inNum == 2) - return (long) ((25000 * val + 133000 + 15737 / 2) / 15737); - else if (inNum == 3) - return (long) ((25000 * val + 133000 + 10108 / 2) / 10108); - else - return (long) ((250000 * val + 1330000 + 41714 / 2) / 41714); -} - -/********* FAN RPM CONVERSIONS ********/ -// Higher register values = slower fans (the fan's strobe gates a counter). -// But this chip saturates back at 0, not at 255 like all the other chips. -// So, 0 means 0 RPM -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 0; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, 255); -} - -#define FAN_FROM_REG(val,div) ((val)==0?0:(val)==255?0:1350000/((val)*(div))) - -/******** TEMP CONVERSIONS (Bob Dougherty) *********/ -// linear fits from HWMon.cpp (Copyright 1998-2000 Jonathan Teh Soon Yew) -// if(temp<169) -// return double(temp)*0.427-32.08; -// else if(temp>=169 && temp<=202) -// return double(temp)*0.582-58.16; -// else -// return double(temp)*0.924-127.33; -// -// A fifth-order polynomial fits the unofficial data (provided by Alex van -// Kaam ) a bit better. It also give more reasonable -// numbers on my machine (ie. they agree with what my BIOS tells me). -// Here's the fifth-order fit to the 8-bit data: -// temp = 1.625093e-10*val^5 - 1.001632e-07*val^4 + 2.457653e-05*val^3 - -// 2.967619e-03*val^2 + 2.175144e-01*val - 7.090067e+0. -// -// (2000-10-25- RFD: thanks to Uwe Andersen for -// finding my typos in this formula!) -// -// Alas, none of the elegant function-fit solutions will work because we -// aren't allowed to use floating point in the kernel and doing it with -// integers doesn't provide enough precision. So we'll do boring old -// look-up table stuff. The unofficial data (see below) have effectively -// 7-bit resolution (they are rounded to the nearest degree). I'm assuming -// that the transfer function of the device is monotonic and smooth, so a -// smooth function fit to the data will allow us to get better precision. -// I used the 5th-order poly fit described above and solved for -// VIA register values 0-255. I *10 before rounding, so we get tenth-degree -// precision. (I could have done all 1024 values for our 10-bit readings, -// but the function is very linear in the useful range (0-80 deg C), so -// we'll just use linear interpolation for 10-bit readings.) So, tempLUT -// is the temp at via register values 0-255: -static const s16 tempLUT[] = - { -709, -688, -667, -646, -627, -607, -589, -570, -553, -536, -519, - -503, -487, -471, -456, -442, -428, -414, -400, -387, -375, - -362, -350, -339, -327, -316, -305, -295, -285, -275, -265, - -255, -246, -237, -229, -220, -212, -204, -196, -188, -180, - -173, -166, -159, -152, -145, -139, -132, -126, -120, -114, - -108, -102, -96, -91, -85, -80, -74, -69, -64, -59, -54, -49, - -44, -39, -34, -29, -25, -20, -15, -11, -6, -2, 3, 7, 12, 16, - 20, 25, 29, 33, 37, 42, 46, 50, 54, 59, 63, 67, 71, 75, 79, 84, - 88, 92, 96, 100, 104, 109, 113, 117, 121, 125, 130, 134, 138, - 142, 146, 151, 155, 159, 163, 168, 172, 176, 181, 185, 189, - 193, 198, 202, 206, 211, 215, 219, 224, 228, 232, 237, 241, - 245, 250, 254, 259, 263, 267, 272, 276, 281, 285, 290, 294, - 299, 303, 307, 312, 316, 321, 325, 330, 334, 339, 344, 348, - 353, 357, 362, 366, 371, 376, 380, 385, 390, 395, 399, 404, - 409, 414, 419, 423, 428, 433, 438, 443, 449, 454, 459, 464, - 469, 475, 480, 486, 491, 497, 502, 508, 514, 520, 526, 532, - 538, 544, 551, 557, 564, 571, 578, 584, 592, 599, 606, 614, - 621, 629, 637, 645, 654, 662, 671, 680, 689, 698, 708, 718, - 728, 738, 749, 759, 770, 782, 793, 805, 818, 830, 843, 856, - 870, 883, 898, 912, 927, 943, 958, 975, 991, 1008, 1026, 1044, - 1062, 1081, 1101, 1121, 1141, 1162, 1184, 1206, 1229, 1252, - 1276, 1301, 1326, 1352, 1378, 1406, 1434, 1462 -}; - -/* the original LUT values from Alex van Kaam - (for via register values 12-240): -{-50,-49,-47,-45,-43,-41,-39,-38,-37,-35,-34,-33,-32,-31, --30,-29,-28,-27,-26,-25,-24,-24,-23,-22,-21,-20,-20,-19,-18,-17,-17,-16,-15, --15,-14,-14,-13,-12,-12,-11,-11,-10,-9,-9,-8,-8,-7,-7,-6,-6,-5,-5,-4,-4,-3, --3,-2,-2,-1,-1,0,0,1,1,1,3,3,3,4,4,4,5,5,5,6,6,7,7,8,8,9,9,9,10,10,11,11,12, -12,12,13,13,13,14,14,15,15,16,16,16,17,17,18,18,19,19,20,20,21,21,21,22,22, -22,23,23,24,24,25,25,26,26,26,27,27,27,28,28,29,29,30,30,30,31,31,32,32,33, -33,34,34,35,35,35,36,36,37,37,38,38,39,39,40,40,41,41,42,42,43,43,44,44,45, -45,46,46,47,48,48,49,49,50,51,51,52,52,53,53,54,55,55,56,57,57,58,59,59,60, -61,62,62,63,64,65,66,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,83,84, -85,86,88,89,91,92,94,96,97,99,101,103,105,107,109,110}; -*/ - -// Here's the reverse LUT. I got it by doing a 6-th order poly fit (needed -// an extra term for a good fit to these inverse data!) and then -// solving for each temp value from -50 to 110 (the useable range for -// this chip). Here's the fit: -// viaRegVal = -1.160370e-10*val^6 +3.193693e-08*val^5 - 1.464447e-06*val^4 -// - 2.525453e-04*val^3 + 1.424593e-02*val^2 + 2.148941e+00*val +7.275808e+01) -// Note that n=161: -static const u8 viaLUT[] = - { 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 23, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40, - 41, 43, 45, 46, 48, 49, 51, 53, 55, 57, 59, 60, 62, 64, 66, - 69, 71, 73, 75, 77, 79, 82, 84, 86, 88, 91, 93, 95, 98, 100, - 103, 105, 107, 110, 112, 115, 117, 119, 122, 124, 126, 129, - 131, 134, 136, 138, 140, 143, 145, 147, 150, 152, 154, 156, - 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, - 182, 183, 185, 187, 188, 190, 192, 193, 195, 196, 198, 199, - 200, 202, 203, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, - 225, 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, 232, - 233, 233, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, - 239, 240 -}; - -/* Converting temps to (8-bit) hyst and over registers - No interpolation here. - The +50 is because the temps start at -50 */ -static inline u8 TEMP_TO_REG(long val) -{ - return viaLUT[val <= -500 ? 0 : val >= 1100 ? 160 : - (val < 0 ? val - 5 : val + 5) / 10 + 50]; -} - -/* for 8-bit temperature hyst and over registers */ -#define TEMP_FROM_REG(val) (tempLUT[(val)]) - -/* for 10-bit temperature readings */ -// You might _think_ this is too long to inline, but's it's really only -// called once... -static inline long TEMP_FROM_REG10(u16 val) -{ - // the temp values are already *10, so we don't need to do that. - long temp; - u16 eightBits = val >> 2; - u16 twoBits = val & 3; - - /* no interpolation for these */ - if (twoBits == 0 || eightBits == 255) - return (long) tempLUT[eightBits]; - - /* do some linear interpolation */ - temp = (4 - twoBits) * tempLUT[eightBits] - + twoBits * tempLUT[eightBits + 1]; - /* achieve rounding */ - return (temp < 0 ? temp - 2 : temp + 2) / 4; -} - -#define ALARMS_FROM_REG(val) (val) - -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) - -/* For the VIA686A, we need to keep some data in memory. - The structure is dynamically allocated, at the same time when a new - via686a client is allocated. */ -struct via686a_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[5]; /* Register value */ - u8 in_max[5]; /* Register value */ - u8 in_min[5]; /* Register value */ - u8 fan[2]; /* Register value */ - u8 fan_min[2]; /* Register value */ - u16 temp[3]; /* Register value 10 bit */ - u8 temp_over[3]; /* Register value */ - u8 temp_hyst[3]; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ - u16 alarms; /* Register encoding, combined */ -}; - -static struct pci_dev *s_bridge; /* pointer to the (only) via686a */ - -static int via686a_attach_adapter(struct i2c_adapter *adapter); -static int via686a_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int via686a_detach_client(struct i2c_client *client); - -static int via686a_read_value(struct i2c_client *client, u8 register); -static void via686a_write_value(struct i2c_client *client, u8 register, - u8 value); -static void via686a_update_client(struct i2c_client *client); -static void via686a_init_client(struct i2c_client *client); - - -static void via686a_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void via686a_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void via686a_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void via686a_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void via686a_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -/* The driver. I choose to use type i2c_driver, as at is identical to both - smbus_driver and isa_driver, and clients could be of either kind */ -static struct i2c_driver via686a_driver = { - .name = "VIA 686A", - .id = I2C_DRIVERID_VIA686A, - .flags = I2C_DF_NOTIFY, - .attach_adapter = via686a_attach_adapter, - .detach_client = via686a_detach_client, -}; - - - -/* The /proc/sys entries */ - -/* -- SENSORS SYSCTL START -- */ -#define VIA686A_SYSCTL_IN0 1000 -#define VIA686A_SYSCTL_IN1 1001 -#define VIA686A_SYSCTL_IN2 1002 -#define VIA686A_SYSCTL_IN3 1003 -#define VIA686A_SYSCTL_IN4 1004 -#define VIA686A_SYSCTL_FAN1 1101 -#define VIA686A_SYSCTL_FAN2 1102 -#define VIA686A_SYSCTL_TEMP 1200 -#define VIA686A_SYSCTL_TEMP2 1201 -#define VIA686A_SYSCTL_TEMP3 1202 -#define VIA686A_SYSCTL_FAN_DIV 2000 -#define VIA686A_SYSCTL_ALARMS 2001 - -#define VIA686A_ALARM_IN0 0x01 -#define VIA686A_ALARM_IN1 0x02 -#define VIA686A_ALARM_IN2 0x04 -#define VIA686A_ALARM_IN3 0x08 -#define VIA686A_ALARM_TEMP 0x10 -#define VIA686A_ALARM_FAN1 0x40 -#define VIA686A_ALARM_FAN2 0x80 -#define VIA686A_ALARM_IN4 0x100 -#define VIA686A_ALARM_TEMP2 0x800 -#define VIA686A_ALARM_CHAS 0x1000 -#define VIA686A_ALARM_TEMP3 0x8000 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected VIA686A. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table via686a_dir_table_template[] = { - {VIA686A_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &via686a_in}, - {VIA686A_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &via686a_in}, - {VIA686A_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &via686a_in}, - {VIA686A_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &via686a_in}, - {VIA686A_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &via686a_in}, - {VIA686A_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &via686a_fan}, - {VIA686A_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &via686a_fan}, - {VIA686A_SYSCTL_TEMP, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &via686a_temp}, - {VIA686A_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &via686a_temp}, - {VIA686A_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &via686a_temp}, - {VIA686A_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &via686a_fan_div}, - {VIA686A_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &via686a_alarms}, - {0} -}; - -static inline int via686a_read_value(struct i2c_client *client, u8 reg) -{ - return (inb_p(client->addr + reg)); -} - -static inline void via686a_write_value(struct i2c_client *client, u8 reg, - u8 value) -{ - outb_p(value, client->addr + reg); -} - -/* This is called when the module is loaded */ -static int via686a_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, via686a_detect); -} - -int via686a_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct via686a_data *data; - int err = 0; - const char *type_name = "via686a"; - u16 val; - - /* Make sure we are probing the ISA bus!! */ - if (!i2c_is_isa_adapter(adapter)) { - printk - ("via686a.o: via686a_detect called for an I2C bus adapter?!?\n"); - return 0; - } - - /* 8231 requires multiple of 256, we enforce that on 686 as well */ - if(force_addr) - address = force_addr & 0xFF00; - if (check_region(address, VIA686A_EXTENT)) { - printk("via686a.o: region 0x%x already in use!\n", - address); - return -ENODEV; - } - - if(force_addr) { - printk("via686a.o: forcing ISA address 0x%04X\n", address); - if (PCIBIOS_SUCCESSFUL != - pci_write_config_word(s_bridge, VIA686A_BASE_REG, address)) - return -ENODEV; - } - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(s_bridge, VIA686A_ENABLE_REG, &val)) - return -ENODEV; - if (!(val & 0x0001)) { - printk("via686a.o: enabling sensors\n"); - if (PCIBIOS_SUCCESSFUL != - pci_write_config_word(s_bridge, VIA686A_ENABLE_REG, - val | 0x0001)) - return -ENODEV; - } - - if (!(data = kmalloc(sizeof(struct via686a_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - init_MUTEX(&data->lock); - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &via686a_driver; - new_client->flags = 0; - - /* Reserve the ISA region */ - request_region(address, VIA686A_EXTENT, "via686a-sensors"); - - /* Fill in the remaining client fields and put into the global list */ - strcpy(new_client->name, "Via 686A Integrated Sensors"); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry((struct i2c_client *) new_client, - type_name, - via686a_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - /* Initialize the VIA686A chip */ - via686a_init_client(new_client); - return 0; - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - release_region(address, VIA686A_EXTENT); - kfree(data); - ERROR0: - return err; -} - -static int via686a_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct via686a_data *) - (client->data))->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("via686a.o: Client deregistration failed, client not detached.\n"); - return err; - } - - release_region(client->addr, VIA686A_EXTENT); - kfree(client->data); - - return 0; -} - -/* Called when we have found a new VIA686A. */ -static void via686a_init_client(struct i2c_client *client) -{ - u8 reg; - - /* Start monitoring */ - reg = via686a_read_value(client, VIA686A_REG_CONFIG); - via686a_write_value(client, VIA686A_REG_CONFIG, (reg|0x01)&0x7F); - - /* Configure temp interrupt mode for continuous-interrupt operation */ - via686a_write_value(client, VIA686A_REG_TEMP_MODE, - via686a_read_value(client, VIA686A_REG_TEMP_MODE) & - !(VIA686A_TEMP_MODE_MASK | VIA686A_TEMP_MODE_CONTINUOUS)); -} - -static void via686a_update_client(struct i2c_client *client) -{ - struct via686a_data *data = client->data; - int i; - - down(&data->update_lock); - - if (time_after(jiffies - data->last_updated, HZ + HZ / 2) || - time_before(jiffies, data->last_updated) || !data->valid) { - - for (i = 0; i <= 4; i++) { - data->in[i] = - via686a_read_value(client, VIA686A_REG_IN(i)); - data->in_min[i] = via686a_read_value(client, - VIA686A_REG_IN_MIN - (i)); - data->in_max[i] = - via686a_read_value(client, VIA686A_REG_IN_MAX(i)); - } - for (i = 1; i <= 2; i++) { - data->fan[i - 1] = - via686a_read_value(client, VIA686A_REG_FAN(i)); - data->fan_min[i - 1] = via686a_read_value(client, - VIA686A_REG_FAN_MIN(i)); - } - for (i = 1; i <= 3; i++) { - data->temp[i - 1] = via686a_read_value(client, - VIA686A_REG_TEMP(i)) << 2; - data->temp_over[i - 1] = - via686a_read_value(client, - VIA686A_REG_TEMP_OVER(i)); - data->temp_hyst[i - 1] = - via686a_read_value(client, - VIA686A_REG_TEMP_HYST(i)); - } - /* add in lower 2 bits - temp1 uses bits 7-6 of VIA686A_REG_TEMP_LOW1 - temp2 uses bits 5-4 of VIA686A_REG_TEMP_LOW23 - temp3 uses bits 7-6 of VIA686A_REG_TEMP_LOW23 - */ - data->temp[0] |= (via686a_read_value(client, - VIA686A_REG_TEMP_LOW1) - & 0xc0) >> 6; - data->temp[1] |= - (via686a_read_value(client, VIA686A_REG_TEMP_LOW23) & - 0x30) >> 4; - data->temp[2] |= - (via686a_read_value(client, VIA686A_REG_TEMP_LOW23) & - 0xc0) >> 6; - - i = via686a_read_value(client, VIA686A_REG_FANDIV); - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = i >> 6; - data->alarms = - via686a_read_value(client, - VIA686A_REG_ALARM1) | - (via686a_read_value(client, VIA686A_REG_ALARM2) << 8); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -static void via686a_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct via686a_data *data = client->data; - int nr = ctl_name - VIA686A_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - via686a_update_client(client); - results[0] = IN_FROM_REG(data->in_min[nr], nr); - results[1] = IN_FROM_REG(data->in_max[nr], nr); - results[2] = IN_FROM_REG(data->in[nr], nr); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0], nr); - via686a_write_value(client, VIA686A_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1], nr); - via686a_write_value(client, VIA686A_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void via686a_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct via686a_data *data = client->data; - int nr = ctl_name - VIA686A_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - via686a_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data->fan_div - [nr - 1])); - results[1] = FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = FAN_TO_REG(results[0], - DIV_FROM_REG(data-> - fan_div[nr -1])); - via686a_write_value(client, - VIA686A_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } - } -} - -void via686a_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct via686a_data *data = client->data; - int nr = ctl_name - VIA686A_SYSCTL_TEMP; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - via686a_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_over[nr]); - results[1] = TEMP_FROM_REG(data->temp_hyst[nr]); - results[2] = TEMP_FROM_REG10(data->temp[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_over[nr] = TEMP_TO_REG(results[0]); - via686a_write_value(client, - VIA686A_REG_TEMP_OVER(nr + 1), - data->temp_over[nr]); - } - if (*nrels_mag >= 2) { - data->temp_hyst[nr] = TEMP_TO_REG(results[1]); - via686a_write_value(client, - VIA686A_REG_TEMP_HYST(nr + 1), - data->temp_hyst[nr]); - } - } -} - -void via686a_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct via686a_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - via686a_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -void via686a_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct via686a_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - via686a_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = via686a_read_value(client, VIA686A_REG_FANDIV); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) | (data->fan_div[1] << 6); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan_div[0] << 4); - via686a_write_value(client, VIA686A_REG_FANDIV, - old); - } - } -} - - -static struct pci_device_id via686a_pci_ids[] __devinitdata = { - {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0, } -}; - -static int __devinit via686a_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) -{ - u16 val; - int addr = 0; - - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(dev, VIA686A_BASE_REG, &val)) - return -ENODEV; - - addr = val & ~(VIA686A_EXTENT - 1); - if (addr == 0 && force_addr == 0) { - printk("via686a.o: base address not set - upgrade BIOS or use force_addr=0xaddr\n"); - return -ENODEV; - } - if (force_addr) - addr = force_addr; /* so detect will get called */ - - normal_isa[0] = addr; - s_bridge = dev; - return i2c_add_driver(&via686a_driver); -} - -static void __devexit via686a_pci_remove(struct pci_dev *dev) -{ - i2c_del_driver(&via686a_driver); -} - -static struct pci_driver via686a_pci_driver = { - .name = "via686a", - .id_table = via686a_pci_ids, - .probe = via686a_pci_probe, - .remove = __devexit_p(via686a_pci_remove), -}; - -static int __init sm_via686a_init(void) -{ - printk("via686a.o version %s (%s)\n", LM_VERSION, LM_DATE); - return pci_module_init(&via686a_pci_driver); -} - -static void __exit sm_via686a_exit(void) -{ - pci_unregister_driver(&via686a_pci_driver); -} - -MODULE_AUTHOR("Kyösti Mälkki , " - "Mark Studebaker " - "and Bob Dougherty "); -MODULE_DESCRIPTION("VIA 686A Sensor device"); -MODULE_LICENSE("GPL"); - -module_init(sm_via686a_init); -module_exit(sm_via686a_exit); diff --git a/kernel/chips/vt1211.c b/kernel/chips/vt1211.c deleted file mode 100644 index 37346f1c..00000000 --- a/kernel/chips/vt1211.c +++ /dev/null @@ -1,820 +0,0 @@ -/* - vt1211.c - Part of lm_sensors, Linux kernel modules - for hardware monitoring - - Copyright (c) 2002 Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* Supports VIA VT1211 Super I/O sensors via ISA (LPC) accesses only. */ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" - -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Initialize the base address of the sensors"); - -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0x0000, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -SENSORS_INSMOD_1(vt1211); - -/* modified from kernel/include/traps.c */ -#define REG 0x2e /* The register to read/write */ -#define DEV 0x07 /* Register: Logical device select */ -#define VAL 0x2f /* The value to read/write */ -#define PME 0x0b /* The device with the hardware monitor */ -#define DEVID 0x20 /* Register: Device ID */ - -static inline void -superio_outb(int reg, int val) -{ - outb(reg, REG); - outb(val, VAL); -} - -static inline int -superio_inb(int reg) -{ - outb(reg, REG); - return inb(VAL); -} - -static inline void -superio_select(void) -{ - outb(DEV, REG); - outb(PME, VAL); -} - -static inline void -superio_enter(void) -{ - outb(0x87, REG); - outb(0x87, REG); -} - -static inline void -superio_exit(void) -{ - outb(0xAA, REG); -} - -#define VT1211_DEVID 0x3c -#define VT1211_ACT_REG 0x30 -#define VT1211_BASE_REG 0x60 - -#define VT1211_EXTENT 0x80 - -/* pwm numbered 1-2 */ -#define VT1211_REG_PWM(nr) (0x5f + (nr)) -#define VT1211_REG_PWM_CTL 0x51 - -/* The VT1211 registers */ -/* We define the sensors as follows. Somewhat convoluted to minimize - changes from via686a. - Sensor Voltage Mode Temp Mode - -------- ------------ --------- - Reading 1 temp1 Intel thermal diode - Reading 3 temp2 VT1211 internal thermal diode - UCH1/Reading2 in0 temp3 - UCH2 in1 temp4 - UCH3 in2 temp5 - UCH4 in3 temp6 - UCH5 in4 temp7 - 3.3V in5 -*/ - -/* ins numbered 0-5 */ -#define VT1211_REG_IN_MAX(nr) ((nr)==0 ? 0x3d : 0x29 + ((nr) * 2)) -#define VT1211_REG_IN_MIN(nr) ((nr)==0 ? 0x3e : 0x2a + ((nr) * 2)) -#define VT1211_REG_IN(nr) (0x21 + (nr)) - -/* fans numbered 1-2 */ -#define VT1211_REG_FAN_MIN(nr) (0x3a + (nr)) -#define VT1211_REG_FAN(nr) (0x28 + (nr)) - -static const u8 regtemp[] = { 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25 }; -static const u8 regover[] = { 0x39, 0x1d, 0x3d, 0x2b, 0x2d, 0x2f, 0x31 }; -static const u8 reghyst[] = { 0x3a, 0x1e, 0x3e, 0x2c, 0x2e, 0x30, 0x32 }; - -/* temps numbered 1-7 */ -#define VT1211_REG_TEMP(nr) (regtemp[(nr) - 1]) -#define VT1211_REG_TEMP_OVER(nr) (regover[(nr) - 1]) -#define VT1211_REG_TEMP_HYST(nr) (reghyst[(nr) - 1]) -#define VT1211_REG_TEMP_LOW1 0x4b /* bits 7-6 */ -#define VT1211_REG_TEMP_LOW3 0x49 /* bits 5-4 */ -#define VT1211_REG_TEMP_LOW47 0x4d - -#define VT1211_REG_CONFIG 0x40 -#define VT1211_REG_ALARM1 0x41 -#define VT1211_REG_ALARM2 0x42 -#define VT1211_REG_VID 0x45 -#define VT1211_REG_FANDIV 0x47 -#define VT1211_REG_UCH_CONFIG 0x4a -#define VT1211_REG_TEMP1_CONFIG 0x4b -#define VT1211_REG_TEMP2_CONFIG 0x4c - -/* temps 1-7; voltages 0-5 */ -#define ISTEMP(i, ch_config) ((i) <= 2 ? 1 : \ - ((ch_config) >> ((i)-1)) & 1) -#define ISVOLT(i, ch_config) ((i) > 4 ? 1 : !(((ch_config) >> ((i)+2)) & 0x01)) - -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) -#define PWM_FROM_REG(val) (val) -#define PWM_TO_REG(val) SENSORS_LIMIT((val), 0, 255) - -/* temp1 (i = 1) is an Intel thermal diode which is scaled in user space. - temp2 (i = 2) is the internal temp diode so it's scaled in the driver - according to some measurements taken on an EPIA M10000. - temp3-7 are thermistor based so the driver returns the voltage measured at - the pin (range 0V - 2.2V). */ -#define TEMP_FROM_REG(i, reg) ((i) == 1 ? (reg) * 10 : \ - (i) == 2 ? (reg) < 51 ? 0 : \ - ((reg) - 51) * 10 : \ - ((253 - (reg)) * 2200 + 105) / 210) -/* for 10-bit temp values */ -#define TEMP_FROM_REG10(i, reg) ((i) == 1 ? (reg) * 10 / 4 : \ - (i) == 2 ? (reg) < 204 ? 0 : \ - ((reg) - 204) * 10 / 4 : \ - ((1012 - (reg)) * 550 + 105) / 210) -#define TEMP_TO_REG(i, val) SENSORS_LIMIT( \ - ((i) == 1 ? ((val) + 5) / 10 : \ - (i) == 2 ? ((val) + 5) / 10 + 51 : \ - 253 - ((val) * 210 + 1100) / 2200), 0, 255) - -/* in5 (i = 5) is special. It's the internal 3.3V so it's scaled in the - driver according to the VT1211 BIOS porting guide */ -#define IN_FROM_REG(i, reg) ((reg) < 3 ? 0 : (i) == 5 ? \ - (((reg) - 3) * 15882 + 4790) / 9580 : \ - (((reg) - 3) * 10000 + 4790) / 9580) -#define IN_TO_REG(i, val) (SENSORS_LIMIT((i) == 5 ? \ - ((val) * 9580 + 7941) / 15882 + 3 : \ - ((val) * 9580 + 5000) / 10000 + 3, 0, 255)) - -/********* FAN RPM CONVERSIONS ********/ -/* But this chip saturates back at 0, not at 255 like all the other chips. - So, 0 means 0 RPM */ -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 0; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1310720 + rpm * div / 2) / (rpm * div), 1, 255); -} - -#define MIN_TO_REG(a,b) FAN_TO_REG(a,b) -#define FAN_FROM_REG(val,div) ((val)==0?0:(val)==255?0:1310720/((val)*(div))) - -struct vt1211_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[6]; /* Register value */ - u8 in_max[6]; /* Register value */ - u8 in_min[6]; /* Register value */ - u16 temp[7]; /* Register value 10 bit */ - u8 temp_over[7]; /* Register value */ - u8 temp_hyst[7]; /* Register value */ - u8 fan[2]; /* Register value */ - u8 fan_min[2]; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ - u16 alarms; /* Register encoding */ - u8 pwm[2]; /* Register value */ - u8 pwm_ctl; /* Register value */ - u8 vid; /* Register encoding */ - u8 vrm; - u8 uch_config; -}; - -static int vt1211_attach_adapter(struct i2c_adapter *adapter); -static int vt1211_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int vt1211_detach_client(struct i2c_client *client); - -static inline int vt_rdval(struct i2c_client *client, u8 register); -static inline void vt1211_write_value(struct i2c_client *client, u8 register, - u8 value); -static void vt1211_update_client(struct i2c_client *client); -static void vt1211_init_client(struct i2c_client *client); - - -static void vt1211_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt1211_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt1211_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt1211_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt1211_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt1211_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt1211_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt1211_uch(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt1211_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver vt1211_driver = { - .name = "VT1211 sensors driver", - .id = I2C_DRIVERID_VT1211, - .flags = I2C_DF_NOTIFY, - .attach_adapter = vt1211_attach_adapter, - .detach_client = vt1211_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define VT1211_SYSCTL_IN0 1000 -#define VT1211_SYSCTL_IN1 1001 -#define VT1211_SYSCTL_IN2 1002 -#define VT1211_SYSCTL_IN3 1003 -#define VT1211_SYSCTL_IN4 1004 -#define VT1211_SYSCTL_IN5 1005 -#define VT1211_SYSCTL_FAN1 1101 -#define VT1211_SYSCTL_FAN2 1102 -#define VT1211_SYSCTL_TEMP1 1200 -#define VT1211_SYSCTL_TEMP2 1201 -#define VT1211_SYSCTL_TEMP3 1202 -#define VT1211_SYSCTL_TEMP4 1203 -#define VT1211_SYSCTL_TEMP5 1204 -#define VT1211_SYSCTL_TEMP6 1205 -#define VT1211_SYSCTL_TEMP7 1206 -#define VT1211_SYSCTL_VID 1300 -#define VT1211_SYSCTL_PWM1 1401 -#define VT1211_SYSCTL_PWM2 1402 -#define VT1211_SYSCTL_VRM 1600 -#define VT1211_SYSCTL_UCH 1700 -#define VT1211_SYSCTL_FAN_DIV 2000 -#define VT1211_SYSCTL_ALARMS 2001 - -#define VT1211_ALARM_IN1 0x01 -#define VT1211_ALARM_IN2 0x02 -#define VT1211_ALARM_IN5 0x04 -#define VT1211_ALARM_IN3 0x08 -#define VT1211_ALARM_TEMP1 0x10 -#define VT1211_ALARM_FAN1 0x40 -#define VT1211_ALARM_FAN2 0x80 -#define VT1211_ALARM_IN4 0x100 -#define VT1211_ALARM_TEMP3 0x800 -#define VT1211_ALARM_CHAS 0x1000 -#define VT1211_ALARM_TEMP2 0x8000 -/* duplicates */ -#define VT1211_ALARM_IN0 VT1211_ALARM_TEMP3 -#define VT1211_ALARM_TEMP4 VT1211_ALARM_IN1 -#define VT1211_ALARM_TEMP5 VT1211_ALARM_IN2 -#define VT1211_ALARM_TEMP6 VT1211_ALARM_IN3 -#define VT1211_ALARM_TEMP7 VT1211_ALARM_IN4 - -/* -- SENSORS SYSCTL END -- */ - -static ctl_table vt1211_dir_table_template[] = { - {VT1211_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_in}, - {VT1211_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_in}, - {VT1211_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_in}, - {VT1211_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_in}, - {VT1211_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_in}, - {VT1211_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_in}, - {VT1211_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt1211_temp}, - {VT1211_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt1211_temp}, - {VT1211_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt1211_temp}, - {VT1211_SYSCTL_TEMP4, "temp4", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt1211_temp}, - {VT1211_SYSCTL_TEMP5, "temp5", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt1211_temp}, - {VT1211_SYSCTL_TEMP6, "temp6", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt1211_temp}, - {VT1211_SYSCTL_TEMP7, "temp7", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt1211_temp}, - {VT1211_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_fan}, - {VT1211_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_fan}, - {VT1211_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_fan_div}, - {VT1211_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_alarms}, - {VT1211_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_pwm}, - {VT1211_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_pwm}, - {VT1211_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_vid}, - {VT1211_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_vrm}, - {VT1211_SYSCTL_UCH, "uch_config", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt1211_uch}, - {0} -}; - -static int vt1211_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, vt1211_detect); -} - -static int __init vt1211_find(int *address) -{ - u16 val; - - superio_enter(); - val= superio_inb(DEVID); - if(VT1211_DEVID != val) { - superio_exit(); - return -ENODEV; - } - - superio_select(); - val = (superio_inb(VT1211_BASE_REG) << 8) | - superio_inb(VT1211_BASE_REG + 1); - *address = val & ~(VT1211_EXTENT - 1); - if (*address == 0 && force_addr == 0) { - printk("vt1211.o: base address not set - use force_addr=0xaddr\n"); - superio_exit(); - return -ENODEV; - } - if (force_addr) - *address = force_addr; /* so detect will get called */ - - superio_exit(); - return 0; -} - -int vt1211_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct vt1211_data *data; - int err = 0; - u8 val; - const char *type_name = "vt1211"; - const char *client_name = "VT1211 chip"; - - if (!i2c_is_isa_adapter(adapter)) { - return 0; - } - - if(force_addr) - address = force_addr & ~(VT1211_EXTENT - 1); - if (check_region(address, VT1211_EXTENT)) { - printk("vt1211.o: region 0x%x already in use!\n", address); - return -ENODEV; - } - if(force_addr) { - printk("vt1211.o: forcing ISA address 0x%04X\n", address); - superio_enter(); - superio_select(); - superio_outb(VT1211_BASE_REG, address >> 8); - superio_outb(VT1211_BASE_REG+1, address & 0xff); - superio_exit(); - } - - superio_enter(); - superio_select(); - if((val = 0x01 & superio_inb(VT1211_ACT_REG)) == 0) - superio_outb(VT1211_ACT_REG, 1); - superio_exit(); - - if (!(data = kmalloc(sizeof(struct vt1211_data), GFP_KERNEL))) { - return -ENOMEM; - } - - new_client = &data->client; - new_client->addr = address; - init_MUTEX(&data->lock); - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &vt1211_driver; - new_client->flags = 0; - - request_region(address, VT1211_EXTENT, "vt1211-sensors"); - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - if ((i = i2c_register_entry((struct i2c_client *) new_client, - type_name, - vt1211_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - vt1211_init_client(new_client); - return 0; - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - release_region(address, VT1211_EXTENT); - kfree(data); - return err; -} - -static int vt1211_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct vt1211_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("vt1211.o: Client deregistration failed, client not detached.\n"); - return err; - } - - release_region(client->addr, VT1211_EXTENT); - kfree(client->data); - - return 0; -} - -static inline int vt_rdval(struct i2c_client *client, u8 reg) -{ - return (inb_p(client->addr + reg)); -} - -static inline void vt1211_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - outb_p(value, client->addr + reg); -} - -static void vt1211_init_client(struct i2c_client *client) -{ - struct vt1211_data *data = client->data; - - data->vrm = 91; - /* set "default" interrupt mode for alarms, which isn't the default */ - vt1211_write_value(client, VT1211_REG_TEMP1_CONFIG, 0); - vt1211_write_value(client, VT1211_REG_TEMP2_CONFIG, 0); -} - -static void vt1211_update_client(struct i2c_client *client) -{ - struct vt1211_data *data = client->data; - int i, j; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - data->uch_config = vt_rdval(client, VT1211_REG_UCH_CONFIG); - for (i = 0; i <= 5; i++) { - if(ISVOLT(i, data->uch_config)) { - data->in[i] = vt_rdval(client, VT1211_REG_IN(i)); - data->in_min[i] = vt_rdval(client, - VT1211_REG_IN_MIN(i)); - data->in_max[i] = vt_rdval(client, - VT1211_REG_IN_MAX(i)); - } else { - data->in[i] = 0; - data->in_min[i] = 0; - data->in_max[i] = 0; - } - } - for (i = 1; i <= 2; i++) { - data->fan[i - 1] = vt_rdval(client, VT1211_REG_FAN(i)); - data->fan_min[i - 1] = vt_rdval(client, - VT1211_REG_FAN_MIN(i)); - } - for (i = 1; i <= 7; i++) { - if(ISTEMP(i, data->uch_config)) { - data->temp[i - 1] = vt_rdval(client, - VT1211_REG_TEMP(i)) << 2; - switch(i) { - case 1: - j = (vt_rdval(client, - VT1211_REG_TEMP_LOW1) >> - 6) & 3; - break; - case 2: - j = 0; - break; - case 3: - j = (vt_rdval(client, - VT1211_REG_TEMP_LOW3) >> - 4) & 3; - break; - default: - j = (vt_rdval(client, - VT1211_REG_TEMP_LOW47) >> - ((i-4)*2)) & 0x03; - } - data->temp[i - 1] |= j; - data->temp_over[i - 1] = vt_rdval(client, - VT1211_REG_TEMP_OVER(i)); - data->temp_hyst[i - 1] = vt_rdval(client, - VT1211_REG_TEMP_HYST(i)); - } else { - data->temp[i - 1] = 0; - data->temp_over[i - 1] = 0; - data->temp_hyst[i - 1] = 0; - } - } - - for (i = 1; i <= 2; i++) { - data->fan[i - 1] = vt_rdval(client, VT1211_REG_FAN(i)); - data->fan_min[i - 1] = vt_rdval(client, - VT1211_REG_FAN_MIN(i)); - data->pwm[i - 1] = vt_rdval(client, VT1211_REG_PWM(i)); - } - - data->pwm_ctl = vt_rdval(client, VT1211_REG_PWM_CTL); - i = vt_rdval(client, VT1211_REG_FANDIV); - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = i >> 6; - data->alarms = vt_rdval(client, VT1211_REG_ALARM1) | - (vt_rdval(client, VT1211_REG_ALARM2) << 8); - data->vid= vt_rdval(client, VT1211_REG_VID) & 0x1f; - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void vt1211_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt1211_data *data = client->data; - int nr = ctl_name - VT1211_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - vt1211_update_client(client); - results[0] = IN_FROM_REG(nr, data->in_min[nr]); - results[1] = IN_FROM_REG(nr, data->in_max[nr]); - results[2] = IN_FROM_REG(nr, data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(nr, results[0]); - vt1211_write_value(client, VT1211_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(nr, results[1]); - vt1211_write_value(client, VT1211_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void vt1211_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt1211_data *data = client->data; - int nr = ctl_name - VT1211_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - vt1211_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data->fan_div - [nr - 1])); - results[1] = FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = MIN_TO_REG(results[0], - DIV_FROM_REG - (data-> - fan_div[nr-1])); - vt1211_write_value(client, VT1211_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } - } -} - - -void vt1211_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt1211_data *data = client->data; - int nr = ctl_name - VT1211_SYSCTL_TEMP1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = nr < 2 ? 1 : 3; - else if (operation == SENSORS_PROC_REAL_READ) { - vt1211_update_client(client); - results[0] = TEMP_FROM_REG(nr + 1, data->temp_over[nr]); - results[1] = TEMP_FROM_REG(nr + 1, data->temp_hyst[nr]); - results[2] = TEMP_FROM_REG10(nr + 1, data->temp[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_over[nr] = TEMP_TO_REG(nr + 1, results[0]); - vt1211_write_value(client, - VT1211_REG_TEMP_OVER(nr + 1), - data->temp_over[nr]); - } - if (*nrels_mag >= 2) { - data->temp_hyst[nr] = TEMP_TO_REG(nr + 1, results[1]); - vt1211_write_value(client, - VT1211_REG_TEMP_HYST(nr + 1), - data->temp_hyst[nr]); - } - } -} - -void vt1211_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt1211_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - vt1211_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -void vt1211_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct vt1211_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - vt1211_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = vt_rdval(client, VT1211_REG_FANDIV); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) | (data->fan_div[1] << 6); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan_div[0] << 4); - vt1211_write_value(client, VT1211_REG_FANDIV, old); - } - } -} - -void vt1211_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt1211_data *data = client->data; - int nr = 1 + ctl_name - VT1211_SYSCTL_PWM1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - vt1211_update_client(client); - results[0] = PWM_FROM_REG(data->pwm[nr - 1]); - results[1] = (data->pwm_ctl >> (3 + (4 * (nr - 1)))) & 1; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->pwm[nr - 1] = PWM_TO_REG(results[0]); - if (*nrels_mag >= 2) { - if(results[1]) { - data->pwm_ctl |= - (0x08 << (4 * (nr - 1))); - vt1211_write_value(client, - VT1211_REG_PWM_CTL, - data->pwm_ctl); - } else { - data->pwm_ctl &= - ~ (0x08 << (4 * (nr - 1))); - vt1211_write_value(client, - VT1211_REG_PWM_CTL, - data->pwm_ctl); - } - } - vt1211_write_value(client, VT1211_REG_PWM(nr), - data->pwm[nr - 1]); - } - } -} - -void vt1211_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt1211_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - vt1211_update_client(client); - results[0] = vid_from_reg(data->vid, data->vrm); - *nrels_mag = 1; - } -} - -void vt1211_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt1211_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) - data->vrm = results[0]; - } -} - -void vt1211_uch(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt1211_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->uch_config & 0x7c; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->uch_config = (data->uch_config & 0x83)|(results[0] & 0x7c); - vt1211_write_value(client, VT1211_REG_UCH_CONFIG, - data->uch_config); - } - } -} - -static int __init sm_vt1211_init(void) -{ - int addr; - - printk("vt1211.o version %s (%s)\n", LM_VERSION, LM_DATE); - - if (vt1211_find(&addr)) { - printk("vt1211.o: VT1211 not detected, module not inserted.\n"); - return -ENODEV; - } - normal_isa[0] = addr; - - return i2c_add_driver(&vt1211_driver); -} - -static void __exit sm_vt1211_exit(void) -{ - i2c_del_driver(&vt1211_driver); -} - - - -MODULE_AUTHOR("Mark D. Studebaker "); -MODULE_DESCRIPTION("VT1211 sensors"); -MODULE_LICENSE("GPL"); - -module_init(sm_vt1211_init); -module_exit(sm_vt1211_exit); diff --git a/kernel/chips/vt8231.c b/kernel/chips/vt8231.c deleted file mode 100644 index 24ab2e49..00000000 --- a/kernel/chips/vt8231.c +++ /dev/null @@ -1,836 +0,0 @@ -/* - vt8231.c - Part of lm_sensors, Linux kernel modules - for hardware monitoring - - Copyright (c) 2002 Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* Supports VIA VT8231 South Bridge embedded sensors */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" - - -static int force_addr = 0; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Initialize the base address of the sensors"); - -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0x0000, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -SENSORS_INSMOD_1(vt8231); - -#define VIA686A_EXTENT 0x80 -#define VIA686A_BASE_REG 0x70 -#define VIA686A_ENABLE_REG 0x74 - -/* pwm numbered 1-2 */ -#define VT8231_REG_PWM(nr) (0x5f + (nr)) -#define VT8231_REG_PWM_CTL 0x51 - -/* The VT8231 registers */ -/* We define the sensors as follows. - Sensor Voltage Mode Temp Mode - -------- ------------ --------- - Reading 1 temp1 - UCH1 in0 temp2 - UCH2 in1 temp3 - UCH3 in2 temp4 - UCH4 in3 temp5 - UCH5 in4 temp6 - 3.3V in5 -*/ - -/* ins numbered 0-5 */ -#define VT8231_REG_IN_MAX(nr) ((nr)==0 ? 0x3d : 0x29 + ((nr) * 2)) -#define VT8231_REG_IN_MIN(nr) ((nr)==0 ? 0x3e : 0x2a + ((nr) * 2)) -#define VT8231_REG_IN(nr) (0x21 + (nr)) - -/* fans numbered 1-2 */ -#define VT8231_REG_FAN_MIN(nr) (0x3a + (nr)) -#define VT8231_REG_FAN(nr) (0x28 + (nr)) - -static const u8 regtemp[] = { 0x1f, 0x21, 0x22, 0x23, 0x24, 0x25 }; -static const u8 regover[] = { 0x39, 0x3d, 0x2b, 0x2d, 0x2f, 0x31 }; -static const u8 reghyst[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 }; - -/* temps numbered 1-6 */ -#define VT8231_REG_TEMP(nr) (regtemp[(nr) - 1]) -#define VT8231_REG_TEMP_OVER(nr) (regover[(nr) - 1]) -#define VT8231_REG_TEMP_HYST(nr) (reghyst[(nr) - 1]) -#define VT8231_REG_TEMP_LOW12 0x49 -#define VT8231_REG_TEMP_LOW36 0x4d - -#define VT8231_REG_CONFIG 0x40 -#define VT8231_REG_ALARM1 0x41 -#define VT8231_REG_ALARM2 0x42 -#define VT8231_REG_VID 0x45 -#define VT8231_REG_FANDIV 0x47 -#define VT8231_REG_UCH_CONFIG 0x4a -#define VT8231_REG_TEMP1_CONFIG 0x4b -#define VT8231_REG_TEMP2_CONFIG 0x4c - -/* temps 1-6; voltages 0-5 */ -#define ISTEMP(i, ch_config) ((i) == 1 ? 1 : \ - ((ch_config) >> (i)) & 0x01) -#define ISVOLT(i, ch_config) ((i) == 5 ? 1 : \ - !(((ch_config) >> ((i)+2)) & 0x01)) - -#define DIV_FROM_REG(val) (1 << (val)) -#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1) -#define PWM_FROM_REG(val) (val) -#define PWM_TO_REG(val) SENSORS_LIMIT((val), 0, 255) - -/* Used for temp1 (diode) */ -#define TEMP_FROM_REG(val) ((val)*10) -#define TEMP_FROM_REG10(val) (((val)*10)/4) -#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-5)/10):\ - ((val)+5)/10),0,255)) - -/* Used for temp2-temp6 (thermistor) */ -#define THERM_FROM_REG(reg) (((253 * 4 - (reg)) * 55 + 105) / 210) -#define THERM_TO_REG(val) (253 - ((val) * 210 + 110) / 220) - -/* Used for in0-in4 */ -#define IN_FROM_REG(val) ((((val) - 3) * 1000 + 479) / 958) -#define IN_TO_REG(val) SENSORS_LIMIT(((val) * 958 + 500) \ - / 1000 + 3, 0, 255) -/* Used for in5 (scaled internally) */ -#define IN5_FROM_REG(val) ((((val) - 3) * 54000 + 16286) / 32572) -#define IN5_TO_REG(val) SENSORS_LIMIT(((val) * 32572 + 27000) \ - / 54000 + 3, 0, 255) - - -/********* FAN RPM CONVERSIONS ********/ -/* But this chip saturates back at 0, not at 255 like all the other chips. - So, 0 means 0 RPM */ -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 0; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1310720 + rpm * div / 2) / (rpm * div), 1, 255); -} - -#define MIN_TO_REG(a,b) FAN_TO_REG(a,b) -#define FAN_FROM_REG(val,div) ((val)==0?0:(val)==255?0:1310720/((val)*(div))) - -struct vt8231_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[6]; /* Register value */ - u8 in_max[6]; /* Register value */ - u8 in_min[6]; /* Register value */ - u16 temp[6]; /* Register value 10 bit */ - u8 temp_over[6]; /* Register value */ - u8 temp_hyst[6]; /* Register value */ - u8 fan[2]; /* Register value */ - u8 fan_min[2]; /* Register value */ - u8 fan_div[2]; /* Register encoding, shifted right */ - u16 alarms; /* Register encoding */ - u8 pwm[2]; /* Register value */ - u8 pwm_ctl; /* Register value */ - u8 vid; /* Register encoding */ - u8 vrm; - u8 uch_config; -}; - -static int vt8231_attach_adapter(struct i2c_adapter *adapter); -static int vt8231_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int vt8231_detach_client(struct i2c_client *client); - -static inline int vt_rdval(struct i2c_client *client, u8 register); -static inline void vt8231_write_value(struct i2c_client *client, u8 register, - u8 value); -static void vt8231_update_client(struct i2c_client *client); -static void vt8231_init_client(struct i2c_client *client); - - -static void vt8231_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_in5(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_uch(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void vt8231_therm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver vt8231_driver = { - .name = "VT8231 sensors driver", - .id = I2C_DRIVERID_VT8231, - .flags = I2C_DF_NOTIFY, - .attach_adapter = vt8231_attach_adapter, - .detach_client = vt8231_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ -#define VT8231_SYSCTL_IN0 1000 -#define VT8231_SYSCTL_IN1 1001 -#define VT8231_SYSCTL_IN2 1002 -#define VT8231_SYSCTL_IN3 1003 -#define VT8231_SYSCTL_IN4 1004 -#define VT8231_SYSCTL_IN5 1005 -#define VT8231_SYSCTL_FAN1 1101 -#define VT8231_SYSCTL_FAN2 1102 -#define VT8231_SYSCTL_TEMP 1200 -#define VT8231_SYSCTL_TEMP2 1201 -#define VT8231_SYSCTL_TEMP3 1202 -#define VT8231_SYSCTL_TEMP4 1203 -#define VT8231_SYSCTL_TEMP5 1204 -#define VT8231_SYSCTL_TEMP6 1205 -#define VT8231_SYSCTL_VID 1300 -#define VT8231_SYSCTL_PWM1 1401 -#define VT8231_SYSCTL_PWM2 1402 -#define VT8231_SYSCTL_VRM 1600 -#define VT8231_SYSCTL_UCH 1700 -#define VT8231_SYSCTL_FAN_DIV 2000 -#define VT8231_SYSCTL_ALARMS 2001 - -#define VT8231_ALARM_IN1 0x01 -#define VT8231_ALARM_IN2 0x02 -#define VT8231_ALARM_IN5 0x04 -#define VT8231_ALARM_IN3 0x08 -#define VT8231_ALARM_TEMP 0x10 -#define VT8231_ALARM_FAN1 0x40 -#define VT8231_ALARM_FAN2 0x80 -#define VT8231_ALARM_IN4 0x100 -#define VT8231_ALARM_TEMP2 0x800 -#define VT8231_ALARM_CHAS 0x1000 -/* duplicates */ -#define VT8231_ALARM_IN0 VT8231_ALARM_TEMP2 -#define VT8231_ALARM_TEMP3 VT8231_ALARM_IN1 -#define VT8231_ALARM_TEMP4 VT8231_ALARM_IN2 -#define VT8231_ALARM_TEMP5 VT8231_ALARM_IN3 -#define VT8231_ALARM_TEMP6 VT8231_ALARM_IN4 - -/* -- SENSORS SYSCTL END -- */ - -static ctl_table vt8231_dir_table_template[] = { - {VT8231_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_in}, - {VT8231_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_in}, - {VT8231_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_in}, - {VT8231_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_in}, - {VT8231_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_in}, - {VT8231_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_in5}, - {VT8231_SYSCTL_TEMP, "temp1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_temp}, - {VT8231_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, - {VT8231_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, - {VT8231_SYSCTL_TEMP4, "temp4", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, - {VT8231_SYSCTL_TEMP5, "temp5", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, - {VT8231_SYSCTL_TEMP6, "temp6", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &vt8231_therm}, - {VT8231_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_fan}, - {VT8231_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_fan}, - {VT8231_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_fan_div}, - {VT8231_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_alarms}, - {VT8231_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_pwm}, - {VT8231_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_pwm}, - {VT8231_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_vid}, - {VT8231_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_vrm}, - {VT8231_SYSCTL_UCH, "uch_config", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &vt8231_uch}, - {0} -}; - -static struct pci_dev *s_bridge; - -static int vt8231_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, vt8231_detect); -} - -/* Locate chip and get correct base address */ -static int __init vt8231_find(int *address) -{ - u16 val; - - if (!pci_present()) - return -ENODEV; - - if (!(s_bridge = pci_find_device(PCI_VENDOR_ID_VIA, - 0x8235, NULL))) - return -ENODEV; - - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(s_bridge, VIA686A_BASE_REG, &val)) - return -ENODEV; - *address = val & ~(VIA686A_EXTENT - 1); - if (*address == 0 && force_addr == 0) { - printk("vt8231.o: base address not set - upgrade BIOS or use force_addr=0xaddr\n"); - return -ENODEV; - } - if (force_addr) - *address = force_addr; /* so detect will get called */ - - return 0; -} - -int vt8231_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct vt8231_data *data; - int err = 0; - const char *type_name = "vt8231"; - u16 val; - - if (!i2c_is_isa_adapter(adapter)) { - return 0; - } - - /* 8231 requires multiple of 256 */ - if(force_addr) - address = force_addr & 0xFF00; - if (check_region(address, VIA686A_EXTENT)) { - printk("vt8231.o: region 0x%x already in use!\n", - address); - return -ENODEV; - } - - if(force_addr) { - printk("vt8231.o: forcing ISA address 0x%04X\n", address); - if (PCIBIOS_SUCCESSFUL != - pci_write_config_word(s_bridge, VIA686A_BASE_REG, address)) - return -ENODEV; - } - if (PCIBIOS_SUCCESSFUL != - pci_read_config_word(s_bridge, VIA686A_ENABLE_REG, &val)) - return -ENODEV; - if (!(val & 0x0001)) { - printk("vt8231.o: enabling sensors\n"); - if (PCIBIOS_SUCCESSFUL != - pci_write_config_word(s_bridge, VIA686A_ENABLE_REG, - val | 0x0001)) - return -ENODEV; - } - - if (!(data = kmalloc(sizeof(struct vt8231_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - init_MUTEX(&data->lock); - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &vt8231_driver; - new_client->flags = 0; - - /* Reserve the ISA region */ - request_region(address, VIA686A_EXTENT, "vt8231-sensors"); - - /* Fill in the remaining client fields and put into the global list */ - strcpy(new_client->name, "Via 8231 Integrated Sensors"); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry((struct i2c_client *) new_client, - type_name, - vt8231_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR4; - } - data->sysctl_id = i; - - vt8231_init_client(new_client); - return 0; - - ERROR4: - i2c_detach_client(new_client); - ERROR3: - release_region(address, VIA686A_EXTENT); - kfree(data); - ERROR0: - return err; -} - -static int vt8231_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct vt8231_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("vt8231.o: Client deregistration failed, client not detached.\n"); - return err; - } - - release_region(client->addr, VIA686A_EXTENT); - kfree(client->data); - - return 0; -} - - -static inline int vt_rdval(struct i2c_client *client, u8 reg) -{ - return (inb_p(client->addr + reg)); -} - -static inline void vt8231_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - outb_p(value, client->addr + reg); -} - -static void vt8231_init_client(struct i2c_client *client) -{ - struct vt8231_data *data = client->data; - - data->vrm = 91; - /* set "default" interrupt mode for alarms, which isn't the default */ - vt8231_write_value(client, VT8231_REG_TEMP1_CONFIG, 0); - vt8231_write_value(client, VT8231_REG_TEMP2_CONFIG, 0); -} - -static void vt8231_update_client(struct i2c_client *client) -{ - struct vt8231_data *data = client->data; - int i, j; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - data->uch_config = vt_rdval(client, VT8231_REG_UCH_CONFIG); - for (i = 0; i <= 5; i++) { - if(ISVOLT(i, data->uch_config)) { - data->in[i] = vt_rdval(client, VT8231_REG_IN(i)); - data->in_min[i] = vt_rdval(client, - VT8231_REG_IN_MIN(i)); - data->in_max[i] = vt_rdval(client, - VT8231_REG_IN_MAX(i)); - } else { - data->in[i] = 0; - data->in_min[i] = 0; - data->in_max[i] = 0; - } - } - for (i = 1; i <= 2; i++) { - data->fan[i - 1] = vt_rdval(client, VT8231_REG_FAN(i)); - data->fan_min[i - 1] = vt_rdval(client, - VT8231_REG_FAN_MIN(i)); - } - for (i = 1; i <= 6; i++) { - if(ISTEMP(i, data->uch_config)) { - data->temp[i - 1] = vt_rdval(client, - VT8231_REG_TEMP(i)) << 2; - switch(i) { - case 1: - j = (vt_rdval(client, - VT8231_REG_TEMP_LOW12) & - 0xc0) >> 6; - break; - case 2: - j = (vt_rdval(client, - VT8231_REG_TEMP_LOW12) & - 0x30) >> 4; - break; - default: - j = (vt_rdval(client, - VT8231_REG_TEMP_LOW36) >> - ((i-3)*2)) & 0x03; - break; - - } - data->temp[i - 1] |= j; - data->temp_over[i - 1] = vt_rdval(client, - VT8231_REG_TEMP_OVER(i)); - data->temp_hyst[i - 1] = vt_rdval(client, - VT8231_REG_TEMP_HYST(i)); - } else { - data->temp[i - 1] = 0; - data->temp_over[i - 1] = 0; - data->temp_hyst[i - 1] = 0; - } - } - - for (i = 1; i <= 2; i++) { - data->fan[i - 1] = vt_rdval(client, VT8231_REG_FAN(i)); - data->fan_min[i - 1] = vt_rdval(client, - VT8231_REG_FAN_MIN(i)); - data->pwm[i - 1] = vt_rdval(client, VT8231_REG_PWM(i)); - } - - data->pwm_ctl = vt_rdval(client, VT8231_REG_PWM_CTL); - i = vt_rdval(client, VT8231_REG_FANDIV); - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = i >> 6; - data->alarms = vt_rdval(client, VT8231_REG_ALARM1) | - (vt_rdval(client, VT8231_REG_ALARM2) << 8); - data->vid= vt_rdval(client, VT8231_REG_VID) & 0x1f; - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -void vt8231_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - int nr = ctl_name - VT8231_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - vt8231_update_client(client); - results[0] = IN_FROM_REG(data->in_min[nr]); - results[1] = IN_FROM_REG(data->in_max[nr]); - results[2] = IN_FROM_REG(data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0]); - vt8231_write_value(client, VT8231_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1]); - vt8231_write_value(client, VT8231_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void vt8231_in5(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - vt8231_update_client(client); - results[0] = IN5_FROM_REG(data->in_min[5]); - results[1] = IN5_FROM_REG(data->in_max[5]); - results[2] = IN5_FROM_REG(data->in[5]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[5] = IN5_TO_REG(results[0]); - vt8231_write_value(client, VT8231_REG_IN_MIN(5), - data->in_min[5]); - } - if (*nrels_mag >= 2) { - data->in_max[5] = IN5_TO_REG(results[1]); - vt8231_write_value(client, VT8231_REG_IN_MAX(5), - data->in_max[5]); - } - } -} - -void vt8231_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - int nr = ctl_name - VT8231_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - vt8231_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data->fan_div - [nr - 1])); - results[1] = FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = MIN_TO_REG(results[0], - DIV_FROM_REG - (data-> - fan_div[nr-1])); - vt8231_write_value(client, VT8231_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } - } -} - - -void vt8231_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - vt8231_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_over[0]); - results[1] = TEMP_FROM_REG(data->temp_hyst[0]); - results[2] = TEMP_FROM_REG10(data->temp[0]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_over[0] = TEMP_TO_REG(results[0]); - vt8231_write_value(client, - VT8231_REG_TEMP_OVER(1), - data->temp_over[0]); - } - if (*nrels_mag >= 2) { - data->temp_hyst[0] = TEMP_TO_REG(results[1]); - vt8231_write_value(client, - VT8231_REG_TEMP_HYST(1), - data->temp_hyst[0]); - } - } -} - -void vt8231_therm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - int nr = ctl_name - VT8231_SYSCTL_TEMP; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - vt8231_update_client(client); - results[0] = THERM_FROM_REG(data->temp_over[nr] * 4); - results[1] = THERM_FROM_REG(data->temp_hyst[nr] * 4); - results[2] = THERM_FROM_REG(data->temp[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_over[nr] = THERM_TO_REG(results[0]); - vt8231_write_value(client, - VT8231_REG_TEMP_OVER(nr + 1), - data->temp_over[nr]); - } - if (*nrels_mag >= 2) { - data->temp_hyst[nr] = THERM_TO_REG(results[1]); - vt8231_write_value(client, - VT8231_REG_TEMP_HYST(nr + 1), - data->temp_hyst[nr]); - } - } -} - -void vt8231_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - vt8231_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -void vt8231_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - int old; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - vt8231_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = vt_rdval(client, VT8231_REG_FANDIV); - if (*nrels_mag >= 2) { - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) | (data->fan_div[1] << 6); - } - if (*nrels_mag >= 1) { - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) | (data->fan_div[0] << 4); - vt8231_write_value(client, VT8231_REG_FANDIV, old); - } - } -} - -void vt8231_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - int nr = 1 + ctl_name - VT8231_SYSCTL_PWM1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - vt8231_update_client(client); - results[0] = PWM_FROM_REG(data->pwm[nr - 1]); - results[1] = (data->pwm_ctl >> (3 + (4 * (nr - 1)))) & 1; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->pwm[nr - 1] = PWM_TO_REG(results[0]); - if (*nrels_mag >= 2) { - if(results[1]) { - data->pwm_ctl |= - (0x08 << (4 * (nr - 1))); - vt8231_write_value(client, - VT8231_REG_PWM_CTL, - data->pwm_ctl); - } else { - data->pwm_ctl &= - ~ (0x08 << (4 * (nr - 1))); - vt8231_write_value(client, - VT8231_REG_PWM_CTL, - data->pwm_ctl); - } - } - vt8231_write_value(client, VT8231_REG_PWM(nr), - data->pwm[nr - 1]); - } - } -} - -void vt8231_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - vt8231_update_client(client); - results[0] = vid_from_reg(data->vid, data->vrm); - *nrels_mag = 1; - } -} - -void vt8231_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) - data->vrm = results[0]; - } -} - -void vt8231_uch(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct vt8231_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->uch_config & 0x7c; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->uch_config = (data->uch_config & 0x83)|(results[0] & 0x7c); - vt8231_write_value(client, VT8231_REG_UCH_CONFIG, - data->uch_config); - } - } -} - -static int __init sm_vt8231_init(void) -{ - int addr; - - printk("vt8231.o version %s (%s)\n", LM_VERSION, LM_DATE); - - if (vt8231_find(&addr)) { - printk("vt8231.o: VT8231 not detected, module not inserted.\n"); - return -ENODEV; - } - normal_isa[0] = addr; - - return i2c_add_driver(&vt8231_driver);} - -static void __exit sm_vt8231_exit(void) -{ - i2c_del_driver(&vt8231_driver); -} - - - -MODULE_AUTHOR("Mark D. Studebaker "); -MODULE_DESCRIPTION("VT8231 sensors"); -MODULE_LICENSE("GPL"); - -module_init(sm_vt8231_init); -module_exit(sm_vt8231_exit); diff --git a/kernel/chips/w83627hf.c b/kernel/chips/w83627hf.c deleted file mode 100644 index f4054615..00000000 --- a/kernel/chips/w83627hf.c +++ /dev/null @@ -1,1501 +0,0 @@ -/* - w83627hf.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998 - 2003 Frodo Looijaard , - Philip Edelbrock , - and Mark Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - Supports following chips: - - Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA - 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, - use w83781d.c. - - Note: automatic ("cruise") fan control for 697, 637 & 627thf not - supported yet. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" -#include "lm75.h" - -static int force_addr; -MODULE_PARM(force_addr, "i"); -MODULE_PARM_DESC(force_addr, - "Initialize the base address of the sensors"); -static int force_i2c = 0x1f; -MODULE_PARM(force_i2c, "i"); -MODULE_PARM_DESC(force_i2c, - "Initialize the i2c address of the sensors"); - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_5(w83627hf, w83627thf, w83697hf, w83637hf, w83687thf); - -static int init = 1; -MODULE_PARM(init, "i"); -MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization"); - -/* modified from kernel/include/traps.c */ -static int REG; /* The register to read/write */ -#define DEV 0x07 /* Register: Logical device select */ -static int VAL; /* The value to read/write */ - -/* logical device numbers for superio_select (below) */ -#define W83627HF_LD_FDC 0x00 -#define W83627HF_LD_PRT 0x01 -#define W83627HF_LD_UART1 0x02 -#define W83627HF_LD_UART2 0x03 -#define W83627HF_LD_KBC 0x05 -#define W83627HF_LD_CIR 0x06 /* w83627hf only */ -#define W83627HF_LD_GAME 0x07 -#define W83627HF_LD_MIDI 0x07 -#define W83627HF_LD_GPIO1 0x07 -#define W83627HF_LD_GPIO5 0x07 /* w83627thf only */ -#define W83627HF_LD_GPIO2 0x08 -#define W83627HF_LD_GPIO3 0x09 -#define W83627HF_LD_GPIO4 0x09 /* w83627thf only */ -#define W83627HF_LD_ACPI 0x0a -#define W83627HF_LD_HWM 0x0b - -#define DEVID 0x20 /* Register: Device ID */ - -#define W83627THF_GPIO5_EN 0x30 /* w83627thf only */ -#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) -{ - outb(reg, REG); - outb(val, VAL); -} - -static inline int -superio_inb(int reg) -{ - outb(reg, REG); - return inb(VAL); -} - -static inline void -superio_select(int ld) -{ - outb(DEV, REG); - outb(ld, VAL); -} - -static inline void -superio_enter(void) -{ - outb(0x87, REG); - outb(0x87, REG); -} - -static inline void -superio_exit(void) -{ - outb(0xAA, REG); -} - -#define W627_DEVID 0x52 -#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 */ - -/* Length of ISA address segment */ -#define WINB_EXTENT 8 - -/* Where are the ISA address/data registers relative to the base address */ -#define W83781D_ADDR_REG_OFFSET 5 -#define W83781D_DATA_REG_OFFSET 6 - -/* The W83781D registers */ -/* The W83782D registers for nr=7,8 are in bank 5 */ -#define W83781D_REG_IN_MAX(nr) ((nr < 7) ? (0x2b + (nr) * 2) : \ - (0x554 + (((nr) - 7) * 2))) -#define W83781D_REG_IN_MIN(nr) ((nr < 7) ? (0x2c + (nr) * 2) : \ - (0x555 + (((nr) - 7) * 2))) -#define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \ - (0x550 + (nr) - 7)) - -#define W83781D_REG_FAN_MIN(nr) (0x3a + (nr)) -#define W83781D_REG_FAN(nr) (0x27 + (nr)) - -#define W83781D_REG_TEMP2 0x0150 -#define W83781D_REG_TEMP3 0x0250 -#define W83781D_REG_TEMP2_HYST 0x153 -#define W83781D_REG_TEMP3_HYST 0x253 -#define W83781D_REG_TEMP2_CONFIG 0x152 -#define W83781D_REG_TEMP3_CONFIG 0x252 -#define W83781D_REG_TEMP2_OVER 0x155 -#define W83781D_REG_TEMP3_OVER 0x255 - -#define W83781D_REG_TEMP 0x27 -#define W83781D_REG_TEMP_OVER 0x39 -#define W83781D_REG_TEMP_HYST 0x3A -#define W83781D_REG_BANK 0x4E - -#define W83781D_REG_CONFIG 0x40 -#define W83781D_REG_ALARM1 0x459 -#define W83781D_REG_ALARM2 0x45A -#define W83781D_REG_ALARM3 0x45B - -#define W83781D_REG_BEEP_CONFIG 0x4D -#define W83781D_REG_BEEP_INTS1 0x56 -#define W83781D_REG_BEEP_INTS2 0x57 -#define W83781D_REG_BEEP_INTS3 0x453 - -#define W83781D_REG_VID_FANDIV 0x47 - -#define W83781D_REG_CHIPID 0x49 -#define W83781D_REG_WCHIPID 0x58 -#define W83781D_REG_CHIPMAN 0x4F -#define W83781D_REG_PIN 0x4B - -#define W83781D_REG_VBAT 0x5D - -#define W83627HF_REG_PWM1 0x5A -#define W83627HF_REG_PWM2 0x5B - -#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/687THF too */ - -static const u8 regpwm_627hf[] = { W83627HF_REG_PWM1, W83627HF_REG_PWM2 }; -static const u8 regpwm[] = { W83627THF_REG_PWM1, W83627THF_REG_PWM2, - W83627THF_REG_PWM3 }; -#define W836X7HF_REG_PWM(type, nr) (((type) == w83627hf) ? \ - regpwm_627hf[(nr) - 1] : regpwm[(nr) - 1]) - -#define W83781D_REG_I2C_ADDR 0x48 -#define W83781D_REG_I2C_SUBADDR 0x4A - -/* Sensor selection */ -#define W83781D_REG_SCFG1 0x5D -static const u8 BIT_SCFG1[] = { 0x02, 0x04, 0x08 }; -#define W83781D_REG_SCFG2 0x59 -static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 }; -#define W83781D_DEFAULT_BETA 3435 - -/* Conversions. Limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255)) -#define IN_FROM_REG(val) (((val) * 16 + 5) / 10) - -#define IN_TO_REG_VRM9(val) \ - (SENSORS_LIMIT((((val) * 1000 - 70000 + 244) / 488), 0, 255)) -#define IN_FROM_REG_VRM9(reg) (((reg) * 488 + 70000 + 500) / 1000) - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define TEMP_MIN (-1280) -#define TEMP_MAX ( 1270) - -/* TEMP: 1/10 degrees C (-128C to +127C) - REG: 1C/bit, two's complement */ -static u8 TEMP_TO_REG(int temp) -{ - int ntemp = SENSORS_LIMIT(temp, TEMP_MIN, TEMP_MAX); - ntemp += (ntemp<0 ? -5 : 5); - return (u8)(ntemp / 10); -} - -static int TEMP_FROM_REG(u8 reg) -{ - return (s8)reg * 10; -} - -#define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==255?0:1350000/((val)*(div))) - -#define PWM_TO_REG(val) (SENSORS_LIMIT((val),0,255)) -#define BEEPS_TO_REG(val) ((val) & 0xffffff) - -#define BEEP_ENABLE_TO_REG(val) ((val)?1:0) -#define BEEP_ENABLE_FROM_REG(val) ((val)?1:0) - -#define DIV_FROM_REG(val) (1 << (val)) - -static inline u8 DIV_TO_REG(long val) -{ - int i; - val = SENSORS_LIMIT(val, 1, 128) >> 1; - for (i = 0; i < 7; i++) { - if (val == 0) - break; - val >>= 1; - } - return ((u8) i); -} - -/* For each registered chip, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new client is allocated. */ -struct w83627hf_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 in[9]; /* Register value */ - u8 in_max[9]; /* Register value */ - u8 in_min[9]; /* Register value */ - u8 fan[3]; /* Register value */ - u8 fan_min[3]; /* Register value */ - u8 temp; - u8 temp_over; /* Register value */ - u8 temp_hyst; /* Register value */ - u16 temp_add[2]; /* Register value */ - u16 temp_add_over[2]; /* Register value */ - u16 temp_add_hyst[2]; /* Register value */ - u8 fan_div[3]; /* Register encoding, shifted right */ - u8 vid; /* Register encoding, combined */ - u32 alarms; /* Register encoding, combined */ - u32 beeps; /* Register encoding, combined */ - u8 beep_enable; /* Boolean */ - u8 pwm[3]; /* Register value */ - u16 sens[3]; /* 782D/783S only. - 1 = pentium diode; 2 = 3904 diode; - 3000-5000 = thermistor beta. - Default = 3435. - Other Betas unimplemented */ - u8 vrm; - u8 vrm_ovt; /* Register value, 627THF/637HF/687THF only */ -}; - - -static int w83627hf_attach_adapter(struct i2c_adapter *adapter); -static int w83627hf_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int w83627hf_detach_client(struct i2c_client *client); - -static int w83627hf_read_value(struct i2c_client *client, u16 register); -static int w83627hf_write_value(struct i2c_client *client, u16 register, - u16 value); -static void w83627hf_update_client(struct i2c_client *client); -static void w83627hf_init_client(struct i2c_client *client); - - -static void w83627hf_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_temp_add(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_beep(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83627hf_sens(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver w83627hf_driver = { - .name = "W83627HF sensor driver", - .id = I2C_DRIVERID_W83627HF, - .flags = I2C_DF_NOTIFY, - .attach_adapter = w83627hf_attach_adapter, - .detach_client = w83627hf_detach_client, -}; - -/* The /proc/sys entries */ -/* WARNING these are copied from w83781d.c and have not been renamed. - 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 !!! -*/ -/* -- SENSORS SYSCTL START -- */ - -#define W83781D_SYSCTL_IN0 1000 /* Volts * 100 */ -#define W83781D_SYSCTL_IN1 1001 -#define W83781D_SYSCTL_IN2 1002 -#define W83781D_SYSCTL_IN3 1003 -#define W83781D_SYSCTL_IN4 1004 -#define W83781D_SYSCTL_IN5 1005 -#define W83781D_SYSCTL_IN6 1006 -#define W83781D_SYSCTL_IN7 1007 -#define W83781D_SYSCTL_IN8 1008 -#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */ -#define W83781D_SYSCTL_FAN2 1102 -#define W83781D_SYSCTL_FAN3 1103 -#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_VID 1300 /* Volts * 1000 */ -#define W83781D_SYSCTL_VRM 1301 -#define W83781D_SYSCTL_PWM1 1401 -#define W83781D_SYSCTL_PWM2 1402 -#define W83781D_SYSCTL_PWM3 1403 -#define W83781D_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ -#define W83781D_SYSCTL_SENS2 1502 -#define W83781D_SYSCTL_SENS3 1503 -#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */ -#define W83781D_SYSCTL_BEEP 2002 /* bitvector */ - -#define W83781D_ALARM_IN0 0x0001 -#define W83781D_ALARM_IN1 0x0002 -#define W83781D_ALARM_IN2 0x0004 -#define W83781D_ALARM_IN3 0x0008 -#define W83781D_ALARM_IN4 0x0100 -#define W83781D_ALARM_IN5 0x0200 -#define W83781D_ALARM_IN6 0x0400 -#define W83782D_ALARM_IN7 0x10000 -#define W83782D_ALARM_IN8 0x20000 -#define W83781D_ALARM_FAN1 0x0040 -#define W83781D_ALARM_FAN2 0x0080 -#define W83781D_ALARM_FAN3 0x0800 -#define W83781D_ALARM_TEMP1 0x0010 -#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */ -#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S */ -#define W83781D_ALARM_TEMP3 0x2000 /* 782D only */ -#define W83781D_ALARM_CHAS 0x1000 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected chip. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ - -/* without pwm3-4 */ -static ctl_table w83627hf_dir_table_template[] = { - {W83781D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan}, - {W83781D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan}, - {W83781D_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan}, - {W83781D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_temp}, - {W83781D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_temp_add}, - {W83781D_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_temp_add}, - {W83781D_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_vid}, - {W83781D_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_vrm}, - {W83781D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan_div}, - {W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_alarms}, - {W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_beep}, - {W83781D_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_pwm}, - {W83781D_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_pwm}, - {W83781D_SYSCTL_SENS1, "sensor1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_sens}, - {W83781D_SYSCTL_SENS2, "sensor2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_sens}, - {W83781D_SYSCTL_SENS3, "sensor3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_sens}, - {0} -}; - -/* similar to w83782d but no fan3, no vid */ -static ctl_table w83697hf_dir_table_template[] = { - {W83781D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - /* no in1 to maintain compatibility with 781d and 782d. */ - {W83781D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan}, - {W83781D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan}, - {W83781D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_temp}, - {W83781D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_temp_add}, - {W83781D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan_div}, - {W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_alarms}, - {W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_beep}, - {W83781D_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_pwm}, - {W83781D_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_pwm}, - {W83781D_SYSCTL_SENS1, "sensor1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_sens}, - {W83781D_SYSCTL_SENS2, "sensor2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_sens}, - {0} -}; - -/* no in5 and in6 */ -/* 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}, - {W83781D_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_in}, - {W83781D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan}, - {W83781D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan}, - {W83781D_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan}, - {W83781D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_temp}, - {W83781D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_temp_add}, - {W83781D_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_temp_add}, - {W83781D_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_vid}, - {W83781D_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_vrm}, - {W83781D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_fan_div}, - {W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_alarms}, - {W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_beep}, - {W83781D_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_pwm}, - {W83781D_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_pwm}, - {W83781D_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_pwm}, - {W83781D_SYSCTL_SENS1, "sensor1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_sens}, - {W83781D_SYSCTL_SENS2, "sensor2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_sens}, - {W83781D_SYSCTL_SENS3, "sensor3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83627hf_sens}, - {0} -}; - - -/* This function is called when: - * w83627hf_driver is inserted (when this module is loaded), for each - available adapter - * when a new adapter is inserted (and w83627hf_driver is still present) */ -static int w83627hf_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, w83627hf_detect); -} - -static int __init w83627hf_find(int sioaddr, int *address) -{ - u16 val; - - REG = sioaddr; - VAL = sioaddr + 1; - - superio_enter(); - val= superio_inb(DEVID); - if (val != W627_DEVID && val != W627THF_DEVID && val != W697_DEVID - && val != W637_DEVID && val != W687THF_DEVID) { - superio_exit(); - return -ENODEV; - } - - superio_select(W83627HF_LD_HWM); - val = (superio_inb(WINB_BASE_REG) << 8) | - superio_inb(WINB_BASE_REG + 1); - *address = val & ~(WINB_EXTENT - 1); - if (*address == 0 && force_addr == 0) { - printk("w83627hf.o: base address not set - use force_addr=0xaddr\n"); - superio_exit(); - return -ENODEV; - } - if (force_addr) - *address = force_addr; /* so detect will get called */ - - superio_exit(); - return 0; -} - -int w83627hf_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i, val; - struct i2c_client *new_client; - struct w83627hf_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - if (!i2c_is_isa_adapter(adapter)) - return 0; - - if(force_addr) - address = force_addr & ~(WINB_EXTENT - 1); - if (check_region(address, WINB_EXTENT)) { - printk("w83627hf.o: region 0x%x already in use!\n", address); - return -ENODEV; - } - if(force_addr) { - printk("w83627hf.o: forcing ISA address 0x%04X\n", address); - superio_enter(); - superio_select(W83627HF_LD_HWM); - superio_outb(WINB_BASE_REG, address >> 8); - superio_outb(WINB_BASE_REG+1, address & 0xff); - superio_exit(); - } - - superio_enter(); - val= superio_inb(DEVID); - if(val == W627_DEVID) - kind = w83627hf; - else if(val == W697_DEVID) - kind = w83697hf; - else if(val == W627THF_DEVID) - 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) - superio_outb(WINB_ACT_REG, 1); - superio_exit(); - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access w83627hf_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct w83627hf_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - init_MUTEX(&data->lock); - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &w83627hf_driver; - new_client->flags = 0; - - - if (kind == w83627hf) { - type_name = "w83627hf"; - client_name = "W83627HF chip"; - } else if (kind == w83627thf) { - type_name = "w83627thf"; - client_name = "W83627THF chip"; - } else if (kind == w83697hf) { - type_name = "w83697hf"; - client_name = "W83697HF chip"; - } 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; - } - - request_region(address, WINB_EXTENT, type_name); - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - (kind == w83697hf) ? - w83697hf_dir_table_template : - (kind == w83627hf) ? - w83627hf_dir_table_template : - /* w83627thf table also used for 637HF - and 687THF */ - w83627thf_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR7; - } - data->sysctl_id = i; - - /* Initialize the chip */ - w83627hf_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - -ERROR7: - i2c_detach_client(new_client); -ERROR3: - release_region(address, WINB_EXTENT); -ERROR1: - kfree(data); -ERROR0: - return err; -} - -static int w83627hf_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct w83627hf_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - (KERN_ERR "w83627hf.o: Client deregistration failed, client not detached.\n"); - return err; - } - - release_region(client->addr, WINB_EXTENT); - kfree(client->data); - - return 0; -} - - -/* - ISA access must always be locked explicitly! - We ignore the W83781D BUSY flag at this moment - it could lead to deadlocks, - would slow down the W83781D access and should not be necessary. - There are some ugly typecasts here, but the good news is - they should - nowhere else be necessary! */ -static int w83627hf_read_value(struct i2c_client *client, u16 reg) -{ - int res, word_sized; - - down(&(((struct w83627hf_data *) (client->data))->lock)); - word_sized = (((reg & 0xff00) == 0x100) - || ((reg & 0xff00) == 0x200)) - && (((reg & 0x00ff) == 0x50) - || ((reg & 0x00ff) == 0x53) - || ((reg & 0x00ff) == 0x55)); - if (reg & 0xff00) { - outb_p(W83781D_REG_BANK, - client->addr + W83781D_ADDR_REG_OFFSET); - outb_p(reg >> 8, - client->addr + W83781D_DATA_REG_OFFSET); - } - outb_p(reg & 0xff, client->addr + W83781D_ADDR_REG_OFFSET); - res = inb_p(client->addr + W83781D_DATA_REG_OFFSET); - if (word_sized) { - outb_p((reg & 0xff) + 1, - client->addr + W83781D_ADDR_REG_OFFSET); - res = - (res << 8) + inb_p(client->addr + - W83781D_DATA_REG_OFFSET); - } - if (reg & 0xff00) { - outb_p(W83781D_REG_BANK, - client->addr + W83781D_ADDR_REG_OFFSET); - outb_p(0, client->addr + W83781D_DATA_REG_OFFSET); - } - up(&(((struct w83627hf_data *) (client->data))->lock)); - return res; -} - -static int w83627thf_read_gpio5(struct i2c_client *client) -{ - int res = 0xff, sel; - - superio_enter(); - superio_select(W83627HF_LD_GPIO5); - - /* Make sure these GPIO pins are enabled */ - if (!(superio_inb(W83627THF_GPIO5_EN) & (1<<3))) { -#ifdef DEBUG - printk(KERN_DEBUG "w83627hf: GPIO5 disabled, no VID " - "function\n"); -#endif - goto exit; - } - - /* Make sure the pins are configured for input - There must be at least five (VRM 9), and possibly 6 (VRM 10) */ - sel = superio_inb(W83627THF_GPIO5_IOSR) & 0x3f; - if ((sel & 0x1f) != 0x1f) { -#ifdef DEBUG - printk(KERN_DEBUG "w83627hf: GPIO5 not configured for " - "VID function\n"); -#endif - goto exit; - } - - printk(KERN_INFO "w83627hf: Reading VID from GPIO5\n"); - res = superio_inb(W83627THF_GPIO5_DR) & sel; - -exit: - superio_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; - - down(&(((struct w83627hf_data *) (client->data))->lock)); - word_sized = (((reg & 0xff00) == 0x100) - || ((reg & 0xff00) == 0x200)) - && (((reg & 0x00ff) == 0x53) - || ((reg & 0x00ff) == 0x55)); - if (reg & 0xff00) { - outb_p(W83781D_REG_BANK, - client->addr + W83781D_ADDR_REG_OFFSET); - outb_p(reg >> 8, - client->addr + W83781D_DATA_REG_OFFSET); - } - outb_p(reg & 0xff, client->addr + W83781D_ADDR_REG_OFFSET); - if (word_sized) { - outb_p(value >> 8, - client->addr + W83781D_DATA_REG_OFFSET); - outb_p((reg & 0xff) + 1, - client->addr + W83781D_ADDR_REG_OFFSET); - } - outb_p(value & 0xff, - client->addr + W83781D_DATA_REG_OFFSET); - if (reg & 0xff00) { - outb_p(W83781D_REG_BANK, - client->addr + W83781D_ADDR_REG_OFFSET); - outb_p(0, client->addr + W83781D_DATA_REG_OFFSET); - } - up(&(((struct w83627hf_data *) (client->data))->lock)); - return 0; -} - -/* Called when we have found a new W83781D. */ -static void w83627hf_init_client(struct i2c_client *client) -{ - struct w83627hf_data *data = client->data; - int i; - int type = data->type; - u8 tmp; - - /* Minimize conflicts with other winbond i2c-only clients... */ - /* disable i2c subclients... how to disable main i2c client?? */ - /* force i2c address to relatively uncommon address */ - w83627hf_write_value(client, W83781D_REG_I2C_SUBADDR, 0x89); - w83627hf_write_value(client, W83781D_REG_I2C_ADDR, force_i2c); - - /* Read VID only once */ - if (w83627hf == data->type || w83637hf == data->type) { - int lo = w83627hf_read_value(client, W83781D_REG_VID_FANDIV); - int hi = w83627hf_read_value(client, W83781D_REG_CHIPID); - 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 - || w83687thf == data->type) - data->vrm_ovt = - w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG); - else - data->vrm_ovt = 0; - - /* Choose VRM based on "VRM & OVT" register */ - data->vrm = (data->vrm_ovt & 0x01) ? 90 : 82; - - tmp = w83627hf_read_value(client, W83781D_REG_SCFG1); - for (i = 1; i <= 3; i++) { - if (!(tmp & BIT_SCFG1[i - 1])) { - data->sens[i - 1] = W83781D_DEFAULT_BETA; - } else { - if (w83627hf_read_value - (client, - W83781D_REG_SCFG2) & BIT_SCFG2[i - 1]) - data->sens[i - 1] = 1; - else - data->sens[i - 1] = 2; - } - if ((type == w83697hf) && (i == 2)) - break; - } - - if(init) { - /* Enable temp2 */ - tmp = w83627hf_read_value(client, W83781D_REG_TEMP2_CONFIG); - if (tmp & 0x01) { - printk(KERN_WARNING "w83627hf: temp2 was disabled, " - "readings might not make sense\n"); - w83627hf_write_value(client, W83781D_REG_TEMP2_CONFIG, - tmp & 0xfe); - } - - /* Enable temp3 */ - if (type != w83697hf) { - tmp = w83627hf_read_value(client, - W83781D_REG_TEMP3_CONFIG); - if (tmp & 0x01) { - printk(KERN_WARNING "w83627hf: temp3 was " - "disabled, readings might not make " - "sense\n"); - w83627hf_write_value(client, - W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); - } - } - } - - /* Start monitoring */ - w83627hf_write_value(client, W83781D_REG_CONFIG, - (w83627hf_read_value(client, - W83781D_REG_CONFIG) & 0xf7) - | 0x01); -} - -static void w83627hf_update_client(struct i2c_client *client) -{ - struct w83627hf_data *data = client->data; - int i; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - for (i = 0; i <= 8; i++) { - /* skip missing sensors */ - if (((data->type == w83697hf) && (i == 1)) || - ((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)); - data->in_min[i] = - w83627hf_read_value(client, - W83781D_REG_IN_MIN(i)); - data->in_max[i] = - w83627hf_read_value(client, - W83781D_REG_IN_MAX(i)); - } - for (i = 1; i <= 3; i++) { - data->fan[i - 1] = - w83627hf_read_value(client, W83781D_REG_FAN(i)); - data->fan_min[i - 1] = - w83627hf_read_value(client, - W83781D_REG_FAN_MIN(i)); - } - for (i = 1; i <= 3; i++) { - u8 tmp = w83627hf_read_value(client, - W836X7HF_REG_PWM(data->type, i)); - if (data->type == w83627thf) - tmp &= 0xf0; /* bits 0-3 are reserved in 627THF */ - data->pwm[i - 1] = tmp; - if(i == 2 && (data->type == w83627hf || data->type == w83697hf)) - break; - } - - data->temp = w83627hf_read_value(client, W83781D_REG_TEMP); - data->temp_over = - w83627hf_read_value(client, W83781D_REG_TEMP_OVER); - data->temp_hyst = - w83627hf_read_value(client, W83781D_REG_TEMP_HYST); - data->temp_add[0] = - w83627hf_read_value(client, W83781D_REG_TEMP2); - data->temp_add_over[0] = - w83627hf_read_value(client, W83781D_REG_TEMP2_OVER); - data->temp_add_hyst[0] = - w83627hf_read_value(client, W83781D_REG_TEMP2_HYST); - if (data->type != w83697hf) { - data->temp_add[1] = - w83627hf_read_value(client, W83781D_REG_TEMP3); - data->temp_add_over[1] = - w83627hf_read_value(client, W83781D_REG_TEMP3_OVER); - data->temp_add_hyst[1] = - w83627hf_read_value(client, W83781D_REG_TEMP3_HYST); - } - - i = w83627hf_read_value(client, W83781D_REG_VID_FANDIV); - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = (i >> 6) & 0x03; - if (data->type != w83697hf) { - data->fan_div[2] = (w83627hf_read_value(client, - W83781D_REG_PIN) >> 6) & 0x03; - } - i = w83627hf_read_value(client, W83781D_REG_VBAT); - data->fan_div[0] |= (i >> 3) & 0x04; - data->fan_div[1] |= (i >> 4) & 0x04; - if (data->type != w83697hf) - data->fan_div[2] |= (i >> 5) & 0x04; - data->alarms = - w83627hf_read_value(client, W83781D_REG_ALARM1) | - (w83627hf_read_value(client, W83781D_REG_ALARM2) << 8) | - (w83627hf_read_value(client, W83781D_REG_ALARM3) << 16); - i = w83627hf_read_value(client, W83781D_REG_BEEP_INTS2); - data->beep_enable = i >> 7; - data->beeps = ((i & 0x7f) << 8) | - w83627hf_read_value(client, W83781D_REG_BEEP_INTS1) | - w83627hf_read_value(client, W83781D_REG_BEEP_INTS3) << 16; - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -void w83627hf_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - int nr = ctl_name - W83781D_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - w83627hf_update_client(client); - - if (nr == 0 && (data->vrm_ovt & 0x01)) { - /* use VRM9 calculation */ - results[0] = IN_FROM_REG_VRM9(data->in_min[0]); - results[1] = IN_FROM_REG_VRM9(data->in_max[0]); - results[2] = IN_FROM_REG_VRM9(data->in[0]); - - } else { - /* use VRM8 (standard) calculation */ - results[0] = IN_FROM_REG(data->in_min[nr]); - results[1] = IN_FROM_REG(data->in_max[nr]); - results[2] = IN_FROM_REG(data->in[nr]); - } - - *nrels_mag = 3; - - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (nr == 0 && (data->vrm_ovt & 0x01)) - /* use VRM9 calculation */ - data->in_min[0] = IN_TO_REG_VRM9(results[0]); - else - /* use VRM8 (standard) calculation */ - data->in_min[nr] = IN_TO_REG(results[0]); - - w83627hf_write_value(client, W83781D_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - if (nr == 0 && (data->vrm_ovt & 0x01)) - /* use VRM9 calculation */ - data->in_max[0] = IN_TO_REG_VRM9(results[1]); - else - /* use VRM8 (standard) calculation */ - data->in_max[nr] = IN_TO_REG(results[1]); - - w83627hf_write_value(client, W83781D_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void w83627hf_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - int nr = ctl_name - W83781D_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83627hf_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - results[1] = FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = - FAN_TO_REG(results[0], - DIV_FROM_REG(data->fan_div[nr-1])); - w83627hf_write_value(client, - W83781D_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } - } -} - -void w83627hf_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - w83627hf_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_over); - results[1] = TEMP_FROM_REG(data->temp_hyst); - results[2] = TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_over = TEMP_TO_REG(results[0]); - w83627hf_write_value(client, W83781D_REG_TEMP_OVER, - data->temp_over); - } - if (*nrels_mag >= 2) { - data->temp_hyst = TEMP_TO_REG(results[1]); - w83627hf_write_value(client, W83781D_REG_TEMP_HYST, - data->temp_hyst); - } - } -} - -void w83627hf_temp_add(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - int nr = ctl_name - W83781D_SYSCTL_TEMP2; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - w83627hf_update_client(client); - results[0] = - LM75_TEMP_FROM_REG(data->temp_add_over[nr]); - results[1] = - LM75_TEMP_FROM_REG(data->temp_add_hyst[nr]); - results[2] = LM75_TEMP_FROM_REG(data->temp_add[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_add_over[nr] = - LM75_TEMP_TO_REG(results[0]); - w83627hf_write_value(client, - nr ? W83781D_REG_TEMP3_OVER : - W83781D_REG_TEMP2_OVER, - data->temp_add_over[nr]); - } - if (*nrels_mag >= 2) { - data->temp_add_hyst[nr] = - LM75_TEMP_TO_REG(results[1]); - w83627hf_write_value(client, - nr ? W83781D_REG_TEMP3_HYST : - W83781D_REG_TEMP2_HYST, - data->temp_add_hyst[nr]); - } - } -} - -void w83627hf_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - if (data->vid == 0xff) - results[0] = 0; - else - results[0] = vid_from_reg(data->vid, data->vrm); - *nrels_mag = 1; - } -} - -void w83627hf_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) - data->vrm = results[0]; - } -} - -void w83627hf_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83627hf_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -void w83627hf_beep(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - int val; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83627hf_update_client(client); - results[0] = BEEP_ENABLE_FROM_REG(data->beep_enable); - results[1] = data->beeps; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 2) { - data->beeps = BEEPS_TO_REG(results[1]); - w83627hf_write_value(client, W83781D_REG_BEEP_INTS1, - data->beeps & 0xff); - w83627hf_write_value(client, - W83781D_REG_BEEP_INTS3, - ((data-> beeps) >> 16) & - 0xff); - val = (data->beeps >> 8) & 0x7f; - } else if (*nrels_mag >= 1) - val = - w83627hf_read_value(client, - W83781D_REG_BEEP_INTS2) & - 0x7f; - if (*nrels_mag >= 1) { - data->beep_enable = BEEP_ENABLE_TO_REG(results[0]); - w83627hf_write_value(client, W83781D_REG_BEEP_INTS2, - val | data->beep_enable << 7); - } - } -} - -/* w83697hf only has two fans */ -void w83627hf_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - int old, old2, old3 = 0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83627hf_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - if (data->type == w83697hf) { - *nrels_mag = 2; - } else { - results[2] = DIV_FROM_REG(data->fan_div[2]); - *nrels_mag = 3; - } - } else if (operation == SENSORS_PROC_REAL_WRITE) { - unsigned long min = 0; - - old = w83627hf_read_value(client, W83781D_REG_VID_FANDIV); - /* w83627hf doesn't have extended divisor bits */ - old3 = w83627hf_read_value(client, W83781D_REG_VBAT); - if (*nrels_mag >= 3 && data->type != w83697hf) { - min = FAN_FROM_REG(data->fan_min[2], - DIV_FROM_REG(data->fan_div[2])); - data->fan_div[2] = DIV_TO_REG(results[2]); - old2 = w83627hf_read_value(client, W83781D_REG_PIN); - old2 = (old2 & 0x3f) - | ((data->fan_div[2] & 0x03) << 6); - w83627hf_write_value(client, W83781D_REG_PIN, old2); - old3 = (old3 & 0x7f) - | ((data->fan_div[2] & 0x04) << 5); - data->fan_min[2] = FAN_TO_REG(min, - DIV_FROM_REG(data->fan_div[2])); - w83627hf_write_value(client, W83781D_REG_FAN_MIN(3), - data->fan_min[2]); - } - if (*nrels_mag >= 2) { - min = FAN_FROM_REG(data->fan_min[1], - DIV_FROM_REG(data->fan_div[1])); - data->fan_div[1] = DIV_TO_REG(results[1]); - old = (old & 0x3f) - | ((data->fan_div[1] & 0x03) << 6); - old3 = (old3 & 0xbf) - | ((data->fan_div[1] & 0x04) << 4); - data->fan_min[1] = FAN_TO_REG(min, - DIV_FROM_REG(data->fan_div[1])); - w83627hf_write_value(client, W83781D_REG_FAN_MIN(2), - data->fan_min[1]); - } - if (*nrels_mag >= 1) { - min = FAN_FROM_REG(data->fan_min[0], - DIV_FROM_REG(data->fan_div[0])); - data->fan_div[0] = DIV_TO_REG(results[0]); - old = (old & 0xcf) - | ((data->fan_div[0] & 0x03) << 4); - w83627hf_write_value(client, W83781D_REG_VID_FANDIV, - old); - old3 = (old3 & 0xdf) - | ((data->fan_div[0] & 0x04) << 3); - w83627hf_write_value(client, W83781D_REG_VBAT, - old3); - data->fan_min[0] = FAN_TO_REG(min, - DIV_FROM_REG(data->fan_div[0])); - w83627hf_write_value(client, W83781D_REG_FAN_MIN(1), - data->fan_min[0]); - } - } -} - -/* we do not currently support disabling PWM with 2nd argument; - set first argument to 255 to disable */ -void w83627hf_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - int nr = 1 + ctl_name - W83781D_SYSCTL_PWM1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83627hf_update_client(client); - results[0] = data->pwm[nr - 1]; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - if (data->type == w83627thf) { - /* bits 0-3 are reserved in 627THF */ - data->pwm[nr - 1] = PWM_TO_REG(results[0]) & 0xf0; - w83627hf_write_value(client, - W836X7HF_REG_PWM(data->type, nr), - data->pwm[nr - 1] | - (w83627hf_read_value(client, - W836X7HF_REG_PWM(data->type, nr)) & 0x0f)); - } else { - data->pwm[nr - 1] = PWM_TO_REG(results[0]); - w83627hf_write_value(client, - W836X7HF_REG_PWM(data->type, nr), - data->pwm[nr - 1]); - } - } - } -} - -void w83627hf_sens(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83627hf_data *data = client->data; - int nr = 1 + ctl_name - W83781D_SYSCTL_SENS1; - u8 tmp; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->sens[nr - 1]; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - switch (results[0]) { - case 1: /* PII/Celeron diode */ - tmp = w83627hf_read_value(client, - W83781D_REG_SCFG1); - w83627hf_write_value(client, - W83781D_REG_SCFG1, - tmp | BIT_SCFG1[nr - - 1]); - tmp = w83627hf_read_value(client, - W83781D_REG_SCFG2); - w83627hf_write_value(client, - W83781D_REG_SCFG2, - tmp | BIT_SCFG2[nr - - 1]); - data->sens[nr - 1] = results[0]; - break; - case 2: /* 3904 */ - tmp = w83627hf_read_value(client, - W83781D_REG_SCFG1); - w83627hf_write_value(client, - W83781D_REG_SCFG1, - tmp | BIT_SCFG1[nr - - 1]); - tmp = w83627hf_read_value(client, - W83781D_REG_SCFG2); - w83627hf_write_value(client, - W83781D_REG_SCFG2, - tmp & ~BIT_SCFG2[nr - - 1]); - data->sens[nr - 1] = results[0]; - break; - case W83781D_DEFAULT_BETA: /* thermistor */ - tmp = w83627hf_read_value(client, - W83781D_REG_SCFG1); - w83627hf_write_value(client, - W83781D_REG_SCFG1, - tmp & ~BIT_SCFG1[nr - - 1]); - data->sens[nr - 1] = results[0]; - break; - default: - printk - (KERN_ERR "w83627hf.o: Invalid sensor type %ld; must be 1, 2, or %d\n", - results[0], W83781D_DEFAULT_BETA); - break; - } - } - } -} - -static int __init sm_w83627hf_init(void) -{ - int addr; - - printk(KERN_INFO "w83627hf.o version %s (%s)\n", LM_VERSION, LM_DATE); - if (w83627hf_find(0x2e, &addr) - && w83627hf_find(0x4e, &addr)) { - printk("w83627hf.o: W83627/697 not detected, module not inserted.\n"); - return -ENODEV; - } - normal_isa[0] = addr; - - return i2c_add_driver(&w83627hf_driver); -} - -static void __exit sm_w83627hf_exit(void) -{ - i2c_del_driver(&w83627hf_driver); -} - - - -MODULE_AUTHOR("Frodo Looijaard , " - "Philip Edelbrock , " - "and Mark Studebaker "); -MODULE_DESCRIPTION("W83627HF driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_w83627hf_init); -module_exit(sm_w83627hf_exit); diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c deleted file mode 100644 index 73ceec28..00000000 --- a/kernel/chips/w83781d.c +++ /dev/null @@ -1,1883 +0,0 @@ -/* - w83781d.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998 - 2003 Frodo Looijaard , - Philip Edelbrock , - and Mark Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - Supports following chips: - - Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA - as99127f 7 3 0 3 0x31 0x12c3 yes no - as99127f rev.2 (type name = as99127f) 0x31 0x5ca3 yes no - w83627hf 9 3 2 3 0x21 0x5ca3 yes yes(LPC) - w83781d 7 3 0 3 0x10-1 0x5ca3 yes yes - w83782d 9 3 2-4 3 0x30 0x5ca3 yes yes - w83783s 5-6 3 2 1-2 0x40 0x5ca3 yes no - w83791d 10 5 5 3 0x71 0x5ca3 yes no - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" -#include "lm75.h" - -/* RT Table support #defined so we can take it out if it gets bothersome */ -#define W83781D_RT 1 - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x20, 0x2f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { 0x0290, SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_6(w83781d, w83782d, w83783s, w83627hf, as99127f, w83791d); -SENSORS_MODULE_PARM(force_subclients, "List of subclient addresses: " \ - "{bus, clientaddr, subclientaddr1, subclientaddr2}"); - -static int init = 1; -MODULE_PARM(init, "i"); -MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization"); - -/* Constants specified below */ - -/* Length of ISA address segment */ -#define W83781D_EXTENT 8 - -/* Where are the ISA address/data registers relative to the base address */ -#define W83781D_ADDR_REG_OFFSET 5 -#define W83781D_DATA_REG_OFFSET 6 - -/* The W83781D registers */ -/* The W83782D registers for nr=7,8 are in bank 5 */ -#define W83781D_REG_IN_MAX(nr) ((nr < 7) ? (0x2b + (nr) * 2) : \ - (0x554 + (((nr) - 7) * 2))) -#define W83781D_REG_IN_MIN(nr) ((nr < 7) ? (0x2c + (nr) * 2) : \ - (0x555 + (((nr) - 7) * 2))) -#define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \ - (0x550 + (nr) - 7)) - -#define W83791D_REG_IN_MAX(nr) ((nr < 7) ? (0x2b + (nr) * 2) : \ - (0xb4 + (((nr) - 7) * 2))) -#define W83791D_REG_IN_MIN(nr) ((nr < 7) ? (0x2c + (nr) * 2) : \ - (0xb5 + (((nr) - 7) * 2))) -#define W83791D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \ - (0xb0 + (nr) - 7)) - -#define W83781D_REG_FAN_MIN(nr) ((nr < 4) ? (0x3a + (nr)) : \ - (0xba + (nr) - 4)) -#define W83781D_REG_FAN(nr) ((nr < 4) ? (0x27 + (nr)) : \ - (0xbc + (nr) - 4)) - -#define W83781D_REG_TEMP2 0x0150 -#define W83781D_REG_TEMP3 0x0250 -#define W83781D_REG_TEMP2_HYST 0x153 -#define W83781D_REG_TEMP3_HYST 0x253 -#define W83781D_REG_TEMP2_CONFIG 0x152 -#define W83781D_REG_TEMP3_CONFIG 0x252 -#define W83781D_REG_TEMP2_OVER 0x155 -#define W83781D_REG_TEMP3_OVER 0x255 - -#define W83781D_REG_TEMP 0x27 -#define W83781D_REG_TEMP_OVER 0x39 -#define W83781D_REG_TEMP_HYST 0x3A -#define W83781D_REG_BANK 0x4E - -#define W83781D_REG_CONFIG 0x40 - -/* Interrupt status (W83781D, AS99127F) */ -#define W83781D_REG_ALARM1 0x41 -#define W83781D_REG_ALARM2 0x42 - -/* Real-time status (W83782D, W83783S, W83627HF) */ -#define W83782D_REG_ALARM1 0x459 -#define W83782D_REG_ALARM2 0x45A -#define W83782D_REG_ALARM3 0x45B - -/* Real-time status (W83791D) */ -#define W83791D_REG_ALARM1 0xA9 -#define W83791D_REG_ALARM2 0xAA -#define W83791D_REG_ALARM3 0xAB - -#define W83781D_REG_BEEP_CONFIG 0x4D -#define W83781D_REG_BEEP_INTS1 0x56 -#define W83781D_REG_BEEP_INTS2 0x57 -#define W83781D_REG_BEEP_INTS3 0x453 /* not on W83781D */ - -#define W83781D_REG_VID_FANDIV 0x47 - -#define W83781D_REG_CHIPID 0x49 -#define W83781D_REG_WCHIPID 0x58 -#define W83781D_REG_CHIPMAN 0x4F -#define W83781D_REG_PIN 0x4B - -/* 782D/783S/791D only */ -#define W83781D_REG_VBAT 0x5D - -/* PWM 782D (1-4) and 783S (1-2) only */ -#define W83781D_REG_PWM1 0x5B /* 782d and 783s/627hf datasheets disagree */ - /* on which is which; */ -#define W83781D_REG_PWM2 0x5A /* We follow the 782d convention here, */ - /* However 782d is probably wrong. */ -#define W83781D_REG_PWM3 0x5E -#define W83781D_REG_PWM4 0x5F -#define W83781D_REG_PWMCLK12 0x5C -#define W83781D_REG_PWMCLK34 0x45C - -#define W83791D_REG_PWM1 0x81 -#define W83791D_REG_PWM2 0x83 -#define W83791D_REG_PWM3 0x94 - -#define W83627HF_REG_PWM1 0x01 -#define W83627HF_REG_PWM2 0x03 -#define W83627HF_REG_PWMCLK1 0x00 -#define W83627HF_REG_PWMCLK2 0x02 - -static const u8 regpwm[] = { W83781D_REG_PWM1, W83781D_REG_PWM2, - W83781D_REG_PWM3, W83781D_REG_PWM4 -}; - -static const u8 regpwm_w83791d[] = { W83791D_REG_PWM1, W83791D_REG_PWM2, - W83791D_REG_PWM3 -}; - -#define W83781D_REG_PWM(type, nr) (((type) == w83791d) ? \ - regpwm_w83791d[(nr) - 1] : \ - regpwm[(nr) - 1]) - -#define W83781D_REG_I2C_ADDR 0x48 -#define W83781D_REG_I2C_SUBADDR 0x4A - -/* The following are undocumented in the data sheets however we - received the information in an email from Winbond tech support */ -/* Sensor selection - not on 781d */ -#define W83781D_REG_SCFG1 0x5D -static const u8 BIT_SCFG1[] = { 0x02, 0x04, 0x08 }; -#define W83781D_REG_SCFG2 0x59 -static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 }; -#define W83781D_DEFAULT_BETA 3435 - -/* RT Table registers */ -#define W83781D_REG_RT_IDX 0x50 -#define W83781D_REG_RT_VAL 0x51 - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255)) -#define IN_FROM_REG(val) (((val) * 16 + 5) / 10) - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, - 254); -} - -#define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==255?0:1350000/((val)*(div))) - -#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-5)/10):\ - ((val)+5)/10),0,255)) -#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*10) - -#define ALARMS_FROM_REG(val) (val) -#define PWM_FROM_REG(val) (val) -#define PWM_TO_REG(val) (SENSORS_LIMIT((val),0,255)) -#define BEEPS_FROM_REG(val,type) ((type)==as99127f?(val)^0x7FFF:(val)) -#define BEEPS_TO_REG(val,type) ((type)==as99127f?(~(val))&0x7FFF:(val)&0xffffff) - -#define BEEP_ENABLE_TO_REG(val) ((val)?1:0) -#define BEEP_ENABLE_FROM_REG(val) ((val)?1:0) - -#define DIV_FROM_REG(val) (1 << (val)) - -static inline u8 DIV_TO_REG(long val, enum chips type) -{ - int i; - val = SENSORS_LIMIT(val, 1, - ((type == w83781d || type == as99127f) ? 8 : 128)) >> 1; - for (i = 0; i < 7; i++) { - if (val == 0) - break; - val >>= 1; - } - return ((u8) i); -} - -/* There are some complications in a module like this. First off, W83781D chips - may be both present on the SMBus and the ISA bus, and we have to handle - those cases separately at some places. Second, there might be several - W83781D chips available (well, actually, that is probably never done; but - it is a clean illustration of how to handle a case like that). Finally, - a specific chip may be attached to *both* ISA and SMBus, and we would - not like to detect it double. Fortunately, in the case of the W83781D at - least, a register tells us what SMBus address we are on, so that helps - a bit - except if there could be more than one SMBus. Groan. No solution - for this yet. */ - -/* This module may seem overly long and complicated. In fact, it is not so - bad. Quite a lot of bookkeeping is done. A real driver can often cut - some corners. */ - -/* For each registered W83781D, we need to keep some data in memory. It is - dynamically allocated, at the same time when a new w83781d client is - allocated. */ -struct w83781d_data { - struct i2c_client client; - struct semaphore lock; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - struct i2c_client *lm75; /* for secondary I2C addresses */ - /* pointer to array of 2 subclients */ - - u8 in[10]; /* Register value - 8 & 9 for 782D and 791D only 10 for 791D */ - u8 in_max[10]; /* Register value - 8 & 9 for 782D and 791D only 10 for 791D */ - u8 in_min[10]; /* Register value - 8 & 9 for 782D and 791D only 10 for 791D */ - u8 fan[5]; /* Register value - 4 & 5 for 791D only */ - u8 fan_min[5]; /* Register value - 4 & 5 for 791D only */ - u8 temp; - u8 temp_over; /* Register value */ - u8 temp_hyst; /* Register value */ - u16 temp_add[2]; /* Register value */ - u16 temp_add_over[2]; /* Register value */ - u16 temp_add_hyst[2]; /* Register value */ - u8 fan_div[3]; /* Register encoding, shifted right */ - u8 vid; /* Register encoding, combined */ - u32 alarms; /* Register encoding, combined */ - u32 beeps; /* Register encoding, combined */ - u8 beep_enable; /* Boolean */ - u8 pwm[4]; /* Register value */ - u8 pwmenable[4]; /* bool */ - u16 sens[3]; /* 782D/783S only. - 1 = pentium diode; 2 = 3904 diode; - 3000-5000 = thermistor beta. - Default = 3435. - Other Betas unimplemented */ -#ifdef W83781D_RT - u8 rt[3][32]; /* Register value */ -#endif - u8 vrm; -}; - - -static int w83781d_attach_adapter(struct i2c_adapter *adapter); -static int w83781d_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int w83781d_detach_client(struct i2c_client *client); - -static int w83781d_read_value(struct i2c_client *client, u16 register); -static int w83781d_write_value(struct i2c_client *client, u16 register, - u16 value); -static void w83781d_update_client(struct i2c_client *client); -static void w83781d_init_client(struct i2c_client *client); - - -static void w83781d_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_temp_add(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_beep(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83781d_sens(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -#ifdef W83781D_RT -static void w83781d_rt(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -#endif - -static struct i2c_driver w83781d_driver = { - .name = "W83781D sensor driver", - .id = I2C_DRIVERID_W83781D, - .flags = I2C_DF_NOTIFY, - .attach_adapter = w83781d_attach_adapter, - .detach_client = w83781d_detach_client, -}; - -/* The /proc/sys entries */ -/* -- SENSORS SYSCTL START -- */ - -#define W83781D_SYSCTL_IN0 1000 /* Volts * 100 */ -#define W83781D_SYSCTL_IN1 1001 -#define W83781D_SYSCTL_IN2 1002 -#define W83781D_SYSCTL_IN3 1003 -#define W83781D_SYSCTL_IN4 1004 -#define W83781D_SYSCTL_IN5 1005 -#define W83781D_SYSCTL_IN6 1006 -#define W83781D_SYSCTL_IN7 1007 -#define W83781D_SYSCTL_IN8 1008 -#define W83781D_SYSCTL_IN9 1009 -#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */ -#define W83781D_SYSCTL_FAN2 1102 -#define W83781D_SYSCTL_FAN3 1103 -#define W83781D_SYSCTL_FAN4 1104 -#define W83781D_SYSCTL_FAN5 1105 - -#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_VID 1300 /* Volts * 1000 */ -#define W83781D_SYSCTL_VRM 1301 -#define W83781D_SYSCTL_PWM1 1401 -#define W83781D_SYSCTL_PWM2 1402 -#define W83781D_SYSCTL_PWM3 1403 -#define W83781D_SYSCTL_PWM4 1404 -#define W83781D_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ -#define W83781D_SYSCTL_SENS2 1502 -#define W83781D_SYSCTL_SENS3 1503 -#define W83781D_SYSCTL_RT1 1601 /* 32-entry table */ -#define W83781D_SYSCTL_RT2 1602 /* 32-entry table */ -#define W83781D_SYSCTL_RT3 1603 /* 32-entry table */ -#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */ -#define W83781D_SYSCTL_BEEP 2002 /* bitvector */ - -#define W83781D_ALARM_IN0 0x0001 -#define W83781D_ALARM_IN1 0x0002 -#define W83781D_ALARM_IN2 0x0004 -#define W83781D_ALARM_IN3 0x0008 -#define W83781D_ALARM_IN4 0x0100 -#define W83781D_ALARM_IN5 0x0200 -#define W83781D_ALARM_IN6 0x0400 -#define W83782D_ALARM_IN7 0x10000 -#define W83782D_ALARM_IN8 0x20000 -#define W83791D_ALARM_IN7 0x080000 /* 791D only */ -#define W83791D_ALARM_IN8 0x100000 /* 791D only */ -#define W83791D_ALARM_IN9 0x004000 /* 791D only */ -#define W83781D_ALARM_FAN1 0x0040 -#define W83781D_ALARM_FAN2 0x0080 -#define W83781D_ALARM_FAN3 0x0800 -#define W83791D_ALARM_FAN4 0x200000 /* 791D only */ -#define W83791D_ALARM_FAN5 0x400000 /* 791D only */ -#define W83781D_ALARM_TEMP1 0x0010 -#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */ -#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S/791D */ -#define W83781D_ALARM_TEMP3 0x2000 /* 782D/791D */ -#define W83781D_ALARM_CHAS 0x1000 /* 782D/791D */ - -#define W83791D_BEEP_IN1 0x002000 /* 791D only */ -#define W83791D_BEEP_IN7 0x010000 /* 791D only */ -#define W83791D_BEEP_IN8 0x020000 /* 791D only */ -#define W83791D_BEEP_TEMP3 0x000002 /* 791D only */ - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected chip. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ - -/* just a guess - no datasheet */ -static ctl_table as99127f_dir_table_template[] = { - {W83781D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp}, - {W83781D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vid}, - {W83781D_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vrm}, - {W83781D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan_div}, - {W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_alarms}, - {W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_beep}, - {0} -}; - -static ctl_table w83781d_dir_table_template[] = { - {W83781D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp}, - {W83781D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vid}, - {W83781D_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vrm}, - {W83781D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan_div}, - {W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_alarms}, - {W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_beep}, -#ifdef W83781D_RT - {W83781D_SYSCTL_RT1, "rt1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_rt}, - {W83781D_SYSCTL_RT2, "rt2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_rt}, - {W83781D_SYSCTL_RT3, "rt3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_rt}, -#endif - {0} -}; - -/* without pwm3-4 */ -static ctl_table w83782d_isa_dir_table_template[] = { - {W83781D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp}, - {W83781D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vid}, - {W83781D_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vrm}, - {W83781D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan_div}, - {W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_alarms}, - {W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_beep}, - {W83781D_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_SENS1, "sensor1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_sens}, - {W83781D_SYSCTL_SENS2, "sensor2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_sens}, - {W83781D_SYSCTL_SENS3, "sensor3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_sens}, - {0} -}; - -/* with pwm3-4 */ -static ctl_table w83782d_i2c_dir_table_template[] = { - {W83781D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp}, - {W83781D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vid}, - {W83781D_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vrm}, - {W83781D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan_div}, - {W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_alarms}, - {W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_beep}, - {W83781D_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_PWM4, "pwm4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_SENS1, "sensor1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_sens}, - {W83781D_SYSCTL_SENS2, "sensor2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_sens}, - {W83781D_SYSCTL_SENS3, "sensor3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_sens}, - {0} -}; - -/* w83791D has 10 voltages 5 fans and 3 temps. 2 of the temps are on other - devices. */ -static ctl_table w83791d_dir_table_template[] = { - {W83781D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN9, "in9", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN4, "fan4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN5, "fan5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp}, - {W83781D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vid}, - {W83781D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan_div}, - {W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_alarms}, - {W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_beep}, - {W83781D_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_PWM4, "pwm4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vrm}, - {0} -}; - -static ctl_table w83783s_dir_table_template[] = { - {W83781D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - /* no in1 to maintain compatibility with 781d and 782d. */ - {W83781D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_in}, - {W83781D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan}, - {W83781D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp}, - {W83781D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_temp_add}, - {W83781D_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vid}, - {W83781D_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_vrm}, - {W83781D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_fan_div}, - {W83781D_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_alarms}, - {W83781D_SYSCTL_BEEP, "beep", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_beep}, - {W83781D_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_pwm}, - {W83781D_SYSCTL_SENS1, "sensor1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_sens}, - {W83781D_SYSCTL_SENS2, "sensor2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83781d_sens}, - {0} -}; - - -/* This function is called when: - * w83781d_driver is inserted (when this module is loaded), for each - available adapter - * when a new adapter is inserted (and w83781d_driver is still present) */ -static int w83781d_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, w83781d_detect); -} - -static int w83781d_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i, val1 = 0, val2, id; - struct i2c_client *new_client; - struct w83781d_data *data; - int err = 0; - 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; - - if (is_isa) { - if (!request_region(address, W83781D_EXTENT, "w83781d")) - goto ERROR0; - release_region(address, W83781D_EXTENT); - } - - /* Probe whether there is anything available on this address. Already - done for SMBus clients */ - if (kind < 0) { - if (is_isa) { - -#define REALLY_SLOW_IO - /* We need the timeouts for at least some LM78-like chips. But only - if we read 'undefined' registers. */ - i = inb_p(address + 1); - if (inb_p(address + 2) != i) - goto ERROR0; - if (inb_p(address + 3) != i) - goto ERROR0; - if (inb_p(address + 7) != i) - goto ERROR0; -#undef REALLY_SLOW_IO - - /* Let's just hope nothing breaks here */ - i = inb_p(address + 5) & 0x7f; - outb_p(~i & 0x7f, address + 5); - if ((inb_p(address + 5) & 0x7f) != (~i & 0x7f)) { - outb_p(i, address + 5); - return 0; - } - } - } - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access w83781d_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct w83781d_data), GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - init_MUTEX(&data->lock); - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &w83781d_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - /* The w8378?d may be stuck in some other bank than bank 0. This may - make reading other information impossible. Specify a force=... or - force_*=... parameter, and the Winbond will be reset to the right - bank. */ - if (kind < 0) { - if (w83781d_read_value(new_client, W83781D_REG_CONFIG) & - 0x80) - goto ERROR1; - - val1 = w83781d_read_value(new_client, W83781D_REG_BANK); - val2 = w83781d_read_value(new_client, W83781D_REG_CHIPMAN); - /* Check for Winbond or Asus ID if in bank 0 */ - if ((!(val1 & 0x07)) && - (((!(val1 & 0x80)) && (val2 != 0xa3) && (val2 != 0xc3)) - || ((val1 & 0x80) && (val2 != 0x5c) && (val2 != 0x12)))) - goto ERROR1; - - /* If Winbond SMBus, check address at 0x48. - Asus doesn't support, except for the as99127f rev.2 */ - if ((!is_isa) && (((!(val1 & 0x80)) && (val2 == 0xa3)) || - ((val1 & 0x80) && (val2 == 0x5c)))) { - if (w83781d_read_value - (new_client, W83781D_REG_I2C_ADDR) != address) - goto ERROR1; - } - } - - /* We have either had a force parameter, or we have already detected the - 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) & 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; - - val1 = - w83781d_read_value(new_client, W83781D_REG_WCHIPID); - if ((val1 == 0x10 || val1 == 0x11) && vendid == winbond) - kind = w83781d; - else if (val1 == 0x30 && vendid == winbond) - kind = w83782d; - else if (val1 == 0x40 && vendid == winbond && !is_isa && address == 0x2d) - kind = w83783s; - else if (val1 == 0x21 && vendid == winbond) - kind = w83627hf; - else if (val1 == 0x71 && vendid == winbond && address >= 0x2c) - kind = w83791d; - else if (val1 == 0x31 && !is_isa && address >= 0x28) - kind = as99127f; - else { - if (kind == 0) - printk(KERN_WARNING "w83781d.o: Ignoring " - "'force' parameter for unknown chip " - "at adapter %d, address 0x%02x\n", - i2c_adapter_id(adapter), address); - goto ERROR1; - } - } - - if (kind == w83781d) { - type_name = "w83781d"; - client_name = "W83781D chip"; - } else if (kind == w83782d) { - type_name = "w83782d"; - client_name = "W83782D chip"; - } else if (kind == w83783s) { - type_name = "w83783s"; - client_name = "W83783S chip"; - } else if (kind == w83627hf) { - type_name = "w83627hf"; - client_name = "W83627HF chip"; - } else if (kind == as99127f) { - type_name = "as99127f"; - client_name = "AS99127F chip"; - } else if (kind == w83791d) { - type_name = "w83791d"; - client_name = "W83791D chip"; - } else { -#ifdef DEBUG - printk(KERN_ERR "w83781d.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - err = -ENODEV; - goto ERROR1; - } - - /* Reserve the ISA region */ - if (is_isa) - request_region(address, W83781D_EXTENT, type_name); - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto ERROR3; - - /* attach secondary i2c lm75-like clients */ - if (!is_isa) { - if (!(data->lm75 = kmalloc(2 * sizeof(struct i2c_client), - GFP_KERNEL))) { - err = -ENOMEM; - goto ERROR4; - } - id = i2c_adapter_id(adapter); - if(force_subclients[0] == id && force_subclients[1] == address) { - for(i = 2; i <= 3; i++) { - if(force_subclients[i] < 0x48 || - force_subclients[i] > 0x4f) { - printk(KERN_ERR "w83781d.o: Invalid subclient address %d; must be 0x48-0x4f\n", - force_subclients[i]); - goto ERROR5; - } - } - w83781d_write_value(new_client, - W83781D_REG_I2C_SUBADDR, - (force_subclients[2] & 0x07) | - ((force_subclients[3] & 0x07) <<4)); - data->lm75[0].addr = force_subclients[2]; - } else { - val1 = w83781d_read_value(new_client, - W83781D_REG_I2C_SUBADDR); - data->lm75[0].addr = 0x48 + (val1 & 0x07); - } - if (kind != w83783s) { - if(force_subclients[0] == id && - force_subclients[1] == address) { - data->lm75[1].addr = force_subclients[3]; - } else { - data->lm75[1].addr = 0x48 + ((val1 >> 4) & 0x07); - } - if(data->lm75[0].addr == data->lm75[1].addr) { - printk(KERN_ERR "w83781d.o: Duplicate addresses 0x%x for subclients.\n", - data->lm75[0].addr); - goto ERROR5; - } - } - if (kind == w83781d) - client_name = "W83781D subclient"; - else if (kind == w83782d) - client_name = "W83782D subclient"; - else if (kind == w83783s) - client_name = "W83783S subclient"; - else if (kind == w83627hf) - client_name = "W83627HF subclient"; - else if (kind == as99127f) - client_name = "AS99127F subclient"; - else if (kind == w83791d) - client_name = "W83791D subclient"; - - - for (i = 0; i <= 1; i++) { - data->lm75[i].data = NULL; /* store all data in w83781d */ - data->lm75[i].adapter = adapter; - data->lm75[i].driver = &w83781d_driver; - data->lm75[i].flags = 0; - strcpy(data->lm75[i].name, client_name); - if ((err = i2c_attach_client(&(data->lm75[i])))) { - printk(KERN_ERR "w83781d.o: Subclient %d registration at address 0x%x failed.\n", - i, data->lm75[i].addr); - if (i == 1) - goto ERROR6; - goto ERROR5; - } - if (kind == w83783s) - break; - } - } else { - data->lm75 = NULL; - } - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, - type_name, - (kind == as99127f) ? - as99127f_dir_table_template : - (kind == w83781d) ? - w83781d_dir_table_template : - (kind == w83783s) ? - w83783s_dir_table_template : - (kind == w83791d ) ? - w83791d_dir_table_template : - (is_isa || kind == w83627hf) ? - w83782d_isa_dir_table_template : - w83782d_i2c_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto ERROR7; - } - data->sysctl_id = i; - - /* Only PWM2 can be disabled */ - for(i = 0; i < 4; i++) - data->pwmenable[i] = 1; - - /* Initialize the chip */ - w83781d_init_client(new_client); - return 0; - -/* OK, this is not exactly good programming practice, usually. But it is - very code-efficient in this case. */ - - ERROR7: - if (!is_isa) - i2c_detach_client(& - (((struct - w83781d_data *) (new_client->data))-> - lm75[1])); - ERROR6: - if (!is_isa) - i2c_detach_client(& - (((struct - w83781d_data *) (new_client->data))-> - lm75[0])); - ERROR5: - if (!is_isa) - kfree(((struct w83781d_data *) (new_client->data))->lm75); - ERROR4: - i2c_detach_client(new_client); - ERROR3: - if (is_isa) - release_region(address, W83781D_EXTENT); - ERROR1: - kfree(data); - ERROR0: - return err; -} - -static int w83781d_detach_client(struct i2c_client *client) -{ - int err; - struct w83781d_data *data = client->data; - - i2c_deregister_entry(data->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - (KERN_ERR "w83781d.o: Client deregistration failed, client not detached.\n"); - return err; - } - - if(i2c_is_isa_client(client)) { - release_region(client->addr, W83781D_EXTENT); - } else { - i2c_detach_client(&(data->lm75[0])); - if (data->type != w83783s) - i2c_detach_client(&(data->lm75[1])); - kfree(data->lm75); - } - kfree(data); - - return 0; -} - -/* The SMBus locks itself, usually, but nothing may access the Winbond between - bank switches. ISA access must always be locked explicitly! - We ignore the W83781D BUSY flag at this moment - it could lead to deadlocks, - would slow down the W83781D access and should not be necessary. - There are some ugly typecasts here, but the good news is - they should - nowhere else be necessary! */ -static int w83781d_read_value(struct i2c_client *client, u16 reg) -{ - int res, word_sized, bank; - struct i2c_client *cl; - - down(&(((struct w83781d_data *) (client->data))->lock)); - if (i2c_is_isa_client(client)) { - word_sized = (((reg & 0xff00) == 0x100) - || ((reg & 0xff00) == 0x200)) - && (((reg & 0x00ff) == 0x50) - || ((reg & 0x00ff) == 0x53) - || ((reg & 0x00ff) == 0x55)); - if (reg & 0xff00) { - outb_p(W83781D_REG_BANK, - client->addr + W83781D_ADDR_REG_OFFSET); - outb_p(reg >> 8, - client->addr + W83781D_DATA_REG_OFFSET); - } - outb_p(reg & 0xff, client->addr + W83781D_ADDR_REG_OFFSET); - res = inb_p(client->addr + W83781D_DATA_REG_OFFSET); - if (word_sized) { - outb_p((reg & 0xff) + 1, - client->addr + W83781D_ADDR_REG_OFFSET); - res = - (res << 8) + inb_p(client->addr + - W83781D_DATA_REG_OFFSET); - } - if (reg & 0xff00) { - outb_p(W83781D_REG_BANK, - client->addr + W83781D_ADDR_REG_OFFSET); - outb_p(0, client->addr + W83781D_DATA_REG_OFFSET); - } - } else { - bank = (reg >> 8) & 0x0f; - if (bank > 2) - /* switch banks */ - i2c_smbus_write_byte_data(client, W83781D_REG_BANK, - bank); - if (bank == 0 || bank > 2) { - res = i2c_smbus_read_byte_data(client, reg & 0xff); - } else { - /* switch to subclient */ - cl = - &(((struct w83781d_data *) (client->data))-> - lm75[bank - 1]); - /* convert from ISA to LM75 I2C addresses */ - switch (reg & 0xff) { - case 0x50: /* TEMP */ - res = swab16(i2c_smbus_read_word_data(cl, 0)); - break; - case 0x52: /* CONFIG */ - res = i2c_smbus_read_byte_data(cl, 1); - break; - case 0x53: /* HYST */ - res = swab16(i2c_smbus_read_word_data(cl, 2)); - break; - case 0x55: /* OVER */ - default: - res = swab16(i2c_smbus_read_word_data(cl, 3)); - break; - } - } - if (bank > 2) - i2c_smbus_write_byte_data(client, W83781D_REG_BANK, - 0); - } - up(&(((struct w83781d_data *) (client->data))->lock)); - return res; -} - -static int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value) -{ - int word_sized, bank; - struct i2c_client *cl; - - down(&(((struct w83781d_data *) (client->data))->lock)); - if (i2c_is_isa_client(client)) { - word_sized = (((reg & 0xff00) == 0x100) - || ((reg & 0xff00) == 0x200)) - && (((reg & 0x00ff) == 0x53) - || ((reg & 0x00ff) == 0x55)); - if (reg & 0xff00) { - outb_p(W83781D_REG_BANK, - client->addr + W83781D_ADDR_REG_OFFSET); - outb_p(reg >> 8, - client->addr + W83781D_DATA_REG_OFFSET); - } - outb_p(reg & 0xff, client->addr + W83781D_ADDR_REG_OFFSET); - if (word_sized) { - outb_p(value >> 8, - client->addr + W83781D_DATA_REG_OFFSET); - outb_p((reg & 0xff) + 1, - client->addr + W83781D_ADDR_REG_OFFSET); - } - outb_p(value & 0xff, - client->addr + W83781D_DATA_REG_OFFSET); - if (reg & 0xff00) { - outb_p(W83781D_REG_BANK, - client->addr + W83781D_ADDR_REG_OFFSET); - outb_p(0, client->addr + W83781D_DATA_REG_OFFSET); - } - } else { - bank = (reg >> 8) & 0x0f; - if (bank > 2) - /* switch banks */ - i2c_smbus_write_byte_data(client, W83781D_REG_BANK, - bank); - if (bank == 0 || bank > 2) { - i2c_smbus_write_byte_data(client, reg & 0xff, - value & 0xff); - } else { - /* switch to subclient */ - cl = &(((struct w83781d_data *) (client->data))-> - lm75[bank - 1]); - /* convert from ISA to LM75 I2C addresses */ - switch (reg & 0xff) { - case 0x52: /* CONFIG */ - i2c_smbus_write_byte_data(cl, 1, value & 0xff); - break; - case 0x53: /* HYST */ - i2c_smbus_write_word_data(cl, 2, swab16(value)); - break; - case 0x55: /* OVER */ - i2c_smbus_write_word_data(cl, 3, swab16(value)); - break; - } - } - if (bank > 2) - i2c_smbus_write_byte_data(client, W83781D_REG_BANK, - 0); - } - up(&(((struct w83781d_data *) (client->data))->lock)); - return 0; -} - -/* Called when we have found a new W83781D. */ -static void w83781d_init_client(struct i2c_client *client) -{ - struct w83781d_data *data = client->data; - int i, p; - int type = data->type; - u8 tmp; - - if(init && type != as99127f) { /* this resets registers we don't have - documentation for on the as99127f */ - /* save these registers */ - i = w83781d_read_value(client, W83781D_REG_BEEP_CONFIG); - p = w83781d_read_value(client, W83781D_REG_PWMCLK12); - /* Reset all except Watchdog values and last conversion values - This sets fan-divs to 2, among others */ - w83781d_write_value(client, W83781D_REG_CONFIG, 0x80); - /* Restore the registers and disable power-on abnormal beep. - This saves FAN 1/2/3 input/output values set by BIOS. */ - w83781d_write_value(client, W83781D_REG_BEEP_CONFIG, i | 0x80); - w83781d_write_value(client, W83781D_REG_PWMCLK12, p); - /* Disable master beep-enable (reset turns it on). - Individual beeps should be reset to off but for some reason - disabling this bit helps some people not get beeped */ - w83781d_write_value(client, W83781D_REG_BEEP_INTS2, 0); - } - - data->vrm = (type == w83791d) ? 90 : 82; - - if ((type != w83781d) && (type != as99127f)) { - tmp = w83781d_read_value(client, W83781D_REG_SCFG1); - for (i = 1; i <= 3; i++) { - if (!(tmp & BIT_SCFG1[i - 1])) { - data->sens[i - 1] = W83781D_DEFAULT_BETA; - } else { - if (w83781d_read_value - (client, - W83781D_REG_SCFG2) & BIT_SCFG2[i - 1]) - data->sens[i - 1] = 1; - else - data->sens[i - 1] = 2; - } - if (type == w83783s && i == 2) - break; - } - } -#ifdef W83781D_RT -/* - Fill up the RT Tables. - We assume that they are 32 bytes long, in order for temp 1-3. - Data sheet documentation is sparse. - We also assume that it is only for the 781D although I suspect - that the others support it as well.... -*/ - - if (init && type == w83781d) { - u16 k = 0; -/* - Auto-indexing doesn't seem to work... - w83781d_write_value(client,W83781D_REG_RT_IDX,0); -*/ - for (i = 0; i < 3; i++) { - int j; - for (j = 0; j < 32; j++) { - w83781d_write_value(client, - W83781D_REG_RT_IDX, - k++); - data->rt[i][j] = - w83781d_read_value(client, - W83781D_REG_RT_VAL); - } - } - } -#endif /* W83781D_RT */ - - if (init && type != as99127f) { - w83781d_write_value(client, W83781D_REG_TEMP2_CONFIG, 0x00); - if (type != w83783s) { - w83781d_write_value(client, W83781D_REG_TEMP3_CONFIG, - 0x00); - } - } - - /* Start monitoring */ - w83781d_write_value(client, W83781D_REG_CONFIG, - (w83781d_read_value(client, - W83781D_REG_CONFIG) & 0xf7) - | 0x01); -} - -static void w83781d_update_client(struct i2c_client *client) -{ - struct w83781d_data *data = client->data; - int i; - - down(&data->update_lock); - - if (time_after(jiffies - data->last_updated, HZ + HZ / 2) || - time_before(jiffies, data->last_updated) || !data->valid) { - pr_debug(KERN_DEBUG "Starting device update\n"); - - for (i = 0; i <= 9; i++) { - if ((data->type == w83783s) - && (i == 1)) - continue; /* 783S has no in1 */ - if (data->type == w83791d) { - data->in[i] = - w83781d_read_value(client, W83791D_REG_IN(i)); - data->in_min[i] = - w83781d_read_value(client, - W83791D_REG_IN_MIN(i)); - data->in_max[i] = - w83781d_read_value(client, - W83791D_REG_IN_MAX(i)); - } else { - 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) - && (data->type != w83791d)) - break; - - if (data->type != w83791d && i == 8) - break; - } - for (i = 1; i <= 5; i++) { - data->fan[i - 1] = - w83781d_read_value(client, W83781D_REG_FAN(i)); - data->fan_min[i - 1] = - w83781d_read_value(client, - W83781D_REG_FAN_MIN(i)); - if (data->type != w83791d && i == 3) break; - } - if (data->type != w83781d && data->type != as99127f) { - for (i = 1; i <= 4; i++) { - data->pwm[i - 1] = - w83781d_read_value(client, - W83781D_REG_PWM(data->type, i)); - if (((data->type == w83783s) - || (data->type == w83627hf) - || ((data->type == w83782d) - && i2c_is_isa_client(client))) - && i == 2) - break; - } - /* Only PWM2 can be disabled */ - data->pwmenable[1] = (w83781d_read_value(client, - W83781D_REG_PWMCLK12) & 0x08) >> 3; - } - - data->temp = w83781d_read_value(client, W83781D_REG_TEMP); - data->temp_over = - w83781d_read_value(client, W83781D_REG_TEMP_OVER); - data->temp_hyst = - w83781d_read_value(client, W83781D_REG_TEMP_HYST); - data->temp_add[0] = - w83781d_read_value(client, W83781D_REG_TEMP2); - data->temp_add_over[0] = - w83781d_read_value(client, W83781D_REG_TEMP2_OVER); - data->temp_add_hyst[0] = - w83781d_read_value(client, W83781D_REG_TEMP2_HYST); - if (data->type != w83783s) { - data->temp_add[1] = - w83781d_read_value(client, W83781D_REG_TEMP3); - data->temp_add_over[1] = - w83781d_read_value(client, W83781D_REG_TEMP3_OVER); - data->temp_add_hyst[1] = - w83781d_read_value(client, W83781D_REG_TEMP3_HYST); - } - i = w83781d_read_value(client, W83781D_REG_VID_FANDIV); - data->vid = i & 0x0f; - data->vid |= (w83781d_read_value(client, - W83781D_REG_CHIPID) & 0x01) << 4; - data->fan_div[0] = (i >> 4) & 0x03; - data->fan_div[1] = (i >> 6) & 0x03; - data->fan_div[2] = (w83781d_read_value(client, - W83781D_REG_PIN) >> 6) & 0x03; - if ((data->type != w83781d) && (data->type != as99127f)) { - i = w83781d_read_value(client, W83781D_REG_VBAT); - data->fan_div[0] |= (i >> 3) & 0x04; - data->fan_div[1] |= (i >> 4) & 0x04; - data->fan_div[2] |= (i >> 5) & 0x04; - } - - if ((data->type == w83782d) || (data->type == w83627hf)) { - data->alarms = w83781d_read_value(client, - W83782D_REG_ALARM1) - | (w83781d_read_value(client, - W83782D_REG_ALARM2) << 8) - | (w83781d_read_value(client, - W83782D_REG_ALARM3) << 16); - } else if (data->type == w83783s) { - /* Only two real-time status registers */ - data->alarms = w83781d_read_value(client, - W83782D_REG_ALARM1) - | (w83781d_read_value(client, - W83782D_REG_ALARM2) << 8); - } else if (data->type == w83791d) { - data->alarms = w83781d_read_value(client, - W83791D_REG_ALARM1) - | (w83781d_read_value(client, - W83791D_REG_ALARM2) << 8) - | (w83781d_read_value(client, - W83791D_REG_ALARM3) << 16); - } else { - /* No real-time status registers, fall back to - interrupt status registers */ - data->alarms = w83781d_read_value(client, - W83781D_REG_ALARM1) - | (w83781d_read_value(client, - W83781D_REG_ALARM2) << 8); - } - - i = w83781d_read_value(client, W83781D_REG_BEEP_INTS2); - data->beep_enable = i >> 7; - data->beeps = ((i & 0x7f) << 8) + - w83781d_read_value(client, W83781D_REG_BEEP_INTS1); - if ((data->type != w83781d) && (data->type != as99127f) - && (data->type != w83791d)) { - data->beeps |= - w83781d_read_value(client, - W83781D_REG_BEEP_INTS3) << 16; - } - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ -static void w83781d_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - int nr = ctl_name - W83781D_SYSCTL_IN0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 2; - else if (operation == SENSORS_PROC_REAL_READ) { - w83781d_update_client(client); - results[0] = IN_FROM_REG(data->in_min[nr]); - results[1] = IN_FROM_REG(data->in_max[nr]); - results[2] = IN_FROM_REG(data->in[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->in_min[nr] = IN_TO_REG(results[0]); - w83781d_write_value(client, W83781D_REG_IN_MIN(nr), - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - data->in_max[nr] = IN_TO_REG(results[1]); - w83781d_write_value(client, W83781D_REG_IN_MAX(nr), - data->in_max[nr]); - } - } -} - -void w83781d_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - int nr = ctl_name - W83781D_SYSCTL_FAN1 + 1; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83781d_update_client(client); - results[0] = FAN_FROM_REG(data->fan_min[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - results[1] = FAN_FROM_REG(data->fan[nr - 1], - DIV_FROM_REG(data->fan_div[nr - 1])); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->fan_min[nr - 1] = - FAN_TO_REG(results[0], - DIV_FROM_REG(data->fan_div[nr-1])); - w83781d_write_value(client, - W83781D_REG_FAN_MIN(nr), - data->fan_min[nr - 1]); - } - } -} - -void w83781d_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - w83781d_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_over); - results[1] = TEMP_FROM_REG(data->temp_hyst); - results[2] = TEMP_FROM_REG(data->temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_over = TEMP_TO_REG(results[0]); - w83781d_write_value(client, W83781D_REG_TEMP_OVER, - data->temp_over); - } - if (*nrels_mag >= 2) { - data->temp_hyst = TEMP_TO_REG(results[1]); - w83781d_write_value(client, W83781D_REG_TEMP_HYST, - data->temp_hyst); - } - } -} - -void w83781d_temp_add(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - int nr = ctl_name - W83781D_SYSCTL_TEMP2; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - w83781d_update_client(client); - results[0] = LM75_TEMP_FROM_REG(data->temp_add_over[nr]); - results[1] = LM75_TEMP_FROM_REG(data->temp_add_hyst[nr]); - results[2] = LM75_TEMP_FROM_REG(data->temp_add[nr]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_add_over[nr] = - LM75_TEMP_TO_REG(results[0]); - w83781d_write_value(client, - nr ? W83781D_REG_TEMP3_OVER : - W83781D_REG_TEMP2_OVER, - data->temp_add_over[nr]); - } - if (*nrels_mag >= 2) { - data->temp_add_hyst[nr] = - LM75_TEMP_TO_REG(results[1]); - w83781d_write_value(client, - nr ? W83781D_REG_TEMP3_HYST : - W83781D_REG_TEMP2_HYST, - data->temp_add_hyst[nr]); - } - } -} - - -void w83781d_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - w83781d_update_client(client); - results[0] = vid_from_reg(data->vid, data->vrm); - *nrels_mag = 1; - } -} - -void w83781d_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) - data->vrm = results[0]; - } -} - -void w83781d_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83781d_update_client(client); - results[0] = ALARMS_FROM_REG(data->alarms); - *nrels_mag = 1; - } -} - -void w83781d_beep(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - int val; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83781d_update_client(client); - results[0] = BEEP_ENABLE_FROM_REG(data->beep_enable); - results[1] = BEEPS_FROM_REG(data->beeps, data->type); - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 2) { - data->beeps = BEEPS_TO_REG(results[1], data->type); - w83781d_write_value(client, W83781D_REG_BEEP_INTS1, - data->beeps & 0xff); - if ((data->type != w83781d) && - (data->type != as99127f)) { - w83781d_write_value(client, - W83781D_REG_BEEP_INTS3, - ((data-> beeps) >> 16) & - 0xff); - } - val = (data->beeps >> 8) & 0x7f; - } else if (*nrels_mag >= 1) - val = - w83781d_read_value(client, - W83781D_REG_BEEP_INTS2) & - 0x7f; - if (*nrels_mag >= 1) { - data->beep_enable = BEEP_ENABLE_TO_REG(results[0]); - w83781d_write_value(client, W83781D_REG_BEEP_INTS2, - val | data->beep_enable << 7); - } - } -} - -void w83781d_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - int old, old2, old3 = 0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83781d_update_client(client); - results[0] = DIV_FROM_REG(data->fan_div[0]); - results[1] = DIV_FROM_REG(data->fan_div[1]); - results[2] = DIV_FROM_REG(data->fan_div[2]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - old = w83781d_read_value(client, W83781D_REG_VID_FANDIV); - /* w83781d and as99127f don't have extended divisor bits */ - if ((data->type != w83781d) && data->type != as99127f) { - old3 = - w83781d_read_value(client, W83781D_REG_VBAT); - } - if (*nrels_mag >= 3) { - data->fan_div[2] = - DIV_TO_REG(results[2], data->type); - old2 = w83781d_read_value(client, W83781D_REG_PIN); - old2 = - (old2 & 0x3f) | ((data->fan_div[2] & 0x03) << 6); - w83781d_write_value(client, W83781D_REG_PIN, old2); - if ((data->type != w83781d) && - (data->type != as99127f)) { - old3 = - (old3 & 0x7f) | - ((data->fan_div[2] & 0x04) << 5); - } - } - if (*nrels_mag >= 2) { - data->fan_div[1] = - DIV_TO_REG(results[1], data->type); - old = - (old & 0x3f) | ((data->fan_div[1] & 0x03) << 6); - if ((data->type != w83781d) && - (data->type != as99127f)) { - old3 = - (old3 & 0xbf) | - ((data->fan_div[1] & 0x04) << 4); - } - } - if (*nrels_mag >= 1) { - data->fan_div[0] = - DIV_TO_REG(results[0], data->type); - old = - (old & 0xcf) | ((data->fan_div[0] & 0x03) << 4); - w83781d_write_value(client, W83781D_REG_VID_FANDIV, - old); - if ((data->type != w83781d) && - (data->type != as99127f)) { - old3 = - (old3 & 0xdf) | - ((data->fan_div[0] & 0x04) << 3); - w83781d_write_value(client, - W83781D_REG_VBAT, - old3); - } - } - } -} - -void w83781d_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - int nr = 1 + ctl_name - W83781D_SYSCTL_PWM1; - int j, k; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83781d_update_client(client); - results[0] = PWM_FROM_REG(data->pwm[nr - 1]); - results[1] = data->pwmenable[nr - 1]; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->pwm[nr - 1] = PWM_TO_REG(results[0]); - w83781d_write_value(client, - W83781D_REG_PWM(data->type, nr), - data->pwm[nr - 1]); - } - /* only PWM2 can be enabled/disabled */ - if (*nrels_mag >= 2 && nr == 2) { - j = w83781d_read_value(client, W83781D_REG_PWMCLK12); - k = w83781d_read_value(client, W83781D_REG_BEEP_CONFIG); - if(results[1]) { - if(!(j & 0x08)) - w83781d_write_value(client, - W83781D_REG_PWMCLK12, j | 0x08); - if(k & 0x10) - w83781d_write_value(client, - W83781D_REG_BEEP_CONFIG, k & 0xef); - data->pwmenable[1] = 1; - } else { - if(j & 0x08) - w83781d_write_value(client, - W83781D_REG_PWMCLK12, j & 0xf7); - if(!(k & 0x10)) - w83781d_write_value(client, - W83781D_REG_BEEP_CONFIG, j | 0x10); - data->pwmenable[1] = 0; - } - } - } -} - -void w83781d_sens(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - int nr = 1 + ctl_name - W83781D_SYSCTL_SENS1; - u8 tmp; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->sens[nr - 1]; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - switch (results[0]) { - case 1: /* PII/Celeron diode */ - tmp = w83781d_read_value(client, - W83781D_REG_SCFG1); - w83781d_write_value(client, - W83781D_REG_SCFG1, - tmp | BIT_SCFG1[nr - - 1]); - tmp = w83781d_read_value(client, - W83781D_REG_SCFG2); - w83781d_write_value(client, - W83781D_REG_SCFG2, - tmp | BIT_SCFG2[nr - - 1]); - data->sens[nr - 1] = results[0]; - break; - case 2: /* 3904 */ - tmp = w83781d_read_value(client, - W83781D_REG_SCFG1); - w83781d_write_value(client, - W83781D_REG_SCFG1, - tmp | BIT_SCFG1[nr - - 1]); - tmp = w83781d_read_value(client, - W83781D_REG_SCFG2); - w83781d_write_value(client, - W83781D_REG_SCFG2, - tmp & ~BIT_SCFG2[nr - - 1]); - data->sens[nr - 1] = results[0]; - break; - case W83781D_DEFAULT_BETA: /* thermistor */ - tmp = w83781d_read_value(client, - W83781D_REG_SCFG1); - w83781d_write_value(client, - W83781D_REG_SCFG1, - tmp & ~BIT_SCFG1[nr - - 1]); - data->sens[nr - 1] = results[0]; - break; - default: - printk - (KERN_ERR "w83781d.o: Invalid sensor type %ld; must be 1, 2, or %d\n", - results[0], W83781D_DEFAULT_BETA); - break; - } - } - } -} - -#ifdef W83781D_RT -static void w83781d_rt(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83781d_data *data = client->data; - int nr = 1 + ctl_name - W83781D_SYSCTL_RT1; - int i; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - for (i = 0; i < 32; i++) { - results[i] = data->rt[nr - 1][i]; - } - *nrels_mag = 32; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag > 32) - *nrels_mag = 32; - for (i = 0; i < *nrels_mag; i++) { - /* fixme: no bounds checking 0-255 */ - data->rt[nr - 1][i] = results[i]; - w83781d_write_value(client, W83781D_REG_RT_IDX, i); - w83781d_write_value(client, W83781D_REG_RT_VAL, - data->rt[nr - 1][i]); - } - } -} -#endif - -static int __init sm_w83781d_init(void) -{ - printk(KERN_INFO "w83781d.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&w83781d_driver); -} - -static void __exit sm_w83781d_exit(void) -{ - i2c_del_driver(&w83781d_driver); -} - - - -MODULE_AUTHOR("Frodo Looijaard , " - "Philip Edelbrock , " - "and Mark Studebaker "); -MODULE_DESCRIPTION("W83781D driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_w83781d_init); -module_exit(sm_w83781d_exit); diff --git a/kernel/chips/w83792d.c b/kernel/chips/w83792d.c deleted file mode 100644 index aa08572f..00000000 --- a/kernel/chips/w83792d.c +++ /dev/null @@ -1,1532 +0,0 @@ -/* - w83792d.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2004, 2005 Winbond Electronics Corp. - Chunhao Huang - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - Note: - 1. This driver is only for 2.4 kernel(2.4.10 or later), 2.6 kernel - need a different driver. - 2. This driver is only for Winbond W83792D C version device, there - are also some motherboards with B version W83792D device. The - calculation method to in6-in7(measured value, limits) is a little - different between C and B version. C or B version can be identified - by CR[0x49h]. - 3. The function of chassis open detection need further test. - 4. The function of vid and vrm has not been finished, because I'm NOT - very familiar with them. If someone can finish it, that's good, - then please delete this note 4. -*/ - -/* - Supports following chips: - - Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA - w83792d 9 7 3 3 0x7a 0x5ca3 yes no -*/ - -#include -#include -#include -#include -#include -#include "version.h" -#include "sensors_vid.h" - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { 0x2c, 0x2f, SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(w83792d); -SENSORS_MODULE_PARM(force_subclients, "List of subclient addresses: " \ - "{bus, clientaddr, subclientaddr1, subclientaddr2}"); - -static int init; -MODULE_PARM(init, "i"); -MODULE_PARM_DESC(init, "Set to one for chip initialization"); - -/* Enable/Disable w83792d debugging output */ -/* #define W83792D_DEBUG 1 */ - -/* Constants specified below */ -#define W83792D_REG_GPIO_EN 0x1A -#define W83792D_REG_CONFIG 0x40 -#define W83792D_REG_I2C_ADDR 0x48 -#define W83792D_REG_CHIPID 0x49 /* contains version ID: A/B/C */ -#define W83792D_REG_I2C_SUBADDR 0x4A -#define W83792D_REG_PIN 0x4B -#define W83792D_REG_IRQ 0x4C -#define W83792D_REG_BANK 0x4E -#define W83792D_REG_CHIPMAN 0x4F /* contains the vendor ID */ -#define W83792D_REG_WCHIPID 0x58 /* contains the chip ID */ -#define W83792D_REG_VID_IN_B 0x17 /* ctroll in0/in1 's limit modifiability */ - -static const u8 W83792D_REG_IN[9] = { - 0x20, /* Vcore A in DataSheet */ - 0x21, /* Vcore B in DataSheet */ - 0x22, /* VIN0 in DataSheet */ - 0x23, /* VIN1 in DataSheet */ - 0x24, /* VIN2 in DataSheet */ - 0x25, /* VIN3 in DataSheet */ - 0x26, /* 5VCC in DataSheet */ - 0xB0, /* 5VSB in DataSheet */ - 0xB1 /* VBAT in DataSheet */ -}; -#define W83792D_REG_LOW_BITS1 0x3E /* Low Bits I in DataSheet */ -#define W83792D_REG_LOW_BITS2 0x3F /* Low Bits II in DataSheet */ -static const u8 W83792D_REG_IN_MAX[9] = { - 0x2B, /* Vcore A High Limit in DataSheet */ - 0x2D, /* Vcore B High Limit in DataSheet */ - 0x2F, /* VIN0 High Limit in DataSheet */ - 0x31, /* VIN1 High Limit in DataSheet */ - 0x33, /* VIN2 High Limit in DataSheet */ - 0x35, /* VIN3 High Limit in DataSheet */ - 0x37, /* 5VCC High Limit in DataSheet */ - 0xB4, /* 5VSB High Limit in DataSheet */ - 0xB6 /* VBAT High Limit in DataSheet */ -}; -static const u8 W83792D_REG_IN_MIN[9] = { - 0x2C, /* Vcore A Low Limit in DataSheet */ - 0x2E, /* Vcore B Low Limit in DataSheet */ - 0x30, /* VIN0 Low Limit in DataSheet */ - 0x32, /* VIN1 Low Limit in DataSheet */ - 0x34, /* VIN2 Low Limit in DataSheet */ - 0x36, /* VIN3 Low Limit in DataSheet */ - 0x38, /* 5VCC Low Limit in DataSheet */ - 0xB5, /* 5VSB Low Limit in DataSheet */ - 0xB7 /* VBAT Low Limit in DataSheet */ -}; - -static const u8 W83792D_REG_FAN[7] = { - 0x28, /* FAN 1 Count in DataSheet */ - 0x29, /* FAN 2 Count in DataSheet */ - 0x2A, /* FAN 3 Count in DataSheet */ - 0xB8, /* FAN 4 Count in DataSheet */ - 0xB9, /* FAN 5 Count in DataSheet */ - 0xBA, /* FAN 6 Count in DataSheet */ - 0xBE /* FAN 7 Count in DataSheet */ -}; -static const u8 W83792D_REG_FAN_MIN[7] = { - 0x3B, /* FAN 1 Count Low Limit in DataSheet */ - 0x3C, /* FAN 2 Count Low Limit in DataSheet */ - 0x3D, /* FAN 3 Count Low Limit in DataSheet */ - 0xBB, /* FAN 4 Count Low Limit in DataSheet */ - 0xBC, /* FAN 5 Count Low Limit in DataSheet */ - 0xBD, /* FAN 6 Count Low Limit in DataSheet */ - 0xBF /* FAN 7 Count Low Limit in DataSheet */ -}; -#define W83792D_REG_FAN_CFG 0x84 /* FAN Configuration in DataSheet */ -static const u8 W83792D_REG_PWM[7] = { - 0x81, /* FAN 1 Duty Cycle, be used to control */ - 0x83, /* FAN 2 Duty Cycle, be used to control */ - 0x94, /* FAN 3 Duty Cycle, be used to control */ - 0xA3, /* FAN 4 Duty Cycle, be used to control */ - 0xA4, /* FAN 5 Duty Cycle, be used to control */ - 0xA5, /* FAN 6 Duty Cycle, be used to control */ - 0xA6 /* FAN 7 Duty Cycle, be used to control */ -}; - -#define W83792D_REG_TEMP1 0x27 /* TEMP 1 in DataSheet */ -#define W83792D_REG_TEMP1_OVER 0x39 /* TEMP 1 High Limit in DataSheet */ -#define W83792D_REG_TEMP1_HYST 0x3A /* TEMP 1 Low Limit in DataSheet */ -static const u8 W83792D_REG_TEMP_ADD[2][7] = { - { 0xC0, /* TEMP 2 in DataSheet */ - 0xC1, /* TEMP 2(0.5 deg) in DataSheet */ - 0xC5, /* TEMP 2 Over High part in DataSheet */ - 0xC6, /* TEMP 2 Over Low part in DataSheet */ - 0xC3, /* TEMP 2 Thyst High part in DataSheet */ - 0xC4, /* TEMP 2 Thyst Low part in DataSheet */ - 0xC2 }, /* TEMP 2 Config in DataSheet */ - { 0xC8, /* TEMP 3 in DataSheet */ - 0xC9, /* TEMP 3(0.5 deg) in DataSheet */ - 0xCD, /* TEMP 3 Over High part in DataSheet */ - 0xCE, /* TEMP 3 Over Low part in DataSheet */ - 0xCB, /* TEMP 3 Thyst High part in DataSheet */ - 0xCC, /* TEMP 3 Thyst Low part in DataSheet */ - 0xCA } /* TEMP 3 Config in DataSheet */ -}; - -static const u8 W83792D_REG_FAN_DIV[4] = { - 0x47, /* contains FAN2 and FAN1 Divisor */ - 0x5B, /* contains FAN4 and FAN3 Divisor */ - 0x5C, /* contains FAN6 and FAN5 Divisor */ - 0x9E /* contains FAN7 Divisor. */ -}; - -#define W83792D_REG_ALARM1 0xA9 /* realtime status register1 */ -#define W83792D_REG_ALARM2 0xAA /* realtime status register2 */ -#define W83792D_REG_ALARM3 0xAB /* realtime status register3 */ -#define W83792D_REG_CASE_OPEN 0x42 /* Bit 5: Case Open status bit */ -#define W83792D_REG_CASE_OPEN_CLR 0x44 /* Bit 7: Case Open CLR_CHS/Reset bit */ - -static const u8 W83792D_REG_THERMAL[3] = { - 0x85, /* SmartFanI: Fan1 target value */ - 0x86, /* SmartFanI: Fan2 target value */ - 0x96 /* SmartFanI: Fan3 target value */ -}; - -static const u8 W83792D_REG_FAN_TOL[3] = { - 0x87, /* (bit3-0)SmartFan Fan1 tolerance */ - 0x87, /* (bit7-4)SmartFan Fan2 tolerance */ - 0x97 /* (bit3-0)SmartFan Fan3 tolerance */ -}; - -static const u8 W83792D_REG_POINTS[3][4] = { - { 0x85, /* SmartFanII: Fan1 temp point 1 */ - 0xE3, /* SmartFanII: Fan1 temp point 2 */ - 0xE4, /* SmartFanII: Fan1 temp point 3 */ - 0xE5 }, /* SmartFanII: Fan1 temp point 4 */ - { 0x86, /* SmartFanII: Fan2 temp point 1 */ - 0xE6, /* SmartFanII: Fan2 temp point 2 */ - 0xE7, /* SmartFanII: Fan2 temp point 3 */ - 0xE8 }, /* SmartFanII: Fan2 temp point 4 */ - { 0x96, /* SmartFanII: Fan3 temp point 1 */ - 0xE9, /* SmartFanII: Fan3 temp point 2 */ - 0xEA, /* SmartFanII: Fan3 temp point 3 */ - 0xEB } /* SmartFanII: Fan3 temp point 4 */ -}; - -static const u8 W83792D_REG_LEVELS[3][4] = { - { 0x88, /* (bit3-0) SmartFanII: Fan1 Non-Stop */ - 0x88, /* (bit7-4) SmartFanII: Fan1 Level 1 */ - 0xE0, /* (bit7-4) SmartFanII: Fan1 Level 2 */ - 0xE0 }, /* (bit3-0) SmartFanII: Fan1 Level 3 */ - { 0x89, /* (bit3-0) SmartFanII: Fan2 Non-Stop */ - 0x89, /* (bit7-4) SmartFanII: Fan2 Level 1 */ - 0xE1, /* (bit7-4) SmartFanII: Fan2 Level 2 */ - 0xE1 }, /* (bit3-0) SmartFanII: Fan2 Level 3 */ - { 0x98, /* (bit3-0) SmartFanII: Fan3 Non-Stop */ - 0x98, /* (bit7-4) SmartFanII: Fan3 Level 1 */ - 0xE2, /* (bit7-4) SmartFanII: Fan3 Level 2 */ - 0xE2 } /* (bit3-0) SmartFanII: Fan3 Level 3 */ -}; - -static inline u8 FAN_TO_REG(long rpm, int div) -{ - if (rpm == 0) - return 255; - rpm = SENSORS_LIMIT(rpm, 1, 1000000); - return SENSORS_LIMIT(1350000/(rpm * div), 1, 254); -} - -#define IN_FROM_REG(nr,val) (((nr)<=1)?(val*2): \ - ((((nr)==6)||((nr)==7))?(val*6):(val*4))) -#define IN_TO_REG(nr,val) (((nr)<=1)?(val/2): \ - ((((nr)==6)||((nr)==7))?(val/6):(val/4))) -#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*10) -#define TEMP_TO_REG(val) (SENSORS_LIMIT((val>=0)?((val)/10):((val)/10+256), 0, 255)) -#define FAN_FROM_REG(val,div) ((val)==0?-1:(val)==255?0:1350000/((val)*(div))) -#define DIV_FROM_REG(val) (1 << (val)) - -#ifdef W83792D_DEBUG -#define ENTER() printk(KERN_DEBUG "w83792d: ENTERING %s, line: %d\n", __FUNCTION__, __LINE__); -#define LEAVE() printk(KERN_DEBUG "w83792d: LEAVING %s, line: %d\n", __FUNCTION__, __LINE__); -#else -#define ENTER() -#define LEAVE() -#endif - -struct w83792d_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - struct i2c_client *lm75[2]; /* for secondary I2C addresses */ - - u8 in[9]; /* Register value */ - u8 in_max[9]; /* Register value */ - u8 in_min[9]; /* Register value */ - u16 low_bits; /* Register value */ - u8 has_fan; /* Bit vector */ - u8 fan[7]; /* Register value */ - u8 fan_min[7]; /* Register value */ - u8 fan_cfg; /* Configure Fan Mode */ - u8 temp1[3]; /* Register value */ - u8 temp_add[2][7]; /* Register value */ - u8 fan_div[7]; /* Fan Divisor */ - /*u8 vid; Register encoding, combined */ - u8 pwm[7]; /* We only consider the first 3 set of pwm, - although 792 chip has 7 set of pwm. */ - u8 pwm_flag[7]; /* indicates PWM or DC mode: 1->PWM; 0->DC */ - /* u8 vrm; VRM version */ - u32 alarms; /* realtime status register encoding,combined */ - u8 chassis[2]; /* [0]->Chassis status, [1]->CLR_CHS */ - u8 thermal_cruise[3]; /* Smart FanI: Fan1,2,3 target value */ - u8 fan_tolerance[3]; /* Fan1,2,3 tolerance(Smart Fan I/II) */ - u8 sf2_points[3][4]; /* Smart FanII: Fan1,2,3 temperature points */ - u8 sf2_levels[3][4]; /* Smart FanII: Fan1,2,3 duty cycle levels */ -}; - -/* Read the w83792d register value, only use bank 0 of the 792 chip */ -static inline int -w83792d_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -/* Write value into the w83792d registers, only use bank 0 of the 792 chip */ -static inline int -w83792d_write_value(struct i2c_client *client, u8 reg, u8 value) -{ - return i2c_smbus_write_byte_data(client, reg, value); -} - -static int w83792d_attach_adapter(struct i2c_adapter *adapter); -static int w83792d_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static int w83792d_detach_client(struct i2c_client *client); - -static void w83792d_init_client(struct i2c_client *client); -static void w83792d_update_client(struct i2c_client *client); -#ifdef W83792D_DEBUG -static void w83792d_print_debug(struct w83792d_data *data); -#endif -static void w83792d_in(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_fan(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_temp_add(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -/*static void w83792d_vid(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_vrm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); */ -static void w83792d_set_fan_div(struct i2c_client *client, - int nr, u8 newdiv); -static void w83792d_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_chassis(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_pwm(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_pwm_flag(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_fan_cfg(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_thermal_cruise(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_fan_tolerance(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_sf2_points(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void w83792d_sf2_levels(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); - -static struct i2c_driver w83792d_driver = { - .name = "W83792D sensor driver", - .flags = I2C_DF_NOTIFY, - .attach_adapter = w83792d_attach_adapter, - .detach_client = w83792d_detach_client, -}; - -/* The /proc/sys entries */ -/* -- SENSORS SYSCTL START -- */ - -#define W83792D_SYSCTL_IN0 1000 -#define W83792D_SYSCTL_IN1 1001 -#define W83792D_SYSCTL_IN2 1002 -#define W83792D_SYSCTL_IN3 1003 -#define W83792D_SYSCTL_IN4 1004 -#define W83792D_SYSCTL_IN5 1005 -#define W83792D_SYSCTL_IN6 1006 -#define W83792D_SYSCTL_IN7 1007 -#define W83792D_SYSCTL_IN8 1008 -#define W83792D_SYSCTL_FAN1 1101 -#define W83792D_SYSCTL_FAN2 1102 -#define W83792D_SYSCTL_FAN3 1103 -#define W83792D_SYSCTL_FAN4 1104 -#define W83792D_SYSCTL_FAN5 1105 -#define W83792D_SYSCTL_FAN6 1106 -#define W83792D_SYSCTL_FAN7 1107 - -#define W83792D_SYSCTL_TEMP1 1200 -#define W83792D_SYSCTL_TEMP2 1201 -#define W83792D_SYSCTL_TEMP3 1202 -/*#define W83792D_SYSCTL_VID 1300 -#define W83792D_SYSCTL_VRM 1301*/ -#define W83792D_SYSCTL_PWM_FLAG 1400 -#define W83792D_SYSCTL_PWM1 1401 -#define W83792D_SYSCTL_PWM2 1402 -#define W83792D_SYSCTL_PWM3 1403 -#define W83792D_SYSCTL_FAN_CFG 1500 /* control Fan Mode */ -#define W83792D_SYSCTL_FAN_DIV 1501 -#define W83792D_SYSCTL_CHASSIS 1502 /* control Case Open */ -#define W83792D_SYSCTL_ALARMS 1503 - -#define W83792D_SYSCTL_THERMAL_CRUISE 1600 /* Smart Fan I: target value */ -#define W83792D_SYSCTL_FAN_TOLERANCE 1601 /* Smart Fan I/II: tolerance */ -#define W83792D_SYSCTL_SF2_POINTS_FAN1 1602 /* Smart Fan II: Fan1 points */ -#define W83792D_SYSCTL_SF2_POINTS_FAN2 1603 /* Smart Fan II: Fan2 points */ -#define W83792D_SYSCTL_SF2_POINTS_FAN3 1604 /* Smart Fan II: Fan3 points */ -#define W83792D_SYSCTL_SF2_LEVELS_FAN1 1605 /* Smart Fan II: Fan1 levels */ -#define W83792D_SYSCTL_SF2_LEVELS_FAN2 1606 /* Smart Fan II: Fan2 levels */ -#define W83792D_SYSCTL_SF2_LEVELS_FAN3 1607 /* Smart Fan II: Fan3 levels */ - -#define W83792D_ALARM_IN0 0x0001 -#define W83792D_ALARM_IN1 0x0002 -#define W83792D_ALARM_IN2 0x0100 -#define W83792D_ALARM_IN3 0x0200 -#define W83792D_ALARM_IN4 0x0400 -#define W83792D_ALARM_IN5 0x0800 -#define W83792D_ALARM_IN6 0x1000 -#define W83792D_ALARM_IN7 0x80000 -#define W83792D_ALARM_IN8 0x100000 -#define W83792D_ALARM_TEMP1 0x0004 -#define W83792D_ALARM_TEMP2 0x0008 -#define W83792D_ALARM_TEMP3 0x0010 -#define W83792D_ALARM_FAN1 0x0020 -#define W83792D_ALARM_FAN2 0x0040 -#define W83792D_ALARM_FAN3 0x0080 -#define W83792D_ALARM_FAN4 0x200000 -#define W83792D_ALARM_FAN5 0x400000 -#define W83792D_ALARM_FAN6 0x800000 -#define W83792D_ALARM_FAN7 0x8000 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for detected chip, - W83792D has 9 voltages 7 fans and 3 temperatures. */ -static ctl_table w83792d_dir_table_template[] = -{ - {W83792D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_in}, - {W83792D_SYSCTL_IN1, "in1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_in}, - {W83792D_SYSCTL_IN2, "in2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_in}, - {W83792D_SYSCTL_IN3, "in3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_in}, - {W83792D_SYSCTL_IN4, "in4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_in}, - {W83792D_SYSCTL_IN5, "in5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_in}, - {W83792D_SYSCTL_IN6, "in6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_in}, - {W83792D_SYSCTL_IN7, "in7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_in}, - {W83792D_SYSCTL_IN8, "in8", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_in}, - {W83792D_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_fan}, - {W83792D_SYSCTL_FAN2, "fan2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_fan}, - {W83792D_SYSCTL_FAN3, "fan3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_fan}, - {W83792D_SYSCTL_FAN4, "fan4", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_fan}, - {W83792D_SYSCTL_FAN5, "fan5", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_fan}, - {W83792D_SYSCTL_FAN6, "fan6", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_fan}, - {W83792D_SYSCTL_FAN7, "fan7", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_fan}, - {W83792D_SYSCTL_TEMP1, "temp1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_temp}, - {W83792D_SYSCTL_TEMP2, "temp2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_temp_add}, - {W83792D_SYSCTL_TEMP3, "temp3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_temp_add}, - /*{W83792D_SYSCTL_VID, "vid", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_vid}, */ - {W83792D_SYSCTL_FAN_DIV, "fan_div", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_fan_div}, - {W83792D_SYSCTL_ALARMS, "alarms", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_alarms}, - {W83792D_SYSCTL_CHASSIS, "chassis", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_chassis}, - {W83792D_SYSCTL_PWM1, "pwm1", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_pwm}, - {W83792D_SYSCTL_PWM2, "pwm2", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_pwm}, - {W83792D_SYSCTL_PWM3, "pwm3", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_pwm}, - {W83792D_SYSCTL_PWM_FLAG, "pwm_flag", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_pwm_flag}, - {W83792D_SYSCTL_FAN_CFG, "fan_cfg", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_fan_cfg}, - /*{W83792D_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &w83792d_vrm}, */ - {W83792D_SYSCTL_THERMAL_CRUISE, "thermal_cruise", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_thermal_cruise}, - {W83792D_SYSCTL_FAN_TOLERANCE, "fan_tolerance", NULL, 0, 0644, - NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_fan_tolerance}, - {W83792D_SYSCTL_SF2_POINTS_FAN1, "sf2_points_fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_sf2_points}, - {W83792D_SYSCTL_SF2_POINTS_FAN2, "sf2_points_fan2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_sf2_points}, - {W83792D_SYSCTL_SF2_POINTS_FAN3, "sf2_points_fan3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_sf2_points}, - {W83792D_SYSCTL_SF2_LEVELS_FAN1, "sf2_levels_fan1", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_sf2_levels}, - {W83792D_SYSCTL_SF2_LEVELS_FAN2, "sf2_levels_fan2", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_sf2_levels}, - {W83792D_SYSCTL_SF2_LEVELS_FAN3, "sf2_levels_fan3", NULL, 0, 0644, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83792d_sf2_levels}, - {0} -}; - -/* This function is called when: - * w83792d_driver is inserted (when this module is loaded), for each - available adapter - * when a new adapter is inserted (and w83792d_driver is still present) */ -static int w83792d_attach_adapter(struct i2c_adapter *adapter) -{ - int i_tmp; - ENTER() - i_tmp = i2c_detect(adapter, &addr_data, w83792d_detect); - LEAVE() - return i_tmp; -} - -static int -w83792d_create_subclient(struct i2c_adapter *adapter, - struct i2c_client *new_client, int addr, - struct i2c_client **sub_cli) -{ - int err; - struct i2c_client *sub_client; - - (*sub_cli) = sub_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); - if (!(sub_client)) { - return -ENOMEM; - } - memset(sub_client, 0x00, sizeof(struct i2c_client)); - sub_client->addr = 0x48 + addr; - sub_client->data = NULL; - sub_client->adapter = adapter; - sub_client->driver = &w83792d_driver; - sub_client->flags = 0; - strcpy(sub_client->name, "w83792d subclient"); - if ((err = i2c_attach_client(sub_client))) { - printk(KERN_ERR "w83792: subclient registration " - "at address 0x%x failed\n", sub_client->addr); - kfree(sub_client); - return err; - } - return 0; -} - -static int -w83792d_detect_subclients(struct i2c_adapter *adapter, int address, int kind, - struct i2c_client *new_client) -{ - int i, id, err; - u8 val; - struct w83792d_data *data = new_client->data; - - data->lm75[0] = NULL; - data->lm75[1] = NULL; - - id = i2c_adapter_id(adapter); - if (force_subclients[0] == id && force_subclients[1] == address) { - for (i = 2; i <= 3; i++) { - if (force_subclients[i] < 0x48 || - force_subclients[i] > 0x4f) { - printk(KERN_ERR "w83792d: invalid subclient " - "address %d; must be 0x48-0x4f\n", - force_subclients[i]); - err = -ENODEV; - goto ERROR_SC_0; - } - } - w83792d_write_value(new_client, W83792D_REG_I2C_SUBADDR, - (force_subclients[2] & 0x07) | - ((force_subclients[3] & 0x07) << 4)); - } - - val = w83792d_read_value(new_client, W83792D_REG_I2C_SUBADDR); - if (!(val & 0x08)) { - err = w83792d_create_subclient(adapter, new_client, val & 0x7, - &data->lm75[0]); - if (err < 0) - goto ERROR_SC_0; - } - if (!(val & 0x80)) { - if ((data->lm75[0] != NULL) && - ((val & 0x7) == ((val >> 4) & 0x7))) { - printk(KERN_ERR "w83792d: duplicate addresses 0x%x, " - "use force_subclient\n", data->lm75[0]->addr); - err = -ENODEV; - goto ERROR_SC_1; - } - err = w83792d_create_subclient(adapter, new_client, - (val >> 4) & 0x7, &data->lm75[1]); - if (err < 0) - goto ERROR_SC_1; - } - - return 0; - -/* Undo inits in case of errors */ - -ERROR_SC_1: - if (data->lm75[0] != NULL) { - i2c_detach_client(data->lm75[0]); - kfree(data->lm75[0]); - } -ERROR_SC_0: - return err; -} - - -static int w83792d_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i, val1 = 0, val2 = 0; - struct i2c_client *new_client; - struct w83792d_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - ENTER() - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { - LEAVE() - goto ERROR0; - } - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access w83792d_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct w83792d_data), GFP_KERNEL))) { - printk(KERN_ERR "w83792d: Out of memory in w83792d_detect (new_client).\n"); - err = -ENOMEM; - LEAVE() - goto ERROR0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &w83792d_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - if (kind < 0) { - if (w83792d_read_value(new_client, W83792D_REG_CONFIG)&0x80) { - LEAVE() - goto ERROR1; - } - val1 = w83792d_read_value(new_client, W83792D_REG_BANK); - val2 = w83792d_read_value(new_client, W83792D_REG_CHIPMAN); -#ifdef W83792D_DEBUG - printk(KERN_DEBUG "w83792d: val1 is: %d, val2 is: %d\n", - val1, val2); -#endif - /* Check for Winbond ID if in bank 0 */ - if (!(val1 & 0x07)) { /* is Bank0 */ - if (((!(val1 & 0x80)) && (val2 != 0xa3)) || - ((val1 & 0x80) && (val2 != 0x5c))) { - LEAVE() - goto ERROR1; - } - } - /* check address at 0x48. */ - if (w83792d_read_value(new_client, W83792D_REG_I2C_ADDR) - != address) { - LEAVE() - goto ERROR1; - } - } - - /* We have either had a force parameter, or we have already detected - the Winbond. Put it now into bank 0 and Vendor ID High Byte */ - w83792d_write_value(new_client, W83792D_REG_BANK, - (w83792d_read_value(new_client, - W83792D_REG_BANK) & 0x78) | - 0x80); - - /* Determine the chip type. */ - if (kind <= 0) { - /* get vendor ID */ - val2 = w83792d_read_value(new_client, W83792D_REG_CHIPMAN); - if (val2 != 0x5c) { /* the vendor is NOT Winbond */ - LEAVE() - goto ERROR1; - } - val1 = w83792d_read_value(new_client, W83792D_REG_WCHIPID); - if (val1 == 0x7a) { - kind = w83792d; - } else { - if (kind == 0) - printk(KERN_WARNING "w83792d: Ignoring " - "'force' parameter for unknown chip " - "at adapter %d, address 0x%02x\n", - i2c_adapter_id(adapter), address); - LEAVE() - goto ERROR1; - } - } - - if (kind == w83792d) { - type_name = "w83792d"; - client_name = "W83792D chip"; - } else { - printk(KERN_ERR "w83792d: Internal error: unknown kind (%d)?!?", - kind); - LEAVE() - goto ERROR1; - } - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - data->has_fan = 0x07; /* at least 3 fan inputs */ - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) { - LEAVE() - goto ERROR1; - } - - if ((err = w83792d_detect_subclients(adapter, address, - kind, new_client))) - goto ERROR2; - - /* Read GPIO enable register to check if pins for fan 4,5 are used as - GPIO */ - val1 = w83792d_read_value(new_client, W83792D_REG_GPIO_EN); - if (!(val1 & 0x40)) - data->has_fan |= 0x08; /* fan 4 */ - if (!(val1 & 0x20)) - data->has_fan |= 0x10; /* fan 5 */ - - val1 = w83792d_read_value(new_client, W83792D_REG_PIN); - if (val1 & 0x40) - data->has_fan |= 0x20; /* fan 6 */ - if (val1 & 0x04) - data->has_fan |= 0x40; /* fan 7 */ - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - w83792d_dir_table_template, THIS_MODULE)) < 0) { - err = i; - goto ERROR3; - } - data->sysctl_id = i; - - /* Initialize the chip */ - w83792d_init_client(new_client); - LEAVE() - return 0; - -ERROR3: - if (data->lm75[0] != NULL) { - i2c_detach_client(data->lm75[0]); - kfree(data->lm75[0]); - } - if (data->lm75[1] != NULL) { - i2c_detach_client(data->lm75[1]); - kfree(data->lm75[1]); - } -ERROR2: - i2c_detach_client(new_client); -ERROR1: - kfree(data); -ERROR0: - - LEAVE() - return err; -} - -static int w83792d_detach_client(struct i2c_client *client) -{ - int err; - struct w83792d_data *data = client->data; - ENTER() - - /* remove sysctl table (primary client only) */ - if ((data)) - i2c_deregister_entry(data->sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR "w83792d: Client deregistration failed, client not detached.\n"); - LEAVE() - return err; - } - - if (data) { - /* primary client */ - kfree(data); - } else { - /* subclients */ - kfree(client); - } - - return 0; -} - -/* Called when we have found a new W83792D. */ -static void w83792d_init_client(struct i2c_client *client) -{ - int temp2_cfg, temp3_cfg; - u8 vid_in_b; - - ENTER() - - if (init) { - w83792d_write_value(client, W83792D_REG_CONFIG, 0x80); - } - /* data->vrm = 90; */ /* maybe need to be modified! */ - - /* Clear the bit6 of W83792D_REG_VID_IN_B(set it into 0): - W83792D_REG_VID_IN_B bit6 = 0: the high/low limit of - vin0/vin1 can be modified by user; - W83792D_REG_VID_IN_B bit6 = 1: the high/low limit of - vin0/vin1 auto-updated, can NOT be modified by user. */ - vid_in_b = w83792d_read_value(client, W83792D_REG_VID_IN_B); - w83792d_write_value(client, W83792D_REG_VID_IN_B, - vid_in_b & 0xbf); - - temp2_cfg = w83792d_read_value(client, W83792D_REG_TEMP_ADD[0][6]); - temp3_cfg = w83792d_read_value(client, W83792D_REG_TEMP_ADD[1][6]); - w83792d_write_value(client, W83792D_REG_TEMP_ADD[0][6], - temp2_cfg & 0xe6); - w83792d_write_value(client, W83792D_REG_TEMP_ADD[1][6], - temp3_cfg & 0xe6); - - /* Start monitoring */ - w83792d_write_value(client, W83792D_REG_CONFIG, (w83792d_read_value( - client, W83792D_REG_CONFIG) & 0xf7) | 0x01); - LEAVE() -} - -static void w83792d_update_client(struct i2c_client *client) -{ - struct w83792d_data *data = client->data; - int i, j; - u8 reg_array_tmp[4], pwm_array_tmp[7], reg_tmp; - - down(&data->update_lock); - - if (time_after(jiffies - data->last_updated, HZ * 3) || - time_before(jiffies, data->last_updated) || !data->valid) { - pr_debug(KERN_DEBUG "Starting device update\n"); - - /* Update the voltages measured value and limits */ - for (i = 0; i < 9; i++) { - data->in[i] = w83792d_read_value(client, - W83792D_REG_IN[i]); - data->in_max[i] = w83792d_read_value(client, - W83792D_REG_IN_MAX[i]); - data->in_min[i] = w83792d_read_value(client, - W83792D_REG_IN_MIN[i]); - } - data->low_bits = w83792d_read_value(client, - W83792D_REG_LOW_BITS1) + - (w83792d_read_value(client, - W83792D_REG_LOW_BITS2) << 8); - - for (i = 0; i < 7; i++) { - /* Update the Fan measured value and limits */ - data->fan[i] = w83792d_read_value(client, - W83792D_REG_FAN[i]); - data->fan_min[i] = w83792d_read_value(client, - W83792D_REG_FAN_MIN[i]); - /* Update the PWM/DC Value and PWM/DC flag */ - pwm_array_tmp[i] = w83792d_read_value(client, - W83792D_REG_PWM[i]); - data->pwm[i] = pwm_array_tmp[i] & 0x0f; - data->pwm_flag[i] = pwm_array_tmp[i] >> 7; - } - data->fan_cfg = w83792d_read_value(client, W83792D_REG_FAN_CFG); - - /* Update the Fan Divisor */ - for (i = 0; i < 4; i++) { - reg_array_tmp[i] = w83792d_read_value(client, W83792D_REG_FAN_DIV[i]); - } - data->fan_div[0] = reg_array_tmp[0] & 0x07; - data->fan_div[1] = (reg_array_tmp[0] >> 4) & 0x07; - data->fan_div[2] = reg_array_tmp[1] & 0x07; - data->fan_div[3] = (reg_array_tmp[1] >> 4) & 0x07; - data->fan_div[4] = reg_array_tmp[2] & 0x07; - data->fan_div[5] = (reg_array_tmp[2] >> 4) & 0x07; - data->fan_div[6] = reg_array_tmp[3] & 0x07; - - for (i = 0; i < 7; i++) { - if (!(data->has_fan & (1 << i))) - continue; - if (data->fan[i] == 0xff && data->fan_div[i] < 7) - w83792d_set_fan_div(client, i, 7); - else if (data->fan[i] < 0x70 && data->fan_div[i] > 0) { - w83792d_set_fan_div(client, i, - data->fan_div[i] - 1); - } else if (data->fan[i] > 0xf8 && - data->fan_div[i] < 7) { - w83792d_set_fan_div(client, i, - data->fan_div[i] + 1); - } - } - - /* Update the Temperature1 measured value and limits */ - data->temp1[0] = w83792d_read_value(client, W83792D_REG_TEMP1); - data->temp1[1] = w83792d_read_value(client, W83792D_REG_TEMP1_OVER); - data->temp1[2] = w83792d_read_value(client, W83792D_REG_TEMP1_HYST); - - /* Update the Temperature2/3 measured value and limits */ - for (i = 0; i < 7; i++) { - data->temp_add[0][i] = w83792d_read_value(client, - W83792D_REG_TEMP_ADD[0][i]); - data->temp_add[1][i] = w83792d_read_value(client, - W83792D_REG_TEMP_ADD[1][i]); - } - - /* Update the VID */ - /* i = w83792d_read_value(client, W83792D_REG_FAN_DIV[0]); - data->vid = i & 0x0f; - data->vid |= - (w83792d_read_value(client, W83792D_REG_CHIPID) & 0x01) - << 4; */ - - /* Update the realtime status */ - data->alarms = w83792d_read_value(client, W83792D_REG_ALARM1) + - (w83792d_read_value(client, W83792D_REG_ALARM2) << 8) + - (w83792d_read_value(client, W83792D_REG_ALARM3) << 16); - - /* Update CaseOpen status and it's CLR_CHS. */ - data->chassis[0] = (w83792d_read_value(client, - W83792D_REG_CASE_OPEN) - >> 5) & 0x01; - data->chassis[1] = (w83792d_read_value(client, - W83792D_REG_CASE_OPEN_CLR) - >> 7) & 0x01; - - /* Update Thermal Cruise/Smart Fan I target value */ - for (i = 0; i < 3; i++) { - data->thermal_cruise[i] = - w83792d_read_value(client, - W83792D_REG_THERMAL[i]) & 0x7f; - } - - /* Update Smart Fan I/II tolerance */ - reg_tmp = w83792d_read_value(client, W83792D_REG_FAN_TOL[0]); - data->fan_tolerance[0] = reg_tmp & 0x0f; - data->fan_tolerance[1] = (reg_tmp >> 4) & 0x0f; - data->fan_tolerance[2] = - w83792d_read_value(client, W83792D_REG_FAN_TOL[2]) & 0x0f; - - /* Update Smart Fan II temperature points */ - for (i = 0; i < 3; i++) { - for (j = 0; j < 4; j++) { - data->sf2_points[i][j] = w83792d_read_value( - client,W83792D_REG_POINTS[i][j]) & 0x7f; - } - } - - /* Update Smart Fan II duty cycle levels */ - for (i = 0; i < 3; i++) { - reg_tmp = w83792d_read_value(client, - W83792D_REG_LEVELS[i][0]); - data->sf2_levels[i][0] = reg_tmp & 0x0f; - data->sf2_levels[i][1] = (reg_tmp >> 4) & 0x0f; - reg_tmp = w83792d_read_value(client, - W83792D_REG_LEVELS[i][2]); - data->sf2_levels[i][2] = (reg_tmp >> 4) & 0x0f; - data->sf2_levels[i][3] = reg_tmp & 0x0f; - } - data->last_updated = jiffies; - data->valid = 1; -#ifdef W83792D_DEBUG - w83792d_print_debug(data); -#endif - } - up(&data->update_lock); -} - -/* This is a function used to debug the message. */ -#ifdef W83792D_DEBUG -static void w83792d_print_debug(struct w83792d_data *data) -{ - int i=0, j=0; - printk(KERN_DEBUG "==========The following is the debug message...========\n"); - printk(KERN_DEBUG "9 set of Voltages: =====>\n"); - for (i=0; i<=8; i++) { - printk(KERN_DEBUG "vin[%d] is: 0x%x\n", i, data->in[i]); - printk(KERN_DEBUG "vin[%d] max is: 0x%x\n", i, data->in_max[i]); - printk(KERN_DEBUG "vin[%d] min is: 0x%x\n", i, data->in_min[i]); - } - printk(KERN_DEBUG "Low Bit1 is: 0x%x\n", data->low_bits & 0xff); - printk(KERN_DEBUG "Low Bit2 is: 0x%x\n", data->low_bits >> 8); - printk(KERN_DEBUG "7 set of Fan Counts and 3 set of Duty Cycles: =====>\n"); - printk(KERN_DEBUG "fan_cfg is: 0x%x\n", data->fan_cfg); - for (i=0; i<=6; i++) { - printk(KERN_DEBUG "fan[%d] is: 0x%x\n", i, data->fan[i]); - printk(KERN_DEBUG "fan[%d] min is: 0x%x\n", i, data->fan_min[i]); - if (i<3) { - printk(KERN_DEBUG "pwm[%d] is: 0x%x\n", i, data->pwm[i]); - printk(KERN_DEBUG "pwm_flag[%d] is: 0x%x\n", i, data->pwm_flag[i]); - } - } - printk(KERN_DEBUG "3 set of Temperatures: =====>\n"); - printk(KERN_DEBUG "temp1 is: 0x%x\n", data->temp1[0]); - printk(KERN_DEBUG "temp1 high limit is: 0x%x\n", data->temp1[1]); - printk(KERN_DEBUG "temp1 low limit is: 0x%x\n", data->temp1[2]); - for (i=0; i<2; i++) { - for (j=0; j<7; j++) { - printk(KERN_DEBUG "temp_add[%d][%d] is: 0x%x\n", i, j, - data->temp_add[i][j]); - } - } - for (i=0; i<=6; i++) { - printk(KERN_DEBUG "fan_div[%d] is: 0x%x\n", i, data->fan_div[i]); - } - printk(KERN_DEBUG "==========End of the debug message...==================\n\n"); -} -#endif - -/* The next few functions are the call-back functions of the /proc/sys and - sysctl files. Which function is used is defined in the ctl_table in - the extra1 field. - Each function must return the magnitude (power of 10 to divide the date - with) if it is called with operation==SENSORS_PROC_REAL_INFO. It must - put a maximum of *nrels elements in results reflecting the data of this - file, and set *nrels to the number it actually put in it, if operation== - SENSORS_PROC_REAL_READ. Finally, it must get upto *nrels elements from - results and write them to the chip, if operations==SENSORS_PROC_REAL_WRITE. - Note that on SENSORS_PROC_REAL_READ, I do not check whether results is - large enough (by checking the incoming value of *nrels). This is not very - good practice, but as long as you put less than about 5 values in results, - you can assume it is large enough. */ - -/* read/write voltage meaured value and limits */ -static void w83792d_in(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int nr = ctl_name - W83792D_SYSCTL_IN0; - - /* result[0]: low limit, result[1]: high limit, - result[2]: measured value */ - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - results[0] = IN_FROM_REG(nr, data->in_min[nr]*4); - results[1] = IN_FROM_REG(nr, data->in_max[nr]*4); - /* in7 and in8 do not have low bits, but the formula still - works */ - results[2] = IN_FROM_REG(nr, ((data->in[nr] << 2) | - ((data->low_bits >> (2 * nr)) - & 0x03))); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - /* Write Low limit into register. */ - data->in_min[nr] = SENSORS_LIMIT(IN_TO_REG(nr,results[0])/4, - 0, 255); - w83792d_write_value(client, W83792D_REG_IN_MIN[nr], - data->in_min[nr]); - } - if (*nrels_mag >= 2) { - /* Write High limit into register. */ - data->in_max[nr] = SENSORS_LIMIT(IN_TO_REG(nr,results[1])/4, - 0, 255); - w83792d_write_value(client, W83792D_REG_IN_MAX[nr], - data->in_max[nr]); - } - } -} - -static void w83792d_set_fan_div(struct i2c_client *client, int nr, u8 newdiv) -{ - struct w83792d_data *data = client->data; - int min, old; - u8 tmp; - - min = FAN_FROM_REG(data->fan_min[nr], DIV_FROM_REG(data->fan_div[nr])); - old = FAN_FROM_REG(data->fan[nr], DIV_FROM_REG(data->fan_div[nr])); - data->fan_div[nr] = newdiv; - tmp = w83792d_read_value(client, W83792D_REG_FAN_DIV[nr >> 1]); - tmp &= (nr & 1) ? 0x8f : 0xf8; - tmp |= (nr & 1) ? ((newdiv << 4) & 0x70) : (newdiv & 0x07); - w83792d_write_value(client, W83792D_REG_FAN_DIV[nr >> 1], tmp); - data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); - data->fan[nr] = FAN_TO_REG(old, DIV_FROM_REG(data->fan_div[nr])); - w83792d_write_value(client, W83792D_REG_FAN_MIN[nr], - data->fan_min[nr]); -} - -/* read/write fan meaured value and limits */ -static void w83792d_fan(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int nr = ctl_name - W83792D_SYSCTL_FAN1; - - /* result[0]: low limit, result[1]: measured value */ - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - if (data->has_fan & (1 << nr)) { - results[0] = FAN_FROM_REG(data->fan_min[nr], - DIV_FROM_REG(data->fan_div[nr])); - results[1] = FAN_FROM_REG(data->fan[nr], - DIV_FROM_REG(data->fan_div[nr])); - } else { - results[0] = 0; - results[1] = 0; - } - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1 && (data->has_fan & (1 << nr))) { - data->fan_min[nr] = FAN_TO_REG(results[0], - DIV_FROM_REG(data->fan_div[nr])); - w83792d_write_value(client, - W83792D_REG_FAN_MIN[nr], - data->fan_min[nr]); - } - } -} - -/* read/write temperature1 meaured value and limits */ -static void w83792d_temp(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - - /* result[0]: high limit, result[1]: low limit - result[2]: measured value, the order is different with voltage(in) */ - if (operation == SENSORS_PROC_REAL_INFO) { - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - results[0] = TEMP_FROM_REG(data->temp1[1]); - results[1] = TEMP_FROM_REG(data->temp1[2]); - results[2] = TEMP_FROM_REG(data->temp1[0]); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp1[1] = TEMP_TO_REG(results[0]); - w83792d_write_value(client, W83792D_REG_TEMP1_OVER, - data->temp1[1]); - } - if (*nrels_mag >= 2) { - data->temp1[2] = TEMP_TO_REG(results[1]); - w83792d_write_value(client, W83792D_REG_TEMP1_HYST, - data->temp1[2]); - } - } -} - -/* read/write temperature2,3 meaured value and limits */ -static void w83792d_temp_add(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int nr = ctl_name - W83792D_SYSCTL_TEMP2; - int i=0, j=0; - - /* result[0]: high limit, result[1]: low limit - result[2]: measured value, the order is different with voltage(in) */ - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - for (i=0; i<3; i++) { - j = (i==0) ? 2 : ((i==1)?0:1); - if ((data->temp_add[nr][i*2+1]) & 0x80) { - results[j] = TEMP_FROM_REG(data->temp_add[nr][i*2]) + 5; - } else { - results[j] = TEMP_FROM_REG(data->temp_add[nr][i*2]); - } - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->temp_add[nr][2] = TEMP_TO_REG(results[0]); - w83792d_write_value(client, - W83792D_REG_TEMP_ADD[nr][2], - data->temp_add[nr][2]); - if ((results[0]%10) == 0) { - w83792d_write_value(client, - W83792D_REG_TEMP_ADD[nr][3], 0x00); - } else { /* consider the 0.5 degree */ - w83792d_write_value(client, - W83792D_REG_TEMP_ADD[nr][3], 0x80); - } - } - if (*nrels_mag >= 2) { - data->temp_add[nr][4] = TEMP_TO_REG(results[1]); - w83792d_write_value(client, - W83792D_REG_TEMP_ADD[nr][4], - data->temp_add[nr][4]); - if ((results[1]%10) == 0) { - w83792d_write_value(client, - W83792D_REG_TEMP_ADD[nr][5], 0x00); - } else { /* consider the 0.5 degree */ - w83792d_write_value(client, - W83792D_REG_TEMP_ADD[nr][5], 0x80); - } - } - } -} - -/* -void w83792d_vid(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 3; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - results[0] = vid_from_reg(data->vid, data->vrm); - *nrels_mag = 1; - } -} - -void w83792d_vrm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 1; - else if (operation == SENSORS_PROC_REAL_READ) { - results[0] = data->vrm; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->vrm = results[0]; - } - } -} */ - -/* Read/Write Fan Divisor */ -static void w83792d_fan_div(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int i = 0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - for (i=0; i<7; i++) { - results[i] = DIV_FROM_REG(data->fan_div[i]); - } - *nrels_mag = 7; - } -} - - -/* Under Smart Fan I mode: read/write the Fan1/2/3 target temperature */ -static void w83792d_thermal_cruise(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int i=0; - u8 target_tmp=0, target_mask=0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - for (i=0; i<3; i++) { - results[i] = data->thermal_cruise[i]; - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - for (i=0; i<3; i++) { - if (*nrels_mag < (i+1)) { - return; - } - target_tmp = results[i]; - target_tmp = target_tmp & 0x7f; - target_mask = w83792d_read_value(client, - W83792D_REG_THERMAL[i]) & 0x80; - data->thermal_cruise[i] = SENSORS_LIMIT(target_tmp, 0, 255); - w83792d_write_value(client, W83792D_REG_THERMAL[i], - (data->thermal_cruise[i])|target_mask); - } - } -} - -/* The tolerance of fan1/fan2/fan3, when using Thermal Cruise(Smart Fan I) - or Smart Fan II mode. */ -static void w83792d_fan_tolerance(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int i=0; - u8 tol_tmp, tol_mask; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - for (i=0; i<3; i++) { - results[i] = data->fan_tolerance[i]; - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - for (i=0; i<3; i++) { - if (*nrels_mag < (i+1)) { - return; - } - tol_mask = w83792d_read_value(client, - W83792D_REG_FAN_TOL[i]) & ((i==1)?0x0f:0xf0); - tol_tmp = SENSORS_LIMIT(results[i], 0, 15); - tol_tmp &= 0x0f; - data->fan_tolerance[i] = tol_tmp; - if (i==1) { - tol_tmp <<= 4; - } - w83792d_write_value(client, W83792D_REG_FAN_TOL[i], - tol_mask|tol_tmp); - } - } -} - -/* Under Smart Fan II mode: read/write the Fan1/2/3 temperature points */ -static void w83792d_sf2_points(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int nr = ctl_name - W83792D_SYSCTL_SF2_POINTS_FAN1; - int j=0; - u8 mask_tmp = 0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - for (j=0; j<4; j++) { - results[j] = data->sf2_points[nr][j]; - } - *nrels_mag = 4; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - for (j=0; j<4; j++) { - if (*nrels_mag < (j+1)) { - return; - } - data->sf2_points[nr][j] = SENSORS_LIMIT(results[j], - 0, 127); - mask_tmp = w83792d_read_value(client, - W83792D_REG_POINTS[nr][j]) & 0x80; - w83792d_write_value(client, W83792D_REG_POINTS[nr][j], - mask_tmp|data->sf2_points[nr][j]); - } - } -} - -/* Smart Fan II Duty Cycle1/2/3 of Fan1/2/3. - Notice that: The Non-Stop can NOT be modified by user, - because it is related with some physical characters, - usually set by BIOS. User's modification to it may lead to - Fan's stop, then bring danger. */ -static void w83792d_sf2_levels(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int nr = ctl_name - W83792D_SYSCTL_SF2_LEVELS_FAN1; - int j = 0; - u8 mask_tmp = 0, level_tmp = 0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - for (j=0; j<4; j++) { - results[j] = (data->sf2_levels[nr][j] * 100) / 15; - } - *nrels_mag = 4; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - for (j=1; j<4; j++) { /* start with 1: need ignore Non-Stop */ - if (*nrels_mag < j) { - return; - } - data->sf2_levels[nr][j] = - SENSORS_LIMIT((results[j]*15)/100, 0, 15); - mask_tmp = w83792d_read_value(client, W83792D_REG_LEVELS[nr][j]) - & ((j==3) ? 0xf0 : 0x0f); - if (j==3) { - level_tmp = data->sf2_levels[nr][j]; - } else { - level_tmp = data->sf2_levels[nr][j] << 4; - } - w83792d_write_value(client, W83792D_REG_LEVELS[nr][j], - level_tmp | mask_tmp); - } - } -} - -/* get reatime status of all sensors items: voltage, temp, fan */ -static void w83792d_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - results[0] = data->alarms; - *nrels_mag = 1; - } -} - -/* Read/Write Chassis status and Reset Chassis. */ -static void w83792d_chassis(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - u8 temp1 = 0, temp2 = 0; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - results[0] = data->chassis[0]; - results[1] = data->chassis[1]; - *nrels_mag = 2; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - data->chassis[1] = SENSORS_LIMIT(results[1], 0 ,1); - temp1 = ((data->chassis[1]) << 7) & 0x80; - temp2 = w83792d_read_value(client, - W83792D_REG_CASE_OPEN_CLR) & 0x7f; - w83792d_write_value(client, - W83792D_REG_CASE_OPEN_CLR, - temp1|temp2); - } -} - -/* Read/Write PWM/DC value of Fan1,Fan2,Fan3, which controls the - Fan Duty Cycle */ -static void w83792d_pwm(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int nr = ctl_name - W83792D_SYSCTL_PWM1; - u8 pwm_mask; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - results[0] = data->pwm[nr] << 4; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - data->pwm[nr] = SENSORS_LIMIT(results[0], 0, 255) >> 4; - pwm_mask = w83792d_read_value(client,W83792D_REG_PWM[nr]) & 0xf0; - w83792d_write_value(client,W83792D_REG_PWM[nr],pwm_mask|data->pwm[nr]); - } -} - -/* Read/Write PWM/DC mode for Fan1,Fan2,Fan3: - 1->PWM mode, 0->DC mode */ -static void w83792d_pwm_flag(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - int i = 0; - u8 pwm_flag_mask; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - for (i=0; i<3; i++) { - results[i] = data->pwm_flag[i]; - } - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - for (i=0; i<3; i++) { - if (*nrels_mag < (i+1)) { - return; - } - data->pwm_flag[i] = SENSORS_LIMIT(results[i], 0, 1); - pwm_flag_mask = w83792d_read_value(client, - W83792D_REG_PWM[i]) & 0x7f; - w83792d_write_value(client, W83792D_REG_PWM[i], - ((data->pwm_flag[i])<<7)|pwm_flag_mask); - } - } -} - -/* Read/Write Fan mode into:PWM/DC, Thermal Cruise(SmartFanI), SmartFanII - 0->PWM/DC mode, 1->Thermal Cruise mode, 2/3->SmartFanII mode */ -static void w83792d_fan_cfg(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83792d_data *data = client->data; - u8 temp_cfg1, temp_cfg2, temp_cfg3, temp_cfg4; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - w83792d_update_client(client); - results[0] = (data->fan_cfg) & 0x03; /* Fan1's Mode */ - results[1] = ((data->fan_cfg)>>2) & 0x03; /* Fan2's Mode */ - results[2] = ((data->fan_cfg)>>4) & 0x03; /* Fan3's Mode */ - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag < 3) { - return; - } - temp_cfg1 = SENSORS_LIMIT(results[0], 0, 3); - temp_cfg2 = SENSORS_LIMIT(results[1], 0, 3) << 2; - temp_cfg3 = SENSORS_LIMIT(results[2], 0, 3) << 4; - temp_cfg4 = w83792d_read_value(client,W83792D_REG_FAN_CFG) & 0xc0; - data->fan_cfg = ((temp_cfg4|temp_cfg3)|temp_cfg2)|temp_cfg1; - w83792d_write_value(client,W83792D_REG_FAN_CFG,data->fan_cfg); - } -} - -static int __init sm_w83792d_init(void) -{ - ENTER() - - printk(KERN_INFO "w83792d version %s (%s)\n", LM_VERSION, LM_DATE); - - LEAVE() - return i2c_add_driver(&w83792d_driver); -} - -static void __exit sm_w83792d_exit(void) -{ - ENTER() - - i2c_del_driver(&w83792d_driver); - - LEAVE() -} - - -MODULE_AUTHOR("Chunhao Huang @ Winbond"); -MODULE_DESCRIPTION("W83792AD/D driver for linux-2.4"); -MODULE_LICENSE("GPL"); - -module_init(sm_w83792d_init); -module_exit(sm_w83792d_exit); - diff --git a/kernel/chips/w83l785ts.c b/kernel/chips/w83l785ts.c deleted file mode 100644 index f03d9fd4..00000000 --- a/kernel/chips/w83l785ts.c +++ /dev/null @@ -1,379 +0,0 @@ -/* - * w83l785ts.c - Part of lm_sensors, Linux kernel modules for hardware - * monitoring - * Copyright (C) 2003-2004 Jean Delvare - * - * Inspired from the lm83 driver. The W83L785TS-S is a sensor chip made - * by Winbond. It reports a single external temperature with a 1 deg - * resolution and a 3 deg accuracy. Data sheet can be obtained from - * Winbond's website at: - * http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83L785TS-S.pdf - * - * Thanks to James Bolt for benchmarking the read - * error handling mechanism. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include -#include -#include "version.h" - -#ifndef I2C_DRIVERID_W83L785TS -#define I2C_DRIVERID_W83L785TS 1047 -#endif - -/* How many retries on register read error */ -#define MAX_RETRIES 5 - -/* - * Address to scan - * Address is fully defined internally and cannot be changed. - */ - -static unsigned short normal_i2c[] = { 0x2e, SENSORS_I2C_END }; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* - * Insmod parameters - */ - -SENSORS_INSMOD_1(w83l785ts); - -/* - * The W83L785TS-S registers - * Manufacturer ID is 0x5CA3 for Winbond. - */ - -#define W83L785TS_REG_MAN_ID1 0x4D -#define W83L785TS_REG_MAN_ID2 0x4C -#define W83L785TS_REG_CHIP_ID 0x4E -#define W83L785TS_REG_CONFIG 0x40 -#define W83L785TS_REG_TYPE 0x52 -#define W83L785TS_REG_TEMP 0x27 -#define W83L785TS_REG_TEMP_OVER 0x53 /* not sure about this one */ - -/* - * Conversions - * The W83L785TS-S uses signed 8-bit values. - */ - -#define TEMP_FROM_REG(val) (val) - -/* - * Functions declaration - */ - -static int w83l785ts_attach_adapter(struct i2c_adapter *adapter); -static int w83l785ts_detect(struct i2c_adapter *adapter, int address, unsigned - short flags, int kind); -static int w83l785ts_detach_client(struct i2c_client *client); -static u8 w83l785ts_read_value(struct i2c_client *client, u8 reg, u8 defval); -static void w83l785ts_update_client(struct i2c_client *client); -static void w83l785ts_temp(struct i2c_client *client, int operation, int - ctl_name, int *nrels_mag, long *results); - -/* - * Driver data (common to all clients) - */ - -static struct i2c_driver w83l785ts_driver = { - .name = "W83L785S-S sensor driver", - .id = I2C_DRIVERID_W83L785TS, - .flags = I2C_DF_NOTIFY, - .attach_adapter = w83l785ts_attach_adapter, - .detach_client = w83l785ts_detach_client, -}; - -/* - * Client data (each client gets its own) - */ - -struct w83l785ts_data { - struct i2c_client client; - int sysctl_id; - - struct semaphore update_lock; - char valid; /* zero until following fields are valid */ - unsigned long last_updated; /* in jiffies */ - - /* registers values */ - s8 temp, temp_over; -}; - -/* - * Proc entries - * These files are created for each detected W83L785TS-S. - */ - -/* -- SENSORS SYSCTL START -- */ - -#define W83L785TS_SYSCTL_TEMP 1200 - -/* -- SENSORS SYSCTL END -- */ - - -static ctl_table w83l785ts_dir_table_template[] = -{ - {W83L785TS_SYSCTL_TEMP, "temp", NULL, 0, 0444, NULL, - &i2c_proc_real, &i2c_sysctl_real, NULL, &w83l785ts_temp}, - {0} -}; - -/* - * Real code - */ - -static int w83l785ts_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, w83l785ts_detect); -} - -/* - * The following function does more than just detection. If detection - * succeeds, it also registers the new chip. - */ -static int w83l785ts_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - struct i2c_client *new_client; - struct w83l785ts_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { -#ifdef DEBUG - printk(KERN_DEBUG "w83l785ts.o: I2C bus doesn't support " - "byte read mode, skipping.\n"); -#endif - return 0; - } - - if (!(data = kmalloc(sizeof(struct w83l785ts_data), GFP_KERNEL))) { - printk(KERN_ERR "w83l785ts.o: Out of memory in w83l785ts_detect " - "(new_client).\n"); - return -ENOMEM; - } - - /* - * The common I2C client data is placed right after the - * W83L785TS-specific. The W83L785TS-specific data is pointed to by the - * data field from the I2C client data. - */ - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &w83l785ts_driver; - new_client->flags = 0; - - /* - * Now we do the remaining detection. A negative kind means that - * the driver was loaded with no force parameter (default), so we - * must both detect and identify the chip (actually there is only - * one possible kind of chip for now, W83L785TS-S). A zero kind means - * that the driver was loaded with the force parameter, the detection - * step shall be skipped. A positive kind means that the driver - * was loaded with the force parameter and a given kind of chip is - * requested, so both the detection and the identification steps - * are skipped. - */ - - if (kind < 0) { /* detection */ - if (((w83l785ts_read_value(new_client, W83L785TS_REG_CONFIG, 0) - & 0x80) != 0x00) - || ((w83l785ts_read_value(new_client, W83L785TS_REG_TYPE, 0) - & 0xFC) != 0x00)) { -#ifdef DEBUG - printk(KERN_DEBUG "w83l785ts.o: Detection failed at " - "0x%02x.\n", address); -#endif - goto ERROR1; - } - } - - if (kind <= 0) { /* identification */ - u16 man_id; - u8 chip_id; - - man_id = (w83l785ts_read_value(new_client, W83L785TS_REG_MAN_ID1, 0) << 8) - + w83l785ts_read_value(new_client, W83L785TS_REG_MAN_ID2, 0); - chip_id = w83l785ts_read_value(new_client, W83L785TS_REG_CHIP_ID, 0); - if (man_id == 0x5CA3) { /* Winbond */ - if (chip_id == 0x70) - kind = w83l785ts; - } - } - - if (kind <= 0) { /* identification failed */ - printk(KERN_INFO "w83l785ts.o: Unsupported chip.\n"); - goto ERROR1; - } - - if (kind == w83l785ts) { - type_name = "w83l785ts"; - client_name = "W83L785TS-S chip"; - } else { - printk(KERN_ERR "w83l785ts.o: Unknown kind %d.\n", kind); - goto ERROR1; - } - - /* - * OK, we got a valid chip so we can fill in the remaining client - * fields. - */ - - strcpy(new_client->name, client_name); - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* - * Tell the I2C layer a new client has arrived. - */ - - if ((err = i2c_attach_client(new_client))) { -#ifdef DEBUG - printk(KERN_ERR "w83l785ts.o: Failed attaching client.\n"); -#endif - goto ERROR1; - } - - /* - * Register a new directory entry. - */ - - if ((err = i2c_register_entry(new_client, type_name, - w83l785ts_dir_table_template, THIS_MODULE)) < 0) { -#ifdef DEBUG - printk(KERN_ERR "w83l785ts.o: Failed registering directory " - "entry.\n"); -#endif - goto ERROR2; - } - data->sysctl_id = err; - - /* - * Initialize the W83L785TS chip - * Nothing yet, assume it is already started. - */ - - return 0; - - ERROR2: - i2c_detach_client(new_client); - ERROR1: - kfree(data); - return err; -} - -static int w83l785ts_detach_client(struct i2c_client *client) -{ - int err; - - i2c_deregister_entry(((struct w83l785ts_data *) (client->data))->sysctl_id); - if ((err = i2c_detach_client(client))) { - printk(KERN_ERR "w83l785ts.o: Client deregistration failed, " - "client not detached.\n"); - return err; - } - - kfree(client->data); - return 0; -} - -static u8 w83l785ts_read_value(struct i2c_client *client, u8 reg, u8 defval) -{ - int value, i; - - /* Frequent read errors have been reported on Asus boards, so we - * retry on read errors. If it still fails (unlikely), return the - * default value requested by the caller. */ - for (i = 1; i <= MAX_RETRIES; i++) { - value = i2c_smbus_read_byte_data(client, reg); - if (value >= 0) - return value; - printk(KERN_WARNING "w83l785ts.o: Read failed, will retry " - "in %d.\n", i); - mdelay(i); - } - - printk(KERN_ERR "w83l785ts.o: Couldn't read value from register. " - "Please report.\n"); - return defval; -} - -static void w83l785ts_update_client(struct i2c_client *client) -{ - struct w83l785ts_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ * 2) - || (jiffies < data->last_updated) - || !data->valid) { -#ifdef DEBUG - printk(KERN_DEBUG "w83l785ts.o: Updating data.\n"); -#endif - data->temp = w83l785ts_read_value(client, W83L785TS_REG_TEMP, - data->temp); - data->temp_over = w83l785ts_read_value(client, - W83L785TS_REG_TEMP_OVER, data->temp_over); - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -static void w83l785ts_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct w83l785ts_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) { - *nrels_mag = 0; /* magnitude */ - } else if (operation == SENSORS_PROC_REAL_READ) { - w83l785ts_update_client(client); - results[0] = TEMP_FROM_REG(data->temp_over); - results[1] = TEMP_FROM_REG(data->temp); - *nrels_mag = 2; - } -} - -static int __init sm_w83l785ts_init(void) -{ - printk(KERN_INFO "w83l785ts.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&w83l785ts_driver); -} - -static void __exit sm_w83l785ts_exit(void) -{ - i2c_del_driver(&w83l785ts_driver); -} - -MODULE_AUTHOR("Jean Delvare "); -MODULE_DESCRIPTION("W83L785TS-S sensor driver"); -MODULE_LICENSE("GPL"); - -module_init(sm_w83l785ts_init); -module_exit(sm_w83l785ts_exit); diff --git a/kernel/chips/xeontemp.c b/kernel/chips/xeontemp.c deleted file mode 100644 index df97c887..00000000 --- a/kernel/chips/xeontemp.c +++ /dev/null @@ -1,383 +0,0 @@ -/* - xeontemp.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999,2003 Frodo Looijaard , - Philip Edelbrock , and - Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* The Xeon temperature sensor looks just like an ADM1021 with the remote - sensor only. There is are no ID registers so detection is difficult. */ - -#include -#include -#include -#include -#include -#include "version.h" - -#ifndef I2C_DRIVERID_XEONTEMP -#define I2C_DRIVERID_XEONTEMP 1045 -#endif - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { 0x18, 0x1a, 0x29, 0x2b, - 0x4c, 0x4e, SENSORS_I2C_END -}; -static unsigned short normal_i2c_range[] = { SENSORS_I2C_END }; -static unsigned int normal_isa[] = { SENSORS_ISA_END }; -static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; - -/* Insmod parameters */ -SENSORS_INSMOD_1(xeontemp); - -/* xeontemp constants specified below */ - -/* The registers */ -/* Read-only */ -#define XEONTEMP_REG_REMOTE_TEMP 0x01 -#define XEONTEMP_REG_STATUS 0x02 -/* These use different addresses for reading/writing */ -#define XEONTEMP_REG_CONFIG_R 0x03 -#define XEONTEMP_REG_CONFIG_W 0x09 -#define XEONTEMP_REG_CONV_RATE_R 0x04 -#define XEONTEMP_REG_CONV_RATE_W 0x0A -/* limits */ -#define XEONTEMP_REG_REMOTE_TOS_R 0x07 -#define XEONTEMP_REG_REMOTE_TOS_W 0x0D -#define XEONTEMP_REG_REMOTE_THYST_R 0x08 -#define XEONTEMP_REG_REMOTE_THYST_W 0x0E -/* write-only */ -#define XEONTEMP_REG_ONESHOT 0x0F - -#define XEONTEMP_ALARM_RTEMP (XEONTEMP_ALARM_RTEMP_HIGH | XEONTEMP_ALARM_RTEMP_LOW\ - | XEONTEMP_ALARM_RTEMP_NA) -#define XEONTEMP_ALARM_ALL XEONTEMP_ALARM_RTEMP - -/* Conversions. Rounding and limit checking is only done on the TO_REG - variants. Note that you should be a bit careful with which arguments - these macros are called: arguments may be evaluated more than once. - Fixing this is just not worth it. */ -/* Conversions note: 1021 uses normal integer signed-byte format*/ -#define TEMP_FROM_REG(val) (val > 127 ? val-256 : val) -#define TEMP_TO_REG(val) (SENSORS_LIMIT((val < 0 ? val+256 : val),0,255)) - -/* Each client has this additional data */ -struct xeontemp_data { - struct i2c_client client; - int sysctl_id; - enum chips type; - - struct semaphore update_lock; - char valid; /* !=0 if following fields are valid */ - unsigned long last_updated; /* In jiffies */ - - u8 remote_temp, remote_temp_os, remote_temp_hyst, alarms; - u8 fail; -}; - -static int xeontemp_attach_adapter(struct i2c_adapter *adapter); -static int xeontemp_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind); -static void xeontemp_init_client(struct i2c_client *client); -static int xeontemp_detach_client(struct i2c_client *client); -static int xeontemp_read_value(struct i2c_client *client, u8 reg); -static int xeontemp_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask); -static int xeontemp_write_value(struct i2c_client *client, u8 reg, - u16 value); -static void xeontemp_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, - long *results); -static void xeontemp_alarms(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results); -static void xeontemp_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 xeontemp_driver = { - .name = "Xeon temp sensor driver", - .id = I2C_DRIVERID_XEONTEMP, - .flags = I2C_DF_NOTIFY, - .attach_adapter = xeontemp_attach_adapter, - .detach_client = xeontemp_detach_client, -}; - -/* -- SENSORS SYSCTL START -- */ - -#define XEONTEMP_SYSCTL_REMOTE_TEMP 1201 -#define XEONTEMP_SYSCTL_ALARMS 1203 - -#define XEONTEMP_ALARM_RTEMP_HIGH 0x10 -#define XEONTEMP_ALARM_RTEMP_LOW 0x08 -#define XEONTEMP_ALARM_RTEMP_NA 0x04 - -/* -- SENSORS SYSCTL END -- */ - -/* These files are created for each detected xeontemp. This is just a template; - though at first sight, you might think we could use a statically - allocated list, we need some way to get back to the parent - which - is done through one of the 'extra' fields which are initialized - when a new copy is allocated. */ -static ctl_table xeontemp_dir_table_template[] = { - {XEONTEMP_SYSCTL_REMOTE_TEMP, "temp", NULL, 0, 0644, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &xeontemp_remote_temp}, - {XEONTEMP_SYSCTL_ALARMS, "alarms", NULL, 0, 0444, NULL, &i2c_proc_real, - &i2c_sysctl_real, NULL, &xeontemp_alarms}, - {0} -}; - -static int xeontemp_attach_adapter(struct i2c_adapter *adapter) -{ - return i2c_detect(adapter, &addr_data, xeontemp_detect); -} - -static int xeontemp_detect(struct i2c_adapter *adapter, int address, - unsigned short flags, int kind) -{ - int i; - struct i2c_client *new_client; - struct xeontemp_data *data; - int err = 0; - const char *type_name = ""; - const char *client_name = ""; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - goto error0; - - /* OK. For now, we presume we have a valid client. We now create the - client structure, even though we cannot fill it completely yet. - But it allows us to access xeontemp_{read,write}_value. */ - - if (!(data = kmalloc(sizeof(struct xeontemp_data), GFP_KERNEL))) { - err = -ENOMEM; - goto error0; - } - - new_client = &data->client; - new_client->addr = address; - new_client->data = data; - new_client->adapter = adapter; - new_client->driver = &xeontemp_driver; - new_client->flags = 0; - - /* Now, we do the remaining detection. */ - - if (kind < 0) { - if ( - (xeontemp_read_value(new_client, XEONTEMP_REG_STATUS) & - 0x03) != 0x00) - goto error1; - } - - /* Determine the chip type. */ - - if (kind <= 0) { - kind = xeontemp; - } - - type_name = "xeontemp"; - client_name = "xeon sensors"; - - /* Fill in the remaining client fields and put it into the global list */ - strcpy(new_client->name, client_name); - data->type = kind; - data->valid = 0; - init_MUTEX(&data->update_lock); - - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(new_client))) - goto error3; - - /* Register a new directory entry with module sensors */ - if ((i = i2c_register_entry(new_client, type_name, - xeontemp_dir_table_template, - THIS_MODULE)) < 0) { - err = i; - goto error4; - } - data->sysctl_id = i; - - xeontemp_init_client(new_client); - return 0; - - error4: - i2c_detach_client(new_client); - error3: - error1: - kfree(data); - error0: - return err; -} - -static void xeontemp_init_client(struct i2c_client *client) -{ - /* Enable ADC and disable suspend mode */ - xeontemp_write_value(client, XEONTEMP_REG_CONFIG_W, 0); - /* Set Conversion rate to 1/sec (this can be tinkered with) */ - xeontemp_write_value(client, XEONTEMP_REG_CONV_RATE_W, 0x04); -} - -static int xeontemp_detach_client(struct i2c_client *client) -{ - - int err; - - i2c_deregister_entry(((struct xeontemp_data *) (client->data))-> - sysctl_id); - - if ((err = i2c_detach_client(client))) { - printk - ("xeontemp.o: Client deregistration failed, client not detached.\n"); - return err; - } - - kfree(client->data); - - return 0; - -} - - -/* All registers are byte-sized */ -static int xeontemp_read_value(struct i2c_client *client, u8 reg) -{ - return i2c_smbus_read_byte_data(client, reg); -} - -/* only update value if read succeeded; set fail bit if failed */ -static int xeontemp_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask) -{ - int i; - struct xeontemp_data *data = client->data; - - i = i2c_smbus_read_byte_data(client, reg); - if (i < 0) { - data->fail |= mask; - return i; - } - *val = i; - return 0; -} - -static int xeontemp_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); -} - -static void xeontemp_update_client(struct i2c_client *client) -{ - struct xeontemp_data *data = client->data; - - down(&data->update_lock); - - if ((jiffies - data->last_updated > HZ + HZ / 2) || - (jiffies < data->last_updated) || !data->valid) { - -#ifdef DEBUG - printk("Starting xeontemp update\n"); -#endif - - data->fail = 0; - xeontemp_rd_good(&(data->remote_temp), client, - XEONTEMP_REG_REMOTE_TEMP, XEONTEMP_ALARM_RTEMP); - xeontemp_rd_good(&(data->remote_temp_os), client, - XEONTEMP_REG_REMOTE_TOS_R, XEONTEMP_ALARM_RTEMP); - xeontemp_rd_good(&(data->remote_temp_hyst), client, - XEONTEMP_REG_REMOTE_THYST_R, - XEONTEMP_ALARM_RTEMP); - data->alarms = XEONTEMP_ALARM_ALL; - if (!xeontemp_rd_good(&(data->alarms), client, - XEONTEMP_REG_STATUS, 0)) - data->alarms &= XEONTEMP_ALARM_ALL; - data->last_updated = jiffies; - data->valid = 1; - } - - up(&data->update_lock); -} - -void xeontemp_remote_temp(struct i2c_client *client, int operation, - int ctl_name, int *nrels_mag, long *results) -{ - struct xeontemp_data *data = client->data; - - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - xeontemp_update_client(client); - results[0] = TEMP_FROM_REG(data->remote_temp_os); - results[1] = TEMP_FROM_REG(data->remote_temp_hyst); - results[2] = TEMP_FROM_REG(data->remote_temp); - *nrels_mag = 3; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - if (*nrels_mag >= 1) { - data->remote_temp_os = TEMP_TO_REG(results[0]); - xeontemp_write_value(client, - XEONTEMP_REG_REMOTE_TOS_W, - data->remote_temp_os); - } - if (*nrels_mag >= 2) { - data->remote_temp_hyst = TEMP_TO_REG(results[1]); - xeontemp_write_value(client, - XEONTEMP_REG_REMOTE_THYST_W, - data->remote_temp_hyst); - } - } -} - -void xeontemp_alarms(struct i2c_client *client, int operation, int ctl_name, - int *nrels_mag, long *results) -{ - struct xeontemp_data *data = client->data; - if (operation == SENSORS_PROC_REAL_INFO) - *nrels_mag = 0; - else if (operation == SENSORS_PROC_REAL_READ) { - xeontemp_update_client(client); - results[0] = data->alarms | data->fail; - *nrels_mag = 1; - } else if (operation == SENSORS_PROC_REAL_WRITE) { - /* Can't write to it */ - } -} - -static int __init sm_xeontemp_init(void) -{ - printk(KERN_INFO "xeontemp.o version %s (%s)\n", LM_VERSION, LM_DATE); - return i2c_add_driver(&xeontemp_driver); -} - -static void __exit sm_xeontemp_exit(void) -{ - i2c_del_driver(&xeontemp_driver); -} - -MODULE_AUTHOR - ("Frodo Looijaard and Philip Edelbrock "); -MODULE_DESCRIPTION("xeontemp driver"); -MODULE_LICENSE("GPL"); - -MODULE_PARM(read_only, "i"); -MODULE_PARM_DESC(read_only, "Don't set any values, read only mode"); - -module_init(sm_xeontemp_init) -module_exit(sm_xeontemp_exit) diff --git a/kernel/include/Module.mk b/kernel/include/Module.mk index e9702d0e..2f62f1ff 100644 --- a/kernel/include/Module.mk +++ b/kernel/include/Module.mk @@ -20,22 +20,9 @@ # verbatim in the rules, until it is redefined. MODULE_DIR := kernel/include KERNELINCLUDEDIR := $(MODULE_DIR) -KERNELCHIPSDIR := kernel/chips KERNELINCLUDEFILES := $(MODULE_DIR)/i2c-dev.h $(MODULE_DIR)/sensors.h -$(KERNELINCLUDEDIR)/sensors.h: $(KERNELINCLUDEDIR)/sensors.h.template - cat $@.template > $@ - $(AWK) '/SENSORS SYSCTL START/,/SENSORS SYSCTL END/' $(KERNELCHIPSDIR)/*.c >> $@ - echo '#endif' >> $@ - -$(KERNELINCLUDEDIR)/sensors.hd: - ( $(GREP) 'SENSORS SYSCTL START' /dev/null $(KERNELCHIPSDIR)/*.c | \ - $(SED) -e 's/:.*//' -e 's#^#$(KERNELINCLUDEDIR)/sensors.h: #' ) > $@ - -# Get dependencies of sensors.h -INCLUDEFILES += $(MODULE_DIR)/sensors.hd - REMOVEKERNELINC := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SYSINCLUDEDIR)/%,$(KERNELINCLUDEFILES)) install-all-kernel-include: @@ -50,8 +37,3 @@ user_uninstall:: $(RM) $(REMOVEKERNELINC) # Remove directory if empty, ignore failure $(RMDIR) $(DESTDIR)$(SYSINCLUDEDIR) 2> /dev/null || true - -clean-all-kernel-include: - $(RM) $(KERNELINCLUDEDIR)/*.h.install $(KERNELINCLUDEDIR)/sensors.h $(KERNELINCLUDEDIR)/sensors.hd - -clean :: clean-all-kernel-include diff --git a/kernel/include/ds1307.h b/kernel/include/ds1307.h deleted file mode 100644 index add9b123..00000000 --- a/kernel/include/ds1307.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef DS1307_H -#define DS1307_H - -/* - * linux/include/linux/ds1307.h - * - * Author: Abraham van der Merwe - * - * Linux support for the Dallas Semiconductor DS1307 Serial Real-Time - * Clock. - * - * Based on code from the lm-sensors project which is available - * at http://www.lm-sensors.org/ and Russell King's PCF8583 Real-Time - * Clock driver (linux/drivers/acorn/char/pcf8583.c). - * - * This source code is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - */ - -#include - -/* practically the same as struct rtc_time, but without tm_yday and tm_isdst */ -struct ds1307_date { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; -}; - -struct ds1307_memory { - u8 offset; /* 0 - 55 */ - u8 buf[56]; /* data */ - u8 length; /* offset + length <= 50 */ -}; - -/* size of the rtc non-volatile ram */ -#define DS1307_SIZE 56 - -/* the following frequencies are supported */ -#define DS1307_FREQ_1HZ 1 -#define DS1307_FREQ_4KHZ 4096 -#define DS1307_FREQ_8KHZ 8192 -#define DS1307_FREQ_32KHZ 32768 - -#define DS1307_GET_DATE _IOR ('d',0,struct ds1307_date *) -#define DS1307_SET_DATE _IOW ('d',1,struct ds1307_date *) -#define DS1307_IRQ_ON _IO ('d',2) -#define DS1307_IRQ_OFF _IO ('d',3) -#define DS1307_GET_FREQ _IOR ('d',4,u16 *) -#define DS1307_SET_FREQ _IOW ('d',5,u16 *) -#define DS1307_READ _IOR ('d',6,struct ds1307_memory *) -#define DS1307_WRITE _IOW ('d',7,struct ds1307_memory *) -#define DS1307_ENABLE _IO ('d',8) - -#endif /* #ifdef DS1307_H */ diff --git a/kernel/include/sensors.h b/kernel/include/sensors.h new file mode 100644 index 00000000..b077ae3f --- /dev/null +++ b/kernel/include/sensors.h @@ -0,0 +1,1608 @@ +/* + sensors.h - Part of lm_sensors, Linux kernel modules for hardware + monitoring + Copyright (c) 1998, 1999 Frodo Looijaard + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef LIB_SENSORS_H +#define LIB_SENSORS_H + +/* This file is intended to be included from userland utilities only. + * It used to be generated from kernel driver code, but the new sysfs + * standard interface makes these definitions obsolete. For now, we will be + * keeping the old defintions in this file, until all applications have + * been upgraded to the new model (dynamic discovery of chip features.) + */ + + +/* From linux/i2c-proc.h */ + +/* Sysctl IDs */ +#ifdef DEV_HWMON +#define DEV_SENSORS DEV_HWMON +#else /* ndef DEV_HWMOM */ +#define DEV_SENSORS 2 /* The id of the lm_sensors directory within the + dev table */ +#endif /* def DEV_HWMON */ + +/* The maximum length of the prefix */ +#define SENSORS_PREFIX_MAX 20 + +#define SENSORS_CHIPS 1 +struct i2c_chips_data { + int sysctl_id; + char name[SENSORS_PREFIX_MAX + 13]; +}; + + +/* -- SENSORS SYSCTL START -- */ + +#define ADM1021_SYSCTL_TEMP 1200 +#define ADM1021_SYSCTL_REMOTE_TEMP 1201 +#define ADM1021_SYSCTL_DIE_CODE 1202 +#define ADM1021_SYSCTL_ALARMS 1203 + +#define ADM1021_ALARM_TEMP_HIGH 0x40 +#define ADM1021_ALARM_TEMP_LOW 0x20 +#define ADM1021_ALARM_RTEMP_HIGH 0x10 +#define ADM1021_ALARM_RTEMP_LOW 0x08 +#define ADM1021_ALARM_RTEMP_NA 0x04 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define ADM1024_SYSCTL_IN0 1000 /* Volts * 100 */ +#define ADM1024_SYSCTL_IN1 1001 +#define ADM1024_SYSCTL_IN2 1002 +#define ADM1024_SYSCTL_IN3 1003 +#define ADM1024_SYSCTL_IN4 1004 +#define ADM1024_SYSCTL_IN5 1005 +#define ADM1024_SYSCTL_FAN1 1101 /* Rotations/min */ +#define ADM1024_SYSCTL_FAN2 1102 +#define ADM1024_SYSCTL_TEMP 1250 /* Degrees Celsius * 100 */ +#define ADM1024_SYSCTL_TEMP1 1290 /* Degrees Celsius */ +#define ADM1024_SYSCTL_TEMP2 1295 /* Degrees Celsius */ +#define ADM1024_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define ADM1024_SYSCTL_ALARMS 2001 /* bitvector */ +#define ADM1024_SYSCTL_ANALOG_OUT 2002 +#define ADM1024_SYSCTL_VID 2003 + +#define ADM1024_ALARM_IN0 0x0001 +#define ADM1024_ALARM_IN1 0x0002 +#define ADM1024_ALARM_IN2 0x0004 +#define ADM1024_ALARM_IN3 0x0008 +#define ADM1024_ALARM_IN4 0x0100 +#define ADM1024_ALARM_IN5 0x0200 +#define ADM1024_ALARM_FAN1 0x0040 +#define ADM1024_ALARM_FAN2 0x0080 +#define ADM1024_ALARM_TEMP 0x0010 +#define ADM1024_ALARM_TEMP1 0x0020 +#define ADM1024_ALARM_TEMP2 0x0001 +#define ADM1024_ALARM_CHAS 0x1000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define ADM1025_SYSCTL_IN0 1000 /* Volts * 100 */ +#define ADM1025_SYSCTL_IN1 1001 +#define ADM1025_SYSCTL_IN2 1002 +#define ADM1025_SYSCTL_IN3 1003 +#define ADM1025_SYSCTL_IN4 1004 +#define ADM1025_SYSCTL_IN5 1005 + +#define ADM1025_SYSCTL_RTEMP 1250 /* Degrees Celsius * 10 */ +#define ADM1025_SYSCTL_TEMP 1251 + +#define ADM1025_SYSCTL_ALARMS 2001 /* bitvector */ +#define ADM1025_SYSCTL_VID 2003 /* Volts * 1000 */ +#define ADM1025_SYSCTL_VRM 2004 + +#define ADM1025_ALARM_IN0 0x0001 +#define ADM1025_ALARM_IN1 0x0002 +#define ADM1025_ALARM_IN2 0x0004 +#define ADM1025_ALARM_IN3 0x0008 +#define ADM1025_ALARM_IN4 0x0100 +#define ADM1025_ALARM_IN5 0x0200 +#define ADM1025_ALARM_RTEMP 0x0020 +#define ADM1025_ALARM_TEMP 0x0010 +#define ADM1025_ALARM_RFAULT 0x4000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define ADM1026_SYSCTL_FAN0 1000 +#define ADM1026_SYSCTL_FAN1 1001 +#define ADM1026_SYSCTL_FAN2 1002 +#define ADM1026_SYSCTL_FAN3 1003 +#define ADM1026_SYSCTL_FAN4 1004 +#define ADM1026_SYSCTL_FAN5 1005 +#define ADM1026_SYSCTL_FAN6 1006 +#define ADM1026_SYSCTL_FAN7 1007 +#define ADM1026_SYSCTL_FAN_DIV 1008 +#define ADM1026_SYSCTL_GPIO 1009 +#define ADM1026_SYSCTL_GPIO_MASK 1010 +#define ADM1026_SYSCTL_ALARMS 1011 +#define ADM1026_SYSCTL_ALARM_MASK 1012 +#define ADM1026_SYSCTL_IN0 1013 +#define ADM1026_SYSCTL_IN1 1014 +#define ADM1026_SYSCTL_IN2 1015 +#define ADM1026_SYSCTL_IN3 1016 +#define ADM1026_SYSCTL_IN4 1017 +#define ADM1026_SYSCTL_IN5 1018 +#define ADM1026_SYSCTL_IN6 1019 +#define ADM1026_SYSCTL_IN7 1020 +#define ADM1026_SYSCTL_IN8 1021 +#define ADM1026_SYSCTL_IN9 1022 +#define ADM1026_SYSCTL_IN10 1023 +#define ADM1026_SYSCTL_IN11 1024 +#define ADM1026_SYSCTL_IN12 1025 +#define ADM1026_SYSCTL_IN13 1026 +#define ADM1026_SYSCTL_IN14 1027 +#define ADM1026_SYSCTL_IN15 1028 +#define ADM1026_SYSCTL_IN16 1029 +#define ADM1026_SYSCTL_PWM 1030 +#define ADM1026_SYSCTL_ANALOG_OUT 1031 +#define ADM1026_SYSCTL_AFC 1032 +#define ADM1026_SYSCTL_TEMP1 1033 +#define ADM1026_SYSCTL_TEMP2 1034 +#define ADM1026_SYSCTL_TEMP3 1035 +#define ADM1026_SYSCTL_TEMP_OFFSET1 1036 +#define ADM1026_SYSCTL_TEMP_OFFSET2 1037 +#define ADM1026_SYSCTL_TEMP_OFFSET3 1038 +#define ADM1026_SYSCTL_TEMP_THERM1 1039 +#define ADM1026_SYSCTL_TEMP_THERM2 1040 +#define ADM1026_SYSCTL_TEMP_THERM3 1041 +#define ADM1026_SYSCTL_TEMP_TMIN1 1042 +#define ADM1026_SYSCTL_TEMP_TMIN2 1043 +#define ADM1026_SYSCTL_TEMP_TMIN3 1044 +#define ADM1026_SYSCTL_VID 1045 +#define ADM1026_SYSCTL_VRM 1046 + +#define ADM1026_ALARM_TEMP2 (1L << 0) +#define ADM1026_ALARM_TEMP3 (1L << 1) +#define ADM1026_ALARM_IN9 (1L << 1) +#define ADM1026_ALARM_IN11 (1L << 2) +#define ADM1026_ALARM_IN12 (1L << 3) +#define ADM1026_ALARM_IN13 (1L << 4) +#define ADM1026_ALARM_IN14 (1L << 5) +#define ADM1026_ALARM_IN15 (1L << 6) +#define ADM1026_ALARM_IN16 (1L << 7) +#define ADM1026_ALARM_IN0 (1L << 8) +#define ADM1026_ALARM_IN1 (1L << 9) +#define ADM1026_ALARM_IN2 (1L << 10) +#define ADM1026_ALARM_IN3 (1L << 11) +#define ADM1026_ALARM_IN4 (1L << 12) +#define ADM1026_ALARM_IN5 (1L << 13) +#define ADM1026_ALARM_IN6 (1L << 14) +#define ADM1026_ALARM_IN7 (1L << 15) +#define ADM1026_ALARM_FAN0 (1L << 16) +#define ADM1026_ALARM_FAN1 (1L << 17) +#define ADM1026_ALARM_FAN2 (1L << 18) +#define ADM1026_ALARM_FAN3 (1L << 19) +#define ADM1026_ALARM_FAN4 (1L << 20) +#define ADM1026_ALARM_FAN5 (1L << 21) +#define ADM1026_ALARM_FAN6 (1L << 22) +#define ADM1026_ALARM_FAN7 (1L << 23) +#define ADM1026_ALARM_TEMP1 (1L << 24) +#define ADM1026_ALARM_IN10 (1L << 25) +#define ADM1026_ALARM_IN8 (1L << 26) +#define ADM1026_ALARM_THERM (1L << 27) +#define ADM1026_ALARM_AFC_FAN (1L << 28) +#define ADM1026_ALARM_UNUSED (1L << 29) +#define ADM1026_ALARM_CI (1L << 30) +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define ADM1031_SYSCTL_TEMP1 1200 +#define ADM1031_SYSCTL_TEMP2 1201 +#define ADM1031_SYSCTL_TEMP3 1202 + +#define ADM1031_SYSCTL_FAN1 1210 +#define ADM1031_SYSCTL_FAN2 1211 + +#define ADM1031_SYSCTL_FAN_DIV 1220 + +#define ADM1031_SYSCTL_ALARMS 1250 + +#define ADM1031_ALARM_FAN1_MIN 0x0001 +#define ADM1031_ALARM_FAN1_FLT 0x0002 +#define ADM1031_ALARM_TEMP2_HIGH 0x0004 +#define ADM1031_ALARM_TEMP2_LOW 0x0008 +#define ADM1031_ALARM_TEMP2_CRIT 0x0010 +#define ADM1031_ALARM_TEMP2_DIODE 0x0020 +#define ADM1031_ALARM_TEMP1_HIGH 0x0040 +#define ADM1031_ALARM_TEMP1_LOW 0x0080 +#define ADM1031_ALARM_FAN2_MIN 0x0100 +#define ADM1031_ALARM_FAN2_FLT 0x0200 +#define ADM1031_ALARM_TEMP3_HIGH 0x0400 +#define ADM1031_ALARM_TEMP3_LOW 0x0800 +#define ADM1031_ALARM_TEMP3_CRIT 0x1000 +#define ADM1031_ALARM_TEMP3_DIODE 0x2000 +#define ADM1031_ALARM_TEMP1_CRIT 0x4000 +#define ADM1031_ALARM_THERMAL 0x8000 + + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define ADM9240_SYSCTL_IN0 1000 /* Volts * 100 */ +#define ADM9240_SYSCTL_IN1 1001 +#define ADM9240_SYSCTL_IN2 1002 +#define ADM9240_SYSCTL_IN3 1003 +#define ADM9240_SYSCTL_IN4 1004 +#define ADM9240_SYSCTL_IN5 1005 +#define ADM9240_SYSCTL_FAN1 1101 /* Rotations/min */ +#define ADM9240_SYSCTL_FAN2 1102 +#define ADM9240_SYSCTL_TEMP 1250 /* Degrees Celsius * 100 */ +#define ADM9240_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define ADM9240_SYSCTL_ALARMS 2001 /* bitvector */ +#define ADM9240_SYSCTL_ANALOG_OUT 2002 +#define ADM9240_SYSCTL_VID 2003 + +#define ADM9240_ALARM_IN0 0x0001 +#define ADM9240_ALARM_IN1 0x0002 +#define ADM9240_ALARM_IN2 0x0004 +#define ADM9240_ALARM_IN3 0x0008 +#define ADM9240_ALARM_IN4 0x0100 +#define ADM9240_ALARM_IN5 0x0200 +#define ADM9240_ALARM_FAN1 0x0040 +#define ADM9240_ALARM_FAN2 0x0080 +#define ADM9240_ALARM_TEMP 0x0010 +#define ADM9240_ALARM_CHAS 0x1000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define ASB100_SYSCTL_IN0 1000 /* Volts * 100 */ +#define ASB100_SYSCTL_IN1 1001 +#define ASB100_SYSCTL_IN2 1002 +#define ASB100_SYSCTL_IN3 1003 +#define ASB100_SYSCTL_IN4 1004 +#define ASB100_SYSCTL_IN5 1005 +#define ASB100_SYSCTL_IN6 1006 + +#define ASB100_SYSCTL_FAN1 1101 /* Rotations/min */ +#define ASB100_SYSCTL_FAN2 1102 +#define ASB100_SYSCTL_FAN3 1103 + +#define ASB100_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ +#define ASB100_SYSCTL_TEMP2 1201 +#define ASB100_SYSCTL_TEMP3 1202 +#define ASB100_SYSCTL_TEMP4 1203 + +#define ASB100_SYSCTL_VID 1300 /* Volts * 1000 */ +#define ASB100_SYSCTL_VRM 1301 + +#define ASB100_SYSCTL_PWM1 1401 /* 0-255 => 0-100% duty cycle */ + +#define ASB100_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define ASB100_SYSCTL_ALARMS 2001 /* bitvector */ + +#define ASB100_ALARM_IN0 0x0001 /* ? */ +#define ASB100_ALARM_IN1 0x0002 /* ? */ +#define ASB100_ALARM_IN2 0x0004 +#define ASB100_ALARM_IN3 0x0008 +#define ASB100_ALARM_TEMP1 0x0010 +#define ASB100_ALARM_TEMP2 0x0020 +#define ASB100_ALARM_FAN1 0x0040 +#define ASB100_ALARM_FAN2 0x0080 +#define ASB100_ALARM_IN4 0x0100 +#define ASB100_ALARM_IN5 0x0200 /* ? */ +#define ASB100_ALARM_IN6 0x0400 /* ? */ +#define ASB100_ALARM_FAN3 0x0800 +#define ASB100_ALARM_CHAS 0x1000 +#define ASB100_ALARM_TEMP3 0x2000 + +#define ASB100_ALARM_IN7 0x10000 /* ? */ +#define ASB100_ALARM_IN8 0x20000 /* ? */ + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define BMC_SYSCTL_IN1 1000 +#define BMC_SYSCTL_TEMP1 1100 +#define BMC_SYSCTL_CURR1 1200 +#define BMC_SYSCTL_FAN1 1300 +#define BMC_SYSCTL_ALARMS 5000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define BT869_SYSCTL_STATUS 1000 +#define BT869_SYSCTL_NTSC 1001 +#define BT869_SYSCTL_HALF 1002 +#define BT869_SYSCTL_RES 1003 +#define BT869_SYSCTL_COLORBARS 1004 +#define BT869_SYSCTL_DEPTH 1005 +#define BT869_SYSCTL_SVIDEO 1006 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define DDCMON_SYSCTL_ID 1010 +#define DDCMON_SYSCTL_SIZE 1011 +#define DDCMON_SYSCTL_SYNC 1012 +#define DDCMON_SYSCTL_TIMINGS 1013 +#define DDCMON_SYSCTL_SERIAL 1014 +#define DDCMON_SYSCTL_TIME 1015 +#define DDCMON_SYSCTL_EDID 1016 +#define DDCMON_SYSCTL_GAMMA 1017 +#define DDCMON_SYSCTL_DPMS 1018 +#define DDCMON_SYSCTL_TIMING1 1021 +#define DDCMON_SYSCTL_TIMING2 1022 +#define DDCMON_SYSCTL_TIMING3 1023 +#define DDCMON_SYSCTL_TIMING4 1024 +#define DDCMON_SYSCTL_TIMING5 1025 +#define DDCMON_SYSCTL_TIMING6 1026 +#define DDCMON_SYSCTL_TIMING7 1027 +#define DDCMON_SYSCTL_TIMING8 1028 +#define DDCMON_SYSCTL_MAXCLOCK 1029 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define DS1621_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ +#define DS1621_SYSCTL_ALARMS 2001 /* bitvector */ +#define DS1621_ALARM_TEMP_HIGH 0x40 +#define DS1621_ALARM_TEMP_LOW 0x20 +#define DS1621_SYSCTL_ENABLE 2002 +#define DS1621_SYSCTL_CONTINUOUS 2003 +#define DS1621_SYSCTL_POLARITY 2004 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define EEPROM_SYSCTL1 1000 +#define EEPROM_SYSCTL2 1001 +#define EEPROM_SYSCTL3 1002 +#define EEPROM_SYSCTL4 1003 +#define EEPROM_SYSCTL5 1004 +#define EEPROM_SYSCTL6 1005 +#define EEPROM_SYSCTL7 1006 +#define EEPROM_SYSCTL8 1007 +#define EEPROM_SYSCTL9 1008 +#define EEPROM_SYSCTL10 1009 +#define EEPROM_SYSCTL11 1010 +#define EEPROM_SYSCTL12 1011 +#define EEPROM_SYSCTL13 1012 +#define EEPROM_SYSCTL14 1013 +#define EEPROM_SYSCTL15 1014 +#define EEPROM_SYSCTL16 1015 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define F71805F_SYSCTL_IN0 1000 +#define F71805F_SYSCTL_IN1 1001 +#define F71805F_SYSCTL_IN2 1002 +#define F71805F_SYSCTL_IN3 1003 +#define F71805F_SYSCTL_IN4 1004 +#define F71805F_SYSCTL_IN5 1005 +#define F71805F_SYSCTL_IN6 1006 +#define F71805F_SYSCTL_IN7 1007 +#define F71805F_SYSCTL_IN8 1008 +#define F71805F_SYSCTL_FAN1 1101 +#define F71805F_SYSCTL_FAN2 1102 +#define F71805F_SYSCTL_FAN3 1103 +#define F71805F_SYSCTL_TEMP1 1201 +#define F71805F_SYSCTL_TEMP2 1202 +#define F71805F_SYSCTL_TEMP3 1203 +#define F71805F_SYSCTL_SENSOR1 1211 +#define F71805F_SYSCTL_SENSOR2 1212 +#define F71805F_SYSCTL_SENSOR3 1213 +#define F71805F_SYSCTL_ALARMS_IN 1090 +#define F71805F_SYSCTL_ALARMS_FAN 1190 +#define F71805F_SYSCTL_ALARMS_TEMP 1290 +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define FSCHER_SYSCTL_VOLT0 1000 /* 12 volt supply */ +#define FSCHER_SYSCTL_VOLT1 1001 /* 5 volt supply */ +#define FSCHER_SYSCTL_VOLT2 1002 /* batterie voltage */ +#define FSCHER_SYSCTL_FAN0 1101 /* state, ripple, actual value + fan 0 */ +#define FSCHER_SYSCTL_FAN1 1102 /* state, ripple, actual value + fan 1 */ +#define FSCHER_SYSCTL_FAN2 1103 /* state, ripple, actual value + fan 2 */ +#define FSCHER_SYSCTL_TEMP0 1201 /* state and value of sensor 0, + cpu die */ +#define FSCHER_SYSCTL_TEMP1 1202 /* state and value of sensor 1, + motherboard */ +#define FSCHER_SYSCTL_TEMP2 1203 /* state and value of sensor 2, + chassis */ +#define FSCHER_SYSCTL_PWM0 1301 /* min fan 0 */ +#define FSCHER_SYSCTL_PWM1 1302 /* min fan 1 */ +#define FSCHER_SYSCTL_PWM2 1303 /* min fan 2 */ +#define FSCHER_SYSCTL_REV 2000 /* revision */ +#define FSCHER_SYSCTL_EVENT 2001 /* global event status */ +#define FSCHER_SYSCTL_CONTROL 2002 /* global control byte */ +#define FSCHER_SYSCTL_WDOG 2003 /* watch dog preset, state and + control */ +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define FSCPOS_SYSCTL_VOLT0 1000 /* 12 volt supply */ +#define FSCPOS_SYSCTL_VOLT1 1001 /* 5 volt supply */ +#define FSCPOS_SYSCTL_VOLT2 1002 /* batterie voltage*/ +#define FSCPOS_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */ +#define FSCPOS_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */ +#define FSCPOS_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */ +#define FSCPOS_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */ +#define FSCPOS_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */ +#define FSCPOS_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */ +#define FSCPOS_SYSCTL_REV 2000 /* Revision */ +#define FSCPOS_SYSCTL_EVENT 2001 /* global event status */ +#define FSCPOS_SYSCTL_CONTROL 2002 /* global control byte */ +#define FSCPOS_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */ +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define FSCSCY_SYSCTL_VOLT0 1000 /* 12 volt supply */ +#define FSCSCY_SYSCTL_VOLT1 1001 /* 5 volt supply */ +#define FSCSCY_SYSCTL_VOLT2 1002 /* batterie voltage*/ +#define FSCSCY_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */ +#define FSCSCY_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */ +#define FSCSCY_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */ +#define FSCSCY_SYSCTL_FAN3 1104 /* state, min, ripple, actual value fan 3 */ +#define FSCSCY_SYSCTL_FAN4 1105 /* state, min, ripple, actual value fan 4 */ +#define FSCSCY_SYSCTL_FAN5 1106 /* state, min, ripple, actual value fan 5 */ +#define FSCSCY_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */ +#define FSCSCY_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */ +#define FSCSCY_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */ +#define FSCSCY_SYSCTL_TEMP3 1204 /* state and value of sensor 3, chassis */ +#define FSCSCY_SYSCTL_REV 2000 /* Revision */ +#define FSCSCY_SYSCTL_EVENT 2001 /* global event status */ +#define FSCSCY_SYSCTL_CONTROL 2002 /* global control byte */ +#define FSCSCY_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */ +#define FSCSCY_SYSCTL_PCILOAD 2004 /* PCILoad value */ +#define FSCSCY_SYSCTL_INTRUSION 2005 /* state, control for intrusion sensor */ + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define GL518_SYSCTL_VDD 1000 /* Volts * 100 */ +#define GL518_SYSCTL_VIN1 1001 +#define GL518_SYSCTL_VIN2 1002 +#define GL518_SYSCTL_VIN3 1003 +#define GL518_SYSCTL_FAN1 1101 /* RPM */ +#define GL518_SYSCTL_FAN2 1102 +#define GL518_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ +#define GL518_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define GL518_SYSCTL_ALARMS 2001 /* bitvector */ +#define GL518_SYSCTL_BEEP 2002 /* bitvector */ +#define GL518_SYSCTL_FAN1OFF 2003 +#define GL518_SYSCTL_ITERATE 2004 + +#define GL518_ALARM_VDD 0x01 +#define GL518_ALARM_VIN1 0x02 +#define GL518_ALARM_VIN2 0x04 +#define GL518_ALARM_VIN3 0x08 +#define GL518_ALARM_TEMP 0x10 +#define GL518_ALARM_FAN1 0x20 +#define GL518_ALARM_FAN2 0x40 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define GL520_SYSCTL_VDD 1000 /* Volts * 100 */ +#define GL520_SYSCTL_VIN1 1001 +#define GL520_SYSCTL_VIN2 1002 +#define GL520_SYSCTL_VIN3 1003 +#define GL520_SYSCTL_VIN4 1004 +#define GL520_SYSCTL_FAN1 1101 /* RPM */ +#define GL520_SYSCTL_FAN2 1102 +#define GL520_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ +#define GL520_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ +#define GL520_SYSCTL_VID 1300 +#define GL520_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define GL520_SYSCTL_ALARMS 2001 /* bitvector */ +#define GL520_SYSCTL_BEEP 2002 /* bitvector */ +#define GL520_SYSCTL_FAN1OFF 2003 +#define GL520_SYSCTL_CONFIG 2004 + +#define GL520_ALARM_VDD 0x01 +#define GL520_ALARM_VIN1 0x02 +#define GL520_ALARM_VIN2 0x04 +#define GL520_ALARM_VIN3 0x08 +#define GL520_ALARM_TEMP1 0x10 +#define GL520_ALARM_FAN1 0x20 +#define GL520_ALARM_FAN2 0x40 +#define GL520_ALARM_TEMP2 0x80 +#define GL520_ALARM_VIN4 0x80 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define IT87_SYSCTL_IN0 1000 /* Volts * 100 */ +#define IT87_SYSCTL_IN1 1001 +#define IT87_SYSCTL_IN2 1002 +#define IT87_SYSCTL_IN3 1003 +#define IT87_SYSCTL_IN4 1004 +#define IT87_SYSCTL_IN5 1005 +#define IT87_SYSCTL_IN6 1006 +#define IT87_SYSCTL_IN7 1007 +#define IT87_SYSCTL_IN8 1008 +#define IT87_SYSCTL_FAN1 1101 /* Rotations/min */ +#define IT87_SYSCTL_FAN2 1102 +#define IT87_SYSCTL_FAN3 1103 +#define IT87_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ +#define IT87_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ +#define IT87_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ +#define IT87_SYSCTL_VID 1300 /* Volts * 100 */ +#define IT87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define IT87_SYSCTL_ALARMS 2004 /* bitvector */ + +#define IT87_SYSCTL_PWM1 1401 +#define IT87_SYSCTL_PWM2 1402 +#define IT87_SYSCTL_PWM3 1403 +#define IT87_SYSCTL_FAN_CTL 1501 +#define IT87_SYSCTL_FAN_ON_OFF 1502 +#define IT87_SYSCTL_SENS1 1601 /* 1, 2, or Beta (3000-5000) */ +#define IT87_SYSCTL_SENS2 1602 +#define IT87_SYSCTL_SENS3 1603 + +#define IT87_ALARM_IN0 0x000100 +#define IT87_ALARM_IN1 0x000200 +#define IT87_ALARM_IN2 0x000400 +#define IT87_ALARM_IN3 0x000800 +#define IT87_ALARM_IN4 0x001000 +#define IT87_ALARM_IN5 0x002000 +#define IT87_ALARM_IN6 0x004000 +#define IT87_ALARM_IN7 0x008000 +#define IT87_ALARM_FAN1 0x0001 +#define IT87_ALARM_FAN2 0x0002 +#define IT87_ALARM_FAN3 0x0004 +#define IT87_ALARM_TEMP1 0x00010000 +#define IT87_ALARM_TEMP2 0x00020000 +#define IT87_ALARM_TEMP3 0x00040000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define LM63_SYSCTL_TEMP1 1200 +#define LM63_SYSCTL_TEMP2 1201 +#define LM63_SYSCTL_TEMP2_TCRIT 1205 +#define LM63_SYSCTL_TEMP2_TCRIT_HYST 1208 +#define LM63_SYSCTL_ALARMS 1210 +#define LM63_SYSCTL_FAN1 1220 +#define LM63_SYSCTL_PWM1 1230 + +#define LM63_ALARM_LOCAL_HIGH 0x40 +#define LM63_ALARM_REMOTE_HIGH 0x10 +#define LM63_ALARM_REMOTE_LOW 0x08 +#define LM63_ALARM_REMOTE_CRIT 0x02 +#define LM63_ALARM_REMOTE_OPEN 0x04 +#define LM63_ALARM_FAN_LOW 0x01 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define LM75_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define LM78_SYSCTL_IN0 1000 /* Volts * 100 */ +#define LM78_SYSCTL_IN1 1001 +#define LM78_SYSCTL_IN2 1002 +#define LM78_SYSCTL_IN3 1003 +#define LM78_SYSCTL_IN4 1004 +#define LM78_SYSCTL_IN5 1005 +#define LM78_SYSCTL_IN6 1006 +#define LM78_SYSCTL_FAN1 1101 /* Rotations/min */ +#define LM78_SYSCTL_FAN2 1102 +#define LM78_SYSCTL_FAN3 1103 +#define LM78_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ +#define LM78_SYSCTL_VID 1300 /* Volts * 100 */ +#define LM78_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define LM78_SYSCTL_ALARMS 2001 /* bitvector */ + +#define LM78_ALARM_IN0 0x0001 +#define LM78_ALARM_IN1 0x0002 +#define LM78_ALARM_IN2 0x0004 +#define LM78_ALARM_IN3 0x0008 +#define LM78_ALARM_IN4 0x0100 +#define LM78_ALARM_IN5 0x0200 +#define LM78_ALARM_IN6 0x0400 +#define LM78_ALARM_FAN1 0x0040 +#define LM78_ALARM_FAN2 0x0080 +#define LM78_ALARM_FAN3 0x0800 +#define LM78_ALARM_TEMP 0x0010 +#define LM78_ALARM_BTI 0x0020 +#define LM78_ALARM_CHAS 0x1000 +#define LM78_ALARM_FIFO 0x2000 +#define LM78_ALARM_SMI_IN 0x4000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define LM80_SYSCTL_IN0 1000 /* Volts * 100 */ +#define LM80_SYSCTL_IN1 1001 +#define LM80_SYSCTL_IN2 1002 +#define LM80_SYSCTL_IN3 1003 +#define LM80_SYSCTL_IN4 1004 +#define LM80_SYSCTL_IN5 1005 +#define LM80_SYSCTL_IN6 1006 +#define LM80_SYSCTL_FAN1 1101 /* Rotations/min */ +#define LM80_SYSCTL_FAN2 1102 +#define LM80_SYSCTL_TEMP 1250 /* Degrees Celsius * 100 */ +#define LM80_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define LM80_SYSCTL_ALARMS 2001 /* bitvector */ + +#define LM80_ALARM_IN0 0x0001 +#define LM80_ALARM_IN1 0x0002 +#define LM80_ALARM_IN2 0x0004 +#define LM80_ALARM_IN3 0x0008 +#define LM80_ALARM_IN4 0x0010 +#define LM80_ALARM_IN5 0x0020 +#define LM80_ALARM_IN6 0x0040 +#define LM80_ALARM_FAN1 0x0400 +#define LM80_ALARM_FAN2 0x0800 +#define LM80_ALARM_TEMP_HOT 0x0100 +#define LM80_ALARM_TEMP_OS 0x2000 +#define LM80_ALARM_CHAS 0x1000 +#define LM80_ALARM_BTI 0x0200 +#define LM80_ALARM_INT_IN 0x0080 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define LM83_SYSCTL_LOCAL_TEMP 1200 +#define LM83_SYSCTL_REMOTE1_TEMP 1201 +#define LM83_SYSCTL_REMOTE2_TEMP 1202 +#define LM83_SYSCTL_REMOTE3_TEMP 1203 +#define LM83_SYSCTL_TCRIT 1208 +#define LM83_SYSCTL_ALARMS 1210 + +#define LM83_ALARM_LOCAL_HIGH 0x0040 +#define LM83_ALARM_LOCAL_CRIT 0x0001 +#define LM83_ALARM_REMOTE1_HIGH 0x8000 +#define LM83_ALARM_REMOTE1_CRIT 0x0100 +#define LM83_ALARM_REMOTE1_OPEN 0x2000 +#define LM83_ALARM_REMOTE2_HIGH 0x0010 +#define LM83_ALARM_REMOTE2_CRIT 0x0002 +#define LM83_ALARM_REMOTE2_OPEN 0x0004 +#define LM83_ALARM_REMOTE3_HIGH 0x1000 +#define LM83_ALARM_REMOTE3_CRIT 0x0200 +#define LM83_ALARM_REMOTE3_OPEN 0x0400 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +/* Common parameters */ +#define LM85_SYSCTL_IN0 1000 +#define LM85_SYSCTL_IN1 1001 +#define LM85_SYSCTL_IN2 1002 +#define LM85_SYSCTL_IN3 1003 +#define LM85_SYSCTL_IN4 1004 +#define LM85_SYSCTL_FAN1 1005 +#define LM85_SYSCTL_FAN2 1006 +#define LM85_SYSCTL_FAN3 1007 +#define LM85_SYSCTL_FAN4 1008 +#define LM85_SYSCTL_TEMP1 1009 +#define LM85_SYSCTL_TEMP2 1010 +#define LM85_SYSCTL_TEMP3 1011 +#define LM85_SYSCTL_VID 1012 +#define LM85_SYSCTL_ALARMS 1013 +#define LM85_SYSCTL_PWM1 1014 +#define LM85_SYSCTL_PWM2 1015 +#define LM85_SYSCTL_PWM3 1016 +#define LM85_SYSCTL_VRM 1017 +#define LM85_SYSCTL_PWM_CFG1 1019 +#define LM85_SYSCTL_PWM_CFG2 1020 +#define LM85_SYSCTL_PWM_CFG3 1021 +#define LM85_SYSCTL_PWM_ZONE1 1022 +#define LM85_SYSCTL_PWM_ZONE2 1023 +#define LM85_SYSCTL_PWM_ZONE3 1024 +#define LM85_SYSCTL_ZONE1 1025 +#define LM85_SYSCTL_ZONE2 1026 +#define LM85_SYSCTL_ZONE3 1027 +#define LM85_SYSCTL_SMOOTH1 1028 +#define LM85_SYSCTL_SMOOTH2 1029 +#define LM85_SYSCTL_SMOOTH3 1030 + +/* Vendor specific values */ +#define LM85_SYSCTL_SPINUP_CTL 1100 +#define LM85_SYSCTL_TACH_MODE 1101 + +/* Analog Devices variant of the LM85 */ +#define ADM1027_SYSCTL_TACH_MODE 1200 +#define ADM1027_SYSCTL_TEMP_OFFSET1 1201 +#define ADM1027_SYSCTL_TEMP_OFFSET2 1202 +#define ADM1027_SYSCTL_TEMP_OFFSET3 1203 +#define ADM1027_SYSCTL_FAN_PPR 1204 +#define ADM1027_SYSCTL_ALARM_MASK 1205 + +/* Analog Devices variant of the LM85/ADM1027 */ +#define ADT7463_SYSCTL_TMIN_CTL1 1300 +#define ADT7463_SYSCTL_TMIN_CTL2 1301 +#define ADT7463_SYSCTL_TMIN_CTL3 1302 +#define ADT7463_SYSCTL_THERM_SIGNAL 1303 + +/* SMSC variant of the LM85 */ +#define EMC6D100_SYSCTL_IN5 1400 +#define EMC6D100_SYSCTL_IN6 1401 +#define EMC6D100_SYSCTL_IN7 1402 + +#define LM85_ALARM_IN0 0x0001 +#define LM85_ALARM_IN1 0x0002 +#define LM85_ALARM_IN2 0x0004 +#define LM85_ALARM_IN3 0x0008 +#define LM85_ALARM_TEMP1 0x0010 +#define LM85_ALARM_TEMP2 0x0020 +#define LM85_ALARM_TEMP3 0x0040 +#define LM85_ALARM_ALARM2 0x0080 +#define LM85_ALARM_IN4 0x0100 +#define LM85_ALARM_RESERVED 0x0200 +#define LM85_ALARM_FAN1 0x0400 +#define LM85_ALARM_FAN2 0x0800 +#define LM85_ALARM_FAN3 0x1000 +#define LM85_ALARM_FAN4 0x2000 +#define LM85_ALARM_TEMP1_FAULT 0x4000 +#define LM85_ALARM_TEMP3_FAULT 0x08000 +#define LM85_ALARM_IN6 0x10000 +#define LM85_ALARM_IN7 0x20000 +#define LM85_ALARM_IN5 0x40000 +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define LM87_SYSCTL_IN0 1000 /* Volts * 100 */ +#define LM87_SYSCTL_IN1 1001 +#define LM87_SYSCTL_IN2 1002 +#define LM87_SYSCTL_IN3 1003 +#define LM87_SYSCTL_IN4 1004 +#define LM87_SYSCTL_IN5 1005 +#define LM87_SYSCTL_AIN1 1006 +#define LM87_SYSCTL_AIN2 1007 +#define LM87_SYSCTL_FAN1 1102 +#define LM87_SYSCTL_FAN2 1103 +#define LM87_SYSCTL_TEMP1 1250 /* Degrees Celsius * 10 */ +#define LM87_SYSCTL_TEMP2 1251 /* Degrees Celsius * 10 */ +#define LM87_SYSCTL_TEMP3 1252 /* Degrees Celsius * 10 */ +#define LM87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define LM87_SYSCTL_ALARMS 2001 /* bitvector */ +#define LM87_SYSCTL_ANALOG_OUT 2002 +#define LM87_SYSCTL_VID 2003 +#define LM87_SYSCTL_VRM 2004 + +#define LM87_ALARM_IN0 0x0001 +#define LM87_ALARM_IN1 0x0002 +#define LM87_ALARM_IN2 0x0004 +#define LM87_ALARM_IN3 0x0008 +#define LM87_ALARM_TEMP1 0x0010 +#define LM87_ALARM_TEMP2 0x0020 +#define LM87_ALARM_TEMP3 0x0020 /* same?? */ +#define LM87_ALARM_FAN1 0x0040 +#define LM87_ALARM_FAN2 0x0080 +#define LM87_ALARM_IN4 0x0100 +#define LM87_ALARM_IN5 0x0200 +#define LM87_ALARM_RESERVED1 0x0400 +#define LM87_ALARM_RESERVED2 0x0800 +#define LM87_ALARM_CHAS 0x1000 +#define LM87_ALARM_THERM_SIG 0x2000 +#define LM87_ALARM_TEMP2_FAULT 0x4000 +#define LM87_ALARM_TEMP3_FAULT 0x08000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define LM90_SYSCTL_LOCAL_TEMP 1200 +#define LM90_SYSCTL_REMOTE_TEMP 1201 +#define LM90_SYSCTL_LOCAL_TCRIT 1204 +#define LM90_SYSCTL_REMOTE_TCRIT 1205 +#define LM90_SYSCTL_LOCAL_HYST 1207 +#define LM90_SYSCTL_REMOTE_HYST 1208 +#define LM90_SYSCTL_ALARMS 1210 +#define LM90_SYSCTL_PEC 1214 + +#define LM90_ALARM_LOCAL_HIGH 0x40 +#define LM90_ALARM_LOCAL_LOW 0x20 +#define LM90_ALARM_LOCAL_CRIT 0x01 +#define LM90_ALARM_REMOTE_HIGH 0x10 +#define LM90_ALARM_REMOTE_LOW 0x08 +#define LM90_ALARM_REMOTE_CRIT 0x02 +#define LM90_ALARM_REMOTE_OPEN 0x04 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define LM92_SYSCTL_ALARMS 2001 /* high, low, critical */ +#define LM92_SYSCTL_TEMP 1200 /* high, low, critical, hysteresis, input */ + +#define LM92_ALARM_TEMP_HIGH 0x01 +#define LM92_ALARM_TEMP_LOW 0x02 +#define LM92_ALARM_TEMP_CRIT 0x04 +#define LM92_TEMP_HIGH 0x08 +#define LM92_TEMP_LOW 0x10 +#define LM92_TEMP_CRIT 0x20 +#define LM92_TEMP_HYST 0x40 +#define LM92_TEMP_INPUT 0x80 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +/* volts * 100 */ +#define LM93_SYSCTL_IN1 1001 +#define LM93_SYSCTL_IN2 1002 +#define LM93_SYSCTL_IN3 1003 +#define LM93_SYSCTL_IN4 1004 +#define LM93_SYSCTL_IN5 1005 +#define LM93_SYSCTL_IN6 1006 +#define LM93_SYSCTL_IN7 1007 +#define LM93_SYSCTL_IN8 1008 +#define LM93_SYSCTL_IN9 1009 +#define LM93_SYSCTL_IN10 1010 +#define LM93_SYSCTL_IN11 1011 +#define LM93_SYSCTL_IN12 1012 +#define LM93_SYSCTL_IN13 1013 +#define LM93_SYSCTL_IN14 1014 +#define LM93_SYSCTL_IN15 1015 +#define LM93_SYSCTL_IN16 1016 + +/* degrees Celsius * 10 */ +#define LM93_SYSCTL_TEMP1 1101 +#define LM93_SYSCTL_TEMP2 1102 +#define LM93_SYSCTL_TEMP3 1103 + +#define LM93_SYSCTL_TEMP1_AUTO_BASE 1111 +#define LM93_SYSCTL_TEMP2_AUTO_BASE 1112 +#define LM93_SYSCTL_TEMP3_AUTO_BASE 1113 + +#define LM93_SYSCTL_TEMP1_AUTO_OFFSETS 1121 +#define LM93_SYSCTL_TEMP2_AUTO_OFFSETS 1122 +#define LM93_SYSCTL_TEMP3_AUTO_OFFSETS 1123 + +#define LM93_SYSCTL_TEMP1_AUTO_BOOST 1131 +#define LM93_SYSCTL_TEMP2_AUTO_BOOST 1132 +#define LM93_SYSCTL_TEMP3_AUTO_BOOST 1133 + +#define LM93_SYSCTL_TEMP1_AUTO_BOOST_HYST 1141 +#define LM93_SYSCTL_TEMP2_AUTO_BOOST_HYST 1142 +#define LM93_SYSCTL_TEMP3_AUTO_BOOST_HYST 1143 + +/* 0 => off, 255 => 100% */ +#define LM93_SYSCTL_TEMP1_AUTO_PWM_MIN 1151 +#define LM93_SYSCTL_TEMP2_AUTO_PWM_MIN 1152 +#define LM93_SYSCTL_TEMP3_AUTO_PWM_MIN 1153 + +/* degrees Celsius * 10 */ +#define LM93_SYSCTL_TEMP1_AUTO_OFFSET_HYST 1161 +#define LM93_SYSCTL_TEMP2_AUTO_OFFSET_HYST 1162 +#define LM93_SYSCTL_TEMP3_AUTO_OFFSET_HYST 1163 + +/* rotations/minute */ +#define LM93_SYSCTL_FAN1 1201 +#define LM93_SYSCTL_FAN2 1202 +#define LM93_SYSCTL_FAN3 1203 +#define LM93_SYSCTL_FAN4 1204 + +/* 1-2 => enable smart tach mode associated with this pwm #, or disable */ +#define LM93_SYSCTL_FAN1_SMART_TACH 1205 +#define LM93_SYSCTL_FAN2_SMART_TACH 1206 +#define LM93_SYSCTL_FAN3_SMART_TACH 1207 +#define LM93_SYSCTL_FAN4_SMART_TACH 1208 + +/* volts * 1000 */ +#define LM93_SYSCTL_VID1 1301 +#define LM93_SYSCTL_VID2 1302 + +/* 0 => off, 255 => 100% */ +#define LM93_SYSCTL_PWM1 1401 +#define LM93_SYSCTL_PWM2 1402 + +/* Hz */ +#define LM93_SYSCTL_PWM1_FREQ 1411 +#define LM93_SYSCTL_PWM2_FREQ 1412 + +/* bitvector */ +#define LM93_SYSCTL_PWM1_AUTO_CHANNELS 1421 +#define LM93_SYSCTL_PWM2_AUTO_CHANNELS 1422 + +/* Hz */ +#define LM93_SYSCTL_PWM1_AUTO_SPINUP_MIN 1431 +#define LM93_SYSCTL_PWM2_AUTO_SPINUP_MIN 1432 + +/* seconds */ +#define LM93_SYSCTL_PWM1_AUTO_SPINUP_TIME 1441 +#define LM93_SYSCTL_PWM2_AUTO_SPINUP_TIME 1442 + +/* seconds */ +#define LM93_SYSCTL_PWM_AUTO_PROCHOT_RAMP 1451 +#define LM93_SYSCTL_PWM_AUTO_VRDHOT_RAMP 1452 + +/* 0 => 0%, 255 => > 99.6% */ +#define LM93_SYSCTL_PROCHOT1 1501 +#define LM93_SYSCTL_PROCHOT2 1502 + +/* !0 => enable #PROCHOT logical short */ +#define LM93_SYSCTL_PROCHOT_SHORT 1503 + +/* 2 boolean enable/disable, 3rd value indicates duty cycle */ +#define LM93_SYSCTL_PROCHOT_OVERRIDE 1504 + +/* 2 values, 0-9 */ +#define LM93_SYSCTL_PROCHOT_INTERVAL 1505 + +/* GPIO input (bitmask) */ +#define LM93_SYSCTL_GPIO 1601 + +/* #VRDHOT input (boolean) */ +#define LM93_SYSCTL_VRDHOT1 1701 +#define LM93_SYSCTL_VRDHOT2 1702 + +/* alarms (bitmask) */ +#define LM93_SYSCTL_ALARMS 2001 + +/* alarm bitmask definitions + The LM93 has nearly 64 bits of error status... I've pared that down to + what I think is a useful subset in order to fit it into 32 bits. + + Especially note that the #VRD_HOT alarms are missing because we provide + that information as values in another /proc file. + + If libsensors is extended to support 64 bit values, this could be revisited. +*/ +#define LM93_ALARM_IN1 0x00000001 +#define LM93_ALARM_IN2 0x00000002 +#define LM93_ALARM_IN3 0x00000004 +#define LM93_ALARM_IN4 0x00000008 +#define LM93_ALARM_IN5 0x00000010 +#define LM93_ALARM_IN6 0x00000020 +#define LM93_ALARM_IN7 0x00000040 +#define LM93_ALARM_IN8 0x00000080 +#define LM93_ALARM_IN9 0x00000100 +#define LM93_ALARM_IN10 0x00000200 +#define LM93_ALARM_IN11 0x00000400 +#define LM93_ALARM_IN12 0x00000800 +#define LM93_ALARM_IN13 0x00001000 +#define LM93_ALARM_IN14 0x00002000 +#define LM93_ALARM_IN15 0x00004000 +#define LM93_ALARM_IN16 0x00008000 +#define LM93_ALARM_FAN1 0x00010000 +#define LM93_ALARM_FAN2 0x00020000 +#define LM93_ALARM_FAN3 0x00040000 +#define LM93_ALARM_FAN4 0x00080000 +#define LM93_ALARM_PH1_ERR 0x00100000 +#define LM93_ALARM_PH2_ERR 0x00200000 +#define LM93_ALARM_SCSI1_ERR 0x00400000 +#define LM93_ALARM_SCSI2_ERR 0x00800000 +#define LM93_ALARM_DVDDP1_ERR 0x01000000 +#define LM93_ALARM_DVDDP2_ERR 0x02000000 +#define LM93_ALARM_D1_ERR 0x04000000 +#define LM93_ALARM_D2_ERR 0x08000000 +#define LM93_ALARM_TEMP1 0x10000000 +#define LM93_ALARM_TEMP2 0x20000000 +#define LM93_ALARM_TEMP3 0x40000000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define LTC1710_SYSCTL_SWITCH_1 1000 +#define LTC1710_SYSCTL_SWITCH_2 1001 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define MATORB_SYSCTL_DISP 1000 +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define MAX1619_SYSCTL_LOCAL_TEMP 1200 +#define MAX1619_SYSCTL_REMOTE_TEMP 1201 +#define MAX1619_SYSCTL_REMOTE_CRIT 1202 +#define MAX1619_SYSCTL_ALARMS 1203 + +#define MAX1619_ALARM_REMOTE_THIGH 0x10 +#define MAX1619_ALARM_REMOTE_TLOW 0x08 +#define MAX1619_ALARM_REMOTE_OPEN 0x04 +#define MAX1619_ALARM_REMOTE_OVERT 0x02 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define MAX6650_SYSCTL_FAN1 1101 +#define MAX6650_SYSCTL_FAN2 1102 +#define MAX6650_SYSCTL_FAN3 1103 +#define MAX6650_SYSCTL_FAN4 1104 +#define MAX6650_SYSCTL_SPEED 1105 +#define MAX6650_SYSCTL_XDUMP 1106 + + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define MAXI_SYSCTL_FAN1 1101 /* Rotations/min */ +#define MAXI_SYSCTL_FAN2 1102 /* Rotations/min */ +#define MAXI_SYSCTL_FAN3 1103 /* Rotations/min */ +#define MAXI_SYSCTL_FAN4 1104 /* Rotations/min */ +#define MAXI_SYSCTL_TEMP1 1201 /* Degrees Celsius */ +#define MAXI_SYSCTL_TEMP2 1202 /* Degrees Celsius */ +#define MAXI_SYSCTL_TEMP3 1203 /* Degrees Celsius */ +#define MAXI_SYSCTL_TEMP4 1204 /* Degrees Celsius */ +#define MAXI_SYSCTL_TEMP5 1205 /* Degrees Celsius */ +#define MAXI_SYSCTL_TEMP6 1206 /* Degrees Celsius */ +#define MAXI_SYSCTL_PLL 1301 /* MHz */ +#define MAXI_SYSCTL_VID1 1401 /* Volts / 6.337, for nba just Volts */ +#define MAXI_SYSCTL_VID2 1402 /* Volts */ +#define MAXI_SYSCTL_VID3 1403 /* Volts */ +#define MAXI_SYSCTL_VID4 1404 /* Volts */ +#define MAXI_SYSCTL_VID5 1405 /* Volts */ +#define MAXI_SYSCTL_LCD1 1501 /* Line 1 of LCD */ +#define MAXI_SYSCTL_LCD2 1502 /* Line 2 of LCD */ +#define MAXI_SYSCTL_LCD3 1503 /* Line 3 of LCD */ +#define MAXI_SYSCTL_LCD4 1504 /* Line 4 of LCD */ +#define MAXI_SYSCTL_ALARMS 2001 /* Bitvector (see below) */ + +#define MAXI_ALARM_VID4 0x0001 +#define MAXI_ALARM_TEMP2 0x0002 +#define MAXI_ALARM_VID1 0x0004 +#define MAXI_ALARM_VID2 0x0008 +#define MAXI_ALARM_VID3 0x0010 +#define MAXI_ALARM_PLL 0x0080 +#define MAXI_ALARM_TEMP4 0x0100 +#define MAXI_ALARM_TEMP5 0x0200 +#define MAXI_ALARM_FAN1 0x1000 +#define MAXI_ALARM_FAN2 0x2000 +#define MAXI_ALARM_FAN3 0x4000 + +#define MAXI_ALARM_FAN 0x0100 /* To be used with MaxiLife'99 */ +#define MAXI_ALARM_VID 0x0200 /* The MSB specifies which sensor */ +#define MAXI_ALARM_TEMP 0x0400 /* in the alarm group failed, i.e.: */ +#define MAXI_ALARM_VADD 0x0800 /* 0x0402 = TEMP2 failed = CPU2 temp */ + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define MIC74_SYSCTL_REG0 1000 +#define MIC74_SYSCTL_REG1 1001 +#define MIC74_SYSCTL_REG2 1002 +#define MIC74_SYSCTL_REG3 1003 +#define MIC74_SYSCTL_REG4 1004 +#define MIC74_SYSCTL_REG5 1005 +#define MIC74_SYSCTL_REG6 1006 +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define MTP008_SYSCTL_IN0 1000 /* Volts * 100 */ +#define MTP008_SYSCTL_IN1 1001 +#define MTP008_SYSCTL_IN2 1002 +#define MTP008_SYSCTL_IN3 1003 +#define MTP008_SYSCTL_IN4 1004 +#define MTP008_SYSCTL_IN5 1005 +#define MTP008_SYSCTL_IN6 1006 +#define MTP008_SYSCTL_FAN1 1101 /* Rotations/min */ +#define MTP008_SYSCTL_FAN2 1102 +#define MTP008_SYSCTL_FAN3 1103 +#define MTP008_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ +#define MTP008_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ +#define MTP008_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ +#define MTP008_SYSCTL_VID 1300 /* Volts * 100 */ +#define MTP008_SYSCTL_PWM1 1401 +#define MTP008_SYSCTL_PWM2 1402 +#define MTP008_SYSCTL_PWM3 1403 +#define MTP008_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ +#define MTP008_SYSCTL_SENS2 1502 +#define MTP008_SYSCTL_SENS3 1503 +#define MTP008_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define MTP008_SYSCTL_ALARMS 2001 /* bitvector */ +#define MTP008_SYSCTL_BEEP 2002 /* bitvector */ + +#define MTP008_ALARM_IN0 0x0001 +#define MTP008_ALARM_IN1 0x0002 +#define MTP008_ALARM_IN2 0x0004 +#define MTP008_ALARM_IN3 0x0008 +#define MTP008_ALARM_IN4 0x0100 +#define MTP008_ALARM_IN5 0x0200 +#define MTP008_ALARM_IN6 0x0400 +#define MTP008_ALARM_FAN1 0x0040 +#define MTP008_ALARM_FAN2 0x0080 +#define MTP008_ALARM_FAN3 0x0800 +#define MTP008_ALARM_TEMP1 0x0010 +#define MTP008_ALARM_TEMP2 0x0100 +#define MTP008_ALARM_TEMP3 0x0200 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define PC87365_SYSCTL_ALARMS 100 /* bit field */ + +#define PC87360_SYSCTL_FAN1 1101 /* Rotations/min */ +#define PC87360_SYSCTL_FAN2 1102 +#define PC87360_SYSCTL_FAN3 1103 /* not for PC87360/PC87363 */ +#define PC87360_SYSCTL_FAN_DIV 1201 /* 1, 2, 4 or 8 */ +#define PC87360_SYSCTL_FAN1_STATUS 1301 /* bit field */ +#define PC87360_SYSCTL_FAN2_STATUS 1302 +#define PC87360_SYSCTL_FAN3_STATUS 1303 /* not for PC87360/PC87363 */ +#define PC87360_SYSCTL_PWM1 1401 /* 0-255 */ +#define PC87360_SYSCTL_PWM2 1402 +#define PC87360_SYSCTL_PWM3 1403 /* not for PC87360/PC87363 */ + +#define PC87360_STATUS_FAN_READY 0x01 +#define PC87360_STATUS_FAN_LOW 0x02 +#define PC87360_STATUS_FAN_OVERFLOW 0x04 + +#define PC87365_SYSCTL_IN0 2100 /* mV */ +#define PC87365_SYSCTL_IN1 2101 +#define PC87365_SYSCTL_IN2 2102 +#define PC87365_SYSCTL_IN3 2103 +#define PC87365_SYSCTL_IN4 2104 +#define PC87365_SYSCTL_IN5 2105 +#define PC87365_SYSCTL_IN6 2106 +#define PC87365_SYSCTL_IN7 2107 +#define PC87365_SYSCTL_IN8 2108 +#define PC87365_SYSCTL_IN9 2109 +#define PC87365_SYSCTL_IN10 2110 +#define PC87365_SYSCTL_TEMP4 2111 /* not for PC87365 */ +#define PC87365_SYSCTL_TEMP5 2112 /* not for PC87365 */ +#define PC87365_SYSCTL_TEMP6 2113 /* not for PC87365 */ +#define PC87365_SYSCTL_IN0_STATUS 2300 /* bit field */ +#define PC87365_SYSCTL_IN1_STATUS 2301 +#define PC87365_SYSCTL_IN2_STATUS 2302 +#define PC87365_SYSCTL_IN3_STATUS 2303 +#define PC87365_SYSCTL_IN4_STATUS 2304 +#define PC87365_SYSCTL_IN5_STATUS 2305 +#define PC87365_SYSCTL_IN6_STATUS 2306 +#define PC87365_SYSCTL_IN7_STATUS 2307 +#define PC87365_SYSCTL_IN8_STATUS 2308 +#define PC87365_SYSCTL_IN9_STATUS 2309 +#define PC87365_SYSCTL_IN10_STATUS 2310 +#define PC87365_SYSCTL_TEMP4_STATUS 2311 /* not for PC87365 */ +#define PC87365_SYSCTL_TEMP5_STATUS 2312 /* not for PC87365 */ +#define PC87365_SYSCTL_TEMP6_STATUS 2313 /* not for PC87365 */ + +#define PC87365_SYSCTL_VID 2400 +#define PC87365_SYSCTL_VRM 2401 + +#define PC87365_STATUS_IN_MIN 0x02 +#define PC87365_STATUS_IN_MAX 0x04 + +#define PC87365_SYSCTL_TEMP1 3101 /* degrees Celsius */ +#define PC87365_SYSCTL_TEMP2 3102 +#define PC87365_SYSCTL_TEMP3 3103 /* not for PC87365 */ +#define PC87365_SYSCTL_TEMP1_STATUS 3301 /* bit field */ +#define PC87365_SYSCTL_TEMP2_STATUS 3302 +#define PC87365_SYSCTL_TEMP3_STATUS 3303 /* not for PC87365 */ + +#define PC87365_STATUS_TEMP_MIN 0x02 +#define PC87365_STATUS_TEMP_MAX 0x04 +#define PC87365_STATUS_TEMP_CRIT 0x08 +#define PC87365_STATUS_TEMP_OPEN 0x40 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define PCA9540_SYSCTL_CHANNEL 1000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define PCF8574_SYSCTL_READ 1000 +#define PCF8574_SYSCTL_WRITE 1001 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define PCF8591_SYSCTL_AIN_CONF 1000 /* Analog input configuration */ +#define PCF8591_SYSCTL_CH0 1001 /* Input channel 1 */ +#define PCF8591_SYSCTL_CH1 1002 /* Input channel 2 */ +#define PCF8591_SYSCTL_CH2 1003 /* Input channel 3 */ +#define PCF8591_SYSCTL_CH3 1004 /* Input channel 4 */ +#define PCF8591_SYSCTL_AOUT_ENABLE 1005 /* Analog output enable flag */ +#define PCF8591_SYSCTL_AOUT 1006 /* Analog output */ +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define SAA1064_SYSCTL_BRIGHT 1000 /* Brightness, 0-7 */ +#define SAA1064_SYSCTL_TEST 1001 /* Testmode (on = all digits lit) */ +#define SAA1064_SYSCTL_DISP 1005 /* four eight bit values */ +#define SAA1064_SYSCTL_REFRESH 1006 /* refresh digits in case of powerloss */ + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define SIS5595_SYSCTL_IN0 1000 /* Volts * 100 */ +#define SIS5595_SYSCTL_IN1 1001 +#define SIS5595_SYSCTL_IN2 1002 +#define SIS5595_SYSCTL_IN3 1003 +#define SIS5595_SYSCTL_IN4 1004 +#define SIS5595_SYSCTL_FAN1 1101 /* Rotations/min */ +#define SIS5595_SYSCTL_FAN2 1102 +#define SIS5595_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ +#define SIS5595_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define SIS5595_SYSCTL_ALARMS 2001 /* bitvector */ + +#define SIS5595_ALARM_IN0 0x01 +#define SIS5595_ALARM_IN1 0x02 +#define SIS5595_ALARM_IN2 0x04 +#define SIS5595_ALARM_IN3 0x08 +#define SIS5595_ALARM_BTI 0x20 +#define SIS5595_ALARM_FAN1 0x40 +#define SIS5595_ALARM_FAN2 0x80 +#define SIS5595_ALARM_IN4 0x8000 +#define SIS5595_ALARM_TEMP 0x8000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +/* Status Register Bits */ +/* * * * * * Alarm Bits * * * * */ +#define SMARTBATT_OVER_CHARGED_ALARM 0x8000 +#define SMARTBATT_TERMINATE_CHARGE_ALARM 0x4000 +#define SMARTBATT_OVER_TEMP_ALARM 0x1000 +#define SMARTBATT_TERMINATE_DISCHARGE_ALARM 0x0800 +#define SMARTBATT_REMAINING_CAPACITY_ALARM 0x0200 +#define SMARTBATT_REMAINING_TIME_ALARM 0x0100 +/* * * * * * Status Bits * * * * */ +#define SMARTBATT_INITIALIZED 0x0080 +#define SMARTBATT_DISCHARGING 0x0040 +#define SMARTBATT_FULLY_CHARGED 0x0020 +#define SMARTBATT_FULLY_DISCHARGED 0x0010 +/* * * * * * Error Bits * * * * */ +#define SMARTBATT_OK 0x0000 +#define SMARTBATT_BUSY 0x0001 +#define SMARTBATT_RESERVED_COMMAND 0x0002 +#define SMARTBATT_UNSUPPORTED_COMMAND 0x0003 +#define SMARTBATT_ACCESS_DENIED 0x0004 +#define SMARTBATT_OVER_UNDERFLOW 0x0005 +#define SMARTBATT_BAD_SIZE 0x0006 +#define SMARTBATT_UNKNOWN_ERROR 0x0007 + +#define SMARTBATT_ALARM (SMARTBATT_OVER_CHARGED_ALARM \ + | SMARTBATT_TERMINATE_CHARGE_ALARM | SMARTBATT_OVER_TEMP_ALARM \ + | SMARTBATT_TERMINATE_DISCHARGE_ALARM \ + | SMARTBATT_REMAINING_CAPACITY_ALARM \ + | SMARTBATT_REMAINING_TIME_ALARM) + +#define SMARTBATT_STATUS (SMARTBATT_INITIALIZED | SMARTBATT_DISCHARGING \ + | SMARTBATT_FULLY_CHARGED | SMARTBATT_FULLY_DISCHARGED ) + +#define SMARTBATT_ERROR (SMARTBATT_BUSY | SMARTBATT_RESERVED_COMMAND \ + | SMARTBATT_UNSUPPORTED_COMMAND | SMARTBATT_ACCESS_DENIED \ + | SMARTBATT_OVER_UNDERFLOW | SMARTBATT_BAD_SIZE\ + | SMARTBATT_UNKNOWN_ERROR) + + +#define SMARTBATT_SYSCTL_I 1001 +#define SMARTBATT_SYSCTL_V 1002 +#define SMARTBATT_SYSCTL_TEMP 1003 +#define SMARTBATT_SYSCTL_TIME 1004 +#define SMARTBATT_SYSCTL_ALARMS 1005 +#define SMARTBATT_SYSCTL_STATUS 1006 +#define SMARTBATT_SYSCTL_ERROR 1007 +#define SMARTBATT_SYSCTL_CHARGE 1008 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define ARP_SYSCTL1 1000 +#define ARP_SYSCTL2 1001 +#define ARP_SYSCTL3 1002 +#define ARP_SYSCTL4 1003 +#define ARP_SYSCTL5 1004 +#define ARP_SYSCTL6 1005 +#define ARP_SYSCTL7 1006 +#define ARP_SYSCTL8 1007 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define SMSC47M1_SYSCTL_FAN1 1101 /* Rotations/min */ +#define SMSC47M1_SYSCTL_FAN2 1102 +#define SMSC47M1_SYSCTL_FAN3 1103 +#define SMSC47M1_SYSCTL_PWM1 1401 +#define SMSC47M1_SYSCTL_PWM2 1402 +#define SMSC47M1_SYSCTL_PWM3 1403 +#define SMSC47M1_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define SMSC47M1_SYSCTL_ALARMS 2004 /* bitvector */ + +#define SMSC47M1_ALARM_FAN1 0x0001 +#define SMSC47M1_ALARM_FAN2 0x0002 +#define SMSC47M1_ALARM_FAN3 0x0004 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define THMC50_SYSCTL_TEMP 1200 /* Degrees Celsius */ +#define THMC50_SYSCTL_REMOTE_TEMP 1201 /* Degrees Celsius */ +#define THMC50_SYSCTL_INTER 1202 +#define THMC50_SYSCTL_INTER_MASK 1203 +#define THMC50_SYSCTL_DIE_CODE 1204 +#define THMC50_SYSCTL_ANALOG_OUT 1205 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define VIA686A_SYSCTL_IN0 1000 +#define VIA686A_SYSCTL_IN1 1001 +#define VIA686A_SYSCTL_IN2 1002 +#define VIA686A_SYSCTL_IN3 1003 +#define VIA686A_SYSCTL_IN4 1004 +#define VIA686A_SYSCTL_FAN1 1101 +#define VIA686A_SYSCTL_FAN2 1102 +#define VIA686A_SYSCTL_TEMP 1200 +#define VIA686A_SYSCTL_TEMP2 1201 +#define VIA686A_SYSCTL_TEMP3 1202 +#define VIA686A_SYSCTL_FAN_DIV 2000 +#define VIA686A_SYSCTL_ALARMS 2001 + +#define VIA686A_ALARM_IN0 0x01 +#define VIA686A_ALARM_IN1 0x02 +#define VIA686A_ALARM_IN2 0x04 +#define VIA686A_ALARM_IN3 0x08 +#define VIA686A_ALARM_TEMP 0x10 +#define VIA686A_ALARM_FAN1 0x40 +#define VIA686A_ALARM_FAN2 0x80 +#define VIA686A_ALARM_IN4 0x100 +#define VIA686A_ALARM_TEMP2 0x800 +#define VIA686A_ALARM_CHAS 0x1000 +#define VIA686A_ALARM_TEMP3 0x8000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define VT1211_SYSCTL_IN0 1000 +#define VT1211_SYSCTL_IN1 1001 +#define VT1211_SYSCTL_IN2 1002 +#define VT1211_SYSCTL_IN3 1003 +#define VT1211_SYSCTL_IN4 1004 +#define VT1211_SYSCTL_IN5 1005 +#define VT1211_SYSCTL_FAN1 1101 +#define VT1211_SYSCTL_FAN2 1102 +#define VT1211_SYSCTL_TEMP1 1200 +#define VT1211_SYSCTL_TEMP2 1201 +#define VT1211_SYSCTL_TEMP3 1202 +#define VT1211_SYSCTL_TEMP4 1203 +#define VT1211_SYSCTL_TEMP5 1204 +#define VT1211_SYSCTL_TEMP6 1205 +#define VT1211_SYSCTL_TEMP7 1206 +#define VT1211_SYSCTL_VID 1300 +#define VT1211_SYSCTL_PWM1 1401 +#define VT1211_SYSCTL_PWM2 1402 +#define VT1211_SYSCTL_VRM 1600 +#define VT1211_SYSCTL_UCH 1700 +#define VT1211_SYSCTL_FAN_DIV 2000 +#define VT1211_SYSCTL_ALARMS 2001 + +#define VT1211_ALARM_IN1 0x01 +#define VT1211_ALARM_IN2 0x02 +#define VT1211_ALARM_IN5 0x04 +#define VT1211_ALARM_IN3 0x08 +#define VT1211_ALARM_TEMP1 0x10 +#define VT1211_ALARM_FAN1 0x40 +#define VT1211_ALARM_FAN2 0x80 +#define VT1211_ALARM_IN4 0x100 +#define VT1211_ALARM_TEMP3 0x800 +#define VT1211_ALARM_CHAS 0x1000 +#define VT1211_ALARM_TEMP2 0x8000 +/* duplicates */ +#define VT1211_ALARM_IN0 VT1211_ALARM_TEMP3 +#define VT1211_ALARM_TEMP4 VT1211_ALARM_IN1 +#define VT1211_ALARM_TEMP5 VT1211_ALARM_IN2 +#define VT1211_ALARM_TEMP6 VT1211_ALARM_IN3 +#define VT1211_ALARM_TEMP7 VT1211_ALARM_IN4 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ +#define VT8231_SYSCTL_IN0 1000 +#define VT8231_SYSCTL_IN1 1001 +#define VT8231_SYSCTL_IN2 1002 +#define VT8231_SYSCTL_IN3 1003 +#define VT8231_SYSCTL_IN4 1004 +#define VT8231_SYSCTL_IN5 1005 +#define VT8231_SYSCTL_FAN1 1101 +#define VT8231_SYSCTL_FAN2 1102 +#define VT8231_SYSCTL_TEMP 1200 +#define VT8231_SYSCTL_TEMP2 1201 +#define VT8231_SYSCTL_TEMP3 1202 +#define VT8231_SYSCTL_TEMP4 1203 +#define VT8231_SYSCTL_TEMP5 1204 +#define VT8231_SYSCTL_TEMP6 1205 +#define VT8231_SYSCTL_VID 1300 +#define VT8231_SYSCTL_PWM1 1401 +#define VT8231_SYSCTL_PWM2 1402 +#define VT8231_SYSCTL_VRM 1600 +#define VT8231_SYSCTL_UCH 1700 +#define VT8231_SYSCTL_FAN_DIV 2000 +#define VT8231_SYSCTL_ALARMS 2001 + +#define VT8231_ALARM_IN1 0x01 +#define VT8231_ALARM_IN2 0x02 +#define VT8231_ALARM_IN5 0x04 +#define VT8231_ALARM_IN3 0x08 +#define VT8231_ALARM_TEMP 0x10 +#define VT8231_ALARM_FAN1 0x40 +#define VT8231_ALARM_FAN2 0x80 +#define VT8231_ALARM_IN4 0x100 +#define VT8231_ALARM_TEMP2 0x800 +#define VT8231_ALARM_CHAS 0x1000 +/* duplicates */ +#define VT8231_ALARM_IN0 VT8231_ALARM_TEMP2 +#define VT8231_ALARM_TEMP3 VT8231_ALARM_IN1 +#define VT8231_ALARM_TEMP4 VT8231_ALARM_IN2 +#define VT8231_ALARM_TEMP5 VT8231_ALARM_IN3 +#define VT8231_ALARM_TEMP6 VT8231_ALARM_IN4 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define W83781D_SYSCTL_IN0 1000 /* Volts * 100 */ +#define W83781D_SYSCTL_IN1 1001 +#define W83781D_SYSCTL_IN2 1002 +#define W83781D_SYSCTL_IN3 1003 +#define W83781D_SYSCTL_IN4 1004 +#define W83781D_SYSCTL_IN5 1005 +#define W83781D_SYSCTL_IN6 1006 +#define W83781D_SYSCTL_IN7 1007 +#define W83781D_SYSCTL_IN8 1008 +#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */ +#define W83781D_SYSCTL_FAN2 1102 +#define W83781D_SYSCTL_FAN3 1103 +#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ +#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ +#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ +#define W83781D_SYSCTL_VID 1300 /* Volts * 1000 */ +#define W83781D_SYSCTL_VRM 1301 +#define W83781D_SYSCTL_PWM1 1401 +#define W83781D_SYSCTL_PWM2 1402 +#define W83781D_SYSCTL_PWM3 1403 +#define W83781D_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ +#define W83781D_SYSCTL_SENS2 1502 +#define W83781D_SYSCTL_SENS3 1503 +#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */ +#define W83781D_SYSCTL_BEEP 2002 /* bitvector */ + +#define W83781D_ALARM_IN0 0x0001 +#define W83781D_ALARM_IN1 0x0002 +#define W83781D_ALARM_IN2 0x0004 +#define W83781D_ALARM_IN3 0x0008 +#define W83781D_ALARM_IN4 0x0100 +#define W83781D_ALARM_IN5 0x0200 +#define W83781D_ALARM_IN6 0x0400 +#define W83782D_ALARM_IN7 0x10000 +#define W83782D_ALARM_IN8 0x20000 +#define W83781D_ALARM_FAN1 0x0040 +#define W83781D_ALARM_FAN2 0x0080 +#define W83781D_ALARM_FAN3 0x0800 +#define W83781D_ALARM_TEMP1 0x0010 +#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */ +#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S */ +#define W83781D_ALARM_TEMP3 0x2000 /* 782D only */ +#define W83781D_ALARM_CHAS 0x1000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define W83781D_SYSCTL_IN0 1000 /* Volts * 100 */ +#define W83781D_SYSCTL_IN1 1001 +#define W83781D_SYSCTL_IN2 1002 +#define W83781D_SYSCTL_IN3 1003 +#define W83781D_SYSCTL_IN4 1004 +#define W83781D_SYSCTL_IN5 1005 +#define W83781D_SYSCTL_IN6 1006 +#define W83781D_SYSCTL_IN7 1007 +#define W83781D_SYSCTL_IN8 1008 +#define W83781D_SYSCTL_IN9 1009 +#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */ +#define W83781D_SYSCTL_FAN2 1102 +#define W83781D_SYSCTL_FAN3 1103 +#define W83781D_SYSCTL_FAN4 1104 +#define W83781D_SYSCTL_FAN5 1105 + +#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ +#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ +#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ +#define W83781D_SYSCTL_VID 1300 /* Volts * 1000 */ +#define W83781D_SYSCTL_VRM 1301 +#define W83781D_SYSCTL_PWM1 1401 +#define W83781D_SYSCTL_PWM2 1402 +#define W83781D_SYSCTL_PWM3 1403 +#define W83781D_SYSCTL_PWM4 1404 +#define W83781D_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ +#define W83781D_SYSCTL_SENS2 1502 +#define W83781D_SYSCTL_SENS3 1503 +#define W83781D_SYSCTL_RT1 1601 /* 32-entry table */ +#define W83781D_SYSCTL_RT2 1602 /* 32-entry table */ +#define W83781D_SYSCTL_RT3 1603 /* 32-entry table */ +#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */ +#define W83781D_SYSCTL_BEEP 2002 /* bitvector */ + +#define W83781D_ALARM_IN0 0x0001 +#define W83781D_ALARM_IN1 0x0002 +#define W83781D_ALARM_IN2 0x0004 +#define W83781D_ALARM_IN3 0x0008 +#define W83781D_ALARM_IN4 0x0100 +#define W83781D_ALARM_IN5 0x0200 +#define W83781D_ALARM_IN6 0x0400 +#define W83782D_ALARM_IN7 0x10000 +#define W83782D_ALARM_IN8 0x20000 +#define W83791D_ALARM_IN7 0x080000 /* 791D only */ +#define W83791D_ALARM_IN8 0x100000 /* 791D only */ +#define W83791D_ALARM_IN9 0x004000 /* 791D only */ +#define W83781D_ALARM_FAN1 0x0040 +#define W83781D_ALARM_FAN2 0x0080 +#define W83781D_ALARM_FAN3 0x0800 +#define W83791D_ALARM_FAN4 0x200000 /* 791D only */ +#define W83791D_ALARM_FAN5 0x400000 /* 791D only */ +#define W83781D_ALARM_TEMP1 0x0010 +#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */ +#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S/791D */ +#define W83781D_ALARM_TEMP3 0x2000 /* 782D/791D */ +#define W83781D_ALARM_CHAS 0x1000 /* 782D/791D */ + +#define W83791D_BEEP_IN1 0x002000 /* 791D only */ +#define W83791D_BEEP_IN7 0x010000 /* 791D only */ +#define W83791D_BEEP_IN8 0x020000 /* 791D only */ +#define W83791D_BEEP_TEMP3 0x000002 /* 791D only */ + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define W83792D_SYSCTL_IN0 1000 +#define W83792D_SYSCTL_IN1 1001 +#define W83792D_SYSCTL_IN2 1002 +#define W83792D_SYSCTL_IN3 1003 +#define W83792D_SYSCTL_IN4 1004 +#define W83792D_SYSCTL_IN5 1005 +#define W83792D_SYSCTL_IN6 1006 +#define W83792D_SYSCTL_IN7 1007 +#define W83792D_SYSCTL_IN8 1008 +#define W83792D_SYSCTL_FAN1 1101 +#define W83792D_SYSCTL_FAN2 1102 +#define W83792D_SYSCTL_FAN3 1103 +#define W83792D_SYSCTL_FAN4 1104 +#define W83792D_SYSCTL_FAN5 1105 +#define W83792D_SYSCTL_FAN6 1106 +#define W83792D_SYSCTL_FAN7 1107 + +#define W83792D_SYSCTL_TEMP1 1200 +#define W83792D_SYSCTL_TEMP2 1201 +#define W83792D_SYSCTL_TEMP3 1202 +/*#define W83792D_SYSCTL_VID 1300 +#define W83792D_SYSCTL_VRM 1301*/ +#define W83792D_SYSCTL_PWM_FLAG 1400 +#define W83792D_SYSCTL_PWM1 1401 +#define W83792D_SYSCTL_PWM2 1402 +#define W83792D_SYSCTL_PWM3 1403 +#define W83792D_SYSCTL_FAN_CFG 1500 /* control Fan Mode */ +#define W83792D_SYSCTL_FAN_DIV 1501 +#define W83792D_SYSCTL_CHASSIS 1502 /* control Case Open */ +#define W83792D_SYSCTL_ALARMS 1503 + +#define W83792D_SYSCTL_THERMAL_CRUISE 1600 /* Smart Fan I: target value */ +#define W83792D_SYSCTL_FAN_TOLERANCE 1601 /* Smart Fan I/II: tolerance */ +#define W83792D_SYSCTL_SF2_POINTS_FAN1 1602 /* Smart Fan II: Fan1 points */ +#define W83792D_SYSCTL_SF2_POINTS_FAN2 1603 /* Smart Fan II: Fan2 points */ +#define W83792D_SYSCTL_SF2_POINTS_FAN3 1604 /* Smart Fan II: Fan3 points */ +#define W83792D_SYSCTL_SF2_LEVELS_FAN1 1605 /* Smart Fan II: Fan1 levels */ +#define W83792D_SYSCTL_SF2_LEVELS_FAN2 1606 /* Smart Fan II: Fan2 levels */ +#define W83792D_SYSCTL_SF2_LEVELS_FAN3 1607 /* Smart Fan II: Fan3 levels */ + +#define W83792D_ALARM_IN0 0x0001 +#define W83792D_ALARM_IN1 0x0002 +#define W83792D_ALARM_IN2 0x0100 +#define W83792D_ALARM_IN3 0x0200 +#define W83792D_ALARM_IN4 0x0400 +#define W83792D_ALARM_IN5 0x0800 +#define W83792D_ALARM_IN6 0x1000 +#define W83792D_ALARM_IN7 0x80000 +#define W83792D_ALARM_IN8 0x100000 +#define W83792D_ALARM_TEMP1 0x0004 +#define W83792D_ALARM_TEMP2 0x0008 +#define W83792D_ALARM_TEMP3 0x0010 +#define W83792D_ALARM_FAN1 0x0020 +#define W83792D_ALARM_FAN2 0x0040 +#define W83792D_ALARM_FAN3 0x0080 +#define W83792D_ALARM_FAN4 0x200000 +#define W83792D_ALARM_FAN5 0x400000 +#define W83792D_ALARM_FAN6 0x800000 +#define W83792D_ALARM_FAN7 0x8000 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define W83L785TS_SYSCTL_TEMP 1200 + +/* -- SENSORS SYSCTL END -- */ +/* -- SENSORS SYSCTL START -- */ + +#define XEONTEMP_SYSCTL_REMOTE_TEMP 1201 +#define XEONTEMP_SYSCTL_ALARMS 1203 + +#define XEONTEMP_ALARM_RTEMP_HIGH 0x10 +#define XEONTEMP_ALARM_RTEMP_LOW 0x08 +#define XEONTEMP_ALARM_RTEMP_NA 0x04 + +/* -- SENSORS SYSCTL END -- */ +#endif diff --git a/kernel/include/sensors.h.template b/kernel/include/sensors.h.template deleted file mode 100644 index 8a60a74b..00000000 --- a/kernel/include/sensors.h.template +++ /dev/null @@ -1,55 +0,0 @@ -/* - sensors.h - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - --- THIS FILE IS AUTOGENERATED DO NOT EDIT -- -*/ - -#ifndef LIB_SENSORS_H -#define LIB_SENSORS_H - -/* This file is intended to be included from userland utilities only. - * - * Individual drivers define their own SYSCTL and ALARM values in - * the driver itself surrounded by the following 'trigger' lines: - * - * -- SENSORS SYSCTL START -- - * -- SENSORS SYSCTL END -- - */ - - -/* From linux/i2c-proc.h */ - -/* Sysctl IDs */ -#ifdef DEV_HWMON -#define DEV_SENSORS DEV_HWMON -#else /* ndef DEV_HWMOM */ -#define DEV_SENSORS 2 /* The id of the lm_sensors directory within the - dev table */ -#endif /* def DEV_HWMON */ - -/* The maximum length of the prefix */ -#define SENSORS_PREFIX_MAX 20 - -#define SENSORS_CHIPS 1 -struct i2c_chips_data { - int sysctl_id; - char name[SENSORS_PREFIX_MAX + 13]; -}; - - diff --git a/kernel/include/sensors_compat.h b/kernel/include/sensors_compat.h deleted file mode 100644 index ccde2b82..00000000 --- a/kernel/include/sensors_compat.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Stolen from kernel 2.5.69 - * device.h - generic, centralized driver model - * To make it easier to backport from 2.5 - * - * Copyright (c) 2001-2003 Patrick Mochel - * - */ - -#ifndef _SENSORS_COMPAT_H_ -#define _SENSORS_COMPAT_H_ - -#include - -/* debugging and troubleshooting/diagnostic helpers. */ -#define dev_printk(level, dev, format, arg...) \ - printk(level "%s: " format , (dev)->name , ## arg) - -#ifdef DEBUG -#define dev_dbg(dev, format, arg...) \ - dev_printk(KERN_DEBUG , dev , format , ## arg) -#else -#define dev_dbg(dev, format, arg...) do {} while (0) -#endif - -#define dev_err(dev, format, arg...) \ - dev_printk(KERN_ERR , dev , format , ## arg) -#define dev_info(dev, format, arg...) \ - dev_printk(KERN_INFO , dev , format , ## arg) -#define dev_warn(dev, format, arg...) \ - dev_printk(KERN_WARNING , dev , format , ## arg) - - -/* The part below, taken from linux/init.h, is required for compatibility with - kernels 2.4.16 and older, which don't know about __devexit_p. */ - -/* Functions marked as __devexit may be discarded at kernel link time, depending - on config options. Newer versions of binutils detect references from - retained sections to discarded sections and flag an error. Pointers to - __devexit functions must use __devexit_p(function_name), the wrapper will - insert either the function_name or NULL, depending on the config options. - */ -#ifndef __devexit_p -#if defined(MODULE) || defined(CONFIG_HOTPLUG) -#define __devexit_p(x) x -#else -#define __devexit_p(x) NULL -#endif -#endif /* __devexit_p */ - -#endif /* _SENSORS_COMPAT_H_ */ diff --git a/kernel/include/sensors_vid.h b/kernel/include/sensors_vid.h deleted file mode 100644 index 81b36b66..00000000 --- a/kernel/include/sensors_vid.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - sensors_vid.h - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 2002-2004 Mark D. Studebaker - With assistance from Trent Piepho - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - This file contains common code for decoding VID pins. - This file is #included in various sensor chip drivers. - As the user is unlikely to load more than one driver which - includes this code we don't worry about the wasted space. - References: VRM x.y DC-DC Converter Design Guidelines, - VRD 10.0 Design Guide, - available at http://developer.intel.com -*/ - -/* - AMD Opteron processors don't follow the Intel VRM spec. - I'm going to "make up" 2.4 as the VRM spec for the Opterons. - No good reason just a mnemonic for the 24x Opteron processor - series - - Opteron VID encoding is: - - 00000 = 1.550 V - 00001 = 1.525 V - . . . . - 11110 = 0.800 V - 11111 = 0.000 V (off) - */ - -/* - Legal val values 00 - 1F except for VRD 10.0, 0x00-0x3f. - vrm is the Intel VRM document version. - Note: vrm version is scaled by 10 and the return value is scaled by 1000 - to avoid floating point in the kernel. -*/ - -static inline int vid_from_reg(int val, int vrm) -{ - int vid; - - switch(vrm) { - - case 100: /* VRD 10.0 */ - val &= 0x3f; - if((val & 0x1f) == 0x1f) - return 0; - if((val & 0x1f) <= 0x09 || val == 0x0a) - vid = 10875 - (val & 0x1f) * 250; - else - vid = 18625 - (val & 0x1f) * 250; - if(val & 0x20) - vid -= 125; - vid /= 10; /* only return 3 dec. places for now */ - return vid; - - case 24: /* Opteron processor */ - val &= 0x1f; - return(val == 0x1f ? 0 : 1550 - val * 25); - - case 91: /* VRM 9.1 */ - case 90: /* VRM 9.0 */ - val &= 0x1f; - return(val == 0x1f ? 0 : - 1850 - val * 25); - - case 85: /* VRM 8.5 */ - val &= 0x1f; - return((val & 0x10 ? 25 : 0) + - ((val & 0x0f) > 0x04 ? 2050 : 1250) - - ((val & 0x0f) * 50)); - - case 84: /* VRM 8.4 */ - val &= 0x0f; - /* fall through */ - default: /* VRM 8.2 */ - val &= 0x1f; - return(val == 0x1f ? 0 : - val & 0x10 ? 5100 - (val) * 100 : - 2050 - (val) * 50); - } -} diff --git a/kernel/sensors.c b/kernel/sensors.c deleted file mode 100644 index 6b0e7014..00000000 --- a/kernel/sensors.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - sensors.c - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - diff --git a/lm_sensors.lsm b/lm_sensors.lsm index 96b1f3cb..f197b53a 100644 --- a/lm_sensors.lsm +++ b/lm_sensors.lsm @@ -3,14 +3,11 @@ Title: lm_sensors Version: 2.10.3 Entered-date: 29DEC98 Description: Hardware health monitoring package for Linux. It consists of - kernel modules to access sensor chips and SMBus hardware, - of a library to allow applications to read this data more + a library to allow applications to read sensors data more easily, and of an example program to pretty print this data. - LM78, LM79, LM80, W83781D and GL518SM sensor chips are - supported, among others. Version 2 is a complete non-compatible modular rewrite of this package. -Keywords: kernel module SMBus sensors LM78 health +Keywords: sensors health Author: frodol@dds.nl (Frodo Looijaard) phil@netroedge.com (Philip Edelbrock) and other great contributors From 314c674660d3cd55ac770433c8dc94ffa97856c7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 13 May 2007 08:22:47 +0000 Subject: [PATCH 027/718] Legacy hotplug modules and documentation: Delete. These modules no longer work with 2.6 kernels. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4402 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/hotplug/Makefile | 24 --- prog/hotplug/Makefile.p4b | 64 ------- prog/hotplug/README | 112 ----------- prog/hotplug/README.p4b | 96 ++-------- prog/hotplug/m7101.c | 391 -------------------------------------- prog/hotplug/p4b_smbus.c | 340 --------------------------------- 7 files changed, 14 insertions(+), 1014 deletions(-) delete mode 100644 prog/hotplug/Makefile delete mode 100644 prog/hotplug/Makefile.p4b delete mode 100644 prog/hotplug/README delete mode 100644 prog/hotplug/m7101.c delete mode 100644 prog/hotplug/p4b_smbus.c diff --git a/CHANGES b/CHANGES index 46c4d34f..17bd3d4a 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm_sensors CHANGES file SVN HEAD All bus modules and documentation: Delete All chip modules and documentation: Delete + Legacy hotplug modules and documentation: Delete File doc/version-2: Delete, obsolete File sensors.conf.eg: Add a dme1737 section File lm_sensors.sysconfig: Delete, now generated by sensors-detect diff --git a/prog/hotplug/Makefile b/prog/hotplug/Makefile deleted file mode 100644 index 1aa4b896..00000000 --- a/prog/hotplug/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -INCLUDEDIR = /usr/include - -# Compile with Debugging turned on - watch out, lots of pci device infos. -CFLAGS = -D__KERNEL__ -DMODULE -DLINUX -DM7101_DEBUG -O2 -Wall -I$(INCLUDEDIR) -# CFLAGS := -D__KERNEL__ -DMODULE -DLINUX -O2 -Wall -I$(INCLUDEDIR) - -CC := gcc -LD := ld - -# extract versionnumber from version.h -VER = $(shell awk -F\" '/REL/ {print $$2}' $(INCLUDEDIR)/linux/version.h) - -OBJS = m7101.o - -all: $(OBJS) - -%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ - -install: all - install -m 644 $(OBJS) /lib/modules/$(VER)/kernel/drivers/i2c/busses - -clean: - rm -f $(OBJS) diff --git a/prog/hotplug/Makefile.p4b b/prog/hotplug/Makefile.p4b deleted file mode 100644 index 42242597..00000000 --- a/prog/hotplug/Makefile.p4b +++ /dev/null @@ -1,64 +0,0 @@ -# pcwd Kernel Module Makefile -# - -VERSION=1.40 - -# The currently running kernel version. This is used right below to -# determine where the kernel sources can be found. -KERNELVERSION := $(shell uname -r) - -# The location of linux itself. This is used to find the kernel headers -# and other things. -#LINUX := /usr/src/linux -LINUX := /lib/modules/$(KERNELVERSION)/build -LINUX_HEADERS := $(LINUX)/include - -# Uncomment the third line on SMP systems if the magic invocation fails. It -# is a bit complicated because SMP configuration changed around kernel 2.1.130 -SMP := $(shell if grep -q '^SMP[[:space:]]*=' $(LINUX)/Makefile || \ - grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_SMP[[:space:]]*1' $(LINUX_HEADERS)/linux/autoconf.h ; \ - then echo 1; else echo 0; fi) -#SMP := 0 -#SMP := 1 - -# Uncomment the second or third line if the magic invocation fails. -# We need to know whether CONFIG_MODVERSIONS is defined. -MODVER := $(shell if cat $(LINUX_HEADERS)/linux/config.h $(LINUX_HEADERS)/linux/autoconf.h 2>/dev/null | grep -q '^[[:space:]]*\#define[[:space:]]*CONFIG_MODVERSIONS[[:space:]]*1'; then echo 1; else echo 0; fi) -#MODVER := 0 -#MODVER := 1 - -MODCPPFLAGS := - -ifeq ($(SMP),1) -MODCPPFLAGS += -D__SMP__ -endif - -ifeq ($(MODVER),1) -MODCPPFLAGS += -DMODVERSIONS -include $(LINUX_HEADERS)/linux/modversions.h -endif - -CFLAGS := $(MODCPPFLAGS) -D__KERNEL__ -DMODULE -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -I$(LINUX_HEADERS) - -OBJS = p4b_smbus.o - -all: $(OBJS) - -install: all - install -d /lib/modules/$(KERNELVERSION)/kernel/drivers/i2c/busses - install -c p4b_smbus.o /lib/modules/$(KERNELVERSION)/kernel/drivers/i2c/busses -# test ! -x /dev/watchdog || mknod -m 600 /dev/watchdog c 10 130 -# test ! -x /dev/temperature || mknod -m 600 /dev/temperature c 10 131 - -inst: all - rmmod p4b_smbus - install -d /lib/modules/$(KERNELVERSION)/kernel/drivers/i2c/busses - install -c p4b_smbus.o /lib/modules/$(KERNEL)/kernel/drivers/i2c/busses - depmod -a -# modprobe p4b_smbus - -clean: - rm -f *.o *~ core - -cleandist: - rm -f *.o *~ core - diff --git a/prog/hotplug/README b/prog/hotplug/README deleted file mode 100644 index d0f9d7ca..00000000 --- a/prog/hotplug/README +++ /dev/null @@ -1,112 +0,0 @@ -Files in this directory: - -* m7101.c - M7101 - SMBus Support for ALi M15x3 based motherboards. - -* README.p4b - More detailed information for files below. - -* p4b_smbus.c - 2.4 Kernel module which unhides the bus for ASUS boards. - -* unhide_ICH_SMBus - Script which unhides the bus for 2.6 kernel. - --------------------------------------------------------- -Quick Start (2.4 kernels only): - - Verify that hotplug is enabled in your kernel (general setup) - and reconfigure/rebuild/reinstall kernel if not - "lspci" to verify that 7101 device is not present - "make" - (as root) "make install" - (as root) "insmod m7101" - "lspci" to verify that 7101 device is present - --------------------------------------------------------- --------------------------------------------------------- - -Version 0.2 for 2.4.0-testx kernels. -Mark D. Studebaker - -*** You must have 'Support for hot-pluggable devices' enabled -*** in your kernel (under 'general setup') for this module to work!! - -For 2.2 and early 2.3 kernels you must use version 0.1; -version 0.2 will not work. -Version 0.1 does not use the kernel hotplug facility. - --------------------------------------------------------- -Notes below for the 0.2 version, MDS. --------------------------------------------------------- -Default I/O addresses are 0xe800 for SMBus and 0xec00 for ACPI. - -These can be changed at module insertion. -For example: - insmod m7101 smb_io=0x5000 acpi_io=0x4000 - - --------------------------------------------------------- -Notes below from the 0.1 version, B. Kohl. --------------------------------------------------------- - -This module was written to enable SMBus support on ALi M15x3 chipset based -motherboards. Although it was written for and tested on Gigabytes GA-5AX -it should work on any M15x3 chipset based board. - -Probably most people trying this software on a GA-5AX will be utterly -disappointed. We have seen no sensor chips on this board - only DIMMs -were connected to the SMBus. If you are trying to make lm_sensors read -temperature and voltage values you will be pretty lost. - -CAVEAT: To perform it's task this module needs to manipulate PCI-config -data and device structures on a very low level. This bears the risk of -causing havoc to your system in case anything goes wrong. Use this soft- -ware absolutely at your own risk. - - -Installation: -Untar the m7101.tgz file into an appropriate location and cd into the -m7101 subdirectory. Then type "make" to build the module file 'm7101.o'. -To insert it type - $ insmod m7101.o -as root. - -If everything goes well (no error messages) you will see a description like -the following when doing 'lspci -v': - -00:03.0 Non-VGA unclassified device: Acer Laboratories Inc. [ALi] M7101 PMU - Flags: medium devsel - I/O ports at 4000 - I/O ports at 5000 - -and find an entry in the proc filesystem under /proc/bus/pci/00/03.0. - - -Removing the module removes the M7101 device from the proc file system -and switches the SMBus support off. - -The lm_sensors software now should be able to access devices on the -motherboard's SMBus through the M7101. - -Values for the ACPI-IO port (normally 0x4000) and the SMBus-IO port -(normally 0x5000) can be specified using the parameters acpi_io and -smbus_io respectively on the insmod command line. -The module defaults to ports 0xec00 and 0xe800. - -In case the module does not load you might want to switch on debugging -by uncommenting the second CFLAGS-line (with the -DM7101_DEBUG switch) -in the Makefile. - -This module was written to activate SMBus support. I don't know neither -have I tested wether it works with the software from the ACPI project. - -Note: Egcs compilers with versions below 2.95.2 do not compile properly. -Use either 2.95.2 or gcc 2.7.2.x. - -I have tested this module with 2.2 kernels up to version 2.2.14. - - -I wish to thank Frank Bauer for his help with this module. - -Burkhard Kohl (burkhard.kohl@gmx.de) diff --git a/prog/hotplug/README.p4b b/prog/hotplug/README.p4b index e3cf3c23..eb43a0e7 100644 --- a/prog/hotplug/README.p4b +++ b/prog/hotplug/README.p4b @@ -1,13 +1,15 @@ What is it? ----------- -It unhides the SMBus of Intel ICH southbridges hidden -on ASUS P4B series. It is implemented as a module (p4b_smbus.o), -or a shell script for the 2.6 kernel (unhide_ICH_SMBus). +It unhides the SMBus of Intel ICH southbridges hidden on Asus P4B series +and some other Asus and non-Asus systems. It is implemented as a shell +script for the 2.6 kernel: unhide_ICH_SMBus. It works with the following chips: * ICH2 (82801BA) * ICH2-M (82801BAM) + * ICH3 (82801CA) + * ICH3-M (82801CAM) * ICH4 (82801DB) * ICH4-M (82801DBM) * ICH5 (82801EB) @@ -17,13 +19,15 @@ with the German support and learned that: "We do not want the users to be irritated by just another PCI Device in the Win98 device manager." Really funny :-). -This module is for 2.4 kernels only. For 2.6 kernels, activation is -handled by the code in drivers/pci/quirks.c in the kernel source. If you -have the 2.6 kernel and the quirks code does not activate your SMBus, -you may: +For 2.6 kernels, activation is normally handled by the code in +drivers/pci/quirks.c in the kernel source. If you have the 2.6 kernel and +the quirks code does not activate your SMBus, you may: - * check if you have kernel version from 2.6.17 to 2.6.19 - If so you, need to disable ACPI sleep support and recompile kernel. + * first of all, read the paragraph "Hidden ICH SMBus" in + Documentation/i2c/busses/i2c-i801 in the kernel source. + + * check if you have kernel version from 2.6.16 to 2.6.19 + If so, you need to disable ACPI sleep support and recompile kernel. If you don't use suspend try below instead of recompilation. * run as root the ./unhide_ICH_SMBus script. It will unhide the bus @@ -33,77 +37,3 @@ you may: * if above script works and you have latest kernel, you may try to fix the quirks.c, recompile and test your new kernel, and then submit a patch to us. Contact us if you need assistance. - -Information for 2.4 users continues below. - -NOTE: As of kernel 2.4.23, the kernel activates the SMBus PCI device -on the following boards: - * Asus P4B - * Asus P4B533 - * Asus P4PE - * Asus P4T533 - * Asus P4G8X Deluxe -So this module is no longer required for these boards. For the other -affected boards, it still is. - -What does the module do? ------------------------- -(Note: the following instructions assume the ICH2. For the ICH4, -the PCI IDs are 24C0 and 24C3) - -It turnes off (!) the bits number 8 and 3 in the LPC register of the ICH2. -This you can also try as root with setpci and pcitweak. -First do a: - -setpci -d 8086:2440 f2.w - -You will get an hex number VAL - in my case 148 (Hex)-, where you have to -erase the two bits - in my case you get 40 (Hex). -Then do a: - -setpci -d 8086:2440 f2.w=VAL - -Running "lspci -n" you will not see any new device, but with "pcitweak -l" you -should get a line similar to this in the output: - -PCI: 00:1f:3: chip 8086,2443 card 1043,8028 rev 12 class 0c,05,00 hdr 00 - -The important thing is the "8086,2443" here. -The device is activated, but not included in /proc/pci and -/proc/bus/pci/devices. This is the reason for running the module. - -What are the system requirements? ---------------------------------- - -- Obviously a board with Intel i801BA/DB/EB ICH2/4/5 with broken BIOS. -- A linux working with a 2.4 kernel AND hotplug support in it! -- A installed kernel tree and gcc. -- i2c and sensor modules installed. - -How to install? ---------------- - -Simply do a: - -make -f Makefile.p4b -insmod p4b_smbus.o -modprobe i2c-core -modprobe i2c-i801 -modprobe i2c-dev -modprobe i2c-proc - -Then run your sensor: - -modprobe w83781d - -What should i never do? ------------------------ - -Do not try to do a "rmmod p4b_smbus" before a "rmmod i2c-i801". -The other way around should be okay. Otherwise you remove the PCI device -without notifying the i2c driver. - - -------------------------------- -Ilja Rauhut - diff --git a/prog/hotplug/m7101.c b/prog/hotplug/m7101.c deleted file mode 100644 index a7e4a977..00000000 --- a/prog/hotplug/m7101.c +++ /dev/null @@ -1,391 +0,0 @@ -/* - * m7101.c - * - * Initialize the M7101 device on ALi M15x3 Chipsets - */ -/* - Copyright (c) 2000 Burkhard Kohl , - Frank Bauer , and - Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* CHANGES: - * 030799 FB: created this file - * frank.bauer@nikocity.de - * - * 110799 BK: messed it up to insert the M7101 dev after boot - * buk@buks.ipn.de - * - * 160799 BK: grouped portions of the code into functions - * - * June 21, 2000 MDS: Add Copyright and GPL comments, - * distribute as release 0.1. - * - * Sept 21, 2000 MDS: Rewrite to use kernel hotplug facility, - * (similar to drivers/pcmcia/cardbus.c), - * fix makefile so it will compile, - * distribute as release 0.2. - * - * This code is absolutely experimental - use it at your own - * risk. - * - * Warning, this module will work only with 2.4.x kernels. - * If it works with earlier kernels then it is by luck. - * - * Warning, this module does not work with egcs < 2.95.2, use - * gcc > 2.7.2 or egcs >= 2.95.2. - * - */ - - -#ifdef M7101_DEBUG -#define DBG(x...) printk(x) -#else -#define DBG(x...) -#endif - -#ifndef TRUE -#define TRUE 1 -#define FALSE !TRUE -#endif - -#include -#ifndef CONFIG_HOTPLUG -#error ERROR - You must have 'Support for hot-pluggable devices' enabled in your kernel (under 'general setup')!! -#endif - -/* Deal with CONFIG_MODVERSIONS */ -#ifdef CONFIG_MODVERSIONS -#define MODVERSIONS -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - from lm_sensors-2.3.3: - */ -#define SMBHSTCFG 0x0E0 -/* PCI Address Constants */ -#define SMBATPC 0x05B /* used to unlock xxxBA registers */ -/* ALI15X3 address lock bits */ -#define ALI15X3_LOCK 0x06 - -/* - addresses the i/o space gets mapped to, - for M1543C, Bits 16-31 are supposed to be zero - */ -#define ACPI_IO_SIZE 0x40 -#define SMB_IO_SIZE 0x20 -#define ACPI_BASE 0x0 -#define SMB_BASE 0x1 -static u32 acpi_io = 0xEC00; /* Set I/O Base defaults here */ -static u32 smb_io = 0xE800; -MODULE_PARM(acpi_io, "l"); -MODULE_PARM(smb_io, "l"); -#ifdef M7101_DEBUG -static int debug = 0; -MODULE_PARM(debug, "i"); -#endif - -/* status, used to indicate that io space needs to be freed */ -static struct pci_dev *m7101 = NULL; -static int m7101_inserted = FALSE; -extern void cleanup_module(); - -static rwlock_t m7101_lock = RW_LOCK_UNLOCKED; -static unsigned long m7101_lock_flags = 0; - - -#ifdef M7101_DEBUG -static void -dump_dev_data(struct pci_dev *dev, int address_data) -{ - if (dev != NULL) { - printk("m7101: devfn: 0x%4x class: 0x%4x\n", - dev->devfn, dev->class); - printk("m7101: vendor: 0x%4x device: 0x%4x\n", - dev->vendor, dev->device); - - if (address_data) { - printk("m7101: resource[0]: 0x%08lx resource[1]: 0x%08lx\n", - dev->resource[0].start, dev->resource[1].start); - printk("m7101: resource[2]: 0x%08lx resource[3]: 0x%08lx\n", - dev->resource[2].start, dev->resource[3].start); - printk("m7101: resource[4]: 0x%08lx resource[5]: 0x%08lx\n", - dev->resource[4].start, dev->resource[5].start); - printk("m7101: rom_address: 0x%08lx\n", - dev->resource[PCI_ROM_RESOURCE].start); - } - } -} -#endif - -/* - * Checks whether PMU and SMB are enabled and turns them on in case they are not. - * It's done by clearing Bit 2 in M1533 config space 5Fh. - * I/O - */ -static int -m7101_enable(struct pci_dev *dev){ - u8 val = 0; - - pci_read_config_byte(dev, 0x5F, &val); - DBG("m7101: M7101 config byte reading 0x%X.\n", val); - if (val & 0x4) { - pci_write_config_byte(dev, 0x5F, val & 0xFB); - pci_read_config_byte(dev, 0x5F, &val); - if(val & 0x4) { - DBG("m7101: Can't enable PMU/SMB, config byte locked:-(\n"); - return -EIO; - } - } - return 0; - -} - -/* - * Builds the basic pci_dev for the M7101 - */ -static int -m7101_build(struct pci_dev **m7101, struct pci_bus *bus) -{ - u32 devfn; - u16 id = 0; - u16 vid = 0; - int ret; - - DBG("m7101: requesting kernel space for the m7101 entry.\n"); - *m7101 = kmalloc(sizeof(**m7101), GFP_ATOMIC); - if(NULL == *m7101) { - printk("m7101: out of memory.\n"); - return -ENOMEM; - } - - /* minimally fill in structure for search */ - /* The device should be on the same bus as the M1533. */ - memset(*m7101, 0, sizeof(**m7101)); - (*m7101)->bus = bus; - (*m7101)->sysdata = bus->sysdata; - (*m7101)->hdr_type = PCI_HEADER_TYPE_NORMAL; - - DBG("m7101: now looking for M7101.\n"); - for (id = 0, devfn = 0; devfn < 0xFF; devfn++) { - (*m7101)->devfn = devfn; - ret = pci_read_config_word(*m7101, PCI_DEVICE_ID, &id); - if (ret == 0 && PCI_DEVICE_ID_AL_M7101 == id) { - pci_read_config_word(*m7101, PCI_VENDOR_ID, &vid); - if(vid == PCI_VENDOR_ID_AL) - break; - } - } - if (PCI_DEVICE_ID_AL_M7101 != id) { - DBG("m7101: M7101 not found although M1533 present - strange.\n"); - return -EACCES; - } else { - DBG("m7101: M7101 found and enabled. Devfn: 0x%X.\n", devfn); - } - /* We now have the devfn and bus of the M7101 device. - * let's put the rest of the device data together. - */ - - (*m7101)->vendor = PCI_VENDOR_ID_AL; - (*m7101)->hdr_type = PCI_HEADER_TYPE_NORMAL; - (*m7101)->device = PCI_DEVICE_ID_AL_M7101; - return(pci_setup_device(*m7101)); -} - -/* - * unlock the address registers if necessary - */ -static int -m7101_unlock_registers(struct pci_dev *m7101) -{ - u8 val = 0; - - if (pci_read_config_byte(m7101, SMBATPC, &val)) { - DBG("m7101: failed to read SMBATPC\n"); - return -EIO; - } else { - if(val & ALI15X3_LOCK) { - DBG("m7101: need to unlock the address registers\n"); - val &= ~ALI15X3_LOCK; - if (pci_write_config_byte(m7101, SMBATPC, val)) { - DBG("m7101: failed to write SMBATPC\n"); - return -EIO; - } - } - } - - return 0; -} - - -static int -m7101_set_io_address(struct pci_dev *m7101, u32 addr, int base_idx, int size) -{ - if (!addr) { - printk("m7101: Sorry - cannot assign address 0 to region.\n"); - return -EINVAL; - } - if (check_region(addr, size)) { - printk("m7101: Requested IO-region 0x%x already in use.\n", addr); - return -EBUSY; - } else { - m7101->resource[base_idx].start = addr; - } - - return 0; -} - - -/* Initialize the module */ -int init_module(void) -{ - struct pci_bus *bus = NULL; - struct pci_dev *dev = NULL; - u32 acpi_addr = 0, smb_addr = 0; - int ret = 0; - - DBG("m7101: init_module().\n"); - - /* Are we on a PCI-Board? */ - if (!pci_present()) { - printk("m7101: No PCI bus found - sorry.\n"); - return -ENODEV; - } - - /* We want to be sure that the M7101 is not present yet. */ - dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); - if (dev) { - printk("m7101: M7101 already present, no need to run this module.\n"); -#ifdef M7101_DEBUG - if(debug) - { - printk("m7101: removing device for testing\n"); - pci_remove_device(dev); - m7101_inserted = 0; - return 0; - } - else -#endif - return -EPERM; - } - - /* Are we operating a M15x3 chipset */ - dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); - if (NULL == dev) { - printk("m7101: ALi M15xx chipset not found.\n"); - return -ENODEV ; - } - /* we need the bus pointer later */ - bus = dev->bus; - - if ( (ret = m7101_enable(dev)) ) { - printk("m7101: Unable to turn on M7101 device - sorry!\n"); - return ret; - } - - if ( (ret = m7101_build(&m7101, bus)) ){ - return ret; - } - - /* thus, now we have a rudimentary dev for M7101 ... */ - /* check wether register need to be unlocked. */ - if ( (ret = m7101_unlock_registers(m7101)) ){ - return ret; - } - - /* - * Handle address assignment for ACPI_IO - * If address is already assigned do nothing. - */ - acpi_addr = m7101->resource[ACPI_BASE].start; - if (!acpi_addr) { - acpi_io |= PCI_BASE_ADDRESS_SPACE_IO; - ret = m7101_set_io_address(m7101, acpi_io,ACPI_BASE, ACPI_IO_SIZE); - if (ret) - return ret; - acpi_addr = acpi_io; - } - - /* - * Handle address assignment for SMB_IO - * If address is already assigned then do nothing. - */ - smb_addr = m7101->resource[SMB_BASE].start; - if (!smb_addr) { - smb_io |= PCI_BASE_ADDRESS_SPACE_IO; - ret = m7101_set_io_address(m7101, smb_io, SMB_BASE, SMB_IO_SIZE); - if (ret) - return ret; - smb_addr = smb_io; - } - -#ifdef M7101_DEBUG - dump_dev_data(m7101, 1); -#endif - - - if ( (ret = pci_enable_device(m7101)) ) { - printk("m7101: Unable to pci_enable M7101 device!\n"); - return ret; - } - - DBG("m7101: now inserting.\n"); - pci_insert_device(m7101, m7101->bus); - printk("m7101: Enabled with ACPI I/O address 0x%04X and SMB I/O address 0x%04X\n", - acpi_addr, smb_addr); - m7101_inserted = TRUE; - - return 0; -} - - -void cleanup_module() -{ - write_lock_irqsave(m7101_lock, m7101_lock_flags); - if (m7101_inserted) { - pci_remove_device(m7101); - m7101_inserted = FALSE; - } - write_unlock_irqrestore(m7101_lock, m7101_lock_flags); - - if (NULL != m7101) - kfree(m7101); - - printk("m7101: bye bye\n"); -} - -EXPORT_NO_SYMBOLS; - -#ifdef MODULE -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif -MODULE_AUTHOR("Burkhard Kohl , " - "Frank Bauer , " - "and Mark Studebaker "); -MODULE_DESCRIPTION("M7101 PCI Inserter"); - -#endif /* MODULE */ diff --git a/prog/hotplug/p4b_smbus.c b/prog/hotplug/p4b_smbus.c deleted file mode 100644 index 9f3e96c0..00000000 --- a/prog/hotplug/p4b_smbus.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * p4b_smbus.c - * - * Initialize the SMBus device on ICH2/2-M/4/4-M/5 (82801BA/BAM/DB/DBM/EB) - */ -/* - Copyright (c) 2002 Ilja Rauhut and - Klaus Woltereck , - - Based on the m7101.c hotplug example by: - - Copyright (c) 2000 Burkhard Kohl , - Frank Bauer , and - Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* CHANGES: - * February 13,2002 IR First Version - * - * This code is absolutely experimental - use it at your own - * risk. - * - * Warning, this module will work only with 2.4.x kernels. - * If it works with earlier kernels then it is by luck. - * - * Warning, this module does not work with egcs < 2.95.2, use - * gcc > 2.7.2 or egcs >= 2.95.2. - * - * - * June 21, 2002, added support for the ICH4, code clean up -- Klaus - * - * Apr 13, 2004, modified for ICH4-M (82801DBM) -- Axel Thimm - * bugfix: register F2/bit 8 on ICH2* is bit 0 on ICH4* - * - * Jan 6, 2007, added support for the ICH5 -- Jean Delvare - */ - - -#ifdef P4Bsmbus_DEBUG -#define DBG(x...) printk(x) -#else -#define DBG(x...) -#endif - -#ifndef TRUE -#define TRUE 1 -#define FALSE !TRUE -#endif - -#include -#ifndef CONFIG_HOTPLUG -#error ERROR - You must have 'Support for hot-pluggable devices' enabled in your kernel (under 'general setup')!! -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/* -rmm from lm_sensors-2.3.3: - */ - -#define SMB_IO_SIZE 0xF -#define SMB_BASE 0x20 - - -/* - * some shorter definitions for the ICHx PCI device IDs - */ - -#define ICH2 0x2440 -#define ICH2_M 0x244c -#define ICH2_SMBUS 0x2443 - -#define ICH4 0x24c0 -#define ICH4_M 0x24cc -#define ICH4_SMBUS 0x24c3 - -#define ICH5 0x24d0 -#define ICH5_SMBUS 0x24d3 - -#define is_supported_smbus(id) \ - ((id) == ICH2_SMBUS || \ - (id) == ICH4_SMBUS || \ - (id) == ICH5_SMBUS) - -/* status, used to indicate that io space needs to be freed */ -static struct pci_dev *i801smbus = NULL; -static int i801smbus_inserted = FALSE; -extern void cleanup_module(void); - -static rwlock_t i801smbus_lock = RW_LOCK_UNLOCKED; -static unsigned long i801smbus_lock_flags = 0; - -/* - * Checks whether SMBus is enabled and turns it on in case they are not. - * It's done by modifying the i801 function disable register, F2h. - * ICH2(-M): PCI-Device 0x8086:0x2440(0x244c) - * Bit 3: Disables SMBus Host Controller function. - * Bit 8: allows SMBus I/O space to be accessible when Bit 3 is set. - * ICH4(-M): PCI-Device 0x8086:0x24c0(0x24cc) - * Bit 3: Disables SMBus Host Controller function. - * Bit 0: allows SMBus I/O space to be accessible when Bit 3 is set. - * ICH5: PCI-Device 0x8086:0x24d0 - * Same as ICH4. - */ -static int -i801smbus_enable(struct pci_dev *dev, u16 testmask, u16 mask){ - u16 val = 0; - - pci_read_config_word(dev, 0xF2, &val); - DBG("i801smbus: i801smbus config byte reading 0x%X.\n", val); - if (val & testmask) { - pci_write_config_word(dev, 0xF2, val & mask); - pci_read_config_word(dev, 0xF2, &val); - if(val & testmask) - { - DBG("i801smbus: i801smbus config byte locked:-(\n"); - return -EIO; - } - else - printk("i801smbus: SMBus activated in LPC!\n"); - } - return 0; - -} - -/* - * Builds the basic pci_dev for the i801smbus - */ -static int i801smbus_build(struct pci_dev **i801smbus, struct pci_bus *bus) -{ - u32 devfn; - u16 id = 0; - u16 vid = 0; - int ret; - - DBG("i801smbus: requesting kernel space for the i801smbus entry.\n"); - *i801smbus = kmalloc(sizeof(**i801smbus), GFP_ATOMIC); - if(NULL == *i801smbus) { - printk("i801smbus: out of memory.\n"); - return -ENOMEM; - } - - /* minimally fill in structure for search */ - /* The device should be on the same bus as the i801. */ - memset(*i801smbus, 0, sizeof(**i801smbus)); - (*i801smbus)->bus = bus; - (*i801smbus)->sysdata = bus->sysdata; - (*i801smbus)->hdr_type = PCI_HEADER_TYPE_NORMAL; - - DBG("i801smbus: now looking for i801smbus.\n"); - for (id = 0, devfn = 0; devfn < 0xFF; devfn++) { - (*i801smbus)->devfn = devfn; - ret = pci_read_config_word(*i801smbus, PCI_DEVICE_ID, &id); - if (ret == 0 && is_supported_smbus(id)) { - pci_read_config_word(*i801smbus, PCI_VENDOR_ID, &vid); - if(vid == 0x8086) - break; - } - } - if (!is_supported_smbus(id)) { - DBG("i801smbus: i801smbus not found although i801 present - strange.\n"); - return -EACCES; - } else { - DBG("i801smbus: i801smbus found and enabled. Devfn: 0x%X.\n", devfn); - } - /* We now have the devfn and bus of the i801smbus device. - * let's put the rest of the device data together. - */ - - (*i801smbus)->vendor = 0x8086; - (*i801smbus)->hdr_type = PCI_HEADER_TYPE_NORMAL; - (*i801smbus)->device = id; - - return(pci_setup_device(*i801smbus)); -} - - - - -/* Initialize the module */ -int init_module(void) -{ - struct pci_bus *bus = NULL; - struct pci_dev *dev = NULL; - int ret = 0; - u16 testmask = 0, mask = 0; - - DBG("i801smbus: init_module().\n"); - - /* Are we on a PCI-Board? */ - if (!pci_present()) { - printk("i801smbus: No PCI bus found - sorry.\n"); - return -ENODEV; - } - - /* We want to be sure that the i801smbus is not present yet. */ - dev = pci_find_device(0x8086, ICH2_SMBUS, NULL); - - if (dev) - { - printk("i801smbus: SMBus already active\n"); - return -EPERM; - } - - dev = pci_find_device(0x8086, ICH4_SMBUS, NULL); - - if (dev) - { - printk("i801smbus: SMBus already active\n"); - return -EPERM; - } - - dev = pci_find_device(0x8086, ICH5_SMBUS, NULL); - - if (dev) - { - printk("i801smbus: SMBus already active\n"); - return -EPERM; - } - - /* Are we operating a i801 chipset */ - if ((dev = pci_find_device(0x8086, ICH2, NULL)) != 0) - { - printk("i801smbus: found Intel ICH2 (82801BA).\n"); - testmask = 0x008; - mask = 0xfef7; - } - else if ((dev = pci_find_device(0x8086, ICH2_M, NULL)) != 0) - { - printk("i801smbus: found Intel ICH2-M (82801BAM).\n"); - testmask = 0x008; - mask = 0xfef7; - } - else if ((dev = pci_find_device(0x8086, ICH4, NULL)) != 0) - { - printk("i801smbus: found Intel ICH4 (82801DB).\n"); - testmask = 0x008; - mask = 0xfff6; - } - else if ((dev = pci_find_device(0x8086, ICH4_M, NULL)) != 0) - { - printk("i801smbus: found Intel ICH4-M (82801DBM).\n"); - testmask = 0x008; - mask = 0xfff6; - } - else if ((dev = pci_find_device(0x8086, ICH5, NULL)) != 0) - { - printk(KERN_INFO "i801smbus: Found Intel ICH5 (82801EB)\n"); - testmask = 0x008; - mask = 0xfff6; - } - else - { - printk(KERN_NOTICE "i801smbus: No supported Intel ICH (82801) " - "chip found\n"); - return -ENODEV ; - } - - /* we need the bus pointer later */ - bus = dev->bus; - - - if ( (ret = i801smbus_enable(dev, testmask, mask)) ) - { - printk("i801smbus: Unable to turn on i801smbus device - sorry!\n"); - return ret; - } - - if ( (ret = i801smbus_build(&i801smbus, bus)) ) - return ret; - - - if ( (ret = pci_enable_device(i801smbus)) ) { - printk("i801smbus: Unable to pci_enable i801smbus device!\n"); - return ret; - } - - DBG("i801smbus: now inserting.\n"); - pci_insert_device(i801smbus, i801smbus->bus); - printk("i801smbus: Enabled\n"); - i801smbus_inserted = TRUE; - return 0; -} - - -void cleanup_module(void) -{ - write_lock_irqsave(&i801smbus_lock, i801smbus_lock_flags); - if (i801smbus_inserted) { - pci_remove_device(i801smbus); - i801smbus_inserted = FALSE; - } - write_unlock_irqrestore(&i801smbus_lock, i801smbus_lock_flags); - - if (NULL != i801smbus) - { - kfree(i801smbus); - } - printk("i801smbus: SMBus device removed\n"); -} - -EXPORT_NO_SYMBOLS; - -#ifdef MODULE -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif -MODULE_AUTHOR("Ilja Rauhut , " - "Burkhard Kohl , " - "Frank Bauer , " - "Mark Studebaker ," - "and Klaus Woltereck "); -MODULE_DESCRIPTION("i801smbus PCI Inserter"); - -#endif /* MODULE */ From 5a38143c5e56c3c042660d705ae2559f42309a79 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 13 May 2007 15:02:44 +0000 Subject: [PATCH 028/718] libsensors: Drop support for non-sensor drivers: ddcmon and eeprom. These should never have been supported to start with, and no longer are in practice with recent 2.6 kernels. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4403 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/chips.c | 268 ---------------------------------------------------- lib/chips.h | 67 ------------- lib/sysfs.c | 4 - 4 files changed, 1 insertion(+), 339 deletions(-) diff --git a/CHANGES b/CHANGES index 17bd3d4a..15bbb2a7 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,7 @@ SVN HEAD File README.patches: Delete, obsolete Library: Clean up pwm symbol names translation Add dme1737 support + Delete support of non-sensor drivers (ddcmon, eeprom) Man page sensors.conf.5: Update the chip statement section Program isadump: Detect when address bit 7 is a busy flag Program mkpatch: Delete diff --git a/lib/chips.c b/lib/chips.c index b9f6f214..349250c7 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -3198,272 +3198,6 @@ static sensors_chip_feature via686a_features[] = { { 0 }, 0 } }; -static sensors_chip_feature ddcmon_features[] = - { - { { SENSORS_DDCMON_MAN_ID, "Manufacturer ID", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_ID, VALUE(1), 0 }, - { { SENSORS_DDCMON_PROD_ID, "Model Number", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_ID, VALUE(2), 0 }, - { { SENSORS_DDCMON_VERSIZE, "Monitor Size (cm)", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_SIZE, VALUE(1), 0 }, - { { SENSORS_DDCMON_HORSIZE, "hsize", SENSORS_DDCMON_VERSIZE, NOMAP, R }, - DDCMON_SYSCTL_SIZE, VALUE(2), 0 }, - { { SENSORS_DDCMON_VERSYNCMIN, "Vertical Sync (Hz)", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_SYNC, VALUE(1), 0 }, - { { SENSORS_DDCMON_VERSYNCMAX, "v_sync_max", SENSORS_DDCMON_VERSYNCMIN, - NOMAP, R }, - DDCMON_SYSCTL_SYNC, VALUE(2), 0 }, - { { SENSORS_DDCMON_HORSYNCMIN, "Horizontal Sync (KHz)", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_SYNC, VALUE(3), 0 }, - { { SENSORS_DDCMON_HORSYNCMAX, "h_sync_max", SENSORS_DDCMON_HORSYNCMIN, - NOMAP, R }, - DDCMON_SYSCTL_SYNC, VALUE(4), 0 }, - { { SENSORS_DDCMON_TIMINGS, "Established Timings", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIMINGS, VALUE(1), 0 }, - { { SENSORS_DDCMON_SERIAL, "Serial Number", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_SERIAL, VALUE(1), 0 }, - { { SENSORS_DDCMON_YEAR, "Manufacture Time", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIME, VALUE(1), 0 }, - { { SENSORS_DDCMON_WEEK, "week", SENSORS_DDCMON_YEAR, NOMAP, R }, - DDCMON_SYSCTL_TIME, VALUE(2), 0 }, - { { SENSORS_DDCMON_EDID_VER, "EDID Version", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_EDID, VALUE(1), 0 }, - { { SENSORS_DDCMON_EDID_REV, "revision", SENSORS_DDCMON_EDID_VER, NOMAP, R }, - DDCMON_SYSCTL_EDID, VALUE(2), 0 }, - { { SENSORS_DDCMON_GAMMA, "Gamma Factor", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_GAMMA, VALUE(1), 2 }, - { { SENSORS_DDCMON_DPMS, "DPMS Modes", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_DPMS, VALUE(1), 0 }, - { { SENSORS_DDCMON_TIMING1_HOR, "Standard Timing 1", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIMING1, VALUE(1), 0 }, - { { SENSORS_DDCMON_TIMING1_VER, "vertical", SENSORS_DDCMON_TIMING1_HOR, - NOMAP, R }, - DDCMON_SYSCTL_TIMING1, VALUE(2), 0 }, - { { SENSORS_DDCMON_TIMING1_REF, "refresh", SENSORS_DDCMON_TIMING1_HOR, NOMAP, - R }, - DDCMON_SYSCTL_TIMING1, VALUE(3), 0 }, - { { SENSORS_DDCMON_TIMING2_HOR, "Standard Timing 2", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIMING2, VALUE(1), 0 }, - { { SENSORS_DDCMON_TIMING2_VER, "vertical", SENSORS_DDCMON_TIMING2_HOR, - NOMAP, R }, - DDCMON_SYSCTL_TIMING2, VALUE(2), 0 }, - { { SENSORS_DDCMON_TIMING2_REF, "refresh", SENSORS_DDCMON_TIMING2_HOR, NOMAP, - R }, - DDCMON_SYSCTL_TIMING2, VALUE(3), 0 }, - { { SENSORS_DDCMON_TIMING3_HOR, "Standard Timing 3", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIMING3, VALUE(1), 0 }, - { { SENSORS_DDCMON_TIMING3_VER, "vertical", SENSORS_DDCMON_TIMING3_HOR, - NOMAP, R }, - DDCMON_SYSCTL_TIMING3, VALUE(2), 0 }, - { { SENSORS_DDCMON_TIMING3_REF, "refresh", SENSORS_DDCMON_TIMING3_HOR, NOMAP, - R }, - DDCMON_SYSCTL_TIMING3, VALUE(3), 0 }, - { { SENSORS_DDCMON_TIMING4_HOR, "Standard Timing 4", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIMING4, VALUE(1), 0 }, - { { SENSORS_DDCMON_TIMING4_VER, "vertical", SENSORS_DDCMON_TIMING4_HOR, - NOMAP, R }, - DDCMON_SYSCTL_TIMING4, VALUE(2), 0 }, - { { SENSORS_DDCMON_TIMING4_REF, "refresh", SENSORS_DDCMON_TIMING4_HOR, NOMAP, - R }, - DDCMON_SYSCTL_TIMING4, VALUE(3), 0 }, - { { SENSORS_DDCMON_TIMING5_HOR, "Standard Timing 5", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIMING5, VALUE(1), 0 }, - { { SENSORS_DDCMON_TIMING5_VER, "vertical", SENSORS_DDCMON_TIMING5_HOR, - NOMAP, R }, - DDCMON_SYSCTL_TIMING5, VALUE(2), 0 }, - { { SENSORS_DDCMON_TIMING5_REF, "refresh", SENSORS_DDCMON_TIMING5_HOR, NOMAP, - R }, - DDCMON_SYSCTL_TIMING5, VALUE(3), 0 }, - { { SENSORS_DDCMON_TIMING6_HOR, "Standard Timing 6", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIMING6, VALUE(1), 0 }, - { { SENSORS_DDCMON_TIMING6_VER, "vertical", SENSORS_DDCMON_TIMING6_HOR, - NOMAP, R }, - DDCMON_SYSCTL_TIMING6, VALUE(2), 0 }, - { { SENSORS_DDCMON_TIMING6_REF, "refresh", SENSORS_DDCMON_TIMING6_HOR, NOMAP, - R }, - DDCMON_SYSCTL_TIMING6, VALUE(3), 0 }, - { { SENSORS_DDCMON_TIMING7_HOR, "Standard Timing 7", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIMING7, VALUE(1), 0 }, - { { SENSORS_DDCMON_TIMING7_VER, "vertical", SENSORS_DDCMON_TIMING7_HOR, - NOMAP, R }, - DDCMON_SYSCTL_TIMING7, VALUE(2), 0 }, - { { SENSORS_DDCMON_TIMING7_REF, "refresh", SENSORS_DDCMON_TIMING7_HOR, NOMAP, - R }, - DDCMON_SYSCTL_TIMING7, VALUE(3), 0 }, - { { SENSORS_DDCMON_TIMING8_HOR, "Standard Timing 8", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_TIMING8, VALUE(1), 0 }, - { { SENSORS_DDCMON_TIMING8_VER, "vertical", SENSORS_DDCMON_TIMING8_HOR, - NOMAP, R }, - DDCMON_SYSCTL_TIMING8, VALUE(2), 0 }, - { { SENSORS_DDCMON_TIMING8_REF, "refresh", SENSORS_DDCMON_TIMING8_HOR, NOMAP, - R }, - DDCMON_SYSCTL_TIMING8, VALUE(3), 0 }, - { { SENSORS_DDCMON_MAXCLOCK, "Max Pixel Clock (MHz)", NOMAP, NOMAP, R }, - DDCMON_SYSCTL_MAXCLOCK, VALUE(1), 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature eeprom_features[] = - { - { { SENSORS_EEPROM_TYPE, "Memory type", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(3), 0 }, -/* cheat and use the row-address-bits label for the total size in sensors */ - { { SENSORS_EEPROM_ROWADDR, "Memory size (MB)", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(4), 0 }, - { { SENSORS_EEPROM_COLADDR, "col", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(5), 0 }, - { { SENSORS_EEPROM_NUMROWS, "num rows", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(6), 0 }, - { { SENSORS_EEPROM_BANKS, "banks", NOMAP, NOMAP, R }, - EEPROM_SYSCTL2, VALUE(2), 0 }, -/* for Sony Vaio's eeproms */ - { { SENSORS_EEPROM_VAIO_NAME, "Machine name", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(1), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+1, "name2", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(2), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+2, "name3", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(3), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+3, "name4", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(4), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+4, "name5", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(5), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+5, "name6", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(6), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+6, "name7", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(7), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+7, "name8", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(8), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+8, "name9", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(9), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+9, "name10", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(10), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+10, "name11", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(11), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+11, "name12", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(12), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+12, "name13", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(13), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+13, "name14", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(14), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+14, "name15", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(15), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+15, "name16", NOMAP, NOMAP, R }, - EEPROM_SYSCTL9, VALUE(16), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+16, "name17", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(1), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+17, "name18", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(2), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+18, "name19", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(3), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+19, "name20", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(4), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+20, "name21", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(5), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+21, "name22", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(6), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+22, "name23", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(7), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+23, "name24", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(8), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+24, "name25", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(9), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+25, "name26", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(10), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+26, "name27", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(11), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+27, "name28", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(12), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+28, "name29", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(13), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+29, "name30", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(14), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+30, "name31", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(15), 0 }, - { { SENSORS_EEPROM_VAIO_NAME+31, "name32", NOMAP, NOMAP, R }, - EEPROM_SYSCTL10, VALUE(16), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL, "Serial number", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(1), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+1, "serial2", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(2), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+2, "serial3", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(3), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+3, "serial4", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(4), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+4, "serial5", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(5), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+5, "serial6", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(6), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+6, "serial7", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(7), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+7, "serial8", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(8), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+8, "serial9", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(9), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+9, "serial10", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(10), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+10, "serial11", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(11), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+11, "serial12", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(12), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+12, "serial13", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(13), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+13, "serial14", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(14), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+14, "serial15", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(15), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+15, "serial16", NOMAP, NOMAP, R }, - EEPROM_SYSCTL13, VALUE(16), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+16, "serial17", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(1), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+17, "serial18", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(2), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+18, "serial19", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(3), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+19, "serial20", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(4), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+20, "serial21", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(5), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+21, "serial22", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(6), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+22, "serial23", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(7), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+23, "serial24", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(8), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+24, "serial25", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(9), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+25, "serial26", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(10), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+26, "serial27", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(11), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+27, "serial28", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(12), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+28, "serial29", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(13), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+29, "serial30", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(14), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+30, "serial31", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(15), 0 }, - { { SENSORS_EEPROM_VAIO_SERIAL+31, "serial32", NOMAP, NOMAP, R }, - EEPROM_SYSCTL14, VALUE(16), 0 }, -/* for monitor's edid */ - { { SENSORS_EEPROM_EDID_HEADER, "EDID header", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(1), 0 }, -/* for Shuttle EEPROMS */ - { { SENSORS_EEPROM_SHUTTLE, "Ethernet Address", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(1), 0 }, - { { SENSORS_EEPROM_SHUTTLE, "shuttle2", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(2), 0 }, - { { SENSORS_EEPROM_SHUTTLE, "shuttle3", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(3), 0 }, - { { SENSORS_EEPROM_SHUTTLE, "shuttle4", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(4), 0 }, - { { SENSORS_EEPROM_SHUTTLE, "shuttle5", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(5), 0 }, - { { SENSORS_EEPROM_SHUTTLE, "shuttle6", NOMAP, NOMAP, R }, - EEPROM_SYSCTL1, VALUE(6), 0 }, - { { 0 }, 0 } - }; - /* NOTE: Many shared values with adm1027_features !!! */ static sensors_chip_feature lm85_features[] = { @@ -6107,8 +5841,6 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_NE1619_PREFIX, adm1025_features }, { SENSORS_ADM1026_PREFIX, adm1026_features }, { SENSORS_VIA686A_PREFIX, via686a_features }, - { SENSORS_DDCMON_PREFIX, ddcmon_features }, - { SENSORS_EEPROM_PREFIX, eeprom_features }, { SENSORS_LM87_PREFIX, lm87_features }, { SENSORS_MTP008_PREFIX, mtp008_features }, { SENSORS_DS1621_PREFIX, ds1621_features }, diff --git a/lib/chips.h b/lib/chips.h index e2d5cff1..b3980662 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -1371,73 +1371,6 @@ #define SENSORS_VIA686A_ALARMS 81 /* R */ -/* DDC Monitor */ - -#define SENSORS_DDCMON_PREFIX "ddcmon" - -#define SENSORS_DDCMON_MAN_ID 10 -#define SENSORS_DDCMON_PROD_ID 11 -#define SENSORS_DDCMON_YEAR 13 -#define SENSORS_DDCMON_WEEK 14 -#define SENSORS_DDCMON_EDID_VER 15 -#define SENSORS_DDCMON_EDID_REV 16 -#define SENSORS_DDCMON_HORSIZE 21 -#define SENSORS_DDCMON_VERSIZE 22 -#define SENSORS_DDCMON_GAMMA 23 -#define SENSORS_DDCMON_DPMS 24 -#define SENSORS_DDCMON_HORSYNCMIN 31 -#define SENSORS_DDCMON_HORSYNCMAX 32 -#define SENSORS_DDCMON_VERSYNCMIN 33 -#define SENSORS_DDCMON_VERSYNCMAX 34 -#define SENSORS_DDCMON_MAXCLOCK 35 -#define SENSORS_DDCMON_SERIAL 40 -#define SENSORS_DDCMON_TIMINGS 50 -#define SENSORS_DDCMON_TIMING1_HOR 51 -#define SENSORS_DDCMON_TIMING1_VER 52 -#define SENSORS_DDCMON_TIMING1_REF 53 -#define SENSORS_DDCMON_TIMING2_HOR 54 -#define SENSORS_DDCMON_TIMING2_VER 55 -#define SENSORS_DDCMON_TIMING2_REF 56 -#define SENSORS_DDCMON_TIMING3_HOR 57 -#define SENSORS_DDCMON_TIMING3_VER 58 -#define SENSORS_DDCMON_TIMING3_REF 59 -#define SENSORS_DDCMON_TIMING4_HOR 60 -#define SENSORS_DDCMON_TIMING4_VER 61 -#define SENSORS_DDCMON_TIMING4_REF 62 -#define SENSORS_DDCMON_TIMING5_HOR 63 -#define SENSORS_DDCMON_TIMING5_VER 64 -#define SENSORS_DDCMON_TIMING5_REF 65 -#define SENSORS_DDCMON_TIMING6_HOR 66 -#define SENSORS_DDCMON_TIMING6_VER 67 -#define SENSORS_DDCMON_TIMING6_REF 68 -#define SENSORS_DDCMON_TIMING7_HOR 69 -#define SENSORS_DDCMON_TIMING7_VER 70 -#define SENSORS_DDCMON_TIMING7_REF 71 -#define SENSORS_DDCMON_TIMING8_HOR 72 -#define SENSORS_DDCMON_TIMING8_VER 73 -#define SENSORS_DDCMON_TIMING8_REF 74 - -/* EEPROM (SDRAM DIMM) */ - -#define SENSORS_EEPROM_PREFIX "eeprom" - -#define SENSORS_EEPROM_TYPE 10 -#define SENSORS_EEPROM_ROWADDR 12 -#define SENSORS_EEPROM_COLADDR 13 -#define SENSORS_EEPROM_NUMROWS 14 -#define SENSORS_EEPROM_BANKS 15 - -#define SENSORS_EEPROM_VAIO_NAME 128 -/* 129 to 159: reserved, do not use! */ -#define SENSORS_EEPROM_VAIO_SERIAL 160 -/* 161 to 191: reserved, do not use! */ - -#define SENSORS_EEPROM_EDID_HEADER 32 -/* 33 to 39: reserved, do not use! */ - -#define SENSORS_EEPROM_SHUTTLE 40 -/* 41 to 45: reserved, do not use! */ - /* Analog Devices LM87 chips */ #define SENSORS_LM87_PREFIX "lm87" diff --git a/lib/sysfs.c b/lib/sysfs.c index ce9c109f..bd525b91 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -198,10 +198,6 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) " subclient\n")) return 0; - /* also ignore eeproms */ - if (!strcmp(attr->value, "eeprom\n")) - return 0; - /* NB: attr->value[attr->len-1] == '\n'; chop that off */ entry.name.prefix = strndup(attr->value, attr->len - 1); if (!entry.name.prefix) From 9f98b3301956e166ff072f30c431e72af209fe64 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 16 May 2007 09:11:37 +0000 Subject: [PATCH 029/718] Fix busy flag detection. Some Super-I/O chips (W83627THF) can't read back from the address port, so the value 0xff is returned, causing a false positive with the original test. Testing explicitly for 0x80 instead of only testing that bit 7 is set, works around it. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4406 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/dump/isadump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/dump/isadump.c b/prog/dump/isadump.c index 5031e783..04eee8d3 100644 --- a/prog/dump/isadump.c +++ b/prog/dump/isadump.c @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) res = inb(addrreg + i + j); } else { outb(i+j, addrreg); - if (i+j == 0 && (inb(addrreg) & 0x80)) { + if (i+j == 0 && inb(addrreg) == 0x80) { /* Bit 7 appears to be a busy flag */ range = 128; } From 835c00d1bc7b5506e017b5fed0e23a476b2c1aa2 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 16 May 2007 09:13:50 +0000 Subject: [PATCH 030/718] Fix Super-I/O exit sequence for Winbond/Fintek chips. isadump now uses the same sequence as sensors-detect uses. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4407 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/dump/superio.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 15bbb2a7..0462cacb 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ SVN HEAD Delete support of non-sensor drivers (ddcmon, eeprom) Man page sensors.conf.5: Update the chip statement section Program isadump: Detect when address bit 7 is a busy flag + Fix Super-I/O exit sequence for Winbond/Fintek chips Program mkpatch: Delete Program pwmconfig: Use smaller steps for low PWM values Program rrd: Support only hwmon class devices diff --git a/prog/dump/superio.c b/prog/dump/superio.c index 7a6b3efa..ac092635 100644 --- a/prog/dump/superio.c +++ b/prog/dump/superio.c @@ -66,6 +66,10 @@ void superio_write_key(int addrreg, unsigned char *key) void superio_reset(int addrreg, int datareg) { + /* Some chips (SMSC, Winbond) want this */ + outb(0xaa, addrreg); + + /* Return to "Wait For Key" state (PNP-ISA spec) */ outb(0x02, addrreg); outb(0x02, datareg); } From 8cc806b2984b00d97183d0f35e19c927d0a7f0bf Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 17 May 2007 12:07:20 +0000 Subject: [PATCH 031/718] sensors-detect: Add support for the ATI SB700 SMBus controller. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4409 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 0462cacb..b44da1fa 100644 --- a/CHANGES +++ b/CHANGES @@ -26,6 +26,7 @@ SVN HEAD Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection Add /usr/sbin to the PATH (#2199) + Add ATI SB700 detection 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 3457014b..65dcabd7 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -666,17 +666,24 @@ $revision =~ s/ \([^()]*\)//; { vendid => 0x1002, devid => 0x4372, - procid => "ATI Technologies Inc ATI SMBus", + procid => "ATI Technologies Inc IXP SB400 SMBus Controller", driver => "i2c-piix4", match => qr/^SMBus PIIX4 adapter at /, } , { vendid => 0x1002, devid => 0x4385, - procid => "ATI Technologies Inc ATI SMBus", + procid => "ATI Technologies Inc SB600 SMBus", driver => "i2c-piix4", match => qr/^SMBus PIIX4 adapter at /, } , + { + vendid => 0x1002, + devid => 0x4395, + procid => "ATI Technologies Inc SB700 SMBus", + driver => "i2c-piix4", + match => qr/^SMBus PIIX4 adapter at /, + }, { vendid => 0x100B, devid => 0x0500, From d2341c8ec152f35e22a7e08798109afbfa863b3c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 22 May 2007 11:31:51 +0000 Subject: [PATCH 032/718] Add Maxim MAX6680/MAX6681 detection. Patch contributed by Rainer Birkenmaier (Siemens). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4411 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index b44da1fa..d0949779 100644 --- a/CHANGES +++ b/CHANGES @@ -27,6 +27,7 @@ SVN HEAD Fix SMSC DME1737 detection Add /usr/sbin to the PATH (#2199) Add ATI SB700 detection + Add Maxim MAX6680/MAX6681 detection 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 65dcabd7..f2e0ec19 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1260,6 +1260,12 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x4c], i2c_detect => sub { lm90_detect(6, @_); }, }, + { + name => "Maxim MAX6680/MAX6681", + driver => "lm90", + i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], + i2c_detect => sub { lm90_detect(7, @_); }, + }, { name => "National Semiconductor LM63", driver => "lm63", @@ -3670,12 +3676,12 @@ sub lm83_detect # $_[0]: Chip to detect # (0 = LM90, 1=LM89/LM99, 2=LM86, 3=ADM1032, 4=MAX6657/MAX6658/MAX6659, -# 5 = ADT7461, 6 = MAX6648/MAX6692) +# 5 = ADT7461, 6 = MAX6648/MAX6692, 7 = MAX6680/MAX6681) # $_[1]: A reference to the file descriptor to access this chip. # $_[2]: Address # Returns: undef if not detected, 4, 6 or 8 if detected. -# The Maxim chips have a low confidence value (4) -# because they don't have a die revision register. +# The Maxim chips MAX6657, MAX6658 and MAX6659 have a low confidence +# value (4) because they don't have a die revision register. # Registers used: # 0x03: Configuration # 0x04: Conversion rate @@ -3738,6 +3744,13 @@ sub lm90_detect return if $cid != 0x59; # MAX6648/MAX6692 return 8; } + if ($chip == 7) { + return if ($conf & 0x03) != 0; + return if $rate > 0x07; + return if $mid != 0x4d; # Maxim + return if $cid != 0x01; # MAX6680/MAX6681 + return 6; + } return; } From d9f8e44d403a638be71fca25116b2a720d39323e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 28 May 2007 07:17:09 +0000 Subject: [PATCH 033/718] Add IT8726F detection. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4415 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES b/CHANGES index d0949779..2a216324 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,7 @@ SVN HEAD Add /usr/sbin to the PATH (#2199) Add ATI SB700 detection Add Maxim MAX6680/MAX6681 detection + Add IT8726F detection 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index f2e0ec19..1e7ffd88 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1966,6 +1966,12 @@ $chip_kern26_w83791d = { devid => 0x8718, logdev => 0x04, }, + { + name => "ITE IT8726F Super IO Sensors", + driver => "it87", + devid => 0x8726, + logdev => 0x04, + }, ], }, ); From 9eb42272d2884ab9b169e70fac83e951b1ec5c9e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 28 May 2007 08:59:22 +0000 Subject: [PATCH 034/718] Ignore generated files. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4418 7894878c-1315-0410-8ee3-d5d059ff63e0 From b33986c2ac51bf40cc9e914e3eb1efd2d9f93d39 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 28 May 2007 10:31:56 +0000 Subject: [PATCH 035/718] Support and use the new I2C block read with variable length which will be available in Linux kernel 2.6.23. Binary compatibility is guaranteed, source code compatibility isn't, but the incompatibility will be spotted quickly as the prototype of the helper function i2c_smbus_read_i2c_block_data() changed. The only problem would be if a program is calling i2c_smbus_access() directly. Hopefully this should be a rare case. The py-smbus binding code is in this case and will be adjusted soon. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4419 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 ++ kernel/include/i2c-dev.h | 15 ++++++++++++--- prog/dump/i2cdump.c | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 2a216324..375d38fb 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ lm_sensors CHANGES file ----------------------- SVN HEAD + File i2c-dev.h: Support I2C block reads with specified length All bus modules and documentation: Delete All chip modules and documentation: Delete Legacy hotplug modules and documentation: Delete @@ -13,6 +14,7 @@ SVN HEAD Add dme1737 support Delete support of non-sensor drivers (ddcmon, eeprom) Man page sensors.conf.5: Update the chip statement section + Program i2cdump: Use the new I2C block read function Program isadump: Detect when address bit 7 is a busy flag Fix Super-I/O exit sequence for Winbond/Fintek chips Program mkpatch: Delete diff --git a/kernel/include/i2c-dev.h b/kernel/include/i2c-dev.h index 5737d5ee..5284cf11 100644 --- a/kernel/include/i2c-dev.h +++ b/kernel/include/i2c-dev.h @@ -106,8 +106,9 @@ union i2c_smbus_data { #define I2C_SMBUS_WORD_DATA 3 #define I2C_SMBUS_PROC_CALL 4 #define I2C_SMBUS_BLOCK_DATA 5 -#define I2C_SMBUS_I2C_BLOCK_DATA 6 +#define I2C_SMBUS_I2C_BLOCK_BROKEN 6 #define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ +#define I2C_SMBUS_I2C_BLOCK_DATA 8 /* ----- commands for the ioctl like i2c_command call: @@ -271,12 +272,20 @@ static inline __s32 i2c_smbus_write_block_data(int file, __u8 command, } /* Returns the number of read bytes */ +/* Until kernel 2.6.22, the length is hardcoded to 32 bytes. If you + ask for less than 32 bytes, your code will only work with kernels + 2.6.23 and later. */ static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, - __u8 *values) + __u8 length, __u8 *values) { union i2c_smbus_data data; int i; + + if (length > 32) + length = 32; + data.block[0] = length; if (i2c_smbus_access(file,I2C_SMBUS_READ,command, + length == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN : I2C_SMBUS_I2C_BLOCK_DATA,&data)) return -1; else { @@ -297,7 +306,7 @@ static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, data.block[i] = values[i-1]; data.block[0] = length; return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, - I2C_SMBUS_I2C_BLOCK_DATA, &data); + I2C_SMBUS_I2C_BLOCK_BROKEN, &data); } /* Returns the number of read bytes */ diff --git a/prog/dump/i2cdump.c b/prog/dump/i2cdump.c index ddcb65cd..77d53a99 100644 --- a/prog/dump/i2cdump.c +++ b/prog/dump/i2cdump.c @@ -316,7 +316,7 @@ int main(int argc, char *argv[]) } else { for (res = 0; res < 256; res += i) { i = i2c_smbus_read_i2c_block_data(file, - res, cblock + res); + res, 32, cblock + res); if (i <= 0) break; } From 1bd92120659febdcd19bfa7dbc3722fe00e7b753 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 28 May 2007 12:38:28 +0000 Subject: [PATCH 036/718] Fill the magnitude field of dynamically generated device entries. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4420 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/sysfs.c b/lib/sysfs.c index bd525b91..88863ba8 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -37,6 +37,29 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 16 +static +int get_type_scaling(int type) +{ + switch (type & 0xFF10) { + case SENSORS_FEATURE_IN: + case SENSORS_FEATURE_TEMP: + return 3; + case SENSORS_FEATURE_FAN: + return 0; + } + + switch (type) { + case SENSORS_FEATURE_VID: + return 3; + case SENSORS_FEATURE_VRM: + return 1; + default: + return 0; + } + + return 0; +} + static sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) { @@ -149,6 +172,8 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) SENSORS_MODE_R : (attr->method & SYSFS_METHOD_STORE) ? SENSORS_MODE_W : SENSORS_MODE_NO_RW; + feature.scaling = get_type_scaling(type); + features[i] = feature; fnum++; } From 2eece824c8739597c61deaf0e988f9d061f8e5f3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 28 May 2007 13:26:07 +0000 Subject: [PATCH 037/718] Fix alignment of alarm for one-limit temperatures. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4421 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/chips.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 375d38fb..ee386a1f 100644 --- a/CHANGES +++ b/CHANGES @@ -25,6 +25,7 @@ SVN HEAD Update URI Program sensors: Drop ddcmon and eeprom support Add dme1737 support + Fix alignment of alarm for one-limit temperatures Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection Add /usr/sbin to the PATH (#2199) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index a1c7e35b..af468f48 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -61,7 +61,7 @@ void print_temp_info_real(float n_cur, float n_over, float n_hyst, float n_lim, limitprec, n_hyst, degstr, limitprec, n_over, degstr); else if(minmax == MAXONLY) - printf("%+6.*f%s (high = %+5.*f%s) ", + printf("%+6.*f%s (high = %+5.*f%s) ", curprec, n_cur, degstr, limitprec, n_over, degstr); else if(minmax == CRIT) @@ -78,7 +78,7 @@ void print_temp_info_real(float n_cur, float n_over, float n_hyst, float n_lim, printf("%+6.*f%s", curprec, n_cur, degstr); else if(minmax == HYSTONLY) - printf( "%+6.*f%s (hyst = %+5.*f%s) ", + printf("%+6.*f%s (hyst = %+5.*f%s) ", curprec, n_cur, degstr, limitprec, n_over, degstr); else if(minmax == LIM) From a08cf956fbed7b97b06997b8aaccd43776c01f9b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 28 May 2007 14:22:58 +0000 Subject: [PATCH 038/718] Fixes to the dynamic chip support: * Fix the handling of temperature hysteresis. Hysteresis is not a temperature limit by itself, but a property of temperature limit. * Handle per-limit temperature alarms. With these fixes, the ADM1032 is properly supported by the new code. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4423 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 6 ++++- lib/sensors.h | 8 +++++-- prog/sensors/chips_generic.c | 45 ++++++++++++++++-------------------- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/lib/access.c b/lib/access.c index 3285468d..9f9726f5 100644 --- a/lib/access.c +++ b/lib/access.c @@ -515,13 +515,17 @@ struct feature_type_match }; static struct feature_type_match temp_matches[] = { - { "hyst", SENSORS_FEATURE_TEMP_HYST }, { "over", SENSORS_FEATURE_TEMP_OVER }, { "max", SENSORS_FEATURE_TEMP_MAX }, + { "max_hyst", SENSORS_FEATURE_TEMP_MAX_HYST }, { "min", SENSORS_FEATURE_TEMP_MIN }, { "low", SENSORS_FEATURE_TEMP_LOW }, { "crit", SENSORS_FEATURE_TEMP_CRIT }, + { "crit_hyst", SENSORS_FEATURE_TEMP_CRIT_HYST }, { "alarm", SENSORS_FEATURE_TEMP_ALARM }, + { "min_alarm", SENSORS_FEATURE_TEMP_MIN_ALARM }, + { "max_alarm", SENSORS_FEATURE_TEMP_MAX_ALARM }, + { "crit_alarm", SENSORS_FEATURE_TEMP_CRIT_ALARM }, { "fault", SENSORS_FEATURE_TEMP_FAULT }, { "type", SENSORS_FEATURE_TEMP_SENS }, { 0 } diff --git a/lib/sensors.h b/lib/sensors.h index 29c560cb..5edcfc7d 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -166,15 +166,19 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_FAN_DIV, SENSORS_FEATURE_TEMP = 0x200, - SENSORS_FEATURE_TEMP_HYST, SENSORS_FEATURE_TEMP_OVER, SENSORS_FEATURE_TEMP_MAX, + SENSORS_FEATURE_TEMP_MAX_HYST, SENSORS_FEATURE_TEMP_MIN, SENSORS_FEATURE_TEMP_HIGH, SENSORS_FEATURE_TEMP_LOW, SENSORS_FEATURE_TEMP_LIM, SENSORS_FEATURE_TEMP_CRIT, + SENSORS_FEATURE_TEMP_CRIT_HYST, SENSORS_FEATURE_TEMP_ALARM = 0x210, + SENSORS_FEATURE_TEMP_MAX_ALARM, + SENSORS_FEATURE_TEMP_MIN_ALARM, + SENSORS_FEATURE_TEMP_CRIT_ALARM, SENSORS_FEATURE_TEMP_FAULT, SENSORS_FEATURE_TEMP_SENS, @@ -185,7 +189,7 @@ typedef enum sensors_feature_type { /* special the largest number of subfeatures used, iow the highest ## from all the 0x?## above + 1*/ - SENSORS_FEATURE_MAX_SUB_FEATURES = 19 + SENSORS_FEATURE_MAX_SUB_FEATURES = 22 } sensors_feature_type; sensors_feature_type sensors_feature_get_type diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index fed9cf6c..1745a471 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -144,27 +144,16 @@ static void print_generic_chip_temp(const sensors_chip_name *name, } else { type = MINMAX; } + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST); + type = HYST; } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); type = CRIT; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HYST)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HYST); - type = HYST; } else { min = 0; type = MAXONLY; } - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HYST)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HYST); - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_OVER)) { - max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_OVER); - type = HYST; - } else { - max = min; - max = 0; - type = HYSTONLY; - } } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_LOW)) { min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_LOW); @@ -208,23 +197,25 @@ static void print_generic_chip_temp(const sensors_chip_name *name, if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT) > 0.5) { printf(" FAULT"); - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) { + } else + if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) + || (type == MINMAX && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM) > 0.5) + || (type == MINMAX && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM) > 0.5)) { printf(" ALARM"); } printf("\n"); - if (type == MINMAX && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) - { + if (type != CRIT && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { const sensors_feature_data *subfeature; max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HYST)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HYST); - type = HYSTONLY; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX) && - !TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST); type = HYSTONLY; } else { type = SINGLE; @@ -239,7 +230,11 @@ static void print_generic_chip_temp(const sensors_chip_name *name, if (valid) { print_label(label, label_size); free(label); - print_temp_info_real(max, min, 0, 0.0, type, 1, 0); + print_temp_info_real(max, min, 0, 0.0, type, 1, 1); + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5) { + printf(" ALARM"); + } printf("\n"); } } From 139afe66650d0677b33d940a042ddbd864f10a15 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 28 May 2007 15:02:18 +0000 Subject: [PATCH 039/718] Disable specific support for the ds1621, lm90 and f71805f drivers. I tested that the generic support works fine for these devices. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4424 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/chips.c | 10 +++++----- prog/sensors/main.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/chips.c b/lib/chips.c index 349250c7..b3b80667 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -5843,7 +5843,7 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_VIA686A_PREFIX, via686a_features }, { SENSORS_LM87_PREFIX, lm87_features }, { SENSORS_MTP008_PREFIX, mtp008_features }, - { SENSORS_DS1621_PREFIX, ds1621_features }, +/* { SENSORS_DS1621_PREFIX, ds1621_features }, */ { SENSORS_ADM1024_PREFIX, adm1024_features }, { SENSORS_IT87_PREFIX, it87_features }, { SENSORS_IT8712_PREFIX, it87_features }, @@ -5874,12 +5874,12 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_ADM1027_PREFIX, adm1027_features }, { SENSORS_ADT7463_PREFIX, adm1027_features }, { SENSORS_LM83_PREFIX, lm83_features }, - { SENSORS_LM90_PREFIX, lm90_features }, +/* { SENSORS_LM90_PREFIX, lm90_features }, { SENSORS_ADM1032_PREFIX, lm90_features }, { SENSORS_LM99_PREFIX, lm90_features }, { SENSORS_LM86_PREFIX, lm90_features }, { SENSORS_MAX6657_PREFIX, lm90_features }, - { SENSORS_ADT7461_PREFIX, lm90_features }, + { SENSORS_ADT7461_PREFIX, lm90_features }, */ { SENSORS_LM63_PREFIX, lm63_features }, { SENSORS_MAX1619_PREFIX, max1619_features }, { SENSORS_XEONTEMP_PREFIX, xeontemp_features }, @@ -5889,8 +5889,8 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_ADM1031_PREFIX, adm1031_features }, { SENSORS_LM93_PREFIX, lm93_features }, { SENSORS_SMSC47B397_PREFIX, smsc47b397_features }, - { SENSORS_F71805F_PREFIX, f71805f_features }, - { SENSORS_F71872F_PREFIX, f71805f_features }, +/* { SENSORS_F71805F_PREFIX, f71805f_features }, + { SENSORS_F71872F_PREFIX, f71805f_features }, */ // { SENSORS_ABITUGURU_PREFIX, abituguru_features }, // { SENSORS_K8TEMP_PREFIX, k8temp_features }, { SENSORS_CORETEMP_PREFIX, coretemp_features }, diff --git a/prog/sensors/main.c b/prog/sensors/main.c index df18e8aa..0cd1b8d0 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -332,7 +332,7 @@ struct match { }; struct match matches[] = { - { "ds1621", print_ds1621 }, +/* { "ds1621", print_ds1621 }, */ { "lm75", print_lm75 }, { "adm1021", print_adm1021 }, { "max1617", print_adm1021 }, @@ -408,12 +408,12 @@ struct match matches[] = { { "bmc", print_bmc }, { "adm1026", print_adm1026 }, { "lm83", print_lm83 }, - { "lm90", print_lm90 }, +/* { "lm90", print_lm90 }, { "adm1032", print_lm90 }, { "lm99", print_lm90 }, { "lm86", print_lm90 }, { "max6657", print_lm90 }, - { "adt7461", print_lm90 }, + { "adt7461", print_lm90 }, */ { "lm63", print_lm63 }, { "xeontemp", print_xeontemp }, { "max6650", print_max6650 }, @@ -423,8 +423,8 @@ struct match matches[] = { { "adm1031", print_adm1031 }, { "lm93", print_lm93 }, { "smsc47b397", print_smsc47b397 }, - { "f71805f", print_f71805f }, - { "f71872f", print_f71805f }, +/* { "f71805f", print_f71805f }, + { "f71872f", print_f71805f }, */ // { "abituguru", print_abituguru }, // { "k8temp", print_k8temp }, { "coretemp", print_coretemp }, From 6a7971c88ca2f1ce662a1ffe976a0598407410b6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 29 May 2007 12:25:44 +0000 Subject: [PATCH 040/718] "make uninstall" is now implemented. No driver for the MTP006. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4426 7894878c-1315-0410-8ee3-d5d059ff63e0 --- TODO | 5 ----- 1 file changed, 5 deletions(-) diff --git a/TODO b/TODO index cc0105dd..1ab7bde0 100644 --- a/TODO +++ b/TODO @@ -36,8 +36,6 @@ KERNEL MODULES correctly now, and it is possible to rmmod adapter while one of its clients is in use. -* "uninstall" Makefile target. - * ACPI and SMBus host - ACPI subsystem may access SMBus host too. Locks? - On my ancient board using i2c-via, suspend and power switch status @@ -82,9 +80,6 @@ KERNEL MODULES * lm80: Check how OS alarms work. At page 17 of the sheet, it tells something completely different from the description at page 25. -* Add MTP006F chip: http://www.myson.com/Pcd/MTP006/Mtp006.pdf - gfiala@s.netic.de (Guido Fiala) has one on his mainboard - LIBRARY ======= From 33a3d6fba2beb4931096917ff1868c0e8f98c3e0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 29 May 2007 16:23:19 +0000 Subject: [PATCH 041/718] Drop SENSORS_FEATURE_TEMP_OVER, SENSORS_FEATURE_TEMP_HIGH and SENSORS_FEATURE_TEMP_LOW, they don't correspond to anything in the standard sysfs interface. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4427 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 2 -- lib/sensors.h | 3 --- prog/sensors/chips_generic.c | 14 -------------- 3 files changed, 19 deletions(-) diff --git a/lib/access.c b/lib/access.c index 9f9726f5..fb7c7dc4 100644 --- a/lib/access.c +++ b/lib/access.c @@ -515,11 +515,9 @@ struct feature_type_match }; static struct feature_type_match temp_matches[] = { - { "over", SENSORS_FEATURE_TEMP_OVER }, { "max", SENSORS_FEATURE_TEMP_MAX }, { "max_hyst", SENSORS_FEATURE_TEMP_MAX_HYST }, { "min", SENSORS_FEATURE_TEMP_MIN }, - { "low", SENSORS_FEATURE_TEMP_LOW }, { "crit", SENSORS_FEATURE_TEMP_CRIT }, { "crit_hyst", SENSORS_FEATURE_TEMP_CRIT_HYST }, { "alarm", SENSORS_FEATURE_TEMP_ALARM }, diff --git a/lib/sensors.h b/lib/sensors.h index 5edcfc7d..9528bb6d 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -166,12 +166,9 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_FAN_DIV, SENSORS_FEATURE_TEMP = 0x200, - SENSORS_FEATURE_TEMP_OVER, SENSORS_FEATURE_TEMP_MAX, SENSORS_FEATURE_TEMP_MAX_HYST, SENSORS_FEATURE_TEMP_MIN, - SENSORS_FEATURE_TEMP_HIGH, - SENSORS_FEATURE_TEMP_LOW, SENSORS_FEATURE_TEMP_LIM, SENSORS_FEATURE_TEMP_CRIT, SENSORS_FEATURE_TEMP_CRIT_HYST, diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 1745a471..ccca26e6 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -154,20 +154,6 @@ static void print_generic_chip_temp(const sensors_chip_name *name, min = 0; type = MAXONLY; } - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_LOW)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_LOW); - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_HIGH)) { - max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_HIGH); - } else { /* TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_OVER) */ - max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_OVER); - } - - type = MINMAX; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_OVER)) { - max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_OVER); - min = 0; - type = MAXONLY; } else { min = max = 0; type = SINGLE; From 768be0b9c04830e54c66fd390c10fb1eae13cb2b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 29 May 2007 16:49:06 +0000 Subject: [PATCH 042/718] Drop SENSORS_FEATURE_TEMP_LIM, it doesn't correspond to anything in the standard sysfs interface. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4428 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 1 - prog/sensors/chips.c | 15 +-------------- prog/sensors/chips.h | 3 +-- prog/sensors/chips_generic.c | 18 ++++-------------- 4 files changed, 6 insertions(+), 31 deletions(-) diff --git a/lib/sensors.h b/lib/sensors.h index 9528bb6d..deb31e7a 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -169,7 +169,6 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_TEMP_MAX, SENSORS_FEATURE_TEMP_MAX_HYST, SENSORS_FEATURE_TEMP_MIN, - SENSORS_FEATURE_TEMP_LIM, SENSORS_FEATURE_TEMP_CRIT, SENSORS_FEATURE_TEMP_CRIT_HYST, SENSORS_FEATURE_TEMP_ALARM = 0x210, diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index af468f48..ee173337 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -30,7 +30,6 @@ #include "kernel/include/sensors.h" void print_label(const char *label, int space); -static void print_temp_info(float, float, float, int, int, int); static inline float deg_ctof( float ); extern int fahrenheit; @@ -45,7 +44,7 @@ inline float deg_ctof( float cel ) curprec and limitprec are # of digits after decimal point for the current temp and the limits note: symbolic constants defined in chips.h */ -void print_temp_info_real(float n_cur, float n_over, float n_hyst, float n_lim, +void print_temp_info(float n_cur, float n_over, float n_hyst, int minmax, int curprec, int limitprec) { if (fahrenheit) { @@ -81,22 +80,10 @@ void print_temp_info_real(float n_cur, float n_over, float n_hyst, float n_lim, printf("%+6.*f%s (hyst = %+5.*f%s) ", curprec, n_cur, degstr, limitprec, n_over, degstr); - else if(minmax == LIM) - printf("%+6.*f%s (low = %+5.*f%s, high = %+5.*f%s, lim = %+5.*f%s) ", - curprec, n_cur, degstr, - limitprec, n_hyst, degstr, - limitprec, n_over, degstr, - limitprec, n_lim, degstr); else printf("Unknown temperature mode!"); } -void print_temp_info(float n_cur, float n_over, float n_hyst, - int minmax, int curprec, int limitprec) -{ - print_temp_info_real(n_cur, n_over, n_hyst, 0, minmax, curprec, limitprec); -} - void print_label(const char *label, int space) { int len=strlen(label)+1; diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index 82e525b0..a2525526 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -85,8 +85,7 @@ extern void print_dme1737(const sensors_chip_name *name); #define CRIT 3 #define SINGLE 4 #define HYSTONLY 5 -#define LIM 6 -void print_temp_info_real(float n_cur, float n_over, float n_hyst, float n_lim, +void print_temp_info(float n_cur, float n_over, float n_hyst, int minmax, int curprec, int limitprec); void print_vid_info_real(const sensors_chip_name *name, int f_vid, int f_vrm, int label_size); diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index ccca26e6..957c5100 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -107,7 +107,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, const sensors_feature_data *feature, int i, int j, int label_size) { - double val, max, min, lim = 0.0; + double val, max, min; char *label; int valid, type; const int size = SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP; @@ -137,13 +137,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN); - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_LIM)) { - lim = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_LIM); - type = LIM; - } else { - type = MINMAX; - } + type = MINMAX; } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST); type = HYST; @@ -162,11 +156,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, print_label(label, label_size); free(label); - if (type == LIM) { - print_temp_info_real(val, max, min, lim, type, 1, 1); - } else { - print_temp_info_real(val, max, min, 0.0, type, 1, 1); - } + print_temp_info(val, max, min, type, 1, 1); /* print out temperature sensor info */ if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { @@ -216,7 +206,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, if (valid) { print_label(label, label_size); free(label); - print_temp_info_real(max, min, 0, 0.0, type, 1, 1); + print_temp_info(max, min, 0, type, 1, 1); if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5) { printf(" ALARM"); From 2eb4a52e2502ae4ac192eb16688617d558bad09e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 4 Jun 2007 16:41:48 +0000 Subject: [PATCH 043/718] Ignore generated files. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4430 7894878c-1315-0410-8ee3-d5d059ff63e0 From a46d7961d3b12764003e64ba33b3d4bdfa49244d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 4 Jun 2007 17:54:46 +0000 Subject: [PATCH 044/718] Do not force the I2C slave address by default. It's only fair to let the users know that they're doing something wrong. They can insist by using the new -f option. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4431 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/dump/i2cbusses.c | 14 ++++++++++++++ prog/dump/i2cbusses.h | 1 + prog/dump/i2cdump.8 | 10 +++++++++- prog/dump/i2cdump.c | 14 +++++--------- prog/dump/i2cget.8 | 10 +++++++++- prog/dump/i2cget.c | 22 +++++----------------- prog/dump/i2cset.8 | 11 ++++++++++- prog/dump/i2cset.c | 12 ++++-------- 9 files changed, 58 insertions(+), 37 deletions(-) diff --git a/CHANGES b/CHANGES index ee386a1f..782e6154 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ SVN HEAD Add dme1737 support Delete support of non-sensor drivers (ddcmon, eeprom) Man page sensors.conf.5: Update the chip statement section + Programs i2cdump, i2cget, i2cset: Do not force the slave address by default Program i2cdump: Use the new I2C block read function Program isadump: Detect when address bit 7 is a busy flag Fix Super-I/O exit sequence for Winbond/Fintek chips diff --git a/prog/dump/i2cbusses.c b/prog/dump/i2cbusses.c index 725dd665..5c511f52 100644 --- a/prog/dump/i2cbusses.c +++ b/prog/dump/i2cbusses.c @@ -243,3 +243,17 @@ int open_i2c_dev(const int i2cbus, char *filename, const int quiet) return file; } + +int set_slave_addr(int file, int address, int force) +{ + /* With force, let the user read from/write to the registers + even when a driver is also running */ + if (ioctl(file, force ? I2C_SLAVE_FORCE : I2C_SLAVE, address) < 0) { + fprintf(stderr, + "Error: Could not set address to 0x%02x: %s\n", + address, strerror(errno)); + return -errno; + } + + return 0; +} diff --git a/prog/dump/i2cbusses.h b/prog/dump/i2cbusses.h index 35edb195..d7ecb664 100644 --- a/prog/dump/i2cbusses.h +++ b/prog/dump/i2cbusses.h @@ -24,5 +24,6 @@ void print_i2c_busses(int procfmt); int open_i2c_dev(const int i2cbus, char *filename, const int quiet); +int set_slave_addr(int file, int address, int force); #endif diff --git a/prog/dump/i2cdump.8 b/prog/dump/i2cdump.8 index 6cc758d2..711c79f3 100644 --- a/prog/dump/i2cdump.8 +++ b/prog/dump/i2cdump.8 @@ -1,9 +1,10 @@ -.TH I2CDUMP 8 "April 2006" +.TH I2CDUMP 8 "June 2007" .SH NAME i2cdump \- examine I2C registers .SH SYNOPSIS .B i2cdump +.RB [ -f ] .RB [ -y ] .I i2cbus .I address @@ -22,6 +23,13 @@ visible through the I2C bus. .B -V Display the version and exit. .TP +.B -f +Force access to the device even if it is already busy. By default, i2cdump +will refuse to access a device which is already under the control of a +kernel driver. Using this flag is dangerous, it can seriously confuse the +kernel driver in question. It can also cause i2cdump to return invalid +results. So use at your own risk and only if you know what you're doing. +.TP .B -y Disable interactive mode. By default, i2cdump will wait for a confirmation from the user before messing with the I2C bus. When this flag is used, it diff --git a/prog/dump/i2cdump.c b/prog/dump/i2cdump.c index 77d53a99..e47663ec 100644 --- a/prog/dump/i2cdump.c +++ b/prog/dump/i2cdump.c @@ -31,8 +31,8 @@ void help(void) { - fprintf(stderr, "Syntax: i2cdump [-y] I2CBUS ADDRESS [MODE] [BANK " - "[BANKREG]]\n" + fprintf(stderr, "Syntax: i2cdump [-f] [-y] I2CBUS ADDRESS [MODE] " + "[BANK [BANKREG]]\n" " i2cdump -V\n" " MODE is one of:\n" " b (byte, default)\n" @@ -60,12 +60,13 @@ int main(int argc, char *argv[]) int block[256], s_length = 0; int pec = 0, even = 0; int flags = 0; - int yes = 0, version = 0; + int force = 0, yes = 0, version = 0; /* handle (optional) flags first */ while (1+flags < argc && argv[1+flags][0] == '-') { switch (argv[1+flags][1]) { case 'V': version = 1; break; + case 'f': force = 1; break; case 'y': yes = 1; break; default: fprintf(stderr, "Warning: Unsupported flag " @@ -234,13 +235,8 @@ int main(int argc, char *argv[]) break; } - /* use FORCE so that we can look at registers even when - a driver is also running */ - if (ioctl(file, I2C_SLAVE_FORCE, address) < 0) { - fprintf(stderr, "Error: Could not set address to %d: %s\n", - address, strerror(errno)); + if (set_slave_addr(file, address, force) < 0) exit(1); - } if (pec) { if (ioctl(file, I2C_PEC, 1) < 0) { diff --git a/prog/dump/i2cget.8 b/prog/dump/i2cget.8 index 6d7d469f..642343b7 100644 --- a/prog/dump/i2cget.8 +++ b/prog/dump/i2cget.8 @@ -1,9 +1,10 @@ -.TH I2CGET 8 "September 2005" +.TH I2CGET 8 "June 2007" .SH "NAME" i2cget \- read from I2C/SMBus chip registers .SH SYNOPSIS .B i2cget +.RB [ -f ] .RB [ -y ] .I i2cbus .I chip-address @@ -21,6 +22,13 @@ bus (or SMBus). .B -V Display the version and exit. .TP +.B -f +Force access to the device even if it is already busy. By default, i2cget +will refuse to access a device which is already under the control of a +kernel driver. Using this flag is dangerous, it can seriously confuse the +kernel driver in question. It can also cause i2cget to return an invalid +value. So use at your own risk and only if you know what you're doing. +.TP .B -y Disable interactive mode. By default, i2cget will wait for a confirmation from the user before messing with the I2C bus. When this flag is used, it diff --git a/prog/dump/i2cget.c b/prog/dump/i2cget.c index acadb233..314b5192 100644 --- a/prog/dump/i2cget.c +++ b/prog/dump/i2cget.c @@ -36,8 +36,8 @@ void help(void) __attribute__ ((noreturn)); void help(void) { - fprintf(stderr, "Syntax: i2cget [-y] I2CBUS CHIP-ADDRESS [DATA-ADDRESS " - "[MODE]]\n" + fprintf(stderr, "Syntax: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS " + "[DATA-ADDRESS [MODE]]\n" " i2cget -V\n" " MODE can be: 'b' (read byte data, default)\n" " 'w' (read word data)\n" @@ -102,19 +102,6 @@ int check_funcs(int file, int i2cbus, int size, int daddress, int pec) return 0; } -int set_slave(int file, int address) -{ - /* use FORCE so that we can read registers even when - a driver is also running */ - if (ioctl(file, I2C_SLAVE_FORCE, address) < 0) { - fprintf(stderr, "Error: Could not set address to %d: %s\n", - address, strerror(errno)); - return -1; - } - - return 0; -} - int confirm(const char *filename, int address, int size, int daddress, int pec) { int dont = 0; @@ -173,12 +160,13 @@ int main(int argc, char *argv[]) char filename[20]; int pec = 0; int flags = 0; - int yes = 0, version = 0; + int force = 0, yes = 0, version = 0; /* handle (optional) flags first */ while (1+flags < argc && argv[1+flags][0] == '-') { switch (argv[1+flags][1]) { case 'V': version = 1; break; + case 'f': force = 1; break; case 'y': yes = 1; break; default: fprintf(stderr, "Warning: Unsupported flag " @@ -235,7 +223,7 @@ int main(int argc, char *argv[]) file = open_i2c_dev(i2cbus, filename, 0); if (file < 0 || check_funcs(file, i2cbus, size, daddress, pec) - || set_slave(file, address)) + || set_slave_addr(file, address, force)) exit(1); if (!yes && !confirm(filename, address, size, daddress, pec)) diff --git a/prog/dump/i2cset.8 b/prog/dump/i2cset.8 index a4b64c33..97a5c9bc 100644 --- a/prog/dump/i2cset.8 +++ b/prog/dump/i2cset.8 @@ -1,9 +1,10 @@ -.TH I2CSET 8 "September 2005" +.TH I2CSET 8 "June 2007" .SH "NAME" i2cset \- set I2C registers .SH SYNOPSIS .B i2cset +.RB [ -f ] .RB [ -y ] .I i2cbus .I chip-address @@ -24,6 +25,14 @@ bus. .B -V Display the version and exit. .TP +.B -f +Force access to the device even if it is already busy. By default, i2cset +will refuse to access a device which is already under the control of a +kernel driver. Using this flag is dangerous, it can seriously confuse the +kernel driver in question. It can also cause i2cset to silently write to +the wrong register. So use at your own risk and only if you know what +you're doing. +.TP .B -y Disable interactive mode. By default, i2cset will wait for a confirmation from the user before messing with the I2C bus. When this flag is used, it diff --git a/prog/dump/i2cset.c b/prog/dump/i2cset.c index 2f0b1d35..3be4a9c4 100644 --- a/prog/dump/i2cset.c +++ b/prog/dump/i2cset.c @@ -33,7 +33,7 @@ void help(void) __attribute__ ((noreturn)); void help(void) { - fprintf(stderr, "Syntax: i2cset [-y] I2CBUS CHIP-ADDRESS DATA-ADDRESS " + fprintf(stderr, "Syntax: i2cset [-f] [-y] I2CBUS CHIP-ADDRESS DATA-ADDRESS " "VALUE [MODE] [MASK]\n" " i2cset -V\n" " MODE is 'b[yte]' or 'w[ord]' (default b)\n" @@ -53,12 +53,13 @@ int main(int argc, char *argv[]) unsigned long funcs; int pec = 0; int flags = 0; - int yes = 0, version = 0; + int force = 0, yes = 0, version = 0; /* handle (optional) flags first */ while (1+flags < argc && argv[1+flags][0] == '-') { switch (argv[1+flags][1]) { case 'V': version = 1; break; + case 'f': force = 1; break; case 'y': yes = 1; break; default: fprintf(stderr, "Warning: Unsupported flag " @@ -160,13 +161,8 @@ int main(int argc, char *argv[]) break; } - /* use FORCE so that we can write registers even when - a driver is also running */ - if (ioctl(file, I2C_SLAVE_FORCE, address) < 0) { - fprintf(stderr, "Error: Could not set address to %d: %s\n", - address, strerror(errno)); + if (set_slave_addr(file, address, force) < 0) exit(1); - } if (!yes) { int dont = 0; From d72fcc81683698fd89781cda28a1b30b3bba9ae0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 8 Jun 2007 14:39:06 +0000 Subject: [PATCH 045/718] Replace all references to bmcsensors and i2c-ipmi for kernel 2.6 with ipmisensors and ipmi-si in sensors-detect. Original patch from Juerg Haefliger. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4434 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 85 ++++++++++++++++++++++++-------------- 2 files changed, 54 insertions(+), 32 deletions(-) diff --git a/CHANGES b/CHANGES index 782e6154..e19664e5 100644 --- a/CHANGES +++ b/CHANGES @@ -33,6 +33,7 @@ SVN HEAD Add ATI SB700 detection Add Maxim MAX6680/MAX6681 detection Add IT8726F detection + Fix IPMI support for 2.6 kernels 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 1e7ffd88..45effd70 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1512,18 +1512,6 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x50], i2c_detect => sub { max6900_detect(@_); }, }, - { - name => "IPMI BMC KCS", - driver => "bmcsensors", - isa_addrs => [ 0x0ca0 ], - isa_detect => sub { ipmi_kcs_detect(@_); }, - }, - { - name => "IPMI BMC SMIC", - driver => "bmcsensors", - isa_addrs => [ 0x0ca8 ], - isa_detect => sub { ipmi_smic_detect(@_); }, - }, { name => "Smart Battery Charger", driver => "to-be-written", @@ -1546,20 +1534,48 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); # Special case chip information goes here and would be included in # the chip_special_cases routine below -use vars qw($chip_kern24_w83791d $chip_kern26_w83791d); -$chip_kern24_w83791d = { - name => "Winbond W83791D", - driver => "w83781d", - i2c_addrs => [0x2c..0x2f], - i2c_detect => sub { w83781d_detect(7, @_); }, -}; +use vars qw(@chip_kern24_ids @chip_kern26_ids); +@chip_kern24_ids = ( + { + name => "Winbond W83791D", + driver => "w83781d", + i2c_addrs => [0x2c..0x2f], + i2c_detect => sub { w83781d_detect(7, @_); }, + }, + { + name => "IPMI BMC KCS", + driver => "bmcsensors", + isa_addrs => [0x0ca0], + isa_detect => sub { ipmi_kcs_detect(@_); }, + }, + { + name => "IPMI BMC SMIC", + driver => "bmcsensors", + isa_addrs => [0x0ca8], + isa_detect => sub { ipmi_smic_detect(@_); }, + }, +); -$chip_kern26_w83791d = { - name => "Winbond W83791D", - driver => "w83791d", - i2c_addrs => [0x2c..0x2f], - i2c_detect => sub { w83781d_detect(7, @_); }, -}; +@chip_kern26_ids = ( + { + name => "Winbond W83791D", + driver => "w83791d", + i2c_addrs => [0x2c..0x2f], + i2c_detect => sub { w83781d_detect(7, @_); }, + }, + { + name => "IPMI BMC KCS", + driver => "ipmisensors", + isa_addrs => [0x0ca0], + isa_detect => sub { ipmi_kcs_detect(@_); }, + }, + { + name => "IPMI BMC SMIC", + driver => "ipmisensors", + isa_addrs => [0x0ca8], + isa_detect => sub { ipmi_smic_detect(@_); }, + }, +); # This is a list of all recognized superio chips. # Each entry must have the following fields: @@ -3257,9 +3273,9 @@ sub chip_special_cases # Based on the kernel, add the appropriate chip structure to the # chip_ids detection list if (kernel_version_at_least(2, 6, 0)) { - push @chip_ids, $chip_kern26_w83791d; + push @chip_ids, @chip_kern26_ids; } else { - push @chip_ids, $chip_kern24_w83791d; + push @chip_ids, @chip_kern24_ids; } } @@ -5409,7 +5425,7 @@ sub generate_modprobes my ($prefer_isa) = @_; my ($chip,$detection,$nr,$i,@optionlist,@probelist,$driver,$isa,$adap); - my $bmcsensors = 0; + my $ipmi = 0; my @adapters; my $modprobes = ""; my $configfile = ""; @@ -5449,8 +5465,9 @@ sub generate_modprobes not (exists $detection->{i2c_driver} and not $prefer_isa)) { $isa=1; } - if ($chip->{driver} eq "bmcsensors") { - $bmcsensors=1; + if ($chip->{driver} eq "bmcsensors" || + $chip->{driver} eq "ipmisensors") { + $ipmi = 1; } } } @@ -5475,9 +5492,13 @@ sub generate_modprobes # i2c-isa is loaded automatically (as a dependency) since 2.6.14, # and will soon be gone. $modprobes .= "modprobe i2c-isa\n" if ($isa && !kernel_version_at_least(2, 6, 18)); - if ($bmcsensors) { + if ($ipmi) { $modprobes .= "# You must also install and load the IPMI modules\n"; - $modprobes .= "modprobe i2c-ipmi\n"; + if (kernel_version_at_least(2, 6, 0)) { + $modprobes .= "modprobe ipmi-si\n"; + } else { + $modprobes .= "modprobe i2c-ipmi\n"; + } } # Now determine the chip probe lines From e56e0039ef01820ad38e24537a270705649e1a94 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 12 Jun 2007 11:34:19 +0000 Subject: [PATCH 046/718] Cleanups to fancontrol: * Use let for arithmetic evaluation. Patch taken from the Suse package. * Kill old commented-out code. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4440 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/pwm/fancontrol | 45 ++++----------------------------------------- 2 files changed, 5 insertions(+), 41 deletions(-) diff --git a/CHANGES b/CHANGES index e19664e5..35f2b803 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,7 @@ SVN HEAD Program isadump: Detect when address bit 7 is a busy flag Fix Super-I/O exit sequence for Winbond/Fintek chips Program mkpatch: Delete + Program fancontrol: Use let for arithmetic evaluation Program pwmconfig: Use smaller steps for low PWM values Program rrd: Support only hwmon class devices Look for rrd in /usr/bin by default diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index 243c6adf..d1007b1c 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -2,7 +2,7 @@ # # Simple script implementing a temperature dependent fan speed control # -# Version 0.63 +# Version 0.64 # # Usage: fancontrol [CONFIGFILE] # @@ -188,7 +188,7 @@ function restorefans() do pwmo=${AFCPWM[$fcvcount]} pwmdisable $pwmo - fcvcount=$fcvcount+1 + let fcvcount=$fcvcount+1 done echo 'Verify fans have returned to full speed' exit 1 @@ -287,7 +287,7 @@ function UpdateFanSpeeds { then echo "new pwmval=$pwmval" fi - fcvcount=$fcvcount+1 + let fcvcount=$fcvcount+1 done } @@ -302,7 +302,7 @@ do echo "Error enabling PWM on $DIR/$pwmo" restorefans fi - fcvcount=$fcvcount+1 + let fcvcount=$fcvcount+1 done echo 'Starting automatic fan control...' @@ -313,40 +313,3 @@ do UpdateFanSpeeds sleep $INTERVAL done - -# some old stuff/missing features, will clean this up soon -#if ( test "$regulationtype" = "quad" ) ; then -# while true ; do -# temp=`cat ${temp1} | cut -b 12-13` -# if (( ${temp} < ${mintemp} )) ; -# then pwm=0 -# elif (( ${temp} > ${maxtemp} )) ; -# then pwm=255 -# else -# pwm=`calc "((10/(${maxtemp}-${mintemp})*(${temp}-${mintemp}))^2/1000*(${maxtemp}-${mintemp})*(255-${minspeed})+${minspeed})"` -# #no optimization here for readability (or sloth :)) -# fi ; -# echo $pwm > ${pwm1} ; -# -# sleep 10 ; -# done ; - -#elif ( test "$regulationtype" = "exp" ) ; then - #add support for exponential calculation here - -#else -# pwmconst=$[(255-${minspeed})/(${maxtemp}-${mintemp})] -# while true ; do -# let temp=`cat temp1 | cut -b 12-13` ; -# if (( ${temp} < ${mintemp} )) ; -# then pwm=0 -# elif (( ${temp} > ${maxtemp} )) ; -# then pwm=255 -# else -# pwm=$[(${temp}-${mintemp})*${pwmconst}+${minspeed}] -# fi ; -# echo $pwm > pwm2 ; -# -# sleep 10 ; -# done ; -#fi From 59a0831fa6cc31cda02ae474d38b10a4d7f1d216 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 12 Jun 2007 11:36:15 +0000 Subject: [PATCH 047/718] More cleanups to fancontrol: * No longer depend on grep. We already depend on egrep so let's use it everywhere. * Don't depend on awk to compute the target PWM value. Bash has an arithmetic expression evaluation engine which does the job just fine. * Use read instead of cat to read the sensor values. read is built-in, so it's cheaper. * When sysfs is used (2.6 kernel), do not postproces the sensor value reads with cut, as it is not needed. * Update the dependency list. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4441 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 ++ prog/pwm/fancontrol | 34 ++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index 35f2b803..3f3f84b9 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,8 @@ SVN HEAD Fix Super-I/O exit sequence for Winbond/Fintek chips Program mkpatch: Delete Program fancontrol: Use let for arithmetic evaluation + No longer need awk and grep + Limit calls to external programs (Linux 2.6 only) Program pwmconfig: Use smaller steps for low PWM values Program rrd: Support only hwmon class devices Look for rrd in /usr/bin by default diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index d1007b1c..d70016fb 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -2,12 +2,12 @@ # # Simple script implementing a temperature dependent fan speed control # -# Version 0.64 +# Version 0.65 # # Usage: fancontrol [CONFIGFILE] # # Dependencies: -# bash, awk, egrep, sed, lm_sensors :) +# bash, egrep, sed, cut, sleep, lm_sensors :) # # Please send any questions, comments or success stories to # marius.reiner@hdev.de @@ -104,7 +104,7 @@ DIR=/proc/sys/dev/sensors if [ ! -d $DIR ] then # For Linux 2.6, detect if config file uses the hwmon class or not yet - if echo "$AFCPWM[0]" | grep '^hwmon[0-9]' + if echo "${AFCPWM[0]}" | egrep -q '^hwmon[0-9]' then SDIR=/sys/class/hwmon else @@ -196,11 +196,6 @@ function restorefans() trap restorefans SIGHUP SIGINT SIGQUIT SIGTERM SIGKILL -# function doing all the math -function calc () { - awk "BEGIN { print $@ }" -} - # main function function UpdateFanSpeeds { let fcvcount=0 @@ -215,36 +210,43 @@ function UpdateFanSpeeds { minsa=${AFCMINSTART[$fcvcount]} minso=${AFCMINSTOP[$fcvcount]} - tval=`cat ${tsens}` + read tval < ${tsens} if [ $? -ne 0 ] then echo "Error reading temperature from $DIR/$tsens" restorefans fi - tval=`echo ${tval} |cut -d' ' -f3 |cut -d'.' -f1` if [ "$SYSFS" = "1" ] then - let tval="$tval / 1000" + let tval="($tval+500)/1000" + else + tval=`echo ${tval} | cut -d' ' -f3 | cut -d'.' -f1` fi - pwmpval=`cat ${pwmo}` + read pwmpval < ${pwmo} if [ $? -ne 0 ] then echo "Error reading PWM value from $DIR/$pwmo" restorefans fi - pwmpval=`echo ${pwmpval} | cut -d' ' -f1` + if [ "$SYSFS" != "1" ] + then + pwmpval=`echo ${pwmpval} | cut -d' ' -f1` + fi # If fanspeed-sensor output shall be used, do it if [[ -n ${fan} ]] then - fanval=`cat ${fan}` + read fanval < ${fan} if [ $? -ne 0 ] then echo "Error reading Fan value from $DIR/$fan" restorefans fi - fanval=`echo ${fanval} | cut -d' ' -f2` + if [ "$SYSFS" != "1" ] + then + fanval=`echo ${fanval} | cut -d' ' -f2` + fi else fanval=1 # set it to a non zero value, so the rest of the script still works fi @@ -270,7 +272,7 @@ function UpdateFanSpeeds { then pwmval=255 # at specified maxtemp switch to 100% else # calculate the new value from temperature and settings - pwmval=`calc "(((${tval}-${mint})/(${maxt}-${mint}))^2*(255-${minso})+${minso})" |cut -d'.' -f1` + let pwmval="((${tval}-${mint})**2)*(255-${minso})/((${maxt}-${mint})**2)+${minso}" if [ $pwmpval -eq 0 -o $fanval -eq 0 ] then # if fan was stopped start it using a safe value echo $minsa > $pwmo From 57044be111563d6404fc1fe9d148233e61f56ebf Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 12 Jun 2007 11:37:19 +0000 Subject: [PATCH 048/718] fancontrol: * Check for configuration file validity fancontrol and pwmconfig: * Support optional min and max PWM values Documentation updated accordingly. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4442 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 3 +++ doc/fancontrol.txt | 60 ++++++++++++++++++++++++++++++++--------- prog/pwm/fancontrol | 62 ++++++++++++++++++++++++++++++++++++++----- prog/pwm/fancontrol.8 | 28 ++++++++++++------- prog/pwm/pwmconfig | 47 +++++++++++++++++++++++++++----- 5 files changed, 167 insertions(+), 33 deletions(-) diff --git a/CHANGES b/CHANGES index 3f3f84b9..69c1d5c8 100644 --- a/CHANGES +++ b/CHANGES @@ -22,7 +22,10 @@ SVN HEAD Program fancontrol: Use let for arithmetic evaluation No longer need awk and grep Limit calls to external programs (Linux 2.6 only) + Check for configuration file validity + Support optional min and max PWM values Program pwmconfig: Use smaller steps for low PWM values + Support optional min and max PWM values Program rrd: Support only hwmon class devices Look for rrd in /usr/bin by default Add missing shell declarations diff --git a/doc/fancontrol.txt b/doc/fancontrol.txt index 90a9f038..25f8afb1 100644 --- a/doc/fancontrol.txt +++ b/doc/fancontrol.txt @@ -26,7 +26,7 @@ some fan fails, because you probably won't hear it anymore ;) Configuration -Since most of you are going to use the prog/pwm/pwmconfig script, the config +Since most of you are going to use the pwmconfig script, the config file syntax will be discussed last. First I'm going to describe the various variables available for changing fancontrol's behaviour: @@ -35,7 +35,7 @@ INTERVAL fancontrol will be executed FCTEMPS - Maps pwm outputs to temperature sensors so fancontrol know which + Maps pwm outputs to temperature sensors so fancontrol knows which temperature sensors should be used for calculation of new values for the corresponding pwm outputs. @@ -45,29 +45,65 @@ FCFANS stops unexpectedly. MINTEMP - The temperature at which the fan gets switched off completely. + The temperature below which the fan gets switched to minimum speed. MAXTEMP - The temperature at which the fan gets switched to full speed. + The temperature over which the fan gets switched to maximum speed. MINSTART Sets the minimum speed at which the fan begins spinning. You should use a safe value to be sure it works, even when the fan gets old. MINSTOP - The minimum speed at which the fan still spins. Use a save value here, + The minimum speed at which the fan still spins. Use a safe value here, too. -If you set up your configuration by hand, be sure to include ALL variables and -use valid values, there's no error handling yet! The file format is a bit -strange: +MINPWM + The PWM value to use when the temperature is below MINTEMP. + Typically, this will be either 0 if it is OK for the fan to plain + stop, or the same value as MINSTOP if you don't want the fan to + ever stop. + If this value isn't defined, it defaults to 0 (stopped fan). -VARIABLE=chip/pwmdev=value chip/pwmdev2=value2 [...] VARIABLE2=[...] +MAXPWM + The PWM value to use when the temperature is over MAXTEMP. + If this value isn't defined, it defaults to 255 (full speed). + +A graph might help you understand how the different values relate +to each other: + + PWM ^ + 255 + + | + | + | ,-------------- MAXPWM + | ,'. + | ,' . + | ,' . + | ,' . + | ,' . + | ,' . + | MINSTOP .' . + | | . + | | . + | | . + MINPWM |---------------' . + | . . + | . . + | . . + 0 +---------------+-------------+----------------> + MINTEMP MAXTEMP t (degree C) + +The configuration file format is a bit strange: + +VARIABLE=chip/pwmdev=value chip/pwmdev2=value2 [...] +VARIABLE2=[...] Each variable has its own line. The variable name is followed by an equal sign and the device=value pairs. These consist of the relative path to the pwm -output (from /proc/sys/dev/sensors/) for which the value is valid, equal sign -followed by the value and are seperated by a blank. +output (from /proc/sys/dev/sensors, /sys/bus/i2c/devices or /sys/class/hwmon +depending on the kernel version) for which the value is valid, equal sign +followed by the value and are separated by a blank. Example: @@ -82,7 +118,7 @@ The algorithm fancontrol first reads its configuration, writes it to arrays and loops its main function. This function gets the temperatures and fanspeeds from -lm_sensors proc files and calculates new speeds depending on temperature +kernel driver files and calculates new speeds depending on temperature changes, but only if the temp is between MINTEMP and MAXTEMP. After that, the new values are written to the pwm outputs. Currently the speed increases quadratically with rising temperature. This way you won't hear your fans most diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index d70016fb..1fac90c2 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -2,7 +2,7 @@ # # Simple script implementing a temperature dependent fan speed control # -# Version 0.65 +# Version 0.66 # # Usage: fancontrol [CONFIGFILE] # @@ -22,6 +22,7 @@ # # # Copyright 2003 Marius Reiner +# Copyright (C) 2007 Jean Delvare # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -55,6 +56,8 @@ function LoadConfig { MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP=//g'` # optional settings: FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'` + MINPWM=`egrep '^MINPWM=.*$' $1 | sed -e 's/MINPWM=//g'` + MAXPWM=`egrep '^MAXPWM=.*$' $1 | sed -e 's/MAXPWM=//g'` # Check whether all mandatory settings are set if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]] @@ -62,8 +65,12 @@ function LoadConfig { echo "Some mandatory settings missing, please check your config file!" exit 1 fi - # here the other settings should be verified - + if [ "$INTERVAL" -le 0 ] + then + echo "Error in configuration file:" + echo "INTERVAL must be at least 1" + exit 1 + fi # write settings to arrays for easier use and print them echo @@ -80,6 +87,43 @@ function LoadConfig { AFCMAXTEMP[$fcvcount]=`echo $MAXTEMP |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` AFCMINSTART[$fcvcount]=`echo $MINSTART |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` AFCMINSTOP[$fcvcount]=`echo $MINSTOP |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` + AFCMINPWM[$fcvcount]=`echo $MINPWM |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` + [ -z "${AFCMINPWM[$fcvcount]}" ] && AFCMINPWM[$fcvcount]=0 + AFCMAXPWM[$fcvcount]=`echo $MAXPWM |sed -e 's/ /\n/g' |egrep "${AFCPWM[$fcvcount]}" |cut -d'=' -f2` + [ -z "${AFCMAXPWM[$fcvcount]}" ] && AFCMAXPWM[$fcvcount]=255 + + # verify the validity of the settings + if [ "${AFCMINTEMP[$fcvcount]}" -ge "${AFCMAXTEMP[$fcvcount]}" ] + then + echo "Error in configuration file (${AFCPWM[$fcvcount]}):" + echo "MINTEMP must be less than MAXTEMP" + exit 1 + fi + if [ "${AFCMAXPWM[$fcvcount]}" -gt 255 ] + then + echo "Error in configuration file (${AFCPWM[$fcvcount]}):" + echo "MAXPWM must be at most 255" + exit 1 + fi + if [ "${AFCMINSTOP[$fcvcount]}" -ge "${AFCMAXPWM[$fcvcount]}" ] + then + echo "Error in configuration file (${AFCPWM[$fcvcount]}):" + echo "MINSTOP must be less than MAXPWM" + exit 1 + fi + if [ "${AFCMINSTOP[$fcvcount]}" -lt "${AFCMINPWM[$fcvcount]}" ] + then + echo "Error in configuration file (${AFCPWM[$fcvcount]}):" + echo "MINSTOP must be greater than or equal to MINPWM" + exit 1 + fi + if [ "${AFCMINPWM[$fcvcount]}" -lt 0 ] + then + echo "Error in configuration file (${AFCPWM[$fcvcount]}):" + echo "MINPWM must be at least 0" + exit 1 + fi + echo echo "Settings for ${AFCPWM[$fcvcount]}:" echo " Depends on ${AFCTEMP[$fcvcount]}" @@ -88,6 +132,8 @@ function LoadConfig { echo " MAXTEMP=${AFCMAXTEMP[$fcvcount]}" echo " MINSTART=${AFCMINSTART[$fcvcount]}" echo " MINSTOP=${AFCMINSTOP[$fcvcount]}" + echo " MINPWM=${AFCMINPWM[$fcvcount]}" + echo " MAXPWM=${AFCMAXPWM[$fcvcount]}" let fcvcount=fcvcount+1 done echo @@ -209,6 +255,8 @@ function UpdateFanSpeeds { maxt=${AFCMAXTEMP[$fcvcount]} minsa=${AFCMINSTART[$fcvcount]} minso=${AFCMINSTOP[$fcvcount]} + minpwm=${AFCMINPWM[$fcvcount]} + maxpwm=${AFCMAXPWM[$fcvcount]} read tval < ${tsens} if [ $? -ne 0 ] @@ -261,18 +309,20 @@ function UpdateFanSpeeds { echo "maxt=$maxt" echo "minsa=$minsa" echo "minso=$minso" + echo "minpwm=$minpwm" + echo "maxpwm=$maxpwm" echo "tval=$tval" echo "pwmpval=$pwmpval" echo "fanval=$fanval" fi if (( $tval <= $mint )) - then pwmval=0 # at specified mintemp shut fan off + then pwmval=$minpwm # below min temp, use defined min pwm elif (( $tval >= $maxt )) - then pwmval=255 # at specified maxtemp switch to 100% + then pwmval=$maxpwm # over max temp, use defined max pwm else # calculate the new value from temperature and settings - let pwmval="((${tval}-${mint})**2)*(255-${minso})/((${maxt}-${mint})**2)+${minso}" + let pwmval="((${tval}-${mint})**2)*(${maxpwm}-${minso})/((${maxt}-${mint})**2)+${minso}" if [ $pwmpval -eq 0 -o $fanval -eq 0 ] then # if fan was stopped start it using a safe value echo $minsa > $pwmo diff --git a/prog/pwm/fancontrol.8 b/prog/pwm/fancontrol.8 index 4ceb0f6e..1a50743d 100644 --- a/prog/pwm/fancontrol.8 +++ b/prog/pwm/fancontrol.8 @@ -1,4 +1,4 @@ -.TH FANCONTROL 8 "January 27, 2005" +.TH FANCONTROL 8 "June 2007" .SH NAME fancontrol \- automated software based fan speed regulation @@ -49,10 +49,10 @@ Then \fBfancontrol\fP can check the fan speed and restart it if it stops unexpectedly. .TP .B MINTEMP -The temperature below which the fan gets switched off completely. +The temperature below which the fan gets switched to minimum speed. .TP .B MAXTEMP -The temperature over which the fan gets switched to full speed. +The temperature over which the fan gets switched to maximum speed. .TP .B MINSTART Sets the minimum speed at which the fan begins spinning. You should @@ -61,10 +61,19 @@ use a safe value to be sure it works, even when the fan gets old. .B MINSTOP The minimum speed at which the fan still spins. Use a safe value here, too. +.TP +.B MINPWM +The PWM value to use when the temperature is below MINTEMP. +Typically, this will be either 0 if it is OK for the fan to plain +stop, or the same value as MINSTOP if you don't want the fan to +ever stop. +If this value isn't defined, it defaults to 0 (stopped fan). +.TP +.B MAXPWM +The PWM value to use when the temperature is over MAXTEMP. +If this value isn't defined, it defaults to 255 (full speed). .PP -If you set up your configuration by hand, be sure to include ALL variables and -use valid values, there's no error handling yet! The file format is a bit -strange: +The configuration file format is a bit strange: .IP .nf VARIABLE=chip/pwmdev=value chip/pwmdev2=value2 @@ -73,8 +82,9 @@ VARIABLE2=... .PP Each variable has its own line. The variable name is followed by an equal sign and the device=value pairs. These consist of the relative path to the pwm -output (from /proc/sys/dev/sensors/) for which the value is valid, equal sign -followed by the value and are seperated by a blank. Example: +output (from /proc/sys/dev/sensors, /sys/bus/i2c/devices or /sys/class/hwmon +depending on the kernel version) for which the value is valid, equal sign +followed by the value and are separated by a blank. Example: .IP MINTEMP=w83627hf-isa-0290/pwm2=40 w83627hf-isa-0290/pwm1=54 .PP @@ -86,7 +96,7 @@ editing the config file directly following the rules above. \fBfancontrol\fP first reads its configuration, writes it to arrays and loops its main function. This function gets the temperatures and fanspeeds from -lm_sensors proc files and calculates new speeds depending on temperature +kernel driver files and calculates new speeds depending on temperature changes, but only if the temp is between MINTEMP and MAXTEMP. After that, the new values are written to the PWM outputs. Currently the speed increases quadratically with rising temperature. This way you won't hear your fans most diff --git a/prog/pwm/pwmconfig b/prog/pwm/pwmconfig index c9140713..7657d946 100755 --- a/prog/pwm/pwmconfig +++ b/prog/pwm/pwmconfig @@ -1,6 +1,6 @@ #!/bin/bash # -# pwmconfig v0.7 +# pwmconfig v0.8 # Tests the pwm outputs of sensors and configures fancontrol # # Warning!!! This program will stop your fans, one at a time, @@ -10,6 +10,7 @@ # program has exited!!! # # Copyright 2003-2005 The lm_sensors project +# Copyright (C) 2007 Jean Delvare # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -485,6 +486,8 @@ function LoadConfig { MAXTEMP=`egrep '^MAXTEMP=.*$' $1 | sed -e 's/MAXTEMP= *//g'` MINSTART=`egrep '^MINSTART=.*$' $1 | sed -e 's/MINSTART= *//g'` MINSTOP=`egrep '^MINSTOP=.*$' $1 | sed -e 's/MINSTOP= *//g'` + MINPWM=`egrep '^MINPWM=.*$' $1 | sed -e 's/MINPWM= *//g'` + MAXPWM=`egrep '^MAXPWM=.*$' $1 | sed -e 's/MAXPWM= *//g'` # Check for configuration change local item @@ -499,6 +502,8 @@ function LoadConfig { MAXTEMP="" MINSTART="" MINSTOP="" + MINPWM="" + MAXPWM="" fi done } @@ -556,8 +561,10 @@ function SaveConfig { echo "Saving configuration to $FCCONFIG..." tmpfile=`mktemp -t pwmcfg.XXXXXXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; } trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15 - egrep -v '(INTERVAL|FCTEMPS|FCFANS|MAXTEMP|MINTEMP|MINSTART|MINSTOP)' $FCCONFIG >$tmpfile + egrep -v '(INTERVAL|FCTEMPS|FCFANS|MAXTEMP|MINTEMP|MINSTART|MINSTOP|MINPWM|MAXPWM)' $FCCONFIG >$tmpfile echo -e "INTERVAL=$INTERVAL\nFCTEMPS=$FCTEMPS\nFCFANS=$FCFANS\nMINTEMP=$MINTEMP\nMAXTEMP=$MAXTEMP\nMINSTART=$MINSTART\nMINSTOP=$MINSTOP" >>$tmpfile + [ -n "$MINPWM" ] && echo "MINPWM=$MINPWM" >>$tmpfile + [ -n "$MAXPWM" ] && echo "MAXPWM=$MAXPWM" >>$tmpfile mv $tmpfile $FCCONFIG #check if file was written correctly echo 'Configuration saved' @@ -599,6 +606,8 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co echo " MAXTEMP=`echo $MAXTEMP |sed -e \"s/ /\n/g\" |egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`" echo " MINSTART=`echo $MINSTART |sed -e \"s/ /\n/g\" |egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`" echo " MINSTOP=`echo $MINSTOP |sed -e \"s/ /\n/g\" |egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`" + echo " MINPWM=`echo $MINPWM |sed -e \"s/ /\n/g\" |egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`" + echo " MAXPWM=`echo $MAXPWM |sed -e \"s/ /\n/g\" |egrep \"${pwmo}\" |sed -e \"s/.*=//g\"`" done echo ;; @@ -640,8 +649,8 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co fi fi echo - echo 'Enter the low temperature (C)' - echo -n "at which the fan should be switched off ($DEFMINTEMP): " + echo 'Enter the low temperature (degree C)' + echo -n "below which the fan should spin at minimum speed ($DEFMINTEMP): " read XMT if [ "$XMT" = "" ] then @@ -654,8 +663,8 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co MINTEMP="`echo $MINTEMP | sed -e \"s/${pwmsed}[^ ]* *//g\"` ${pwms}=${XMT}" fi echo - echo 'Enter the high temperature (C)' - echo -n "at which the fan should be switched to full speed ($DEFMAXTEMP): " + echo 'Enter the high temperature (degree C)' + echo -n "over which the fan should spin at maximum speed ($DEFMAXTEMP): " read XMT if [ "$XMT" = "" ] then @@ -706,6 +715,32 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co MINSTOP="`echo $MINSTOP | sed -e \"s/${pwmsed}[^ ]* *//g\"` ${pwms}=${XMV}" fi echo + echo "Enter the PWM value (0-$XMV) to use when the temperature" + echo -n "is below the low temperature limit (0): " + read XMINP + if [ -n "$XMINP" ] + then + if [ "$MINPWM" = "" ] + then + MINPWM="${pwms}=${XMINP}" + else + MINPWM="`echo $MINPWM | sed -e \"s/${pwmsed}[^ ]* *//g\"` ${pwms}=${XMINP}" + fi + fi + echo + echo "Enter the PWM value ($XMV-$MAX) to use when the temperature" + echo -n "is over the high temperature limit ($MAX): " + read XMAXP + if [ -n "$XMAXP" ] + then + if [ "$MAXPWM" = "" ] + then + MAXPWM="${pwms}=${XMAXP}" + else + MAXPWM="`echo $MAXPWM | sed -e \"s/${pwmsed}[^ ]* *//g\"` ${pwms}=${XMAXP}" + fi + fi + echo break; done ;; From 835f9b492c24a6da8468cbe5fdacbc1c5c49172d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 12 Jun 2007 11:37:59 +0000 Subject: [PATCH 049/718] fancontrol: Better integration with init scripts (picked from Suse) * Do not return with an error when receiving SIGTERM. * Handle signals while sleeping. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4443 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/pwm/fancontrol | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 69c1d5c8..9486b355 100644 --- a/CHANGES +++ b/CHANGES @@ -24,6 +24,7 @@ SVN HEAD Limit calls to external programs (Linux 2.6 only) Check for configuration file validity Support optional min and max PWM values + Better integration with init scripts Program pwmconfig: Use smaller steps for low PWM values Support optional min and max PWM values Program rrd: Support only hwmon class devices diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index 1fac90c2..107da10a 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -228,6 +228,7 @@ function pwmenable() function restorefans() { + local status=$1 echo 'Aborting, restoring fans...' let fcvcount=0 while (( $fcvcount < ${#AFCPWM[@]} )) # go through all pwm outputs @@ -237,10 +238,11 @@ function restorefans() let fcvcount=$fcvcount+1 done echo 'Verify fans have returned to full speed' - exit 1 + exit $status } -trap restorefans SIGHUP SIGINT SIGQUIT SIGTERM SIGKILL +trap 'restorefans 0' SIGQUIT SIGTERM +trap 'restorefans 1' SIGHUP SIGINT # main function function UpdateFanSpeeds { @@ -262,7 +264,7 @@ function UpdateFanSpeeds { if [ $? -ne 0 ] then echo "Error reading temperature from $DIR/$tsens" - restorefans + restorefans 1 fi if [ "$SYSFS" = "1" ] then @@ -275,7 +277,7 @@ function UpdateFanSpeeds { if [ $? -ne 0 ] then echo "Error reading PWM value from $DIR/$pwmo" - restorefans + restorefans 1 fi if [ "$SYSFS" != "1" ] then @@ -289,7 +291,7 @@ function UpdateFanSpeeds { if [ $? -ne 0 ] then echo "Error reading Fan value from $DIR/$fan" - restorefans + restorefans 1 fi if [ "$SYSFS" != "1" ] then @@ -326,14 +328,15 @@ function UpdateFanSpeeds { if [ $pwmpval -eq 0 -o $fanval -eq 0 ] then # if fan was stopped start it using a safe value echo $minsa > $pwmo - sleep 1 + # Sleep while still handling signals + read < <(exec sleep 1) fi fi echo $pwmval > $pwmo # write new value to pwm output if [ $? -ne 0 ] then echo "Error writing PWM value to $DIR/$pwmo" - restorefans + restorefans 1 fi if [ "$DEBUG" != "" ] then @@ -352,7 +355,7 @@ do if [ $? -ne 0 ] then echo "Error enabling PWM on $DIR/$pwmo" - restorefans + restorefans 1 fi let fcvcount=$fcvcount+1 done @@ -363,5 +366,6 @@ echo 'Starting automatic fan control...' while true do UpdateFanSpeeds - sleep $INTERVAL + # Sleep while still handling signals + read < <(exec sleep $INTERVAL) done From cdbf3eaa7093924598f89394e18b38f261c8f8b7 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Thu, 14 Jun 2007 12:30:17 +0000 Subject: [PATCH 050/718] Merge from trunk: 4399 git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4444 7894878c-1315-0410-8ee3-d5d059ff63e0 --- TODO | 2 -- 1 file changed, 2 deletions(-) diff --git a/TODO b/TODO index 1ab7bde0..ad7c2f27 100644 --- a/TODO +++ b/TODO @@ -93,8 +93,6 @@ LIBRARY enum sensor-type { volt, fan, temp, volt_min, volt_max, fan_div, fan_min, temp_over, temp_hyst } -* reload does not work (Bison/Flex problem?). - * Some library routines are pretty inefficient right now. * Library should be split in more separate files, for better linking From b23feefd215de5f45a6da2c27bd49fbd055426de Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Thu, 14 Jun 2007 12:31:26 +0000 Subject: [PATCH 051/718] Merge from trunk: 4400 git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4445 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/py-smbus/smbusmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/py-smbus/smbusmodule.c b/prog/py-smbus/smbusmodule.c index b512291f..74fd0afb 100644 --- a/prog/py-smbus/smbusmodule.c +++ b/prog/py-smbus/smbusmodule.c @@ -495,7 +495,7 @@ SMBus_read_i2c_block_data(SMBus *self, PyObject *args) int addr, cmd; union i2c_smbus_data data; - if (!PyArg_ParseTuple(args, "ii:read_block_data", &addr, &cmd)) + if (!PyArg_ParseTuple(args, "ii:read_i2c_block_data", &addr, &cmd)) return NULL; SMBus_SET_ADDR(self, addr); From 3fd5aba00088dfeb1e78270f0ba658ecd8e66b16 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sat, 16 Jun 2007 14:01:05 +0000 Subject: [PATCH 052/718] ported r4435 from trunk git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4450 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/py-smbus/smbusmodule.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/prog/py-smbus/smbusmodule.c b/prog/py-smbus/smbusmodule.c index 74fd0afb..f0ca53c5 100644 --- a/prog/py-smbus/smbusmodule.c +++ b/prog/py-smbus/smbusmodule.c @@ -1,6 +1,6 @@ /* * smbusmodule.c - Python bindings for Linux SMBus access through i2c-dev - * Copyright (C) 2005,2006 Mark M. Hoffman + * Copyright (C) 2005-2007 Mark M. Hoffman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,15 @@ #include #include +/* +** These are required to build this module against Linux older than 2.6.23. +*/ +#ifndef I2C_SMBUS_I2C_BLOCK_BROKEN +#undef I2C_SMBUS_I2C_BLOCK_DATA +#define I2C_SMBUS_I2C_BLOCK_BROKEN 6 +#define I2C_SMBUS_I2C_BLOCK_DATA 8 +#endif + PyDoc_STRVAR(SMBus_module_doc, "This module defines an object type that allows SMBus transactions\n" "on Linux hosts. The host kernel must have I2C support, I2C device\n" @@ -486,22 +495,25 @@ SMBus_block_process_call(SMBus *self, PyObject *args) } PyDoc_STRVAR(SMBus_read_i2c_block_data_doc, - "read_i2c_block_data(addr, cmd) -> results\n\n" + "read_i2c_block_data(addr, cmd, len=32) -> results\n\n" "Perform I2C Block Read transaction.\n"); static PyObject * SMBus_read_i2c_block_data(SMBus *self, PyObject *args) { - int addr, cmd; + int addr, cmd, len=32; union i2c_smbus_data data; - if (!PyArg_ParseTuple(args, "ii:read_i2c_block_data", &addr, &cmd)) + if (!PyArg_ParseTuple(args, "ii|i:read_i2c_block_data", &addr, &cmd, + &len)) return NULL; SMBus_SET_ADDR(self, addr); + data.block[0] = len; /* save a bit of code by calling the access function directly */ if (i2c_smbus_access(self->fd, I2C_SMBUS_READ, (__u8)cmd, + len = 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN: I2C_SMBUS_I2C_BLOCK_DATA, &data)) { PyErr_SetFromErrno(PyExc_IOError); return NULL; @@ -529,7 +541,7 @@ SMBus_write_i2c_block_data(SMBus *self, PyObject *args) /* save a bit of code by calling the access function directly */ if (i2c_smbus_access(self->fd, I2C_SMBUS_WRITE, (__u8)cmd, - I2C_SMBUS_I2C_BLOCK_DATA, &data)) { + I2C_SMBUS_I2C_BLOCK_BROKEN, &data)) { PyErr_SetFromErrno(PyExc_IOError); return NULL; } From 8b5ed619c0352e03b77a917e8b8f7de39298f1f7 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sat, 16 Jun 2007 14:02:23 +0000 Subject: [PATCH 053/718] ported r4446 from trunk git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4451 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/py-smbus/smbusmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/py-smbus/smbusmodule.c b/prog/py-smbus/smbusmodule.c index f0ca53c5..afc54a41 100644 --- a/prog/py-smbus/smbusmodule.c +++ b/prog/py-smbus/smbusmodule.c @@ -513,7 +513,7 @@ SMBus_read_i2c_block_data(SMBus *self, PyObject *args) data.block[0] = len; /* save a bit of code by calling the access function directly */ if (i2c_smbus_access(self->fd, I2C_SMBUS_READ, (__u8)cmd, - len = 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN: + len == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN: I2C_SMBUS_I2C_BLOCK_DATA, &data)) { PyErr_SetFromErrno(PyExc_IOError); return NULL; From 85393f35b6a441b2850246434e3ca90a58df25b5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 08:18:47 +0000 Subject: [PATCH 054/718] Always build libsensors with sysfs support. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4458 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + Makefile | 9 --------- lib/Module.mk | 10 +--------- lib/sysfs.h | 10 ---------- 4 files changed, 2 insertions(+), 28 deletions(-) diff --git a/CHANGES b/CHANGES index 9486b355..1af0af72 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,7 @@ SVN HEAD Library: Clean up pwm symbol names translation Add dme1737 support Delete support of non-sensor drivers (ddcmon, eeprom) + Always build with sysfs support Man page sensors.conf.5: Update the chip statement section Programs i2cdump, i2cget, i2cset: Do not force the slave address by default Program i2cdump: Use the new I2C block read function diff --git a/Makefile b/Makefile index 61a5b39e..df32bfcc 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,6 @@ PREFIX := /usr/local # Your C compiler CC := gcc -# Build with sysfs support -SYSFS_SUPPORT := 1 - # This is the directory where sensors.conf will be installed, if no other # configuration file is found ETCDIR := /etc @@ -157,14 +154,8 @@ ALL_CFLAGS += $(CFLAGS) PROGCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS) -Wundef PROGCFLAGS := $(ALL_CFLAGS) ARCPPFLAGS := $(ALL_CPPFLAGS) -ifdef SYSFS_SUPPORT -ARCPPFLAGS := $(ARCPPFLAGS) -DSYSFS_SUPPORT -endif ARCFLAGS := $(ALL_CFLAGS) LIBCPPFLAGS := $(ALL_CPPFLAGS) -ifdef SYSFS_SUPPORT -LIBCPPFLAGS := $(LIBCPPFLAGS) -DSYSFS_SUPPORT -endif LIBCFLAGS := -fpic -D_REENTRANT $(ALL_CFLAGS) .PHONY: all user clean install user_install uninstall user_uninstall version package diff --git a/lib/Module.mk b/lib/Module.mk index dc51fb0a..f8cbdfe8 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -49,10 +49,7 @@ LIBTARGETS := $(MODULE_DIR)/$(LIBSTLIBNAME) $(MODULE_DIR)/$(LIBSHLIBNAME) \ LIBCSOURCES := $(MODULE_DIR)/data.c $(MODULE_DIR)/general.c \ $(MODULE_DIR)/error.c $(MODULE_DIR)/chips.c \ $(MODULE_DIR)/proc.c $(MODULE_DIR)/access.c \ - $(MODULE_DIR)/init.c -ifdef SYSFS_SUPPORT - LIBCSOURCES := $(LIBCSOURCES) $(MODULE_DIR)/sysfs.c -endif + $(MODULE_DIR)/init.c $(MODULE_DIR)/sysfs.c LIBOTHEROBJECTS := $(MODULE_DIR)/conf-parse.o $(MODULE_DIR)/conf-lex.o LIBSHOBJECTS := $(LIBCSOURCES:.c=.lo) $(LIBOTHEROBJECTS:.o=.lo) @@ -64,13 +61,8 @@ LIBHEADERFILES := $(MODULE_DIR)/error.h $(MODULE_DIR)/sensors.h \ $(MODULE_DIR)/chips.h # How to create the shared library -ifdef SYSFS_SUPPORT $(MODULE_DIR)/$(LIBSHLIBNAME): $(LIBSHOBJECTS) $(CC) -shared -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm -lsysfs -else -$(MODULE_DIR)/$(LIBSHLIBNAME): $(LIBSHOBJECTS) - $(CC) -shared -Wl,-soname,$(LIBSHSONAME) -o $@ $^ -lc -lm -endif $(MODULE_DIR)/$(LIBSHSONAME): $(MODULE_DIR)/$(LIBSHLIBNAME) $(RM) $@ diff --git a/lib/sysfs.h b/lib/sysfs.h index 351524d2..331307ad 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -20,7 +20,6 @@ #ifndef SENSORS_LIB_SYSFS_H #define SENSORS_LIB_SYSFS_H -#ifdef SYSFS_SUPPORT extern int sensors_found_sysfs; extern char sensors_sysfs_mount[]; @@ -31,13 +30,4 @@ extern int sensors_read_sysfs_chips(void); extern int sensors_read_sysfs_bus(void); -#else - -#define sensors_found_sysfs 0 -#define sensors_init_sysfs() 0 -#define sensors_read_sysfs_chips() (-1) -#define sensors_read_sysfs_bus() (-1) - -#endif - #endif /* !SENSORS_LIB_SYSFS_H */ From 02c37024e3a4bfcef8f6b5e4bbadb9c061fdc624 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 08:45:37 +0000 Subject: [PATCH 055/718] Delete documentation generation scripts, they're obsolete. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4459 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/doc/doc-features.pl | 357 --------------------------------------- prog/doc/doc-insmod.pl | 93 ---------- 3 files changed, 1 insertion(+), 450 deletions(-) delete mode 100755 prog/doc/doc-features.pl delete mode 100755 prog/doc/doc-insmod.pl diff --git a/CHANGES b/CHANGES index 1af0af72..7cef0ee8 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ SVN HEAD Delete support of non-sensor drivers (ddcmon, eeprom) Always build with sysfs support Man page sensors.conf.5: Update the chip statement section + Programs doc/*: Delete, obsolete Programs i2cdump, i2cget, i2cset: Do not force the slave address by default Program i2cdump: Use the new I2C block read function Program isadump: Detect when address bit 7 is a busy flag diff --git a/prog/doc/doc-features.pl b/prog/doc/doc-features.pl deleted file mode 100755 index 986edec2..00000000 --- a/prog/doc/doc-features.pl +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/perl -w - -# -# doc-features.pl - Generate module/library documentation -# Copyright (c) 1999 Frodo Looijaard -# Copyright (c) 2002 Jean Delvare -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - -use strict; - -# %prefix contains the SENSORS_*_PREFIX defines as found in lib/chips.h. -# It is generated by scan_chips_h(). It shouldn't have duplicated values. -# %arrayname contains the sensors_chip_features array as found in -# lib/chips.c. It is generated by scan_chips_c_1(). It may have duplicated -# values. -# %prefix and %arrayname are expected to have the same set of keys, and -# this is verified in scan_all(). -# -# %sysctl contains the sysctl filenames as found in kernel/chips/*.c. It -# is generated by scan_kernel_chip, which is called on each file. It has -# (of course) duplicated values. -# -# %features contains the features for all chips as found in lib/chips.c. -# They are stored as arrays of references to hashes, each containing the -# following fields: -# number: The preprocessor symbol for the number of this feature -# name: The name of this feature -# logical_mapping: The preprocessor symbol for the logical mapping -# feature -# compute_mapping: The preprocessor symbol for the compute mapping -# feature -# mode_read: 1 if the feature is readable, 0 if not -# mode_write: 1 if the feature is writable, 0 if not -# sysctl: Preprocessor name of the sysctl file -# offset: Offset (in longs) within the sysctl file -# magnitude: Magnitude of this feature -# -# %mapping contains the feature names. It is generated while parsing -# lib/chips.c and is later used to display the mappings. - -use vars qw(%prefix %arrayname %sysctl %features %mapping); - -# Scan chips.h to get all prefixes values. -# Store the results in %prefix. -# $_[0]: Path to chips.h -sub scan_chips_h -{ - my $chips_h = shift; - - open INPUTFILE, $chips_h - or die "Can't open $chips_h"; - - while () - { - if (m/^\s*#\s*define\s+(SENSORS_\w+_PREFIX)\s+"(\S+)"/) - { - die "Duplicate #define $1 in $chips_h" - if defined $prefix{$1}; - $prefix{$1} = $2; - } - } - - close INPUTFILE; -} - -# Scan chips.c to get the feature array names. -# Store the results in %arrayname. -# $_[0]: Path to chips.c -sub scan_chips_c_1 -{ - my $chips_c = shift; - open INPUTFILE, $chips_c - or die "Can't open $chips_c"; - - while ( !~ m/^\s*sensors_chip_features\s/) {} - while () - { - last if m/^\s*\{\s*0/; - if (m/^\s*\{\s*(SENSORS_\w+_PREFIX)\s*,\s*(\w+)\s*\}\s*,/) - { - die "Duplicate entry $1 in sensors_chip_features" - if defined $arrayname{$1}; - $arrayname{$1} = $2; - } - } - - close INPUTFILE; -} - -# Returns a list of tokens. -# Tokens are either '{', '}', ',', ';' or anything between them. Spaces on -# each side of a token are removed; spaces inside a token are not. -# Used by scan_kernel_chip() and scan_chips_c_2(). -# $_[0]: Line to tokenize -sub tokenize -{ - my $line = shift; - - my @res = (); - $line =~ s/^\s*//; - - while (length $line) - { - last if $line =~ s/^\s*$//; - $line =~ s/^([{};,])\s*// - or $line =~ s/^([^{},;]+?)\s*([{},;\n])/$2/; - die "Parse error" - unless defined $1; - push @res, $1; - } - - return @res; -} - -# Scan one chip file to get sysctl filenames. -# Store the results in %prefix. -# $_[0]: Kernel chip filename -sub scan_kernel_chip -{ - my $chip = shift; - my $line; - - open INPUTFILE, $chip - or die "Can't open $chip"; - - while ($line = ) - { - next unless $line =~ m/^\s*static\s+ctl_table/; - last if $line =~ m/;/; # Skip dynamic ctl_table - my @tokens = tokenize($line); - - while ($line = ) - { - push @tokens, tokenize($line); - last if $line =~ m/;/; - } - - while (shift @tokens ne '{') { die "Tokenization failed in $chip" unless @tokens } - for (;;) - { - while (shift @tokens ne '{') { die "Tokenization failed in $chip" unless @tokens } - my $val = shift @tokens; - last if $val eq '0'; - die "Parse error: ',' expected after '$val' within $chip" - if shift @tokens ne ','; - my $name = shift @tokens; - die "Parse error: invalid name '$name' within $chip" - unless ($sysctl{$val}) = $name =~ m/^"(.+)"$/; - } - } - - close INPUTFILE; -} - -# Scan chips.c to get the feature arrays. -# Store the results in %feature. -# $_[0]: Path to chips.c -sub scan_chips_c_2 -{ - my $chips_c = shift; - my $line; - - open INPUTFILE, $chips_c or - die "Can't open $chips_c"; - while () - { - next unless m/sensors_chip_feature\s+(\w+)\s*\[/; - my $name = $1; - - my @tokens = (); - while ($line = ) - { - push @tokens, tokenize($line); - last if $line =~ m/;/; - } - - $features{$name} = []; - die "Parse error: '{' expected for $name" - if shift @tokens ne '{'; - for(;;) - { - my $new = {}; - while (shift @tokens ne '{') { die unless @tokens } - $new->{number} = shift @tokens; - last if $new->{number} eq '0'; - die "Parse error: ',' expected for $name" - if shift @tokens ne ','; - ($new->{name}) = (shift @tokens) =~ m/^"(.*)"$/ - or die "Parse error: Bad name for $name"; - die "Parse error: ',' expected for $name" - if shift @tokens ne ','; - $new->{logical_mapping} = shift @tokens; - die "Parse error: ',' expected for $name" - if shift @tokens ne ','; - $new->{compute_mapping} = shift @tokens; - die "Parse error: ',' expected for $name" - if shift @tokens ne ','; - my $next = shift @tokens; - $new->{mode_read} = ($next =~ m/_RW?$/); - $new->{mode_write} = ($next =~ m/_R?W$/); - die "Parse error: ',' expected for $name" - if shift @tokens ne ','; - $new->{sysctl} = shift @tokens; - die "Parse error: ',' expected for $name" - if shift @tokens ne ','; - ($new->{offset}) = (shift @tokens) =~ m/^VALUE\s*\(\s*(\d+)\s*\)/ - or die "Parse error: Bad offset for $name"; - die "Parse error: ',' expected for $name" - if shift @tokens ne ','; - $new->{magnitude} = shift @tokens; - push @{$features{$name}}, $new; - $mapping{$new->{number}} = $new->{name}; - while (shift @tokens ne '}') { die unless @tokens } - die "Parse error: ',' expected after $name" - if shift @tokens ne ','; - } - } - - close INPUTFILE; -} - -# $_[0]: Base directory -sub scan_all -{ - my $basedir = shift; - - $basedir =~ s/\/*$//; - - # Generate %prefix - scan_chips_h("$basedir/lib/chips.h"); - # Generate %arrayname - scan_chips_c_1("$basedir/lib/chips.c"); - - # Check that %prefix and %arrayname have the same set of keys - foreach my $item (keys %prefix) - { - die "Missing array name for $item" - unless defined $arrayname{$item}; - } - foreach my $item (keys %arrayname) - { - die "Missing #define for $item" - unless defined $prefix{$item}; - } - - #Generate ?? - scan_chips_c_2("$basedir/lib/chips.c"); - # Generate %sysctl - foreach my $filename (glob "$basedir/kernel/chips/*.c") - { - scan_kernel_chip($filename); - } -} - -# $_[0]: Prefix -sub output_data -{ - my $index = shift; - - printf "Chip '\%s'\n", $prefix{$index}; - print "\n"; - - printf "\%-21s \%-21s \%-21s \%5s \%5s\n", 'LABEL', 'LABEL CLASS', - 'COMPUTE CLASS', 'MODE', 'MAGN'; - foreach my $data (@{$features{$arrayname{$index}}}) - { - print STDERR "Missing logical mapping for $data->{logical_mapping} (index = $index, name = $data->{name})\n" - unless defined $mapping{$data->{logical_mapping}}; - print STDERR "Missing compute mapping for $data->{compute_mapping} (index = $index, name = $data->{name})\n" - unless defined $mapping{$data->{compute_mapping}}; - - printf "\%-21s \%-21s \%-21s \%4s \%2d\n", $data->{name}, - $mapping{$data->{logical_mapping}} || '?', - $mapping{$data->{compute_mapping}} || '?', - ($data->{mode_read}?'R':'-').($data->{mode_write}?'W':'-'), - $data->{magnitude}; - } - print "\n"; - - printf "\%-21s \%-38s \%16s:\%1s\n", 'LABEL', 'FEATURE SYMBOL', - 'SYSCTL FILE', 'N'; - foreach my $data (@{$features{$arrayname{$index}}}) - { - print STDERR "Missing sysctl for $data->{sysctl} (index = $index, name = $data->{name})\n" - unless defined $sysctl{$data->{sysctl}}; - - printf "\%-21s \%-38s \%16s:\%1d\n",$data->{name}, $data->{number}, - $sysctl{$data->{sysctl}} || '?', $data->{offset}; - } - print "\n", "\n"; -} - -if (@ARGV < 1 or $ARGV[0] =~ m/^-/) -{ - print "Usage: $0 PATH [PREFIXES ...]\n", - " PATH is the path to the base directory of the lm_sensors tree.\n", - " PREFIXES are the chips that have to be output. If none are\n", - " specified, all chips are printed.\n"; - exit 0; -} - -%prefix = %arrayname = %sysctl = %features = (); -%mapping = (SENSORS_NO_MAPPING => '-'); - -scan_all(shift @ARGV); - -print "Chip Features\n", "-------------\n", "\n"; - -if (@ARGV) -{ - my %rprefix = reverse %prefix; - foreach my $prefix (@ARGV) - { - if (exists $rprefix{$prefix}) - { - output_data($rprefix{$prefix}) - } - else - { - my $lines = 0; - print "No chip named `$prefix' was found.\n", - "Suggestions:\n"; - foreach my $k (sort keys %rprefix) - { - if (grep /$prefix/, $k) - { - print " $k\n"; - $lines++; - } - } - print " (none)\n" - unless $lines; - print "\n"; - } - } -} -else -{ - foreach my $item (sort keys %prefix) - { - output_data($item); - } -} diff --git a/prog/doc/doc-insmod.pl b/prog/doc/doc-insmod.pl deleted file mode 100755 index 289ab5c4..00000000 --- a/prog/doc/doc-insmod.pl +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/perl -w - -# -# doc-insmod.pl - Generate module parameters documentation -# Copyright (c) 1998, 1999 Frodo Looijaard -# Copyright (c) 2002 Jean Delvare -# -# Known to work with Linux modutils 2.3.10-pre1, 2.4.6, 2.4.15, 2.4.16 -# and 2.4.19. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - - -use strict; -use Text::Wrap; -use vars qw($modinfo); - -$modinfo = 'modinfo'; -$ENV{PATH} = '/sbin'; - -sub get_modinfo_version -{ - my $line = `$modinfo -V`; - - return undef unless $line =~ m/\b(\d+)\.(\d+)\.(\d+)/; - return ($1<<16)+($2<<8)+$3; -} - -# @_[0]: name or full path of the kernel module -sub print_modinfo -{ - my $modname = shift; - my $version = get_modinfo_version(); - - unless ($modname =~ m/^([\w\d.\/-]+)$/) - { - print STDERR "Invalid module name.\n"; - return; - } - $modname = $1; - - my ($author, $license); - $author = `$modinfo -a $modname`; - $author =~ s/\n\s+/ /mg; # handle multiline authors - $author =~ s/^"//; - $author =~ s/"$//; - if (defined $version and $version >= (2<<16)+(4<<8)+15) - { - $license = `$modinfo -l $modname`; - $license =~ s/^"//; - $license =~ s/"$//; - } - - print wrap('Author: ', ' ', $author), "\n"; - print wrap('License: ', ' ', $license), "\n" - if defined $license; - print "\n", "Module Parameters\n", "-----------------\n", "\n"; - - my $lines = 0; - open OPTIONS, "$modinfo -p $modname |"; - while () - { - next unless m/^(parm:\s*)?(\S+) (.+), description "(.*)"$/; - print "* $2: $3\n", - wrap(' ', ' ', $4), "\n"; - $lines++; - } - close OPTIONS; - print "(none)\n" - unless $lines; -} - -if (@ARGV != 1 or $ARGV[0] =~ /^-/) -{ - print "Usage: $0 MODULE\n", - " MODULE is a module name or the full path to a module file.\n"; - exit 0; -} - -print_modinfo($ARGV[0]); From 116e411b2dcb7a95dd27ed45b11b0266c70b7d83 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 08:47:05 +0000 Subject: [PATCH 056/718] Drop description of deleted doc scripts. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4460 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/progs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/doc/progs b/doc/progs index b4c2cf63..0e6201e1 100644 --- a/doc/progs +++ b/doc/progs @@ -30,19 +30,6 @@ see useful_addresses.html. connected to them, as well as Super-I/O and misc chips. It also generates modprobe lines and module options. This program is interactive. -* prog/doc/doc-features.pl (written in Perl, not installed) - This program is used to help us generate driver documentation; it scans - some C source programs to do this. Syntax: - ./doc-features.pl BASE [PREFIX...] - BASE is the path to the base directory of the lm_sensors tree - PREFIX is one of more prefixes of chips you want documented; if left out, - all chips are documented. - -* prog/doc/doc-insmod.pl (written in Perl, not installed) - This program is used to help us generate driver documentation; it reads - all module information and outputs insmod parameter information. Syntax: - ./doc-insmod.pl DRIVER - * prog/dump/i2cdump (written in C, installed by 'make install') This program dumps the registers of an I2C device. Usual syntax: From c8b02ddfa36f8e2296fb037d81b4c423bea1f97a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 11:39:08 +0000 Subject: [PATCH 057/718] Install libsensors as libsensors.so.4, and sensors as sensors3. This makes it possible to install both the old and the new libsensors and sensors, making testing much easier. sensors3 will be renamed back to sensors before we release. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4461 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/Module.mk | 4 ++-- prog/sensors/Module.mk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Module.mk b/lib/Module.mk index f8cbdfe8..94cac2c7 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -32,8 +32,8 @@ LIBMAN5FILES := $(MODULE_DIR)/sensors.conf.5 # changed in a backward incompatible way. The interface is defined by # the public header files - in this case they are error.h, sensors.h, # chips.h. -LIBMAINVER := 3 -LIBMINORVER := 1.3 +LIBMAINVER := 4 +LIBMINORVER := 0.0 LIBVER := $(LIBMAINVER).$(LIBMINORVER) # The static lib name, the shared lib name, and the internal ('so') name of diff --git a/prog/sensors/Module.mk b/prog/sensors/Module.mk index a758b1d1..b07dfb5a 100644 --- a/prog/sensors/Module.mk +++ b/prog/sensors/Module.mk @@ -26,7 +26,7 @@ PROGSENSORSMAN1FILES := $(MODULE_DIR)/sensors.1 # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... -PROGSENSORSTARGETS := $(MODULE_DIR)/sensors +PROGSENSORSTARGETS := $(MODULE_DIR)/sensors3 PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c $(MODULE_DIR)/chips_generic.c # Include all dependency files. We use '.rd' to indicate this will create From fea1d9a1bb7d957e1051c2cadafbf2f9be3e51bd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 13:32:27 +0000 Subject: [PATCH 058/718] libsensors: Kill procfs support, part 1. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4462 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + kernel/include/sensors.h | 20 ---- lib/init.c | 12 +-- lib/proc.c | 212 +++++++-------------------------------- lib/proc.h | 6 -- lib/sysfs.c | 6 +- lib/sysfs.h | 2 - 7 files changed, 41 insertions(+), 218 deletions(-) diff --git a/CHANGES b/CHANGES index 7cef0ee8..4b7a120c 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ SVN HEAD Add dme1737 support Delete support of non-sensor drivers (ddcmon, eeprom) Always build with sysfs support + Delete procfs support (Linux 2.4) Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete Programs i2cdump, i2cget, i2cset: Do not force the slave address by default diff --git a/kernel/include/sensors.h b/kernel/include/sensors.h index b077ae3f..6be59145 100644 --- a/kernel/include/sensors.h +++ b/kernel/include/sensors.h @@ -29,26 +29,6 @@ */ -/* From linux/i2c-proc.h */ - -/* Sysctl IDs */ -#ifdef DEV_HWMON -#define DEV_SENSORS DEV_HWMON -#else /* ndef DEV_HWMOM */ -#define DEV_SENSORS 2 /* The id of the lm_sensors directory within the - dev table */ -#endif /* def DEV_HWMON */ - -/* The maximum length of the prefix */ -#define SENSORS_PREFIX_MAX 20 - -#define SENSORS_CHIPS 1 -struct i2c_chips_data { - int sysctl_id; - char name[SENSORS_PREFIX_MAX + 13]; -}; - - /* -- SENSORS SYSCTL START -- */ #define ADM1021_SYSCTL_TEMP 1200 diff --git a/lib/init.c b/lib/init.c index a62d609b..79492e9f 100644 --- a/lib/init.c +++ b/lib/init.c @@ -21,7 +21,6 @@ #include #include "sensors.h" #include "data.h" -#include "proc.h" #include "error.h" #include "access.h" #include "conf.h" @@ -42,13 +41,10 @@ int sensors_init(FILE *input) { int res; sensors_cleanup(); - if (sensors_init_sysfs()) { - if ((res = sensors_read_sysfs_bus()) || (res = sensors_read_sysfs_chips())) - return res; - } else { - if ((res = sensors_read_proc_bus()) || (res = sensors_read_proc_chips())) - return res; - } + if (!sensors_init_sysfs()) + return -SENSORS_ERR_PROC; + if ((res = sensors_read_sysfs_bus()) || (res = sensors_read_sysfs_chips())) + return res; if ((res = sensors_scanner_init(input))) return -SENSORS_ERR_PARSE; if ((res = sensors_yyparse())) diff --git a/lib/proc.c b/lib/proc.c index 3b1253ec..b9020cca 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -17,219 +17,75 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include #include #include #include #include -#include "kernel/include/sensors.h" #include "data.h" #include "error.h" #include "access.h" #include "general.h" -#include "sysfs.h" - -/* OK, this proves one thing: if there are too many chips detected, we get in - trouble. The limit is around 4096/sizeof(struct sensors_chip_data), which - works out to about 100 entries right now. That seems sensible enough, - but if we ever get at the point where more chips can be detected, we must - enlarge buf, and check that sysctl can handle larger buffers. */ - -#define BUF_LEN 4096 - -static char buf[BUF_LEN]; static int getsysname(const sensors_chip_feature *feature, char *sysname, int *sysmag, char *altsysname); -/* This reads /proc/sys/dev/sensors/chips into memory */ -int sensors_read_proc_chips(void) -{ - int res; - - int name[3] = { CTL_DEV, DEV_SENSORS, SENSORS_CHIPS }; - size_t buflen = BUF_LEN; - char *bufptr = buf; - sensors_proc_chips_entry entry; - int lineno; - - if (sysctl(name, 3, bufptr, &buflen, NULL, 0)) - return -SENSORS_ERR_PROC; - - lineno = 1; - while (buflen >= sizeof(struct i2c_chips_data)) { - if ((res = - sensors_parse_chip_name(((struct i2c_chips_data *) bufptr)->name, - &entry.name))) { - sensors_parse_error("Parsing /proc/sys/dev/sensors/chips",lineno); - return res; - } - entry.sysctl = ((struct i2c_chips_data *) bufptr)->sysctl_id; - sensors_add_proc_chips(&entry); - bufptr += sizeof(struct i2c_chips_data); - buflen -= sizeof(struct i2c_chips_data); - lineno++; - } - return 0; -} - -int sensors_read_proc_bus(void) -{ - FILE *f; - char line[255]; - char *border; - sensors_bus entry; - int lineno; - - f = fopen("/proc/bus/i2c","r"); - if (!f) - return -SENSORS_ERR_PROC; - lineno=1; - while (fgets(line,255,f)) { - if (strlen(line) > 0) - line[strlen(line)-1] = '\0'; - if (! (border = rindex(line,'\t'))) - goto ERROR; - /* Skip algorithm name */ - *border='\0'; - if (! (border = rindex(line,'\t'))) - goto ERROR; - if (! (entry.adapter = strdup(border + 1))) - goto FAT_ERROR; - *border='\0'; - if (! (border = rindex(line,'\t'))) - goto ERROR; - *border='\0'; - if (strncmp(line,"i2c-",4)) - goto ERROR; - if (sensors_parse_i2cbus_name(line,&entry.number)) - goto ERROR; - sensors_strip_of_spaces(entry.adapter); - sensors_add_proc_bus(&entry); - lineno++; - } - fclose(f); - return 0; -FAT_ERROR: - sensors_fatal_error("sensors_read_proc_bus","Allocating entry"); -ERROR: - sensors_parse_error("Parsing /proc/bus/i2c",lineno); - fclose(f); - return -SENSORS_ERR_PROC; -} - - -/* This returns the first detected chip which matches the name */ -static int sensors_get_chip_id(sensors_chip_name name) -{ - int i; - for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(name, sensors_proc_chips[i].name)) - return sensors_proc_chips[i].sysctl; - return -SENSORS_ERR_NO_ENTRY; -} - -/* This reads a feature /proc or /sys file. +/* This reads a feature from a sysfs file. Sysfs uses a one-value-per file system... */ int sensors_read_proc(sensors_chip_name name, int feature, double *value) { - int sysctl_name[4] = { CTL_DEV, DEV_SENSORS }; const sensors_chip_feature *the_feature; - size_t buflen = BUF_LEN; int mag; + char n[NAME_MAX], altn[NAME_MAX]; + FILE *f; - if (!sensors_found_sysfs) - if ((sysctl_name[2] = sensors_get_chip_id(name)) < 0) - return sysctl_name[2]; if (! (the_feature = sensors_lookup_feature_nr(name.prefix,feature))) return -SENSORS_ERR_NO_ENTRY; - if (sensors_found_sysfs) { - char n[NAME_MAX], altn[NAME_MAX]; - FILE *f; - strcpy(n, name.busname); - strcat(n, "/"); - strcpy(altn, n); - /* use rindex to append sysname to n */ - getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); - if ((f = fopen(n, "r")) != NULL - || (f = fopen(altn, "r")) != NULL) { - int res = fscanf(f, "%lf", value); - fclose(f); - if (res != 1) - return -SENSORS_ERR_PROC; - for (; mag > 0; mag --) - *value /= 10.0; - } else + + strcpy(n, name.busname); + strcat(n, "/"); + strcpy(altn, n); + /* use rindex to append sysname to n */ + getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); + if ((f = fopen(n, "r")) != NULL + || (f = fopen(altn, "r")) != NULL) { + int res = fscanf(f, "%lf", value); + fclose(f); + if (res != 1) return -SENSORS_ERR_PROC; - } else { - sysctl_name[3] = the_feature->sysctl; - if (sysctl(sysctl_name, 4, buf, &buflen, NULL, 0)) - return -SENSORS_ERR_PROC; - *value = *((long *) (buf + the_feature->offset)); - for (mag = the_feature->scaling; mag > 0; mag --) + for (; mag > 0; mag --) *value /= 10.0; - for (; mag < 0; mag ++) - *value *= 10.0; - } + } else + return -SENSORS_ERR_PROC; + return 0; } int sensors_write_proc(sensors_chip_name name, int feature, double value) { - int sysctl_name[4] = { CTL_DEV, DEV_SENSORS }; const sensors_chip_feature *the_feature; - size_t buflen = BUF_LEN; int mag; + char n[NAME_MAX], altn[NAME_MAX]; + FILE *f; - if (!sensors_found_sysfs) - if ((sysctl_name[2] = sensors_get_chip_id(name)) < 0) - return sysctl_name[2]; if (! (the_feature = sensors_lookup_feature_nr(name.prefix,feature))) return -SENSORS_ERR_NO_ENTRY; - if (sensors_found_sysfs) { - char n[NAME_MAX], altn[NAME_MAX]; - FILE *f; - strcpy(n, name.busname); - strcat(n, "/"); - strcpy(altn, n); - /* use rindex to append sysname to n */ - getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); - if ((f = fopen(n, "w")) != NULL - || (f = fopen(altn, "w")) != NULL) { - for (; mag > 0; mag --) - value *= 10.0; - fprintf(f, "%d", (int) value); - fclose(f); - } else - return -SENSORS_ERR_PROC; - } else { - sysctl_name[3] = the_feature->sysctl; - if (sysctl(sysctl_name, 4, buf, &buflen, NULL, 0)) - return -SENSORS_ERR_PROC; - /* The following line is known to solve random problems, still it - can't be considered a definitive solution... - if (sysctl_name[0] != CTL_DEV) { sysctl_name[0] = CTL_DEV ; } */ - for (mag = the_feature->scaling; mag > 0; mag --) + + strcpy(n, name.busname); + strcat(n, "/"); + strcpy(altn, n); + /* use rindex to append sysname to n */ + getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); + if ((f = fopen(n, "w")) != NULL + || (f = fopen(altn, "w")) != NULL) { + for (; mag > 0; mag --) value *= 10.0; - for (; mag < 0; mag ++) - value /= 10.0; - * ((long *) (buf + the_feature->offset)) = (long) value; - buflen = the_feature->offset + sizeof(long); -#ifdef DEBUG - /* The following get* calls don't do anything, they are here - for debugging purposes only. Strace will show the - returned values. */ - getuid(); geteuid(); - getgid(); getegid(); -#endif - if (sysctl(sysctl_name, 4, NULL, 0, buf, buflen)) - return -SENSORS_ERR_PROC; - } + fprintf(f, "%d", (int) value); + fclose(f); + } else + return -SENSORS_ERR_PROC; + return 0; } diff --git a/lib/proc.h b/lib/proc.h index 05638b58..d4283ad5 100644 --- a/lib/proc.h +++ b/lib/proc.h @@ -20,12 +20,6 @@ #ifndef SENSORS_LIB_PROC_H #define SENSORS_LIB_PROC_H -/* Read /proc/sys/dev/sensors/chips */ -extern int sensors_read_proc_chips(void); - -/* Read /proc/bus/i2c */ -extern int sensors_read_proc_bus(void); - /* Read a value out of a /proc file */ extern int sensors_read_proc(sensors_chip_name name, int feature, double *value); diff --git a/lib/sysfs.c b/lib/sysfs.c index 88863ba8..f2919877 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -31,8 +31,6 @@ #include "general.h" #include "sysfs.h" -int sensors_found_sysfs = 0; - char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 16 @@ -200,9 +198,9 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) int sensors_init_sysfs(void) { if (sysfs_get_mnt_path(sensors_sysfs_mount, NAME_MAX) == 0) - sensors_found_sysfs = 1; + return 1; - return sensors_found_sysfs; + return 0; } /* returns: 0 if successful, !0 otherwise */ diff --git a/lib/sysfs.h b/lib/sysfs.h index 331307ad..77df571a 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -20,8 +20,6 @@ #ifndef SENSORS_LIB_SYSFS_H #define SENSORS_LIB_SYSFS_H -extern int sensors_found_sysfs; - extern char sensors_sysfs_mount[]; extern int sensors_init_sysfs(void); From f8c7f20bf1d6af6acdc02e8875b797f1fe255933 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 13:39:55 +0000 Subject: [PATCH 059/718] No longer need to include general.h. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4463 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/proc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/proc.c b/lib/proc.c index b9020cca..74a09483 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -25,7 +25,6 @@ #include "data.h" #include "error.h" #include "access.h" -#include "general.h" static int getsysname(const sensors_chip_feature *feature, char *sysname, int *sysmag, char *altsysname); From f00aef92719ea15bad7c3992d30ac2600be20b80 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 13:58:55 +0000 Subject: [PATCH 060/718] Return with an explicit error code/message if sysfs isn't mounted. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4464 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/error.c | 2 +- lib/sysfs.c | 15 ++++++++++++--- prog/sensors/main.c | 7 +------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/error.c b/lib/error.c index e1435243..62addd89 100644 --- a/lib/error.c +++ b/lib/error.c @@ -34,7 +34,7 @@ static const char *errorlist[] = /* SENSORS_ERR_WILDCARDS */ "Wildcard found in chip name", /* SENSORS_ERR_NO_ENTRY */ "No such feature known", /* SENSORS_ERR_ACCESS */ "Can't read or write", - /* SENSORS_ERR_PROC */ "Can't access procfs/sysfs file", + /* SENSORS_ERR_PROC */ "Can't access sysfs file", /* SENSORS_ERR_DIV_ZERO */ "Divide by zero", /* SENSORS_ERR_CHIP_NAME */ "Can't parse chip name", /* SENSORS_ERR_BUS_NAME */ "Can't parse bus name", diff --git a/lib/sysfs.c b/lib/sysfs.c index f2919877..8be60fd0 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -20,6 +20,9 @@ /* this define needed for strndup() */ #define _GNU_SOURCE +#include +#include +#include #include #include #include @@ -197,10 +200,16 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) /* returns !0 if sysfs filesystem was found, 0 otherwise */ int sensors_init_sysfs(void) { - if (sysfs_get_mnt_path(sensors_sysfs_mount, NAME_MAX) == 0) - return 1; + struct stat statbuf; - return 0; + /* libsysfs will return success even if sysfs is not mounted, + so we have to double-check */ + if (sysfs_get_mnt_path(sensors_sysfs_mount, NAME_MAX) + || stat(sensors_sysfs_mount, &statbuf) < 0 + || statbuf.st_nlink <= 2) /* Empty directory */ + return 0; + + return 1; } /* returns: 0 if successful, !0 otherwise */ diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 0cd1b8d0..2a1a6969 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -237,12 +237,7 @@ int main (int argc, char *argv[]) open_config_file(config_file_name); if ((res = sensors_init(config_file))) { - fprintf(stderr,"%s\n",sensors_strerror(res)); - if (res == -SENSORS_ERR_PROC) - fprintf(stderr, - "Kernel interface access error\n" - "For 2.6 kernels, make sure you have mounted sysfs and libsensors\n" - "was compiled with sysfs support!\n"); + fprintf(stderr, "sensors_init: %s\n", sensors_strerror(res)); exit(1); } close_config_file(config_file_name); From 24f6b62c3fdf189ac6932fcae5615829dd5c9ef6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 14:21:01 +0000 Subject: [PATCH 061/718] Delete all remnants of algorithm names. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4465 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + doc/FAQ | 7 +++---- doc/lm_sensors-FAQ.html | 7 +++---- doc/lm_sensors-FAQ.texi | 5 ++--- lib/access.c | 6 ------ lib/conf-parse.y | 18 ------------------ lib/data.c | 4 +--- lib/libsensors.3 | 8 +------- lib/sensors.conf.5 | 5 +---- lib/sensors.h | 3 --- prog/sensors/main.c | 7 +------ 11 files changed, 13 insertions(+), 58 deletions(-) diff --git a/CHANGES b/CHANGES index 4b7a120c..88b1d725 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ SVN HEAD Delete support of non-sensor drivers (ddcmon, eeprom) Always build with sysfs support Delete procfs support (Linux 2.4) + Delete all remnants of algorithm names Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete Programs i2cdump, i2cget, i2cset: Do not force the slave address by default diff --git a/doc/FAQ b/doc/FAQ index 0030d16a..e2e359b8 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -94,7 +94,7 @@ lm_sensors 4.24.2 Sensors-detect says "Can't open /dev/i2c[-/]0" 4.24.3 Sensors-detect doesn't find any sensors! 4.25 Sensors says `Error: Line xxx: zzzzzzz' - 4.26 Sensors only gives the name, adapter, and algorithm for my chip + 4.26 Sensors only gives the name and adapter for my chip 4.27 Sensors says `ERROR: Can't get xxxxx data!' 4.28 Sensors doesn't find any sensors, just eeproms. 4.29 Inserting modules hangs my board @@ -1103,15 +1103,14 @@ These are errors from the libsensors library in reading the it. If you have a parse error, perhaps you have to put the feature name in double quotes. -4.26 Sensors only gives the name, adapter, and algorithm for my chip -==================================================================== +4.26 Sensors only gives the name and adapter for my chip +======================================================== If `sensors' only says this, for example, and doesn't provide any actual data at all: it87-isa-0290 Adapter: ISA adapter - Algorithm: ISA algorithm Your chip is not currently supported by `sensors' and so all it does is print out that information. Get the latest release and be sure you diff --git a/doc/lm_sensors-FAQ.html b/doc/lm_sensors-FAQ.html index 6ceab70a..6ba58d4c 100644 --- a/doc/lm_sensors-FAQ.html +++ b/doc/lm_sensors-FAQ.html @@ -152,7 +152,7 @@ Jean Delvare
  • 4.24.3 Sensors-detect doesn't find any sensors!
  • 4.25 Sensors says `Error: Line xxx: zzzzzzz' -
  • 4.26 Sensors only gives the name, adapter, and algorithm for my chip +
  • 4.26 Sensors only gives the name and adapter for my chip
  • 4.27 Sensors says `ERROR: Can't get xxxxx data!'
  • 4.28 Sensors doesn't find any sensors, just eeproms.
  • 4.29 Inserting modules hangs my board @@ -897,7 +897,7 @@ Up: Top
  • Section 4.23: What is at I2C address XXX?
  • Section 4.24: Sensors-detect doesn't work at all
  • Section 4.25: Sensors says `Error: Line xxx: zzzzzzz' -
  • Section 4.26: Sensors only gives the name, adapter, and algorithm! +
  • Section 4.26: Sensors only gives the name and adapter!
  • Section 4.27: Sensors says `ERROR: Can't get xxxxx data!'
  • Section 4.28: Sensors doesn't find any sensors, just eeproms.
  • Section 4.29: Inserting modules hangs my board @@ -1679,14 +1679,13 @@ Up: Problems -

    4.26 Sensors only gives the name, adapter, and algorithm for my chip

    +

    4.26 Sensors only gives the name and adapter for my chip

    If sensors only says this, for example, and doesn't provide any actual data at all:

         it87-isa-0290
          Adapter: ISA adapter
    -     Algorithm: ISA algorithm
     

    Your chip is not currently supported by sensors and so all it does is print out that information. Get the latest release diff --git a/doc/lm_sensors-FAQ.texi b/doc/lm_sensors-FAQ.texi index 55ecc57b..ada3d3e3 100644 --- a/doc/lm_sensors-FAQ.texi +++ b/doc/lm_sensors-FAQ.texi @@ -561,7 +561,7 @@ to work. * Section 4.23:: What is at I2C address XXX? * Section 4.24:: Sensors-detect doesn't work at all * Section 4.25:: Sensors says @samp{Error: Line xxx: zzzzzzz} -* Section 4.26:: Sensors only gives the name, adapter, and algorithm! +* Section 4.26:: Sensors only gives the name and adapter! * Section 4.27:: Sensors says @samp{ERROR: Can't get xxxxx data!} * Section 4.28:: Sensors doesn't find any sensors, just eeproms. * Section 4.29:: Inserting modules hangs my board @@ -1142,7 +1142,7 @@ to put the feature name in double quotes. @node Section 4.26, Section 4.27, Section 4.25, Problems -@section Sensors only gives the name, adapter, and algorithm for my chip +@section Sensors only gives the name and adapter for my chip If @command{sensors} only says this, for example, and doesn't provide any actual data at all: @@ -1150,7 +1150,6 @@ provide any actual data at all: @example it87-isa-0290 Adapter: ISA adapter -Algorithm: ISA algorithm @end example Your chip is not currently supported by @command{sensors} and so all it diff --git a/lib/access.c b/lib/access.c index fb7c7dc4..a66d2b35 100644 --- a/lib/access.c +++ b/lib/access.c @@ -325,12 +325,6 @@ const char *sensors_get_adapter_name(int bus_nr) return NULL; } -/* This function is deprecated and will be dropped soon. */ -const char *sensors_get_algorithm_name(int bus_nr) -{ - return "No longer available"; -} - /* nr1-1 is the last main feature found; nr2-1 is the last subfeature found */ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, int *nr1, int *nr2) diff --git a/lib/conf-parse.y b/lib/conf-parse.y index 5ae50e58..88a1cf49 100644 --- a/lib/conf-parse.y +++ b/lib/conf-parse.y @@ -120,7 +120,6 @@ static sensors_chip *current_chip = NULL; %type expression %type i2cbus_name %type adapter_name -%type algorithm_name %type function_name %type string %type chip_name @@ -134,7 +133,6 @@ input: /* empty */ ; line: bus_statement EOL - | busalgo_statement EOL | label_statement EOL | set_statement EOL | chip_statement EOL @@ -152,17 +150,6 @@ bus_statement: BUS i2cbus_name adapter_name } ; -/* for compatibility, deprecated */ -busalgo_statement: BUS i2cbus_name adapter_name algorithm_name - { sensors_bus new_el; - new_el.lineno = $1; - new_el.number = $2; - new_el.adapter = $3; - free($4); - bus_add_el(&new_el); - } -; - label_statement: LABEL function_name string { sensors_label new_el; check_current_chip(); @@ -315,11 +302,6 @@ adapter_name: NAME $$ = $1; } ; -algorithm_name: NAME - { sensors_strip_of_spaces($1); - $$ = $1; } -; - function_name: NAME { $$ = $1; } ; diff --git a/lib/data.c b/lib/data.c index 3954df0b..0c7fa705 100644 --- a/lib/data.c +++ b/lib/data.c @@ -238,9 +238,7 @@ int sensors_substitute_chip(sensors_chip_name *name,int lineno) return -SENSORS_ERR_BUS_NAME; } - /* We used to compare both the adapter and the algorithm names for - bus matching, but Linux 2.6 has no more names for algorithms, and - it was redundant anyway. So we now only rely on the adapter name. */ + /* Compare the adapter names */ for (j = 0; j < sensors_proc_bus_count; j++) { if (!strcmp(sensors_config_busses[i].adapter, sensors_proc_bus[j].adapter)) { diff --git a/lib/libsensors.3 b/lib/libsensors.3 index ae8a71ea..c5c22991 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -24,7 +24,7 @@ .\" .\" References consulted: .\" libsensors source code -.TH libsensors 3 "October 2006" "" "Linux Programmer's Manual" +.TH libsensors 3 "June 2007" "" "Linux Programmer's Manual" .SH NAME libsensors \- publicly accessible functions provided by the sensors library .SH SYNOPSIS @@ -81,12 +81,6 @@ Check whether the chip name is an 'absolute' name, which can only match one chip This function returns the adapter name of a bus number, as used within the sensors_chip_name structure. If it could not be found, it returns NULL. -.B const char *sensors_get_algorithm_name(int bus_nr); -.br -This function used to return the algorithm name of a bus number. -It is now deprecated and returns an arbitrary string. It will be dropped -in a later version of the library so you should stop using it. - \fBint sensors_get_label(sensors_chip_name name, int feature, char **result);\fP .br diff --git a/lib/sensors.conf.5 b/lib/sensors.conf.5 index a6d996fc..776b4067 100644 --- a/lib/sensors.conf.5 +++ b/lib/sensors.conf.5 @@ -23,7 +23,7 @@ .\" .\" References consulted: .\" sensors.conf.eg by Frodo Looijaard -.TH sensors.conf 5 "April 2007" "" "Linux Programmer's Manual" +.TH sensors.conf 5 "June 2007" "" "Linux Programmer's Manual" .SH NAME sensors.conf \- libsensors configuration file @@ -149,9 +149,6 @@ or It should always be quoted as well as it will most certainly contain spaces or dashes. -There used to be a third argument, the algorithm name. For compatibility -reasons, the parser still accepts this third argument, but ignores it. - The .I bus statements may be scattered randomly throughout the configuration file; diff --git a/lib/sensors.h b/lib/sensors.h index deb31e7a..6b9d5e94 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -74,9 +74,6 @@ extern int sensors_chip_name_has_wildcards(sensors_chip_name chip); it returns NULL */ extern const char *sensors_get_adapter_name(int bus_nr); -/* This function is deprecated and will be dropped soon. */ -extern const char *sensors_get_algorithm_name(int bus_nr); - /* Look up the label which belongs to this chip. Note that chip should not contain wildcard values! *result is newly allocated (free it yourself). This function will return 0 on success, and <0 on failure. This diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 2a1a6969..6d2b372b 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -161,8 +161,6 @@ int main (int argc, char *argv[]) { "no-unknown", no_argument, NULL, 'U' }, { "config-file", required_argument, NULL, 'c' }, { "unknown", no_argument, NULL, 'u' }, - /* next option accepted for compatibility, but otherwise ignored */ - { "algorithm", no_argument, NULL, 'a' }, { "generic", no_argument, NULL, 'g'}, { 0,0,0,0 } }; @@ -175,7 +173,7 @@ int main (int argc, char *argv[]) hide_unknown = 0; do_generic = 0; while (1) { - c = getopt_long(argc,argv,"hsvfaAUc:ug",long_opts,NULL); + c = getopt_long(argc, argv, "hsvfAUc:ug", long_opts, NULL); if (c == EOF) break; switch(c) { @@ -207,9 +205,6 @@ int main (int argc, char *argv[]) case 'u': do_unknown = 1; break; - case 'a': - /* Ignore for compatibility */ - break; case 'g': do_generic = 1; break; From 7a485557488f70e0a262d11f5ec64b0d657e0023 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 17:08:15 +0000 Subject: [PATCH 062/718] Fix the case where the system has different CPU models. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4467 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 45effd70..e17ee22c 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2244,11 +2244,12 @@ sub initialize_cpu_list { open(local *INPUTFILE, "/proc/cpuinfo") or die "Can't access /proc/cpuinfo!"; local $_; - my %entry; + my $entry; + while () { if (m/^processor\s*:\s*(\d+)/) { - push @cpu, \%entry if scalar keys(%entry); # Previous entry - %entry = (); # New entry + push @cpu, $entry if scalar keys(%{$entry}); # Previous entry + $entry = {}; # New entry next; } if (m/^(vendor_id|cpu family|model|model name|stepping)\s*:\s*(.+)$/) { @@ -2256,11 +2257,11 @@ sub initialize_cpu_list my $v = $2; $v =~ s/\s+/ /g; # Merge multiple spaces $v =~ s/ $//; # Trim trailing space - $entry{$k} = $v; + $entry->{$k} = $v; next; } } - push @cpu, \%entry if scalar keys(%entry); # Last entry + push @cpu, $entry if scalar keys(%{$entry}); # Last entry close INPUTFILE; } From efb0a142ac28f2e6c54456f7158b47b16f8197eb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jun 2007 19:02:25 +0000 Subject: [PATCH 063/718] Add detection for non-standard SMSC Super-I/Os. Patch from Juerg Haefliger. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4469 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 68 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/CHANGES b/CHANGES index 88b1d725..82f1beb8 100644 --- a/CHANGES +++ b/CHANGES @@ -45,6 +45,7 @@ SVN HEAD Add Maxim MAX6680/MAX6681 detection Add IT8726F detection Fix IPMI support for 2.6 kernels + Add detection for non-standard SMSC Super-I/Os 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index e17ee22c..bc2f6fcf 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1832,6 +1832,38 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); devid => 0x77, }, ], + # Non-standard SMSC detection callback and chip list. These chips differ + # from the standard ones listed above in that the device ID register + # address is 0x0d instead of 0x20 (as specified by the ISA PNP spec). + ns_detect => \&smsc_ns_detect_superio, + ns_chips => + [ + { + name => "SMSC FDC37C665 Super IO", + driver => "not-a-sensor", + devid => 0x65, + }, + { + name => "SMSC FDC37C666 Super IO", + driver => "not-a-sensor", + devid => 0x66, + }, + { + name => "SMSC FDC37C669 Super IO", + driver => "not-a-sensor", + devid => 0x03, + }, + { + name => "SMSC FDC37N769 Super IO", + driver => "not-a-sensor", + devid => 0x28, + }, + { + name => "SMSC LPC47N227 Super IO", + driver => "not-a-sensor", + devid => 0x5a, + }, + ], }, { family => "VIA/Winbond/Fintek", @@ -3190,6 +3222,36 @@ sub probe_superio($$$) $new_hash; } +# Detection routine for non-standard SMSC Super I/O chips +# $_[0]: Super I/O LPC config/index port +# $_[1]: Super I/O LPC data port +# $_[2]: Reference to array of non-standard chips +# Return values: 1 if non-standard chip found, 0 otherwise +sub smsc_ns_detect_superio +{ + my ($addrreg, $datareg, $ns_chips) = @_; + my ($val, $chip); + + # read alternate device ID register + outb($addrreg, 0x0d); + $val = inb($datareg); + if ($val == 0x00 || $val == 0xff) { + return 0; + } + + print "Yes\n"; + + foreach $chip (@{$ns_chips}) { + if ($chip->{devid} == $val) { + probe_superio($addrreg, $datareg, $chip); + return 1; + } + } + + printf("Found unknown non-standard chip with ID 0x%02x\n", $val); + return 1; +} + sub scan_superio { my ($addrreg, $datareg) = @_; @@ -3207,6 +3269,12 @@ sub scan_superio foreach $val (@{$family->{enter}->{$addrreg}}) { outb($addrreg, $val); } +# call the non-standard detection routine first if it exists + if (defined($family->{ns_detect}) && + &{$family->{ns_detect}}($addrreg, $datareg, $family->{ns_chips})) { + exit_superio($addrreg, $datareg); + last FAMILY; + } # did it work? outb($addrreg, $superio{devidreg}); $val = inb($datareg); From 220aa2649abd7955bd677c7fcd84f84f08700269 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 26 Jun 2007 06:24:23 +0000 Subject: [PATCH 064/718] Discard irrelevant "CONFORMING TO" sections. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4471 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/i2cdetect.8 | 3 --- prog/dump/i2cdump.8 | 3 --- prog/dump/i2cget.8 | 3 --- prog/dump/i2cset.8 | 3 --- prog/dump/isadump.8 | 3 --- prog/dump/isaset.8 | 3 --- 6 files changed, 18 deletions(-) diff --git a/prog/detect/i2cdetect.8 b/prog/detect/i2cdetect.8 index 806f4a3f..09c85cb7 100644 --- a/prog/detect/i2cdetect.8 +++ b/prog/detect/i2cdetect.8 @@ -77,9 +77,6 @@ Display the version and exit. .B "\-l" Output a list of installed busses. -.SH CONFORMING TO -lm_sensors-2.x - .SH SEE ALSO i2cdump(8), sensors-detect(8) diff --git a/prog/dump/i2cdump.8 b/prog/dump/i2cdump.8 index 711c79f3..9a703e9a 100644 --- a/prog/dump/i2cdump.8 +++ b/prog/dump/i2cdump.8 @@ -69,9 +69,6 @@ on random addresses. Anyway, it is of little use unless you have an idea of what you are looking for and have some general knowledge about hardware monitoring chips internals. -.SH CONFORMING TO -lm_sensors-2.x - .SH SEE ALSO i2cset(8), i2cdetect(8), isadump(8) diff --git a/prog/dump/i2cget.8 b/prog/dump/i2cget.8 index 642343b7..4b4b76e1 100644 --- a/prog/dump/i2cget.8 +++ b/prog/dump/i2cget.8 @@ -58,9 +58,6 @@ in such a way that an SMBus read transaction can be seen as a write transaction certain chips. This is particularly true if setting \fImode\fR to \fBcp\fP (write byte/read byte with PEC). Be extremely careful using this program. -.SH CONFORMING TO -lm_sensors-2.x - .SH SEE ALSO i2cdump(8), i2cset(8) diff --git a/prog/dump/i2cset.8 b/prog/dump/i2cset.8 index 97a5c9bc..de7971a6 100644 --- a/prog/dump/i2cset.8 +++ b/prog/dump/i2cset.8 @@ -66,9 +66,6 @@ a serial EEPROM on a memory DIMM (chip addresses between 0x50 and 0x57) may DESTROY your memory, leaving your system unbootable! Be extremely careful using this program. -.SH CONFORMING TO -lm_sensors-2.x - .SH SEE ALSO i2cdump(8), isaset(8) diff --git a/prog/dump/isadump.8 b/prog/dump/isadump.8 index 05dfe9cc..b3bf86c6 100644 --- a/prog/dump/isadump.8 +++ b/prog/dump/isadump.8 @@ -93,9 +93,6 @@ Running isadump with random parameters can cause system crashes, data loss, and worse! Be extremely careful when using this program. -.SH CONFORMING TO -lm_sensors-2.x - .SH SEE ALSO i2cdump(8), isaset(8) diff --git a/prog/dump/isaset.8 b/prog/dump/isaset.8 index 448c3bba..12071a22 100644 --- a/prog/dump/isaset.8 +++ b/prog/dump/isaset.8 @@ -63,9 +63,6 @@ Running isaset with random parameters can cause system crashes, data loss, and worse! Be extremely careful when using this program. -.SH CONFORMING TO -lm_sensors-2.x - .SH SEE ALSO i2cset(8), isadump(8) From 617e759d94fc4b2a3eb817deaf1aebf2935740f3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 26 Jun 2007 07:47:30 +0000 Subject: [PATCH 065/718] Make sensors-detect no longer depend on i2cdetect. Parsing /proc/bus/i2c or walking sysfs for the same information (i2c adapter names) is not that difficult. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4472 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 88 ++++++++++++++++++++++++-------------- 2 files changed, 57 insertions(+), 32 deletions(-) diff --git a/CHANGES b/CHANGES index 82f1beb8..1a66260f 100644 --- a/CHANGES +++ b/CHANGES @@ -46,6 +46,7 @@ SVN HEAD Add IT8726F detection Fix IPMI support for 2.6 kernels Add detection for non-standard SMSC Super-I/Os + No longer depend on i2cdetect 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index bc2f6fcf..2f6282cc 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -34,7 +34,7 @@ use Fcntl; use POSIX; use File::Basename; -# We will call modprobe and i2cdetect, which typically live in either /sbin, +# We will call modprobe, which typically lives in either /sbin, # /usr/sbin or /usr/local/bin. So make sure these are all in the PATH. foreach ('/usr/sbin', '/usr/local/sbin', '/sbin') { $ENV{PATH} = "$_:".$ENV{PATH} @@ -2297,6 +2297,45 @@ sub initialize_cpu_list close INPUTFILE; } +# @i2c_adapters is a list of references to hashes, one hash per I2C/SMBus +# adapter present on the system. Each entry has the following keys: name +# (directly taken from either /proc/bus/i2c or /sys/class/i2c-adapter) and +# driver. +use vars qw(@i2c_adapters); + +sub initialize_i2c_adapters_list +{ + my $entry; + local $_; + + if (defined $sysfs_root) { + my $class_dir = "${sysfs_root}/class/i2c-adapter"; + opendir(local *ADAPTERS, $class_dir) or return; + + while (defined($_ = readdir(ADAPTERS))) { + next unless m/^i2c-(\d+)$/; + $entry = {}; # New entry + $entry->{'name'} = sysfs_device_attribute("${class_dir}/i2c-$1", "name") + || sysfs_device_attribute("${class_dir}/i2c-$1/device", "name"); + $entry->{'driver'} = find_adapter_driver($entry->{'name'}); + $i2c_adapters[$1] = $entry; + } + closedir(ADAPTERS); + } else { + open(local *INPUTFILE, "/proc/bus/i2c") or return; + + while () { + my ($nr, $type, $name) = /^i2c-(\d+)\s+(\S+)\s+(.*?) *(\t|$)/; + next if ($type eq "dummy" || $type eq "isa"); + $entry = {}; # New entry + $entry->{'name'} = $name; + $entry->{'driver'} = find_adapter_driver($name); + $i2c_adapters[$nr] = $entry; + } + close(INPUTFILE); + } +} + ########### # MODULES # ########### @@ -2542,7 +2581,7 @@ sub adapter_pci_detection return @res; } -# $_[0]: Adapter description as found in /proc/bus/i2c +# $_[0]: Adapter description as found in /proc/bus/i2c or sysfs sub find_adapter_driver { my $adapter; @@ -5495,7 +5534,6 @@ sub generate_modprobes my ($chip,$detection,$nr,$i,@optionlist,@probelist,$driver,$isa,$adap); my $ipmi = 0; - my @adapters; my $modprobes = ""; my $configfile = ""; @@ -5503,18 +5541,6 @@ sub generate_modprobes $configfile .= "# I2C module options\n"; $configfile .= "alias char-major-89 i2c-dev\n"; - # Collect all loaded adapters - # i2cdetect -l either cats /proc/bus/i2c or scans sysfs for the same information - open(local *INPUTFILE, "i2cdetect -l |") or die "Couldn't find i2cdetect program!!"; - local $_; - while () { - my ($dev_nr, $type, $adap) = /^i2c-(\d+)\s+(\S+)\s+(.*?) *(\t|$)/; - next if ($type eq "dummy" || $type eq "isa"); - $adapters[$dev_nr]->{driver} = find_adapter_driver($adap); - $adapters[$dev_nr]->{adapname} = $adap; - } - close INPUTFILE; - # Collect all adapters used $nr = 0; $isa = 0; @@ -5523,9 +5549,9 @@ sub generate_modprobes # If there is more than one bus detected by a driver, they are # still all added. So we number them in the correct order if (exists $detection->{i2c_driver} and - not exists $adapters[$detection->{i2c_devnr}]->{nr_later} and + not exists $i2c_adapters[$detection->{i2c_devnr}]->{nr_later} and not (exists $detection->{isa_addr} and $prefer_isa)) { - foreach $adap (@adapters) { + foreach $adap (@i2c_adapters) { next unless exists $adap->{driver}; $adap->{nr_later} = $nr++ if $adap->{driver} eq $detection->{i2c_driver}; } @@ -5543,14 +5569,14 @@ sub generate_modprobes $modprobes .= "# I2C adapter drivers\n" if $nr; for ($i = 0; $i < $nr; $i++) { - foreach $adap (@adapters) { + foreach $adap (@i2c_adapters) { next unless exists $adap->{nr_later} and $adap->{nr_later} == $i; if ($adap->{driver} eq "UNKNOWN") { - $modprobes .= "# modprobe unknown adapter ".$adap->{adapname}."\n"; + $modprobes .= "# modprobe unknown adapter ".$adap->{name}."\n"; } elsif ($adap->{driver} eq "DISABLED") { - $modprobes .= "# modprobe disabled adapter ".$adap->{adapname}."\n"; + $modprobes .= "# modprobe disabled adapter ".$adap->{name}."\n"; } elsif ($adap->{driver} eq "to-be-written") { - $modprobes .= "# no driver available for adapter ".$adap->{adapname}."\n"; + $modprobes .= "# no driver available for adapter ".$adap->{name}."\n"; } else { $modprobes .= "modprobe $adap->{driver}\n" unless $modprobes =~ /modprobe $adap->{driver}\n/; @@ -5602,10 +5628,10 @@ sub generate_modprobes # Handle misdetects foreach $detection (@{$chip->{misdetected}}) { - push @optionlist, $adapters[$detection->{i2c_devnr}]->{nr_later}, + push @optionlist, $i2c_adapters[$detection->{i2c_devnr}]->{nr_later}, $detection->{i2c_addr} if exists $detection->{i2c_addr} and - exists $adapters[$detection->{i2c_devnr}]->{nr_later}; + exists $i2c_adapters[$detection->{i2c_devnr}]->{nr_later}; push @optionlist, -1, $detection->{isa_addr} if exists $detection->{isa_addr} and $isa; } @@ -5614,10 +5640,10 @@ sub generate_modprobes foreach $detection (@{$chip->{detected}}) { if (exists $detection->{i2c_driver} and exists $detection->{isa_addr} and - exists $adapters[$detection->{i2c_devnr}]->{nr_later} and + exists $i2c_adapters[$detection->{i2c_devnr}]->{nr_later} and $isa) { if ($prefer_isa) { - push @optionlist,$adapters[$detection->{i2c_devnr}]->{nr_later}, + push @optionlist, $i2c_adapters[$detection->{i2c_devnr}]->{nr_later}, $detection->{i2c_addr}; } else { push @optionlist, -1, $detection->{isa_addr} @@ -5703,6 +5729,7 @@ sub main print "If you have undetectable or unsupported adapters, you can have them\n". "scanned by manually loading the modules before running this script.\n\n"; + initialize_i2c_adapters_list(); if (!exists($modules_list{"i2c-dev"}) && !(defined $sysfs_root && -e "$sysfs_root/class/i2c-dev")) { @@ -5732,12 +5759,9 @@ sub main "you can specify that address to remain unprobed.\n"; my ($inp,@not_to_scan,$inp2); - # i2cdetect -l either cats /proc/bus/i2c or scans sysfs for the same information - open(local *INPUTFILE, "i2cdetect -l |") or die "Couldn't find i2cdetect program!!"; - local $_; - while () { - my ($dev_nr, $type, $adap) = /^i2c-(\d+)\s+(\S+)\s+(.*?) *(\t|$)/; - next if ($type eq "dummy" || $type eq "isa"); + for (my $dev_nr = 0; $dev_nr < @i2c_adapters; $dev_nr++) { + next unless exists $i2c_adapters[$dev_nr]; + my $adap = $i2c_adapters[$dev_nr]->{'name'}; print "\n"; print "Next adapter: $adap (i2c-$dev_nr)\n"; print "Do you want to scan it? (YES/no/selectively): "; @@ -5754,7 +5778,7 @@ sub main chop $inp2; @not_to_scan = parse_not_to_scan 0,0x7f,$inp2; } - scan_adapter $dev_nr, $adap, find_adapter_driver($adap), + scan_adapter $dev_nr, $adap, $i2c_adapters[$dev_nr]->{'driver'}, \@not_to_scan unless $inp =~ /^\s*[Nn]/; } print "\n"; From 6c7effca88f2c4b3f842965dac0aeabbc4f162c1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 26 Jun 2007 10:06:46 +0000 Subject: [PATCH 066/718] libsensors: Kill procfs and sysctl support, part 2. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4473 7894878c-1315-0410-8ee3-d5d059ff63e0 --- BACKGROUND | 7 +- CHANGES | 2 +- kernel/include/sensors.h | 1039 +--------- lib/chips.c | 4120 +++++++++++++++++++------------------- lib/data.h | 9 - 5 files changed, 2050 insertions(+), 3127 deletions(-) diff --git a/BACKGROUND b/BACKGROUND index a7b452c0..c757f90b 100644 --- a/BACKGROUND +++ b/BACKGROUND @@ -14,9 +14,8 @@ few general-purpose base kernel modules, which you always need. In addition, there is one kernel module for each piece of hardware - whether this is an I2C bus adapter, an SMBus adapter or a sensors chip. -The kernel modules communicate their information through both the /proc -and sysctl interfaces (Linux 2.4) or the /sys interface (Linux 2.6). To -keep things uncomplicated, the sensor chips always advert their +The kernel modules communicate their information through the /sys inter- +face. To keep things uncomplicated, the sensor chips always advert their measurements 'as is'. This means that the values they report are not immediately relevant to you - they must first be scaled and translated to correspond to the real world. @@ -31,7 +30,7 @@ This is important, because bugs in kernel-space might crash your computer or do other bad things. And kernel memory can not be swapped out! Applications could (and can) directly read the sensor values through the -/proc, sysctl or /sys interfaces. This is harder than it sounds; because +/sys interface. This is harder than it sounds; because no two chips are the same, the information they communicate may also be very unlike. This would mean that every application would have to know about every type of chip. But there is a better solution. diff --git a/CHANGES b/CHANGES index 1a66260f..297667b3 100644 --- a/CHANGES +++ b/CHANGES @@ -14,7 +14,7 @@ SVN HEAD Add dme1737 support Delete support of non-sensor drivers (ddcmon, eeprom) Always build with sysfs support - Delete procfs support (Linux 2.4) + Delete procfs and sysctl support (Linux 2.4) Delete all remnants of algorithm names Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/kernel/include/sensors.h b/kernel/include/sensors.h index 6be59145..ad1ba586 100644 --- a/kernel/include/sensors.h +++ b/kernel/include/sensors.h @@ -29,37 +29,12 @@ */ -/* -- SENSORS SYSCTL START -- */ - -#define ADM1021_SYSCTL_TEMP 1200 -#define ADM1021_SYSCTL_REMOTE_TEMP 1201 -#define ADM1021_SYSCTL_DIE_CODE 1202 -#define ADM1021_SYSCTL_ALARMS 1203 - #define ADM1021_ALARM_TEMP_HIGH 0x40 #define ADM1021_ALARM_TEMP_LOW 0x20 #define ADM1021_ALARM_RTEMP_HIGH 0x10 #define ADM1021_ALARM_RTEMP_LOW 0x08 #define ADM1021_ALARM_RTEMP_NA 0x04 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define ADM1024_SYSCTL_IN0 1000 /* Volts * 100 */ -#define ADM1024_SYSCTL_IN1 1001 -#define ADM1024_SYSCTL_IN2 1002 -#define ADM1024_SYSCTL_IN3 1003 -#define ADM1024_SYSCTL_IN4 1004 -#define ADM1024_SYSCTL_IN5 1005 -#define ADM1024_SYSCTL_FAN1 1101 /* Rotations/min */ -#define ADM1024_SYSCTL_FAN2 1102 -#define ADM1024_SYSCTL_TEMP 1250 /* Degrees Celsius * 100 */ -#define ADM1024_SYSCTL_TEMP1 1290 /* Degrees Celsius */ -#define ADM1024_SYSCTL_TEMP2 1295 /* Degrees Celsius */ -#define ADM1024_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define ADM1024_SYSCTL_ALARMS 2001 /* bitvector */ -#define ADM1024_SYSCTL_ANALOG_OUT 2002 -#define ADM1024_SYSCTL_VID 2003 #define ADM1024_ALARM_IN0 0x0001 #define ADM1024_ALARM_IN1 0x0002 @@ -74,22 +49,6 @@ #define ADM1024_ALARM_TEMP2 0x0001 #define ADM1024_ALARM_CHAS 0x1000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define ADM1025_SYSCTL_IN0 1000 /* Volts * 100 */ -#define ADM1025_SYSCTL_IN1 1001 -#define ADM1025_SYSCTL_IN2 1002 -#define ADM1025_SYSCTL_IN3 1003 -#define ADM1025_SYSCTL_IN4 1004 -#define ADM1025_SYSCTL_IN5 1005 - -#define ADM1025_SYSCTL_RTEMP 1250 /* Degrees Celsius * 10 */ -#define ADM1025_SYSCTL_TEMP 1251 - -#define ADM1025_SYSCTL_ALARMS 2001 /* bitvector */ -#define ADM1025_SYSCTL_VID 2003 /* Volts * 1000 */ -#define ADM1025_SYSCTL_VRM 2004 #define ADM1025_ALARM_IN0 0x0001 #define ADM1025_ALARM_IN1 0x0002 @@ -101,55 +60,6 @@ #define ADM1025_ALARM_TEMP 0x0010 #define ADM1025_ALARM_RFAULT 0x4000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define ADM1026_SYSCTL_FAN0 1000 -#define ADM1026_SYSCTL_FAN1 1001 -#define ADM1026_SYSCTL_FAN2 1002 -#define ADM1026_SYSCTL_FAN3 1003 -#define ADM1026_SYSCTL_FAN4 1004 -#define ADM1026_SYSCTL_FAN5 1005 -#define ADM1026_SYSCTL_FAN6 1006 -#define ADM1026_SYSCTL_FAN7 1007 -#define ADM1026_SYSCTL_FAN_DIV 1008 -#define ADM1026_SYSCTL_GPIO 1009 -#define ADM1026_SYSCTL_GPIO_MASK 1010 -#define ADM1026_SYSCTL_ALARMS 1011 -#define ADM1026_SYSCTL_ALARM_MASK 1012 -#define ADM1026_SYSCTL_IN0 1013 -#define ADM1026_SYSCTL_IN1 1014 -#define ADM1026_SYSCTL_IN2 1015 -#define ADM1026_SYSCTL_IN3 1016 -#define ADM1026_SYSCTL_IN4 1017 -#define ADM1026_SYSCTL_IN5 1018 -#define ADM1026_SYSCTL_IN6 1019 -#define ADM1026_SYSCTL_IN7 1020 -#define ADM1026_SYSCTL_IN8 1021 -#define ADM1026_SYSCTL_IN9 1022 -#define ADM1026_SYSCTL_IN10 1023 -#define ADM1026_SYSCTL_IN11 1024 -#define ADM1026_SYSCTL_IN12 1025 -#define ADM1026_SYSCTL_IN13 1026 -#define ADM1026_SYSCTL_IN14 1027 -#define ADM1026_SYSCTL_IN15 1028 -#define ADM1026_SYSCTL_IN16 1029 -#define ADM1026_SYSCTL_PWM 1030 -#define ADM1026_SYSCTL_ANALOG_OUT 1031 -#define ADM1026_SYSCTL_AFC 1032 -#define ADM1026_SYSCTL_TEMP1 1033 -#define ADM1026_SYSCTL_TEMP2 1034 -#define ADM1026_SYSCTL_TEMP3 1035 -#define ADM1026_SYSCTL_TEMP_OFFSET1 1036 -#define ADM1026_SYSCTL_TEMP_OFFSET2 1037 -#define ADM1026_SYSCTL_TEMP_OFFSET3 1038 -#define ADM1026_SYSCTL_TEMP_THERM1 1039 -#define ADM1026_SYSCTL_TEMP_THERM2 1040 -#define ADM1026_SYSCTL_TEMP_THERM3 1041 -#define ADM1026_SYSCTL_TEMP_TMIN1 1042 -#define ADM1026_SYSCTL_TEMP_TMIN2 1043 -#define ADM1026_SYSCTL_TEMP_TMIN3 1044 -#define ADM1026_SYSCTL_VID 1045 -#define ADM1026_SYSCTL_VRM 1046 #define ADM1026_ALARM_TEMP2 (1L << 0) #define ADM1026_ALARM_TEMP3 (1L << 1) @@ -183,19 +93,7 @@ #define ADM1026_ALARM_AFC_FAN (1L << 28) #define ADM1026_ALARM_UNUSED (1L << 29) #define ADM1026_ALARM_CI (1L << 30) -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define ADM1031_SYSCTL_TEMP1 1200 -#define ADM1031_SYSCTL_TEMP2 1201 -#define ADM1031_SYSCTL_TEMP3 1202 - -#define ADM1031_SYSCTL_FAN1 1210 -#define ADM1031_SYSCTL_FAN2 1211 - -#define ADM1031_SYSCTL_FAN_DIV 1220 - -#define ADM1031_SYSCTL_ALARMS 1250 #define ADM1031_ALARM_FAN1_MIN 0x0001 #define ADM1031_ALARM_FAN1_FLT 0x0002 @@ -215,23 +113,6 @@ #define ADM1031_ALARM_THERMAL 0x8000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define ADM9240_SYSCTL_IN0 1000 /* Volts * 100 */ -#define ADM9240_SYSCTL_IN1 1001 -#define ADM9240_SYSCTL_IN2 1002 -#define ADM9240_SYSCTL_IN3 1003 -#define ADM9240_SYSCTL_IN4 1004 -#define ADM9240_SYSCTL_IN5 1005 -#define ADM9240_SYSCTL_FAN1 1101 /* Rotations/min */ -#define ADM9240_SYSCTL_FAN2 1102 -#define ADM9240_SYSCTL_TEMP 1250 /* Degrees Celsius * 100 */ -#define ADM9240_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define ADM9240_SYSCTL_ALARMS 2001 /* bitvector */ -#define ADM9240_SYSCTL_ANALOG_OUT 2002 -#define ADM9240_SYSCTL_VID 2003 - #define ADM9240_ALARM_IN0 0x0001 #define ADM9240_ALARM_IN1 0x0002 #define ADM9240_ALARM_IN2 0x0004 @@ -243,33 +124,6 @@ #define ADM9240_ALARM_TEMP 0x0010 #define ADM9240_ALARM_CHAS 0x1000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define ASB100_SYSCTL_IN0 1000 /* Volts * 100 */ -#define ASB100_SYSCTL_IN1 1001 -#define ASB100_SYSCTL_IN2 1002 -#define ASB100_SYSCTL_IN3 1003 -#define ASB100_SYSCTL_IN4 1004 -#define ASB100_SYSCTL_IN5 1005 -#define ASB100_SYSCTL_IN6 1006 - -#define ASB100_SYSCTL_FAN1 1101 /* Rotations/min */ -#define ASB100_SYSCTL_FAN2 1102 -#define ASB100_SYSCTL_FAN3 1103 - -#define ASB100_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define ASB100_SYSCTL_TEMP2 1201 -#define ASB100_SYSCTL_TEMP3 1202 -#define ASB100_SYSCTL_TEMP4 1203 - -#define ASB100_SYSCTL_VID 1300 /* Volts * 1000 */ -#define ASB100_SYSCTL_VRM 1301 - -#define ASB100_SYSCTL_PWM1 1401 /* 0-255 => 0-100% duty cycle */ - -#define ASB100_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define ASB100_SYSCTL_ALARMS 2001 /* bitvector */ #define ASB100_ALARM_IN0 0x0001 /* ? */ #define ASB100_ALARM_IN1 0x0002 /* ? */ @@ -289,176 +143,10 @@ #define ASB100_ALARM_IN7 0x10000 /* ? */ #define ASB100_ALARM_IN8 0x20000 /* ? */ -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define BMC_SYSCTL_IN1 1000 -#define BMC_SYSCTL_TEMP1 1100 -#define BMC_SYSCTL_CURR1 1200 -#define BMC_SYSCTL_FAN1 1300 -#define BMC_SYSCTL_ALARMS 5000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define BT869_SYSCTL_STATUS 1000 -#define BT869_SYSCTL_NTSC 1001 -#define BT869_SYSCTL_HALF 1002 -#define BT869_SYSCTL_RES 1003 -#define BT869_SYSCTL_COLORBARS 1004 -#define BT869_SYSCTL_DEPTH 1005 -#define BT869_SYSCTL_SVIDEO 1006 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define DDCMON_SYSCTL_ID 1010 -#define DDCMON_SYSCTL_SIZE 1011 -#define DDCMON_SYSCTL_SYNC 1012 -#define DDCMON_SYSCTL_TIMINGS 1013 -#define DDCMON_SYSCTL_SERIAL 1014 -#define DDCMON_SYSCTL_TIME 1015 -#define DDCMON_SYSCTL_EDID 1016 -#define DDCMON_SYSCTL_GAMMA 1017 -#define DDCMON_SYSCTL_DPMS 1018 -#define DDCMON_SYSCTL_TIMING1 1021 -#define DDCMON_SYSCTL_TIMING2 1022 -#define DDCMON_SYSCTL_TIMING3 1023 -#define DDCMON_SYSCTL_TIMING4 1024 -#define DDCMON_SYSCTL_TIMING5 1025 -#define DDCMON_SYSCTL_TIMING6 1026 -#define DDCMON_SYSCTL_TIMING7 1027 -#define DDCMON_SYSCTL_TIMING8 1028 -#define DDCMON_SYSCTL_MAXCLOCK 1029 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define DS1621_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ -#define DS1621_SYSCTL_ALARMS 2001 /* bitvector */ #define DS1621_ALARM_TEMP_HIGH 0x40 #define DS1621_ALARM_TEMP_LOW 0x20 -#define DS1621_SYSCTL_ENABLE 2002 -#define DS1621_SYSCTL_CONTINUOUS 2003 -#define DS1621_SYSCTL_POLARITY 2004 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define EEPROM_SYSCTL1 1000 -#define EEPROM_SYSCTL2 1001 -#define EEPROM_SYSCTL3 1002 -#define EEPROM_SYSCTL4 1003 -#define EEPROM_SYSCTL5 1004 -#define EEPROM_SYSCTL6 1005 -#define EEPROM_SYSCTL7 1006 -#define EEPROM_SYSCTL8 1007 -#define EEPROM_SYSCTL9 1008 -#define EEPROM_SYSCTL10 1009 -#define EEPROM_SYSCTL11 1010 -#define EEPROM_SYSCTL12 1011 -#define EEPROM_SYSCTL13 1012 -#define EEPROM_SYSCTL14 1013 -#define EEPROM_SYSCTL15 1014 -#define EEPROM_SYSCTL16 1015 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define F71805F_SYSCTL_IN0 1000 -#define F71805F_SYSCTL_IN1 1001 -#define F71805F_SYSCTL_IN2 1002 -#define F71805F_SYSCTL_IN3 1003 -#define F71805F_SYSCTL_IN4 1004 -#define F71805F_SYSCTL_IN5 1005 -#define F71805F_SYSCTL_IN6 1006 -#define F71805F_SYSCTL_IN7 1007 -#define F71805F_SYSCTL_IN8 1008 -#define F71805F_SYSCTL_FAN1 1101 -#define F71805F_SYSCTL_FAN2 1102 -#define F71805F_SYSCTL_FAN3 1103 -#define F71805F_SYSCTL_TEMP1 1201 -#define F71805F_SYSCTL_TEMP2 1202 -#define F71805F_SYSCTL_TEMP3 1203 -#define F71805F_SYSCTL_SENSOR1 1211 -#define F71805F_SYSCTL_SENSOR2 1212 -#define F71805F_SYSCTL_SENSOR3 1213 -#define F71805F_SYSCTL_ALARMS_IN 1090 -#define F71805F_SYSCTL_ALARMS_FAN 1190 -#define F71805F_SYSCTL_ALARMS_TEMP 1290 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define FSCHER_SYSCTL_VOLT0 1000 /* 12 volt supply */ -#define FSCHER_SYSCTL_VOLT1 1001 /* 5 volt supply */ -#define FSCHER_SYSCTL_VOLT2 1002 /* batterie voltage */ -#define FSCHER_SYSCTL_FAN0 1101 /* state, ripple, actual value - fan 0 */ -#define FSCHER_SYSCTL_FAN1 1102 /* state, ripple, actual value - fan 1 */ -#define FSCHER_SYSCTL_FAN2 1103 /* state, ripple, actual value - fan 2 */ -#define FSCHER_SYSCTL_TEMP0 1201 /* state and value of sensor 0, - cpu die */ -#define FSCHER_SYSCTL_TEMP1 1202 /* state and value of sensor 1, - motherboard */ -#define FSCHER_SYSCTL_TEMP2 1203 /* state and value of sensor 2, - chassis */ -#define FSCHER_SYSCTL_PWM0 1301 /* min fan 0 */ -#define FSCHER_SYSCTL_PWM1 1302 /* min fan 1 */ -#define FSCHER_SYSCTL_PWM2 1303 /* min fan 2 */ -#define FSCHER_SYSCTL_REV 2000 /* revision */ -#define FSCHER_SYSCTL_EVENT 2001 /* global event status */ -#define FSCHER_SYSCTL_CONTROL 2002 /* global control byte */ -#define FSCHER_SYSCTL_WDOG 2003 /* watch dog preset, state and - control */ -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define FSCPOS_SYSCTL_VOLT0 1000 /* 12 volt supply */ -#define FSCPOS_SYSCTL_VOLT1 1001 /* 5 volt supply */ -#define FSCPOS_SYSCTL_VOLT2 1002 /* batterie voltage*/ -#define FSCPOS_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */ -#define FSCPOS_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */ -#define FSCPOS_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */ -#define FSCPOS_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */ -#define FSCPOS_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */ -#define FSCPOS_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */ -#define FSCPOS_SYSCTL_REV 2000 /* Revision */ -#define FSCPOS_SYSCTL_EVENT 2001 /* global event status */ -#define FSCPOS_SYSCTL_CONTROL 2002 /* global control byte */ -#define FSCPOS_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */ -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define FSCSCY_SYSCTL_VOLT0 1000 /* 12 volt supply */ -#define FSCSCY_SYSCTL_VOLT1 1001 /* 5 volt supply */ -#define FSCSCY_SYSCTL_VOLT2 1002 /* batterie voltage*/ -#define FSCSCY_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */ -#define FSCSCY_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */ -#define FSCSCY_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */ -#define FSCSCY_SYSCTL_FAN3 1104 /* state, min, ripple, actual value fan 3 */ -#define FSCSCY_SYSCTL_FAN4 1105 /* state, min, ripple, actual value fan 4 */ -#define FSCSCY_SYSCTL_FAN5 1106 /* state, min, ripple, actual value fan 5 */ -#define FSCSCY_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */ -#define FSCSCY_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */ -#define FSCSCY_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */ -#define FSCSCY_SYSCTL_TEMP3 1204 /* state and value of sensor 3, chassis */ -#define FSCSCY_SYSCTL_REV 2000 /* Revision */ -#define FSCSCY_SYSCTL_EVENT 2001 /* global event status */ -#define FSCSCY_SYSCTL_CONTROL 2002 /* global control byte */ -#define FSCSCY_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */ -#define FSCSCY_SYSCTL_PCILOAD 2004 /* PCILoad value */ -#define FSCSCY_SYSCTL_INTRUSION 2005 /* state, control for intrusion sensor */ - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define GL518_SYSCTL_VDD 1000 /* Volts * 100 */ -#define GL518_SYSCTL_VIN1 1001 -#define GL518_SYSCTL_VIN2 1002 -#define GL518_SYSCTL_VIN3 1003 -#define GL518_SYSCTL_FAN1 1101 /* RPM */ -#define GL518_SYSCTL_FAN2 1102 -#define GL518_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ -#define GL518_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define GL518_SYSCTL_ALARMS 2001 /* bitvector */ -#define GL518_SYSCTL_BEEP 2002 /* bitvector */ -#define GL518_SYSCTL_FAN1OFF 2003 -#define GL518_SYSCTL_ITERATE 2004 #define GL518_ALARM_VDD 0x01 #define GL518_ALARM_VIN1 0x02 @@ -468,24 +156,6 @@ #define GL518_ALARM_FAN1 0x20 #define GL518_ALARM_FAN2 0x40 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define GL520_SYSCTL_VDD 1000 /* Volts * 100 */ -#define GL520_SYSCTL_VIN1 1001 -#define GL520_SYSCTL_VIN2 1002 -#define GL520_SYSCTL_VIN3 1003 -#define GL520_SYSCTL_VIN4 1004 -#define GL520_SYSCTL_FAN1 1101 /* RPM */ -#define GL520_SYSCTL_FAN2 1102 -#define GL520_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define GL520_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define GL520_SYSCTL_VID 1300 -#define GL520_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define GL520_SYSCTL_ALARMS 2001 /* bitvector */ -#define GL520_SYSCTL_BEEP 2002 /* bitvector */ -#define GL520_SYSCTL_FAN1OFF 2003 -#define GL520_SYSCTL_CONFIG 2004 #define GL520_ALARM_VDD 0x01 #define GL520_ALARM_VIN1 0x02 @@ -497,35 +167,6 @@ #define GL520_ALARM_TEMP2 0x80 #define GL520_ALARM_VIN4 0x80 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define IT87_SYSCTL_IN0 1000 /* Volts * 100 */ -#define IT87_SYSCTL_IN1 1001 -#define IT87_SYSCTL_IN2 1002 -#define IT87_SYSCTL_IN3 1003 -#define IT87_SYSCTL_IN4 1004 -#define IT87_SYSCTL_IN5 1005 -#define IT87_SYSCTL_IN6 1006 -#define IT87_SYSCTL_IN7 1007 -#define IT87_SYSCTL_IN8 1008 -#define IT87_SYSCTL_FAN1 1101 /* Rotations/min */ -#define IT87_SYSCTL_FAN2 1102 -#define IT87_SYSCTL_FAN3 1103 -#define IT87_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define IT87_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define IT87_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ -#define IT87_SYSCTL_VID 1300 /* Volts * 100 */ -#define IT87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define IT87_SYSCTL_ALARMS 2004 /* bitvector */ - -#define IT87_SYSCTL_PWM1 1401 -#define IT87_SYSCTL_PWM2 1402 -#define IT87_SYSCTL_PWM3 1403 -#define IT87_SYSCTL_FAN_CTL 1501 -#define IT87_SYSCTL_FAN_ON_OFF 1502 -#define IT87_SYSCTL_SENS1 1601 /* 1, 2, or Beta (3000-5000) */ -#define IT87_SYSCTL_SENS2 1602 -#define IT87_SYSCTL_SENS3 1603 #define IT87_ALARM_IN0 0x000100 #define IT87_ALARM_IN1 0x000200 @@ -542,16 +183,6 @@ #define IT87_ALARM_TEMP2 0x00020000 #define IT87_ALARM_TEMP3 0x00040000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define LM63_SYSCTL_TEMP1 1200 -#define LM63_SYSCTL_TEMP2 1201 -#define LM63_SYSCTL_TEMP2_TCRIT 1205 -#define LM63_SYSCTL_TEMP2_TCRIT_HYST 1208 -#define LM63_SYSCTL_ALARMS 1210 -#define LM63_SYSCTL_FAN1 1220 -#define LM63_SYSCTL_PWM1 1230 #define LM63_ALARM_LOCAL_HIGH 0x40 #define LM63_ALARM_REMOTE_HIGH 0x10 @@ -560,27 +191,6 @@ #define LM63_ALARM_REMOTE_OPEN 0x04 #define LM63_ALARM_FAN_LOW 0x01 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define LM75_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define LM78_SYSCTL_IN0 1000 /* Volts * 100 */ -#define LM78_SYSCTL_IN1 1001 -#define LM78_SYSCTL_IN2 1002 -#define LM78_SYSCTL_IN3 1003 -#define LM78_SYSCTL_IN4 1004 -#define LM78_SYSCTL_IN5 1005 -#define LM78_SYSCTL_IN6 1006 -#define LM78_SYSCTL_FAN1 1101 /* Rotations/min */ -#define LM78_SYSCTL_FAN2 1102 -#define LM78_SYSCTL_FAN3 1103 -#define LM78_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ -#define LM78_SYSCTL_VID 1300 /* Volts * 100 */ -#define LM78_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define LM78_SYSCTL_ALARMS 2001 /* bitvector */ #define LM78_ALARM_IN0 0x0001 #define LM78_ALARM_IN1 0x0002 @@ -598,21 +208,6 @@ #define LM78_ALARM_FIFO 0x2000 #define LM78_ALARM_SMI_IN 0x4000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define LM80_SYSCTL_IN0 1000 /* Volts * 100 */ -#define LM80_SYSCTL_IN1 1001 -#define LM80_SYSCTL_IN2 1002 -#define LM80_SYSCTL_IN3 1003 -#define LM80_SYSCTL_IN4 1004 -#define LM80_SYSCTL_IN5 1005 -#define LM80_SYSCTL_IN6 1006 -#define LM80_SYSCTL_FAN1 1101 /* Rotations/min */ -#define LM80_SYSCTL_FAN2 1102 -#define LM80_SYSCTL_TEMP 1250 /* Degrees Celsius * 100 */ -#define LM80_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define LM80_SYSCTL_ALARMS 2001 /* bitvector */ #define LM80_ALARM_IN0 0x0001 #define LM80_ALARM_IN1 0x0002 @@ -629,15 +224,6 @@ #define LM80_ALARM_BTI 0x0200 #define LM80_ALARM_INT_IN 0x0080 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define LM83_SYSCTL_LOCAL_TEMP 1200 -#define LM83_SYSCTL_REMOTE1_TEMP 1201 -#define LM83_SYSCTL_REMOTE2_TEMP 1202 -#define LM83_SYSCTL_REMOTE3_TEMP 1203 -#define LM83_SYSCTL_TCRIT 1208 -#define LM83_SYSCTL_ALARMS 1210 #define LM83_ALARM_LOCAL_HIGH 0x0040 #define LM83_ALARM_LOCAL_CRIT 0x0001 @@ -651,62 +237,6 @@ #define LM83_ALARM_REMOTE3_CRIT 0x0200 #define LM83_ALARM_REMOTE3_OPEN 0x0400 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -/* Common parameters */ -#define LM85_SYSCTL_IN0 1000 -#define LM85_SYSCTL_IN1 1001 -#define LM85_SYSCTL_IN2 1002 -#define LM85_SYSCTL_IN3 1003 -#define LM85_SYSCTL_IN4 1004 -#define LM85_SYSCTL_FAN1 1005 -#define LM85_SYSCTL_FAN2 1006 -#define LM85_SYSCTL_FAN3 1007 -#define LM85_SYSCTL_FAN4 1008 -#define LM85_SYSCTL_TEMP1 1009 -#define LM85_SYSCTL_TEMP2 1010 -#define LM85_SYSCTL_TEMP3 1011 -#define LM85_SYSCTL_VID 1012 -#define LM85_SYSCTL_ALARMS 1013 -#define LM85_SYSCTL_PWM1 1014 -#define LM85_SYSCTL_PWM2 1015 -#define LM85_SYSCTL_PWM3 1016 -#define LM85_SYSCTL_VRM 1017 -#define LM85_SYSCTL_PWM_CFG1 1019 -#define LM85_SYSCTL_PWM_CFG2 1020 -#define LM85_SYSCTL_PWM_CFG3 1021 -#define LM85_SYSCTL_PWM_ZONE1 1022 -#define LM85_SYSCTL_PWM_ZONE2 1023 -#define LM85_SYSCTL_PWM_ZONE3 1024 -#define LM85_SYSCTL_ZONE1 1025 -#define LM85_SYSCTL_ZONE2 1026 -#define LM85_SYSCTL_ZONE3 1027 -#define LM85_SYSCTL_SMOOTH1 1028 -#define LM85_SYSCTL_SMOOTH2 1029 -#define LM85_SYSCTL_SMOOTH3 1030 - -/* Vendor specific values */ -#define LM85_SYSCTL_SPINUP_CTL 1100 -#define LM85_SYSCTL_TACH_MODE 1101 - -/* Analog Devices variant of the LM85 */ -#define ADM1027_SYSCTL_TACH_MODE 1200 -#define ADM1027_SYSCTL_TEMP_OFFSET1 1201 -#define ADM1027_SYSCTL_TEMP_OFFSET2 1202 -#define ADM1027_SYSCTL_TEMP_OFFSET3 1203 -#define ADM1027_SYSCTL_FAN_PPR 1204 -#define ADM1027_SYSCTL_ALARM_MASK 1205 - -/* Analog Devices variant of the LM85/ADM1027 */ -#define ADT7463_SYSCTL_TMIN_CTL1 1300 -#define ADT7463_SYSCTL_TMIN_CTL2 1301 -#define ADT7463_SYSCTL_TMIN_CTL3 1302 -#define ADT7463_SYSCTL_THERM_SIGNAL 1303 - -/* SMSC variant of the LM85 */ -#define EMC6D100_SYSCTL_IN5 1400 -#define EMC6D100_SYSCTL_IN6 1401 -#define EMC6D100_SYSCTL_IN7 1402 #define LM85_ALARM_IN0 0x0001 #define LM85_ALARM_IN1 0x0002 @@ -727,26 +257,7 @@ #define LM85_ALARM_IN6 0x10000 #define LM85_ALARM_IN7 0x20000 #define LM85_ALARM_IN5 0x40000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define LM87_SYSCTL_IN0 1000 /* Volts * 100 */ -#define LM87_SYSCTL_IN1 1001 -#define LM87_SYSCTL_IN2 1002 -#define LM87_SYSCTL_IN3 1003 -#define LM87_SYSCTL_IN4 1004 -#define LM87_SYSCTL_IN5 1005 -#define LM87_SYSCTL_AIN1 1006 -#define LM87_SYSCTL_AIN2 1007 -#define LM87_SYSCTL_FAN1 1102 -#define LM87_SYSCTL_FAN2 1103 -#define LM87_SYSCTL_TEMP1 1250 /* Degrees Celsius * 10 */ -#define LM87_SYSCTL_TEMP2 1251 /* Degrees Celsius * 10 */ -#define LM87_SYSCTL_TEMP3 1252 /* Degrees Celsius * 10 */ -#define LM87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define LM87_SYSCTL_ALARMS 2001 /* bitvector */ -#define LM87_SYSCTL_ANALOG_OUT 2002 -#define LM87_SYSCTL_VID 2003 -#define LM87_SYSCTL_VRM 2004 + #define LM87_ALARM_IN0 0x0001 #define LM87_ALARM_IN1 0x0002 @@ -766,17 +277,6 @@ #define LM87_ALARM_TEMP2_FAULT 0x4000 #define LM87_ALARM_TEMP3_FAULT 0x08000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define LM90_SYSCTL_LOCAL_TEMP 1200 -#define LM90_SYSCTL_REMOTE_TEMP 1201 -#define LM90_SYSCTL_LOCAL_TCRIT 1204 -#define LM90_SYSCTL_REMOTE_TCRIT 1205 -#define LM90_SYSCTL_LOCAL_HYST 1207 -#define LM90_SYSCTL_REMOTE_HYST 1208 -#define LM90_SYSCTL_ALARMS 1210 -#define LM90_SYSCTL_PEC 1214 #define LM90_ALARM_LOCAL_HIGH 0x40 #define LM90_ALARM_LOCAL_LOW 0x20 @@ -786,10 +286,6 @@ #define LM90_ALARM_REMOTE_CRIT 0x02 #define LM90_ALARM_REMOTE_OPEN 0x04 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define LM92_SYSCTL_ALARMS 2001 /* high, low, critical */ -#define LM92_SYSCTL_TEMP 1200 /* high, low, critical, hysteresis, input */ #define LM92_ALARM_TEMP_HIGH 0x01 #define LM92_ALARM_TEMP_LOW 0x02 @@ -800,119 +296,6 @@ #define LM92_TEMP_HYST 0x40 #define LM92_TEMP_INPUT 0x80 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -/* volts * 100 */ -#define LM93_SYSCTL_IN1 1001 -#define LM93_SYSCTL_IN2 1002 -#define LM93_SYSCTL_IN3 1003 -#define LM93_SYSCTL_IN4 1004 -#define LM93_SYSCTL_IN5 1005 -#define LM93_SYSCTL_IN6 1006 -#define LM93_SYSCTL_IN7 1007 -#define LM93_SYSCTL_IN8 1008 -#define LM93_SYSCTL_IN9 1009 -#define LM93_SYSCTL_IN10 1010 -#define LM93_SYSCTL_IN11 1011 -#define LM93_SYSCTL_IN12 1012 -#define LM93_SYSCTL_IN13 1013 -#define LM93_SYSCTL_IN14 1014 -#define LM93_SYSCTL_IN15 1015 -#define LM93_SYSCTL_IN16 1016 - -/* degrees Celsius * 10 */ -#define LM93_SYSCTL_TEMP1 1101 -#define LM93_SYSCTL_TEMP2 1102 -#define LM93_SYSCTL_TEMP3 1103 - -#define LM93_SYSCTL_TEMP1_AUTO_BASE 1111 -#define LM93_SYSCTL_TEMP2_AUTO_BASE 1112 -#define LM93_SYSCTL_TEMP3_AUTO_BASE 1113 - -#define LM93_SYSCTL_TEMP1_AUTO_OFFSETS 1121 -#define LM93_SYSCTL_TEMP2_AUTO_OFFSETS 1122 -#define LM93_SYSCTL_TEMP3_AUTO_OFFSETS 1123 - -#define LM93_SYSCTL_TEMP1_AUTO_BOOST 1131 -#define LM93_SYSCTL_TEMP2_AUTO_BOOST 1132 -#define LM93_SYSCTL_TEMP3_AUTO_BOOST 1133 - -#define LM93_SYSCTL_TEMP1_AUTO_BOOST_HYST 1141 -#define LM93_SYSCTL_TEMP2_AUTO_BOOST_HYST 1142 -#define LM93_SYSCTL_TEMP3_AUTO_BOOST_HYST 1143 - -/* 0 => off, 255 => 100% */ -#define LM93_SYSCTL_TEMP1_AUTO_PWM_MIN 1151 -#define LM93_SYSCTL_TEMP2_AUTO_PWM_MIN 1152 -#define LM93_SYSCTL_TEMP3_AUTO_PWM_MIN 1153 - -/* degrees Celsius * 10 */ -#define LM93_SYSCTL_TEMP1_AUTO_OFFSET_HYST 1161 -#define LM93_SYSCTL_TEMP2_AUTO_OFFSET_HYST 1162 -#define LM93_SYSCTL_TEMP3_AUTO_OFFSET_HYST 1163 - -/* rotations/minute */ -#define LM93_SYSCTL_FAN1 1201 -#define LM93_SYSCTL_FAN2 1202 -#define LM93_SYSCTL_FAN3 1203 -#define LM93_SYSCTL_FAN4 1204 - -/* 1-2 => enable smart tach mode associated with this pwm #, or disable */ -#define LM93_SYSCTL_FAN1_SMART_TACH 1205 -#define LM93_SYSCTL_FAN2_SMART_TACH 1206 -#define LM93_SYSCTL_FAN3_SMART_TACH 1207 -#define LM93_SYSCTL_FAN4_SMART_TACH 1208 - -/* volts * 1000 */ -#define LM93_SYSCTL_VID1 1301 -#define LM93_SYSCTL_VID2 1302 - -/* 0 => off, 255 => 100% */ -#define LM93_SYSCTL_PWM1 1401 -#define LM93_SYSCTL_PWM2 1402 - -/* Hz */ -#define LM93_SYSCTL_PWM1_FREQ 1411 -#define LM93_SYSCTL_PWM2_FREQ 1412 - -/* bitvector */ -#define LM93_SYSCTL_PWM1_AUTO_CHANNELS 1421 -#define LM93_SYSCTL_PWM2_AUTO_CHANNELS 1422 - -/* Hz */ -#define LM93_SYSCTL_PWM1_AUTO_SPINUP_MIN 1431 -#define LM93_SYSCTL_PWM2_AUTO_SPINUP_MIN 1432 - -/* seconds */ -#define LM93_SYSCTL_PWM1_AUTO_SPINUP_TIME 1441 -#define LM93_SYSCTL_PWM2_AUTO_SPINUP_TIME 1442 - -/* seconds */ -#define LM93_SYSCTL_PWM_AUTO_PROCHOT_RAMP 1451 -#define LM93_SYSCTL_PWM_AUTO_VRDHOT_RAMP 1452 - -/* 0 => 0%, 255 => > 99.6% */ -#define LM93_SYSCTL_PROCHOT1 1501 -#define LM93_SYSCTL_PROCHOT2 1502 - -/* !0 => enable #PROCHOT logical short */ -#define LM93_SYSCTL_PROCHOT_SHORT 1503 - -/* 2 boolean enable/disable, 3rd value indicates duty cycle */ -#define LM93_SYSCTL_PROCHOT_OVERRIDE 1504 - -/* 2 values, 0-9 */ -#define LM93_SYSCTL_PROCHOT_INTERVAL 1505 - -/* GPIO input (bitmask) */ -#define LM93_SYSCTL_GPIO 1601 - -/* #VRDHOT input (boolean) */ -#define LM93_SYSCTL_VRDHOT1 1701 -#define LM93_SYSCTL_VRDHOT2 1702 - -/* alarms (bitmask) */ -#define LM93_SYSCTL_ALARMS 2001 /* alarm bitmask definitions The LM93 has nearly 64 bits of error status... I've pared that down to @@ -955,62 +338,12 @@ #define LM93_ALARM_TEMP2 0x20000000 #define LM93_ALARM_TEMP3 0x40000000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define LTC1710_SYSCTL_SWITCH_1 1000 -#define LTC1710_SYSCTL_SWITCH_2 1001 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define MATORB_SYSCTL_DISP 1000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define MAX1619_SYSCTL_LOCAL_TEMP 1200 -#define MAX1619_SYSCTL_REMOTE_TEMP 1201 -#define MAX1619_SYSCTL_REMOTE_CRIT 1202 -#define MAX1619_SYSCTL_ALARMS 1203 #define MAX1619_ALARM_REMOTE_THIGH 0x10 #define MAX1619_ALARM_REMOTE_TLOW 0x08 #define MAX1619_ALARM_REMOTE_OPEN 0x04 #define MAX1619_ALARM_REMOTE_OVERT 0x02 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define MAX6650_SYSCTL_FAN1 1101 -#define MAX6650_SYSCTL_FAN2 1102 -#define MAX6650_SYSCTL_FAN3 1103 -#define MAX6650_SYSCTL_FAN4 1104 -#define MAX6650_SYSCTL_SPEED 1105 -#define MAX6650_SYSCTL_XDUMP 1106 - - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define MAXI_SYSCTL_FAN1 1101 /* Rotations/min */ -#define MAXI_SYSCTL_FAN2 1102 /* Rotations/min */ -#define MAXI_SYSCTL_FAN3 1103 /* Rotations/min */ -#define MAXI_SYSCTL_FAN4 1104 /* Rotations/min */ -#define MAXI_SYSCTL_TEMP1 1201 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP2 1202 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP3 1203 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP4 1204 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP5 1205 /* Degrees Celsius */ -#define MAXI_SYSCTL_TEMP6 1206 /* Degrees Celsius */ -#define MAXI_SYSCTL_PLL 1301 /* MHz */ -#define MAXI_SYSCTL_VID1 1401 /* Volts / 6.337, for nba just Volts */ -#define MAXI_SYSCTL_VID2 1402 /* Volts */ -#define MAXI_SYSCTL_VID3 1403 /* Volts */ -#define MAXI_SYSCTL_VID4 1404 /* Volts */ -#define MAXI_SYSCTL_VID5 1405 /* Volts */ -#define MAXI_SYSCTL_LCD1 1501 /* Line 1 of LCD */ -#define MAXI_SYSCTL_LCD2 1502 /* Line 2 of LCD */ -#define MAXI_SYSCTL_LCD3 1503 /* Line 3 of LCD */ -#define MAXI_SYSCTL_LCD4 1504 /* Line 4 of LCD */ -#define MAXI_SYSCTL_ALARMS 2001 /* Bitvector (see below) */ #define MAXI_ALARM_VID4 0x0001 #define MAXI_ALARM_TEMP2 0x0002 @@ -1029,40 +362,6 @@ #define MAXI_ALARM_TEMP 0x0400 /* in the alarm group failed, i.e.: */ #define MAXI_ALARM_VADD 0x0800 /* 0x0402 = TEMP2 failed = CPU2 temp */ -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define MIC74_SYSCTL_REG0 1000 -#define MIC74_SYSCTL_REG1 1001 -#define MIC74_SYSCTL_REG2 1002 -#define MIC74_SYSCTL_REG3 1003 -#define MIC74_SYSCTL_REG4 1004 -#define MIC74_SYSCTL_REG5 1005 -#define MIC74_SYSCTL_REG6 1006 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define MTP008_SYSCTL_IN0 1000 /* Volts * 100 */ -#define MTP008_SYSCTL_IN1 1001 -#define MTP008_SYSCTL_IN2 1002 -#define MTP008_SYSCTL_IN3 1003 -#define MTP008_SYSCTL_IN4 1004 -#define MTP008_SYSCTL_IN5 1005 -#define MTP008_SYSCTL_IN6 1006 -#define MTP008_SYSCTL_FAN1 1101 /* Rotations/min */ -#define MTP008_SYSCTL_FAN2 1102 -#define MTP008_SYSCTL_FAN3 1103 -#define MTP008_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define MTP008_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define MTP008_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ -#define MTP008_SYSCTL_VID 1300 /* Volts * 100 */ -#define MTP008_SYSCTL_PWM1 1401 -#define MTP008_SYSCTL_PWM2 1402 -#define MTP008_SYSCTL_PWM3 1403 -#define MTP008_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ -#define MTP008_SYSCTL_SENS2 1502 -#define MTP008_SYSCTL_SENS3 1503 -#define MTP008_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define MTP008_SYSCTL_ALARMS 2001 /* bitvector */ -#define MTP008_SYSCTL_BEEP 2002 /* bitvector */ #define MTP008_ALARM_IN0 0x0001 #define MTP008_ALARM_IN1 0x0002 @@ -1078,112 +377,19 @@ #define MTP008_ALARM_TEMP2 0x0100 #define MTP008_ALARM_TEMP3 0x0200 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define PC87365_SYSCTL_ALARMS 100 /* bit field */ - -#define PC87360_SYSCTL_FAN1 1101 /* Rotations/min */ -#define PC87360_SYSCTL_FAN2 1102 -#define PC87360_SYSCTL_FAN3 1103 /* not for PC87360/PC87363 */ -#define PC87360_SYSCTL_FAN_DIV 1201 /* 1, 2, 4 or 8 */ -#define PC87360_SYSCTL_FAN1_STATUS 1301 /* bit field */ -#define PC87360_SYSCTL_FAN2_STATUS 1302 -#define PC87360_SYSCTL_FAN3_STATUS 1303 /* not for PC87360/PC87363 */ -#define PC87360_SYSCTL_PWM1 1401 /* 0-255 */ -#define PC87360_SYSCTL_PWM2 1402 -#define PC87360_SYSCTL_PWM3 1403 /* not for PC87360/PC87363 */ #define PC87360_STATUS_FAN_READY 0x01 #define PC87360_STATUS_FAN_LOW 0x02 #define PC87360_STATUS_FAN_OVERFLOW 0x04 -#define PC87365_SYSCTL_IN0 2100 /* mV */ -#define PC87365_SYSCTL_IN1 2101 -#define PC87365_SYSCTL_IN2 2102 -#define PC87365_SYSCTL_IN3 2103 -#define PC87365_SYSCTL_IN4 2104 -#define PC87365_SYSCTL_IN5 2105 -#define PC87365_SYSCTL_IN6 2106 -#define PC87365_SYSCTL_IN7 2107 -#define PC87365_SYSCTL_IN8 2108 -#define PC87365_SYSCTL_IN9 2109 -#define PC87365_SYSCTL_IN10 2110 -#define PC87365_SYSCTL_TEMP4 2111 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP5 2112 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP6 2113 /* not for PC87365 */ -#define PC87365_SYSCTL_IN0_STATUS 2300 /* bit field */ -#define PC87365_SYSCTL_IN1_STATUS 2301 -#define PC87365_SYSCTL_IN2_STATUS 2302 -#define PC87365_SYSCTL_IN3_STATUS 2303 -#define PC87365_SYSCTL_IN4_STATUS 2304 -#define PC87365_SYSCTL_IN5_STATUS 2305 -#define PC87365_SYSCTL_IN6_STATUS 2306 -#define PC87365_SYSCTL_IN7_STATUS 2307 -#define PC87365_SYSCTL_IN8_STATUS 2308 -#define PC87365_SYSCTL_IN9_STATUS 2309 -#define PC87365_SYSCTL_IN10_STATUS 2310 -#define PC87365_SYSCTL_TEMP4_STATUS 2311 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP5_STATUS 2312 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP6_STATUS 2313 /* not for PC87365 */ - -#define PC87365_SYSCTL_VID 2400 -#define PC87365_SYSCTL_VRM 2401 - #define PC87365_STATUS_IN_MIN 0x02 #define PC87365_STATUS_IN_MAX 0x04 -#define PC87365_SYSCTL_TEMP1 3101 /* degrees Celsius */ -#define PC87365_SYSCTL_TEMP2 3102 -#define PC87365_SYSCTL_TEMP3 3103 /* not for PC87365 */ -#define PC87365_SYSCTL_TEMP1_STATUS 3301 /* bit field */ -#define PC87365_SYSCTL_TEMP2_STATUS 3302 -#define PC87365_SYSCTL_TEMP3_STATUS 3303 /* not for PC87365 */ - #define PC87365_STATUS_TEMP_MIN 0x02 #define PC87365_STATUS_TEMP_MAX 0x04 #define PC87365_STATUS_TEMP_CRIT 0x08 #define PC87365_STATUS_TEMP_OPEN 0x40 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define PCA9540_SYSCTL_CHANNEL 1000 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define PCF8574_SYSCTL_READ 1000 -#define PCF8574_SYSCTL_WRITE 1001 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define PCF8591_SYSCTL_AIN_CONF 1000 /* Analog input configuration */ -#define PCF8591_SYSCTL_CH0 1001 /* Input channel 1 */ -#define PCF8591_SYSCTL_CH1 1002 /* Input channel 2 */ -#define PCF8591_SYSCTL_CH2 1003 /* Input channel 3 */ -#define PCF8591_SYSCTL_CH3 1004 /* Input channel 4 */ -#define PCF8591_SYSCTL_AOUT_ENABLE 1005 /* Analog output enable flag */ -#define PCF8591_SYSCTL_AOUT 1006 /* Analog output */ -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define SAA1064_SYSCTL_BRIGHT 1000 /* Brightness, 0-7 */ -#define SAA1064_SYSCTL_TEST 1001 /* Testmode (on = all digits lit) */ -#define SAA1064_SYSCTL_DISP 1005 /* four eight bit values */ -#define SAA1064_SYSCTL_REFRESH 1006 /* refresh digits in case of powerloss */ - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define SIS5595_SYSCTL_IN0 1000 /* Volts * 100 */ -#define SIS5595_SYSCTL_IN1 1001 -#define SIS5595_SYSCTL_IN2 1002 -#define SIS5595_SYSCTL_IN3 1003 -#define SIS5595_SYSCTL_IN4 1004 -#define SIS5595_SYSCTL_FAN1 1101 /* Rotations/min */ -#define SIS5595_SYSCTL_FAN2 1102 -#define SIS5595_SYSCTL_TEMP 1200 /* Degrees Celsius * 10 */ -#define SIS5595_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define SIS5595_SYSCTL_ALARMS 2001 /* bitvector */ #define SIS5595_ALARM_IN0 0x01 #define SIS5595_ALARM_IN1 0x02 @@ -1195,10 +401,7 @@ #define SIS5595_ALARM_IN4 0x8000 #define SIS5595_ALARM_TEMP 0x8000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -/* Status Register Bits */ /* * * * * * Alarm Bits * * * * */ #define SMARTBATT_OVER_CHARGED_ALARM 0x8000 #define SMARTBATT_TERMINATE_CHARGE_ALARM 0x4000 @@ -1236,65 +439,10 @@ | SMARTBATT_UNKNOWN_ERROR) -#define SMARTBATT_SYSCTL_I 1001 -#define SMARTBATT_SYSCTL_V 1002 -#define SMARTBATT_SYSCTL_TEMP 1003 -#define SMARTBATT_SYSCTL_TIME 1004 -#define SMARTBATT_SYSCTL_ALARMS 1005 -#define SMARTBATT_SYSCTL_STATUS 1006 -#define SMARTBATT_SYSCTL_ERROR 1007 -#define SMARTBATT_SYSCTL_CHARGE 1008 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define ARP_SYSCTL1 1000 -#define ARP_SYSCTL2 1001 -#define ARP_SYSCTL3 1002 -#define ARP_SYSCTL4 1003 -#define ARP_SYSCTL5 1004 -#define ARP_SYSCTL6 1005 -#define ARP_SYSCTL7 1006 -#define ARP_SYSCTL8 1007 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define SMSC47M1_SYSCTL_FAN1 1101 /* Rotations/min */ -#define SMSC47M1_SYSCTL_FAN2 1102 -#define SMSC47M1_SYSCTL_FAN3 1103 -#define SMSC47M1_SYSCTL_PWM1 1401 -#define SMSC47M1_SYSCTL_PWM2 1402 -#define SMSC47M1_SYSCTL_PWM3 1403 -#define SMSC47M1_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define SMSC47M1_SYSCTL_ALARMS 2004 /* bitvector */ - #define SMSC47M1_ALARM_FAN1 0x0001 #define SMSC47M1_ALARM_FAN2 0x0002 #define SMSC47M1_ALARM_FAN3 0x0004 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define THMC50_SYSCTL_TEMP 1200 /* Degrees Celsius */ -#define THMC50_SYSCTL_REMOTE_TEMP 1201 /* Degrees Celsius */ -#define THMC50_SYSCTL_INTER 1202 -#define THMC50_SYSCTL_INTER_MASK 1203 -#define THMC50_SYSCTL_DIE_CODE 1204 -#define THMC50_SYSCTL_ANALOG_OUT 1205 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define VIA686A_SYSCTL_IN0 1000 -#define VIA686A_SYSCTL_IN1 1001 -#define VIA686A_SYSCTL_IN2 1002 -#define VIA686A_SYSCTL_IN3 1003 -#define VIA686A_SYSCTL_IN4 1004 -#define VIA686A_SYSCTL_FAN1 1101 -#define VIA686A_SYSCTL_FAN2 1102 -#define VIA686A_SYSCTL_TEMP 1200 -#define VIA686A_SYSCTL_TEMP2 1201 -#define VIA686A_SYSCTL_TEMP3 1202 -#define VIA686A_SYSCTL_FAN_DIV 2000 -#define VIA686A_SYSCTL_ALARMS 2001 #define VIA686A_ALARM_IN0 0x01 #define VIA686A_ALARM_IN1 0x02 @@ -1308,30 +456,6 @@ #define VIA686A_ALARM_CHAS 0x1000 #define VIA686A_ALARM_TEMP3 0x8000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define VT1211_SYSCTL_IN0 1000 -#define VT1211_SYSCTL_IN1 1001 -#define VT1211_SYSCTL_IN2 1002 -#define VT1211_SYSCTL_IN3 1003 -#define VT1211_SYSCTL_IN4 1004 -#define VT1211_SYSCTL_IN5 1005 -#define VT1211_SYSCTL_FAN1 1101 -#define VT1211_SYSCTL_FAN2 1102 -#define VT1211_SYSCTL_TEMP1 1200 -#define VT1211_SYSCTL_TEMP2 1201 -#define VT1211_SYSCTL_TEMP3 1202 -#define VT1211_SYSCTL_TEMP4 1203 -#define VT1211_SYSCTL_TEMP5 1204 -#define VT1211_SYSCTL_TEMP6 1205 -#define VT1211_SYSCTL_TEMP7 1206 -#define VT1211_SYSCTL_VID 1300 -#define VT1211_SYSCTL_PWM1 1401 -#define VT1211_SYSCTL_PWM2 1402 -#define VT1211_SYSCTL_VRM 1600 -#define VT1211_SYSCTL_UCH 1700 -#define VT1211_SYSCTL_FAN_DIV 2000 -#define VT1211_SYSCTL_ALARMS 2001 #define VT1211_ALARM_IN1 0x01 #define VT1211_ALARM_IN2 0x02 @@ -1351,29 +475,6 @@ #define VT1211_ALARM_TEMP6 VT1211_ALARM_IN3 #define VT1211_ALARM_TEMP7 VT1211_ALARM_IN4 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ -#define VT8231_SYSCTL_IN0 1000 -#define VT8231_SYSCTL_IN1 1001 -#define VT8231_SYSCTL_IN2 1002 -#define VT8231_SYSCTL_IN3 1003 -#define VT8231_SYSCTL_IN4 1004 -#define VT8231_SYSCTL_IN5 1005 -#define VT8231_SYSCTL_FAN1 1101 -#define VT8231_SYSCTL_FAN2 1102 -#define VT8231_SYSCTL_TEMP 1200 -#define VT8231_SYSCTL_TEMP2 1201 -#define VT8231_SYSCTL_TEMP3 1202 -#define VT8231_SYSCTL_TEMP4 1203 -#define VT8231_SYSCTL_TEMP5 1204 -#define VT8231_SYSCTL_TEMP6 1205 -#define VT8231_SYSCTL_VID 1300 -#define VT8231_SYSCTL_PWM1 1401 -#define VT8231_SYSCTL_PWM2 1402 -#define VT8231_SYSCTL_VRM 1600 -#define VT8231_SYSCTL_UCH 1700 -#define VT8231_SYSCTL_FAN_DIV 2000 -#define VT8231_SYSCTL_ALARMS 2001 #define VT8231_ALARM_IN1 0x01 #define VT8231_ALARM_IN2 0x02 @@ -1392,91 +493,6 @@ #define VT8231_ALARM_TEMP5 VT8231_ALARM_IN3 #define VT8231_ALARM_TEMP6 VT8231_ALARM_IN4 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define W83781D_SYSCTL_IN0 1000 /* Volts * 100 */ -#define W83781D_SYSCTL_IN1 1001 -#define W83781D_SYSCTL_IN2 1002 -#define W83781D_SYSCTL_IN3 1003 -#define W83781D_SYSCTL_IN4 1004 -#define W83781D_SYSCTL_IN5 1005 -#define W83781D_SYSCTL_IN6 1006 -#define W83781D_SYSCTL_IN7 1007 -#define W83781D_SYSCTL_IN8 1008 -#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */ -#define W83781D_SYSCTL_FAN2 1102 -#define W83781D_SYSCTL_FAN3 1103 -#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_VID 1300 /* Volts * 1000 */ -#define W83781D_SYSCTL_VRM 1301 -#define W83781D_SYSCTL_PWM1 1401 -#define W83781D_SYSCTL_PWM2 1402 -#define W83781D_SYSCTL_PWM3 1403 -#define W83781D_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ -#define W83781D_SYSCTL_SENS2 1502 -#define W83781D_SYSCTL_SENS3 1503 -#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */ -#define W83781D_SYSCTL_BEEP 2002 /* bitvector */ - -#define W83781D_ALARM_IN0 0x0001 -#define W83781D_ALARM_IN1 0x0002 -#define W83781D_ALARM_IN2 0x0004 -#define W83781D_ALARM_IN3 0x0008 -#define W83781D_ALARM_IN4 0x0100 -#define W83781D_ALARM_IN5 0x0200 -#define W83781D_ALARM_IN6 0x0400 -#define W83782D_ALARM_IN7 0x10000 -#define W83782D_ALARM_IN8 0x20000 -#define W83781D_ALARM_FAN1 0x0040 -#define W83781D_ALARM_FAN2 0x0080 -#define W83781D_ALARM_FAN3 0x0800 -#define W83781D_ALARM_TEMP1 0x0010 -#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */ -#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S */ -#define W83781D_ALARM_TEMP3 0x2000 /* 782D only */ -#define W83781D_ALARM_CHAS 0x1000 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define W83781D_SYSCTL_IN0 1000 /* Volts * 100 */ -#define W83781D_SYSCTL_IN1 1001 -#define W83781D_SYSCTL_IN2 1002 -#define W83781D_SYSCTL_IN3 1003 -#define W83781D_SYSCTL_IN4 1004 -#define W83781D_SYSCTL_IN5 1005 -#define W83781D_SYSCTL_IN6 1006 -#define W83781D_SYSCTL_IN7 1007 -#define W83781D_SYSCTL_IN8 1008 -#define W83781D_SYSCTL_IN9 1009 -#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */ -#define W83781D_SYSCTL_FAN2 1102 -#define W83781D_SYSCTL_FAN3 1103 -#define W83781D_SYSCTL_FAN4 1104 -#define W83781D_SYSCTL_FAN5 1105 - -#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celsius * 10 */ -#define W83781D_SYSCTL_VID 1300 /* Volts * 1000 */ -#define W83781D_SYSCTL_VRM 1301 -#define W83781D_SYSCTL_PWM1 1401 -#define W83781D_SYSCTL_PWM2 1402 -#define W83781D_SYSCTL_PWM3 1403 -#define W83781D_SYSCTL_PWM4 1404 -#define W83781D_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ -#define W83781D_SYSCTL_SENS2 1502 -#define W83781D_SYSCTL_SENS3 1503 -#define W83781D_SYSCTL_RT1 1601 /* 32-entry table */ -#define W83781D_SYSCTL_RT2 1602 /* 32-entry table */ -#define W83781D_SYSCTL_RT3 1603 /* 32-entry table */ -#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ -#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */ -#define W83781D_SYSCTL_BEEP 2002 /* bitvector */ #define W83781D_ALARM_IN0 0x0001 #define W83781D_ALARM_IN1 0x0002 @@ -1506,48 +522,6 @@ #define W83791D_BEEP_IN8 0x020000 /* 791D only */ #define W83791D_BEEP_TEMP3 0x000002 /* 791D only */ -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define W83792D_SYSCTL_IN0 1000 -#define W83792D_SYSCTL_IN1 1001 -#define W83792D_SYSCTL_IN2 1002 -#define W83792D_SYSCTL_IN3 1003 -#define W83792D_SYSCTL_IN4 1004 -#define W83792D_SYSCTL_IN5 1005 -#define W83792D_SYSCTL_IN6 1006 -#define W83792D_SYSCTL_IN7 1007 -#define W83792D_SYSCTL_IN8 1008 -#define W83792D_SYSCTL_FAN1 1101 -#define W83792D_SYSCTL_FAN2 1102 -#define W83792D_SYSCTL_FAN3 1103 -#define W83792D_SYSCTL_FAN4 1104 -#define W83792D_SYSCTL_FAN5 1105 -#define W83792D_SYSCTL_FAN6 1106 -#define W83792D_SYSCTL_FAN7 1107 - -#define W83792D_SYSCTL_TEMP1 1200 -#define W83792D_SYSCTL_TEMP2 1201 -#define W83792D_SYSCTL_TEMP3 1202 -/*#define W83792D_SYSCTL_VID 1300 -#define W83792D_SYSCTL_VRM 1301*/ -#define W83792D_SYSCTL_PWM_FLAG 1400 -#define W83792D_SYSCTL_PWM1 1401 -#define W83792D_SYSCTL_PWM2 1402 -#define W83792D_SYSCTL_PWM3 1403 -#define W83792D_SYSCTL_FAN_CFG 1500 /* control Fan Mode */ -#define W83792D_SYSCTL_FAN_DIV 1501 -#define W83792D_SYSCTL_CHASSIS 1502 /* control Case Open */ -#define W83792D_SYSCTL_ALARMS 1503 - -#define W83792D_SYSCTL_THERMAL_CRUISE 1600 /* Smart Fan I: target value */ -#define W83792D_SYSCTL_FAN_TOLERANCE 1601 /* Smart Fan I/II: tolerance */ -#define W83792D_SYSCTL_SF2_POINTS_FAN1 1602 /* Smart Fan II: Fan1 points */ -#define W83792D_SYSCTL_SF2_POINTS_FAN2 1603 /* Smart Fan II: Fan2 points */ -#define W83792D_SYSCTL_SF2_POINTS_FAN3 1604 /* Smart Fan II: Fan3 points */ -#define W83792D_SYSCTL_SF2_LEVELS_FAN1 1605 /* Smart Fan II: Fan1 levels */ -#define W83792D_SYSCTL_SF2_LEVELS_FAN2 1606 /* Smart Fan II: Fan2 levels */ -#define W83792D_SYSCTL_SF2_LEVELS_FAN3 1607 /* Smart Fan II: Fan3 levels */ #define W83792D_ALARM_IN0 0x0001 #define W83792D_ALARM_IN1 0x0002 @@ -1569,20 +543,9 @@ #define W83792D_ALARM_FAN6 0x800000 #define W83792D_ALARM_FAN7 0x8000 -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define W83L785TS_SYSCTL_TEMP 1200 - -/* -- SENSORS SYSCTL END -- */ -/* -- SENSORS SYSCTL START -- */ - -#define XEONTEMP_SYSCTL_REMOTE_TEMP 1201 -#define XEONTEMP_SYSCTL_ALARMS 1203 #define XEONTEMP_ALARM_RTEMP_HIGH 0x10 #define XEONTEMP_ALARM_RTEMP_LOW 0x08 #define XEONTEMP_ALARM_RTEMP_NA 0x04 -/* -- SENSORS SYSCTL END -- */ #endif diff --git a/lib/chips.c b/lib/chips.c index b3b80667..18c53c09 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -26,278 +26,273 @@ /* For each chip, a list of features; For each feature, the number, its name, the logical mapping (for example, - fan1_div belongs to fan1), the compute mapping, an access field, the - SYSCTL id of the /proc field, the value location of the /proc field, + fan1_div belongs to fan1), the compute mapping, an access field, and the magnitude. The access field indicates whether resources are readable and writable. Sometimes, a resource is neither; in this case, it is just a catch-all category, for mappings. - The value location is the byte-offset where this value can be found in - the sysctl buffer. The magnitude is the 10-power through which the read value must be divided. */ -#define VALUE(x) (x-1) * sizeof(long) #define NOMAP SENSORS_NO_MAPPING #define R SENSORS_MODE_R #define RW SENSORS_MODE_RW -#define NOSYSCTL 0 static sensors_chip_feature lm78_features[] = { { { SENSORS_LM78_IN0, "in0", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78_IN1, "in1", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78_IN2, "in2", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78_IN3, "in3", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78_IN4, "in4", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78_IN5, "in5", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78_IN6, "in6", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78_IN0_MIN, "in0_min", SENSORS_LM78_IN0, SENSORS_LM78_IN0, RW }, - LM78_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78_IN1_MIN, "in1_min", SENSORS_LM78_IN1, SENSORS_LM78_IN1, RW }, - LM78_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78_IN2_MIN, "in2_min", SENSORS_LM78_IN2, SENSORS_LM78_IN2, RW }, - LM78_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78_IN3_MIN, "in3_min", SENSORS_LM78_IN3, SENSORS_LM78_IN3, RW }, - LM78_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78_IN4_MIN, "in4_min", SENSORS_LM78_IN4, SENSORS_LM78_IN4, RW }, - LM78_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, /* swap 5 and 6 min/max because compute lines will be inverting */ { { SENSORS_LM78_IN5_MIN, "in5_min", SENSORS_LM78_IN5, SENSORS_LM78_IN5, RW }, - LM78_SYSCTL_IN5, VALUE(2), 2, "in5_max", 3 }, + 2, "in5_max", 3 }, { { SENSORS_LM78_IN6_MIN, "in6_min", SENSORS_LM78_IN6, SENSORS_LM78_IN6, RW }, - LM78_SYSCTL_IN6, VALUE(2), 2, "in6_max", 3 }, + 2, "in6_max", 3 }, { { SENSORS_LM78_IN0_MAX, "in0_max", SENSORS_LM78_IN0, SENSORS_LM78_IN0, RW }, - LM78_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78_IN1_MAX, "in1_max", SENSORS_LM78_IN1, SENSORS_LM78_IN1, RW }, - LM78_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78_IN2_MAX, "in2_max", SENSORS_LM78_IN2, SENSORS_LM78_IN2, RW }, - LM78_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78_IN3_MAX, "in3_max", SENSORS_LM78_IN3, SENSORS_LM78_IN3, RW }, - LM78_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78_IN4_MAX, "in4_max", SENSORS_LM78_IN4, SENSORS_LM78_IN4, RW }, - LM78_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78_IN5_MAX, "in5_max", SENSORS_LM78_IN5, SENSORS_LM78_IN5, RW }, - LM78_SYSCTL_IN5, VALUE(1), 2, "in5_min", 3 }, + 2, "in5_min", 3 }, { { SENSORS_LM78_IN6_MAX, "in6_max", SENSORS_LM78_IN6, SENSORS_LM78_IN6, RW }, - LM78_SYSCTL_IN6, VALUE(1), 2, "in6_min", 3 }, + 2, "in6_min", 3 }, { { SENSORS_LM78_FAN1, "fan1", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_LM78_FAN2, "fan2", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_LM78_FAN3, "fan3", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_LM78_FAN1_MIN, "fan1_min", SENSORS_LM78_FAN1, SENSORS_LM78_FAN1, RW }, - LM78_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM78_FAN2_MIN, "fan2_min", SENSORS_LM78_FAN2, SENSORS_LM78_FAN2, RW }, - LM78_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM78_FAN3_MIN, "fan3_min", SENSORS_LM78_FAN3, SENSORS_LM78_FAN3, RW }, - LM78_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_LM78_TEMP, "temp", NOMAP, NOMAP, R }, - LM78_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_LM78_TEMP_HYST, "temp_hyst", SENSORS_LM78_TEMP, SENSORS_LM78_TEMP, RW }, - LM78_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_LM78_TEMP_OVER, "temp_over", SENSORS_LM78_TEMP, SENSORS_LM78_TEMP, RW }, - LM78_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_LM78_VID, "vid", NOMAP, NOMAP, R }, - LM78_SYSCTL_VID, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78_FAN1_DIV, "fan1_div", SENSORS_LM78_FAN1, NOMAP, RW }, - LM78_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_LM78_FAN2_DIV, "fan2_div", SENSORS_LM78_FAN2, NOMAP, RW }, - LM78_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_LM78_FAN3_DIV, "fan3_div", SENSORS_LM78_FAN3, NOMAP, R }, - LM78_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_LM78_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM78_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature lm78j_features[] = { { { SENSORS_LM78J_IN0, "in0", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78J_IN1, "in1", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78J_IN2, "in2", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78J_IN3, "in3", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78J_IN4, "in4", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78J_IN5, "in5", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78J_IN6, "in6", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_LM78J_IN0_MIN, "in0_min", SENSORS_LM78J_IN0, SENSORS_LM78J_IN0, RW }, - LM78_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78J_IN1_MIN, "in1_min", SENSORS_LM78J_IN1, SENSORS_LM78J_IN1, RW }, - LM78_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78J_IN2_MIN, "in2_min", SENSORS_LM78J_IN2, SENSORS_LM78J_IN2, RW }, - LM78_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78J_IN3_MIN, "in3_min", SENSORS_LM78J_IN3, SENSORS_LM78J_IN3, RW }, - LM78_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78J_IN4_MIN, "in4_min", SENSORS_LM78J_IN4, SENSORS_LM78J_IN4, RW }, - LM78_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, /* swap 5 and 6 min/max because compute lines will be inverting */ { { SENSORS_LM78J_IN5_MIN, "in5_min", SENSORS_LM78J_IN5, SENSORS_LM78J_IN5, RW }, - LM78_SYSCTL_IN5, VALUE(2), 2, "in5_max", 3 }, + 2, "in5_max", 3 }, { { SENSORS_LM78J_IN6_MIN, "in6_min", SENSORS_LM78J_IN6, SENSORS_LM78J_IN6, RW }, - LM78_SYSCTL_IN6, VALUE(2), 2, "in6_max", 3 }, + 2, "in6_max", 3 }, { { SENSORS_LM78J_IN0_MAX, "in0_max", SENSORS_LM78J_IN0, SENSORS_LM78J_IN0, RW }, - LM78_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78J_IN1_MAX, "in1_max", SENSORS_LM78J_IN1, SENSORS_LM78J_IN1, RW }, - LM78_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78J_IN2_MAX, "in2_max", SENSORS_LM78J_IN2, SENSORS_LM78J_IN2, RW }, - LM78_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78J_IN3_MAX, "in3_max", SENSORS_LM78J_IN3, SENSORS_LM78J_IN3, RW }, - LM78_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78J_IN4_MAX, "in4_max", SENSORS_LM78J_IN4, SENSORS_LM78J_IN4, RW }, - LM78_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_LM78J_IN5_MAX, "in5_max", SENSORS_LM78J_IN5, SENSORS_LM78J_IN5, RW }, - LM78_SYSCTL_IN5, VALUE(1), 2, "in5_min", 3 }, + 2, "in5_min", 3 }, { { SENSORS_LM78J_IN6_MAX, "in6_max", SENSORS_LM78J_IN6, SENSORS_LM78J_IN6, RW }, - LM78_SYSCTL_IN6, VALUE(1), 2, "in6_min", 3 }, + 2, "in6_min", 3 }, { { SENSORS_LM78J_FAN1, "fan1", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_LM78J_FAN2, "fan2", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_LM78J_FAN3, "fan3", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_LM78J_FAN1_MIN, "fan1_min", SENSORS_LM78J_FAN1, SENSORS_LM78J_FAN1, RW }, - LM78_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM78J_FAN2_MIN, "fan2_min", SENSORS_LM78J_FAN2, SENSORS_LM78J_FAN2, RW }, - LM78_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM78J_FAN3_MIN, "fan3_min", SENSORS_LM78J_FAN3, SENSORS_LM78J_FAN3, RW }, - LM78_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_LM78J_TEMP, "temp", NOMAP, NOMAP, R }, - LM78_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_LM78J_TEMP_HYST, "temp_hyst", SENSORS_LM78J_TEMP, SENSORS_LM78J_TEMP, RW }, - LM78_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_LM78J_TEMP_OVER, "temp_over", SENSORS_LM78J_TEMP, SENSORS_LM78J_TEMP, RW }, - LM78_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_LM78J_VID, "vid", NOMAP, NOMAP, R }, - LM78_SYSCTL_VID, VALUE(1), 2 }, + 2 }, { { SENSORS_LM78J_FAN1_DIV, "fan1_div", SENSORS_LM78J_FAN1, NOMAP, RW }, - LM78_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_LM78J_FAN2_DIV, "fan2_div", SENSORS_LM78J_FAN2, NOMAP, RW }, - LM78_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_LM78J_FAN3_DIV, "fan3_div", SENSORS_LM78J_FAN3, NOMAP, R }, - LM78_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_LM78J_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM78_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature lm79_features[] = { { { SENSORS_LM79_IN0, "in0", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_LM79_IN1, "in1", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_LM79_IN2, "in2", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_LM79_IN3, "in3", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_LM79_IN4, "in4", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_LM79_IN5, "in5", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_LM79_IN6, "in6", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_LM79_IN0_MIN, "in0_min", SENSORS_LM79_IN0, SENSORS_LM79_IN0, RW }, - LM78_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_LM79_IN1_MIN, "in1_min", SENSORS_LM79_IN1, SENSORS_LM79_IN1, RW }, - LM78_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_LM79_IN2_MIN, "in2_min", SENSORS_LM79_IN2, SENSORS_LM79_IN2, RW }, - LM78_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_LM79_IN3_MIN, "in3_min", SENSORS_LM79_IN3, SENSORS_LM79_IN3, RW }, - LM78_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_LM79_IN4_MIN, "in4_min", SENSORS_LM79_IN4, SENSORS_LM79_IN4, RW }, - LM78_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, /* swap 5 and 6 min/max because compute lines will be inverting */ { { SENSORS_LM79_IN5_MIN, "in5_min", SENSORS_LM79_IN5, SENSORS_LM79_IN5, RW }, - LM78_SYSCTL_IN5, VALUE(2), 2, "in5_max", 3 }, + 2, "in5_max", 3 }, { { SENSORS_LM79_IN6_MIN, "in6_min", SENSORS_LM79_IN6, SENSORS_LM79_IN6, RW }, - LM78_SYSCTL_IN6, VALUE(2), 2, "in6_max", 3 }, + 2, "in6_max", 3 }, { { SENSORS_LM79_IN0_MAX, "in0_max", SENSORS_LM79_IN0, SENSORS_LM79_IN0, RW }, - LM78_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_LM79_IN1_MAX, "in1_max", SENSORS_LM79_IN1, SENSORS_LM79_IN1, RW }, - LM78_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_LM79_IN2_MAX, "in2_max", SENSORS_LM79_IN2, SENSORS_LM79_IN2, RW }, - LM78_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_LM79_IN3_MAX, "in3_max", SENSORS_LM79_IN3, SENSORS_LM79_IN3, RW }, - LM78_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_LM79_IN4_MAX, "in4_max", SENSORS_LM79_IN4, SENSORS_LM79_IN4, RW }, - LM78_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_LM79_IN5_MAX, "in5_max", SENSORS_LM79_IN5, SENSORS_LM79_IN5, RW }, - LM78_SYSCTL_IN5, VALUE(1), 2, "in5_min", 3 }, + 2, "in5_min", 3 }, { { SENSORS_LM79_IN6_MAX, "in6_max", SENSORS_LM79_IN6, SENSORS_LM79_IN6, RW }, - LM78_SYSCTL_IN6, VALUE(1), 2, "in6_min", 3 }, + 2, "in6_min", 3 }, { { SENSORS_LM79_FAN1, "fan1", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_LM79_FAN2, "fan2", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_LM79_FAN3, "fan3", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_LM79_FAN1_MIN, "fan1_min", SENSORS_LM79_FAN1, SENSORS_LM79_FAN1, RW }, - LM78_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM79_FAN2_MIN, "fan2_min", SENSORS_LM79_FAN2, SENSORS_LM79_FAN2, RW }, - LM78_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM79_FAN3_MIN, "fan3_min", SENSORS_LM79_FAN3, SENSORS_LM79_FAN3, RW }, - LM78_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_LM79_TEMP, "temp", NOMAP, NOMAP, R }, - LM78_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_LM79_TEMP_HYST, "temp_hyst", SENSORS_LM79_TEMP, SENSORS_LM79_TEMP, RW }, - LM78_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_LM79_TEMP_OVER, "temp_over", SENSORS_LM79_TEMP, SENSORS_LM79_TEMP, RW }, - LM78_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_LM79_VID, "vid", NOMAP, NOMAP, R }, - LM78_SYSCTL_VID, VALUE(1), 2 }, + 2 }, { { SENSORS_LM79_FAN1_DIV, "fan1_div", SENSORS_LM79_FAN1, NOMAP, RW }, - LM78_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_LM79_FAN2_DIV, "fan2_div", SENSORS_LM79_FAN2, NOMAP, RW }, - LM78_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_LM79_FAN3_DIV, "fan3_div", SENSORS_LM79_FAN3, NOMAP, R }, - LM78_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_LM79_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM78_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; @@ -305,69 +300,69 @@ static sensors_chip_feature lm79_features[] = static sensors_chip_feature lm75_features[] = { { { SENSORS_LM75_TEMP, "temp", NOMAP, NOMAP, R }, - LM75_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_LM75_TEMP_HYST, "temp_hyst", SENSORS_LM75_TEMP, SENSORS_LM75_TEMP, RW }, - LM75_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_LM75_TEMP_OVER, "temp_over", SENSORS_LM75_TEMP, SENSORS_LM75_TEMP, RW }, - LM75_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { 0 }, 0 } }; static sensors_chip_feature adm1021_features[] = { { { SENSORS_ADM1021_TEMP, "temp", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_ADM1021_TEMP_HYST, "temp_low", SENSORS_ADM1021_TEMP, SENSORS_ADM1021_TEMP, RW }, - ADM1021_SYSCTL_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1021_TEMP_OVER, "temp_over", SENSORS_ADM1021_TEMP, SENSORS_ADM1021_TEMP, RW }, - ADM1021_SYSCTL_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1021_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_ADM1021_REMOTE_TEMP_HYST, "remote_temp_low", SENSORS_ADM1021_REMOTE_TEMP, SENSORS_ADM1021_REMOTE_TEMP, RW }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(2), + 0 }, { { SENSORS_ADM1021_REMOTE_TEMP_OVER, "remote_temp_over", SENSORS_ADM1021_REMOTE_TEMP, SENSORS_ADM1021_REMOTE_TEMP, RW }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(1), + 0 }, { { SENSORS_ADM1021_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1021_DIE_CODE, "die_code", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_DIE_CODE, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature adm1023_features[] = { { { SENSORS_ADM1021_TEMP, "temp", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_ADM1021_TEMP_HYST, "temp_low", SENSORS_ADM1021_TEMP, SENSORS_ADM1021_TEMP, RW }, - ADM1021_SYSCTL_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1021_TEMP_OVER, "temp_over", SENSORS_ADM1021_TEMP, SENSORS_ADM1021_TEMP, RW }, - ADM1021_SYSCTL_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1021_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(4), 3 }, + 3 }, { { SENSORS_ADM1021_REMOTE_TEMP_HYST, "remote_temp_low", SENSORS_ADM1021_REMOTE_TEMP, SENSORS_ADM1021_REMOTE_TEMP, RW }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(2), + 3 }, { { SENSORS_ADM1021_REMOTE_TEMP_OVER, "remote_temp_over", SENSORS_ADM1021_REMOTE_TEMP, SENSORS_ADM1021_REMOTE_TEMP, RW }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(1), + 3 }, { { SENSORS_ADM1021_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; @@ -375,49 +370,49 @@ static sensors_chip_feature adm1023_features[] = static sensors_chip_feature adm1029_features[] = { { { SENSORS_ADM1029_TEMP1, "temp1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1029_TEMP1_MAX, "temp1_max", SENSORS_ADM1029_TEMP1, SENSORS_ADM1029_TEMP1, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1029_TEMP1_MIN, "temp1_min", SENSORS_ADM1029_TEMP1, SENSORS_ADM1029_TEMP1, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1029_TEMP2, "temp2", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1029_TEMP2_MAX, "temp2_max", SENSORS_ADM1029_TEMP2, SENSORS_ADM1029_TEMP2, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1029_TEMP2_MIN, "temp2_min", SENSORS_ADM1029_TEMP2, SENSORS_ADM1029_TEMP2, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1029_TEMP3, "temp3", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1029_TEMP3_MAX, "temp3_max", SENSORS_ADM1029_TEMP3, SENSORS_ADM1029_TEMP3, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1029_TEMP3_MIN, "temp3_min", SENSORS_ADM1029_TEMP3, SENSORS_ADM1029_TEMP3, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1029_FAN1, "fan1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1029_FAN1_MIN, "fan1_min", SENSORS_ADM1029_FAN1, SENSORS_ADM1029_FAN1, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1029_FAN1_DIV, "fan1_div", SENSORS_ADM1029_FAN1, NOMAP, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1029_FAN2, "fan2", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1029_FAN2_MIN, "fan2_min", SENSORS_ADM1029_FAN2, SENSORS_ADM1029_FAN2, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1029_FAN2_DIV, "fan2_div", SENSORS_ADM1029_FAN2, NOMAP, RW }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { 0 }, 0 } }; @@ -425,39 +420,39 @@ static sensors_chip_feature adm1029_features[] = static sensors_chip_feature adm1030_features[] = { { { SENSORS_ADM1031_TEMP1, "temp1", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_TEMP1, VALUE(4), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP1_MAX, "temp1_max", SENSORS_ADM1031_TEMP1, SENSORS_ADM1031_TEMP1, RW }, - ADM1031_SYSCTL_TEMP1, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP1_MIN, "temp1_min", SENSORS_ADM1031_TEMP1, SENSORS_ADM1031_TEMP1, RW }, - ADM1031_SYSCTL_TEMP1, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP1_CRIT, "temp1_crit", SENSORS_ADM1031_TEMP1, SENSORS_ADM1031_TEMP1, RW }, - ADM1031_SYSCTL_TEMP1, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP2, "temp2", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_TEMP2, VALUE(4), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP2_MAX, "temp2_max", SENSORS_ADM1031_TEMP2, SENSORS_ADM1031_TEMP2, RW }, - ADM1031_SYSCTL_TEMP2, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP2_MIN, "temp2_min", SENSORS_ADM1031_TEMP2, SENSORS_ADM1031_TEMP2, RW }, - ADM1031_SYSCTL_TEMP2, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP2_CRIT, "temp2_crit", SENSORS_ADM1031_TEMP2, SENSORS_ADM1031_TEMP2, RW }, - ADM1031_SYSCTL_TEMP2, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1031_FAN1, "fan1", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1031_FAN1_MIN, "fan1_min", SENSORS_ADM1031_FAN1, SENSORS_ADM1031_FAN1, RW }, - ADM1031_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1031_FAN1_DIV, "fan1_div", SENSORS_ADM1031_FAN1, NOMAP, RW }, - ADM1031_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1031_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; @@ -465,355 +460,355 @@ static sensors_chip_feature adm1030_features[] = static sensors_chip_feature adm1031_features[] = { { { SENSORS_ADM1031_TEMP1, "temp1", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_TEMP1, VALUE(4), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP1_MAX, "temp1_max", SENSORS_ADM1031_TEMP1, SENSORS_ADM1031_TEMP1, RW }, - ADM1031_SYSCTL_TEMP1, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP1_MIN, "temp1_min", SENSORS_ADM1031_TEMP1, SENSORS_ADM1031_TEMP1, RW }, - ADM1031_SYSCTL_TEMP1, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP1_CRIT, "temp1_crit", SENSORS_ADM1031_TEMP1, SENSORS_ADM1031_TEMP1, RW }, - ADM1031_SYSCTL_TEMP1, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP2, "temp2", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_TEMP2, VALUE(4), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP2_MAX, "temp2_max", SENSORS_ADM1031_TEMP2, SENSORS_ADM1031_TEMP2, RW }, - ADM1031_SYSCTL_TEMP2, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP2_MIN, "temp2_min", SENSORS_ADM1031_TEMP2, SENSORS_ADM1031_TEMP2, RW }, - ADM1031_SYSCTL_TEMP2, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP2_CRIT, "temp2_crit", SENSORS_ADM1031_TEMP2, SENSORS_ADM1031_TEMP2, RW }, - ADM1031_SYSCTL_TEMP2, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP3, "temp3", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_TEMP3, VALUE(4), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP3_MAX, "temp3_max", SENSORS_ADM1031_TEMP3, SENSORS_ADM1031_TEMP3, RW }, - ADM1031_SYSCTL_TEMP3, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP3_MIN, "temp3_min", SENSORS_ADM1031_TEMP3, SENSORS_ADM1031_TEMP3, RW }, - ADM1031_SYSCTL_TEMP3, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1031_TEMP3_CRIT, "temp3_crit", SENSORS_ADM1031_TEMP3, SENSORS_ADM1031_TEMP3, RW }, - ADM1031_SYSCTL_TEMP3, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1031_FAN1, "fan1", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1031_FAN1_MIN, "fan1_min", SENSORS_ADM1031_FAN1, SENSORS_ADM1031_FAN1, RW }, - ADM1031_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1031_FAN1_DIV, "fan1_div", SENSORS_ADM1031_FAN1, NOMAP, RW }, - ADM1031_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1031_FAN2, "fan2", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1031_FAN2_MIN, "fan2_min", SENSORS_ADM1031_FAN2, SENSORS_ADM1031_FAN2, RW }, - ADM1031_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1031_FAN2_DIV, "fan2_div", SENSORS_ADM1031_FAN2, NOMAP, RW }, - ADM1031_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1031_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM1031_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature max1617_features[] = { { { SENSORS_MAX1617_TEMP, "temp", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_MAX1617_TEMP_HYST, "temp_low", SENSORS_MAX1617_TEMP, SENSORS_MAX1617_TEMP, RW }, - ADM1021_SYSCTL_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_MAX1617_TEMP_OVER, "temp_over", SENSORS_MAX1617_TEMP, SENSORS_MAX1617_TEMP, RW }, - ADM1021_SYSCTL_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_MAX1617_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_MAX1617_REMOTE_TEMP_HYST, "remote_temp_low", SENSORS_MAX1617_REMOTE_TEMP, SENSORS_MAX1617_REMOTE_TEMP, RW }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(2), + 0 }, { { SENSORS_MAX1617_REMOTE_TEMP_OVER, "remote_temp_over", SENSORS_MAX1617_REMOTE_TEMP, SENSORS_MAX1617_REMOTE_TEMP, RW }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(1), + 0 }, { { SENSORS_MAX1617_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature max1617a_features[] = { { { SENSORS_MAX1617A_TEMP, "temp", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_MAX1617A_TEMP_HYST, "temp_low", SENSORS_MAX1617A_TEMP, SENSORS_MAX1617A_TEMP, RW }, - ADM1021_SYSCTL_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_MAX1617A_TEMP_OVER, "temp_over", SENSORS_MAX1617A_TEMP, SENSORS_MAX1617A_TEMP, RW }, - ADM1021_SYSCTL_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_MAX1617A_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_MAX1617A_REMOTE_TEMP_HYST, "remote_temp_low", SENSORS_MAX1617A_REMOTE_TEMP, SENSORS_MAX1617A_REMOTE_TEMP, RW }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(2), + 0 }, { { SENSORS_MAX1617A_REMOTE_TEMP_OVER, "remote_temp_over", SENSORS_MAX1617A_REMOTE_TEMP, SENSORS_MAX1617A_REMOTE_TEMP, RW }, - ADM1021_SYSCTL_REMOTE_TEMP, VALUE(1), + 0 }, { { SENSORS_MAX1617A_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM1021_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature gl518_features[] = { { { SENSORS_GL518_VDD, "vdd", NOMAP, NOMAP, R }, - GL518_SYSCTL_VDD, VALUE(3), 2, "in0_input", 3 }, + 2, "in0_input", 3 }, { { SENSORS_GL518_VIN1, "vin1", NOMAP, NOMAP, R }, - GL518_SYSCTL_VIN1, VALUE(3), 2 }, + 2 }, { { SENSORS_GL518_VIN2, "vin2", NOMAP, NOMAP, R }, - GL518_SYSCTL_VIN2, VALUE(3), 2 }, + 2 }, { { SENSORS_GL518_VIN3, "vin3", NOMAP, NOMAP, R }, - GL518_SYSCTL_VIN3, VALUE(3), 2 }, + 2 }, { { SENSORS_GL518_VDD_MIN, "vdd_min", SENSORS_GL518_VDD, SENSORS_GL518_VDD, RW }, - GL518_SYSCTL_VDD, VALUE(1), 2 , "in0_min", 3 }, + 2 , "in0_min", 3 }, { { SENSORS_GL518_VIN1_MIN, "vin1_min", SENSORS_GL518_VIN1, SENSORS_GL518_VIN1, RW }, - GL518_SYSCTL_VIN1, VALUE(1), 2 }, + 2 }, { { SENSORS_GL518_VIN2_MIN, "vin2_min", SENSORS_GL518_VIN2, SENSORS_GL518_VIN2, RW }, - GL518_SYSCTL_VIN2, VALUE(1), 2 }, + 2 }, { { SENSORS_GL518_VIN3_MIN, "vin3_min", SENSORS_GL518_VIN3, SENSORS_GL518_VIN3, RW }, - GL518_SYSCTL_VIN3, VALUE(1), 2 }, + 2 }, { { SENSORS_GL518_VDD_MAX, "vdd_max", SENSORS_GL518_VDD, SENSORS_GL518_VDD, RW }, - GL518_SYSCTL_VDD, VALUE(2), 2 , "in0_max", 3 }, + 2 , "in0_max", 3 }, { { SENSORS_GL518_VIN1_MAX, "vin1_max", SENSORS_GL518_VIN1, SENSORS_GL518_VIN1, RW }, - GL518_SYSCTL_VIN1, VALUE(2), 2 }, + 2 }, { { SENSORS_GL518_VIN2_MAX, "vin2_max", SENSORS_GL518_VIN2, SENSORS_GL518_VIN2, RW }, - GL518_SYSCTL_VIN2, VALUE(2), 2 }, + 2 }, { { SENSORS_GL518_VIN3_MAX, "vin3_max", SENSORS_GL518_VIN3, SENSORS_GL518_VIN3, RW }, - GL518_SYSCTL_VIN3, VALUE(2), 2 }, + 2 }, { { SENSORS_GL518_FAN1, "fan1", NOMAP, NOMAP, R }, - GL518_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_GL518_FAN2, "fan2", NOMAP, NOMAP, R }, - GL518_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_GL518_FAN1_MIN, "fan1_min", SENSORS_GL518_FAN1, SENSORS_GL518_FAN1, RW }, - GL518_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_GL518_FAN2_MIN, "fan2_min", SENSORS_GL518_FAN2, SENSORS_GL518_FAN2, RW }, - GL518_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_GL518_TEMP, "temp", NOMAP, NOMAP, R }, - GL518_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_GL518_TEMP_HYST, "temp_hyst", SENSORS_GL518_TEMP, SENSORS_GL518_TEMP, RW }, - GL518_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_GL518_TEMP_OVER, "temp_over", SENSORS_GL518_TEMP, SENSORS_GL518_TEMP, RW }, - GL518_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_GL518_FAN1_DIV, "fan1_div", SENSORS_GL518_FAN1, NOMAP, RW }, - GL518_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_GL518_FAN2_DIV, "fan2_div", SENSORS_GL518_FAN2, NOMAP, RW }, - GL518_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_GL518_ALARMS, "alarms", NOMAP, NOMAP, R }, - GL518_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_GL518_BEEP_ENABLE, "beep_enable", SENSORS_GL518_ALARMS, NOMAP, RW }, - GL518_SYSCTL_BEEP, VALUE(1), 0 }, + 0 }, { { SENSORS_GL518_BEEPS, "beeps", SENSORS_GL518_ALARMS, SENSORS_GL518_ALARMS, RW }, - GL518_SYSCTL_BEEP, VALUE(2), 0 }, + 0 }, { { SENSORS_GL518_FAN1OFF, "fan1_off", SENSORS_GL518_FAN1, NOMAP, RW }, - GL518_SYSCTL_FAN1OFF, VALUE(1), 0, "fan1_auto", + 0, "fan1_auto", 0 }, { { SENSORS_GL518_FAN1PIN, "fan1_off_pin", SENSORS_GL518_FAN1OFF, NOMAP, RW }, - GL518_SYSCTL_FAN1OFF, VALUE(2), 0 }, + 0 }, { { SENSORS_GL518_ITERATE, "iterate", NOMAP, NOMAP, RW }, - GL518_SYSCTL_ITERATE, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature gl520_features[] = { { { SENSORS_GL520_VDD, "vdd", NOMAP, NOMAP, R }, - GL520_SYSCTL_VDD, VALUE(3), 2, "in0_input", 3 }, + 2, "in0_input", 3 }, { { SENSORS_GL520_VIN1, "vin1", NOMAP, NOMAP, R }, - GL520_SYSCTL_VIN1, VALUE(3), 2 }, + 2 }, { { SENSORS_GL520_VIN2, "vin2", NOMAP, NOMAP, R }, - GL520_SYSCTL_VIN2, VALUE(3), 2 }, + 2 }, { { SENSORS_GL520_VIN3, "vin3", NOMAP, NOMAP, R }, - GL520_SYSCTL_VIN3, VALUE(3), 2 }, + 2 }, { { SENSORS_GL520_VIN4, "vin4", NOMAP, NOMAP, R }, - GL520_SYSCTL_VIN4, VALUE(3), 2 }, + 2 }, { { SENSORS_GL520_VDD_MIN, "vdd_min", SENSORS_GL520_VDD, SENSORS_GL520_VDD, RW }, - GL520_SYSCTL_VDD, VALUE(1), 2, "in0_min", 3 }, + 2, "in0_min", 3 }, { { SENSORS_GL520_VIN1_MIN, "vin1_min", SENSORS_GL520_VIN1, SENSORS_GL520_VIN1, RW }, - GL520_SYSCTL_VIN1, VALUE(1), 2 }, + 2 }, { { SENSORS_GL520_VIN2_MIN, "vin2_min", SENSORS_GL520_VIN2, SENSORS_GL520_VIN2, RW }, - GL520_SYSCTL_VIN2, VALUE(1), 2 }, + 2 }, { { SENSORS_GL520_VIN3_MIN, "vin3_min", SENSORS_GL520_VIN3, SENSORS_GL520_VIN3, RW }, - GL520_SYSCTL_VIN3, VALUE(1), 2 }, + 2 }, { { SENSORS_GL520_VIN4_MIN, "vin4_min", SENSORS_GL520_VIN4, SENSORS_GL520_VIN4, RW }, - GL520_SYSCTL_VIN4, VALUE(1), 2 }, + 2 }, { { SENSORS_GL520_VDD_MAX, "vdd_max", SENSORS_GL520_VDD, SENSORS_GL520_VDD, RW }, - GL520_SYSCTL_VDD, VALUE(2), 2, "in0_max", 3 }, + 2, "in0_max", 3 }, { { SENSORS_GL520_VIN1_MAX, "vin1_max", SENSORS_GL520_VIN1, SENSORS_GL520_VIN1, RW }, - GL520_SYSCTL_VIN1, VALUE(2), 2 }, + 2 }, { { SENSORS_GL520_VIN2_MAX, "vin2_max", SENSORS_GL520_VIN2, SENSORS_GL520_VIN2, RW }, - GL520_SYSCTL_VIN2, VALUE(2), 2 }, + 2 }, { { SENSORS_GL520_VIN3_MAX, "vin3_max", SENSORS_GL520_VIN3, SENSORS_GL520_VIN3, RW }, - GL520_SYSCTL_VIN3, VALUE(2), 2 }, + 2 }, { { SENSORS_GL520_VIN4_MAX, "vin4_max", SENSORS_GL520_VIN4, SENSORS_GL520_VIN4, RW }, - GL520_SYSCTL_VIN4, VALUE(2), 2 }, + 2 }, { { SENSORS_GL520_FAN1, "fan1", NOMAP, NOMAP, R }, - GL520_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_GL520_FAN2, "fan2", NOMAP, NOMAP, R }, - GL520_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_GL520_FAN1_MIN, "fan1_min", SENSORS_GL520_FAN1, SENSORS_GL520_FAN1, RW }, - GL520_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_GL520_FAN2_MIN, "fan2_min", SENSORS_GL520_FAN2, SENSORS_GL520_FAN2, RW }, - GL520_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_GL520_TEMP1, "temp1", NOMAP, NOMAP, R }, - GL520_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_GL520_TEMP1_HYST, "temp1_hyst", SENSORS_GL520_TEMP1, SENSORS_GL520_TEMP1, RW }, - GL520_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_GL520_TEMP1_OVER, "temp1_over", SENSORS_GL520_TEMP1, SENSORS_GL520_TEMP1, RW }, - GL520_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_GL520_TEMP2, "temp2", NOMAP, NOMAP, R }, - GL520_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_GL520_TEMP2_HYST, "temp2_hyst", SENSORS_GL520_TEMP2, SENSORS_GL520_TEMP2, RW }, - GL520_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_GL520_TEMP2_OVER, "temp2_over", SENSORS_GL520_TEMP2, SENSORS_GL520_TEMP2, RW }, - GL520_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_GL520_VID, "vid", NOMAP, NOMAP, R }, - GL520_SYSCTL_VID, VALUE(1), 2 }, + 2 }, { { SENSORS_GL520_FAN1_DIV, "fan1_div", SENSORS_GL520_FAN1, NOMAP, RW }, - GL520_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_GL520_FAN2_DIV, "fan2_div", SENSORS_GL520_FAN2, NOMAP, RW }, - GL520_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_GL520_ALARMS, "alarms", NOMAP, NOMAP, R }, - GL520_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_GL520_BEEP_ENABLE, "beep_enable", SENSORS_GL520_ALARMS, NOMAP, RW }, - GL520_SYSCTL_BEEP, VALUE(1), 0 }, + 0 }, { { SENSORS_GL520_BEEPS, "beeps", SENSORS_GL520_ALARMS, SENSORS_GL520_ALARMS, RW }, - GL520_SYSCTL_BEEP, VALUE(2), 0 }, + 0 }, { { SENSORS_GL520_FAN1OFF, "fan1_off", SENSORS_GL520_FAN1, NOMAP, RW }, - GL520_SYSCTL_FAN1OFF, VALUE(1), 0 }, + 0 }, { { SENSORS_GL520_TWOTEMPS, "two_temps", NOMAP, NOMAP, RW }, - GL520_SYSCTL_CONFIG, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature lm80_features[] = { { { SENSORS_LM80_IN0, "in0", NOMAP, NOMAP, R }, - LM80_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_LM80_IN1, "in1", NOMAP, NOMAP, R }, - LM80_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_LM80_IN2, "in2", NOMAP, NOMAP, R }, - LM80_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_LM80_IN3, "in3", NOMAP, NOMAP, R }, - LM80_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_LM80_IN4, "in4", NOMAP, NOMAP, R }, - LM80_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_LM80_IN5, "in5", NOMAP, NOMAP, R }, - LM80_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_LM80_IN6, "in6", NOMAP, NOMAP, R }, - LM80_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_LM80_IN0_MIN, "in0_min", SENSORS_LM80_IN0, SENSORS_LM80_IN0, RW }, - LM80_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_LM80_IN1_MIN, "in1_min", SENSORS_LM80_IN1, SENSORS_LM80_IN1, RW }, - LM80_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_LM80_IN2_MIN, "in2_min", SENSORS_LM80_IN2, SENSORS_LM80_IN2, RW }, - LM80_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_LM80_IN3_MIN, "in3_min", SENSORS_LM80_IN3, SENSORS_LM80_IN3, RW }, - LM80_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_LM80_IN4_MIN, "in4_min", SENSORS_LM80_IN4, SENSORS_LM80_IN4, RW }, - LM80_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_LM80_IN5_MIN, "in5_min", SENSORS_LM80_IN5, SENSORS_LM80_IN5, RW }, - LM80_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_LM80_IN6_MIN, "in6_min", SENSORS_LM80_IN6, SENSORS_LM80_IN6, RW }, - LM80_SYSCTL_IN6, VALUE(1), 2 }, + 2 }, { { SENSORS_LM80_IN0_MAX, "in0_max", SENSORS_LM80_IN0, SENSORS_LM80_IN0, RW }, - LM80_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_LM80_IN1_MAX, "in1_max", SENSORS_LM80_IN1, SENSORS_LM80_IN1, RW }, - LM80_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_LM80_IN2_MAX, "in2_max", SENSORS_LM80_IN2, SENSORS_LM80_IN2, RW }, - LM80_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_LM80_IN3_MAX, "in3_max", SENSORS_LM80_IN3, SENSORS_LM80_IN3, RW }, - LM80_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_LM80_IN4_MAX, "in4_max", SENSORS_LM80_IN4, SENSORS_LM80_IN4, RW }, - LM80_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_LM80_IN5_MAX, "in5_max", SENSORS_LM80_IN5, SENSORS_LM80_IN5, RW }, - LM80_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_LM80_IN6_MAX, "in6_max", SENSORS_LM80_IN6, SENSORS_LM80_IN6, RW }, - LM80_SYSCTL_IN6, VALUE(2), 2 }, + 2 }, { { SENSORS_LM80_FAN1, "fan1", NOMAP, NOMAP, R }, - LM80_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_LM80_FAN2, "fan2", NOMAP, NOMAP, R }, - LM80_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_LM80_FAN1_MIN, "fan1_min", SENSORS_LM80_FAN1, NOMAP, RW }, - LM80_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM80_FAN2_MIN, "fan2_min", SENSORS_LM80_FAN2, NOMAP, RW }, - LM80_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM80_TEMP, "temp", NOMAP, NOMAP, R }, - LM80_SYSCTL_TEMP, VALUE(5), 2 }, + 2 }, { { SENSORS_LM80_TEMP_HOT_HYST, "temp_hot_hyst", SENSORS_LM80_TEMP, SENSORS_LM80_TEMP, RW }, - LM80_SYSCTL_TEMP, VALUE(2), 2, + 2, "temp1_max_hyst", 3 }, { { SENSORS_LM80_TEMP_HOT_MAX, "temp_hot_max", SENSORS_LM80_TEMP, SENSORS_LM80_TEMP, RW }, - LM80_SYSCTL_TEMP, VALUE(1), 2, "temp1_max", + 2, "temp1_max", 3 }, { { SENSORS_LM80_TEMP_OS_HYST, "temp_os_hyst", SENSORS_LM80_TEMP, SENSORS_LM80_TEMP, RW }, - LM80_SYSCTL_TEMP, VALUE(4), 2, + 2, "temp1_crit_hyst", 3 }, { { SENSORS_LM80_TEMP_OS_MAX, "temp_os_max", SENSORS_LM80_TEMP, SENSORS_LM80_TEMP, RW }, - LM80_SYSCTL_TEMP, VALUE(3), 2, "temp1_crit", + 2, "temp1_crit", 3 }, { { SENSORS_LM80_FAN1_DIV, "fan1_div", SENSORS_LM80_FAN1, NOMAP, RW }, - LM80_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_LM80_FAN2_DIV, "fan2_div", SENSORS_LM80_FAN2, NOMAP, RW }, - LM80_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_LM80_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM80_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; @@ -821,30 +816,30 @@ static sensors_chip_feature lm80_features[] = static sensors_chip_feature lm83_features[] = { { { SENSORS_LM83_LOCAL_TEMP, "temp1", NOMAP, NOMAP, R }, - LM83_SYSCTL_LOCAL_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_LM83_LOCAL_HIGH, "temp1_high", SENSORS_LM83_LOCAL_TEMP, SENSORS_LM83_LOCAL_TEMP, RW }, - LM83_SYSCTL_LOCAL_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_LM83_REMOTE1_TEMP, "temp2", NOMAP, NOMAP, R }, - LM83_SYSCTL_REMOTE1_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_LM83_REMOTE1_HIGH, "temp2_high", SENSORS_LM83_REMOTE1_TEMP, SENSORS_LM83_REMOTE1_TEMP, RW }, - LM83_SYSCTL_REMOTE1_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_LM83_REMOTE2_TEMP, "temp3", NOMAP, NOMAP, R }, - LM83_SYSCTL_REMOTE2_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_LM83_REMOTE2_HIGH, "temp3_high", SENSORS_LM83_REMOTE2_TEMP, SENSORS_LM83_REMOTE2_TEMP, RW }, - LM83_SYSCTL_REMOTE2_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_LM83_REMOTE3_TEMP, "temp4", NOMAP, NOMAP, R }, - LM83_SYSCTL_REMOTE3_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_LM83_REMOTE3_HIGH, "temp4_high", SENSORS_LM83_REMOTE3_TEMP, SENSORS_LM83_REMOTE3_TEMP, RW }, - LM83_SYSCTL_REMOTE3_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_LM83_TCRIT, "tcrit", NOMAP, NOMAP, RW }, - LM83_SYSCTL_TCRIT, VALUE(1), 0, "temp3_crit", 3, + 0, "temp3_crit", 3, "temp_crit" }, { { SENSORS_LM83_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM83_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; @@ -852,39 +847,39 @@ static sensors_chip_feature lm83_features[] = static sensors_chip_feature lm90_features[] = { { { SENSORS_LM90_LOCAL_TEMP, "temp1", NOMAP, NOMAP, R }, - LM90_SYSCTL_LOCAL_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_LM90_LOCAL_HIGH, "temp1_high", SENSORS_LM90_LOCAL_TEMP, SENSORS_LM90_LOCAL_TEMP, RW }, - LM90_SYSCTL_LOCAL_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_LM90_LOCAL_LOW, "temp1_low", SENSORS_LM90_LOCAL_TEMP, SENSORS_LM90_LOCAL_TEMP, RW }, - LM90_SYSCTL_LOCAL_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_LM90_REMOTE_TEMP, "temp2", NOMAP, NOMAP, R }, - LM90_SYSCTL_REMOTE_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_LM90_REMOTE_HIGH, "temp2_high", SENSORS_LM90_REMOTE_TEMP, SENSORS_LM90_REMOTE_TEMP, RW }, - LM90_SYSCTL_REMOTE_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_LM90_REMOTE_LOW, "temp2_low", SENSORS_LM90_REMOTE_TEMP, SENSORS_LM90_REMOTE_TEMP, RW }, - LM90_SYSCTL_REMOTE_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_LM90_LOCAL_TCRIT, "tcrit1", SENSORS_LM90_LOCAL_TEMP, SENSORS_LM90_LOCAL_TEMP, RW }, - LM90_SYSCTL_LOCAL_TCRIT, VALUE(1), 0, + 0, "temp1_crit", 3 }, { { SENSORS_LM90_REMOTE_TCRIT, "tcrit2", SENSORS_LM90_REMOTE_TEMP, SENSORS_LM90_REMOTE_TEMP, RW }, - LM90_SYSCTL_REMOTE_TCRIT, VALUE(1), 0, + 0, "temp2_crit", 3 }, { { SENSORS_LM90_LOCAL_TCRIT_HYST, "hyst1", SENSORS_LM90_LOCAL_TEMP, SENSORS_LM90_LOCAL_TEMP, RW }, - LM90_SYSCTL_LOCAL_HYST, VALUE(1), 0, + 0, "temp1_crit_hyst", 3 }, { { SENSORS_LM90_REMOTE_TCRIT_HYST, "hyst2", SENSORS_LM90_REMOTE_TEMP, SENSORS_LM90_REMOTE_TEMP, R }, - LM90_SYSCTL_REMOTE_HYST, VALUE(1), 0, + 0, "temp2_crit_hyst", 3 }, { { SENSORS_LM90_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM90_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; @@ -892,36 +887,36 @@ static sensors_chip_feature lm90_features[] = static sensors_chip_feature lm63_features[] = { { { SENSORS_LM63_LOCAL_TEMP, "temp1", NOMAP, NOMAP, R }, - LM63_SYSCTL_TEMP1, VALUE(2), 0 }, + 0 }, { { SENSORS_LM63_LOCAL_HIGH, "temp1_high", SENSORS_LM63_LOCAL_TEMP, SENSORS_LM63_LOCAL_TEMP, RW }, - LM63_SYSCTL_TEMP1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM63_REMOTE_TEMP, "temp2", NOMAP, NOMAP, R }, - LM63_SYSCTL_TEMP2, VALUE(3), 3 }, + 3 }, { { SENSORS_LM63_REMOTE_HIGH, "temp2_high", SENSORS_LM63_REMOTE_TEMP, SENSORS_LM63_REMOTE_TEMP, RW }, - LM63_SYSCTL_TEMP2, VALUE(1), 3 }, + 3 }, { { SENSORS_LM63_REMOTE_LOW, "temp2_low", SENSORS_LM63_REMOTE_TEMP, SENSORS_LM63_REMOTE_TEMP, RW }, - LM63_SYSCTL_TEMP2, VALUE(2), 3 }, + 3 }, { { SENSORS_LM63_REMOTE_TCRIT, "temp2_crit", SENSORS_LM63_REMOTE_TEMP, SENSORS_LM63_REMOTE_TEMP, R }, - LM63_SYSCTL_TEMP2_TCRIT, VALUE(1), 0 }, + 0 }, { { SENSORS_LM63_REMOTE_TCRIT_HYST, "temp2_crit_hyst", SENSORS_LM63_REMOTE_TEMP, SENSORS_LM63_REMOTE_TEMP, RW }, - LM63_SYSCTL_TEMP2_TCRIT_HYST, VALUE(1), + 0, "temp2_crit_hyst", 3 }, { { SENSORS_LM63_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM63_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_LM63_FAN_LOW, "fan1_min", SENSORS_LM63_FAN, SENSORS_LM63_FAN, RW }, - LM63_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM63_FAN, "fan1", NOMAP, NOMAP, R }, - LM63_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_LM63_PWM, "pwm1", NOMAP, NOMAP, RW }, - LM63_SYSCTL_PWM1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM63_PWM_ENABLE, "pwm1_enable", SENSORS_LM63_PWM, NOMAP, RW }, - LM63_SYSCTL_PWM1, VALUE(2), 0 }, + 0 }, { { 0 }, 0 } }; @@ -929,276 +924,267 @@ static sensors_chip_feature lm63_features[] = static sensors_chip_feature w83781d_features[] = { { { SENSORS_W83781D_IN0, "in0", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_W83781D_IN1, "in1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_W83781D_IN2, "in2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_W83781D_IN3, "in3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_W83781D_IN4, "in4", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_W83781D_IN5, "in5", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_W83781D_IN6, "in6", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_W83781D_IN0_MIN, "in0_min", SENSORS_W83781D_IN0, SENSORS_W83781D_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_W83781D_IN1_MIN, "in1_min", SENSORS_W83781D_IN1, SENSORS_W83781D_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_W83781D_IN2_MIN, "in2_min", SENSORS_W83781D_IN2, SENSORS_W83781D_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_W83781D_IN3_MIN, "in3_min", SENSORS_W83781D_IN3, SENSORS_W83781D_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_W83781D_IN4_MIN, "in4_min", SENSORS_W83781D_IN4, SENSORS_W83781D_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, /* swap 5 and 6 min/max because compute lines will be inverting */ { { SENSORS_W83781D_IN5_MIN, "in5_min", SENSORS_W83781D_IN5, SENSORS_W83781D_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(2), 2, "in5_max", 3 }, + 2, "in5_max", 3 }, { { SENSORS_W83781D_IN6_MIN, "in6_min", SENSORS_W83781D_IN6, SENSORS_W83781D_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(2), 2, "in6_max", 3 }, + 2, "in6_max", 3 }, { { SENSORS_W83781D_IN0_MAX, "in0_max", SENSORS_W83781D_IN0, SENSORS_W83781D_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_W83781D_IN1_MAX, "in1_max", SENSORS_W83781D_IN1, SENSORS_W83781D_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_W83781D_IN2_MAX, "in2_max", SENSORS_W83781D_IN2, SENSORS_W83781D_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_W83781D_IN3_MAX, "in3_max", SENSORS_W83781D_IN3, SENSORS_W83781D_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_W83781D_IN4_MAX, "in4_max", SENSORS_W83781D_IN4, SENSORS_W83781D_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_W83781D_IN5_MAX, "in5_max", SENSORS_W83781D_IN5, SENSORS_W83781D_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(1), 2, "in5_min", 3 }, + 2, "in5_min", 3 }, { { SENSORS_W83781D_IN6_MAX, "in6_max", SENSORS_W83781D_IN6, SENSORS_W83781D_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(1), 2, "in6_min", 3 }, + 2, "in6_min", 3 }, { { SENSORS_W83781D_FAN1, "fan1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_W83781D_FAN2, "fan2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_W83781D_FAN3, "fan3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_W83781D_FAN1_MIN, "fan1_min", SENSORS_W83781D_FAN1, SENSORS_W83781D_FAN1, RW }, - W83781D_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_W83781D_FAN2_MIN, "fan2_min", SENSORS_W83781D_FAN2, SENSORS_W83781D_FAN2, RW }, - W83781D_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_W83781D_FAN3_MIN, "fan3_min", SENSORS_W83781D_FAN3, SENSORS_W83781D_FAN3, RW }, - W83781D_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_W83781D_TEMP1, "temp1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_W83781D_TEMP1_HYST, "temp1_hyst", SENSORS_W83781D_TEMP1, SENSORS_W83781D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_W83781D_TEMP1_OVER, "temp1_over", SENSORS_W83781D_TEMP1, SENSORS_W83781D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_W83781D_TEMP2, "temp2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_W83781D_TEMP2_HYST, "temp2_hyst", SENSORS_W83781D_TEMP2, SENSORS_W83781D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_W83781D_TEMP2_OVER, "temp2_over", SENSORS_W83781D_TEMP2, SENSORS_W83781D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_W83781D_TEMP3, "temp3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_W83781D_TEMP3_HYST, "temp3_hyst", SENSORS_W83781D_TEMP3, SENSORS_W83781D_TEMP3, RW }, - W83781D_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_W83781D_TEMP3_OVER, "temp3_over", SENSORS_W83781D_TEMP3, SENSORS_W83781D_TEMP3, RW }, - W83781D_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_W83781D_VID, "vid", NOMAP, NOMAP, R }, - W83781D_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_W83781D_VRM, "vrm", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_W83781D_FAN1_DIV, "fan1_div", SENSORS_W83781D_FAN1, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_W83781D_FAN2_DIV, "fan2_div", SENSORS_W83781D_FAN2, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_W83781D_FAN3_DIV, "fan3_div", SENSORS_W83781D_FAN3, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_W83781D_ALARMS, "alarms", NOMAP, NOMAP, R }, - W83781D_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_W83781D_BEEP_ENABLE, "beep_enable", SENSORS_W83781D_ALARMS, NOMAP, RW }, - W83781D_SYSCTL_BEEP, VALUE(1), 0 }, + 0 }, { { SENSORS_W83781D_BEEPS, "beeps", SENSORS_W83781D_ALARMS, SENSORS_W83781D_ALARMS, RW }, - W83781D_SYSCTL_BEEP, VALUE(2), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature as99127f_features[] = { { { SENSORS_W83782D_IN0, "in0", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN1, "in1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN2, "in2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN3, "in3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN4, "in4", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN5, "in5", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN6, "in6", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN0_MIN, "in0_min", SENSORS_W83782D_IN0, SENSORS_W83782D_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN1_MIN, "in1_min", SENSORS_W83782D_IN1, SENSORS_W83782D_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN2_MIN, "in2_min", SENSORS_W83782D_IN2, SENSORS_W83782D_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN3_MIN, "in3_min", SENSORS_W83782D_IN3, SENSORS_W83782D_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN4_MIN, "in4_min", SENSORS_W83782D_IN4, SENSORS_W83782D_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, /* swap 5 and 6 min/max because compute lines will be inverting */ { { SENSORS_W83782D_IN5_MIN, "in5_min", SENSORS_W83782D_IN5, SENSORS_W83782D_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(2), 2, "in5_max", 3 }, + 2, "in5_max", 3 }, { { SENSORS_W83782D_IN6_MIN, "in6_min", SENSORS_W83782D_IN6, SENSORS_W83782D_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(2), 2, "in6_max", 3 }, + 2, "in6_max", 3 }, { { SENSORS_W83782D_IN0_MAX, "in0_max", SENSORS_W83782D_IN0, SENSORS_W83782D_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN1_MAX, "in1_max", SENSORS_W83782D_IN1, SENSORS_W83782D_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN2_MAX, "in2_max", SENSORS_W83782D_IN2, SENSORS_W83782D_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN3_MAX, "in3_max", SENSORS_W83782D_IN3, SENSORS_W83782D_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN4_MAX, "in4_max", SENSORS_W83782D_IN4, SENSORS_W83782D_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN5_MAX, "in5_max", SENSORS_W83782D_IN5, SENSORS_W83782D_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(1), 2, "in5_min", 3 }, + 2, "in5_min", 3 }, { { SENSORS_W83782D_IN6_MAX, "in6_max", SENSORS_W83782D_IN6, SENSORS_W83782D_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(1), 2, "in6_min", 3 }, + 2, "in6_min", 3 }, { { SENSORS_W83782D_FAN1, "fan1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_W83782D_FAN2, "fan2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_W83781D_FAN3, "fan3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_W83782D_FAN1_MIN, "fan1_min", SENSORS_W83782D_FAN1, SENSORS_W83782D_FAN1, RW }, - W83781D_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_FAN2_MIN, "fan2_min", SENSORS_W83782D_FAN2, SENSORS_W83782D_FAN2, RW }, - W83781D_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_W83781D_FAN3_MIN, "fan3_min", SENSORS_W83781D_FAN3, SENSORS_W83782D_FAN3, RW }, - W83781D_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_TEMP1, "temp1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_W83782D_TEMP1_HYST, "temp1_hyst", SENSORS_W83782D_TEMP1, SENSORS_W83782D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_W83782D_TEMP1_OVER, "temp1_over", SENSORS_W83782D_TEMP1, SENSORS_W83782D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_W83782D_TEMP2, "temp2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_W83782D_TEMP2_HYST, "temp2_hyst", SENSORS_W83782D_TEMP2, SENSORS_W83782D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_W83782D_TEMP2_OVER, "temp2_over", SENSORS_W83782D_TEMP2, SENSORS_W83782D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_W83782D_TEMP3, "temp3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_W83782D_TEMP3_HYST, "temp3_hyst", SENSORS_W83782D_TEMP3, SENSORS_W83782D_TEMP3, RW }, - W83781D_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_W83782D_TEMP3_OVER, "temp3_over", SENSORS_W83782D_TEMP3, SENSORS_W83782D_TEMP3, RW }, - W83781D_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_W83782D_VID, "vid", NOMAP, NOMAP, R }, - W83781D_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_W83782D_VRM, "vrm", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_W83782D_FAN1_DIV, "fan1_div", SENSORS_W83782D_FAN1, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_FAN2_DIV, "fan2_div", SENSORS_W83782D_FAN2, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_W83782D_FAN3_DIV, "fan3_div", SENSORS_W83781D_FAN3, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_W83782D_ALARMS, "alarms", NOMAP, NOMAP, R }, - W83781D_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_BEEP_ENABLE, "beep_enable", SENSORS_W83782D_ALARMS, NOMAP, RW }, - W83781D_SYSCTL_BEEP, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_BEEPS, "beeps", SENSORS_W83782D_ALARMS, SENSORS_W83782D_ALARMS, RW }, - W83781D_SYSCTL_BEEP, VALUE(2), 0 }, + 0 }, { { 0 }, 0 } }; /* macro for LM93 voltage in/min/max entries */ #define SENSORS_LM93_IN_MIN_MAX(nr) \ { { SENSORS_LM93_IN##nr, "in" #nr, NOMAP, \ - NOMAP, R }, \ - LM93_SYSCTL_IN##nr, VALUE(3), 2}, \ + NOMAP, R }, 2}, \ { { SENSORS_LM93_IN##nr##_MIN, "in" #nr "_min", SENSORS_LM93_IN##nr, \ - SENSORS_LM93_IN##nr, RW }, \ - LM93_SYSCTL_IN##nr, VALUE(1), 2 }, \ + SENSORS_LM93_IN##nr, RW }, 2 }, \ { { SENSORS_LM93_IN##nr##_MAX, "in" #nr "_max", SENSORS_LM93_IN##nr, \ - SENSORS_LM93_IN##nr, RW }, \ - LM93_SYSCTL_IN##nr, VALUE(2), 2 } + SENSORS_LM93_IN##nr, RW }, 2 } /* macro for LM93 fan/min entries */ #define SENSORS_LM93_FAN_MIN(nr) \ - { { SENSORS_LM93_FAN##nr, "fan" #nr, NOMAP, NOMAP, R }, \ - LM93_SYSCTL_FAN##nr, VALUE(2), 0 }, \ + { { SENSORS_LM93_FAN##nr, "fan" #nr, NOMAP, NOMAP, R }, 0 }, \ { { SENSORS_LM93_FAN##nr##_MIN, "fan" #nr "_min", \ - SENSORS_LM93_FAN##nr, SENSORS_LM93_FAN##nr, RW }, \ - LM93_SYSCTL_FAN##nr, VALUE(1), 0 } + SENSORS_LM93_FAN##nr, SENSORS_LM93_FAN##nr, RW }, 0 } /* macro for LM93 temp/min/max entries */ #define SENSORS_LM93_TEMP_MIN_MAX(nr) \ - { { SENSORS_LM93_TEMP##nr, "temp" #nr, NOMAP, NOMAP, R }, \ - LM93_SYSCTL_TEMP##nr, VALUE(3), 1 }, \ + { { SENSORS_LM93_TEMP##nr, "temp" #nr, NOMAP, NOMAP, R }, 1 }, \ { { SENSORS_LM93_TEMP##nr##_MAX, "temp" #nr "_max", \ - SENSORS_LM93_TEMP##nr, SENSORS_LM93_TEMP##nr, RW }, \ - LM93_SYSCTL_TEMP##nr, VALUE(1), 1 }, \ + SENSORS_LM93_TEMP##nr, SENSORS_LM93_TEMP##nr, RW }, 1 }, \ { { SENSORS_LM93_TEMP##nr##_MIN, "temp" #nr "_min", \ - SENSORS_LM93_TEMP##nr, SENSORS_LM93_TEMP##nr, RW }, \ - LM93_SYSCTL_TEMP##nr, VALUE(2), 1 } + SENSORS_LM93_TEMP##nr, SENSORS_LM93_TEMP##nr, RW }, 1 } /* macro for LM93 VID entries */ #define SENSORS_LM93_VID(nr) \ - { { SENSORS_LM93_VID##nr, "vid" #nr, NOMAP, NOMAP, R }, \ - LM93_SYSCTL_VID##nr, VALUE(1), 3 } + { { SENSORS_LM93_VID##nr, "vid" #nr, NOMAP, NOMAP, R }, 3 } static sensors_chip_feature lm93_features[] = { SENSORS_LM93_IN_MIN_MAX(1), @@ -1227,45 +1213,35 @@ static sensors_chip_feature lm93_features[] = { SENSORS_LM93_VID(1), SENSORS_LM93_VID(2), { { SENSORS_LM93_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM93_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; /* macro for ASB100 Bach voltage in/min/max entries */ #define SENSORS_ASB100_IN_MIN_MAX(nr) \ - { { SENSORS_ASB100_IN##nr, "in" #nr, NOMAP, NOMAP, R }, \ - ASB100_SYSCTL_IN##nr, \ - VALUE(3), 2 }, \ + { { SENSORS_ASB100_IN##nr, "in" #nr, NOMAP, NOMAP, R }, 2 }, \ { { SENSORS_ASB100_IN##nr##_MIN, "in" #nr "_min", SENSORS_ASB100_IN##nr, \ - SENSORS_ASB100_IN##nr, RW }, \ - ASB100_SYSCTL_IN##nr, VALUE(1), 2 }, \ + SENSORS_ASB100_IN##nr, RW }, 2 }, \ { { SENSORS_ASB100_IN##nr##_MAX, "in" #nr "_max", SENSORS_ASB100_IN##nr, \ - SENSORS_ASB100_IN##nr, RW }, \ - ASB100_SYSCTL_IN##nr, VALUE(2), 2 } + SENSORS_ASB100_IN##nr, RW }, 2 } /* macro for ASB100 Bach fan/min/div entries */ #define SENSORS_ASB100_FAN_MIN_DIV(nr, divmode) \ { { SENSORS_ASB100_FAN##nr, "fan" #nr, NOMAP, \ - NOMAP, R}, \ - ASB100_SYSCTL_FAN##nr, VALUE(2), 0 }, \ + NOMAP, R}, 0 }, \ { { SENSORS_ASB100_FAN##nr##_MIN, "fan" #nr "_min", \ - SENSORS_ASB100_FAN##nr, SENSORS_ASB100_FAN##nr, RW }, \ - ASB100_SYSCTL_FAN##nr, VALUE(1), 0 }, \ + SENSORS_ASB100_FAN##nr, SENSORS_ASB100_FAN##nr, RW }, 0 }, \ { { SENSORS_ASB100_FAN##nr##_DIV, "fan" #nr "_div", \ - SENSORS_ASB100_FAN##nr, NOMAP, divmode }, \ - ASB100_SYSCTL_FAN_DIV, VALUE(nr), 0 } + SENSORS_ASB100_FAN##nr, NOMAP, divmode }, 0 } /* macro for ASB100 Bach temperature/overtemp/hysteresis entries */ #define SENSORS_ASB100_TEMP_OVER_HYST(nr) \ { { SENSORS_ASB100_TEMP##nr, "temp" #nr, NOMAP, \ - NOMAP, R }, \ - ASB100_SYSCTL_TEMP##nr, VALUE(3), 1 }, \ + NOMAP, R }, 1 }, \ { { SENSORS_ASB100_TEMP##nr##_OVER, "temp" #nr "_over", \ - SENSORS_ASB100_TEMP##nr, SENSORS_ASB100_TEMP##nr, RW }, \ - ASB100_SYSCTL_TEMP##nr, VALUE(1), 1 }, \ + SENSORS_ASB100_TEMP##nr, SENSORS_ASB100_TEMP##nr, RW }, 1 }, \ { { SENSORS_ASB100_TEMP##nr##_HYST, "temp" #nr "_hyst", \ - SENSORS_ASB100_TEMP##nr, SENSORS_ASB100_TEMP##nr, RW }, \ - ASB100_SYSCTL_TEMP##nr, VALUE(2), 1 } + SENSORS_ASB100_TEMP##nr, SENSORS_ASB100_TEMP##nr, RW }, 1 } static sensors_chip_feature asb100_features[] = { SENSORS_ASB100_IN_MIN_MAX(0), @@ -1283,421 +1259,421 @@ static sensors_chip_feature asb100_features[] = { SENSORS_ASB100_TEMP_OVER_HYST(3), SENSORS_ASB100_TEMP_OVER_HYST(4), { { SENSORS_ASB100_VID, "vid", NOMAP, NOMAP, R }, - ASB100_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_ASB100_VRM, "vrm", NOMAP, NOMAP, RW }, - ASB100_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_ASB100_ALARMS, "alarms", NOMAP, NOMAP, R }, - ASB100_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature w83782d_features[] = { { { SENSORS_W83782D_IN0, "in0", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN1, "in1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN2, "in2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN3, "in3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN4, "in4", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN5, "in5", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN6, "in6", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN7, "in7", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN7, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN8, "in8", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN8, VALUE(3), 2 }, + 2 }, { { SENSORS_W83782D_IN0_MIN, "in0_min", SENSORS_W83782D_IN0, SENSORS_W83782D_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN1_MIN, "in1_min", SENSORS_W83782D_IN1, SENSORS_W83782D_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN2_MIN, "in2_min", SENSORS_W83782D_IN2, SENSORS_W83782D_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN3_MIN, "in3_min", SENSORS_W83782D_IN3, SENSORS_W83782D_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN4_MIN, "in4_min", SENSORS_W83782D_IN4, SENSORS_W83782D_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN5_MIN, "in5_min", SENSORS_W83782D_IN5, SENSORS_W83782D_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN6_MIN, "in6_min", SENSORS_W83782D_IN6, SENSORS_W83782D_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN7_MIN, "in7_min", SENSORS_W83782D_IN7, SENSORS_W83782D_IN7, RW }, - W83781D_SYSCTL_IN7, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN8_MIN, "in8_min", SENSORS_W83782D_IN8, SENSORS_W83782D_IN8, RW }, - W83781D_SYSCTL_IN8, VALUE(1), 2 }, + 2 }, { { SENSORS_W83782D_IN0_MAX, "in0_max", SENSORS_W83782D_IN0, SENSORS_W83782D_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN1_MAX, "in1_max", SENSORS_W83782D_IN1, SENSORS_W83782D_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN2_MAX, "in2_max", SENSORS_W83782D_IN2, SENSORS_W83782D_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN3_MAX, "in3_max", SENSORS_W83782D_IN3, SENSORS_W83782D_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN4_MAX, "in4_max", SENSORS_W83782D_IN4, SENSORS_W83782D_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN5_MAX, "in5_max", SENSORS_W83782D_IN5, SENSORS_W83782D_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN6_MAX, "in6_max", SENSORS_W83782D_IN6, SENSORS_W83782D_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN7_MAX, "in7_max", SENSORS_W83782D_IN7, SENSORS_W83782D_IN7, RW }, - W83781D_SYSCTL_IN7, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_IN8_MAX, "in8_max", SENSORS_W83782D_IN8, SENSORS_W83782D_IN8, RW }, - W83781D_SYSCTL_IN8, VALUE(2), 2 }, + 2 }, { { SENSORS_W83782D_FAN1, "fan1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_W83782D_FAN2, "fan2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_W83781D_FAN3, "fan3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_W83782D_FAN1_MIN, "fan1_min", SENSORS_W83782D_FAN1, SENSORS_W83782D_FAN1, RW }, - W83781D_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_FAN2_MIN, "fan2_min", SENSORS_W83782D_FAN2, SENSORS_W83782D_FAN2, RW }, - W83781D_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_W83781D_FAN3_MIN, "fan3_min", SENSORS_W83781D_FAN3, SENSORS_W83782D_FAN3, RW }, - W83781D_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_TEMP1, "temp1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_W83782D_TEMP1_HYST, "temp1_hyst", SENSORS_W83782D_TEMP1, SENSORS_W83782D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_W83782D_TEMP1_OVER, "temp1_over", SENSORS_W83782D_TEMP1, SENSORS_W83782D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_W83782D_TEMP2, "temp2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_W83782D_TEMP2_HYST, "temp2_hyst", SENSORS_W83782D_TEMP2, SENSORS_W83782D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_W83782D_TEMP2_OVER, "temp2_over", SENSORS_W83782D_TEMP2, SENSORS_W83782D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_W83782D_TEMP3, "temp3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_W83782D_TEMP3_HYST, "temp3_hyst", SENSORS_W83782D_TEMP3, SENSORS_W83782D_TEMP3, RW }, - W83781D_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_W83782D_TEMP3_OVER, "temp3_over", SENSORS_W83782D_TEMP3, SENSORS_W83782D_TEMP3, RW }, - W83781D_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_W83782D_VID, "vid", NOMAP, NOMAP, R }, - W83781D_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_W83782D_VRM, "vrm", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_W83782D_FAN1_DIV, "fan1_div", SENSORS_W83782D_FAN1, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_FAN2_DIV, "fan2_div", SENSORS_W83782D_FAN2, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_W83782D_FAN3_DIV, "fan3_div", SENSORS_W83781D_FAN3, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_W83782D_ALARMS, "alarms", NOMAP, NOMAP, R }, - W83781D_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_BEEP_ENABLE, "beep_enable", SENSORS_W83782D_ALARMS, NOMAP, RW }, - W83781D_SYSCTL_BEEP, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_BEEPS, "beeps", SENSORS_W83782D_ALARMS, SENSORS_W83782D_ALARMS, RW }, - W83781D_SYSCTL_BEEP, VALUE(2), 0 }, + 0 }, { { SENSORS_W83782D_SENS1, "sensor1", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_SENS1, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_SENS2, "sensor2", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_SENS2, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_SENS3, "sensor3", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_SENS3, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature w83783s_features[] = { { { SENSORS_W83783S_IN0, "in0", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_W83783S_IN1, "in1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_W83783S_IN2, "in2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_W83783S_IN3, "in3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_W83783S_IN4, "in4", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_W83783S_IN5, "in5", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_W83783S_IN6, "in6", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_W83783S_IN0_MIN, "in0_min", SENSORS_W83783S_IN0, SENSORS_W83783S_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_W83783S_IN1_MIN, "in1_min", SENSORS_W83783S_IN1, SENSORS_W83783S_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_W83783S_IN2_MIN, "in2_min", SENSORS_W83783S_IN2, SENSORS_W83783S_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_W83783S_IN3_MIN, "in3_min", SENSORS_W83783S_IN3, SENSORS_W83783S_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_W83783S_IN4_MIN, "in4_min", SENSORS_W83783S_IN4, SENSORS_W83783S_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_W83783S_IN5_MIN, "in5_min", SENSORS_W83783S_IN5, SENSORS_W83783S_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_W83783S_IN6_MIN, "in6_min", SENSORS_W83783S_IN6, SENSORS_W83783S_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(1), 2 }, + 2 }, { { SENSORS_W83783S_IN0_MAX, "in0_max", SENSORS_W83783S_IN0, SENSORS_W83783S_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_W83783S_IN1_MAX, "in1_max", SENSORS_W83783S_IN1, SENSORS_W83783S_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_W83783S_IN2_MAX, "in2_max", SENSORS_W83783S_IN2, SENSORS_W83783S_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_W83783S_IN3_MAX, "in3_max", SENSORS_W83783S_IN3, SENSORS_W83783S_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_W83783S_IN4_MAX, "in4_max", SENSORS_W83783S_IN4, SENSORS_W83783S_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_W83783S_IN5_MAX, "in5_max", SENSORS_W83783S_IN5, SENSORS_W83783S_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_W83783S_IN6_MAX, "in6_max", SENSORS_W83783S_IN6, SENSORS_W83783S_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(2), 2 }, + 2 }, { { SENSORS_W83783S_FAN1, "fan1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_W83783S_FAN2, "fan2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_W83783S_FAN3, "fan3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_W83783S_FAN1_MIN, "fan1_min", SENSORS_W83783S_FAN1, SENSORS_W83783S_FAN1, RW }, - W83781D_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_W83783S_FAN2_MIN, "fan2_min", SENSORS_W83783S_FAN2, SENSORS_W83783S_FAN2, RW }, - W83781D_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_W83783S_FAN3_MIN, "fan3_min", SENSORS_W83783S_FAN3, SENSORS_W83783S_FAN3, RW }, - W83781D_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_W83782D_TEMP1, "temp1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_W83782D_TEMP1_HYST, "temp1_hyst", SENSORS_W83782D_TEMP1, SENSORS_W83782D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_W83782D_TEMP1_OVER, "temp1_over", SENSORS_W83782D_TEMP1, SENSORS_W83782D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_W83782D_TEMP2, "temp2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_W83782D_TEMP2_HYST, "temp2_hyst", SENSORS_W83782D_TEMP2, SENSORS_W83782D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_W83782D_TEMP2_OVER, "temp2_over", SENSORS_W83782D_TEMP2, SENSORS_W83782D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_W83783S_VID, "vid", NOMAP, NOMAP, R }, - W83781D_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_W83783S_VRM, "vrm", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_W83783S_FAN1_DIV, "fan1_div", SENSORS_W83783S_FAN1, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_W83783S_FAN2_DIV, "fan2_div", SENSORS_W83783S_FAN2, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_W83783S_FAN3_DIV, "fan3_div", SENSORS_W83783S_FAN3, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_W83783S_ALARMS, "alarms", NOMAP, NOMAP, R }, - W83781D_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_W83783S_BEEP_ENABLE, "beep_enable", SENSORS_W83783S_ALARMS, NOMAP, RW }, - W83781D_SYSCTL_BEEP, VALUE(1), 0 }, + 0 }, { { SENSORS_W83783S_BEEPS, "beeps", SENSORS_W83783S_ALARMS, SENSORS_W83783S_ALARMS, RW }, - W83781D_SYSCTL_BEEP, VALUE(2), 0 }, + 0 }, { { SENSORS_W83783S_SENS1, "sensor1", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_SENS1, VALUE(1), 0 }, + 0 }, { { SENSORS_W83783S_SENS2, "sensor2", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_SENS2, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature w83791d_features[] = { { { SENSORS_W83791D_IN0, "in0", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN1, "in1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN2, "in2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN3, "in3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN4, "in4", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN5, "in5", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN6, "in6", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN7, "in7", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN7, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN8, "in8", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN8, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN9, "in9", NOMAP, NOMAP, R }, - W83781D_SYSCTL_IN9, VALUE(3), 2 }, + 2 }, { { SENSORS_W83791D_IN0_MIN, "in0_min", SENSORS_W83791D_IN0, SENSORS_W83791D_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN1_MIN, "in1_min", SENSORS_W83791D_IN1, SENSORS_W83791D_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN2_MIN, "in2_min", SENSORS_W83791D_IN2, SENSORS_W83791D_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN3_MIN, "in3_min", SENSORS_W83791D_IN3, SENSORS_W83791D_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN4_MIN, "in4_min", SENSORS_W83791D_IN4, SENSORS_W83791D_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN5_MIN, "in5_min", SENSORS_W83791D_IN5, SENSORS_W83791D_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN6_MIN, "in6_min", SENSORS_W83791D_IN6, SENSORS_W83791D_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN7_MIN, "in7_min", SENSORS_W83791D_IN7, SENSORS_W83791D_IN7, RW }, - W83781D_SYSCTL_IN7, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN8_MIN, "in8_min", SENSORS_W83791D_IN8, SENSORS_W83791D_IN8, RW }, - W83781D_SYSCTL_IN8, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN9_MIN, "in9_min", SENSORS_W83791D_IN9, SENSORS_W83791D_IN9, RW }, - W83781D_SYSCTL_IN9, VALUE(1), 2 }, + 2 }, { { SENSORS_W83791D_IN0_MAX, "in0_max", SENSORS_W83791D_IN0, SENSORS_W83791D_IN0, RW }, - W83781D_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_IN1_MAX, "in1_max", SENSORS_W83791D_IN1, SENSORS_W83791D_IN1, RW }, - W83781D_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_IN2_MAX, "in2_max", SENSORS_W83791D_IN2, SENSORS_W83791D_IN2, RW }, - W83781D_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_IN3_MAX, "in3_max", SENSORS_W83791D_IN3, SENSORS_W83791D_IN3, RW }, - W83781D_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_IN4_MAX, "in4_max", SENSORS_W83791D_IN4, SENSORS_W83791D_IN4, RW }, - W83781D_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_IN5_MAX, "in5_max", SENSORS_W83791D_IN5, SENSORS_W83791D_IN5, RW }, - W83781D_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_IN6_MAX, "in6_max", SENSORS_W83791D_IN6, SENSORS_W83791D_IN6, RW }, - W83781D_SYSCTL_IN6, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_IN7_MAX, "in7_max", SENSORS_W83791D_IN7, SENSORS_W83791D_IN7, RW }, - W83781D_SYSCTL_IN7, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_IN8_MAX, "in8_max", SENSORS_W83791D_IN8, SENSORS_W83791D_IN8, RW }, - W83781D_SYSCTL_IN8, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_IN9_MAX, "in9_max", SENSORS_W83791D_IN9, SENSORS_W83791D_IN9, RW }, - W83781D_SYSCTL_IN9, VALUE(2), 2 }, + 2 }, { { SENSORS_W83791D_FAN1, "fan1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_W83791D_FAN2, "fan2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_W83791D_FAN3, "fan3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_W83791D_FAN4, "fan4", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN4, VALUE(2), 0 }, + 0 }, { { SENSORS_W83791D_FAN5, "fan5", NOMAP, NOMAP, R }, - W83781D_SYSCTL_FAN5, VALUE(2), 0 }, + 0 }, { { SENSORS_W83791D_FAN1_MIN, "fan1_min", SENSORS_W83791D_FAN1, SENSORS_W83791D_FAN1, RW }, - W83781D_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_W83791D_FAN2_MIN, "fan2_min", SENSORS_W83791D_FAN2, SENSORS_W83791D_FAN2, RW }, - W83781D_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_W83791D_FAN3_MIN, "fan3_min", SENSORS_W83791D_FAN3, SENSORS_W83791D_FAN3, RW }, - W83781D_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_W83791D_FAN4_MIN, "fan4_min", SENSORS_W83791D_FAN4, SENSORS_W83791D_FAN4, RW }, - W83781D_SYSCTL_FAN4, VALUE(1), 0 }, + 0 }, { { SENSORS_W83791D_FAN5_MIN, "fan5_min", SENSORS_W83791D_FAN5, SENSORS_W83791D_FAN5, RW }, - W83781D_SYSCTL_FAN5, VALUE(1), 0 }, + 0 }, { { SENSORS_W83791D_TEMP1, "temp1", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_W83791D_TEMP1_HYST, "temp1_hyst", SENSORS_W83791D_TEMP1, SENSORS_W83791D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_W83791D_TEMP1_OVER, "temp1_over", SENSORS_W83791D_TEMP1, SENSORS_W83791D_TEMP1, RW }, - W83781D_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_W83791D_TEMP2, "temp2", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_W83791D_TEMP2_HYST, "temp2_hyst", SENSORS_W83791D_TEMP2, SENSORS_W83791D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_W83791D_TEMP2_OVER, "temp2_over", SENSORS_W83791D_TEMP2, SENSORS_W83791D_TEMP2, RW }, - W83781D_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_W83791D_TEMP3, "temp3", NOMAP, NOMAP, R }, - W83781D_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_W83791D_TEMP3_HYST, "temp3_hyst", SENSORS_W83791D_TEMP3, SENSORS_W83791D_TEMP3, RW }, - W83781D_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_W83791D_TEMP3_OVER, "temp3_over", SENSORS_W83791D_TEMP3, SENSORS_W83791D_TEMP3, RW }, - W83781D_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_W83791D_VID, "vid", NOMAP, NOMAP, R }, - W83781D_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_W83791D_VRM, "vrm", NOMAP, NOMAP, RW }, - W83781D_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_W83791D_FAN1_DIV, "fan1_div", SENSORS_W83791D_FAN1, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_W83791D_FAN2_DIV, "fan2_div", SENSORS_W83791D_FAN2, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_W83791D_FAN3_DIV, "fan3_div", SENSORS_W83781D_FAN3, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_W83791D_FAN4_DIV, "fan4_div", SENSORS_W83791D_FAN4, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(4), 0 }, + 0 }, { { SENSORS_W83791D_FAN5_DIV, "fan5_div", SENSORS_W83791D_FAN5, NOMAP, RW }, - W83781D_SYSCTL_FAN_DIV, VALUE(5), 0 }, + 0 }, { { SENSORS_W83791D_ALARMS, "alarms", NOMAP, NOMAP, R }, - W83781D_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_W83791D_BEEP_ENABLE, "beep_enable", SENSORS_W83791D_ALARMS, NOMAP, RW }, - W83781D_SYSCTL_BEEP, VALUE(1), 0 }, + 0 }, { { SENSORS_W83791D_BEEPS, "beeps", SENSORS_W83791D_ALARMS, SENSORS_W83791D_ALARMS, RW }, - W83781D_SYSCTL_BEEP, VALUE(2), 0 }, + 0 }, { { 0 }, 0 } }; @@ -1705,158 +1681,158 @@ static sensors_chip_feature w83791d_features[] = static sensors_chip_feature w83792d_features[] = { { { SENSORS_W83792D_IN0, "in0", NOMAP, NOMAP, R }, - W83792D_SYSCTL_IN0, VALUE(3), 3 }, + 3 }, { { SENSORS_W83792D_IN1, "in1", NOMAP, NOMAP, R }, - W83792D_SYSCTL_IN1, VALUE(3), 3 }, + 3 }, { { SENSORS_W83792D_IN2, "in2", NOMAP, NOMAP, R }, - W83792D_SYSCTL_IN2, VALUE(3), 3 }, + 3 }, { { SENSORS_W83792D_IN3, "in3", NOMAP, NOMAP, R }, - W83792D_SYSCTL_IN3, VALUE(3), 3 }, + 3 }, { { SENSORS_W83792D_IN4, "in4", NOMAP, NOMAP, R }, - W83792D_SYSCTL_IN4, VALUE(3), 3 }, + 3 }, { { SENSORS_W83792D_IN5, "in5", NOMAP, NOMAP, R }, - W83792D_SYSCTL_IN5, VALUE(3), 3 }, + 3 }, { { SENSORS_W83792D_IN6, "in6", NOMAP, NOMAP, R }, - W83792D_SYSCTL_IN6, VALUE(3), 3 }, + 3 }, { { SENSORS_W83792D_IN7, "in7", NOMAP, NOMAP, R }, - W83792D_SYSCTL_IN7, VALUE(3), 3 }, + 3 }, { { SENSORS_W83792D_IN8, "in8", NOMAP, NOMAP, R }, - W83792D_SYSCTL_IN8, VALUE(3), 3 }, + 3 }, { { SENSORS_W83792D_IN0_MIN, "in0_min", SENSORS_W83792D_IN0, SENSORS_W83792D_IN0, RW }, - W83792D_SYSCTL_IN0, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_IN1_MIN, "in1_min", SENSORS_W83792D_IN1, SENSORS_W83792D_IN1, RW }, - W83792D_SYSCTL_IN1, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_IN2_MIN, "in2_min", SENSORS_W83792D_IN2, SENSORS_W83792D_IN2, RW }, - W83792D_SYSCTL_IN2, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_IN3_MIN, "in3_min", SENSORS_W83792D_IN3, SENSORS_W83792D_IN3, RW }, - W83792D_SYSCTL_IN3, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_IN4_MIN, "in4_min", SENSORS_W83792D_IN4, SENSORS_W83792D_IN4, RW }, - W83792D_SYSCTL_IN4, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_IN5_MIN, "in5_min", SENSORS_W83792D_IN5, SENSORS_W83792D_IN5, RW }, - W83792D_SYSCTL_IN5, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_IN6_MIN, "in6_min", SENSORS_W83792D_IN6, SENSORS_W83792D_IN6, RW }, - W83792D_SYSCTL_IN6, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_IN7_MIN, "in7_min", SENSORS_W83792D_IN7, SENSORS_W83792D_IN7, RW }, - W83792D_SYSCTL_IN7, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_IN8_MIN, "in8_min", SENSORS_W83792D_IN8, SENSORS_W83792D_IN8, RW }, - W83792D_SYSCTL_IN8, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_IN0_MAX, "in0_max", SENSORS_W83792D_IN0, SENSORS_W83792D_IN0, RW }, - W83792D_SYSCTL_IN0, VALUE(2), 3 }, + 3 }, { { SENSORS_W83792D_IN1_MAX, "in1_max", SENSORS_W83792D_IN1, SENSORS_W83792D_IN1, RW }, - W83792D_SYSCTL_IN1, VALUE(2), 3 }, + 3 }, { { SENSORS_W83792D_IN2_MAX, "in2_max", SENSORS_W83792D_IN2, SENSORS_W83792D_IN2, RW }, - W83792D_SYSCTL_IN2, VALUE(2), 3 }, + 3 }, { { SENSORS_W83792D_IN3_MAX, "in3_max", SENSORS_W83792D_IN3, SENSORS_W83792D_IN3, RW }, - W83792D_SYSCTL_IN3, VALUE(2), 3 }, + 3 }, { { SENSORS_W83792D_IN4_MAX, "in4_max", SENSORS_W83792D_IN4, SENSORS_W83792D_IN4, RW }, - W83792D_SYSCTL_IN4, VALUE(2), 3 }, + 3 }, { { SENSORS_W83792D_IN5_MAX, "in5_max", SENSORS_W83792D_IN5, SENSORS_W83792D_IN5, RW }, - W83792D_SYSCTL_IN5, VALUE(2), 3 }, + 3 }, { { SENSORS_W83792D_IN6_MAX, "in6_max", SENSORS_W83792D_IN6, SENSORS_W83792D_IN6, RW }, - W83792D_SYSCTL_IN6, VALUE(2), 3 }, + 3 }, { { SENSORS_W83792D_IN7_MAX, "in7_max", SENSORS_W83792D_IN7, SENSORS_W83792D_IN7, RW }, - W83792D_SYSCTL_IN7, VALUE(2), 3 }, + 3 }, { { SENSORS_W83792D_IN8_MAX, "in8_max", SENSORS_W83792D_IN8, SENSORS_W83792D_IN8, RW }, - W83792D_SYSCTL_IN8, VALUE(2), 3 }, + 3 }, { { SENSORS_W83792D_FAN1, "fan1", NOMAP, NOMAP, R }, - W83792D_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_W83792D_FAN2, "fan2", NOMAP, NOMAP, R }, - W83792D_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_W83792D_FAN3, "fan3", NOMAP, NOMAP, R }, - W83792D_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_W83792D_FAN4, "fan4", NOMAP, NOMAP, R }, - W83792D_SYSCTL_FAN4, VALUE(2), 0 }, + 0 }, { { SENSORS_W83792D_FAN5, "fan5", NOMAP, NOMAP, R }, - W83792D_SYSCTL_FAN5, VALUE(2), 0 }, + 0 }, { { SENSORS_W83792D_FAN6, "fan6", NOMAP, NOMAP, R }, - W83792D_SYSCTL_FAN6, VALUE(2), 0 }, + 0 }, { { SENSORS_W83792D_FAN7, "fan7", NOMAP, NOMAP, R }, - W83792D_SYSCTL_FAN7, VALUE(2), 0 }, + 0 }, { { SENSORS_W83792D_FAN1_MIN, "fan1_min", SENSORS_W83792D_FAN1, SENSORS_W83792D_FAN1, RW }, - W83792D_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_W83792D_FAN2_MIN, "fan2_min", SENSORS_W83792D_FAN2, SENSORS_W83792D_FAN2, RW }, - W83792D_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_W83792D_FAN3_MIN, "fan3_min", SENSORS_W83792D_FAN3, SENSORS_W83792D_FAN3, RW }, - W83792D_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_W83792D_FAN4_MIN, "fan4_min", SENSORS_W83792D_FAN4, SENSORS_W83792D_FAN4, RW }, - W83792D_SYSCTL_FAN4, VALUE(1), 0 }, + 0 }, { { SENSORS_W83792D_FAN5_MIN, "fan5_min", SENSORS_W83792D_FAN5, SENSORS_W83792D_FAN5, RW }, - W83792D_SYSCTL_FAN5, VALUE(1), 0 }, + 0 }, { { SENSORS_W83792D_FAN6_MIN, "fan6_min", SENSORS_W83792D_FAN6, SENSORS_W83792D_FAN6, RW }, - W83792D_SYSCTL_FAN6, VALUE(1), 0 }, + 0 }, { { SENSORS_W83792D_FAN7_MIN, "fan7_min", SENSORS_W83792D_FAN7, SENSORS_W83792D_FAN7, RW }, - W83792D_SYSCTL_FAN7, VALUE(1), 0 }, + 0 }, { { SENSORS_W83792D_TEMP1, "temp1", NOMAP, NOMAP, R }, - W83792D_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_W83792D_TEMP1_HYST, "temp1_hyst", SENSORS_W83792D_TEMP1, SENSORS_W83792D_TEMP1, RW }, - W83792D_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_W83792D_TEMP1_OVER, "temp1_over", SENSORS_W83792D_TEMP1, SENSORS_W83792D_TEMP1, RW }, - W83792D_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_W83792D_TEMP2, "temp2", NOMAP, NOMAP, R }, - W83792D_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_W83792D_TEMP2_HYST, "temp2_hyst", SENSORS_W83792D_TEMP2, SENSORS_W83792D_TEMP2, RW }, - W83792D_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_W83792D_TEMP2_OVER, "temp2_over", SENSORS_W83792D_TEMP2, SENSORS_W83792D_TEMP2, RW }, - W83792D_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_W83792D_TEMP3, "temp3", NOMAP, NOMAP, R }, - W83792D_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_W83792D_TEMP3_HYST, "temp3_hyst", SENSORS_W83792D_TEMP3, SENSORS_W83792D_TEMP3, RW }, - W83792D_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_W83792D_TEMP3_OVER, "temp3_over", SENSORS_W83792D_TEMP3, SENSORS_W83792D_TEMP3, RW }, - W83792D_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, /* { { SENSORS_W83792D_VID, "vid", NOMAP, NOMAP, R }, - W83792D_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_W83792D_VRM, "vrm", NOMAP, NOMAP, RW }, - W83792D_SYSCTL_VRM, VALUE(1), 1 }, */ + 1 }, */ { { SENSORS_W83792D_CHASSIS, "chassis", SENSORS_W83792D_CHASSIS, NOMAP, RW }, - W83792D_SYSCTL_CHASSIS, VALUE(1), 0 }, + 0 }, { { SENSORS_W83792D_FAN1_DIV, "fan1_div", SENSORS_W83792D_FAN1, NOMAP, RW }, - W83792D_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_W83792D_FAN2_DIV, "fan2_div", SENSORS_W83792D_FAN2, NOMAP, RW }, - W83792D_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_W83792D_FAN3_DIV, "fan3_div", SENSORS_W83792D_FAN3, NOMAP, RW }, - W83792D_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_W83792D_FAN4_DIV, "fan4_div", SENSORS_W83792D_FAN4, NOMAP, RW }, - W83792D_SYSCTL_FAN_DIV, VALUE(4), 0 }, + 0 }, { { SENSORS_W83792D_FAN5_DIV, "fan5_div", SENSORS_W83792D_FAN5, NOMAP, RW }, - W83792D_SYSCTL_FAN_DIV, VALUE(5), 0 }, + 0 }, { { SENSORS_W83792D_FAN6_DIV, "fan6_div", SENSORS_W83792D_FAN6, NOMAP, RW }, - W83792D_SYSCTL_FAN_DIV, VALUE(6), 0 }, + 0 }, { { SENSORS_W83792D_FAN7_DIV, "fan7_div", SENSORS_W83792D_FAN7, NOMAP, RW }, - W83792D_SYSCTL_FAN_DIV, VALUE(7), 0 }, + 0 }, { { SENSORS_W83792D_ALARMS, "alarms", NOMAP, NOMAP, R }, - W83792D_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; @@ -1864,42 +1840,41 @@ static sensors_chip_feature w83792d_features[] = /* w83793 */ #define SENSORS_W83793_FEATURES_IN(nr) \ { { SENSORS_W83793_IN(nr), "in" #nr, NOMAP, NOMAP, R }, \ - NOSYSCTL, VALUE(3), 3 }, \ + 3 }, \ { { SENSORS_W83793_IN_MIN(nr), "in" #nr "_min", \ SENSORS_W83793_IN(nr), SENSORS_W83793_IN(nr), RW }, \ - NOSYSCTL, VALUE(1), 3 }, \ + 3 }, \ { { SENSORS_W83793_IN_MAX(nr), "in" #nr "_max", \ SENSORS_W83793_IN(nr), SENSORS_W83793_IN(nr), RW }, \ - NOSYSCTL, VALUE(2), 3 }, \ + 3 }, \ { { SENSORS_W83793_IN_ALARM(nr), "in" #nr "_alarm", \ SENSORS_W83793_IN(nr), NOMAP, R}, \ - NOSYSCTL, VALUE(1), 0 } + 0 } #define SENSORS_W83793_FEATURES_FAN(nr) \ { { SENSORS_W83793_FAN(nr), "fan" #nr, NOMAP, NOMAP, R }, \ - NOSYSCTL, VALUE(2), 0 }, \ + 0 }, \ { { SENSORS_W83793_FAN_MIN(nr), "fan" #nr "_min", \ SENSORS_W83793_FAN(nr), SENSORS_W83793_FAN(nr), RW }, \ - NOSYSCTL, VALUE(1), 0 }, \ + 0 }, \ { { SENSORS_W83793_FAN_ALARM(nr), "fan" #nr "_alarm", \ SENSORS_W83793_FAN(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(1), 0 } + 0 } #define SENSORS_W83793_FEATURES_TEMP(nr) \ { { SENSORS_W83793_TEMP(nr), "temp" #nr, NOMAP, NOMAP, R }, \ - NOSYSCTL, VALUE(3), 3 }, \ + 3 }, \ { { SENSORS_W83793_TEMP_CRIT(nr), "temp" #nr "_max", \ SENSORS_W83793_TEMP(nr), SENSORS_W83793_TEMP(nr), RW }, \ - NOSYSCTL, VALUE(1), 3 }, \ + 3 }, \ { { SENSORS_W83793_TEMP_CRIT_HYST(nr), "temp" #nr "_max_hyst", \ SENSORS_W83793_TEMP(nr), SENSORS_W83793_TEMP(nr), \ RW }, \ - NOSYSCTL, VALUE(2), 3 }, \ + 3 }, \ { { SENSORS_W83793_TEMP_ALARM(nr), "temp" #nr "_alarm", \ SENSORS_W83793_TEMP(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(1), 0 } + 0 } -/* No support for Linux 2.4 yet (sysctl) */ static sensors_chip_feature w83793_features[] = { SENSORS_W83793_FEATURES_IN(0), @@ -1931,13 +1906,13 @@ static sensors_chip_feature w83793_features[] = SENSORS_W83793_FEATURES_TEMP(5), SENSORS_W83793_FEATURES_TEMP(6), { { SENSORS_W83793_VID0, "cpu0_vid", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83793_VID1, "cpu1_vid", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83793_VRM, "vrm", NOMAP, NOMAP, RW }, - NOSYSCTL, VALUE(1), 1 }, + 1 }, { { SENSORS_W83793_CHASSIS, "chassis", NOMAP, NOMAP, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; @@ -1945,295 +1920,293 @@ static sensors_chip_feature w83793_features[] = static sensors_chip_feature w83l785ts_features[] = { { { SENSORS_W83L785TS_TEMP, "temp", NOMAP, NOMAP, R }, - W83L785TS_SYSCTL_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_W83L785TS_TEMP_OVER, "temp_over", SENSORS_W83L785TS_TEMP, SENSORS_W83L785TS_TEMP, R }, - W83L785TS_SYSCTL_TEMP, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; -/* No support for Linux 2.4 yet (sysctl) */ -/* W83627DHG uses same structure excluding in9* */ static sensors_chip_feature w83627ehf_features[] = { { { SENSORS_W83627EHF_IN0, "in0", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN1, "in1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN2, "in2", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN3, "in3", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN4, "in4", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN5, "in5", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN6, "in6", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN7, "in7", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN8, "in8", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN9, "in9", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_W83627EHF_IN0_ALARM, "in0_alarm", SENSORS_W83627EHF_IN0, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN1_ALARM, "in1_alarm", SENSORS_W83627EHF_IN1, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN2_ALARM, "in2_alarm", SENSORS_W83627EHF_IN2, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN3_ALARM, "in3_alarm", SENSORS_W83627EHF_IN3, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN4_ALARM, "in4_alarm", SENSORS_W83627EHF_IN4, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN5_ALARM, "in5_alarm", SENSORS_W83627EHF_IN5, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN6_ALARM, "in6_alarm", SENSORS_W83627EHF_IN6, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN7_ALARM, "in7_alarm", SENSORS_W83627EHF_IN7, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN8_ALARM, "in8_alarm", SENSORS_W83627EHF_IN8, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN9_ALARM, "in9_alarm", SENSORS_W83627EHF_IN9, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_IN0_MIN, "in0_min", SENSORS_W83627EHF_IN0, SENSORS_W83627EHF_IN0, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN1_MIN, "in1_min", SENSORS_W83627EHF_IN1, SENSORS_W83627EHF_IN1, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN2_MIN, "in2_min", SENSORS_W83627EHF_IN2, SENSORS_W83627EHF_IN2, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN3_MIN, "in3_min", SENSORS_W83627EHF_IN3, SENSORS_W83627EHF_IN3, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN4_MIN, "in4_min", SENSORS_W83627EHF_IN4, SENSORS_W83627EHF_IN4, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN5_MIN, "in5_min", SENSORS_W83627EHF_IN5, SENSORS_W83627EHF_IN5, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN6_MIN, "in6_min", SENSORS_W83627EHF_IN6, SENSORS_W83627EHF_IN6, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN7_MIN, "in7_min", SENSORS_W83627EHF_IN7, SENSORS_W83627EHF_IN7, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN8_MIN, "in8_min", SENSORS_W83627EHF_IN8, SENSORS_W83627EHF_IN8, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN9_MIN, "in9_min", SENSORS_W83627EHF_IN9, SENSORS_W83627EHF_IN9, RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_W83627EHF_IN0_MAX, "in0_max", SENSORS_W83627EHF_IN0, SENSORS_W83627EHF_IN0, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_IN1_MAX, "in1_max", SENSORS_W83627EHF_IN1, SENSORS_W83627EHF_IN1, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_IN2_MAX, "in2_max", SENSORS_W83627EHF_IN2, SENSORS_W83627EHF_IN2, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_IN3_MAX, "in3_max", SENSORS_W83627EHF_IN3, SENSORS_W83627EHF_IN3, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_IN4_MAX, "in4_max", SENSORS_W83627EHF_IN4, SENSORS_W83627EHF_IN4, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_IN5_MAX, "in5_max", SENSORS_W83627EHF_IN5, SENSORS_W83627EHF_IN5, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_IN6_MAX, "in6_max", SENSORS_W83627EHF_IN6, SENSORS_W83627EHF_IN6, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_IN7_MAX, "in7_max", SENSORS_W83627EHF_IN7, SENSORS_W83627EHF_IN7, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_IN8_MAX, "in8_max", SENSORS_W83627EHF_IN8, SENSORS_W83627EHF_IN8, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_IN9_MAX, "in9_max", SENSORS_W83627EHF_IN9, SENSORS_W83627EHF_IN9, RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_W83627EHF_FAN1, "fan1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN2, "fan2", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN3, "fan3", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN4, "fan4", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN5, "fan5", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN1_ALARM, "fan1_alarm", SENSORS_W83627EHF_FAN1, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN2_ALARM, "fan2_alarm", SENSORS_W83627EHF_FAN2, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN3_ALARM, "fan3_alarm", SENSORS_W83627EHF_FAN3, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN4_ALARM, "fan4_alarm", SENSORS_W83627EHF_FAN4, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN5_ALARM, "fan5_alarm", SENSORS_W83627EHF_FAN5, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN1_MIN, "fan1_min", SENSORS_W83627EHF_FAN1, SENSORS_W83627EHF_FAN1, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN2_MIN, "fan2_min", SENSORS_W83627EHF_FAN2, SENSORS_W83627EHF_FAN2, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN3_MIN, "fan3_min", SENSORS_W83627EHF_FAN3, SENSORS_W83627EHF_FAN3, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN4_MIN, "fan4_min", SENSORS_W83627EHF_FAN4, SENSORS_W83627EHF_FAN4, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN5_MIN, "fan5_min", SENSORS_W83627EHF_FAN5, SENSORS_W83627EHF_FAN5, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN1_DIV, "fan1_div", SENSORS_W83627EHF_FAN1, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN2_DIV, "fan2_div", SENSORS_W83627EHF_FAN2, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN3_DIV, "fan3_div", SENSORS_W83627EHF_FAN3, NOMAP, R }, - NOSYSCTL, VALUE(3), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN4_DIV, "fan4_div", SENSORS_W83627EHF_FAN4, NOMAP, R }, - NOSYSCTL, VALUE(4), 0 }, + 0 }, { { SENSORS_W83627EHF_FAN5_DIV, "fan5_div", SENSORS_W83627EHF_FAN5, NOMAP, R }, - NOSYSCTL, VALUE(5), 0 }, + 0 }, { { SENSORS_W83627EHF_TEMP1, "temp1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 0 }, + 0 }, { { SENSORS_W83627EHF_TEMP2, "temp2", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 1 }, + 1 }, { { SENSORS_W83627EHF_TEMP3, "temp3", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 1 }, + 1 }, { { SENSORS_W83627EHF_TEMP1_ALARM, "temp1_alarm", SENSORS_W83627EHF_TEMP1, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_TEMP2_ALARM, "temp2_alarm", SENSORS_W83627EHF_TEMP2, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_TEMP3_ALARM, "temp3_alarm", SENSORS_W83627EHF_TEMP3, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_TEMP1_OVER, "temp1_over", SENSORS_W83627EHF_TEMP1, SENSORS_W83627EHF_TEMP1, RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_W83627EHF_TEMP2_OVER, "temp2_over", SENSORS_W83627EHF_TEMP2, SENSORS_W83627EHF_TEMP2, RW }, - NOSYSCTL, VALUE(1), 1 }, + 1 }, { { SENSORS_W83627EHF_TEMP3_OVER, "temp3_over", SENSORS_W83627EHF_TEMP3, SENSORS_W83627EHF_TEMP3, RW }, - NOSYSCTL, VALUE(1), 1 }, + 1 }, { { SENSORS_W83627EHF_TEMP1_HYST, "temp1_hyst", SENSORS_W83627EHF_TEMP1, SENSORS_W83627EHF_TEMP1, RW }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_W83627EHF_TEMP2_HYST, "temp2_hyst", SENSORS_W83627EHF_TEMP2, SENSORS_W83627EHF_TEMP2, RW }, - NOSYSCTL, VALUE(2), 1 }, + 1 }, { { SENSORS_W83627EHF_TEMP3_HYST, "temp3_hyst", SENSORS_W83627EHF_TEMP3, SENSORS_W83627EHF_TEMP3, RW }, - NOSYSCTL, VALUE(2), 1 }, + 1 }, { { 0 }, 0 } }; static sensors_chip_feature adm9240_features[] = { { { SENSORS_ADM9240_IN0, "2.5V", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_IN0, VALUE(3), 2, "in0_input", 3 }, + 2, "in0_input", 3 }, { { SENSORS_ADM9240_IN1, "Vccp1", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_IN1, VALUE(3), 2, "in1_input", 3 }, + 2, "in1_input", 3 }, { { SENSORS_ADM9240_IN2, "3.3V", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_IN2, VALUE(3), 2, "in2_input", 3 }, + 2, "in2_input", 3 }, { { SENSORS_ADM9240_IN3, "5V", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_IN3, VALUE(3), 2, "in3_input", 3 }, + 2, "in3_input", 3 }, { { SENSORS_ADM9240_IN4, "12V", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_IN4, VALUE(3), 2, "in4_input", 3 }, + 2, "in4_input", 3 }, { { SENSORS_ADM9240_IN5, "Vccp2", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_IN5, VALUE(3), 2, "in5_input", 3 }, + 2, "in5_input", 3 }, { { SENSORS_ADM9240_IN0_MIN, "2.5V_min", SENSORS_ADM9240_IN0, SENSORS_ADM9240_IN0, RW }, - ADM9240_SYSCTL_IN0, VALUE(1), 2, "in0_min", 3 }, + 2, "in0_min", 3 }, { { SENSORS_ADM9240_IN1_MIN, "Vccp1_min", SENSORS_ADM9240_IN1, SENSORS_ADM9240_IN1, RW }, - ADM9240_SYSCTL_IN1, VALUE(1), 2, "in1_min", 3 }, + 2, "in1_min", 3 }, { { SENSORS_ADM9240_IN2_MIN, "3.3V_min", SENSORS_ADM9240_IN2, SENSORS_ADM9240_IN2, RW }, - ADM9240_SYSCTL_IN2, VALUE(1), 2, "in2_min", 3 }, + 2, "in2_min", 3 }, { { SENSORS_ADM9240_IN3_MIN, "5V_min", SENSORS_ADM9240_IN3, SENSORS_ADM9240_IN3, RW }, - ADM9240_SYSCTL_IN3, VALUE(1), 2, "in3_min", 3 }, + 2, "in3_min", 3 }, { { SENSORS_ADM9240_IN4_MIN, "12V_min", SENSORS_ADM9240_IN4, SENSORS_ADM9240_IN4, RW }, - ADM9240_SYSCTL_IN4, VALUE(1), 2, "in4_min", 3 }, + 2, "in4_min", 3 }, { { SENSORS_ADM9240_IN5_MIN, "Vccp2_min", SENSORS_ADM9240_IN5, SENSORS_ADM9240_IN5, RW }, - ADM9240_SYSCTL_IN5, VALUE(1), 2, "in5_min", 3 }, + 2, "in5_min", 3 }, { { SENSORS_ADM9240_IN0_MAX, "2.5V_max", SENSORS_ADM9240_IN0, SENSORS_ADM9240_IN0, RW }, - ADM9240_SYSCTL_IN0, VALUE(2), 2, "in0_max", 3 }, + 2, "in0_max", 3 }, { { SENSORS_ADM9240_IN1_MAX, "Vccp1_max", SENSORS_ADM9240_IN1, SENSORS_ADM9240_IN1, RW }, - ADM9240_SYSCTL_IN1, VALUE(2), 2, "in1_max", 3 }, + 2, "in1_max", 3 }, { { SENSORS_ADM9240_IN2_MAX, "3.3V_max", SENSORS_ADM9240_IN2, SENSORS_ADM9240_IN2, RW }, - ADM9240_SYSCTL_IN2, VALUE(2), 2, "in2_max", 3 }, + 2, "in2_max", 3 }, { { SENSORS_ADM9240_IN3_MAX, "5V_max", SENSORS_ADM9240_IN3, SENSORS_ADM9240_IN3, RW }, - ADM9240_SYSCTL_IN3, VALUE(2), 2, "in3_max", 3 }, + 2, "in3_max", 3 }, { { SENSORS_ADM9240_IN4_MAX, "12V_max", SENSORS_ADM9240_IN4, SENSORS_ADM9240_IN4, RW }, - ADM9240_SYSCTL_IN4, VALUE(2), 2, "in4_max", 3 }, + 2, "in4_max", 3 }, { { SENSORS_ADM9240_IN5_MAX, "Vccp2_max", SENSORS_ADM9240_IN5, SENSORS_ADM9240_IN5, RW }, - ADM9240_SYSCTL_IN5, VALUE(2), 2, "in5_max", 3 }, + 2, "in5_max", 3 }, { { SENSORS_ADM9240_FAN1, "fan1", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM9240_FAN2, "fan2", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM9240_FAN1_MIN, "fan1_min", SENSORS_ADM9240_FAN1, SENSORS_ADM9240_FAN1, RW }, - ADM9240_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM9240_FAN2_MIN, "fan2_min", SENSORS_ADM9240_FAN2, SENSORS_ADM9240_FAN2, RW }, - ADM9240_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM9240_TEMP, "temp", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_TEMP, VALUE(3), 1, "temp1_input", + 1, "temp1_input", 3 }, { { SENSORS_ADM9240_TEMP_HYST, "temp_hyst", SENSORS_ADM9240_TEMP, SENSORS_ADM9240_TEMP, RW }, - ADM9240_SYSCTL_TEMP, VALUE(2), 1, + 1, "temp1_max_hyst", 3 }, { { SENSORS_ADM9240_TEMP_OVER, "temp_over", SENSORS_ADM9240_TEMP, SENSORS_ADM9240_TEMP, RW }, - ADM9240_SYSCTL_TEMP, VALUE(1), 1, "temp1_max", + 1, "temp1_max", 3 }, { { SENSORS_ADM9240_VID, "vid", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_VID, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM9240_FAN1_DIV, "fan1_div", SENSORS_ADM9240_FAN1, NOMAP, RW }, - ADM9240_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM9240_FAN2_DIV, "fan2_div", SENSORS_ADM9240_FAN2, NOMAP, RW }, - ADM9240_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM9240_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM9240_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM9240_ANALOG_OUT, "analog_out", NOMAP, NOMAP, RW }, - ADM9240_SYSCTL_ANALOG_OUT, VALUE(1), 0, + 0, "aout_output", 3 }, { { 0 }, 0 } }; @@ -2241,874 +2214,874 @@ static sensors_chip_feature adm9240_features[] = static sensors_chip_feature adm1024_features[] = { { { SENSORS_ADM1024_IN0, "2.5V", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1024_IN1, "Vccp1", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1024_IN2, "3.3V", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1024_IN3, "5V", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1024_IN4, "12V", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1024_IN5, "Vccp2", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1024_IN0_MIN, "2.5V_min", SENSORS_ADM1024_IN0, SENSORS_ADM1024_IN0, RW }, - ADM1024_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1024_IN1_MIN, "Vccp1_min", SENSORS_ADM1024_IN1, SENSORS_ADM1024_IN1, RW }, - ADM1024_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1024_IN2_MIN, "3.3V_min", SENSORS_ADM1024_IN2, SENSORS_ADM1024_IN2, RW }, - ADM1024_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1024_IN3_MIN, "5V_min", SENSORS_ADM1024_IN3, SENSORS_ADM1024_IN3, RW }, - ADM1024_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1024_IN4_MIN, "12V_min", SENSORS_ADM1024_IN4, SENSORS_ADM1024_IN4, RW }, - ADM1024_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1024_IN5_MIN, "Vccp2_min", SENSORS_ADM1024_IN5, SENSORS_ADM1024_IN5, RW }, - ADM1024_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1024_IN0_MAX, "2.5V_max", SENSORS_ADM1024_IN0, SENSORS_ADM1024_IN0, RW }, - ADM1024_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1024_IN1_MAX, "Vccp1_max", SENSORS_ADM1024_IN1, SENSORS_ADM1024_IN1, RW }, - ADM1024_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1024_IN2_MAX, "3.3V_max", SENSORS_ADM1024_IN2, SENSORS_ADM1024_IN2, RW }, - ADM1024_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1024_IN3_MAX, "5V_max", SENSORS_ADM1024_IN3, SENSORS_ADM1024_IN3, RW }, - ADM1024_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1024_IN4_MAX, "12V_max", SENSORS_ADM1024_IN4, SENSORS_ADM1024_IN4, RW }, - ADM1024_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1024_IN5_MAX, "Vccp2_max", SENSORS_ADM1024_IN5, SENSORS_ADM1024_IN5, RW }, - ADM1024_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1024_FAN1, "fan1", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1024_FAN2, "fan2", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1024_FAN1_MIN, "fan1_min", SENSORS_ADM1024_FAN1, SENSORS_ADM1024_FAN1, RW }, - ADM1024_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1024_FAN2_MIN, "fan2_min", SENSORS_ADM1024_FAN2, SENSORS_ADM1024_FAN2, RW }, - ADM1024_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1024_TEMP, "temp", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_ADM1024_TEMP1, "temp1", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_ADM1024_TEMP2, "temp2", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_ADM1024_TEMP_HYST, "temp_hyst", SENSORS_ADM1024_TEMP, SENSORS_ADM1024_TEMP, RW }, - ADM1024_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_ADM1024_TEMP_OVER, "temp_over", SENSORS_ADM1024_TEMP, SENSORS_ADM1024_TEMP, RW }, - ADM1024_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1024_TEMP1_HYST, "temp1_hyst", SENSORS_ADM1024_TEMP1, SENSORS_ADM1024_TEMP1, RW }, - ADM1024_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_ADM1024_TEMP1_OVER, "temp1_over", SENSORS_ADM1024_TEMP1, SENSORS_ADM1024_TEMP1, RW }, - ADM1024_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1024_TEMP2_HYST, "temp2_hyst", SENSORS_ADM1024_TEMP2, SENSORS_ADM1024_TEMP2, RW }, - ADM1024_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_ADM1024_TEMP2_OVER, "temp2_over", SENSORS_ADM1024_TEMP2, SENSORS_ADM1024_TEMP2, RW }, - ADM1024_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1024_VID, "vid", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_VID, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1024_FAN1_DIV, "fan1_div", SENSORS_ADM1024_FAN1, NOMAP, RW }, - ADM1024_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1024_FAN2_DIV, "fan2_div", SENSORS_ADM1024_FAN2, NOMAP, RW }, - ADM1024_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1024_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM1024_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1024_ANALOG_OUT, "analog_out", NOMAP, NOMAP, RW }, - ADM1024_SYSCTL_ANALOG_OUT, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature sis5595_features[] = { { { SENSORS_SIS5595_IN0, "in0", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_SIS5595_IN1, "in1", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_SIS5595_IN2, "in2", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_SIS5595_IN3, "in3", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_SIS5595_IN4, "in4", NOMAP, NOMAP, R }, - LM78_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_SIS5595_IN0_MIN, "in0_min", SENSORS_SIS5595_IN0, SENSORS_SIS5595_IN0, RW }, - LM78_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_SIS5595_IN1_MIN, "in1_min", SENSORS_SIS5595_IN1, SENSORS_SIS5595_IN1, RW }, - LM78_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_SIS5595_IN2_MIN, "in2_min", SENSORS_SIS5595_IN2, SENSORS_SIS5595_IN2, RW }, - LM78_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_SIS5595_IN3_MIN, "in3_min", SENSORS_SIS5595_IN3, SENSORS_SIS5595_IN3, RW }, - LM78_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_SIS5595_IN4_MIN, "in4_min", SENSORS_SIS5595_IN4, SENSORS_SIS5595_IN4, RW }, - LM78_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_SIS5595_IN0_MAX, "in0_max", SENSORS_SIS5595_IN0, SENSORS_SIS5595_IN0, RW }, - LM78_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_SIS5595_IN1_MAX, "in1_max", SENSORS_SIS5595_IN1, SENSORS_SIS5595_IN1, RW }, - LM78_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_SIS5595_IN2_MAX, "in2_max", SENSORS_SIS5595_IN2, SENSORS_SIS5595_IN2, RW }, - LM78_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_SIS5595_IN3_MAX, "in3_max", SENSORS_SIS5595_IN3, SENSORS_SIS5595_IN3, RW }, - LM78_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_SIS5595_IN4_MAX, "in4_max", SENSORS_SIS5595_IN4, SENSORS_SIS5595_IN4, RW }, - LM78_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_SIS5595_FAN1, "fan1", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_SIS5595_FAN2, "fan2", NOMAP, NOMAP, R }, - LM78_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_SIS5595_FAN1_MIN, "fan1_min", SENSORS_SIS5595_FAN1, SENSORS_SIS5595_FAN1, RW }, - LM78_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_SIS5595_FAN2_MIN, "fan2_min", SENSORS_SIS5595_FAN2, SENSORS_SIS5595_FAN2, RW }, - LM78_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_SIS5595_TEMP, "temp", NOMAP, NOMAP, R }, - LM78_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_SIS5595_TEMP_HYST, "temp_hyst", SENSORS_SIS5595_TEMP, SENSORS_SIS5595_TEMP, RW }, - LM78_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_SIS5595_TEMP_OVER, "temp_over", SENSORS_SIS5595_TEMP, SENSORS_SIS5595_TEMP, RW }, - LM78_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_SIS5595_FAN1_DIV, "fan1_div", SENSORS_SIS5595_FAN1, NOMAP, RW }, - LM78_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_SIS5595_FAN2_DIV, "fan2_div", SENSORS_SIS5595_FAN2, NOMAP, RW }, - LM78_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_SIS5595_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM78_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature maxi_cg_features[] = { { { SENSORS_MAXI_CG_FAN1, "fan1", NOMAP, NOMAP, R }, - MAXI_SYSCTL_FAN1, VALUE(3), 0 }, + 0 }, { { SENSORS_MAXI_CG_FAN2, "fan2", NOMAP, NOMAP, R }, - MAXI_SYSCTL_FAN2, VALUE(3), 0 }, + 0 }, { { SENSORS_MAXI_CG_FAN3, "fan3", NOMAP, NOMAP, R }, - MAXI_SYSCTL_FAN3, VALUE(3), 0 }, + 0 }, { { SENSORS_MAXI_CG_FAN1_MIN, "fan1_min", SENSORS_MAXI_CG_FAN1, SENSORS_MAXI_CG_FAN1, RW }, - MAXI_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_MAXI_CG_FAN2_MIN, "fan2_min", SENSORS_MAXI_CG_FAN2, SENSORS_MAXI_CG_FAN2, RW }, - MAXI_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_MAXI_CG_FAN3_MIN, "fan3_min", SENSORS_MAXI_CG_FAN3, SENSORS_MAXI_CG_FAN3, RW }, - MAXI_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_MAXI_CG_FAN1_DIV, "fan1_div", SENSORS_MAXI_CG_FAN1, NOMAP, R }, - MAXI_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_MAXI_CG_FAN2_DIV, "fan2_div", SENSORS_MAXI_CG_FAN2, NOMAP, R }, - MAXI_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_MAXI_CG_FAN3_DIV, "fan3_div", SENSORS_MAXI_CG_FAN3, NOMAP, R }, - MAXI_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_MAXI_CG_TEMP1, "temp1", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP2, "temp2", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP3, "temp3", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP4, "temp4", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP4, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP5, "temp5", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP5, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP1_MAX, "temp1_max", SENSORS_MAXI_CG_TEMP1, SENSORS_MAXI_CG_TEMP1, R }, - MAXI_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP2_MAX, "temp2_max", SENSORS_MAXI_CG_TEMP2, SENSORS_MAXI_CG_TEMP2, R }, - MAXI_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP3_MAX, "temp3_max", SENSORS_MAXI_CG_TEMP3, SENSORS_MAXI_CG_TEMP3, R }, - MAXI_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP4_MAX, "temp4_max", SENSORS_MAXI_CG_TEMP4, SENSORS_MAXI_CG_TEMP4, R }, - MAXI_SYSCTL_TEMP4, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP5_MAX, "temp5_max", SENSORS_MAXI_CG_TEMP5, SENSORS_MAXI_CG_TEMP5, R }, - MAXI_SYSCTL_TEMP5, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP1_HYST, "temp1_hyst", SENSORS_MAXI_CG_TEMP1, SENSORS_MAXI_CG_TEMP1, R }, - MAXI_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP2_HYST, "temp2_hyst", SENSORS_MAXI_CG_TEMP2, SENSORS_MAXI_CG_TEMP2, R }, - MAXI_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP3_HYST, "temp3_hyst", SENSORS_MAXI_CG_TEMP3, SENSORS_MAXI_CG_TEMP3, R }, - MAXI_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP4_HYST, "temp4_hyst", SENSORS_MAXI_CG_TEMP4, SENSORS_MAXI_CG_TEMP4, R }, - MAXI_SYSCTL_TEMP4, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CG_TEMP5_HYST, "temp5_hyst", SENSORS_MAXI_CG_TEMP5, SENSORS_MAXI_CG_TEMP5, R }, - MAXI_SYSCTL_TEMP5, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CG_PLL, "pll", NOMAP, NOMAP, R }, - MAXI_SYSCTL_PLL, VALUE(3), 2 }, + 2 }, { { SENSORS_MAXI_CG_PLL_MIN, "pll_min", SENSORS_MAXI_CG_PLL, SENSORS_MAXI_CG_PLL, RW }, - MAXI_SYSCTL_PLL, VALUE(1), 2 }, + 2 }, { { SENSORS_MAXI_CG_PLL_MAX, "pll_max", SENSORS_MAXI_CG_PLL, SENSORS_MAXI_CG_PLL, RW }, - MAXI_SYSCTL_PLL, VALUE(2), 2 }, + 2 }, { { SENSORS_MAXI_CG_VID1, "vid1", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID1, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID2, "vid2", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID2, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID3, "vid3", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID3, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID4, "vid4", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID4, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID1_MIN, "vid1_min", SENSORS_MAXI_CG_VID1, SENSORS_MAXI_CG_VID1, RW }, - MAXI_SYSCTL_VID1, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID2_MIN, "vid2_min", SENSORS_MAXI_CG_VID2, SENSORS_MAXI_CG_VID2, RW }, - MAXI_SYSCTL_VID2, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID3_MIN, "vid3_min", SENSORS_MAXI_CG_VID3, SENSORS_MAXI_CG_VID3, RW }, - MAXI_SYSCTL_VID3, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID4_MIN, "vid4_min", SENSORS_MAXI_CG_VID4, SENSORS_MAXI_CG_VID4, RW }, - MAXI_SYSCTL_VID4, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID1_MAX, "vid1_max", SENSORS_MAXI_CG_VID1, SENSORS_MAXI_CG_VID1, RW }, - MAXI_SYSCTL_VID1, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID2_MAX, "vid2_max", SENSORS_MAXI_CG_VID2, SENSORS_MAXI_CG_VID2, RW }, - MAXI_SYSCTL_VID2, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID3_MAX, "vid3_max", SENSORS_MAXI_CG_VID3, SENSORS_MAXI_CG_VID3, RW }, - MAXI_SYSCTL_VID3, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID4_MAX, "vid4_max", SENSORS_MAXI_CG_VID4, SENSORS_MAXI_CG_VID4, RW }, - MAXI_SYSCTL_VID4, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_CG_ALARMS, "alarms", NOMAP, NOMAP, R }, - MAXI_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature maxi_co_features[] = { { { SENSORS_MAXI_CO_FAN1, "fan1", NOMAP, NOMAP, R }, - MAXI_SYSCTL_FAN1, VALUE(3), 0 }, + 0 }, { { SENSORS_MAXI_CO_FAN2, "fan2", NOMAP, NOMAP, R }, - MAXI_SYSCTL_FAN2, VALUE(3), 0 }, + 0 }, { { SENSORS_MAXI_CO_FAN3, "fan3", NOMAP, NOMAP, R }, - MAXI_SYSCTL_FAN3, VALUE(3), 0 }, + 0 }, { { SENSORS_MAXI_CO_FAN1_MIN, "fan1_min", SENSORS_MAXI_CO_FAN1, SENSORS_MAXI_CO_FAN1, RW }, - MAXI_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_MAXI_CO_FAN2_MIN, "fan2_min", SENSORS_MAXI_CO_FAN2, SENSORS_MAXI_CO_FAN2, RW }, - MAXI_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_MAXI_CO_FAN3_MIN, "fan3_min", SENSORS_MAXI_CO_FAN3, SENSORS_MAXI_CO_FAN3, RW }, - MAXI_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_MAXI_CO_FAN1_DIV, "fan1_div", SENSORS_MAXI_CO_FAN1, NOMAP, R }, - MAXI_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_MAXI_CO_FAN2_DIV, "fan2_div", SENSORS_MAXI_CO_FAN2, NOMAP, R }, - MAXI_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_MAXI_CO_FAN3_DIV, "fan3_div", SENSORS_MAXI_CO_FAN3, NOMAP, R }, - MAXI_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_MAXI_CO_TEMP1, "temp1", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP2, "temp2", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP3, "temp3", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP4, "temp4", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP4, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP5, "temp5", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP5, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP1_MAX, "temp1_max", SENSORS_MAXI_CO_TEMP1, SENSORS_MAXI_CO_TEMP1, R }, - MAXI_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP2_MAX, "temp2_max", SENSORS_MAXI_CO_TEMP2, SENSORS_MAXI_CO_TEMP2, R }, - MAXI_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP3_MAX, "temp3_max", SENSORS_MAXI_CO_TEMP3, SENSORS_MAXI_CO_TEMP3, R }, - MAXI_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP4_MAX, "temp4_max", SENSORS_MAXI_CO_TEMP4, SENSORS_MAXI_CO_TEMP4, R }, - MAXI_SYSCTL_TEMP4, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP5_MAX, "temp5_max", SENSORS_MAXI_CO_TEMP5, SENSORS_MAXI_CO_TEMP5, R }, - MAXI_SYSCTL_TEMP5, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP1_HYST, "temp1_hyst", SENSORS_MAXI_CO_TEMP1, SENSORS_MAXI_CO_TEMP1, R }, - MAXI_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP2_HYST, "temp2_hyst", SENSORS_MAXI_CO_TEMP2, SENSORS_MAXI_CO_TEMP2, R }, - MAXI_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP3_HYST, "temp3_hyst", SENSORS_MAXI_CO_TEMP3, SENSORS_MAXI_CO_TEMP3, R }, - MAXI_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP4_HYST, "temp4_hyst", SENSORS_MAXI_CO_TEMP4, SENSORS_MAXI_CO_TEMP4, R }, - MAXI_SYSCTL_TEMP4, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CO_TEMP5_HYST, "temp5_hyst", SENSORS_MAXI_CO_TEMP5, SENSORS_MAXI_CO_TEMP5, R }, - MAXI_SYSCTL_TEMP5, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_CO_PLL, "pll", NOMAP, NOMAP, R }, - MAXI_SYSCTL_PLL, VALUE(3), 2 }, + 2 }, { { SENSORS_MAXI_CO_PLL_MIN, "pll_min", SENSORS_MAXI_CO_PLL, SENSORS_MAXI_CO_PLL, RW }, - MAXI_SYSCTL_PLL, VALUE(1), 2 }, + 2 }, { { SENSORS_MAXI_CO_PLL_MAX, "pll_max", SENSORS_MAXI_CO_PLL, SENSORS_MAXI_CO_PLL, RW }, - MAXI_SYSCTL_PLL, VALUE(2), 2 }, + 2 }, { { SENSORS_MAXI_CO_VID1, "vid1", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID1, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID2, "vid2", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID2, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID3, "vid3", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID3, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID4, "vid4", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID4, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID1_MIN, "vid1_min", SENSORS_MAXI_CO_VID1, SENSORS_MAXI_CO_VID1, RW }, - MAXI_SYSCTL_VID1, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID2_MIN, "vid2_min", SENSORS_MAXI_CO_VID2, SENSORS_MAXI_CO_VID2, RW }, - MAXI_SYSCTL_VID2, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID3_MIN, "vid3_min", SENSORS_MAXI_CO_VID3, SENSORS_MAXI_CO_VID3, RW }, - MAXI_SYSCTL_VID3, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID4_MIN, "vid4_min", SENSORS_MAXI_CO_VID4, SENSORS_MAXI_CO_VID4, RW }, - MAXI_SYSCTL_VID4, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID1_MAX, "vid1_max", SENSORS_MAXI_CO_VID1, SENSORS_MAXI_CO_VID1, RW }, - MAXI_SYSCTL_VID1, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID2_MAX, "vid2_max", SENSORS_MAXI_CO_VID2, SENSORS_MAXI_CO_VID2, RW }, - MAXI_SYSCTL_VID2, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_CG_VID3_MAX, "vid3_max", SENSORS_MAXI_CO_VID3, SENSORS_MAXI_CO_VID3, RW }, - MAXI_SYSCTL_VID3, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_CO_VID4_MAX, "vid4_max", SENSORS_MAXI_CO_VID4, SENSORS_MAXI_CG_VID4, RW }, - MAXI_SYSCTL_VID4, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_CO_ALARMS, "alarms", NOMAP, NOMAP, R }, - MAXI_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature maxi_as_features[] = { { { SENSORS_MAXI_AS_FAN1, "fan1", NOMAP, NOMAP, R }, - MAXI_SYSCTL_FAN1, VALUE(3), 0 }, + 0 }, { { SENSORS_MAXI_AS_FAN2, "fan2", NOMAP, NOMAP, R }, - MAXI_SYSCTL_FAN2, VALUE(3), 0 }, + 0 }, { { SENSORS_MAXI_AS_FAN3, "fan3", NOMAP, NOMAP, R }, - MAXI_SYSCTL_FAN3, VALUE(3), 0 }, + 0 }, { { SENSORS_MAXI_AS_FAN1_MIN, "fan1_min", SENSORS_MAXI_AS_FAN1, SENSORS_MAXI_AS_FAN1, RW }, - MAXI_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_MAXI_AS_FAN2_MIN, "fan2_min", SENSORS_MAXI_AS_FAN2, SENSORS_MAXI_AS_FAN2, RW }, - MAXI_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_MAXI_AS_FAN3_MIN, "fan3_min", SENSORS_MAXI_AS_FAN3, SENSORS_MAXI_AS_FAN3, RW }, - MAXI_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_MAXI_AS_FAN1_DIV, "fan1_div", SENSORS_MAXI_AS_FAN1, NOMAP, R }, - MAXI_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_MAXI_AS_FAN2_DIV, "fan2_div", SENSORS_MAXI_AS_FAN2, NOMAP, R }, - MAXI_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_MAXI_AS_FAN3_DIV, "fan3_div", SENSORS_MAXI_AS_FAN3, NOMAP, R }, - MAXI_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_MAXI_AS_TEMP1, "temp1", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP2, "temp2", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP3, "temp3", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP4, "temp4", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP4, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP5, "temp5", NOMAP, NOMAP, R }, - MAXI_SYSCTL_TEMP5, VALUE(3), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP1_MAX, "temp1_max", SENSORS_MAXI_AS_TEMP1, SENSORS_MAXI_AS_TEMP1, R }, - MAXI_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP2_MAX, "temp2_max", SENSORS_MAXI_AS_TEMP2, SENSORS_MAXI_AS_TEMP2, R }, - MAXI_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP3_MAX, "temp3_max", SENSORS_MAXI_AS_TEMP3, SENSORS_MAXI_AS_TEMP3, R }, - MAXI_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP4_MAX, "temp4_max", SENSORS_MAXI_AS_TEMP4, SENSORS_MAXI_AS_TEMP4, R }, - MAXI_SYSCTL_TEMP4, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP5_MAX, "temp5_max", SENSORS_MAXI_AS_TEMP5, SENSORS_MAXI_AS_TEMP5, R }, - MAXI_SYSCTL_TEMP5, VALUE(1), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP1_HYST, "temp1_hyst", SENSORS_MAXI_AS_TEMP1, SENSORS_MAXI_AS_TEMP1, R }, - MAXI_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP2_HYST, "temp2_hyst", SENSORS_MAXI_AS_TEMP2, SENSORS_MAXI_AS_TEMP2, R }, - MAXI_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP3_HYST, "temp3_hyst", SENSORS_MAXI_AS_TEMP3, SENSORS_MAXI_AS_TEMP3, R }, - MAXI_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP4_HYST, "temp4_hyst", SENSORS_MAXI_AS_TEMP4, SENSORS_MAXI_AS_TEMP4, R }, - MAXI_SYSCTL_TEMP4, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_AS_TEMP5_HYST, "temp5_hyst", SENSORS_MAXI_AS_TEMP5, SENSORS_MAXI_AS_TEMP5, R }, - MAXI_SYSCTL_TEMP5, VALUE(2), 1 }, + 1 }, { { SENSORS_MAXI_AS_PLL, "pll", NOMAP, NOMAP, R }, - MAXI_SYSCTL_PLL, VALUE(3), 2 }, + 2 }, { { SENSORS_MAXI_AS_PLL_MIN, "pll_min", SENSORS_MAXI_AS_PLL, SENSORS_MAXI_AS_PLL, RW }, - MAXI_SYSCTL_PLL, VALUE(1), 2 }, + 2 }, { { SENSORS_MAXI_AS_PLL_MAX, "pll_max", SENSORS_MAXI_AS_PLL, SENSORS_MAXI_AS_PLL, RW }, - MAXI_SYSCTL_PLL, VALUE(2), 2 }, + 2 }, { { SENSORS_MAXI_AS_VID1, "vid1", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID1, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID2, "vid2", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID2, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID3, "vid3", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID3, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID4, "vid4", NOMAP, NOMAP, R }, - MAXI_SYSCTL_VID4, VALUE(3), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID1_MIN, "vid1_min", SENSORS_MAXI_AS_VID1, SENSORS_MAXI_AS_VID1, RW }, - MAXI_SYSCTL_VID1, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID2_MIN, "vid2_min", SENSORS_MAXI_AS_VID2, SENSORS_MAXI_AS_VID2, RW }, - MAXI_SYSCTL_VID2, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID3_MIN, "vid3_min", SENSORS_MAXI_AS_VID3, SENSORS_MAXI_AS_VID3, RW }, - MAXI_SYSCTL_VID3, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID4_MIN, "vid4_min", SENSORS_MAXI_AS_VID4, SENSORS_MAXI_AS_VID4, RW }, - MAXI_SYSCTL_VID4, VALUE(1), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID1_MAX, "vid1_max", SENSORS_MAXI_AS_VID1, SENSORS_MAXI_AS_VID1, RW }, - MAXI_SYSCTL_VID1, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID2_MAX, "vid2_max", SENSORS_MAXI_AS_VID2, SENSORS_MAXI_AS_VID2, RW }, - MAXI_SYSCTL_VID2, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID3_MAX, "vid3_max", SENSORS_MAXI_AS_VID3, SENSORS_MAXI_AS_VID3, RW }, - MAXI_SYSCTL_VID3, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_AS_VID4_MAX, "vid4_max", SENSORS_MAXI_AS_VID4, SENSORS_MAXI_CG_VID4, RW }, - MAXI_SYSCTL_VID4, VALUE(2), 4 }, + 4 }, { { SENSORS_MAXI_AS_ALARMS, "alarms", NOMAP, NOMAP, R }, - MAXI_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature thmc50_features[] = { { { SENSORS_THMC50_TEMP, "temp", NOMAP, NOMAP, R }, - THMC50_SYSCTL_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_THMC50_TEMP_HYST, "temp_hyst", SENSORS_THMC50_TEMP, SENSORS_THMC50_TEMP, RW }, - THMC50_SYSCTL_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_THMC50_TEMP_OVER, "temp_over", SENSORS_THMC50_TEMP, SENSORS_THMC50_TEMP, RW }, - THMC50_SYSCTL_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_THMC50_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - THMC50_SYSCTL_REMOTE_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_THMC50_REMOTE_TEMP_HYST, "remote_temp_hyst", SENSORS_THMC50_REMOTE_TEMP, SENSORS_THMC50_REMOTE_TEMP, RW }, - THMC50_SYSCTL_REMOTE_TEMP, VALUE(2), + 0 }, { { SENSORS_THMC50_REMOTE_TEMP_OVER, "remote_temp_over", SENSORS_THMC50_REMOTE_TEMP, SENSORS_THMC50_REMOTE_TEMP, RW }, - THMC50_SYSCTL_REMOTE_TEMP, VALUE(1), + 0 }, { { SENSORS_THMC50_INTER_MASK, "analog output", NOMAP, NOMAP, RW }, - THMC50_SYSCTL_ANALOG_OUT, VALUE(1), 0 }, + 0 }, { { SENSORS_THMC50_INTER, "interrupts", NOMAP, NOMAP, R }, - THMC50_SYSCTL_INTER, VALUE(1), 0 }, + 0 }, { { SENSORS_THMC50_INTER_MASK, "interrupt mask", NOMAP, NOMAP, RW }, - THMC50_SYSCTL_INTER_MASK, VALUE(1), 0 }, + 0 }, { { SENSORS_THMC50_DIE_CODE, "die_code", NOMAP, NOMAP, R }, - THMC50_SYSCTL_DIE_CODE, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature adm1025_features[] = { { { SENSORS_ADM1025_IN0, "in0", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1025_IN1, "in1", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1025_IN2, "in2", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1025_IN3, "in3", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1025_IN4, "in4", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1025_IN5, "in5", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_ADM1025_IN0_MIN, "in0_min", SENSORS_ADM1025_IN0, SENSORS_ADM1025_IN0, RW }, - ADM1025_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1025_IN1_MIN, "in1_min", SENSORS_ADM1025_IN1, SENSORS_ADM1025_IN1, RW }, - ADM1025_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1025_IN2_MIN, "in2_min", SENSORS_ADM1025_IN2, SENSORS_ADM1025_IN2, RW }, - ADM1025_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1025_IN3_MIN, "in3_min", SENSORS_ADM1025_IN3, SENSORS_ADM1025_IN3, RW }, - ADM1025_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1025_IN4_MIN, "in4_min", SENSORS_ADM1025_IN4, SENSORS_ADM1025_IN4, RW }, - ADM1025_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1025_IN5_MIN, "in5_min", SENSORS_ADM1025_IN5, SENSORS_ADM1025_IN5, RW }, - ADM1025_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1025_IN0_MAX, "in0_max", SENSORS_ADM1025_IN0, SENSORS_ADM1025_IN0, RW }, - ADM1025_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1025_IN1_MAX, "in1_max", SENSORS_ADM1025_IN1, SENSORS_ADM1025_IN1, RW }, - ADM1025_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1025_IN2_MAX, "in2_max", SENSORS_ADM1025_IN2, SENSORS_ADM1025_IN2, RW }, - ADM1025_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1025_IN3_MAX, "in3_max", SENSORS_ADM1025_IN3, SENSORS_ADM1025_IN3, RW }, - ADM1025_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1025_IN4_MAX, "in4_max", SENSORS_ADM1025_IN4, SENSORS_ADM1025_IN4, RW }, - ADM1025_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1025_IN5_MAX, "in5_max", SENSORS_ADM1025_IN5, SENSORS_ADM1025_IN5, RW }, - ADM1025_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_ADM1025_TEMP1, "temp1", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_RTEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_ADM1025_TEMP1_LOW, "temp1_low", SENSORS_ADM1025_TEMP1, SENSORS_ADM1025_TEMP1, RW }, - ADM1025_SYSCTL_RTEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_ADM1025_TEMP1_HIGH, "temp1_high", SENSORS_ADM1025_TEMP1, SENSORS_ADM1025_TEMP1, RW }, - ADM1025_SYSCTL_RTEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1025_TEMP2, "temp2", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_ADM1025_TEMP2_LOW, "temp2_low", SENSORS_ADM1025_TEMP2, SENSORS_ADM1025_TEMP2, RW }, - ADM1025_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_ADM1025_TEMP2_HIGH, "temp2_high", SENSORS_ADM1025_TEMP2, SENSORS_ADM1025_TEMP2, RW }, - ADM1025_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1025_VID, "vid", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_VID, VALUE(1), 3, "cpu0_vid", 3, + 3, "cpu0_vid", 3, "in1_ref" }, { { SENSORS_ADM1025_VRM, "vrm", NOMAP, NOMAP, RW }, - ADM1025_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1025_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM1025_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature adm1026_features[] = { { { SENSORS_ADM1026_ALARMS, "alarms", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_ALARM_MASK, "alarm_mask", SENSORS_ADM1026_ALARMS, NOMAP, R }, - ADM1026_SYSCTL_ALARM_MASK, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_GPIO, "gpio", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_GPIO, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_GPIO_MASK, "gpio_mask", SENSORS_ADM1026_GPIO, NOMAP, R }, - ADM1026_SYSCTL_GPIO_MASK, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_VID, "vid", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_VRM, "vrm", NOMAP, NOMAP, RW }, - ADM1026_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1026_PWM, "pwm", NOMAP, NOMAP, RW }, - ADM1026_SYSCTL_PWM, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_AFC_PWM, "afc_pwm", NOMAP, NOMAP, RW }, - ADM1026_SYSCTL_PWM, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_DAC, "analog_out", NOMAP, NOMAP, RW }, - ADM1026_SYSCTL_ANALOG_OUT, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_AFC_DAC, "afc_analog_out", SENSORS_ADM1026_DAC, NOMAP, RW }, - ADM1026_SYSCTL_AFC, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_IN0, "in0", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN0, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN0_MIN, "in0_min", SENSORS_ADM1026_IN0, SENSORS_ADM1026_IN0, RW }, - ADM1026_SYSCTL_IN0, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN0_MAX, "in0_max", SENSORS_ADM1026_IN0, SENSORS_ADM1026_IN0, RW }, - ADM1026_SYSCTL_IN0, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN1, "in1", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN1, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN1_MIN, "in1_min", SENSORS_ADM1026_IN1, SENSORS_ADM1026_IN1, RW }, - ADM1026_SYSCTL_IN1, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN1_MAX, "in1_max", SENSORS_ADM1026_IN1, SENSORS_ADM1026_IN1, RW }, - ADM1026_SYSCTL_IN1, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN2, "in2", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN2, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN2_MIN, "in2_min", SENSORS_ADM1026_IN2, SENSORS_ADM1026_IN2, RW }, - ADM1026_SYSCTL_IN2, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN2_MAX, "in2_max", SENSORS_ADM1026_IN2, SENSORS_ADM1026_IN2, RW }, - ADM1026_SYSCTL_IN2, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN3, "in3", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN3, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN3_MIN, "in3_min", SENSORS_ADM1026_IN3, SENSORS_ADM1026_IN3, RW }, - ADM1026_SYSCTL_IN3, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN3_MAX, "in3_max", SENSORS_ADM1026_IN3, SENSORS_ADM1026_IN3, RW }, - ADM1026_SYSCTL_IN3, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN4, "in4", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN4, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN4_MIN, "in4_min", SENSORS_ADM1026_IN4, SENSORS_ADM1026_IN4, RW }, - ADM1026_SYSCTL_IN4, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN4_MAX, "in4_max", SENSORS_ADM1026_IN4, SENSORS_ADM1026_IN4, RW }, - ADM1026_SYSCTL_IN4, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN5, "in5", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN5, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN5_MIN, "in5_min", SENSORS_ADM1026_IN5, SENSORS_ADM1026_IN5, RW }, - ADM1026_SYSCTL_IN5, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN5_MAX, "in5_max", SENSORS_ADM1026_IN5, SENSORS_ADM1026_IN5, RW }, - ADM1026_SYSCTL_IN5, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN6, "in6", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN6, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN6_MIN, "in6_min", SENSORS_ADM1026_IN6, SENSORS_ADM1026_IN6, RW }, - ADM1026_SYSCTL_IN6, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN6_MAX, "in6_max", SENSORS_ADM1026_IN6, SENSORS_ADM1026_IN6, RW }, - ADM1026_SYSCTL_IN6, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN7, "in7", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN7, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN7_MIN, "in7_min", SENSORS_ADM1026_IN7, SENSORS_ADM1026_IN7, RW }, - ADM1026_SYSCTL_IN7, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN7_MAX, "in7_max", SENSORS_ADM1026_IN7, SENSORS_ADM1026_IN7, RW }, - ADM1026_SYSCTL_IN7, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN8, "in8", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN8, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN8_MIN, "in8_min", SENSORS_ADM1026_IN8, SENSORS_ADM1026_IN8, RW }, - ADM1026_SYSCTL_IN8, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN8_MAX, "in8_max", SENSORS_ADM1026_IN8, SENSORS_ADM1026_IN8, RW }, - ADM1026_SYSCTL_IN8, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN9, "in9", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN9, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN9_MIN, "in9_min", SENSORS_ADM1026_IN9, SENSORS_ADM1026_IN9, RW }, - ADM1026_SYSCTL_IN9, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN9_MAX, "in9_max", SENSORS_ADM1026_IN9, SENSORS_ADM1026_IN9, RW }, - ADM1026_SYSCTL_IN9, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN10, "in10", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN10, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN10_MIN, "in10_min", SENSORS_ADM1026_IN10, SENSORS_ADM1026_IN10, RW }, - ADM1026_SYSCTL_IN10, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN10_MAX, "in10_max", SENSORS_ADM1026_IN10, SENSORS_ADM1026_IN10, RW }, - ADM1026_SYSCTL_IN10, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN11, "in11", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN11, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN11_MIN, "in11_min", SENSORS_ADM1026_IN11, SENSORS_ADM1026_IN11, RW }, - ADM1026_SYSCTL_IN11, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN11_MAX, "in11_max", SENSORS_ADM1026_IN11, SENSORS_ADM1026_IN11, RW }, - ADM1026_SYSCTL_IN11, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN12, "in12", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN12, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN12_MIN, "in12_min", SENSORS_ADM1026_IN12, SENSORS_ADM1026_IN12, RW }, - ADM1026_SYSCTL_IN12, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN12_MAX, "in12_max", SENSORS_ADM1026_IN12, SENSORS_ADM1026_IN12, RW }, - ADM1026_SYSCTL_IN12, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN13, "in13", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN13, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN13_MIN, "in13_min", SENSORS_ADM1026_IN13, SENSORS_ADM1026_IN13, RW }, - ADM1026_SYSCTL_IN13, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN13_MAX, "in13_max", SENSORS_ADM1026_IN13, SENSORS_ADM1026_IN13, RW }, - ADM1026_SYSCTL_IN13, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN14, "in14", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN14, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN14_MIN, "in14_min", SENSORS_ADM1026_IN14, SENSORS_ADM1026_IN14, RW }, - ADM1026_SYSCTL_IN14, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN14_MAX, "in14_max", SENSORS_ADM1026_IN14, SENSORS_ADM1026_IN14, RW }, - ADM1026_SYSCTL_IN14, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN15, "in15", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN15, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN15_MIN, "in15_min", SENSORS_ADM1026_IN15, SENSORS_ADM1026_IN15, RW }, - ADM1026_SYSCTL_IN15, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN15_MAX, "in15_max", SENSORS_ADM1026_IN15, SENSORS_ADM1026_IN15, RW }, - ADM1026_SYSCTL_IN15, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_IN16, "in16", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_IN16, VALUE(3), 3 }, + 3 }, { { SENSORS_ADM1026_IN16_MIN, "in16_min", SENSORS_ADM1026_IN16, SENSORS_ADM1026_IN16, RW }, - ADM1026_SYSCTL_IN16, VALUE(1), 3 }, + 3 }, { { SENSORS_ADM1026_IN16_MAX, "in16_max", SENSORS_ADM1026_IN16, SENSORS_ADM1026_IN16, RW }, - ADM1026_SYSCTL_IN16, VALUE(2), 3 }, + 3 }, { { SENSORS_ADM1026_FAN0, "fan0", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_FAN0, VALUE(2), 0, "fan8_input", + 0, "fan8_input", 0 }, { { SENSORS_ADM1026_FAN0_MIN, "fan0_min", SENSORS_ADM1026_FAN0, SENSORS_ADM1026_FAN0, RW }, - ADM1026_SYSCTL_FAN0, VALUE(1), 0, "fan8_min", + 0, "fan8_min", 0 }, { { SENSORS_ADM1026_FAN0_DIV, "fan0_div", SENSORS_ADM1026_FAN0, NOMAP, RW }, - ADM1026_SYSCTL_FAN_DIV, VALUE(1), 0, + 0, "fan8_div", 0 }, { { SENSORS_ADM1026_FAN1, "fan1", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_FAN1_MIN, "fan1_min", SENSORS_ADM1026_FAN1, SENSORS_ADM1026_FAN1, RW }, - ADM1026_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_FAN1_DIV, "fan1_div", SENSORS_ADM1026_FAN1, NOMAP, RW }, - ADM1026_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_FAN2, "fan2", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_FAN2_MIN, "fan2_min", SENSORS_ADM1026_FAN2, SENSORS_ADM1026_FAN2, RW }, - ADM1026_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_FAN2_DIV, "fan2_div", SENSORS_ADM1026_FAN2, NOMAP, RW }, - ADM1026_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_ADM1026_FAN3, "fan3", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_FAN3_MIN, "fan3_min", SENSORS_ADM1026_FAN3, SENSORS_ADM1026_FAN3, RW }, - ADM1026_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_FAN3_DIV, "fan3_div", SENSORS_ADM1026_FAN3, NOMAP, RW }, - ADM1026_SYSCTL_FAN_DIV, VALUE(4), 0 }, + 0 }, { { SENSORS_ADM1026_FAN4, "fan4", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_FAN4, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_FAN4_MIN, "fan4_min", SENSORS_ADM1026_FAN4, SENSORS_ADM1026_FAN4, RW }, - ADM1026_SYSCTL_FAN4, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_FAN4_DIV, "fan4_div", SENSORS_ADM1026_FAN4, NOMAP, RW }, - ADM1026_SYSCTL_FAN_DIV, VALUE(5), 0 }, + 0 }, { { SENSORS_ADM1026_FAN5, "fan5", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_FAN5, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_FAN5_MIN, "fan5_min", SENSORS_ADM1026_FAN5, SENSORS_ADM1026_FAN5, RW }, - ADM1026_SYSCTL_FAN5, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_FAN5_DIV, "fan5_div", SENSORS_ADM1026_FAN5, NOMAP, RW }, - ADM1026_SYSCTL_FAN_DIV, VALUE(6), 0 }, + 0 }, { { SENSORS_ADM1026_FAN6, "fan6", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_FAN6, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_FAN6_MIN, "fan6_min", SENSORS_ADM1026_FAN6, SENSORS_ADM1026_FAN6, RW }, - ADM1026_SYSCTL_FAN6, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_FAN6_DIV, "fan6_div", SENSORS_ADM1026_FAN6, NOMAP, RW }, - ADM1026_SYSCTL_FAN_DIV, VALUE(7), 0 }, + 0 }, { { SENSORS_ADM1026_FAN7, "fan7", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_FAN7, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_FAN7_MIN, "fan7_min", SENSORS_ADM1026_FAN7, SENSORS_ADM1026_FAN7, RW }, - ADM1026_SYSCTL_FAN7, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_FAN7_DIV, "fan7_div", SENSORS_ADM1026_FAN7, NOMAP, RW }, - ADM1026_SYSCTL_FAN_DIV, VALUE(8), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP1, "temp1", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_TEMP1, VALUE(3), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP1_MIN, "temp1_min", SENSORS_ADM1026_TEMP1, SENSORS_ADM1026_TEMP1, RW }, - ADM1026_SYSCTL_TEMP1, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP1_MAX, "temp1_max", SENSORS_ADM1026_TEMP1, SENSORS_ADM1026_TEMP1, RW }, - ADM1026_SYSCTL_TEMP1, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP1_OFFSET, "temp1_offset", SENSORS_ADM1026_TEMP1, NOMAP, RW }, - ADM1026_SYSCTL_TEMP_OFFSET1, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP1_TMIN, "temp1_tmin", SENSORS_ADM1026_TEMP1, SENSORS_ADM1026_TEMP1, RW }, - ADM1026_SYSCTL_TEMP_TMIN1, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP1_THERM, "temp1_therm", SENSORS_ADM1026_TEMP1, SENSORS_ADM1026_TEMP1, RW }, - ADM1026_SYSCTL_TEMP_THERM1, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP2, "temp2", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_TEMP2, VALUE(3), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP2_MIN, "temp2_min", SENSORS_ADM1026_TEMP2, SENSORS_ADM1026_TEMP2, RW }, - ADM1026_SYSCTL_TEMP2, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP2_MAX, "temp2_max", SENSORS_ADM1026_TEMP2, SENSORS_ADM1026_TEMP2, RW }, - ADM1026_SYSCTL_TEMP2, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP2_OFFSET, "temp2_offset", SENSORS_ADM1026_TEMP2, NOMAP, RW }, - ADM1026_SYSCTL_TEMP_OFFSET2, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP2_TMIN, "temp2_tmin", SENSORS_ADM1026_TEMP2, SENSORS_ADM1026_TEMP2, RW }, - ADM1026_SYSCTL_TEMP_TMIN2, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP2_THERM, "temp2_therm", SENSORS_ADM1026_TEMP2, SENSORS_ADM1026_TEMP2, RW }, - ADM1026_SYSCTL_TEMP_THERM2, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP3, "temp3", NOMAP, NOMAP, R }, - ADM1026_SYSCTL_TEMP3, VALUE(3), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP3_MIN, "temp3_min", SENSORS_ADM1026_TEMP3, SENSORS_ADM1026_TEMP3, RW }, - ADM1026_SYSCTL_TEMP3, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP3_MAX, "temp3_max", SENSORS_ADM1026_TEMP3, SENSORS_ADM1026_TEMP3, RW }, - ADM1026_SYSCTL_TEMP3, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP3_OFFSET, "temp3_offset", SENSORS_ADM1026_TEMP3, NOMAP, RW }, - ADM1026_SYSCTL_TEMP_OFFSET3, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP3_TMIN, "temp3_tmin", SENSORS_ADM1026_TEMP3, SENSORS_ADM1026_TEMP3, RW }, - ADM1026_SYSCTL_TEMP_TMIN3, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1026_TEMP3_THERM, "temp3_therm", SENSORS_ADM1026_TEMP3, SENSORS_ADM1026_TEMP3, RW }, - ADM1026_SYSCTL_TEMP_THERM3, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; @@ -3116,85 +3089,84 @@ static sensors_chip_feature adm1026_features[] = { static sensors_chip_feature via686a_features[] = { { { SENSORS_VIA686A_IN0, "2.0V", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_IN0, VALUE(3), 2, "in0_input", 3 }, + 2, "in0_input", 3 }, { { SENSORS_VIA686A_IN1, "2.5V", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_IN1, VALUE(3), 2, "in1_input", 3 }, + 2, "in1_input", 3 }, { { SENSORS_VIA686A_IN2, "3.3V", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_IN2, VALUE(3), 2, "in2_input", 3 }, + 2, "in2_input", 3 }, { { SENSORS_VIA686A_IN3, "5.0V", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_IN3, VALUE(3), 2, "in3_input", 3 }, + 2, "in3_input", 3 }, { { SENSORS_VIA686A_IN4, "12V", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_IN4, VALUE(3), 2, "in4_input", 3 }, + 2, "in4_input", 3 }, { { SENSORS_VIA686A_IN0_MIN, "in0_min", SENSORS_VIA686A_IN0, SENSORS_VIA686A_IN0, RW }, - VIA686A_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_VIA686A_IN1_MIN, "in1_min", SENSORS_VIA686A_IN1, SENSORS_VIA686A_IN1, RW }, - VIA686A_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_VIA686A_IN2_MIN, "in2_min", SENSORS_VIA686A_IN2, SENSORS_VIA686A_IN2, RW }, - VIA686A_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_VIA686A_IN3_MIN, "in3_min", SENSORS_VIA686A_IN3, SENSORS_VIA686A_IN3, RW }, - VIA686A_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_VIA686A_IN4_MIN, "in4_min", SENSORS_VIA686A_IN4, SENSORS_VIA686A_IN4, RW }, - VIA686A_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_VIA686A_IN0_MAX, "in0_max", SENSORS_VIA686A_IN0, SENSORS_VIA686A_IN0, RW }, - VIA686A_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_VIA686A_IN1_MAX, "in1_max", SENSORS_VIA686A_IN1, SENSORS_VIA686A_IN1, RW }, - VIA686A_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_VIA686A_IN2_MAX, "in2_max", SENSORS_VIA686A_IN2, SENSORS_VIA686A_IN2, RW }, - VIA686A_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_VIA686A_IN3_MAX, "in3_max", SENSORS_VIA686A_IN3, SENSORS_VIA686A_IN3, RW }, - VIA686A_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_VIA686A_IN4_MAX, "in4_max", SENSORS_VIA686A_IN4, SENSORS_VIA686A_IN4, RW }, - VIA686A_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_VIA686A_FAN1, "fan1", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_VIA686A_FAN2, "fan2", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_VIA686A_FAN1_MIN, "fan1_min", SENSORS_VIA686A_FAN1, SENSORS_VIA686A_FAN1, RW }, - VIA686A_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_VIA686A_FAN2_MIN, "fan2_min", SENSORS_VIA686A_FAN2, SENSORS_VIA686A_FAN2, RW }, - VIA686A_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_VIA686A_TEMP, "temp1", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_VIA686A_TEMP_HYST, "temp1_hyst", SENSORS_VIA686A_TEMP, SENSORS_VIA686A_TEMP, RW }, - VIA686A_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_VIA686A_TEMP_OVER, "temp1_over", SENSORS_VIA686A_TEMP, SENSORS_VIA686A_TEMP, RW }, - VIA686A_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_VIA686A_TEMP2, "temp2", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_VIA686A_TEMP2_HYST, "temp2_hyst", SENSORS_VIA686A_TEMP2, SENSORS_VIA686A_TEMP2, RW }, - VIA686A_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_VIA686A_TEMP2_OVER, "temp2_over", SENSORS_VIA686A_TEMP2, SENSORS_VIA686A_TEMP2, RW }, - VIA686A_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_VIA686A_TEMP3, "temp3", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_VIA686A_TEMP3_HYST, "temp3_hyst", SENSORS_VIA686A_TEMP3, SENSORS_VIA686A_TEMP3, RW }, - VIA686A_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_VIA686A_TEMP3_OVER, "temp3_over", SENSORS_VIA686A_TEMP3, SENSORS_VIA686A_TEMP3, RW }, - VIA686A_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_VIA686A_FAN1_DIV, "fan1_div", SENSORS_VIA686A_FAN1, NOMAP, RW }, - VIA686A_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_VIA686A_FAN2_DIV, "fan2_div", SENSORS_VIA686A_FAN2, NOMAP, RW }, - VIA686A_SYSCTL_FAN_DIV, VALUE(2), 0 }, - { { SENSORS_VIA686A_ALARMS, "alarms", NOMAP, NOMAP, R }, - VIA686A_SYSCTL_ALARMS, VALUE(1) }, + 0 }, + { { SENSORS_VIA686A_ALARMS, "alarms", NOMAP, NOMAP, R }, 0 }, { { 0 }, 0 } }; @@ -3202,197 +3174,197 @@ static sensors_chip_feature via686a_features[] = static sensors_chip_feature lm85_features[] = { { { SENSORS_LM85_IN0, "in0", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN0, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN1, "in1", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN1, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN2, "in2", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN2, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN3, "in3", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN3, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN4, "in4", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN4, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN5, "in5", NOMAP, NOMAP, R }, - EMC6D100_SYSCTL_IN5, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN6, "in6", NOMAP, NOMAP, R }, - EMC6D100_SYSCTL_IN6, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN7, "in7", NOMAP, NOMAP, R }, - EMC6D100_SYSCTL_IN7, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN0_MIN, "in0_min", SENSORS_LM85_IN0, SENSORS_LM85_IN0, RW }, - LM85_SYSCTL_IN0, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN1_MIN, "in1_min", SENSORS_LM85_IN1, SENSORS_LM85_IN1, RW }, - LM85_SYSCTL_IN1, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN2_MIN, "in2_min", SENSORS_LM85_IN2, SENSORS_LM85_IN2, RW }, - LM85_SYSCTL_IN2, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN3_MIN, "in3_min", SENSORS_LM85_IN3, SENSORS_LM85_IN3, RW }, - LM85_SYSCTL_IN3, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN4_MIN, "in4_min", SENSORS_LM85_IN4, SENSORS_LM85_IN4, RW }, - LM85_SYSCTL_IN4, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN5_MIN, "in5_min", SENSORS_LM85_IN5, SENSORS_LM85_IN5, RW }, - EMC6D100_SYSCTL_IN5, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN6_MIN, "in6_min", SENSORS_LM85_IN6, SENSORS_LM85_IN6, RW }, - EMC6D100_SYSCTL_IN6, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN7_MIN, "in7_min", SENSORS_LM85_IN7, SENSORS_LM85_IN7, RW }, - EMC6D100_SYSCTL_IN7, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN0_MAX, "in0_max", SENSORS_LM85_IN0, SENSORS_LM85_IN0, RW }, - LM85_SYSCTL_IN0, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN1_MAX, "in1_max", SENSORS_LM85_IN1, SENSORS_LM85_IN1, RW }, - LM85_SYSCTL_IN1, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN2_MAX, "in2_max", SENSORS_LM85_IN2, SENSORS_LM85_IN2, RW }, - LM85_SYSCTL_IN2, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN3_MAX, "in3_max", SENSORS_LM85_IN3, SENSORS_LM85_IN3, RW }, - LM85_SYSCTL_IN3, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN4_MAX, "in4_max", SENSORS_LM85_IN4, SENSORS_LM85_IN4, RW }, - LM85_SYSCTL_IN4, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN5_MAX, "in5_max", SENSORS_LM85_IN5, SENSORS_LM85_IN5, RW }, - EMC6D100_SYSCTL_IN5, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN6_MAX, "in6_max", SENSORS_LM85_IN6, SENSORS_LM85_IN6, RW }, - EMC6D100_SYSCTL_IN6, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN7_MAX, "in7_max", SENSORS_LM85_IN7, SENSORS_LM85_IN7, RW }, - EMC6D100_SYSCTL_IN7, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_FAN1, "fan1", NOMAP, NOMAP, R }, - LM85_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_FAN2, "fan2", NOMAP, NOMAP, R }, - LM85_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_FAN3, "fan3", NOMAP, NOMAP, R }, - LM85_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_FAN4, "fan4", NOMAP, NOMAP, R }, - LM85_SYSCTL_FAN4, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_FAN1_MIN, "fan1_min", SENSORS_LM85_FAN1, SENSORS_LM85_FAN1, RW }, - LM85_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_FAN2_MIN, "fan2_min", SENSORS_LM85_FAN2, SENSORS_LM85_FAN2, RW }, - LM85_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_FAN3_MIN, "fan3_min", SENSORS_LM85_FAN3, SENSORS_LM85_FAN3, RW }, - LM85_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_FAN4_MIN, "fan4_min", SENSORS_LM85_FAN4, SENSORS_LM85_FAN4, RW }, - LM85_SYSCTL_FAN4, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_TEMP1, "temp1", NOMAP, NOMAP, R }, - LM85_SYSCTL_TEMP1, VALUE(3), 2 }, + 2 }, { { SENSORS_LM85_TEMP2, "temp2", NOMAP, NOMAP, R }, - LM85_SYSCTL_TEMP2, VALUE(3), 2 }, + 2 }, { { SENSORS_LM85_TEMP3, "temp3", NOMAP, NOMAP, R }, - LM85_SYSCTL_TEMP3, VALUE(3), 2 }, + 2 }, { { SENSORS_LM85_TEMP1_MIN, "temp1_min", SENSORS_LM85_TEMP1, SENSORS_LM85_TEMP1, RW }, - LM85_SYSCTL_TEMP1, VALUE(1), 2 }, + 2 }, { { SENSORS_LM85_TEMP2_MIN, "temp2_min", SENSORS_LM85_TEMP2, SENSORS_LM85_TEMP2, RW }, - LM85_SYSCTL_TEMP2, VALUE(1), 2 }, + 2 }, { { SENSORS_LM85_TEMP3_MIN, "temp3_min", SENSORS_LM85_TEMP3, SENSORS_LM85_TEMP3, RW }, - LM85_SYSCTL_TEMP3, VALUE(1), 2 }, + 2 }, { { SENSORS_LM85_TEMP1_MAX, "temp1_max", SENSORS_LM85_TEMP1, SENSORS_LM85_TEMP1, RW }, - LM85_SYSCTL_TEMP1, VALUE(2), 2 }, + 2 }, { { SENSORS_LM85_TEMP2_MAX, "temp2_max", SENSORS_LM85_TEMP2, SENSORS_LM85_TEMP2, RW }, - LM85_SYSCTL_TEMP2, VALUE(2), 2 }, + 2 }, { { SENSORS_LM85_TEMP3_MAX, "temp3_max", SENSORS_LM85_TEMP3, SENSORS_LM85_TEMP3, RW }, - LM85_SYSCTL_TEMP3, VALUE(2), 2 }, + 2 }, { { SENSORS_LM85_VID, "vid", NOMAP, NOMAP, R }, - LM85_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_VRM, "vrm", NOMAP, NOMAP, RW }, - LM85_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM85_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM1, "pwm1", NOMAP, NOMAP, RW }, - LM85_SYSCTL_PWM1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM2, "pwm2", NOMAP, NOMAP, RW }, - LM85_SYSCTL_PWM2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM3, "pwm3", NOMAP, NOMAP, RW }, - LM85_SYSCTL_PWM3, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM1_SPINUP, "pwm1_spinup", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_PWM2_SPINUP, "pwm2_spinup", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_PWM3_SPINUP, "pwm3_spinup", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_PWM1_MIN, "pwm1_min", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_PWM2_MIN, "pwm2_min", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_PWM3_MIN, "pwm3_min", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_PWM1_FREQ, "pwm1_freq", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_PWM2_FREQ, "pwm2_freq", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_PWM3_FREQ, "pwm3_freq", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_PWM1_MIN_CTL, "pwm1_min_ctl", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_PWM2_MIN_CTL, "pwm2_min_ctl", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_PWM3_MIN_CTL, "pwm3_min_ctl", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_PWM1_INVERT, "pwm1_invert", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(5), 0 }, + 0 }, { { SENSORS_LM85_PWM2_INVERT, "pwm2_invert", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(5), 0 }, + 0 }, { { SENSORS_LM85_PWM3_INVERT, "pwm3_invert", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(5), 0 }, + 0 }, { { SENSORS_LM85_PWM1_ZONE, "pwm1_zone", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_ZONE1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM2_ZONE, "pwm2_zone", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_ZONE2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM3_ZONE, "pwm3_zone", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_ZONE3, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_ZONE1_LIMIT, "zone1_limit", SENSORS_LM85_TEMP1, NOMAP, RW }, - LM85_SYSCTL_ZONE1, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ZONE2_LIMIT, "zone2_limit", SENSORS_LM85_TEMP2, NOMAP, RW }, - LM85_SYSCTL_ZONE2, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ZONE3_LIMIT, "zone3_limit", SENSORS_LM85_TEMP3, NOMAP, RW }, - LM85_SYSCTL_ZONE3, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ZONE1_HYST, "zone1_hyst", SENSORS_LM85_TEMP1, NOMAP, RW }, - LM85_SYSCTL_ZONE1, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_ZONE2_HYST, "zone2_hyst", SENSORS_LM85_TEMP2, NOMAP, RW }, - LM85_SYSCTL_ZONE2, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_ZONE3_HYST, "zone3_hyst", SENSORS_LM85_TEMP3, NOMAP, RW }, - LM85_SYSCTL_ZONE3, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_ZONE1_RANGE, "zone1_range", SENSORS_LM85_TEMP1, NOMAP, RW }, - LM85_SYSCTL_ZONE1, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_ZONE2_RANGE, "zone2_range", SENSORS_LM85_TEMP2, NOMAP, RW }, - LM85_SYSCTL_ZONE2, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_ZONE3_RANGE, "zone3_range", SENSORS_LM85_TEMP3, NOMAP, RW }, - LM85_SYSCTL_ZONE3, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_ZONE1_CRITICAL, "zone1_critical", SENSORS_LM85_TEMP1, NOMAP, RW }, - LM85_SYSCTL_ZONE1, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_ZONE2_CRITICAL, "zone2_critical", SENSORS_LM85_TEMP2, NOMAP, RW }, - LM85_SYSCTL_ZONE2, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_ZONE3_CRITICAL, "zone3_critical", SENSORS_LM85_TEMP3, NOMAP, RW }, - LM85_SYSCTL_ZONE3, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_PWM1_SPINUP_CTL, "pwm1_spinup_ctl", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_SPINUP_CTL, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM2_SPINUP_CTL, "pwm2_spinup_ctl", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_SPINUP_CTL, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_PWM3_SPINUP_CTL, "pwm3_spinup_ctl", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_SPINUP_CTL, VALUE(3), 0 }, + 0 }, { { SENSORS_LM85_FAN1_TACH_MODE, "fan1_tach_mode", SENSORS_LM85_FAN1, NOMAP, RW }, - LM85_SYSCTL_TACH_MODE, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_FAN2_TACH_MODE, "fan2_tach_mode", SENSORS_LM85_FAN2, NOMAP, RW }, - LM85_SYSCTL_TACH_MODE, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_FAN3_TACH_MODE, "fan3_tach_mode", SENSORS_LM85_FAN3, NOMAP, RW }, - LM85_SYSCTL_TACH_MODE, VALUE(3), 0 }, + 0 }, { { SENSORS_LM85_ZONE1_SMOOTH, "zone1_smooth", SENSORS_LM85_TEMP1, NOMAP, RW }, - LM85_SYSCTL_SMOOTH1, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ZONE2_SMOOTH, "zone2_smooth", SENSORS_LM85_TEMP2, NOMAP, RW }, - LM85_SYSCTL_SMOOTH2, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ZONE3_SMOOTH, "zone3_smooth", SENSORS_LM85_TEMP3, NOMAP, RW }, - LM85_SYSCTL_SMOOTH3, VALUE(1), 1 }, + 1 }, { { 0 }, 0 } }; @@ -3400,300 +3372,300 @@ static sensors_chip_feature lm85_features[] = static sensors_chip_feature adm1027_features[] = { { { SENSORS_LM85_IN0, "in0", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN0, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN1, "in1", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN1, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN2, "in2", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN2, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN3, "in3", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN3, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN4, "in4", NOMAP, NOMAP, R }, - LM85_SYSCTL_IN4, VALUE(3), 3 }, + 3 }, { { SENSORS_LM85_IN0_MIN, "in0_min", SENSORS_LM85_IN0, SENSORS_LM85_IN0, RW }, - LM85_SYSCTL_IN0, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN1_MIN, "in1_min", SENSORS_LM85_IN1, SENSORS_LM85_IN1, RW }, - LM85_SYSCTL_IN1, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN2_MIN, "in2_min", SENSORS_LM85_IN2, SENSORS_LM85_IN2, RW }, - LM85_SYSCTL_IN2, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN3_MIN, "in3_min", SENSORS_LM85_IN3, SENSORS_LM85_IN3, RW }, - LM85_SYSCTL_IN3, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN4_MIN, "in4_min", SENSORS_LM85_IN4, SENSORS_LM85_IN4, RW }, - LM85_SYSCTL_IN4, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_IN0_MAX, "in0_max", SENSORS_LM85_IN0, SENSORS_LM85_IN0, RW }, - LM85_SYSCTL_IN0, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN1_MAX, "in1_max", SENSORS_LM85_IN1, SENSORS_LM85_IN1, RW }, - LM85_SYSCTL_IN1, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN2_MAX, "in2_max", SENSORS_LM85_IN2, SENSORS_LM85_IN2, RW }, - LM85_SYSCTL_IN2, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN3_MAX, "in3_max", SENSORS_LM85_IN3, SENSORS_LM85_IN3, RW }, - LM85_SYSCTL_IN3, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_IN4_MAX, "in4_max", SENSORS_LM85_IN4, SENSORS_LM85_IN4, RW }, - LM85_SYSCTL_IN4, VALUE(2), 3 }, + 3 }, { { SENSORS_LM85_FAN1, "fan1", NOMAP, NOMAP, R }, - LM85_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_FAN2, "fan2", NOMAP, NOMAP, R }, - LM85_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_FAN3, "fan3", NOMAP, NOMAP, R }, - LM85_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_FAN4, "fan4", NOMAP, NOMAP, R }, - LM85_SYSCTL_FAN4, VALUE(2), 0 }, + 0 }, { { SENSORS_LM85_FAN1_MIN, "fan1_min", SENSORS_LM85_FAN1, SENSORS_LM85_FAN1, RW }, - LM85_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_FAN2_MIN, "fan2_min", SENSORS_LM85_FAN2, SENSORS_LM85_FAN2, RW }, - LM85_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_FAN3_MIN, "fan3_min", SENSORS_LM85_FAN3, SENSORS_LM85_FAN3, RW }, - LM85_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_FAN4_MIN, "fan4_min", SENSORS_LM85_FAN4, SENSORS_LM85_FAN4, RW }, - LM85_SYSCTL_FAN4, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_TEMP1, "temp1", NOMAP, NOMAP, R }, - LM85_SYSCTL_TEMP1, VALUE(3), 2 }, + 2 }, { { SENSORS_LM85_TEMP2, "temp2", NOMAP, NOMAP, R }, - LM85_SYSCTL_TEMP2, VALUE(3), 2 }, + 2 }, { { SENSORS_LM85_TEMP3, "temp3", NOMAP, NOMAP, R }, - LM85_SYSCTL_TEMP3, VALUE(3), 2 }, + 2 }, { { SENSORS_LM85_TEMP1_MIN, "temp1_min", SENSORS_LM85_TEMP1, SENSORS_LM85_TEMP1, RW }, - LM85_SYSCTL_TEMP1, VALUE(1), 2 }, + 2 }, { { SENSORS_LM85_TEMP2_MIN, "temp2_min", SENSORS_LM85_TEMP2, SENSORS_LM85_TEMP2, RW }, - LM85_SYSCTL_TEMP2, VALUE(1), 2 }, + 2 }, { { SENSORS_LM85_TEMP3_MIN, "temp3_min", SENSORS_LM85_TEMP3, SENSORS_LM85_TEMP3, RW }, - LM85_SYSCTL_TEMP3, VALUE(1), 2 }, + 2 }, { { SENSORS_LM85_TEMP1_MAX, "temp1_max", SENSORS_LM85_TEMP1, SENSORS_LM85_TEMP1, RW }, - LM85_SYSCTL_TEMP1, VALUE(2), 2 }, + 2 }, { { SENSORS_LM85_TEMP2_MAX, "temp2_max", SENSORS_LM85_TEMP2, SENSORS_LM85_TEMP2, RW }, - LM85_SYSCTL_TEMP2, VALUE(2), 2 }, + 2 }, { { SENSORS_LM85_TEMP3_MAX, "temp3_max", SENSORS_LM85_TEMP3, SENSORS_LM85_TEMP3, RW }, - LM85_SYSCTL_TEMP3, VALUE(2), 2 }, + 2 }, { { SENSORS_LM85_VID, "vid", NOMAP, NOMAP, R }, - LM85_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_LM85_VRM, "vrm", NOMAP, NOMAP, RW }, - LM85_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM85_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM1, "pwm1", NOMAP, NOMAP, RW }, - LM85_SYSCTL_PWM1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM2, "pwm2", NOMAP, NOMAP, RW }, - LM85_SYSCTL_PWM2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM3, "pwm3", NOMAP, NOMAP, RW }, - LM85_SYSCTL_PWM3, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM1_SPINUP, "pwm1_spinup", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_PWM2_SPINUP, "pwm2_spinup", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_PWM3_SPINUP, "pwm3_spinup", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_PWM1_MIN, "pwm1_min", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_PWM2_MIN, "pwm2_min", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_PWM3_MIN, "pwm3_min", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_PWM1_FREQ, "pwm1_freq", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_PWM2_FREQ, "pwm2_freq", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_PWM3_FREQ, "pwm3_freq", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_PWM1_MIN_CTL, "pwm1_min_ctl", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_PWM2_MIN_CTL, "pwm2_min_ctl", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_PWM3_MIN_CTL, "pwm3_min_ctl", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_PWM1_INVERT, "pwm1_invert", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG1, VALUE(5), 0 }, + 0 }, { { SENSORS_LM85_PWM2_INVERT, "pwm2_invert", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG2, VALUE(5), 0 }, + 0 }, { { SENSORS_LM85_PWM3_INVERT, "pwm3_invert", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_CFG3, VALUE(5), 0 }, + 0 }, { { SENSORS_LM85_PWM1_ZONE, "pwm1_zone", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_PWM_ZONE1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM2_ZONE, "pwm2_zone", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_PWM_ZONE2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_PWM3_ZONE, "pwm3_zone", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_PWM_ZONE3, VALUE(1), 0 }, + 0 }, { { SENSORS_LM85_ZONE1_LIMIT, "zone1_limit", SENSORS_LM85_TEMP1, NOMAP, RW }, - LM85_SYSCTL_ZONE1, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ZONE2_LIMIT, "zone2_limit", SENSORS_LM85_TEMP2, NOMAP, RW }, - LM85_SYSCTL_ZONE2, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ZONE3_LIMIT, "zone3_limit", SENSORS_LM85_TEMP3, NOMAP, RW }, - LM85_SYSCTL_ZONE3, VALUE(1), 1 }, + 1 }, { { SENSORS_LM85_ZONE1_HYST, "zone1_hyst", SENSORS_LM85_TEMP1, NOMAP, RW }, - LM85_SYSCTL_ZONE1, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_ZONE2_HYST, "zone2_hyst", SENSORS_LM85_TEMP2, NOMAP, RW }, - LM85_SYSCTL_ZONE2, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_ZONE3_HYST, "zone3_hyst", SENSORS_LM85_TEMP3, NOMAP, RW }, - LM85_SYSCTL_ZONE3, VALUE(2), 1 }, + 1 }, { { SENSORS_LM85_ZONE1_RANGE, "zone1_range", SENSORS_LM85_TEMP1, NOMAP, RW }, - LM85_SYSCTL_ZONE1, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_ZONE2_RANGE, "zone2_range", SENSORS_LM85_TEMP2, NOMAP, RW }, - LM85_SYSCTL_ZONE2, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_ZONE3_RANGE, "zone3_range", SENSORS_LM85_TEMP3, NOMAP, RW }, - LM85_SYSCTL_ZONE3, VALUE(3), 1 }, + 1 }, { { SENSORS_LM85_ZONE1_CRITICAL, "zone1_critical", SENSORS_LM85_TEMP1, NOMAP, RW }, - LM85_SYSCTL_ZONE1, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_ZONE2_CRITICAL, "zone2_critical", SENSORS_LM85_TEMP2, NOMAP, RW }, - LM85_SYSCTL_ZONE2, VALUE(4), 1 }, + 1 }, { { SENSORS_LM85_ZONE3_CRITICAL, "zone3_critical", SENSORS_LM85_TEMP3, NOMAP, RW }, - LM85_SYSCTL_ZONE3, VALUE(4), 1 }, + 1 }, { { SENSORS_ADM1027_FAN1_TACH_MODE, "fan1_tach_mode", SENSORS_LM85_FAN1, NOMAP, RW }, - ADM1027_SYSCTL_TACH_MODE, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1027_FAN2_TACH_MODE, "fan2_tach_mode", SENSORS_LM85_FAN2, NOMAP, RW }, - ADM1027_SYSCTL_TACH_MODE, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1027_FAN3_TACH_MODE, "fan3_tach_mode", SENSORS_LM85_FAN3, NOMAP, RW }, - ADM1027_SYSCTL_TACH_MODE, VALUE(3), 0 }, + 0 }, { { SENSORS_ADM1027_FAN4_TACH_MODE, "fan4_tach_mode", SENSORS_LM85_FAN4, NOMAP, RW }, - ADM1027_SYSCTL_TACH_MODE, VALUE(4), 0 }, + 0 }, { { SENSORS_ADM1027_PWM1_SMOOTH, "pwm1_smooth", SENSORS_LM85_PWM1, NOMAP, RW }, - LM85_SYSCTL_SMOOTH1, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1027_PWM2_SMOOTH, "pwm2_smooth", SENSORS_LM85_PWM2, NOMAP, RW }, - LM85_SYSCTL_SMOOTH2, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1027_PWM3_SMOOTH, "pwm3_smooth", SENSORS_LM85_PWM3, NOMAP, RW }, - LM85_SYSCTL_SMOOTH3, VALUE(1), 1 }, + 1 }, { { SENSORS_ADM1027_TEMP1_OFFSET, "temp1_offset", SENSORS_LM85_TEMP1, SENSORS_LM85_TEMP1, RW }, - ADM1027_SYSCTL_TEMP_OFFSET1, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1027_TEMP2_OFFSET, "temp2_offset", SENSORS_LM85_TEMP2, SENSORS_LM85_TEMP2, RW }, - ADM1027_SYSCTL_TEMP_OFFSET2, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1027_TEMP3_OFFSET, "temp3_offset", SENSORS_LM85_TEMP3, SENSORS_LM85_TEMP3, RW }, - ADM1027_SYSCTL_TEMP_OFFSET3, VALUE(1), 2 }, + 2 }, { { SENSORS_ADM1027_FAN1_PPR, "fan1_ppr", SENSORS_LM85_FAN1, NOMAP, RW }, - ADM1027_SYSCTL_FAN_PPR, VALUE(1), 0 }, + 0 }, { { SENSORS_ADM1027_FAN2_PPR, "fan2_ppr", SENSORS_LM85_FAN2, NOMAP, RW }, - ADM1027_SYSCTL_FAN_PPR, VALUE(2), 0 }, + 0 }, { { SENSORS_ADM1027_FAN3_PPR, "fan3_ppr", SENSORS_LM85_FAN3, NOMAP, RW }, - ADM1027_SYSCTL_FAN_PPR, VALUE(3), 0 }, + 0 }, { { SENSORS_ADM1027_FAN4_PPR, "fan4_ppr", SENSORS_LM85_FAN4, NOMAP, RW }, - ADM1027_SYSCTL_FAN_PPR, VALUE(4), 0 }, + 0 }, { { SENSORS_ADM1027_ALARM_MASK, "alarm_mask", NOMAP, NOMAP, RW }, - ADM1027_SYSCTL_ALARM_MASK, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature lm87_features[] = { { { SENSORS_LM87_IN0, "2.5V", NOMAP, NOMAP, R }, - LM87_SYSCTL_IN0, VALUE(3), 2, "in0_input", 3 }, + 2, "in0_input", 3 }, { { SENSORS_LM87_IN1, "Vccp1", NOMAP, NOMAP, R }, - LM87_SYSCTL_IN1, VALUE(3), 2, "in1_input", 3 }, + 2, "in1_input", 3 }, { { SENSORS_LM87_IN2, "3.3V", NOMAP, NOMAP, R }, - LM87_SYSCTL_IN2, VALUE(3), 2, "in2_input", 3 }, + 2, "in2_input", 3 }, { { SENSORS_LM87_IN3, "5V", NOMAP, NOMAP, R }, - LM87_SYSCTL_IN3, VALUE(3), 2, "in3_input", 3 }, + 2, "in3_input", 3 }, { { SENSORS_LM87_IN4, "12V", NOMAP, NOMAP, R }, - LM87_SYSCTL_IN4, VALUE(3), 2, "in4_input", 3 }, + 2, "in4_input", 3 }, { { SENSORS_LM87_IN5, "Vccp2", NOMAP, NOMAP, R }, - LM87_SYSCTL_IN5, VALUE(3), 2, "in5_input", 3 }, + 2, "in5_input", 3 }, { { SENSORS_LM87_AIN1, "AIN1", NOMAP, NOMAP, R }, - LM87_SYSCTL_AIN1, VALUE(3), 0, "in6_input", 3 }, + 0, "in6_input", 3 }, { { SENSORS_LM87_AIN2, "AIN2", NOMAP, NOMAP, R }, - LM87_SYSCTL_AIN2, VALUE(3), 0, "in7_input", 3 }, + 0, "in7_input", 3 }, { { SENSORS_LM87_IN0_MIN, "2.5V_min", SENSORS_LM87_IN0, SENSORS_LM87_IN0, RW }, - LM87_SYSCTL_IN0, VALUE(1), 2, "in0_min", 3 }, + 2, "in0_min", 3 }, { { SENSORS_LM87_IN1_MIN, "Vccp1_min", SENSORS_LM87_IN1, SENSORS_LM87_IN1, RW }, - LM87_SYSCTL_IN1, VALUE(1), 2, "in1_min", 3 }, + 2, "in1_min", 3 }, { { SENSORS_LM87_IN2_MIN, "3.3V_min", SENSORS_LM87_IN2, SENSORS_LM87_IN2, RW }, - LM87_SYSCTL_IN2, VALUE(1), 2, "in2_min", 3 }, + 2, "in2_min", 3 }, { { SENSORS_LM87_IN3_MIN, "5V_min", SENSORS_LM87_IN3, SENSORS_LM87_IN3, RW }, - LM87_SYSCTL_IN3, VALUE(1), 2, "in3_min", 3 }, + 2, "in3_min", 3 }, { { SENSORS_LM87_IN4_MIN, "12V_min", SENSORS_LM87_IN4, SENSORS_LM87_IN4, RW }, - LM87_SYSCTL_IN4, VALUE(1), 2, "in4_min", 3 }, + 2, "in4_min", 3 }, { { SENSORS_LM87_IN5_MIN, "Vccp2_min", SENSORS_LM87_IN5, SENSORS_LM87_IN5, RW }, - LM87_SYSCTL_IN5, VALUE(1), 2, "in5_min", 3 }, + 2, "in5_min", 3 }, { { SENSORS_LM87_AIN1_MIN, "AIN1_min", SENSORS_LM87_AIN1, SENSORS_LM87_AIN1, RW }, - LM87_SYSCTL_AIN1, VALUE(1), 0, "in6_min", 3 }, + 0, "in6_min", 3 }, { { SENSORS_LM87_AIN2_MIN, "AIN2_min", SENSORS_LM87_AIN2, SENSORS_LM87_AIN2, RW }, - LM87_SYSCTL_AIN2, VALUE(1), 0, "in7_min", 3 }, + 0, "in7_min", 3 }, { { SENSORS_LM87_IN0_MAX, "2.5V_max", SENSORS_LM87_IN0, SENSORS_LM87_IN0, RW }, - LM87_SYSCTL_IN0, VALUE(2), 2, "in0_max", 3 }, + 2, "in0_max", 3 }, { { SENSORS_LM87_IN1_MAX, "Vccp1_max", SENSORS_LM87_IN1, SENSORS_LM87_IN1, RW }, - LM87_SYSCTL_IN1, VALUE(2), 2, "in1_max", 3 }, + 2, "in1_max", 3 }, { { SENSORS_LM87_IN2_MAX, "3.3V_max", SENSORS_LM87_IN2, SENSORS_LM87_IN2, RW }, - LM87_SYSCTL_IN2, VALUE(2), 2, "in2_max", 3 }, + 2, "in2_max", 3 }, { { SENSORS_LM87_IN3_MAX, "5V_max", SENSORS_LM87_IN3, SENSORS_LM87_IN3, RW }, - LM87_SYSCTL_IN3, VALUE(2), 2, "in3_max", 3 }, + 2, "in3_max", 3 }, { { SENSORS_LM87_IN4_MAX, "12V_max", SENSORS_LM87_IN4, SENSORS_LM87_IN4, RW }, - LM87_SYSCTL_IN4, VALUE(2), 2, "in4_max", 3 }, + 2, "in4_max", 3 }, { { SENSORS_LM87_IN5_MAX, "Vccp2_max", SENSORS_LM87_IN5, SENSORS_LM87_IN5, RW }, - LM87_SYSCTL_IN5, VALUE(2), 2, "in5_max", 3 }, + 2, "in5_max", 3 }, { { SENSORS_LM87_AIN1_MAX, "AIN1_max", SENSORS_LM87_AIN1, SENSORS_LM87_AIN1, RW }, - LM87_SYSCTL_AIN1, VALUE(2), 0, "in6_max", 3 }, + 0, "in6_max", 3 }, { { SENSORS_LM87_AIN2_MAX, "AIN2_max", SENSORS_LM87_AIN2, SENSORS_LM87_AIN2, RW }, - LM87_SYSCTL_AIN2, VALUE(2), 0, "in7_max", 3 }, + 0, "in7_max", 3 }, { { SENSORS_LM87_FAN1, "fan1", NOMAP, NOMAP, R }, - LM87_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_LM87_FAN2, "fan2", NOMAP, NOMAP, R }, - LM87_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_LM87_FAN1_MIN, "fan1_min", SENSORS_LM87_FAN1, SENSORS_LM87_FAN1, RW }, - LM87_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_LM87_FAN2_MIN, "fan2_min", SENSORS_LM87_FAN2, SENSORS_LM87_FAN2, RW }, - LM87_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_LM87_TEMP3, "temp3", NOMAP, NOMAP, R }, - LM87_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_LM87_TEMP2, "CPU_Temp", NOMAP, NOMAP, R }, - LM87_SYSCTL_TEMP2, VALUE(3), 1, "temp2_input", 3 }, + 1, "temp2_input", 3 }, { { SENSORS_LM87_TEMP1, "temp1", NOMAP, NOMAP, R }, - LM87_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_LM87_TEMP1_HYST, "temp1_min", SENSORS_LM87_TEMP1, SENSORS_LM87_TEMP1, RW }, - LM87_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_LM87_TEMP1_OVER, "temp1_max", SENSORS_LM87_TEMP1, SENSORS_LM87_TEMP1, RW }, - LM87_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_LM87_TEMP2_HYST, "temp2_min", SENSORS_LM87_TEMP2, SENSORS_LM87_TEMP2, RW }, - LM87_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_LM87_TEMP2_OVER, "temp2_max", SENSORS_LM87_TEMP2, SENSORS_LM87_TEMP2, RW }, - LM87_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_LM87_TEMP3_HYST, "temp3_min", SENSORS_LM87_TEMP3, SENSORS_LM87_TEMP3, RW }, - LM87_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_LM87_TEMP3_OVER, "temp3_max", SENSORS_LM87_TEMP3, SENSORS_LM87_TEMP3, RW }, - LM87_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_LM87_VID, "vid", NOMAP, NOMAP, R }, - LM87_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_LM87_VRM, "vrm", NOMAP, NOMAP, RW }, - LM87_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, /* Ho hum, this will be wrong if fan1 is disabled, but fan2 isn't.. fix?? */ { { SENSORS_LM87_FAN1_DIV, "fan1_div", SENSORS_LM87_FAN1, NOMAP, RW }, - LM87_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_LM87_FAN2_DIV, "fan2_div", SENSORS_LM87_FAN2, NOMAP, RW }, - LM87_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_LM87_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM87_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_LM87_ANALOG_OUT, "analog_out", NOMAP, NOMAP, RW }, - LM87_SYSCTL_ANALOG_OUT, VALUE(1), 0 , + 0 , "aout_output", 3 }, { { 0 }, 0 } }; @@ -3701,548 +3673,548 @@ static sensors_chip_feature lm87_features[] = static sensors_chip_feature mtp008_features[] = { { { SENSORS_MTP008_IN0, "in0", NOMAP, NOMAP, R }, - MTP008_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_MTP008_IN1, "in1", NOMAP, NOMAP, R }, - MTP008_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_MTP008_IN2, "in2", NOMAP, NOMAP, R }, - MTP008_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_MTP008_IN3, "in3", NOMAP, NOMAP, R }, - MTP008_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_MTP008_IN4, "in4", NOMAP, NOMAP, R }, - MTP008_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_MTP008_IN5, "in5", NOMAP, NOMAP, R }, - MTP008_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_MTP008_IN6, "in6", NOMAP, NOMAP, R }, - MTP008_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_MTP008_IN0_MIN, "in0_min", SENSORS_MTP008_IN0, SENSORS_MTP008_IN0, RW }, - MTP008_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_MTP008_IN1_MIN, "in1_min", SENSORS_MTP008_IN1, SENSORS_MTP008_IN1, RW }, - MTP008_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_MTP008_IN2_MIN, "in2_min", SENSORS_MTP008_IN2, SENSORS_MTP008_IN2, RW }, - MTP008_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_MTP008_IN3_MIN, "in3_min", SENSORS_MTP008_IN3, SENSORS_MTP008_IN3, RW }, - MTP008_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_MTP008_IN4_MIN, "in4_min", SENSORS_MTP008_IN4, SENSORS_MTP008_IN4, RW }, - MTP008_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_MTP008_IN5_MIN, "in5_min", SENSORS_MTP008_IN5, SENSORS_MTP008_IN5, RW }, - MTP008_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_MTP008_IN6_MIN, "in6_min", SENSORS_MTP008_IN6, SENSORS_MTP008_IN6, RW }, - MTP008_SYSCTL_IN6, VALUE(1), 2 }, + 2 }, { { SENSORS_MTP008_IN0_MAX, "in0_max", SENSORS_MTP008_IN0, SENSORS_MTP008_IN0, RW }, - MTP008_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_MTP008_IN1_MAX, "in1_max", SENSORS_MTP008_IN1, SENSORS_MTP008_IN1, RW }, - MTP008_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_MTP008_IN2_MAX, "in2_max", SENSORS_MTP008_IN2, SENSORS_MTP008_IN2, RW }, - MTP008_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_MTP008_IN3_MAX, "in3_max", SENSORS_MTP008_IN3, SENSORS_MTP008_IN3, RW }, - MTP008_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_MTP008_IN4_MAX, "in4_max", SENSORS_MTP008_IN4, SENSORS_MTP008_IN4, RW }, - MTP008_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_MTP008_IN5_MAX, "in5_max", SENSORS_MTP008_IN5, SENSORS_MTP008_IN5, RW }, - MTP008_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_MTP008_IN6_MAX, "in6_max", SENSORS_MTP008_IN6, SENSORS_MTP008_IN6, RW }, - MTP008_SYSCTL_IN6, VALUE(2), 2 }, + 2 }, { { SENSORS_MTP008_FAN1, "fan1", NOMAP, NOMAP, R }, - MTP008_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_MTP008_FAN2, "fan2", NOMAP, NOMAP, R }, - MTP008_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_MTP008_FAN3, "fan3", NOMAP, NOMAP, R }, - MTP008_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_MTP008_FAN1_MIN, "fan1_min", SENSORS_MTP008_FAN1, SENSORS_MTP008_FAN1, RW }, - MTP008_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_MTP008_FAN2_MIN, "fan2_min", SENSORS_MTP008_FAN2, SENSORS_MTP008_FAN2, RW }, - MTP008_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_MTP008_FAN3_MIN, "fan3_min", SENSORS_MTP008_FAN3, SENSORS_MTP008_FAN3, RW }, - MTP008_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_MTP008_TEMP1, "temp1", NOMAP, NOMAP, R }, - MTP008_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_MTP008_TEMP2, "temp2", NOMAP, NOMAP, R }, - MTP008_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_MTP008_TEMP3, "temp3", NOMAP, NOMAP, R }, - MTP008_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_MTP008_TEMP1_OVER, "temp1_over", SENSORS_MTP008_TEMP1, SENSORS_MTP008_TEMP1, RW }, - MTP008_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_MTP008_TEMP2_OVER, "temp2_over", SENSORS_MTP008_TEMP2, SENSORS_MTP008_TEMP2, RW }, - MTP008_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_MTP008_TEMP3_OVER, "temp3_over", SENSORS_MTP008_TEMP3, SENSORS_MTP008_TEMP3, RW }, - MTP008_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_MTP008_TEMP1_HYST, "temp1_hyst", SENSORS_MTP008_TEMP1, SENSORS_MTP008_TEMP1, RW }, - MTP008_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_MTP008_TEMP2_HYST, "temp2_hyst", SENSORS_MTP008_TEMP2, SENSORS_MTP008_TEMP2, RW }, - MTP008_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_MTP008_TEMP3_HYST, "temp3_hyst", SENSORS_MTP008_TEMP3, SENSORS_MTP008_TEMP3, RW }, - MTP008_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_MTP008_VID, "vid", NOMAP, NOMAP, R }, - MTP008_SYSCTL_VID, VALUE(1), 2 }, + 2 }, { { SENSORS_MTP008_FAN1_DIV, "fan1_div", NOMAP, NOMAP, RW }, - MTP008_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_MTP008_FAN2_DIV, "fan2_div", NOMAP, NOMAP, RW }, - MTP008_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_MTP008_FAN3_DIV, "fan3_div", NOMAP, NOMAP, RW }, - MTP008_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_MTP008_ALARMS, "alarms", NOMAP, NOMAP, R }, - MTP008_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_MTP008_BEEP, "beeps", NOMAP, NOMAP, R }, - MTP008_SYSCTL_BEEP, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature ds1621_features[] = { { { SENSORS_DS1621_TEMP, "temp", NOMAP, NOMAP, R }, - DS1621_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_DS1621_TEMP_HYST, "temp_hyst", SENSORS_DS1621_TEMP, SENSORS_DS1621_TEMP, RW }, - DS1621_SYSCTL_TEMP, VALUE(2), 1, "temp1_min", + 1, "temp1_min", 3 }, { { SENSORS_DS1621_TEMP_OVER, "temp_over", SENSORS_DS1621_TEMP, SENSORS_DS1621_TEMP, RW }, - DS1621_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_DS1621_ALARMS, "alarms", NOMAP, NOMAP, R }, - DS1621_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature it87_features[] = { { { SENSORS_IT87_IN0, "in0", NOMAP, NOMAP, R }, - IT87_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_IT87_IN1, "in1", NOMAP, NOMAP, R }, - IT87_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_IT87_IN2, "in2", NOMAP, NOMAP, R }, - IT87_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_IT87_IN3, "in3", NOMAP, NOMAP, R }, - IT87_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_IT87_IN4, "in4", NOMAP, NOMAP, R }, - IT87_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_IT87_IN5, "in5", NOMAP, NOMAP, R }, - IT87_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_IT87_IN6, "in6", NOMAP, NOMAP, R }, - IT87_SYSCTL_IN6, VALUE(3), 2 }, + 2 }, { { SENSORS_IT87_IN7, "in7", NOMAP, NOMAP, R }, - IT87_SYSCTL_IN7, VALUE(3), 2 }, + 2 }, { { SENSORS_IT87_IN8, "in8", NOMAP, NOMAP, R }, - IT87_SYSCTL_IN8, VALUE(3), 2 }, + 2 }, { { SENSORS_IT87_IN0_MIN, "in0_min", SENSORS_IT87_IN0, SENSORS_IT87_IN0, RW }, - IT87_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_IT87_IN1_MIN, "in1_min", SENSORS_IT87_IN1, SENSORS_IT87_IN1, RW }, - IT87_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_IT87_IN2_MIN, "in2_min", SENSORS_IT87_IN2, SENSORS_IT87_IN2, RW }, - IT87_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_IT87_IN3_MIN, "in3_min", SENSORS_IT87_IN3, SENSORS_IT87_IN3, RW }, - IT87_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_IT87_IN4_MIN, "in4_min", SENSORS_IT87_IN4, SENSORS_IT87_IN4, RW }, - IT87_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_IT87_IN5_MIN, "in5_min", SENSORS_IT87_IN5, SENSORS_IT87_IN5, RW }, - IT87_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_IT87_IN6_MIN, "in6_min", SENSORS_IT87_IN6, SENSORS_IT87_IN6, RW }, - IT87_SYSCTL_IN6, VALUE(1), 2 }, + 2 }, { { SENSORS_IT87_IN7_MIN, "in7_min", SENSORS_IT87_IN7, SENSORS_IT87_IN7, RW }, - IT87_SYSCTL_IN7, VALUE(1), 2 }, + 2 }, { { SENSORS_IT87_IN0_MAX, "in0_max", SENSORS_IT87_IN0, SENSORS_IT87_IN0, RW }, - IT87_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_IT87_IN1_MAX, "in1_max", SENSORS_IT87_IN1, SENSORS_IT87_IN1, RW }, - IT87_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_IT87_IN2_MAX, "in2_max", SENSORS_IT87_IN2, SENSORS_IT87_IN2, RW }, - IT87_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_IT87_IN3_MAX, "in3_max", SENSORS_IT87_IN3, SENSORS_IT87_IN3, RW }, - IT87_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_IT87_IN4_MAX, "in4_max", SENSORS_IT87_IN4, SENSORS_IT87_IN4, RW }, - IT87_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_IT87_IN5_MAX, "in5_max", SENSORS_IT87_IN5, SENSORS_IT87_IN5, RW }, - IT87_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_IT87_IN6_MAX, "in6_max", SENSORS_IT87_IN6, SENSORS_IT87_IN6, RW }, - IT87_SYSCTL_IN6, VALUE(2), 2 }, + 2 }, { { SENSORS_IT87_IN7_MAX, "in7_max", SENSORS_IT87_IN7, SENSORS_IT87_IN7, RW }, - IT87_SYSCTL_IN7, VALUE(2), 2 }, + 2 }, { { SENSORS_IT87_FAN1, "fan1", NOMAP, NOMAP, R }, - IT87_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_IT87_FAN2, "fan2", NOMAP, NOMAP, R }, - IT87_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_IT87_FAN3, "fan3", NOMAP, NOMAP, R }, - IT87_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_IT87_FAN1_MIN, "fan1_min", SENSORS_IT87_FAN1, SENSORS_IT87_FAN1, RW }, - IT87_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_IT87_FAN2_MIN, "fan2_min", SENSORS_IT87_FAN2, SENSORS_IT87_FAN2, RW }, - IT87_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_IT87_FAN3_MIN, "fan3_min", SENSORS_IT87_FAN3, SENSORS_IT87_FAN3, RW }, - IT87_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_IT87_TEMP1, "temp1", NOMAP, NOMAP, R }, - IT87_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_IT87_TEMP2, "temp2", NOMAP, NOMAP, R }, - IT87_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_IT87_TEMP3, "temp3", NOMAP, NOMAP, R }, - IT87_SYSCTL_TEMP3, VALUE(3), 1 }, + 1 }, { { SENSORS_IT87_TEMP1_LOW, "temp1_low", SENSORS_IT87_TEMP1, SENSORS_IT87_TEMP1, RW }, - IT87_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_IT87_TEMP2_LOW, "temp2_low", SENSORS_IT87_TEMP2, SENSORS_IT87_TEMP2, RW }, - IT87_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_IT87_TEMP3_LOW, "temp3_low", SENSORS_IT87_TEMP3, SENSORS_IT87_TEMP3, RW }, - IT87_SYSCTL_TEMP3, VALUE(2), 1 }, + 1 }, { { SENSORS_IT87_TEMP1_HIGH, "temp1_over", SENSORS_IT87_TEMP1, SENSORS_IT87_TEMP1, RW }, - IT87_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_IT87_TEMP2_HIGH, "temp2_over", SENSORS_IT87_TEMP2, SENSORS_IT87_TEMP2, RW }, - IT87_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_IT87_TEMP3_HIGH, "temp3_over", SENSORS_IT87_TEMP3, SENSORS_IT87_TEMP3, RW }, - IT87_SYSCTL_TEMP3, VALUE(1), 1 }, + 1 }, { { SENSORS_IT87_VID, "vid", NOMAP, NOMAP, R }, - IT87_SYSCTL_VID, VALUE(1), 2 }, + 2 }, { { SENSORS_IT87_FAN1_DIV, "fan1_div", SENSORS_IT87_FAN1, NOMAP, RW }, - IT87_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_IT87_FAN2_DIV, "fan2_div", SENSORS_IT87_FAN2, NOMAP, RW }, - IT87_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_IT87_FAN3_DIV, "fan3_div", SENSORS_IT87_FAN3, NOMAP, RW }, - IT87_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_IT87_ALARMS, "alarms", NOMAP, NOMAP, R }, - IT87_SYSCTL_ALARMS, VALUE(1) }, + 0 }, { { SENSORS_IT87_SENS1, "sensor1", NOMAP, NOMAP, RW }, - IT87_SYSCTL_SENS1, VALUE(1), 0 }, + 0 }, { { SENSORS_IT87_SENS2, "sensor2", NOMAP, NOMAP, RW }, - IT87_SYSCTL_SENS2, VALUE(1), 0 }, + 0 }, { { SENSORS_IT87_SENS3, "sensor3", NOMAP, NOMAP, RW }, - IT87_SYSCTL_SENS3, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature fscpos_features[] = { { { SENSORS_FSCPOS_REV, "rev", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_REV, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_EVENT, "event", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_EVENT, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_CONTROL, "control", NOMAP, NOMAP, RW }, - FSCPOS_SYSCTL_CONTROL, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_VOLTAGE1, "volt12", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_VOLT0, VALUE(1), 2, "in0_input", + 2, "in0_input", 3 }, { { SENSORS_FSCPOS_VOLTAGE2, "volt5", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_VOLT1, VALUE(1), 2, "in1_input", + 2, "in1_input", 3 }, { { SENSORS_FSCPOS_VOLTAGE3, "voltbatt", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_VOLT2, VALUE(1), 2, "in2_input", + 2, "in2_input", 3 }, { { SENSORS_FSCPOS_TEMP1, "temp1", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_TEMP0, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCPOS_TEMP2, "temp2", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_TEMP1, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCPOS_TEMP3, "temp3", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_TEMP2, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCPOS_TEMP1_STATE, "temp1_state", SENSORS_FSCPOS_TEMP1, SENSORS_FSCPOS_TEMP1, RW }, - FSCPOS_SYSCTL_TEMP0, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_TEMP2_STATE, "temp2_state", SENSORS_FSCPOS_TEMP2, SENSORS_FSCPOS_TEMP2, RW }, - FSCPOS_SYSCTL_TEMP1, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_TEMP3_STATE, "temp3_state", SENSORS_FSCPOS_TEMP3, SENSORS_FSCPOS_TEMP3, RW }, - FSCPOS_SYSCTL_TEMP2, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_FAN1, "fan1", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_FAN0, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCPOS_FAN2, "fan2", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_FAN1, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCPOS_FAN3, "fan3", NOMAP, NOMAP, R }, - FSCPOS_SYSCTL_FAN2, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCPOS_FAN1_MIN, "fan1_min", SENSORS_FSCPOS_FAN1, SENSORS_FSCPOS_FAN1, RW }, - FSCPOS_SYSCTL_FAN0, VALUE(2), 0, "pwm1", 0 }, + 0, "pwm1", 0 }, { { SENSORS_FSCPOS_FAN2_MIN, "fan2_min", SENSORS_FSCPOS_FAN2, SENSORS_FSCPOS_FAN2, RW }, - FSCPOS_SYSCTL_FAN1, VALUE(2), 0, "pwm2", 0 }, + 0, "pwm2", 0 }, { { SENSORS_FSCPOS_FAN1_STATE, "fan1_state", SENSORS_FSCPOS_FAN1, SENSORS_FSCPOS_FAN1, RW }, - FSCPOS_SYSCTL_FAN0, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_FAN2_STATE, "fan2_state", SENSORS_FSCPOS_FAN2, SENSORS_FSCPOS_FAN2, RW }, - FSCPOS_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_FAN3_STATE, "fan3_state", SENSORS_FSCPOS_FAN3, SENSORS_FSCPOS_FAN3, RW }, - FSCPOS_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_FAN1_RIPPLE, "fan1_ripple", SENSORS_FSCPOS_FAN1, SENSORS_FSCPOS_FAN1, RW }, - FSCPOS_SYSCTL_FAN0, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCPOS_FAN2_RIPPLE, "fan2_ripple", SENSORS_FSCPOS_FAN2, SENSORS_FSCPOS_FAN2, RW }, - FSCPOS_SYSCTL_FAN1, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCPOS_FAN3_RIPPLE, "fan3_ripple", SENSORS_FSCPOS_FAN3, SENSORS_FSCPOS_FAN3, RW }, - FSCPOS_SYSCTL_FAN2, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCPOS_WDOG_PRESET, "wdog_preset", NOMAP, NOMAP, RW }, - FSCPOS_SYSCTL_WDOG, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCPOS_WDOG_STATE, "wdog_state", SENSORS_FSCPOS_WDOG_PRESET, SENSORS_FSCPOS_WDOG_PRESET, RW }, - FSCPOS_SYSCTL_WDOG, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCPOS_WDOG_CONTROL, "wdog_control", SENSORS_FSCPOS_WDOG_PRESET, SENSORS_FSCPOS_WDOG_PRESET, RW }, - FSCPOS_SYSCTL_WDOG, VALUE(3), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature fscscy_features[] = { { { SENSORS_FSCSCY_REV, "rev", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_REV, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_EVENT, "event", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_EVENT, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_CONTROL, "control", NOMAP, NOMAP, RW }, - FSCSCY_SYSCTL_CONTROL, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_VOLTAGE1, "volt12", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_VOLT0, VALUE(1), 2 }, + 2 }, { { SENSORS_FSCSCY_VOLTAGE2, "volt5", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_VOLT1, VALUE(1), 2 }, + 2 }, { { SENSORS_FSCSCY_VOLTAGE3, "voltbatt", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_VOLT2, VALUE(1), 2 }, + 2 }, { { SENSORS_FSCSCY_TEMP1, "temp1", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_TEMP0, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP2, "temp2", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_TEMP1, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP3, "temp3", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_TEMP2, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP4, "temp4", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_TEMP3, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP1_STATE, "temp1_state", SENSORS_FSCSCY_TEMP1, SENSORS_FSCSCY_TEMP1, RW }, - FSCSCY_SYSCTL_TEMP0, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP2_STATE, "temp2_state", SENSORS_FSCSCY_TEMP2, SENSORS_FSCSCY_TEMP2, RW }, - FSCSCY_SYSCTL_TEMP1, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP3_STATE, "temp3_state", SENSORS_FSCSCY_TEMP3, SENSORS_FSCSCY_TEMP3, RW }, - FSCSCY_SYSCTL_TEMP2, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP4_STATE, "temp4_state", SENSORS_FSCSCY_TEMP4, SENSORS_FSCSCY_TEMP4, RW }, - FSCSCY_SYSCTL_TEMP3, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP1_LIM, "temp1_lim", SENSORS_FSCSCY_TEMP1, SENSORS_FSCSCY_TEMP1, R }, - FSCSCY_SYSCTL_TEMP0, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP2_LIM, "temp2_lim", SENSORS_FSCSCY_TEMP2, SENSORS_FSCSCY_TEMP2, R }, - FSCSCY_SYSCTL_TEMP1, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP3_LIM, "temp3_lim", SENSORS_FSCSCY_TEMP3, SENSORS_FSCSCY_TEMP3, R }, - FSCSCY_SYSCTL_TEMP2, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP4_LIM, "temp4_lim", SENSORS_FSCSCY_TEMP4, SENSORS_FSCSCY_TEMP4, R }, - FSCSCY_SYSCTL_TEMP3, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP1_MIN, "temp1_min", SENSORS_FSCSCY_TEMP1, SENSORS_FSCSCY_TEMP1, R }, - FSCSCY_SYSCTL_TEMP0, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP2_MIN, "temp2_min", SENSORS_FSCSCY_TEMP2, SENSORS_FSCSCY_TEMP2, R }, - FSCSCY_SYSCTL_TEMP1, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP3_MIN, "temp3_min", SENSORS_FSCSCY_TEMP3, SENSORS_FSCSCY_TEMP3, R }, - FSCSCY_SYSCTL_TEMP2, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP4_MIN, "temp4_min", SENSORS_FSCSCY_TEMP4, SENSORS_FSCSCY_TEMP4, R }, - FSCSCY_SYSCTL_TEMP3, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP1_MAX, "temp1_max", SENSORS_FSCSCY_TEMP1, SENSORS_FSCSCY_TEMP1, R }, - FSCSCY_SYSCTL_TEMP0, VALUE(5), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP2_MAX, "temp2_max", SENSORS_FSCSCY_TEMP2, SENSORS_FSCSCY_TEMP2, R }, - FSCSCY_SYSCTL_TEMP1, VALUE(5), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP3_MAX, "temp3_max", SENSORS_FSCSCY_TEMP3, SENSORS_FSCSCY_TEMP3, R }, - FSCSCY_SYSCTL_TEMP2, VALUE(5), 0 }, + 0 }, { { SENSORS_FSCSCY_TEMP4_MAX, "temp4_max", SENSORS_FSCSCY_TEMP4, SENSORS_FSCSCY_TEMP4, R }, - FSCSCY_SYSCTL_TEMP3, VALUE(5), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN1, "fan1", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_FAN0, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN2, "fan2", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_FAN1, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN3, "fan3", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_FAN2, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN4, "fan4", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_FAN3, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN5, "fan5", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_FAN4, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN6, "fan6", NOMAP, NOMAP, R }, - FSCSCY_SYSCTL_FAN5, VALUE(4), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN1_MIN, "fan1_min", SENSORS_FSCSCY_FAN1, SENSORS_FSCSCY_FAN1, RW }, - FSCSCY_SYSCTL_FAN0, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN2_MIN, "fan2_min", SENSORS_FSCSCY_FAN2, SENSORS_FSCSCY_FAN2, RW }, - FSCSCY_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN3_MIN, "fan3_min", SENSORS_FSCSCY_FAN3, SENSORS_FSCSCY_FAN3, RW }, - FSCSCY_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN4_MIN, "fan4_min", SENSORS_FSCSCY_FAN4, SENSORS_FSCSCY_FAN4, RW }, - FSCSCY_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN5_MIN, "fan5_min", SENSORS_FSCSCY_FAN5, SENSORS_FSCSCY_FAN5, RW }, - FSCSCY_SYSCTL_FAN4, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN6_MIN, "fan6_min", SENSORS_FSCSCY_FAN6, SENSORS_FSCSCY_FAN6, RW }, - FSCSCY_SYSCTL_FAN5, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN1_STATE, "fan1_state", SENSORS_FSCSCY_FAN1, SENSORS_FSCSCY_FAN1, RW }, - FSCSCY_SYSCTL_FAN0, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN2_STATE, "fan2_state", SENSORS_FSCSCY_FAN2, SENSORS_FSCSCY_FAN2, RW }, - FSCSCY_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN3_STATE, "fan3_state", SENSORS_FSCSCY_FAN3, SENSORS_FSCSCY_FAN3, RW }, - FSCSCY_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN4_STATE, "fan4_state", SENSORS_FSCSCY_FAN4, SENSORS_FSCSCY_FAN4, RW }, - FSCSCY_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN5_STATE, "fan5_state", SENSORS_FSCSCY_FAN5, SENSORS_FSCSCY_FAN5, RW }, - FSCSCY_SYSCTL_FAN4, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN6_STATE, "fan6_state", SENSORS_FSCSCY_FAN6, SENSORS_FSCSCY_FAN6, RW }, - FSCSCY_SYSCTL_FAN5, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN1_RIPPLE, "fan1_ripple", SENSORS_FSCSCY_FAN1, SENSORS_FSCSCY_FAN1, RW }, - FSCSCY_SYSCTL_FAN0, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN2_RIPPLE, "fan2_ripple", SENSORS_FSCSCY_FAN2, SENSORS_FSCSCY_FAN2, RW }, - FSCSCY_SYSCTL_FAN1, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN3_RIPPLE, "fan3_ripple", SENSORS_FSCSCY_FAN3, SENSORS_FSCSCY_FAN3, RW }, - FSCSCY_SYSCTL_FAN2, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN4_RIPPLE, "fan4_ripple", SENSORS_FSCSCY_FAN4, SENSORS_FSCSCY_FAN4, RW }, - FSCSCY_SYSCTL_FAN3, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN5_RIPPLE, "fan5_ripple", SENSORS_FSCSCY_FAN5, SENSORS_FSCSCY_FAN5, RW }, - FSCSCY_SYSCTL_FAN4, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_FAN6_RIPPLE, "fan6_ripple", SENSORS_FSCSCY_FAN6, SENSORS_FSCSCY_FAN6, RW }, - FSCSCY_SYSCTL_FAN5, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCSCY_WDOG_PRESET, "wdog_preset", NOMAP, NOMAP, RW }, - FSCSCY_SYSCTL_WDOG, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCSCY_WDOG_STATE, "wdog_state", SENSORS_FSCSCY_WDOG_PRESET, SENSORS_FSCSCY_WDOG_PRESET, RW }, - FSCSCY_SYSCTL_WDOG, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCSCY_WDOG_CONTROL, "wdog_control", SENSORS_FSCSCY_WDOG_PRESET, SENSORS_FSCSCY_WDOG_PRESET, RW }, - FSCSCY_SYSCTL_WDOG, VALUE(3), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature fscher_features[] = { { { SENSORS_FSCHER_REV, "rev", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_REV, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_EVENT, "alarms", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_EVENT, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_CONTROL, "control", NOMAP, NOMAP, RW }, - FSCHER_SYSCTL_CONTROL, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_VOLTAGE1, "in0", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_VOLT0, VALUE(1), 2 }, + 2 }, { { SENSORS_FSCHER_VOLTAGE2, "in1", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_VOLT1, VALUE(1), 2 }, + 2 }, { { SENSORS_FSCHER_VOLTAGE3, "in2", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_VOLT2, VALUE(1), 2 }, + 2 }, { { SENSORS_FSCHER_TEMP1, "temp1", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_TEMP0, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCHER_TEMP2, "temp2", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_TEMP1, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCHER_TEMP3, "temp3", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_TEMP2, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCHER_TEMP1_STATE, "temp1_state", SENSORS_FSCHER_TEMP1, SENSORS_FSCHER_TEMP1, RW }, - FSCHER_SYSCTL_TEMP0, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_TEMP2_STATE, "temp2_state", SENSORS_FSCHER_TEMP2, SENSORS_FSCHER_TEMP2, RW }, - FSCHER_SYSCTL_TEMP1, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_TEMP3_STATE, "temp3_state", SENSORS_FSCHER_TEMP3, SENSORS_FSCHER_TEMP3, RW }, - FSCHER_SYSCTL_TEMP2, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_FAN1, "fan1", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_FAN0, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCHER_FAN2, "fan2", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_FAN1, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCHER_FAN3, "fan3", NOMAP, NOMAP, R }, - FSCHER_SYSCTL_FAN2, VALUE(3), 0 }, + 0 }, { { SENSORS_FSCHER_PWM1, "pwm1", SENSORS_FSCHER_FAN1, NOMAP, RW }, - FSCHER_SYSCTL_PWM0, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_PWM2, "pwm2", SENSORS_FSCHER_FAN2, NOMAP, RW }, - FSCHER_SYSCTL_PWM1, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_PWM3, "pwm3", SENSORS_FSCHER_FAN3, NOMAP, RW }, - FSCHER_SYSCTL_PWM2, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_FAN1_STATE, "fan1_state", SENSORS_FSCHER_FAN1, SENSORS_FSCHER_FAN1, RW }, - FSCHER_SYSCTL_FAN0, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_FAN2_STATE, "fan2_state", SENSORS_FSCHER_FAN2, SENSORS_FSCHER_FAN2, RW }, - FSCHER_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_FAN3_STATE, "fan3_state", SENSORS_FSCHER_FAN3, SENSORS_FSCHER_FAN3, RW }, - FSCHER_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_FAN1_RIPPLE, "fan1_ripple", SENSORS_FSCHER_FAN1, SENSORS_FSCHER_FAN1, RW }, - FSCHER_SYSCTL_FAN0, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCHER_FAN2_RIPPLE, "fan2_ripple", SENSORS_FSCHER_FAN2, SENSORS_FSCHER_FAN2, RW }, - FSCHER_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCHER_FAN3_RIPPLE, "fan3_ripple", SENSORS_FSCHER_FAN3, SENSORS_FSCHER_FAN3, RW }, - FSCHER_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCHER_WDOG_PRESET, "wdog_preset", NOMAP, NOMAP, RW }, - FSCHER_SYSCTL_WDOG, VALUE(1), 0 }, + 0 }, { { SENSORS_FSCHER_WDOG_STATE, "wdog_state", SENSORS_FSCHER_WDOG_PRESET, SENSORS_FSCHER_WDOG_PRESET, RW }, - FSCHER_SYSCTL_WDOG, VALUE(2), 0 }, + 0 }, { { SENSORS_FSCHER_WDOG_CONTROL, "wdog_control", SENSORS_FSCHER_WDOG_PRESET, SENSORS_FSCHER_WDOG_PRESET, RW }, - FSCHER_SYSCTL_WDOG, VALUE(3), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature pcf8591_features[] = { { { SENSORS_PCF8591_AIN_CONF, "ain_conf", NOMAP, NOMAP, RW }, - PCF8591_SYSCTL_AIN_CONF, VALUE(1), 0 }, + 0 }, { { SENSORS_PCF8591_CH0, "ch0", NOMAP, NOMAP, R }, - PCF8591_SYSCTL_CH0, VALUE(1), 2, "in0_input", 3 }, + 2, "in0_input", 3 }, { { SENSORS_PCF8591_CH1, "ch1", NOMAP, NOMAP, R }, - PCF8591_SYSCTL_CH1, VALUE(1), 2, "in1_input", 3 }, + 2, "in1_input", 3 }, { { SENSORS_PCF8591_CH2, "ch2", NOMAP, NOMAP, R }, - PCF8591_SYSCTL_CH2, VALUE(1), 2, "in2_input", 3 }, + 2, "in2_input", 3 }, { { SENSORS_PCF8591_CH3, "ch3", NOMAP, NOMAP, R }, - PCF8591_SYSCTL_CH3, VALUE(1), 2, "in3_input", 3 }, + 2, "in3_input", 3 }, { { SENSORS_PCF8591_AOUT_ENABLE, "aout_enable", NOMAP, NOMAP, RW }, - PCF8591_SYSCTL_AOUT_ENABLE, VALUE(1), 0, + 0, "out0_enable", 0 }, { { SENSORS_PCF8591_AOUT, "aout", NOMAP, NOMAP, RW }, - PCF8591_SYSCTL_AOUT, VALUE(1), 2, "out0_output", + 2, "out0_output", 3 }, { { 0 }, 0 } }; @@ -4251,316 +4223,316 @@ static sensors_chip_feature fscscy_features[] = static sensors_chip_feature vt1211_features[] = { { { SENSORS_VT1211_IN0, "in0", NOMAP, NOMAP, R }, - VT1211_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_VT1211_IN1, "in1", NOMAP, NOMAP, R }, - VT1211_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_VT1211_IN2, "in2", NOMAP, NOMAP, R }, - VT1211_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_VT1211_IN3, "in3", NOMAP, NOMAP, R }, - VT1211_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_VT1211_IN4, "in4", NOMAP, NOMAP, R }, - VT1211_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_VT1211_IN5, "in5", NOMAP, NOMAP, R }, - VT1211_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_VT1211_IN0_MIN, "in0_min", SENSORS_VT1211_IN0, SENSORS_VT1211_IN0, RW }, - VT1211_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_VT1211_IN1_MIN, "in1_min", SENSORS_VT1211_IN1, SENSORS_VT1211_IN1, RW }, - VT1211_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_VT1211_IN2_MIN, "in2_min", SENSORS_VT1211_IN2, SENSORS_VT1211_IN2, RW }, - VT1211_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_VT1211_IN3_MIN, "in3_min", SENSORS_VT1211_IN3, SENSORS_VT1211_IN3, RW }, - VT1211_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_VT1211_IN4_MIN, "in4_min", SENSORS_VT1211_IN4, SENSORS_VT1211_IN4, RW }, - VT1211_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_VT1211_IN5_MIN, "in5_min", SENSORS_VT1211_IN5, SENSORS_VT1211_IN5, RW }, - VT1211_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_VT1211_IN0_MAX, "in0_max", SENSORS_VT1211_IN0, SENSORS_VT1211_IN0, RW }, - VT1211_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_VT1211_IN1_MAX, "in1_max", SENSORS_VT1211_IN1, SENSORS_VT1211_IN1, RW }, - VT1211_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_VT1211_IN2_MAX, "in2_max", SENSORS_VT1211_IN2, SENSORS_VT1211_IN2, RW }, - VT1211_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_VT1211_IN3_MAX, "in3_max", SENSORS_VT1211_IN3, SENSORS_VT1211_IN3, RW }, - VT1211_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_VT1211_IN4_MAX, "in4_max", SENSORS_VT1211_IN4, SENSORS_VT1211_IN4, RW }, - VT1211_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_VT1211_IN5_MAX, "in5_max", SENSORS_VT1211_IN5, SENSORS_VT1211_IN5, RW }, - VT1211_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_VT1211_FAN1, "fan1", NOMAP, NOMAP, R }, - VT1211_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_VT1211_FAN2, "fan2", NOMAP, NOMAP, R }, - VT1211_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_VT1211_FAN1_MIN, "fan1_min", SENSORS_VT1211_FAN1, SENSORS_VT1211_FAN1, RW }, - VT1211_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_VT1211_FAN2_MIN, "fan2_min", SENSORS_VT1211_FAN2, SENSORS_VT1211_FAN2, RW }, - VT1211_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_VT1211_TEMP1, "temp1", NOMAP, NOMAP, R }, - VT1211_SYSCTL_TEMP1, VALUE(3), 1 }, + 1 }, { { SENSORS_VT1211_TEMP1_HYST, "temp1_hyst", SENSORS_VT1211_TEMP1, SENSORS_VT1211_TEMP1, RW }, - VT1211_SYSCTL_TEMP1, VALUE(2), 1 }, + 1 }, { { SENSORS_VT1211_TEMP1_OVER, "temp1_over", SENSORS_VT1211_TEMP1, SENSORS_VT1211_TEMP1, RW }, - VT1211_SYSCTL_TEMP1, VALUE(1), 1 }, + 1 }, { { SENSORS_VT1211_TEMP2, "temp2", NOMAP, NOMAP, R }, - VT1211_SYSCTL_TEMP2, VALUE(3), 1 }, + 1 }, { { SENSORS_VT1211_TEMP2_HYST, "temp2_hyst", SENSORS_VT1211_TEMP2, SENSORS_VT1211_TEMP2, RW }, - VT1211_SYSCTL_TEMP2, VALUE(2), 1 }, + 1 }, { { SENSORS_VT1211_TEMP2_OVER, "temp2_over", SENSORS_VT1211_TEMP2, SENSORS_VT1211_TEMP2, RW }, - VT1211_SYSCTL_TEMP2, VALUE(1), 1 }, + 1 }, { { SENSORS_VT1211_TEMP3, "temp3", NOMAP, NOMAP, R }, - VT1211_SYSCTL_TEMP3, VALUE(3), 3 }, + 3 }, { { SENSORS_VT1211_TEMP3_HYST, "temp3_hyst", SENSORS_VT1211_TEMP3, SENSORS_VT1211_TEMP3, RW }, - VT1211_SYSCTL_TEMP3, VALUE(2), 3 }, + 3 }, { { SENSORS_VT1211_TEMP3_OVER, "temp3_over", SENSORS_VT1211_TEMP3, SENSORS_VT1211_TEMP3, RW }, - VT1211_SYSCTL_TEMP3, VALUE(1), 3 }, + 3 }, { { SENSORS_VT1211_TEMP4, "temp4", NOMAP, NOMAP, R }, - VT1211_SYSCTL_TEMP4, VALUE(3), 3 }, + 3 }, { { SENSORS_VT1211_TEMP4_HYST, "temp4_hyst", SENSORS_VT1211_TEMP4, SENSORS_VT1211_TEMP4, RW }, - VT1211_SYSCTL_TEMP4, VALUE(2), 3 }, + 3 }, { { SENSORS_VT1211_TEMP4_OVER, "temp4_over", SENSORS_VT1211_TEMP4, SENSORS_VT1211_TEMP4, RW }, - VT1211_SYSCTL_TEMP4, VALUE(1), 3 }, + 3 }, { { SENSORS_VT1211_TEMP5, "temp5", NOMAP, NOMAP, R }, - VT1211_SYSCTL_TEMP5, VALUE(3), 3 }, + 3 }, { { SENSORS_VT1211_TEMP5_HYST, "temp5_hyst", SENSORS_VT1211_TEMP5, SENSORS_VT1211_TEMP5, RW }, - VT1211_SYSCTL_TEMP5, VALUE(2), 3 }, + 3 }, { { SENSORS_VT1211_TEMP5_OVER, "temp5_over", SENSORS_VT1211_TEMP5, SENSORS_VT1211_TEMP5, RW }, - VT1211_SYSCTL_TEMP5, VALUE(1), 3 }, + 3 }, { { SENSORS_VT1211_TEMP6, "temp6", NOMAP, NOMAP, R }, - VT1211_SYSCTL_TEMP6, VALUE(3), 3 }, + 3 }, { { SENSORS_VT1211_TEMP6_HYST, "temp6_hyst", SENSORS_VT1211_TEMP6, SENSORS_VT1211_TEMP6, RW }, - VT1211_SYSCTL_TEMP6, VALUE(2), 3 }, + 3 }, { { SENSORS_VT1211_TEMP6_OVER, "temp6_over", SENSORS_VT1211_TEMP6, SENSORS_VT1211_TEMP6, RW }, - VT1211_SYSCTL_TEMP6, VALUE(1), 3 }, + 3 }, { { SENSORS_VT1211_TEMP7, "temp7", NOMAP, NOMAP, R }, - VT1211_SYSCTL_TEMP7, VALUE(3), 3 }, + 3 }, { { SENSORS_VT1211_TEMP7_HYST, "temp7_hyst", SENSORS_VT1211_TEMP7, SENSORS_VT1211_TEMP7, RW }, - VT1211_SYSCTL_TEMP7, VALUE(2), 3 }, + 3 }, { { SENSORS_VT1211_TEMP7_OVER, "temp7_over", SENSORS_VT1211_TEMP7, SENSORS_VT1211_TEMP7, RW }, - VT1211_SYSCTL_TEMP7, VALUE(1), 3 }, + 3 }, { { SENSORS_VT1211_FAN1_DIV, "fan1_div", SENSORS_VT1211_FAN1, NOMAP, RW }, - VT1211_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_VT1211_FAN2_DIV, "fan2_div", SENSORS_VT1211_FAN2, NOMAP, RW }, - VT1211_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_VT1211_ALARMS, "alarms", NOMAP, NOMAP, R }, - VT1211_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_VT1211_VID, "vid", NOMAP, NOMAP, R }, - VT1211_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_VT1211_VRM, "vrm", NOMAP, NOMAP, RW }, - VT1211_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_VT1211_UCH, "config", NOMAP, NOMAP, RW }, - VT1211_SYSCTL_UCH, VALUE(1), 0, "uch_config" }, + 0, "uch_config" }, { { 0 }, 0 } }; static sensors_chip_feature smsc47m1_features[] = { { { SENSORS_SMSC47M1_FAN1, "fan1", NOMAP, NOMAP, R }, - SMSC47M1_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN2, "fan2", NOMAP, NOMAP, R }, - SMSC47M1_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN1_MIN, "fan1_min", SENSORS_SMSC47M1_FAN1, SENSORS_SMSC47M1_FAN1, RW }, - SMSC47M1_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN2_MIN, "fan2_min", SENSORS_SMSC47M1_FAN2, SENSORS_SMSC47M1_FAN2, RW }, - SMSC47M1_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN1_DIV, "fan1_div", SENSORS_SMSC47M1_FAN1, NOMAP, RW }, - SMSC47M1_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN2_DIV, "fan2_div", SENSORS_SMSC47M1_FAN2, NOMAP, RW }, - SMSC47M1_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M1_ALARMS, "alarms", NOMAP, NOMAP, R }, - SMSC47M1_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature smsc47m2_features[] = { { { SENSORS_SMSC47M1_FAN1, "fan1", NOMAP, NOMAP, R }, - SMSC47M1_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN2, "fan2", NOMAP, NOMAP, R }, - SMSC47M1_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN3, "fan3", NOMAP, NOMAP, R }, - SMSC47M1_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN1_MIN, "fan1_min", SENSORS_SMSC47M1_FAN1, SENSORS_SMSC47M1_FAN1, RW }, - SMSC47M1_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN2_MIN, "fan2_min", SENSORS_SMSC47M1_FAN2, SENSORS_SMSC47M1_FAN2, RW }, - SMSC47M1_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN3_MIN, "fan3_min", SENSORS_SMSC47M1_FAN3, SENSORS_SMSC47M1_FAN3, RW }, - SMSC47M1_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN1_DIV, "fan1_div", SENSORS_SMSC47M1_FAN1, NOMAP, RW }, - SMSC47M1_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN2_DIV, "fan2_div", SENSORS_SMSC47M1_FAN2, NOMAP, RW }, - SMSC47M1_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M1_FAN3_DIV, "fan3_div", SENSORS_SMSC47M1_FAN3, NOMAP, RW }, - SMSC47M1_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_SMSC47M1_ALARMS, "alarms", NOMAP, NOMAP, R }, - SMSC47M1_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature smsc47m192_features[] = { { { SENSORS_SMSC47M192_IN(0), "in0", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN(1), "in1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN(2), "in2", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN(3), "in3", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN(4), "in4", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN(5), "in5", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN(6), "in6", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN(7), "in7", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MIN(0), "in0_min", SENSORS_SMSC47M192_IN(0), SENSORS_SMSC47M192_IN(0), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MIN(1), "in1_min", SENSORS_SMSC47M192_IN(1), SENSORS_SMSC47M192_IN(1), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MIN(2), "in2_min", SENSORS_SMSC47M192_IN(2), SENSORS_SMSC47M192_IN(2), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MIN(3), "in3_min", SENSORS_SMSC47M192_IN(3), SENSORS_SMSC47M192_IN(3), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MIN(4), "in4_min", SENSORS_SMSC47M192_IN(4), SENSORS_SMSC47M192_IN(4), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MIN(5), "in5_min", SENSORS_SMSC47M192_IN(5), SENSORS_SMSC47M192_IN(5), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MIN(6), "in6_min", SENSORS_SMSC47M192_IN(6), SENSORS_SMSC47M192_IN(6), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MIN(7), "in7_min", SENSORS_SMSC47M192_IN(7), SENSORS_SMSC47M192_IN(7), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MAX(0), "in0_max", SENSORS_SMSC47M192_IN(0), SENSORS_SMSC47M192_IN(0), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MAX(1), "in1_max", SENSORS_SMSC47M192_IN(1), SENSORS_SMSC47M192_IN(1), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MAX(2), "in2_max", SENSORS_SMSC47M192_IN(2), SENSORS_SMSC47M192_IN(2), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MAX(3), "in3_max", SENSORS_SMSC47M192_IN(3), SENSORS_SMSC47M192_IN(3), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MAX(4), "in4_max", SENSORS_SMSC47M192_IN(4), SENSORS_SMSC47M192_IN(4), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MAX(5), "in5_max", SENSORS_SMSC47M192_IN(5), SENSORS_SMSC47M192_IN(5), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MAX(6), "in6_max", SENSORS_SMSC47M192_IN(6), SENSORS_SMSC47M192_IN(6), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_MAX(7), "in7_max", SENSORS_SMSC47M192_IN(7), SENSORS_SMSC47M192_IN(7), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_SMSC47M192_IN_ALARM(0), "in0_alarm", SENSORS_SMSC47M192_IN(0), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_IN_ALARM(1), "in1_alarm", SENSORS_SMSC47M192_IN(1), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_IN_ALARM(2), "in2_alarm", SENSORS_SMSC47M192_IN(2), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_IN_ALARM(3), "in3_alarm", SENSORS_SMSC47M192_IN(3), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_IN_ALARM(4), "in4_alarm", SENSORS_SMSC47M192_IN(4), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_IN_ALARM(5), "in5_alarm", SENSORS_SMSC47M192_IN(5), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_IN_ALARM(6), "in6_alarm", SENSORS_SMSC47M192_IN(6), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_IN_ALARM(7), "in7_alarm", SENSORS_SMSC47M192_IN(7), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP(1), "temp1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP(2), "temp2", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP(3), "temp3", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_MIN(1), "temp1_min", SENSORS_SMSC47M192_TEMP(1), SENSORS_SMSC47M192_TEMP(1), RW }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_MIN(2), "temp2_min", SENSORS_SMSC47M192_TEMP(2), SENSORS_SMSC47M192_TEMP(2), RW }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_MIN(3), "temp3_min", SENSORS_SMSC47M192_TEMP(3), SENSORS_SMSC47M192_TEMP(3), RW }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_MAX(1), "temp1_max", SENSORS_SMSC47M192_TEMP(1), SENSORS_SMSC47M192_TEMP(1), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_MAX(2), "temp2_max", SENSORS_SMSC47M192_TEMP(2), SENSORS_SMSC47M192_TEMP(2), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_MAX(3), "temp3_max", SENSORS_SMSC47M192_TEMP(3), SENSORS_SMSC47M192_TEMP(3), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_ALARM(1), "temp1_alarm", SENSORS_SMSC47M192_TEMP(1), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_ALARM(2), "temp2_alarm", SENSORS_SMSC47M192_TEMP(2), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_ALARM(3), "temp3_alarm", SENSORS_SMSC47M192_TEMP(3), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_FAULT(2), "temp2_input_fault", SENSORS_SMSC47M192_TEMP(2), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_TEMP_FAULT(3), "temp3_input_fault", SENSORS_SMSC47M192_TEMP(3), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_SMSC47M192_VID, "vid", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_SMSC47M192_VRM, "vrm", NOMAP, NOMAP, RW }, - NOSYSCTL, VALUE(1), 1 }, + 1 }, { { 0 }, 0 } }; @@ -4568,882 +4540,880 @@ static sensors_chip_feature smsc47m192_features[] = static sensors_chip_feature pc87360_features[] = { { { SENSORS_PC87360_FAN1, "fan1", NOMAP, NOMAP, R }, - PC87360_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_FAN2, "fan2", NOMAP, NOMAP, R }, - PC87360_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_FAN3, "fan3", NOMAP, NOMAP, R }, - PC87360_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_FAN1_MIN, "fan1_min", SENSORS_PC87360_FAN1, SENSORS_PC87360_FAN1, RW }, - PC87360_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN2_MIN, "fan2_min", SENSORS_PC87360_FAN2, SENSORS_PC87360_FAN2, RW }, - PC87360_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN3_MIN, "fan3_min", SENSORS_PC87360_FAN3, SENSORS_PC87360_FAN3, RW }, - PC87360_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN1_DIV, "fan1_div", SENSORS_PC87360_FAN1, NOMAP, R }, - PC87360_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN2_DIV, "fan2_div", SENSORS_PC87360_FAN2, NOMAP, R }, - PC87360_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_FAN3_DIV, "fan3_div", SENSORS_PC87360_FAN3, NOMAP, R }, - PC87360_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_PC87360_FAN1_STATUS, "fan1_status", SENSORS_PC87360_FAN1, NOMAP, R }, - PC87360_SYSCTL_FAN1_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN2_STATUS, "fan2_status", SENSORS_PC87360_FAN2, NOMAP, R }, - PC87360_SYSCTL_FAN2_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN3_STATUS, "fan3_status", SENSORS_PC87360_FAN3, NOMAP, R }, - PC87360_SYSCTL_FAN3_STATUS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature pc87365_features[] = { { { SENSORS_PC87360_ALARMS_IN, "alarms_in", NOMAP, NOMAP, R }, - PC87365_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_ALARMS_TEMP, "alarms_temp", NOMAP, NOMAP, R }, - PC87365_SYSCTL_ALARMS, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_FAN1, "fan1", NOMAP, NOMAP, R }, - PC87360_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_FAN2, "fan2", NOMAP, NOMAP, R }, - PC87360_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_FAN3, "fan3", NOMAP, NOMAP, R }, - PC87360_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_FAN1_MIN, "fan1_min", SENSORS_PC87360_FAN1, SENSORS_PC87360_FAN1, RW }, - PC87360_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN2_MIN, "fan2_min", SENSORS_PC87360_FAN2, SENSORS_PC87360_FAN2, RW }, - PC87360_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN3_MIN, "fan3_min", SENSORS_PC87360_FAN3, SENSORS_PC87360_FAN3, RW }, - PC87360_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN1_DIV, "fan1_div", SENSORS_PC87360_FAN1, NOMAP, R }, - PC87360_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN2_DIV, "fan2_div", SENSORS_PC87360_FAN2, NOMAP, R }, - PC87360_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_FAN3_DIV, "fan3_div", SENSORS_PC87360_FAN3, NOMAP, R }, - PC87360_SYSCTL_FAN_DIV, VALUE(3), 0 }, + 0 }, { { SENSORS_PC87360_FAN1_STATUS, "fan1_status", SENSORS_PC87360_FAN1, NOMAP, R }, - PC87360_SYSCTL_FAN1_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN2_STATUS, "fan2_status", SENSORS_PC87360_FAN2, NOMAP, R }, - PC87360_SYSCTL_FAN2_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_FAN3_STATUS, "fan3_status", SENSORS_PC87360_FAN3, NOMAP, R }, - PC87360_SYSCTL_FAN3_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN0, "in0", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN0, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN1, "in1", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN1, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN2, "in2", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN2, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN3, "in3", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN3, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN4, "in4", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN4, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN5, "in5", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN5, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN6, "in6", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN6, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN7, "in7", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN7, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN8, "in8", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN8, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN9, "in9", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN9, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN10, "in10", NOMAP, NOMAP, R }, - PC87365_SYSCTL_IN10, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_IN0_MIN, "in0_min", SENSORS_PC87360_IN0, SENSORS_PC87360_IN0, RW }, - PC87365_SYSCTL_IN0, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN1_MIN, "in1_min", SENSORS_PC87360_IN1, SENSORS_PC87360_IN1, RW }, - PC87365_SYSCTL_IN1, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN2_MIN, "in2_min", SENSORS_PC87360_IN2, SENSORS_PC87360_IN2, RW }, - PC87365_SYSCTL_IN2, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN3_MIN, "in3_min", SENSORS_PC87360_IN3, SENSORS_PC87360_IN3, RW }, - PC87365_SYSCTL_IN3, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN4_MIN, "in4_min", SENSORS_PC87360_IN4, SENSORS_PC87360_IN4, RW }, - PC87365_SYSCTL_IN4, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN5_MIN, "in5_min", SENSORS_PC87360_IN5, SENSORS_PC87360_IN5, RW }, - PC87365_SYSCTL_IN5, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN6_MIN, "in6_min", SENSORS_PC87360_IN6, SENSORS_PC87360_IN6, RW }, - PC87365_SYSCTL_IN6, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN7_MIN, "in7_min", SENSORS_PC87360_IN7, SENSORS_PC87360_IN7, RW }, - PC87365_SYSCTL_IN7, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN8_MIN, "in8_min", SENSORS_PC87360_IN8, SENSORS_PC87360_IN8, RW }, - PC87365_SYSCTL_IN8, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN9_MIN, "in9_min", SENSORS_PC87360_IN9, SENSORS_PC87360_IN9, RW }, - PC87365_SYSCTL_IN9, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN10_MIN, "in10_min", SENSORS_PC87360_IN10, SENSORS_PC87360_IN10, RW }, - PC87365_SYSCTL_IN10, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_IN0_MAX, "in0_max", SENSORS_PC87360_IN0, SENSORS_PC87360_IN0, RW }, - PC87365_SYSCTL_IN0, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN1_MAX, "in1_max", SENSORS_PC87360_IN1, SENSORS_PC87360_IN1, RW }, - PC87365_SYSCTL_IN1, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN2_MAX, "in2_max", SENSORS_PC87360_IN2, SENSORS_PC87360_IN2, RW }, - PC87365_SYSCTL_IN2, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN3_MAX, "in3_max", SENSORS_PC87360_IN3, SENSORS_PC87360_IN3, RW }, - PC87365_SYSCTL_IN3, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN4_MAX, "in4_max", SENSORS_PC87360_IN4, SENSORS_PC87360_IN4, RW }, - PC87365_SYSCTL_IN4, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN5_MAX, "in5_max", SENSORS_PC87360_IN5, SENSORS_PC87360_IN5, RW }, - PC87365_SYSCTL_IN5, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN6_MAX, "in6_max", SENSORS_PC87360_IN6, SENSORS_PC87360_IN6, RW }, - PC87365_SYSCTL_IN6, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN7_MAX, "in7_max", SENSORS_PC87360_IN7, SENSORS_PC87360_IN7, RW }, - PC87365_SYSCTL_IN7, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN8_MAX, "in8_max", SENSORS_PC87360_IN8, SENSORS_PC87360_IN8, RW }, - PC87365_SYSCTL_IN8, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN9_MAX, "in9_max", SENSORS_PC87360_IN9, SENSORS_PC87360_IN9, RW }, - PC87365_SYSCTL_IN9, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN10_MAX, "in10_max", SENSORS_PC87360_IN10, SENSORS_PC87360_IN10, RW }, - PC87365_SYSCTL_IN10, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_IN0_STATUS, "in0_status", SENSORS_PC87360_IN0, NOMAP, R }, - PC87365_SYSCTL_IN0_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN1_STATUS, "in1_status", SENSORS_PC87360_IN1, NOMAP, R }, - PC87365_SYSCTL_IN1_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN2_STATUS, "in2_status", SENSORS_PC87360_IN2, NOMAP, R }, - PC87365_SYSCTL_IN2_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN3_STATUS, "in3_status", SENSORS_PC87360_IN3, NOMAP, R }, - PC87365_SYSCTL_IN3_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN4_STATUS, "in4_status", SENSORS_PC87360_IN4, NOMAP, R }, - PC87365_SYSCTL_IN4_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN5_STATUS, "in5_status", SENSORS_PC87360_IN5, NOMAP, R }, - PC87365_SYSCTL_IN5_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN6_STATUS, "in6_status", SENSORS_PC87360_IN6, NOMAP, R }, - PC87365_SYSCTL_IN6_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN7_STATUS, "in7_status", SENSORS_PC87360_IN7, NOMAP, R }, - PC87365_SYSCTL_IN7_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN8_STATUS, "in8_status", SENSORS_PC87360_IN8, NOMAP, R }, - PC87365_SYSCTL_IN8_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN9_STATUS, "in9_status", SENSORS_PC87360_IN9, NOMAP, R }, - PC87365_SYSCTL_IN0_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_IN10_STATUS, "in10_status", SENSORS_PC87360_IN10, NOMAP, R }, - PC87365_SYSCTL_IN10_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_TEMP1, "temp1", NOMAP, NOMAP, R }, - PC87365_SYSCTL_TEMP1, VALUE(4), 0 }, + 0 }, { { SENSORS_PC87360_TEMP2, "temp2", NOMAP, NOMAP, R }, - PC87365_SYSCTL_TEMP2, VALUE(4), 0 }, + 0 }, { { SENSORS_PC87360_TEMP3, "temp3", NOMAP, NOMAP, R }, - PC87365_SYSCTL_TEMP3, VALUE(4), 0 }, + 0 }, { { SENSORS_PC87360_TEMP4, "temp4", NOMAP, NOMAP, R }, - PC87365_SYSCTL_TEMP4, VALUE(4), 3 }, + 3 }, { { SENSORS_PC87360_TEMP5, "temp5", NOMAP, NOMAP, R }, - PC87365_SYSCTL_TEMP5, VALUE(4), 3 }, + 3 }, { { SENSORS_PC87360_TEMP6, "temp6", NOMAP, NOMAP, R }, - PC87365_SYSCTL_TEMP6, VALUE(4), 3 }, + 3 }, { { SENSORS_PC87360_TEMP1_MIN, "temp1_min", SENSORS_PC87360_TEMP1, SENSORS_PC87360_TEMP1, RW }, - PC87365_SYSCTL_TEMP1, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_TEMP2_MIN, "temp2_min", SENSORS_PC87360_TEMP2, SENSORS_PC87360_TEMP2, RW }, - PC87365_SYSCTL_TEMP2, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_TEMP3_MIN, "temp3_min", SENSORS_PC87360_TEMP3, SENSORS_PC87360_TEMP3, RW }, - PC87365_SYSCTL_TEMP3, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87360_TEMP4_MIN, "temp4_min", SENSORS_PC87360_TEMP4, SENSORS_PC87360_TEMP4, RW }, - PC87365_SYSCTL_TEMP4, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_TEMP5_MIN, "temp5_min", SENSORS_PC87360_TEMP5, SENSORS_PC87360_TEMP5, RW }, - PC87365_SYSCTL_TEMP5, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_TEMP6_MIN, "temp6_min", SENSORS_PC87360_TEMP6, SENSORS_PC87360_TEMP6, RW }, - PC87365_SYSCTL_TEMP6, VALUE(2), 3 }, + 3 }, { { SENSORS_PC87360_TEMP1_MAX, "temp1_max", SENSORS_PC87360_TEMP1, SENSORS_PC87360_TEMP1, RW }, - PC87365_SYSCTL_TEMP1, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_TEMP2_MAX, "temp2_max", SENSORS_PC87360_TEMP2, SENSORS_PC87360_TEMP2, RW }, - PC87365_SYSCTL_TEMP2, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_TEMP3_MAX, "temp3_max", SENSORS_PC87360_TEMP3, SENSORS_PC87360_TEMP3, RW }, - PC87365_SYSCTL_TEMP3, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_TEMP4_MAX, "temp4_max", SENSORS_PC87360_TEMP4, SENSORS_PC87360_TEMP4, RW }, - PC87365_SYSCTL_TEMP4, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_TEMP5_MAX, "temp5_max", SENSORS_PC87360_TEMP5, SENSORS_PC87360_TEMP5, RW }, - PC87365_SYSCTL_TEMP5, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_TEMP6_MAX, "temp6_max", SENSORS_PC87360_TEMP6, SENSORS_PC87360_TEMP6, RW }, - PC87365_SYSCTL_TEMP6, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_TEMP1_CRIT, "temp1_crit", SENSORS_PC87360_TEMP1, SENSORS_PC87360_TEMP1, RW }, - PC87365_SYSCTL_TEMP1, VALUE(3), 0 }, + 0 }, { { SENSORS_PC87360_TEMP2_CRIT, "temp2_crit", SENSORS_PC87360_TEMP2, SENSORS_PC87360_TEMP2, RW }, - PC87365_SYSCTL_TEMP2, VALUE(3), 0 }, + 0 }, { { SENSORS_PC87360_TEMP3_CRIT, "temp3_crit", SENSORS_PC87360_TEMP3, SENSORS_PC87360_TEMP3, RW }, - PC87365_SYSCTL_TEMP3, VALUE(3), 0 }, + 0 }, { { SENSORS_PC87360_TEMP4_CRIT, "temp4_crit", SENSORS_PC87360_TEMP4, SENSORS_PC87360_TEMP4, RW }, - PC87365_SYSCTL_TEMP4, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_TEMP5_CRIT, "temp5_crit", SENSORS_PC87360_TEMP5, SENSORS_PC87360_TEMP5, RW }, - PC87365_SYSCTL_TEMP5, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_TEMP6_CRIT, "temp6_crit", SENSORS_PC87360_TEMP6, SENSORS_PC87360_TEMP6, RW }, - PC87365_SYSCTL_TEMP6, VALUE(3), 3 }, + 3 }, { { SENSORS_PC87360_TEMP1_STATUS, "temp1_status", SENSORS_PC87360_TEMP1, NOMAP, R }, - PC87365_SYSCTL_TEMP1_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_TEMP2_STATUS, "temp2_status", SENSORS_PC87360_TEMP2, NOMAP, R }, - PC87365_SYSCTL_TEMP2_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_TEMP3_STATUS, "temp3_status", SENSORS_PC87360_TEMP3, NOMAP, R }, - PC87365_SYSCTL_TEMP3_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_TEMP4_STATUS, "temp4_status", SENSORS_PC87360_TEMP4, NOMAP, R }, - PC87365_SYSCTL_TEMP4_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_TEMP5_STATUS, "temp5_status", SENSORS_PC87360_TEMP5, NOMAP, R }, - PC87365_SYSCTL_TEMP5_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_TEMP6_STATUS, "temp6_status", SENSORS_PC87360_TEMP6, NOMAP, R }, - PC87365_SYSCTL_TEMP6_STATUS, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87360_VID, "vid", NOMAP, NOMAP, R }, - PC87365_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_PC87360_VRM, "vrm", NOMAP, NOMAP, RW }, - PC87365_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { 0 }, 0 } }; static sensors_chip_feature pc87427_features[] = { { { SENSORS_PC87427_FAN(1), "fan1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN(2), "fan2", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN(3), "fan3", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN(4), "fan4", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN(5), "fan5", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN(6), "fan6", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN(7), "fan7", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN(8), "fan8", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN_MIN(1), "fan1_min", SENSORS_PC87427_FAN(1), SENSORS_PC87427_FAN(1), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_MIN(2), "fan2_min", SENSORS_PC87427_FAN(2), SENSORS_PC87427_FAN(2), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_MIN(3), "fan3_min", SENSORS_PC87427_FAN(3), SENSORS_PC87427_FAN(3), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_MIN(4), "fan4_min", SENSORS_PC87427_FAN(4), SENSORS_PC87427_FAN(4), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_MIN(5), "fan5_min", SENSORS_PC87427_FAN(5), SENSORS_PC87427_FAN(5), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_MIN(6), "fan6_min", SENSORS_PC87427_FAN(6), SENSORS_PC87427_FAN(6), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_MIN(7), "fan7_min", SENSORS_PC87427_FAN(7), SENSORS_PC87427_FAN(7), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_MIN(8), "fan8_min", SENSORS_PC87427_FAN(8), SENSORS_PC87427_FAN(8), RW }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_ALARM(1), "fan1_alarm", SENSORS_PC87427_FAN(1), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_ALARM(2), "fan2_alarm", SENSORS_PC87427_FAN(2), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_ALARM(3), "fan3_alarm", SENSORS_PC87427_FAN(3), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_ALARM(4), "fan4_alarm", SENSORS_PC87427_FAN(4), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_ALARM(5), "fan5_alarm", SENSORS_PC87427_FAN(5), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_ALARM(6), "fan6_alarm", SENSORS_PC87427_FAN(6), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_ALARM(7), "fan7_alarm", SENSORS_PC87427_FAN(7), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_ALARM(8), "fan8_alarm", SENSORS_PC87427_FAN(8), NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_PC87427_FAN_FAULT(1), "fan1_fault", SENSORS_PC87427_FAN(1), NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN_FAULT(2), "fan2_fault", SENSORS_PC87427_FAN(2), NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN_FAULT(3), "fan3_fault", SENSORS_PC87427_FAN(3), NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN_FAULT(4), "fan4_fault", SENSORS_PC87427_FAN(4), NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN_FAULT(5), "fan5_fault", SENSORS_PC87427_FAN(5), NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN_FAULT(6), "fan6_fault", SENSORS_PC87427_FAN(6), NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN_FAULT(7), "fan7_fault", SENSORS_PC87427_FAN(7), NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_PC87427_FAN_FAULT(8), "fan8_fault", SENSORS_PC87427_FAN(8), NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature lm92_features[] = { { { SENSORS_LM92_TEMP, "temp", NOMAP, NOMAP, R }, - LM92_SYSCTL_TEMP, VALUE(1), 4 }, + 4 }, { { SENSORS_LM92_TEMP_HIGH, "temp_high", SENSORS_LM92_TEMP, SENSORS_LM92_TEMP, RW }, - LM92_SYSCTL_TEMP, VALUE(2), 4 }, + 4 }, { { SENSORS_LM92_TEMP_LOW, "temp_low", SENSORS_LM92_TEMP, SENSORS_LM92_TEMP, RW }, - LM92_SYSCTL_TEMP, VALUE(3), 4 }, + 4 }, { { SENSORS_LM92_TEMP_CRIT, "temp_crit", SENSORS_LM92_TEMP, SENSORS_LM92_TEMP, RW }, - LM92_SYSCTL_TEMP, VALUE(4), 4 }, + 4 }, { { SENSORS_LM92_TEMP_HYST, "temp_hyst", SENSORS_LM92_TEMP, SENSORS_LM92_TEMP, RW }, - LM92_SYSCTL_TEMP, VALUE(5), 4 , + 4 , "temp1_crit_hyst", 3 }, { { SENSORS_LM92_ALARMS, "alarms", NOMAP, NOMAP, R }, - LM92_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature vt8231_features[] = { { { SENSORS_VT8231_IN0, "in0", NOMAP, NOMAP, R }, - VT8231_SYSCTL_IN0, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_IN1, "in1", NOMAP, NOMAP, R }, - VT8231_SYSCTL_IN1, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_IN2, "in2", NOMAP, NOMAP, R }, - VT8231_SYSCTL_IN2, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_IN3, "in3", NOMAP, NOMAP, R }, - VT8231_SYSCTL_IN3, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_IN4, "in4", NOMAP, NOMAP, R }, - VT8231_SYSCTL_IN4, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_IN5, "in5", NOMAP, NOMAP, R }, - VT8231_SYSCTL_IN5, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_IN0_MIN, "in0_min", SENSORS_VT8231_IN0, SENSORS_VT8231_IN0, RW }, - VT8231_SYSCTL_IN0, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_IN1_MIN, "in1_min", SENSORS_VT8231_IN1, SENSORS_VT8231_IN1, RW }, - VT8231_SYSCTL_IN1, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_IN2_MIN, "in2_min", SENSORS_VT8231_IN2, SENSORS_VT8231_IN2, RW }, - VT8231_SYSCTL_IN2, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_IN3_MIN, "in3_min", SENSORS_VT8231_IN3, SENSORS_VT8231_IN3, RW }, - VT8231_SYSCTL_IN3, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_IN4_MIN, "in4_min", SENSORS_VT8231_IN4, SENSORS_VT8231_IN4, RW }, - VT8231_SYSCTL_IN4, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_IN5_MIN, "in5_min", SENSORS_VT8231_IN5, SENSORS_VT8231_IN5, RW }, - VT8231_SYSCTL_IN5, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_IN0_MAX, "in0_max", SENSORS_VT8231_IN0, SENSORS_VT8231_IN0, RW }, - VT8231_SYSCTL_IN0, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_IN1_MAX, "in1_max", SENSORS_VT8231_IN1, SENSORS_VT8231_IN1, RW }, - VT8231_SYSCTL_IN1, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_IN2_MAX, "in2_max", SENSORS_VT8231_IN2, SENSORS_VT8231_IN2, RW }, - VT8231_SYSCTL_IN2, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_IN3_MAX, "in3_max", SENSORS_VT8231_IN3, SENSORS_VT8231_IN3, RW }, - VT8231_SYSCTL_IN3, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_IN4_MAX, "in4_max", SENSORS_VT8231_IN4, SENSORS_VT8231_IN4, RW }, - VT8231_SYSCTL_IN4, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_IN5_MAX, "in5_max", SENSORS_VT8231_IN5, SENSORS_VT8231_IN5, RW }, - VT8231_SYSCTL_IN5, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_FAN1, "fan1", NOMAP, NOMAP, R }, - VT8231_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_VT8231_FAN2, "fan2", NOMAP, NOMAP, R }, - VT8231_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_VT8231_FAN1_MIN, "fan1_min", SENSORS_VT8231_FAN1, SENSORS_VT8231_FAN1, RW }, - VT8231_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_VT8231_FAN2_MIN, "fan2_min", SENSORS_VT8231_FAN2, SENSORS_VT8231_FAN2, RW }, - VT8231_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_VT8231_TEMP, "temp1", NOMAP, NOMAP, R }, - VT8231_SYSCTL_TEMP, VALUE(3), 1 }, + 1 }, { { SENSORS_VT8231_TEMP_HYST, "temp1_hyst", SENSORS_VT8231_TEMP, SENSORS_VT8231_TEMP, RW }, - VT8231_SYSCTL_TEMP, VALUE(2), 1 }, + 1 }, { { SENSORS_VT8231_TEMP_OVER, "temp1_over", SENSORS_VT8231_TEMP, SENSORS_VT8231_TEMP, RW }, - VT8231_SYSCTL_TEMP, VALUE(1), 1 }, + 1 }, { { SENSORS_VT8231_TEMP2, "temp2", NOMAP, NOMAP, R }, - VT8231_SYSCTL_TEMP2, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_TEMP2_HYST, "temp2_hyst", SENSORS_VT8231_TEMP2, SENSORS_VT8231_TEMP2, RW }, - VT8231_SYSCTL_TEMP2, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_TEMP2_OVER, "temp2_over", SENSORS_VT8231_TEMP2, SENSORS_VT8231_TEMP2, RW }, - VT8231_SYSCTL_TEMP2, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_TEMP3, "temp3", NOMAP, NOMAP, R }, - VT8231_SYSCTL_TEMP3, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_TEMP3_HYST, "temp3_hyst", SENSORS_VT8231_TEMP3, SENSORS_VT8231_TEMP3, RW }, - VT8231_SYSCTL_TEMP3, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_TEMP3_OVER, "temp3_over", SENSORS_VT8231_TEMP3, SENSORS_VT8231_TEMP3, RW }, - VT8231_SYSCTL_TEMP3, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_TEMP4, "temp4", NOMAP, NOMAP, R }, - VT8231_SYSCTL_TEMP4, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_TEMP4_HYST, "temp4_hyst", SENSORS_VT8231_TEMP4, SENSORS_VT8231_TEMP4, RW }, - VT8231_SYSCTL_TEMP4, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_TEMP4_OVER, "temp4_over", SENSORS_VT8231_TEMP4, SENSORS_VT8231_TEMP4, RW }, - VT8231_SYSCTL_TEMP4, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_TEMP5, "temp5", NOMAP, NOMAP, R }, - VT8231_SYSCTL_TEMP5, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_TEMP5_HYST, "temp5_hyst", SENSORS_VT8231_TEMP5, SENSORS_VT8231_TEMP5, RW }, - VT8231_SYSCTL_TEMP5, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_TEMP5_OVER, "temp5_over", SENSORS_VT8231_TEMP5, SENSORS_VT8231_TEMP5, RW }, - VT8231_SYSCTL_TEMP5, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_TEMP6, "temp6", NOMAP, NOMAP, R }, - VT8231_SYSCTL_TEMP6, VALUE(3), 2 }, + 2 }, { { SENSORS_VT8231_TEMP6_HYST, "temp6_hyst", SENSORS_VT8231_TEMP6, SENSORS_VT8231_TEMP6, RW }, - VT8231_SYSCTL_TEMP6, VALUE(2), 2 }, + 2 }, { { SENSORS_VT8231_TEMP6_OVER, "temp6_over", SENSORS_VT8231_TEMP6, SENSORS_VT8231_TEMP6, RW }, - VT8231_SYSCTL_TEMP6, VALUE(1), 2 }, + 2 }, { { SENSORS_VT8231_FAN1_DIV, "fan1_div", SENSORS_VT8231_FAN1, NOMAP, RW }, - VT8231_SYSCTL_FAN_DIV, VALUE(1), 0 }, + 0 }, { { SENSORS_VT8231_FAN2_DIV, "fan2_div", SENSORS_VT8231_FAN2, NOMAP, RW }, - VT8231_SYSCTL_FAN_DIV, VALUE(2), 0 }, + 0 }, { { SENSORS_VT8231_ALARMS, "alarms", NOMAP, NOMAP, R }, - VT8231_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { SENSORS_VT8231_VID, "vid", NOMAP, NOMAP, R }, - VT8231_SYSCTL_VID, VALUE(1), 3 }, + 3 }, { { SENSORS_VT8231_VRM, "vrm", NOMAP, NOMAP, RW }, - VT8231_SYSCTL_VRM, VALUE(1), 1 }, + 1 }, { { SENSORS_VT8231_UCH, "config", NOMAP, NOMAP, RW }, - VT8231_SYSCTL_UCH, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature bmc_features[] = { { { SENSORS_BMC_IN1, "in1", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1, VALUE(3), 3 , "in1_input", 3}, + 3 , "in1_input", 3}, { { SENSORS_BMC_IN1_MIN, "in1_min", SENSORS_BMC_IN1, SENSORS_BMC_IN1, RW }, - BMC_SYSCTL_IN1, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX, "in1_max", SENSORS_BMC_IN1, SENSORS_BMC_IN1, RW }, - BMC_SYSCTL_IN1, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+1, "in2", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+1, VALUE(3), 3 , "in2_input", 3}, + 3 , "in2_input", 3}, { { SENSORS_BMC_IN1_MIN+1, "in2_min", SENSORS_BMC_IN1+1, SENSORS_BMC_IN1+1, RW }, - BMC_SYSCTL_IN1+1, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+1, "in2_max", SENSORS_BMC_IN1+1, SENSORS_BMC_IN1+1, RW }, - BMC_SYSCTL_IN1+1, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+2, "in3", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+2, VALUE(3), 3 , "in2_input", 3}, + 3 , "in2_input", 3}, { { SENSORS_BMC_IN1_MIN+2, "in3_min", SENSORS_BMC_IN1+2, SENSORS_BMC_IN1+2, RW }, - BMC_SYSCTL_IN1+2, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+2, "in3_max", SENSORS_BMC_IN1+2, SENSORS_BMC_IN1+2, RW }, - BMC_SYSCTL_IN1+2, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+3, "in4", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+3, VALUE(3), 3 , "in3_input", 3}, + 3 , "in3_input", 3}, { { SENSORS_BMC_IN1_MIN+3, "in4_min", SENSORS_BMC_IN1+3, SENSORS_BMC_IN1+3, RW }, - BMC_SYSCTL_IN1+3, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+3, "in4_max", SENSORS_BMC_IN1+3, SENSORS_BMC_IN1+3, RW }, - BMC_SYSCTL_IN1+3, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+4, "in5", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+4, VALUE(3), 3 , "in4_input", 3}, + 3 , "in4_input", 3}, { { SENSORS_BMC_IN1_MIN+4, "in5_min", SENSORS_BMC_IN1+4, SENSORS_BMC_IN1+4, RW }, - BMC_SYSCTL_IN1+4, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+4, "in5_max", SENSORS_BMC_IN1+4, SENSORS_BMC_IN1+4, RW }, - BMC_SYSCTL_IN1+4, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+5, "in6", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+5, VALUE(3), 3 , "in5_input", 3}, + 3 , "in5_input", 3}, { { SENSORS_BMC_IN1_MIN+5, "in6_min", SENSORS_BMC_IN1+5, SENSORS_BMC_IN1+5, RW }, - BMC_SYSCTL_IN1+5, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+5, "in6_max", SENSORS_BMC_IN1+5, SENSORS_BMC_IN1+5, RW }, - BMC_SYSCTL_IN1+5, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+6, "in7", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+6, VALUE(3), 3 , "in6_input", 3}, + 3 , "in6_input", 3}, { { SENSORS_BMC_IN1_MIN+6, "in7_min", SENSORS_BMC_IN1+6, SENSORS_BMC_IN1+6, RW }, - BMC_SYSCTL_IN1+6, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+6, "in7_max", SENSORS_BMC_IN1+6, SENSORS_BMC_IN1+6, RW }, - BMC_SYSCTL_IN1+6, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+7, "in8", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+7, VALUE(3), 3 , "in7_input", 3}, + 3 , "in7_input", 3}, { { SENSORS_BMC_IN1_MIN+7, "in8_min", SENSORS_BMC_IN1+7, SENSORS_BMC_IN1+7, RW }, - BMC_SYSCTL_IN1+7, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+7, "in8_max", SENSORS_BMC_IN1+7, SENSORS_BMC_IN1+7, RW }, - BMC_SYSCTL_IN1+7, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+8, "in9", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+8, VALUE(3), 3 , "in8_input", 3}, + 3 , "in8_input", 3}, { { SENSORS_BMC_IN1_MIN+8, "in9_min", SENSORS_BMC_IN1+8, SENSORS_BMC_IN1+8, RW }, - BMC_SYSCTL_IN1+8, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+8, "in9_max", SENSORS_BMC_IN1+8, SENSORS_BMC_IN1+8, RW }, - BMC_SYSCTL_IN1+8, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+9, "in10", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+9, VALUE(3), 3 , "in9_input", 3}, + 3 , "in9_input", 3}, { { SENSORS_BMC_IN1_MIN+9, "in10_min", SENSORS_BMC_IN1+9, SENSORS_BMC_IN1+9, RW }, - BMC_SYSCTL_IN1+9, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+9, "in10_max", SENSORS_BMC_IN1+9, SENSORS_BMC_IN1+9, RW }, - BMC_SYSCTL_IN1+9, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+10, "in11", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+10, VALUE(3), 3 , "in10_input", 3}, + 3 , "in10_input", 3}, { { SENSORS_BMC_IN1_MIN+10, "in11_min", SENSORS_BMC_IN1+10, SENSORS_BMC_IN1+10, RW }, - BMC_SYSCTL_IN1+10, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+10, "in11_max", SENSORS_BMC_IN1+10, SENSORS_BMC_IN1+10, RW }, - BMC_SYSCTL_IN1+10, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+11, "in12", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+11, VALUE(3), 3 , "in11_input", 3}, + 3 , "in11_input", 3}, { { SENSORS_BMC_IN1_MIN+11, "in12_min", SENSORS_BMC_IN1+11, SENSORS_BMC_IN1+11, RW }, - BMC_SYSCTL_IN1+11, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+11, "in12_max", SENSORS_BMC_IN1+11, SENSORS_BMC_IN1+11, RW }, - BMC_SYSCTL_IN1+11, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+12, "in13", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+12, VALUE(3), 3 , "in12_input", 3}, + 3 , "in12_input", 3}, { { SENSORS_BMC_IN1_MIN+12, "in13_min", SENSORS_BMC_IN1+12, SENSORS_BMC_IN1+12, RW }, - BMC_SYSCTL_IN1+12, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+12, "in13_max", SENSORS_BMC_IN1+12, SENSORS_BMC_IN1+12, RW }, - BMC_SYSCTL_IN1+12, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+13, "in14", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+13, VALUE(3), 3 , "in13_input", 3}, + 3 , "in13_input", 3}, { { SENSORS_BMC_IN1_MIN+13, "in14_min", SENSORS_BMC_IN1+13, SENSORS_BMC_IN1+13, RW }, - BMC_SYSCTL_IN1+13, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+13, "in14_max", SENSORS_BMC_IN1+13, SENSORS_BMC_IN1+13, RW }, - BMC_SYSCTL_IN1+13, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+14, "in15", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+14, VALUE(3), 3 , "in14_input", 3}, + 3 , "in14_input", 3}, { { SENSORS_BMC_IN1_MIN+14, "in15_min", SENSORS_BMC_IN1+14, SENSORS_BMC_IN1+14, RW }, - BMC_SYSCTL_IN1+14, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+14, "in15_max", SENSORS_BMC_IN1+14, SENSORS_BMC_IN1+14, RW }, - BMC_SYSCTL_IN1+14, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+15, "in16", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+15, VALUE(3), 3 , "in15_input", 3}, + 3 , "in15_input", 3}, { { SENSORS_BMC_IN1_MIN+15, "in16_min", SENSORS_BMC_IN1+15, SENSORS_BMC_IN1+15, RW }, - BMC_SYSCTL_IN1+15, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+15, "in16_max", SENSORS_BMC_IN1+15, SENSORS_BMC_IN1+15, RW }, - BMC_SYSCTL_IN1+15, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+16, "in17", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+16, VALUE(3), 3 , "in16_input", 3}, + 3 , "in16_input", 3}, { { SENSORS_BMC_IN1_MIN+16, "in17_min", SENSORS_BMC_IN1+16, SENSORS_BMC_IN1+16, RW }, - BMC_SYSCTL_IN1+16, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+16, "in17_max", SENSORS_BMC_IN1+16, SENSORS_BMC_IN1+16, RW }, - BMC_SYSCTL_IN1+16, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+17, "in18", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+17, VALUE(3), 3, "in17_input", 3 }, + 3, "in17_input", 3 }, { { SENSORS_BMC_IN1_MIN+17, "in18_min", SENSORS_BMC_IN1+17, SENSORS_BMC_IN1+17, RW }, - BMC_SYSCTL_IN1+17, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+17, "in18_max", SENSORS_BMC_IN1+17, SENSORS_BMC_IN1+17, RW }, - BMC_SYSCTL_IN1+17, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+18, "in19", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+18, VALUE(3), 3 , "in18_input", 3}, + 3 , "in18_input", 3}, { { SENSORS_BMC_IN1_MIN+18, "in19_min", SENSORS_BMC_IN1+18, SENSORS_BMC_IN1+18, RW }, - BMC_SYSCTL_IN1+18, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+18, "in19_max", SENSORS_BMC_IN1+18, SENSORS_BMC_IN1+18, RW }, - BMC_SYSCTL_IN1+18, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_IN1+19, "in20", NOMAP, NOMAP, R }, - BMC_SYSCTL_IN1+19, VALUE(3), 3 , "in19_input", 3}, + 3 , "in19_input", 3}, { { SENSORS_BMC_IN1_MIN+19, "in20_min", SENSORS_BMC_IN1+19, SENSORS_BMC_IN1+19, RW }, - BMC_SYSCTL_IN1+19, VALUE(1), 3 }, + 3 }, { { SENSORS_BMC_IN1_MAX+19, "in20_max", SENSORS_BMC_IN1+19, SENSORS_BMC_IN1+19, RW }, - BMC_SYSCTL_IN1+19, VALUE(2), 3 }, + 3 }, { { SENSORS_BMC_FAN1, "fan1", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1, VALUE(2), 0, "fan1_input", 0}, + 0, "fan1_input", 0}, { { SENSORS_BMC_FAN1+1, "fan2", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1+1, VALUE(2), 0, "fan2_input", 0 }, + 0, "fan2_input", 0 }, { { SENSORS_BMC_FAN1+2, "fan3", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1+2, VALUE(2), 0, "fan3_input", 0 }, + 0, "fan3_input", 0 }, { { SENSORS_BMC_FAN1+3, "fan4", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1+3, VALUE(2), 0, "fan4_input", 0 }, + 0, "fan4_input", 0 }, { { SENSORS_BMC_FAN1+4, "fan5", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1+4, VALUE(2), 0, "fan5_input", 0 }, + 0, "fan5_input", 0 }, { { SENSORS_BMC_FAN1+5, "fan6", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1+5, VALUE(2), 0, "fan6_input", 0 }, + 0, "fan6_input", 0 }, { { SENSORS_BMC_FAN1+6, "fan7", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1+6, VALUE(2), 0, "fan7_input", 0 }, + 0, "fan7_input", 0 }, { { SENSORS_BMC_FAN1+7, "fan8", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1+7, VALUE(2), 0, "fan8_input", 0 }, + 0, "fan8_input", 0 }, { { SENSORS_BMC_FAN1+8, "fan9", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1+8, VALUE(2), 0, "fan9_input", 0 }, + 0, "fan9_input", 0 }, { { SENSORS_BMC_FAN1+9, "fan10", NOMAP, NOMAP, R }, - BMC_SYSCTL_FAN1+9, VALUE(2), 0, "fan10_input", 0 }, + 0, "fan10_input", 0 }, { { SENSORS_BMC_FAN1_MIN, "fan1_min", SENSORS_BMC_FAN1, SENSORS_BMC_FAN1, RW }, - BMC_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_FAN1_MIN+1, "fan2_min", SENSORS_BMC_FAN1+1, SENSORS_BMC_FAN1+1, RW }, - BMC_SYSCTL_FAN1+1, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_FAN1_MIN+2, "fan3_min", SENSORS_BMC_FAN1+2, SENSORS_BMC_FAN1+2, RW }, - BMC_SYSCTL_FAN1+2, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_FAN1_MIN+3, "fan4_min", SENSORS_BMC_FAN1+3, SENSORS_BMC_FAN1+3, RW }, - BMC_SYSCTL_FAN1+3, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_FAN1_MIN+4, "fan5_min", SENSORS_BMC_FAN1+4, SENSORS_BMC_FAN1+4, RW }, - BMC_SYSCTL_FAN1+4, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_FAN1_MIN+5, "fan6_min", SENSORS_BMC_FAN1+5, SENSORS_BMC_FAN1+5, RW }, - BMC_SYSCTL_FAN1+5, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_FAN1_MIN+6, "fan7_min", SENSORS_BMC_FAN1+6, SENSORS_BMC_FAN1+6, RW }, - BMC_SYSCTL_FAN1+6, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_FAN1_MIN+7, "fan8_min", SENSORS_BMC_FAN1+7, SENSORS_BMC_FAN1+7, RW }, - BMC_SYSCTL_FAN1+7, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_FAN1_MIN+8, "fan9_min", SENSORS_BMC_FAN1+8, SENSORS_BMC_FAN1+8, RW }, - BMC_SYSCTL_FAN1+8, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_FAN1_MIN+9, "fan10_min", SENSORS_BMC_FAN1+9, SENSORS_BMC_FAN1+9, RW }, - BMC_SYSCTL_FAN1+9, VALUE(1), 0 }, + 0 }, { { SENSORS_BMC_TEMP1, "temp1", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1, VALUE(3), 2 , "temp1_input", 3 }, + 2 , "temp1_input", 3 }, { { SENSORS_BMC_TEMP1_MIN, "temp1_min", SENSORS_BMC_TEMP1, SENSORS_BMC_TEMP1, RW }, - BMC_SYSCTL_TEMP1, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX, "temp1_max", SENSORS_BMC_TEMP1, SENSORS_BMC_TEMP1, RW }, - BMC_SYSCTL_TEMP1, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_TEMP1+1, "temp2", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1+1, VALUE(3), 2 , "temp2_input", + 2 , "temp2_input", 2 }, { { SENSORS_BMC_TEMP1_MIN+1, "temp2_min", SENSORS_BMC_TEMP1+1, SENSORS_BMC_TEMP1+1, RW }, - BMC_SYSCTL_TEMP1+1, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX+1, "temp2_max", SENSORS_BMC_TEMP1+1, SENSORS_BMC_TEMP1+1, RW }, - BMC_SYSCTL_TEMP1+1, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_TEMP1+2, "temp3", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1+2, VALUE(3), 2 , "temp3_input", + 2 , "temp3_input", 2 }, { { SENSORS_BMC_TEMP1_MIN+2, "temp3_min", SENSORS_BMC_TEMP1+2, SENSORS_BMC_TEMP1+2, RW }, - BMC_SYSCTL_TEMP1+2, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX+2, "temp3_max", SENSORS_BMC_TEMP1+2, SENSORS_BMC_TEMP1+2, RW }, - BMC_SYSCTL_TEMP1+2, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_TEMP1+3, "temp4", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1+3, VALUE(3), 2, "temp4_input", 2 }, + 2, "temp4_input", 2 }, { { SENSORS_BMC_TEMP1_MIN+3, "temp4_min", SENSORS_BMC_TEMP1+3, SENSORS_BMC_TEMP1+3, RW }, - BMC_SYSCTL_TEMP1+3, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX+3, "temp4_max", SENSORS_BMC_TEMP1+3, SENSORS_BMC_TEMP1+3, RW }, - BMC_SYSCTL_TEMP1+3, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_TEMP1+4, "temp5", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1+4, VALUE(3), 2, "temp5_input", 2 }, + 2, "temp5_input", 2 }, { { SENSORS_BMC_TEMP1_MIN+4, "temp5_min", SENSORS_BMC_TEMP1+4, SENSORS_BMC_TEMP1+4, RW }, - BMC_SYSCTL_TEMP1+4, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX+4, "temp5_max", SENSORS_BMC_TEMP1+4, SENSORS_BMC_TEMP1+4, RW }, - BMC_SYSCTL_TEMP1+4, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_TEMP1+5, "temp6", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1+5, VALUE(3), 2, "temp6_input", 2 }, + 2, "temp6_input", 2 }, { { SENSORS_BMC_TEMP1_MIN+5, "temp6_min", SENSORS_BMC_TEMP1+5, SENSORS_BMC_TEMP1+5, RW }, - BMC_SYSCTL_TEMP1+5, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX+5, "temp6_max", SENSORS_BMC_TEMP1+5, SENSORS_BMC_TEMP1+5, RW }, - BMC_SYSCTL_TEMP1+5, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_TEMP1+6, "temp7", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1+6, VALUE(3), 2, "temp7_input", + 2, "temp7_input", 2 }, { { SENSORS_BMC_TEMP1_MIN+6, "temp7_min", SENSORS_BMC_TEMP1+6, SENSORS_BMC_TEMP1+6, RW }, - BMC_SYSCTL_TEMP1+6, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX+6, "temp7_max", SENSORS_BMC_TEMP1+6, SENSORS_BMC_TEMP1+6, RW }, - BMC_SYSCTL_TEMP1+6, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_TEMP1+7, "temp8", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1+7, VALUE(3), 2, "temp8_input", + 2, "temp8_input", 2 }, { { SENSORS_BMC_TEMP1_MIN+7, "temp8_min", SENSORS_BMC_TEMP1+7, SENSORS_BMC_TEMP1+7, RW }, - BMC_SYSCTL_TEMP1+7, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX+7, "temp8_max", SENSORS_BMC_TEMP1+7, SENSORS_BMC_TEMP1+7, RW }, - BMC_SYSCTL_TEMP1+7, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_TEMP1+8, "temp9", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1+8, VALUE(3), 2, "temp9_input", + 2, "temp9_input", 2 }, { { SENSORS_BMC_TEMP1_MIN+8, "temp9_min", SENSORS_BMC_TEMP1+8, SENSORS_BMC_TEMP1+8, RW }, - BMC_SYSCTL_TEMP1+8, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX+8, "temp9_max", SENSORS_BMC_TEMP1+8, SENSORS_BMC_TEMP1+8, RW }, - BMC_SYSCTL_TEMP1+8, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_TEMP1+9, "temp10", NOMAP, NOMAP, R }, - BMC_SYSCTL_TEMP1+9, VALUE(3), 2, "temp10_input", + 2, "temp10_input", 2 }, { { SENSORS_BMC_TEMP1_MIN+9, "temp10_min", SENSORS_BMC_TEMP1+9, SENSORS_BMC_TEMP1+9, RW }, - BMC_SYSCTL_TEMP1+9, VALUE(2), 2 }, + 2 }, { { SENSORS_BMC_TEMP1_MAX+9, "temp10_max", SENSORS_BMC_TEMP1+9, SENSORS_BMC_TEMP1+9, RW }, - BMC_SYSCTL_TEMP1+9, VALUE(1), 2 }, + 2 }, { { SENSORS_BMC_ALARMS, "alarms", NOMAP, NOMAP, R }, - BMC_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature xeontemp_features[] = { { { SENSORS_XEONTEMP_REMOTE_TEMP, "temp", NOMAP, NOMAP, R }, - XEONTEMP_SYSCTL_REMOTE_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_XEONTEMP_REMOTE_TEMP_HYST, "temp_low", SENSORS_XEONTEMP_REMOTE_TEMP, SENSORS_XEONTEMP_REMOTE_TEMP, RW }, - XEONTEMP_SYSCTL_REMOTE_TEMP, VALUE(2), + 0 }, { { SENSORS_XEONTEMP_REMOTE_TEMP_OVER, "temp_over", SENSORS_XEONTEMP_REMOTE_TEMP, SENSORS_XEONTEMP_REMOTE_TEMP, RW }, - XEONTEMP_SYSCTL_REMOTE_TEMP, VALUE(1), + 0 }, { { SENSORS_XEONTEMP_ALARMS, "alarms", NOMAP, NOMAP, R }, - XEONTEMP_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature max1619_features[] = { { { SENSORS_MAX1619_LOCAL_TEMP, "temp1", NOMAP, NOMAP, R }, - MAX1619_SYSCTL_LOCAL_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_MAX1619_REMOTE_TEMP, "temp2", NOMAP, NOMAP, R }, - MAX1619_SYSCTL_REMOTE_TEMP, VALUE(3), 0 }, + 0 }, { { SENSORS_MAX1619_REMOTE_LOW, "temp2_min", SENSORS_MAX1619_REMOTE_TEMP, SENSORS_MAX1619_REMOTE_TEMP, RW }, - MAX1619_SYSCTL_REMOTE_TEMP, VALUE(2), 0 }, + 0 }, { { SENSORS_MAX1619_REMOTE_HIGH, "temp2_max", SENSORS_MAX1619_REMOTE_TEMP, SENSORS_MAX1619_REMOTE_TEMP, RW }, - MAX1619_SYSCTL_REMOTE_TEMP, VALUE(1), 0 }, + 0 }, { { SENSORS_MAX1619_REMOTE_MAX, "temp2_crit", SENSORS_MAX1619_REMOTE_TEMP, SENSORS_MAX1619_REMOTE_TEMP, RW }, - MAX1619_SYSCTL_REMOTE_CRIT, VALUE(1), 0 }, + 0 }, { { SENSORS_MAX1619_REMOTE_HYST, "temp2_hyst", SENSORS_MAX1619_REMOTE_TEMP, SENSORS_MAX1619_REMOTE_TEMP, RW }, - MAX1619_SYSCTL_REMOTE_CRIT, VALUE(2), 0, + 0, "temp2_crit_hyst", 3 }, { { SENSORS_MAX1619_ALARMS, "alarms", NOMAP, NOMAP, R }, - MAX1619_SYSCTL_ALARMS, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature max6650_features[] = { { { SENSORS_MAX6650_FAN1_TACH, "fan1", NOMAP, NOMAP, R }, - MAX6650_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_MAX6650_FAN2_TACH, "fan2", NOMAP, NOMAP, R }, - MAX6650_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_MAX6650_FAN3_TACH, "fan3", NOMAP, NOMAP, R }, - MAX6650_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, { { SENSORS_MAX6650_FAN4_TACH, "fan4", NOMAP, NOMAP, R }, - MAX6650_SYSCTL_FAN4, VALUE(1), 0 }, + 0 }, { { SENSORS_MAX6650_SPEED, "speed", SENSORS_MAX6650_FAN1_TACH, SENSORS_MAX6650_FAN1_TACH, RW }, - MAX6650_SYSCTL_SPEED, VALUE(1), 0, + 0, "fan1_target", 0 }, { { 0 }, 0 } }; #define SENSORS_SMSC47B397_TEMP(nr) \ - { { SENSORS_SMSC47B397_TEMP##nr, "temp" #nr, NOMAP, NOMAP, R }, \ - 0, VALUE(1), 1 } + { { SENSORS_SMSC47B397_TEMP##nr, "temp" #nr, NOMAP, NOMAP, R }, 0 } #define SENSORS_SMSC47B397_FAN(nr) \ - { { SENSORS_SMSC47B397_FAN##nr, "fan" #nr, NOMAP, NOMAP, R }, \ - 0, VALUE(1), 1 } + { { SENSORS_SMSC47B397_FAN##nr, "fan" #nr, NOMAP, NOMAP, R }, 0 } static sensors_chip_feature smsc47b397_features[] = { @@ -5462,188 +5432,188 @@ static sensors_chip_feature f71805f_features[] = { /* 9 to 11 voltage inputs */ { { SENSORS_F71805F_IN(0), "in0", NOMAP, NOMAP, R }, - F71805F_SYSCTL_IN0, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(1), "in1", NOMAP, NOMAP, R }, - F71805F_SYSCTL_IN1, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(2), "in2", NOMAP, NOMAP, R }, - F71805F_SYSCTL_IN2, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(3), "in3", NOMAP, NOMAP, R }, - F71805F_SYSCTL_IN3, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(4), "in4", NOMAP, NOMAP, R }, - F71805F_SYSCTL_IN4, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(5), "in5", NOMAP, NOMAP, R }, - F71805F_SYSCTL_IN5, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(6), "in6", NOMAP, NOMAP, R }, - F71805F_SYSCTL_IN6, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(7), "in7", NOMAP, NOMAP, R }, - F71805F_SYSCTL_IN7, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(8), "in8", NOMAP, NOMAP, R }, - F71805F_SYSCTL_IN8, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(9), "in9", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN(10), "in10", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(3), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(0), "in0_min", SENSORS_F71805F_IN(0), SENSORS_F71805F_IN(0), RW }, - F71805F_SYSCTL_IN0, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(1), "in1_min", SENSORS_F71805F_IN(1), SENSORS_F71805F_IN(1), RW }, - F71805F_SYSCTL_IN1, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(2), "in2_min", SENSORS_F71805F_IN(2), SENSORS_F71805F_IN(2), RW }, - F71805F_SYSCTL_IN2, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(3), "in3_min", SENSORS_F71805F_IN(3), SENSORS_F71805F_IN(3), RW }, - F71805F_SYSCTL_IN3, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(4), "in4_min", SENSORS_F71805F_IN(4), SENSORS_F71805F_IN(4), RW }, - F71805F_SYSCTL_IN4, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(5), "in5_min", SENSORS_F71805F_IN(5), SENSORS_F71805F_IN(5), RW }, - F71805F_SYSCTL_IN5, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(6), "in6_min", SENSORS_F71805F_IN(6), SENSORS_F71805F_IN(6), RW }, - F71805F_SYSCTL_IN6, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(7), "in7_min", SENSORS_F71805F_IN(7), SENSORS_F71805F_IN(7), RW }, - F71805F_SYSCTL_IN7, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(8), "in8_min", SENSORS_F71805F_IN(8), SENSORS_F71805F_IN(8), RW }, - F71805F_SYSCTL_IN8, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(9), "in9_min", SENSORS_F71805F_IN(9), SENSORS_F71805F_IN(9), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MIN(10), "in10_min", SENSORS_F71805F_IN(10), SENSORS_F71805F_IN(10), RW }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(0), "in0_max", SENSORS_F71805F_IN(0), SENSORS_F71805F_IN(0), RW }, - F71805F_SYSCTL_IN0, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(1), "in1_max", SENSORS_F71805F_IN(1), SENSORS_F71805F_IN(1), RW }, - F71805F_SYSCTL_IN1, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(2), "in2_max", SENSORS_F71805F_IN(2), SENSORS_F71805F_IN(2), RW }, - F71805F_SYSCTL_IN2, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(3), "in3_max", SENSORS_F71805F_IN(3), SENSORS_F71805F_IN(3), RW }, - F71805F_SYSCTL_IN3, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(4), "in4_max", SENSORS_F71805F_IN(4), SENSORS_F71805F_IN(4), RW }, - F71805F_SYSCTL_IN4, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(5), "in5_max", SENSORS_F71805F_IN(5), SENSORS_F71805F_IN(5), RW }, - F71805F_SYSCTL_IN5, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(6), "in6_max", SENSORS_F71805F_IN(6), SENSORS_F71805F_IN(6), RW }, - F71805F_SYSCTL_IN6, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(7), "in7_max", SENSORS_F71805F_IN(7), SENSORS_F71805F_IN(7), RW }, - F71805F_SYSCTL_IN7, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(8), "in8_max", SENSORS_F71805F_IN(8), SENSORS_F71805F_IN(8), RW }, - F71805F_SYSCTL_IN8, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(9), "in9_max", SENSORS_F71805F_IN(9), SENSORS_F71805F_IN(9), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, { { SENSORS_F71805F_IN_MAX(10), "in10_max", SENSORS_F71805F_IN(10), SENSORS_F71805F_IN(10), RW }, - NOSYSCTL, VALUE(2), 3 }, + 3 }, /* 3 fan tachometers */ { { SENSORS_F71805F_FAN(1), "fan1", NOMAP, NOMAP, R }, - F71805F_SYSCTL_FAN1, VALUE(2), 0 }, + 0 }, { { SENSORS_F71805F_FAN(2), "fan2", NOMAP, NOMAP, R }, - F71805F_SYSCTL_FAN2, VALUE(2), 0 }, + 0 }, { { SENSORS_F71805F_FAN(3), "fan3", NOMAP, NOMAP, R }, - F71805F_SYSCTL_FAN3, VALUE(2), 0 }, + 0 }, { { SENSORS_F71805F_FAN_MIN(1), "fan1_min", SENSORS_F71805F_FAN(1), SENSORS_F71805F_FAN(1), RW }, - F71805F_SYSCTL_FAN1, VALUE(1), 0 }, + 0 }, { { SENSORS_F71805F_FAN_MIN(2), "fan2_min", SENSORS_F71805F_FAN(2), SENSORS_F71805F_FAN(2), RW }, - F71805F_SYSCTL_FAN2, VALUE(1), 0 }, + 0 }, { { SENSORS_F71805F_FAN_MIN(3), "fan3_min", SENSORS_F71805F_FAN(3), SENSORS_F71805F_FAN(3), RW }, - F71805F_SYSCTL_FAN3, VALUE(1), 0 }, + 0 }, /* 3 temperature inputs */ { { SENSORS_F71805F_TEMP(1), "temp1", NOMAP, NOMAP, R }, - F71805F_SYSCTL_TEMP1, VALUE(3), 0 }, + 0 }, { { SENSORS_F71805F_TEMP(2), "temp2", NOMAP, NOMAP, R }, - F71805F_SYSCTL_TEMP2, VALUE(3), 0 }, + 0 }, { { SENSORS_F71805F_TEMP(3), "temp3", NOMAP, NOMAP, R }, - F71805F_SYSCTL_TEMP3, VALUE(3), 0 }, + 0 }, { { SENSORS_F71805F_TEMP_MAX(1), "temp1_max", SENSORS_F71805F_TEMP(1), SENSORS_F71805F_TEMP(1), RW }, - F71805F_SYSCTL_TEMP1, VALUE(1), 0 }, + 0 }, { { SENSORS_F71805F_TEMP_MAX(2), "temp2_max", SENSORS_F71805F_TEMP(2), SENSORS_F71805F_TEMP(2), RW }, - F71805F_SYSCTL_TEMP2, VALUE(1), 0 }, + 0 }, { { SENSORS_F71805F_TEMP_MAX(3), "temp3_max", SENSORS_F71805F_TEMP(3), SENSORS_F71805F_TEMP(3), RW }, - F71805F_SYSCTL_TEMP3, VALUE(1), 0 }, + 0 }, { { SENSORS_F71805F_TEMP_HYST(1), "temp1_hyst", SENSORS_F71805F_TEMP(1), SENSORS_F71805F_TEMP(1), RW }, - F71805F_SYSCTL_TEMP1, VALUE(2), 0 }, + 0 }, { { SENSORS_F71805F_TEMP_HYST(2), "temp2_hyst", SENSORS_F71805F_TEMP(2), SENSORS_F71805F_TEMP(2), RW }, - F71805F_SYSCTL_TEMP2, VALUE(2), 0 }, + 0 }, { { SENSORS_F71805F_TEMP_HYST(3), "temp3_hyst", SENSORS_F71805F_TEMP(3), SENSORS_F71805F_TEMP(3), RW }, - F71805F_SYSCTL_TEMP3, VALUE(2), 0 }, + 0 }, { { SENSORS_F71805F_TEMP_TYPE(1), "sensor1", NOMAP, NOMAP, R }, - F71805F_SYSCTL_SENSOR1, VALUE(1), 0 }, + 0 }, { { SENSORS_F71805F_TEMP_TYPE(2), "sensor2", NOMAP, NOMAP, R }, - F71805F_SYSCTL_SENSOR2, VALUE(1), 0 }, + 0 }, { { SENSORS_F71805F_TEMP_TYPE(3), "sensor3", NOMAP, NOMAP, R }, - F71805F_SYSCTL_SENSOR3, VALUE(1), 0 }, + 0 }, /* 3 alarm bitvectors */ { { SENSORS_F71805F_ALARMS_IN, "alarms_in", NOMAP, NOMAP, R }, - F71805F_SYSCTL_ALARMS_IN, VALUE(1), 0 }, + 0 }, { { SENSORS_F71805F_ALARMS_FAN, "alarms_fan", NOMAP, NOMAP, R }, - F71805F_SYSCTL_ALARMS_FAN, VALUE(1), 0 }, + 0 }, { { SENSORS_F71805F_ALARMS_TEMP, "alarms_temp", NOMAP, NOMAP, R }, - F71805F_SYSCTL_ALARMS_TEMP, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; #define SENSORS_ABITUGURU_IN_FEATURES(nr) \ { { SENSORS_ABITUGURU_IN(nr), "in" #nr, NOMAP, NOMAP, R }, \ - NOSYSCTL, VALUE(3), 3 }, \ + 3 }, \ { { SENSORS_ABITUGURU_IN_MIN(nr), "in" #nr "_min", \ SENSORS_ABITUGURU_IN(nr), SENSORS_ABITUGURU_IN(nr), RW }, \ - NOSYSCTL, VALUE(1), 3 }, \ + 3 }, \ { { SENSORS_ABITUGURU_IN_MIN_ALARM(nr), "in" #nr "_min_alarm", \ SENSORS_ABITUGURU_IN(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(1), 0 }, \ + 0 }, \ { { SENSORS_ABITUGURU_IN_MAX(nr), "in" #nr "_max", \ SENSORS_ABITUGURU_IN(nr), SENSORS_ABITUGURU_IN(nr), RW }, \ - NOSYSCTL, VALUE(2), 3 }, \ + 3 }, \ { { SENSORS_ABITUGURU_IN_MAX_ALARM(nr), "in" #nr "_max_alarm", \ SENSORS_ABITUGURU_IN(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(2), 0 } + 0 } #define SENSORS_ABITUGURU_TEMP_FEATURES(nr) \ { { SENSORS_ABITUGURU_TEMP(nr), "temp" #nr, NOMAP, NOMAP, R }, \ - NOSYSCTL, VALUE(3), 3 }, \ + 3 }, \ { { SENSORS_ABITUGURU_TEMP_ALARM(nr), "temp" #nr "_alarm", \ SENSORS_ABITUGURU_TEMP(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(1), 0 }, \ + 0 }, \ { { SENSORS_ABITUGURU_TEMP_MAX(nr), "temp" #nr "_max", \ SENSORS_ABITUGURU_TEMP(nr), SENSORS_ABITUGURU_TEMP(nr), RW }, \ - NOSYSCTL, VALUE(1), 3 }, \ + 3 }, \ { { SENSORS_ABITUGURU_TEMP_CRIT(nr), "temp" #nr "_crit", \ SENSORS_ABITUGURU_TEMP(nr), SENSORS_ABITUGURU_TEMP(nr), RW }, \ - NOSYSCTL, VALUE(2), 3 } + 3 } #define SENSORS_ABITUGURU_FAN_FEATURES(nr) \ { { SENSORS_ABITUGURU_FAN(nr), "fan" #nr, NOMAP, NOMAP, R }, \ - NOSYSCTL, VALUE(2), 0 }, \ + 0 }, \ { { SENSORS_ABITUGURU_FAN_ALARM(nr), "fan" #nr "_alarm", \ SENSORS_ABITUGURU_FAN(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(1), 0 }, \ + 0 }, \ { { SENSORS_ABITUGURU_FAN_MIN(nr), "fan" #nr "_min", \ SENSORS_ABITUGURU_FAN(nr), SENSORS_ABITUGURU_FAN(nr), RW }, \ - NOSYSCTL, VALUE(1), 0 } + 0 } static sensors_chip_feature abituguru_features[] = { @@ -5678,81 +5648,81 @@ static sensors_chip_feature abituguru_features[] = static sensors_chip_feature k8temp_features[] = { { { SENSORS_K8TEMP_TEMP1, "temp1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_K8TEMP_TEMP2, "temp2", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_K8TEMP_TEMP3, "temp3", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_K8TEMP_TEMP4, "temp4", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; static sensors_chip_feature coretemp_features[] = { { { SENSORS_CORETEMP_TEMP1, "temp1", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(2), 0 }, + 0 }, { { SENSORS_CORETEMP_TEMP1_CRIT, "temp1_crit", SENSORS_CORETEMP_TEMP1, SENSORS_CORETEMP_TEMP1, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { SENSORS_CORETEMP_TEMP1_CRIT_ALARM, "temp1_crit_alarm", SENSORS_CORETEMP_TEMP1, NOMAP, R }, - NOSYSCTL, VALUE(1), 0 }, + 0 }, { { 0 }, 0 } }; #define SENSORS_DME1737_IN_FEATURES(nr) \ { { SENSORS_DME1737_IN(nr), "in" #nr, \ NOMAP, NOMAP, R }, \ - NOSYSCTL, VALUE(3), 3 }, \ + 3 }, \ { { SENSORS_DME1737_IN_MIN(nr), "in" #nr "_min", \ SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \ - NOSYSCTL, VALUE(1), 3 }, \ + 3 }, \ { { SENSORS_DME1737_IN_MAX(nr), "in" #nr "_max", \ SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \ - NOSYSCTL, VALUE(2), 3 }, \ + 3 }, \ { { SENSORS_DME1737_IN_ALARM(nr), "in" #nr "_alarm", \ SENSORS_DME1737_IN(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(1), 0 } + 0 } #define SENSORS_DME1737_TEMP_FEATURES(nr) \ { { SENSORS_DME1737_TEMP(nr), "temp" #nr, \ NOMAP, NOMAP, R }, \ - NOSYSCTL, VALUE(3), 3 }, \ + 3 }, \ { { SENSORS_DME1737_TEMP_MIN(nr), "temp" #nr "_min", \ SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \ - NOSYSCTL, VALUE(2), 3 }, \ + 3 }, \ { { SENSORS_DME1737_TEMP_MAX(nr), "temp" #nr "_max", \ SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \ - NOSYSCTL, VALUE(1), 3 }, \ + 3 }, \ { { SENSORS_DME1737_TEMP_ALARM(nr), "temp" #nr "_alarm", \ SENSORS_DME1737_TEMP(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(1), 0 }, \ + 0 }, \ { { SENSORS_DME1737_TEMP_FAULT(nr), "temp" #nr "_fault", \ SENSORS_DME1737_TEMP(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(2), 0 } + 0 } #define SENSORS_DME1737_FAN_FEATURES(nr) \ { { SENSORS_DME1737_FAN(nr), "fan" #nr, \ NOMAP, NOMAP, R }, \ - NOSYSCTL, VALUE(2), 0 }, \ + 0 }, \ { { SENSORS_DME1737_FAN_MIN(nr), "fan" #nr "_min", \ SENSORS_DME1737_FAN(nr), SENSORS_DME1737_FAN(nr), RW }, \ - NOSYSCTL, VALUE(1), 0 }, \ + 0 }, \ { { SENSORS_DME1737_FAN_ALARM(nr), "fan" #nr "_alarm", \ SENSORS_DME1737_FAN(nr), NOMAP, R }, \ - NOSYSCTL, VALUE(1), 0 } + 0 } #define SENSORS_DME1737_PWM_FEATURES(nr) \ { { SENSORS_DME1737_PWM(nr), "pwm" #nr, \ NOMAP, NOMAP, RW }, \ - NOSYSCTL, VALUE(1), 0 }, \ + 0 }, \ { { SENSORS_DME1737_PWM_ENABLE(nr), "pwm" #nr "_enable", \ SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \ - NOSYSCTL, VALUE(2), 0 }, \ + 0 }, \ { { SENSORS_DME1737_PWM_FREQ(nr), "pwm" #nr "_freq", \ SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \ - NOSYSCTL, VALUE(3), 0 } + 0 } static sensors_chip_feature dme1737_features[] = { @@ -5778,9 +5748,9 @@ static sensors_chip_feature dme1737_features[] = SENSORS_DME1737_PWM_FEATURES(5), SENSORS_DME1737_PWM_FEATURES(6), { { SENSORS_DME1737_VID, "cpu0_vid", NOMAP, NOMAP, R }, - NOSYSCTL, VALUE(1), 3 }, + 3 }, { { SENSORS_DME1737_VRM, "vrm", NOMAP, NOMAP, RW }, - NOSYSCTL, VALUE(1), 1 }, + 1 }, { { 0 }, 0 } }; diff --git a/lib/data.h b/lib/data.h index af6017c3..01b55e13 100644 --- a/lib/data.h +++ b/lib/data.h @@ -120,7 +120,6 @@ typedef struct sensors_bus { /* /proc/sys/dev/sensors/chips line representation */ typedef struct sensors_proc_chips_entry { - int sysctl; sensors_chip_name name; } sensors_proc_chips_entry; @@ -139,20 +138,12 @@ typedef struct sensors_proc_chips_entry { mode is SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W or SENSORS_MODE_RW, for unaccessible, readable, writable, and both readable and writable. - sysctl is the SYSCTL id of the file the value can be found in. - offset is the (byte) offset of the place this feature can be found. scaling is the number of decimal points to scale by. - This scaling is performed on the raw sysctl value, NOT the value - seen in /proc. Therefore the scaling value must be the same as - the value returned in nrels_mag by the SENSORS_PROC_REAL_INFO - operation in the chip drivers. Divide the read value by 10**scaling to get the real value. Scaling can be positive or negative but negative values aren't very useful because the driver can scale that direction itself. */ typedef struct sensors_chip_feature { sensors_feature_data data; - int sysctl; - int offset; int scaling; const char *sysname; int sysscaling; From 8138489a72f314166fb8606d3ed66b1a66fa62a0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 26 Jun 2007 11:33:09 +0000 Subject: [PATCH 067/718] struct sensors_proc_chips_entry now has a single member, so we may as well use this member directly for slightly more simple code. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4474 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 2 +- lib/data.c | 2 +- lib/data.h | 9 ++------- lib/init.c | 8 +------- lib/sysfs.c | 32 ++++++++++++++++---------------- 5 files changed, 21 insertions(+), 32 deletions(-) diff --git a/lib/access.c b/lib/access.c index a66d2b35..6d4b67ab 100644 --- a/lib/access.c +++ b/lib/access.c @@ -304,7 +304,7 @@ const sensors_chip_name *sensors_get_detected_chips(int *nr) { const sensors_chip_name *res; res = (*nr >= sensors_proc_chips_count ? - NULL : &sensors_proc_chips[*nr].name); + NULL : &sensors_proc_chips[*nr]); (*nr)++; return res; } diff --git a/lib/data.c b/lib/data.c index 0c7fa705..70a37cf9 100644 --- a/lib/data.c +++ b/lib/data.c @@ -36,7 +36,7 @@ sensors_bus *sensors_config_busses = NULL; int sensors_config_busses_count = 0; int sensors_config_busses_max = 0; -sensors_proc_chips_entry *sensors_proc_chips = NULL; +sensors_chip_name *sensors_proc_chips = NULL; int sensors_proc_chips_count = 0; int sensors_proc_chips_max = 0; diff --git a/lib/data.h b/lib/data.h index 01b55e13..2fd0519a 100644 --- a/lib/data.h +++ b/lib/data.h @@ -118,11 +118,6 @@ typedef struct sensors_bus { int lineno; } sensors_bus; -/* /proc/sys/dev/sensors/chips line representation */ -typedef struct sensors_proc_chips_entry { - sensors_chip_name name; -} sensors_proc_chips_entry; - /* Internal data about a single chip feature. name is the string name used to refer to this feature (both in config files and through user functions); @@ -164,13 +159,13 @@ extern sensors_bus *sensors_config_busses; extern int sensors_config_busses_count; extern int sensors_config_busses_max; -extern sensors_proc_chips_entry *sensors_proc_chips; +extern sensors_chip_name *sensors_proc_chips; extern int sensors_proc_chips_count; extern int sensors_proc_chips_max; #define sensors_add_proc_chips(el) sensors_add_array_el( \ (el), &sensors_proc_chips, &sensors_proc_chips_count,\ - &sensors_proc_chips_max, sizeof(struct sensors_proc_chips_entry)) + &sensors_proc_chips_max, sizeof(struct sensors_chip_name)) extern sensors_bus *sensors_proc_bus; extern int sensors_proc_bus_count; diff --git a/lib/init.c b/lib/init.c index 79492e9f..dfc4cdf8 100644 --- a/lib/init.c +++ b/lib/init.c @@ -27,7 +27,6 @@ #include "sysfs.h" #include "scanner.h" -static void free_proc_chips_entry(sensors_proc_chips_entry entry); static void free_chip_name(sensors_chip_name name); static void free_bus(sensors_bus bus); static void free_chip(sensors_chip chip); @@ -61,7 +60,7 @@ void sensors_cleanup(void) sensors_scanner_exit(); for (i = 0; i < sensors_proc_chips_count; i++) - free_proc_chips_entry(sensors_proc_chips[i]); + free_chip_name(sensors_proc_chips[i]); free(sensors_proc_chips); sensors_proc_chips = NULL; sensors_proc_chips_count = sensors_proc_chips_max = 0; @@ -85,11 +84,6 @@ void sensors_cleanup(void) sensors_proc_bus_count = sensors_proc_bus_max = 0; } -void free_proc_chips_entry(sensors_proc_chips_entry entry) -{ - free_chip_name(entry.name); -} - void free_chip_name(sensors_chip_name name) { free(name.prefix); diff --git a/lib/sysfs.c b/lib/sysfs.c index 8be60fd0..f1fdbea5 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -219,7 +219,7 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) int domain, bus, slot, fn, i; struct sysfs_attribute *attr, *bus_attr; char bus_path[SYSFS_PATH_MAX]; - sensors_proc_chips_entry entry; + sensors_chip_name name; /* ignore any device without name attribute */ if (!(attr = sysfs_get_device_attr(dev, "name"))) @@ -231,22 +231,22 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) return 0; /* NB: attr->value[attr->len-1] == '\n'; chop that off */ - entry.name.prefix = strndup(attr->value, attr->len - 1); - if (!entry.name.prefix) + name.prefix = strndup(attr->value, attr->len - 1); + if (!name.prefix) sensors_fatal_error(__FUNCTION__, "out of memory"); - entry.name.busname = strdup(dev->path); - if (!entry.name.busname) + name.busname = strdup(dev->path); + if (!name.busname) sensors_fatal_error(__FUNCTION__, "out of memory"); - if (sscanf(dev->name, "%d-%x", &entry.name.bus, &entry.name.addr) == 2) { + if (sscanf(dev->name, "%d-%x", &name.bus, &name.addr) == 2) { /* find out if legacy ISA or not */ - if (entry.name.bus == 9191) - entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; + if (name.bus == 9191) + name.bus = SENSORS_CHIP_NAME_BUS_ISA; else { snprintf(bus_path, sizeof(bus_path), "%s/class/i2c-adapter/i2c-%d/device/name", - sensors_sysfs_mount, entry.name.bus); + sensors_sysfs_mount, name.bus); if ((bus_attr = sysfs_open_attribute(bus_path))) { if (sysfs_read_attribute(bus_attr)) @@ -254,24 +254,24 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) if (bus_attr->value && !strncmp(bus_attr->value, "ISA ", 4)) - entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; + name.bus = SENSORS_CHIP_NAME_BUS_ISA; sysfs_close_attribute(bus_attr); } } - } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &entry.name.addr) == 1) { + } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &name.addr) == 1) { /* must be new ISA (platform driver) */ - entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; + name.bus = SENSORS_CHIP_NAME_BUS_ISA; } else if (sscanf(dev->name, "%x:%x:%x.%x", &domain, &bus, &slot, &fn) == 4) { /* PCI */ - entry.name.addr = (domain << 16) + (bus << 8) + (slot << 3) + fn; - entry.name.bus = SENSORS_CHIP_NAME_BUS_PCI; + name.addr = (domain << 16) + (bus << 8) + (slot << 3) + fn; + name.bus = SENSORS_CHIP_NAME_BUS_PCI; } else return -SENSORS_ERR_PARSE; /* check whether this chip is known in the static list */ for (i = 0; sensors_chip_features_list[i].prefix; i++) - if (!strcasecmp(sensors_chip_features_list[i].prefix, entry.name.prefix)) + if (!strcasecmp(sensors_chip_features_list[i].prefix, name.prefix)) break; /* if no chip definition matches */ @@ -287,7 +287,7 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) total_dynamic++; } - sensors_add_proc_chips(&entry); + sensors_add_proc_chips(&name); return 0; } From 2b1fb387e9bca5a5ee799de92fce4188bd873aec Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 26 Jun 2007 13:54:26 +0000 Subject: [PATCH 068/718] Delete unused file. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4476 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/config.c | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 etc/config.c diff --git a/etc/config.c b/etc/config.c deleted file mode 100644 index ddf790cc..00000000 --- a/etc/config.c +++ /dev/null @@ -1,8 +0,0 @@ -/* - * This is used by the top-level makefile to automagically - * get the kernel version from . - * A simple grep doesn't work for Mandrake and Red Hat distributions - * that contain multiple UTS_RELEASE definitions in version.h. - */ -#include -char *uts_release=UTS_RELEASE; From 9ab400fad35291dff880a973bbc85a0387a34505 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 26 Jun 2007 20:34:18 +0000 Subject: [PATCH 069/718] Add SMSC SCH5317 detection. Patch from Juerg Haefliger. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4479 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES b/CHANGES index 297667b3..2003f9b1 100644 --- a/CHANGES +++ b/CHANGES @@ -47,6 +47,7 @@ SVN HEAD Fix IPMI support for 2.6 kernels Add detection for non-standard SMSC Super-I/Os No longer depend on i2cdetect + Add SMSC SCH5317 detection 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 2f6282cc..51e42fac 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1806,6 +1806,12 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); devid => 0x81, logdev => 0x08, }, + { + name => "SMSC SCH5317 Super IO", + driver => "smsc47b397", + devid => 0x85, + logdev => 0x08, + }, { name => "SMSC SCH5504-NS Super IO", # No datasheet From d7b4debbf6319a6572eb8f3524ad5cbfdb0217ce Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 27 Jun 2007 08:10:19 +0000 Subject: [PATCH 070/718] Move i2cdetect, i2cdump, i2cset and i2cget to a separate package (i2c-tools). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4480 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/developers/applications | 6 +- doc/progs | 23 -- prog/detect/Module.mk | 17 +- prog/detect/i2cdetect.8 | 88 -------- prog/detect/i2cdetect.c | 347 ----------------------------- prog/dump/Module.mk | 22 +- prog/dump/i2cbusses.c | 259 ---------------------- prog/dump/i2cbusses.h | 29 --- prog/dump/i2cdump.8 | 80 ------- prog/dump/i2cdump.c | 426 ------------------------------------ prog/dump/i2cget.8 | 68 ------ prog/dump/i2cget.c | 263 ---------------------- prog/dump/i2cset.8 | 77 ------- prog/dump/i2cset.c | 286 ------------------------ 14 files changed, 10 insertions(+), 1981 deletions(-) delete mode 100644 prog/detect/i2cdetect.8 delete mode 100644 prog/detect/i2cdetect.c delete mode 100644 prog/dump/i2cbusses.c delete mode 100644 prog/dump/i2cbusses.h delete mode 100644 prog/dump/i2cdump.8 delete mode 100644 prog/dump/i2cdump.c delete mode 100644 prog/dump/i2cget.8 delete mode 100644 prog/dump/i2cget.c delete mode 100644 prog/dump/i2cset.8 delete mode 100644 prog/dump/i2cset.c diff --git a/doc/developers/applications b/doc/developers/applications index 30918de4..a8d1e654 100644 --- a/doc/developers/applications +++ b/doc/developers/applications @@ -34,7 +34,7 @@ Details: bus are being accessed. No access is provided for non-i2c busses such as ISA. - For good examples, see prog/detect/i2cdetect.c and + For good examples, see i2cdetect.c (in the i2c-tools package) and prog/detect/sensors-detect. @@ -56,8 +56,8 @@ Details: bus are being accessed. No access is provided for non-i2c busses such as ISA. - For good examples, see prog/detect/i2cdetect.c, - prog/dump/i2cdump.c, and prog/dump/i2cset.c. + For good examples, see i2cdetect.c, i2cdump.c, and i2cset.c (all in the + i2c-tools package). 3A. /proc access (2.4 kernels) diff --git a/doc/progs b/doc/progs index 0e6201e1..9de8a0b0 100644 --- a/doc/progs +++ b/doc/progs @@ -18,34 +18,11 @@ see useful_addresses.html. * prog/daemon/healthd.sh (written in bash, not installed) An example of a very simple hardware health monitoring daemon. -* prog/detect/i2cdetect (written in C, installed by 'make install') - This program scans your complete I2C or SMBus adapter for connected devices. - Syntax: - i2cdetect 0 - Here the '0' stands for the bus number (run "i2cdetect -l" - to list all installed busses). - * prog/detect/sensors-detect (written in Perl, installed by 'make install') This program tries to detect the available SMBus adapters and the chips connected to them, as well as Super-I/O and misc chips. It also generates modprobe lines and module options. This program is interactive. -* prog/dump/i2cdump (written in C, installed by 'make install') - This program dumps the registers of an I2C device. - Usual syntax: - i2cdump 0 0x4c b - Here the '0' stands for the bus number (run i2cdump with no arguments - to list all installed busses). - '0x49' is the device address, and 'b' or 'w' stands for byte - or word data. - -* prog/dump/i2cset (written in C, installed by 'make install') - prog/dump/i2cget (written in C, installed by 'make install') - These programs are used to write to or read from a register of an - I2C device. Usual syntax: - i2cset bus device address data - i2cget bus device address - * prog/dump/isadump (written in C, installed by 'make install') This program dumps the registers of ISA or Super-I/O chips. Usual syntax: diff --git a/prog/detect/Module.mk b/prog/detect/Module.mk index c1f57ead..90326ed4 100644 --- a/prog/detect/Module.mk +++ b/prog/detect/Module.mk @@ -22,28 +22,18 @@ MODULE_DIR := prog/detect PROGDETECTDIR := $(MODULE_DIR) PROGDETECTMAN8DIR := $(MANDIR)/man8 -PROGDETECTMAN8FILES := $(MODULE_DIR)/i2cdetect.8 $(MODULE_DIR)/sensors-detect.8 +PROGDETECTMAN8FILES := $(MODULE_DIR)/sensors-detect.8 # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... -PROGDETECTTARGETS := $(MODULE_DIR)/i2cdetect -PROGDETECTSOURCES := $(MODULE_DIR)/i2cdetect.c -PROGDETECTSBININSTALL := $(MODULE_DIR)/sensors-detect \ - $(MODULE_DIR)/i2cdetect - -# Include all dependency files. We use '.rd' to indicate this will create -# executables. -INCLUDEFILES += $(PROGDETECTSOURCES:.c=.rd) +PROGDETECTSBININSTALL := $(MODULE_DIR)/sensors-detect REMOVEDETECTBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SBINDIR)/%,$(PROGDETECTSBININSTALL)) REMOVEDETECTMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGDETECTMAN8DIR)/%,$(PROGDETECTMAN8FILES)) -all-prog-detect: $(PROGDETECTTARGETS) +all-prog-detect: user :: all-prog-detect -$(MODULE_DIR)/i2cdetect: $(MODULE_DIR)/i2cdetect.ro prog/dump/i2cbusses.ro - $(CC) $(EXLDFLAGS) -o $@ $^ - install-prog-detect: all-prog-detect $(MKDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(PROGDETECTMAN8DIR) $(INSTALL) -m 755 $(PROGDETECTSBININSTALL) $(DESTDIR)$(SBINDIR) @@ -55,5 +45,4 @@ user_uninstall:: $(RM) $(REMOVEDETECTMAN) clean-prog-detect: - $(RM) $(PROGDETECTDIR)/*.rd $(PROGDETECTDIR)/*.ro $(PROGDETECTTARGETS) clean :: clean-prog-detect diff --git a/prog/detect/i2cdetect.8 b/prog/detect/i2cdetect.8 deleted file mode 100644 index 09c85cb7..00000000 --- a/prog/detect/i2cdetect.8 +++ /dev/null @@ -1,88 +0,0 @@ -.TH I2CDETECT 8 "October 2006" -.SH NAME -i2cdetect \- detect I2C chips - -.SH SYNOPSIS -.B i2cdetect -.RI [ -y ] -.RI [ -a ] -.RI [ -q | -r ] -.I i2cbus -.RI [ "first last" ] -.br -.B i2cdetect -.I -F -.I i2cbus -.br -.B i2cdetect -.I -V -.br -.B i2cdetect -.I -l - -.SH DESCRIPTION -i2cdetect is a userspace program to scan an I2C bus for devices. It -outputs a table with the list of detected devices on the specified bus. -\fIi2cbus\fR indicates the number of the I2C bus to be scanned, and -should correspond to one of the busses listed by \fIi2cdetect -l\fR. -The optional parameters \fIfirst\fR and \fIlast\fR restrict the scanning -range (default: from 0x03 to 0x77). -.PP -i2cdetect can also be used to query the functionalities of an I2C bus -(see option \fB-F\fP.) - -.SH WARNING -This program can confuse your I2C bus, cause data loss and worse! - -.SH INTERPRETING THE OUTPUT -Each cell in the output table will contain one of the following symbols: -.IP \(bu "\w'\(bu'u+1n" -"--". The address was probed but no chip answered. -.IP \(bu -"UU". Probing was skipped, because this address is currently in use by -a driver. This strongly suggests that there is a chip at this address. -.IP \(bu -An address number in hexadecimal, e.g. "2d" or "4e". A chip -was found at this address. - -.SH OPTIONS -.TP -.B "\-y" -Disable interactive mode. By default, i2cdetect will wait for a confirmation -from the user before messing with the I2C bus. When this flag is used, it -will perform the operation directly. This is mainly meant to be used in -scripts. -.TP -.B "\-a" -Force scanning of non-regular addresses. Not recommended. -.TP -.B "\-q" -Use SMBus "quick write" commands for probing (by default, the command -used is the one believed to be the safest for each address). -Not recommended. This is known to corrupt the Atmel AT24RF08 EEPROM -found on many IBM Thinkpad laptops. -.TP -.B "\-r" -Use SMBus "read byte" commands for probing (by default, the command -used is the one believed to be the safest for each address). -Not recommended. This is known to lock SMBus on various write-only -chips (most notably clock chips at address 0x69). -.TP -.B "\-F" -Display the list of functionalities implemented by the adapter and exit. -.TP -.B "\-V" -Display the version and exit. -.TP -.B "\-l" -Output a list of installed busses. - -.SH SEE ALSO -i2cdump(8), sensors-detect(8) - -.SH AUTHOR -Frodo Looijaard, Mark D. Studebaker, and the lm_sensors group -http://www.lm-sensors.org/ -This manual page was written by Aurelien Jarno , for -the Debian GNU/Linux system. It was then reviewed by the lm_sensors team and -is now part of the lm_sensors source distribution. diff --git a/prog/detect/i2cdetect.c b/prog/detect/i2cdetect.c deleted file mode 100644 index 7bae2f8e..00000000 --- a/prog/detect/i2cdetect.c +++ /dev/null @@ -1,347 +0,0 @@ -/* - i2cdetect.c - a user-space program to scan for I2C devices - Copyright (C) 1999-2004 Frodo Looijaard , - Mark D. Studebaker and - Jean Delvare - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "../dump/i2cbusses.h" -#include "i2c-dev.h" -#include "version.h" - -#define MODE_AUTO 0 -#define MODE_QUICK 1 -#define MODE_READ 2 -#define MODE_FUNC 3 - -void help(void) -{ - fprintf(stderr, - "Syntax: i2cdetect [-y] [-a] [-q|-r] I2CBUS [FIRST LAST]\n" - " i2cdetect -F I2CBUS\n" - " i2cdetect -l\n" - " i2cdetect -V\n" - " I2CBUS is an integer\n" - " With -a, probe all addresses (NOT RECOMMENDED)\n" - " With -q, uses only quick write commands for probing (NOT " - "RECOMMENDED)\n" - " With -r, uses only read byte commands for probing (NOT " - "RECOMMENDED)\n" - " If provided, FIRST and LAST limit the probing range.\n" - " With -l, lists installed busses only\n"); - print_i2c_busses(0); -} - -int scan_i2c_bus(int file, const int mode, const int first, const int last) -{ - int i, j; - int res; - - printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\n"); - - for (i = 0; i < 128; i += 16) { - printf("%02x: ", i); - for(j = 0; j < 16; j++) { - fflush(stdout); - - /* Skip unwanted addresses */ - if (i+j < first || i+j > last) { - printf(" "); - continue; - } - - /* Set slave address */ - if (ioctl(file, I2C_SLAVE, i+j) < 0) { - if (errno == EBUSY) { - printf("UU "); - continue; - } else { - fprintf(stderr, "Error: Could not set " - "address to 0x%02x: %s\n", i+j, - strerror(errno)); - return -1; - } - } - - /* Probe this address */ - switch (mode) { - case MODE_QUICK: - /* This is known to corrupt the Atmel AT24RF08 - EEPROM */ - res = i2c_smbus_write_quick(file, - I2C_SMBUS_WRITE); - break; - case MODE_READ: - /* This is known to lock SMBus on various - write-only chips (mainly clock chips) */ - res = i2c_smbus_read_byte(file); - break; - default: - if ((i+j >= 0x30 && i+j <= 0x37) - || (i+j >= 0x50 && i+j <= 0x5F)) - res = i2c_smbus_read_byte(file); - else - res = i2c_smbus_write_quick(file, - I2C_SMBUS_WRITE); - } - - if (res < 0) - printf("-- "); - else - printf("%02x ", i+j); - } - printf("\n"); - } - - return 0; -} - -struct func -{ - long value; - const char* name; -}; - -static const struct func all_func[] = { - { .value = I2C_FUNC_I2C, - .name = "I2C" }, - { .value = I2C_FUNC_SMBUS_QUICK, - .name = "SMBus Quick Command" }, - { .value = I2C_FUNC_SMBUS_WRITE_BYTE, - .name = "SMBus Send Byte" }, - { .value = I2C_FUNC_SMBUS_READ_BYTE, - .name = "SMBus Receive Byte" }, - { .value = I2C_FUNC_SMBUS_WRITE_BYTE_DATA, - .name = "SMBus Write Byte" }, - { .value = I2C_FUNC_SMBUS_READ_BYTE_DATA, - .name = "SMBus Read Byte" }, - { .value = I2C_FUNC_SMBUS_WRITE_WORD_DATA, - .name = "SMBus Write Word" }, - { .value = I2C_FUNC_SMBUS_READ_WORD_DATA, - .name = "SMBus Read Word" }, - { .value = I2C_FUNC_SMBUS_PROC_CALL, - .name = "SMBus Process Call" }, - { .value = I2C_FUNC_SMBUS_WRITE_BLOCK_DATA, - .name = "SMBus Block Write" }, - { .value = I2C_FUNC_SMBUS_READ_BLOCK_DATA, - .name = "SMBus Block Read" }, - { .value = I2C_FUNC_SMBUS_BLOCK_PROC_CALL, - .name = "SMBus Block Process Call" }, - { .value = I2C_FUNC_SMBUS_HWPEC_CALC, - .name = "SMBus PEC" }, - { .value = I2C_FUNC_SMBUS_WRITE_I2C_BLOCK, - .name = "I2C Block Write" }, - { .value = I2C_FUNC_SMBUS_READ_I2C_BLOCK, - .name = "I2C Block Read" }, - { } -}; - -void print_functionality(unsigned long funcs) -{ - int i; - - for (i = 0; all_func[i].value; i++) { - printf("%-32s %s\n", all_func[i].name, - (funcs & all_func[i].value) ? "yes" : "no"); - } -} - -int main(int argc, char *argv[]) -{ - char *end; - int i2cbus, file, res; - char filename[20]; - unsigned long funcs; - int mode = MODE_AUTO; - int first = 0x03, last = 0x77; - int flags = 0; - int yes = 0, version = 0, list = 0; - - /* handle (optional) flags first */ - while (1+flags < argc && argv[1+flags][0] == '-') { - switch (argv[1+flags][1]) { - case 'V': version = 1; break; - case 'y': yes = 1; break; - case 'l': list = 1; break; - case 'F': - if (mode != MODE_AUTO && mode != MODE_FUNC) { - fprintf(stderr, "Error: Different modes " - "specified!\n"); - exit(1); - } - mode = MODE_FUNC; - break; - case 'r': - if (mode == MODE_QUICK) { - fprintf(stderr, "Error: Different modes " - "specified!\n"); - exit(1); - } - mode = MODE_READ; - break; - case 'q': - if (mode == MODE_READ) { - fprintf(stderr, "Error: Different modes " - "specified!\n"); - exit(1); - } - mode = MODE_QUICK; - break; - case 'a': - first = 0x00; - last = 0x7F; - break; - default: - fprintf(stderr, "Warning: Unsupported flag " - "\"-%c\"!\n", argv[1+flags][1]); - help(); - exit(1); - } - flags++; - } - - if (version) { - fprintf(stderr, "i2cdetect version %s\n", LM_VERSION); - exit(0); - } - - if (list) { - print_i2c_busses(1); - exit(0); - } - - if (argc < flags + 2) { - fprintf(stderr, "Error: No i2c-bus specified!\n"); - help(); - exit(1); - } - i2cbus = strtol(argv[flags+1], &end, 0); - if (*end) { - fprintf(stderr, "Error: I2CBUS argument not a number!\n"); - help(); - exit(1); - } - if ((i2cbus < 0) || (i2cbus > 0xff)) { - fprintf(stderr, "Error: I2CBUS argument out of range " - "(0-255)!\n"); - help(); - exit(1); - } - - /* read address range if present */ - if (argc == flags + 4 && mode != MODE_FUNC) { - int tmp; - - tmp = strtol(argv[flags+2], &end, 0); - if (*end) { - fprintf(stderr, "Error: FIRST argment not a " - "number!\n"); - help(); - exit(1); - } - if (tmp < first || tmp > last) { - fprintf(stderr, "Error: FIRST argument out of range " - "(0x%02x-0x%02x)!\n", first, last); - help(); - exit(1); - } - first = tmp; - - tmp = strtol(argv[flags+3], &end, 0); - if (*end) { - fprintf(stderr, "Error: LAST argment not a " - "number!\n"); - help(); - exit(1); - } - if (tmp < first || tmp > last) { - fprintf(stderr, "Error: LAST argument out of range " - "(0x%02x-0x%02x)!\n", first, last); - help(); - exit(1); - } - last = tmp; - } else if (argc != flags + 2) { - help(); - exit(1); - } - - file = open_i2c_dev(i2cbus, filename, 0); - if (file < 0) { - exit(1); - } - - if (ioctl(file, I2C_FUNCS, &funcs) < 0) { - fprintf(stderr, "Error: Could not get the adapter " - "functionality matrix: %s\n", strerror(errno)); - close(file); - exit(1); - } - - /* Special case, we only list the implemented functionalities */ - if (mode == MODE_FUNC) { - close(file); - printf("Functionalities implemented by %s:\n", filename); - print_functionality(funcs); - exit(0); - } - - if (mode != MODE_READ && !(funcs & I2C_FUNC_SMBUS_QUICK)) { - fprintf(stderr, "Error: Can't use SMBus Quick Write command " - "on this bus (ISA bus?)\n"); - close(file); - exit(1); - } - if (mode != MODE_QUICK && !(funcs & I2C_FUNC_SMBUS_READ_BYTE)) { - fprintf(stderr, "Error: Can't use SMBus Read Byte command " - "on this bus (ISA bus?)\n"); - close(file); - exit(1); - } - - if (!yes) { - char s[2]; - - fprintf(stderr, "WARNING! This program can confuse your I2C " - "bus, cause data loss and worse!\n"); - - fprintf(stderr, "I will probe file %s%s.\n", filename, - mode==MODE_QUICK?" using quick write commands": - mode==MODE_READ?" using read byte commands":""); - fprintf(stderr, "I will probe address range 0x%02x-0x%02x.\n", - first, last); - - fprintf(stderr, "Continue? [Y/n] "); - fflush(stderr); - if (!fgets(s, 2, stdin) - || (s[0] != '\n' && s[0] != 'y' && s[0] != 'Y')) { - fprintf(stderr, "Aborting on user request.\n"); - exit(0); - } - } - - res = scan_i2c_bus(file, mode, first, last); - - close(file); - - exit(res?1:0); -} diff --git a/prog/dump/Module.mk b/prog/dump/Module.mk index ee9c4f4f..a91136e9 100644 --- a/prog/dump/Module.mk +++ b/prog/dump/Module.mk @@ -22,18 +22,13 @@ MODULE_DIR := prog/dump PROGDUMPDIR := $(MODULE_DIR) PROGDUMPMAN8DIR := $(MANDIR)/man8 -PROGDUMPMAN8FILES := $(MODULE_DIR)/i2cdump.8 $(MODULE_DIR)/i2cset.8 \ - $(MODULE_DIR)/i2cget.8 +PROGDUMPMAN8FILES := # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... -PROGDUMPTARGETS := $(MODULE_DIR)/i2cdump $(MODULE_DIR)/i2cset \ - $(MODULE_DIR)/i2cget -PROGDUMPSOURCES := $(MODULE_DIR)/i2cdump.c $(MODULE_DIR)/i2cset.c \ - $(MODULE_DIR)/i2cget.c $(MODULE_DIR)/i2cbusses.c \ - $(MODULE_DIR)/util.c -PROGDUMPBININSTALL := $(MODULE_DIR)/i2cdump $(MODULE_DIR)/i2cset \ - $(MODULE_DIR)/i2cget +PROGDUMPTARGETS := +PROGDUMPSOURCES := $(MODULE_DIR)/util.c +PROGDUMPBININSTALL := # Only build isadump and isaset on x86 machines. ifneq (,$(findstring $(MACHINE), i386 i486 i586 i686 x86_64)) @@ -54,15 +49,6 @@ REMOVEDUMPMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGDUMPMAN8DIR)/%,$(PRO all-prog-dump: $(PROGDUMPTARGETS) user :: all-prog-dump -$(MODULE_DIR)/i2cdump: $(MODULE_DIR)/i2cdump.ro $(MODULE_DIR)/i2cbusses.ro $(MODULE_DIR)/util.ro - $(CC) $(EXLDFLAGS) -o $@ $^ - -$(MODULE_DIR)/i2cset: $(MODULE_DIR)/i2cset.ro $(MODULE_DIR)/i2cbusses.ro $(MODULE_DIR)/util.ro - $(CC) $(EXLDFLAGS) -o $@ $^ - -$(MODULE_DIR)/i2cget: $(MODULE_DIR)/i2cget.ro $(MODULE_DIR)/i2cbusses.ro $(MODULE_DIR)/util.ro - $(CC) $(EXLDFLAGS) -o $@ $^ - $(MODULE_DIR)/isadump: $(MODULE_DIR)/isadump.ro $(MODULE_DIR)/superio.ro $(MODULE_DIR)/util.ro $(CC) $(EXLDFLAGS) -o $@ $^ diff --git a/prog/dump/i2cbusses.c b/prog/dump/i2cbusses.c deleted file mode 100644 index 5c511f52..00000000 --- a/prog/dump/i2cbusses.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - i2cbusses: Print the installed i2c busses for both 2.4 and 2.6 kernels. - Part of user-space programs to access for I2C - devices. - Copyright (c) 1999-2003 Frodo Looijaard and - Mark D. Studebaker - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "i2cbusses.h" -#include "i2c-dev.h" - -enum adt { adt_dummy, adt_isa, adt_i2c, adt_smbus, adt_unknown }; - -struct adap_type { - const char *funcs; - const char* algo; -}; - -static struct adap_type adap_types[5] = { - { .funcs = "dummy", - .algo = "Dummy bus", }, - { .funcs = "isa", - .algo = "ISA bus", }, - { .funcs = "i2c", - .algo = "I2C adapter", }, - { .funcs = "smbus", - .algo = "SMBus adapter", }, - { .funcs = "unknown", - .algo = "N/A", }, -}; - -static enum adt i2c_get_funcs(int i2cbus) -{ - unsigned long funcs; - int file; - char filename[20]; - enum adt ret; - - file = open_i2c_dev(i2cbus, filename, 1); - if (file < 0) - return adt_unknown; - - if (ioctl(file, I2C_FUNCS, &funcs) < 0) - ret = adt_unknown; - else if (funcs & I2C_FUNC_I2C) - ret = adt_i2c; - else if (funcs & (I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA)) - ret = adt_smbus; - else - ret = adt_dummy; - - close(file); - return ret; -} - -/* - this just prints out the installed i2c busses in a consistent format, whether - on a 2.4 kernel using /proc or a 2.6 kernel using /sys. - If procfmt == 1, print out exactly /proc/bus/i2c format on stdout. - This allows this to be used in a program to emulate /proc/bus/i2c on a - sysfs system. -*/ -void print_i2c_busses(int procfmt) -{ - FILE *fptr; - char s[100]; - struct dirent *de, *dde; - DIR *dir, *ddir; - FILE *f; - char *border; - char dev[NAME_MAX], fstype[NAME_MAX], sysfs[NAME_MAX], n[NAME_MAX]; - int foundsysfs = 0; - int count=0; - - - /* look in /proc/bus/i2c */ - if((fptr = fopen("/proc/bus/i2c", "r"))) { - while(fgets(s, 100, fptr)) { - if(count++ == 0 && !procfmt) - fprintf(stderr," Installed I2C busses:\n"); - if(procfmt) - printf("%s", s); - else - fprintf(stderr, " %s", s); - } - fclose(fptr); - goto done; - } - - /* look in sysfs */ - /* First figure out where sysfs was mounted */ - if ((f = fopen("/proc/mounts", "r")) == NULL) { - goto done; - } - while (fgets(n, NAME_MAX, f)) { - sscanf(n, "%[^ ] %[^ ] %[^ ] %*s\n", dev, sysfs, fstype); - if (strcasecmp(fstype, "sysfs") == 0) { - foundsysfs++; - break; - } - } - fclose(f); - if (! foundsysfs) { - goto done; - } - - /* Bus numbers in i2c-adapter don't necessarily match those in - i2c-dev and what we really care about are the i2c-dev numbers. - Unfortunately the names are harder to get in i2c-dev */ - strcat(sysfs, "/class/i2c-dev"); - if(!(dir = opendir(sysfs))) - goto done; - /* go through the busses */ - while ((de = readdir(dir)) != NULL) { - if (!strcmp(de->d_name, ".")) - continue; - if (!strcmp(de->d_name, "..")) - continue; - - /* this should work for kernels 2.6.5 or higher and */ - /* is preferred because is unambiguous */ - sprintf(n, "%s/%s/name", sysfs, de->d_name); - f = fopen(n, "r"); - /* this seems to work for ISA */ - if(f == NULL) { - sprintf(n, "%s/%s/device/name", sysfs, de->d_name); - f = fopen(n, "r"); - } - /* non-ISA is much harder */ - /* and this won't find the correct bus name if a driver - has more than one bus */ - if(f == NULL) { - sprintf(n, "%s/%s/device", sysfs, de->d_name); - if(!(ddir = opendir(n))) - continue; - while ((dde = readdir(ddir)) != NULL) { - if (!strcmp(dde->d_name, ".")) - continue; - if (!strcmp(dde->d_name, "..")) - continue; - if ((!strncmp(dde->d_name, "i2c-", 4))) { - sprintf(n, "%s/%s/device/%s/name", - sysfs, de->d_name, dde->d_name); - if((f = fopen(n, "r"))) - goto found; - } - } - } - -found: - if (f != NULL) { - int i2cbus; - enum adt type; - char x[120]; - char *px; - - px = fgets(x, 120, f); - fclose(f); - if (!px) { - fprintf(stderr, "%s: read error\n", n); - continue; - } - if((border = index(x, '\n')) != NULL) - *border = 0; - if(count++ == 0 && !procfmt) - fprintf(stderr," Installed I2C busses:\n"); - /* match 2.4 /proc/bus/i2c format as closely as possible */ - if(!strncmp(x, "ISA ", 4)) { - type = adt_isa; - } else if(!sscanf(de->d_name, "i2c-%d", &i2cbus)) { - type = adt_dummy; - } else { - /* Attempt to probe for adapter capabilities */ - type = i2c_get_funcs(i2cbus); - } - - if (procfmt) - printf("%s\t%-10s\t%-32s\t%s\n", de->d_name, - adap_types[type].funcs, x, adap_types[type].algo); - else - fprintf(stderr, " %s\t%-10s\t%s\n", de->d_name, - adap_types[type].funcs, x); - } - } - closedir(dir); - -done: - if(count == 0 && !procfmt) - fprintf(stderr,"Error: No I2C busses found!\n" - "Be sure you have done 'modprobe i2c-dev'\n" - "and also modprobed your i2c bus drivers\n"); -} - -int open_i2c_dev(const int i2cbus, char *filename, const int quiet) -{ - int file; - - sprintf(filename, "/dev/i2c/%d", i2cbus); - file = open(filename, O_RDWR); - - if (file < 0 && errno == ENOENT) { - sprintf(filename, "/dev/i2c-%d", i2cbus); - file = open(filename, O_RDWR); - } - - if (file < 0 && !quiet) { - if (errno == ENOENT) { - fprintf(stderr, "Error: Could not open file " - "`/dev/i2c-%d' or `/dev/i2c/%d': %s\n", - i2cbus, i2cbus, strerror(ENOENT)); - } else { - fprintf(stderr, "Error: Could not open file " - "`%s': %s\n", filename, strerror(errno)); - if (errno == EACCES) - fprintf(stderr, "Run as root?\n"); - } - } - - return file; -} - -int set_slave_addr(int file, int address, int force) -{ - /* With force, let the user read from/write to the registers - even when a driver is also running */ - if (ioctl(file, force ? I2C_SLAVE_FORCE : I2C_SLAVE, address) < 0) { - fprintf(stderr, - "Error: Could not set address to 0x%02x: %s\n", - address, strerror(errno)); - return -errno; - } - - return 0; -} diff --git a/prog/dump/i2cbusses.h b/prog/dump/i2cbusses.h deleted file mode 100644 index d7ecb664..00000000 --- a/prog/dump/i2cbusses.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - i2cbusses.h - Part of the lm_sensors project - - Copyright (C) 2004 The lm_sensors group - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _I2CBUSSES_H -#define _I2CBUSSES_H - -void print_i2c_busses(int procfmt); - -int open_i2c_dev(const int i2cbus, char *filename, const int quiet); -int set_slave_addr(int file, int address, int force); - -#endif diff --git a/prog/dump/i2cdump.8 b/prog/dump/i2cdump.8 deleted file mode 100644 index 9a703e9a..00000000 --- a/prog/dump/i2cdump.8 +++ /dev/null @@ -1,80 +0,0 @@ -.TH I2CDUMP 8 "June 2007" -.SH NAME -i2cdump \- examine I2C registers - -.SH SYNOPSIS -.B i2cdump -.RB [ -f ] -.RB [ -y ] -.I i2cbus -.I address -.RI [ mode ] -.RI [ "bank " [ bankreg ]] -.br -.B i2cdump -.B -V - -.SH DESCRIPTION -i2cdump is a small helper program to examine registers -visible through the I2C bus. - -.SH OPTIONS -.TP -.B -V -Display the version and exit. -.TP -.B -f -Force access to the device even if it is already busy. By default, i2cdump -will refuse to access a device which is already under the control of a -kernel driver. Using this flag is dangerous, it can seriously confuse the -kernel driver in question. It can also cause i2cdump to return invalid -results. So use at your own risk and only if you know what you're doing. -.TP -.B -y -Disable interactive mode. By default, i2cdump will wait for a confirmation -from the user before messing with the I2C bus. When this flag is used, it -will perform the operation directly. This is mainly meant to be used in -scripts. -.PP -At least two options must be provided to i2cdump. \fIi2cbus\fR indicates the -number of the I2C bus to be scanned. This number should correspond to one -of the busses listed by \fIi2cdetect -l\fR. \fIaddress\fR indicates the -address to be scanned on that bus, and is an integer between 0x00 and 0x7F. -.PP -The \fImode\fR parameter, if specified, is one of the letters \fBb\fP, \fBw\fP, -\fBs\fP, or \fBi\fP, corresponding to a read size of a single byte, a 16-bit -word, an SMBus block, an I2C block, respectively. The \fBc\fP mode is a -little different, it reads all bytes consecutively, and is useful for chips that -have an address auto-increment feature, such as EEPROMs. The \fBW\fP mode is -also special, it is similar to \fBw\fP except that a read command will only -be issued on even register addresses; this is again mainly useful for EEPROMs. -.PP -A \fBp\fP can also be appended to the \fImode\fR parameter (except for -\fBi\fP and \fBW\fP) to enable PEC. If the \fImode\fR parameter is omitted, -i2cdump defaults to byte access without PEC. -.PP -The \fIbank\fR and \fIbankreg\fR parameters are useful on the W83781D and -similar chips (at the time of writing, all Winbond and Asus chips). -\fIbank\fR is an integer between 0 and 7, and \fIbankreg\fR is an integer -between 0x00 and 0xFF (default value: 0x4E). The W83781D data sheet has more -information on bank selection. - -.SH WARNING -i2cdump can be dangerous if used improperly. Most notably, the \fBc\fP mode -starts with WRITING a byte to the chip. On most chips it will be stored in the -address pointer register, which is OK, but some chips with a single register -or no (visible) register at all will most likely see this as a real WRITE, -resulting in possible misbehavior or corruption. Do not use i2cdump -on random addresses. Anyway, it is of little use unless you have an idea of -what you are looking for and have some general knowledge about hardware -monitoring chips internals. - -.SH SEE ALSO -i2cset(8), i2cdetect(8), isadump(8) - -.SH AUTHOR -Frodo Looijaard, Mark D. Studebaker, and the lm_sensors group -http://www.lm-sensors.org/ -This manual page was originally written by David Z Maze for -the Debian GNU/Linux system. It was then reviewed by the lm_sensors team and -is now part of the lm_sensors source distribution. diff --git a/prog/dump/i2cdump.c b/prog/dump/i2cdump.c deleted file mode 100644 index e47663ec..00000000 --- a/prog/dump/i2cdump.c +++ /dev/null @@ -1,426 +0,0 @@ -/* - i2cdump.c - a user-space program to dump I2C registers - Copyright (C) 2002-2003 Frodo Looijaard , and - Mark D. Studebaker - Copyright (C) 2004 The lm_sensors group - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "util.h" -#include "i2cbusses.h" -#include "i2c-dev.h" -#include "version.h" - -void help(void) -{ - fprintf(stderr, "Syntax: i2cdump [-f] [-y] I2CBUS ADDRESS [MODE] " - "[BANK [BANKREG]]\n" - " i2cdump -V\n" - " MODE is one of:\n" - " b (byte, default)\n" - " w (word)\n" - " W (word on even register addresses)\n" - " s (SMBus block)\n" - " i (I2C block)\n" - " c (consecutive byte)\n" - " Append 'p' to 'b', 'w', 's' or 'c' for PEC checking\n" - " I2CBUS is an integer\n" - " ADDRESS is an integer 0x00 - 0x7f\n" - " BANK and BANKREG are for byte and word accesses (default " - "bank 0, reg 0x4e)\n" - " BANK is the command for smbusblock accesses (default 0)\n"); - print_i2c_busses(0); -} - -int main(int argc, char *argv[]) -{ - char *end; - int i, j, res, i2cbus, address, size, file; - int bank = 0, bankreg = 0x4E, old_bank = 0; - char filename[20]; - unsigned long funcs; - int block[256], s_length = 0; - int pec = 0, even = 0; - int flags = 0; - int force = 0, yes = 0, version = 0; - - /* handle (optional) flags first */ - while (1+flags < argc && argv[1+flags][0] == '-') { - switch (argv[1+flags][1]) { - case 'V': version = 1; break; - case 'f': force = 1; break; - case 'y': yes = 1; break; - default: - fprintf(stderr, "Warning: Unsupported flag " - "\"-%c\"!\n", argv[1+flags][1]); - help(); - exit(1); - } - flags++; - } - - if (version) { - fprintf(stderr, "i2cdump version %s\n", LM_VERSION); - exit(0); - } - - if (argc < flags + 2) { - fprintf(stderr, "Error: No i2c-bus specified!\n"); - help(); - exit(1); - } - i2cbus = strtol(argv[flags+1], &end, 0); - if (*end) { - fprintf(stderr, "Error: First argument not a number!\n"); - help(); - exit(1); - } - if (i2cbus < 0 || i2cbus > 0xff) { - fprintf(stderr, "Error: I2CBUS argument out of range!\n"); - help(); - exit(1); - } - - if (argc < flags + 3) { - fprintf(stderr, "Error: No address specified!\n"); - help(); - exit(1); - } - address = strtol(argv[flags+2], &end, 0); - if (*end) { - fprintf(stderr, "Error: Second argument not a number!\n"); - help(); - exit(1); - } - if (address < 0 || address > 0x7f) { - fprintf(stderr, "Error: Address out of range!\n"); - help(); - exit(1); - } - - if (argc < flags + 4) { - fprintf(stderr, "No size specified (using byte-data access)\n"); - size = I2C_SMBUS_BYTE_DATA; - } else if (!strncmp(argv[flags+3], "b", 1)) { - size = I2C_SMBUS_BYTE_DATA; - pec = argv[flags+3][1] == 'p'; - } else if (!strncmp(argv[flags+3], "w", 1)) { - size = I2C_SMBUS_WORD_DATA; - pec = argv[flags+3][1] == 'p'; - } else if (!strncmp(argv[flags+3], "W", 1)) { - size = I2C_SMBUS_WORD_DATA; - even = 1; - } else if (!strncmp(argv[flags+3], "s", 1)) { - size = I2C_SMBUS_BLOCK_DATA; - pec = argv[flags+3][1] == 'p'; - } else if (!strncmp(argv[flags+3], "c", 1)) { - size = I2C_SMBUS_BYTE; - pec = argv[flags+3][1] == 'p'; - } else if (!strcmp(argv[flags+3], "i")) - size = I2C_SMBUS_I2C_BLOCK_DATA; - else { - fprintf(stderr, "Error: Invalid mode!\n"); - help(); - exit(1); - } - - if (argc > flags + 4) { - bank = strtol(argv[flags+4], &end, 0); - if (*end || size == I2C_SMBUS_I2C_BLOCK_DATA) { - fprintf(stderr, "Error: Invalid bank number!\n"); - help(); - exit(1); - } - if ((size == I2C_SMBUS_BYTE_DATA || size == I2C_SMBUS_WORD_DATA) - && (bank < 0 || bank > 15)) { - fprintf(stderr, "Error: bank out of range!\n"); - help(); - exit(1); - } - if (size == I2C_SMBUS_BLOCK_DATA - && (bank < 0 || bank > 0xff)) { - fprintf(stderr, "Error: block command out of range!\n"); - help(); - exit(1); - } - - if (argc > flags + 5) { - bankreg = strtol(argv[flags+5], &end, 0); - if (*end || size == I2C_SMBUS_BLOCK_DATA) { - fprintf(stderr, "Error: Invalid bank register " - "number!\n"); - help(); - exit(1); - } - if (bankreg < 0 || bankreg > 0xff) { - fprintf(stderr, "Error: bank out of range " - "(0-0xff)!\n"); - help(); - exit(1); - } - } - } - - file = open_i2c_dev(i2cbus, filename, 0); - if (file < 0) { - exit(1); - } - - /* check adapter functionality */ - if (ioctl(file, I2C_FUNCS, &funcs) < 0) { - fprintf(stderr, "Error: Could not get the adapter " - "functionality matrix: %s\n", strerror(errno)); - exit(1); - } - - switch(size) { - case I2C_SMBUS_BYTE: - if (!((funcs & I2C_FUNC_SMBUS_BYTE) == I2C_FUNC_SMBUS_BYTE)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have byte capability\n", i2cbus); - exit(1); - } - break; - - case I2C_SMBUS_BYTE_DATA: - if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have byte read capability\n", i2cbus); - exit(1); - } - break; - - case I2C_SMBUS_WORD_DATA: - if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have word read capability\n", i2cbus); - exit(1); - } - break; - - case I2C_SMBUS_BLOCK_DATA: - if (!(funcs & I2C_FUNC_SMBUS_READ_BLOCK_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have smbus block read capability\n", - i2cbus); - exit(1); - } - break; - - case I2C_SMBUS_I2C_BLOCK_DATA: - if (!(funcs & I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have i2c block read capability\n", - i2cbus); - exit(1); - } - break; - } - - if (set_slave_addr(file, address, force) < 0) - exit(1); - - if (pec) { - if (ioctl(file, I2C_PEC, 1) < 0) { - fprintf(stderr, "Error: Could not set PEC: %s\n", - strerror(errno)); - exit(1); - } - if (!(funcs & (I2C_FUNC_SMBUS_HWPEC_CALC | I2C_FUNC_I2C))) { - fprintf(stderr, "Warning: Adapter for i2c bus %d does " - "not seem to actually support PEC\n", i2cbus); - } - } - - if (!yes) { - fprintf(stderr, "WARNING! This program can confuse your I2C " - "bus, cause data loss and worse!\n"); - - fprintf(stderr, "I will probe file %s, address 0x%x, mode " - "%s\n", filename, address, - size == I2C_SMBUS_BLOCK_DATA ? "smbus block" : - size == I2C_SMBUS_I2C_BLOCK_DATA ? "i2c block" : - size == I2C_SMBUS_BYTE ? "byte consecutive read" : - size == I2C_SMBUS_BYTE_DATA ? "byte" : "word"); - if (pec) - fprintf(stderr, "PEC checking enabled.\n"); - if (even) - fprintf(stderr, "Only probing even register " - "addresses.\n"); - if (bank) { - if (size == I2C_SMBUS_BLOCK_DATA) - fprintf(stderr, "Using command 0x%02x.\n", - bank); - else - fprintf(stderr, "Probing bank %d using bank " - "register 0x%02x.\n", bank, bankreg); - } - - fprintf(stderr, "Continue? [Y/n] "); - fflush(stderr); - if (!user_ack(1)) { - fprintf(stderr, "Aborting on user request.\n"); - exit(0); - } - } - - /* See Winbond w83781d data sheet for bank details */ - if (bank && size != I2C_SMBUS_BLOCK_DATA) { - res = i2c_smbus_read_byte_data(file, bankreg); - if (res >= 0) { - old_bank = res; - res = i2c_smbus_write_byte_data(file, bankreg, - bank | (old_bank & 0xf0)); - } - if (res < 0) { - fprintf(stderr, "Error: Bank switching failed\n"); - exit(1); - } - } - - /* handle all but word data */ - if (size != I2C_SMBUS_WORD_DATA || even) { - /* do the block transaction */ - if (size == I2C_SMBUS_BLOCK_DATA - || size == I2C_SMBUS_I2C_BLOCK_DATA) { - unsigned char cblock[288]; - - if (size == I2C_SMBUS_BLOCK_DATA) { - res = i2c_smbus_read_block_data(file, bank, - cblock); - /* Remember returned block length for a nicer - display later */ - s_length = res; - } else { - for (res = 0; res < 256; res += i) { - i = i2c_smbus_read_i2c_block_data(file, - res, 32, cblock + res); - if (i <= 0) - break; - } - } - if (res <= 0) { - fprintf(stderr, "Error: Block read failed, " - "return code %d\n", res); - exit(1); - } - if (res >= 256) - res = 256; - for (i = 0; i < res; i++) - block[i] = cblock[i]; - if (size != I2C_SMBUS_BLOCK_DATA) - for (i = res; i < 256; i++) - block[i] = -1; - } - - if (size == I2C_SMBUS_BYTE) { - res = i2c_smbus_write_byte(file, 0); - if(res != 0) { - fprintf(stderr, "Error: Write start address " - "failed, return code %d\n", res); - exit(1); - } - } - - printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f" - " 0123456789abcdef\n"); - for (i = 0; i < 256; i+=16) { - if (size == I2C_SMBUS_BLOCK_DATA && i >= s_length) - break; - printf("%02x: ", i); - for (j = 0; j < 16; j++) { - fflush(stdout); - if (size == I2C_SMBUS_BYTE_DATA) { - block[i+j] = res = - i2c_smbus_read_byte_data(file, i+j); - } else if (size == I2C_SMBUS_WORD_DATA) { - res = i2c_smbus_read_word_data(file, - i+j); - if (res < 0) { - block[i+j] = res; - block[i+j+1] = res; - } else { - block[i+j] = res & 0xff; - block[i+j+1] = res >> 8; - } - } else if (size == I2C_SMBUS_BYTE) { - block[i+j] = res = - i2c_smbus_read_byte(file); - } else - res = block[i+j]; - - if (size == I2C_SMBUS_BLOCK_DATA - && i+j >= s_length) { - printf(" "); - } else if (res < 0) { - printf("XX "); - if (size == I2C_SMBUS_WORD_DATA) - printf("XX "); - } else { - printf("%02x ", block[i+j]); - if (size == I2C_SMBUS_WORD_DATA) - printf("%02x ", block[i+j+1]); - } - if (size == I2C_SMBUS_WORD_DATA) - j++; - } - printf(" "); - - for (j = 0; j < 16; j++) { - if (size == I2C_SMBUS_BLOCK_DATA - && i+j >= s_length) - break; - - res = block[i+j]; - if (res < 0) - printf("X"); - else - if ((res & 0xff) == 0x00 - || (res & 0xff) == 0xff) - printf("."); - else - if ((res & 0xff) < 32 - || (res & 0xff) >= 127) - printf("?"); - else - printf("%c", res & 0xff); - } - printf("\n"); - } - } else { - printf(" 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f\n"); - for (i = 0; i < 256; i+=8) { - printf("%02x: ", i); - for (j = 0; j < 8; j++) { - res = i2c_smbus_read_word_data(file, i+j); - if (res < 0) - printf("XXXX "); - else - printf("%04x ", res & 0xffff); - } - printf("\n"); - } - } - if (bank && size != I2C_SMBUS_BLOCK_DATA) { - i2c_smbus_write_byte_data(file, bankreg, old_bank); - } - exit(0); -} diff --git a/prog/dump/i2cget.8 b/prog/dump/i2cget.8 deleted file mode 100644 index 4b4b76e1..00000000 --- a/prog/dump/i2cget.8 +++ /dev/null @@ -1,68 +0,0 @@ -.TH I2CGET 8 "June 2007" -.SH "NAME" -i2cget \- read from I2C/SMBus chip registers - -.SH SYNOPSIS -.B i2cget -.RB [ -f ] -.RB [ -y ] -.I i2cbus -.I chip-address -.RI [ data-address " [" mode ]] -.br -.B i2cget -.B -V - -.SH DESCRIPTION -i2cget is a small helper program to read registers visible through the I2C -bus (or SMBus). - -.SH OPTIONS -.TP -.B -V -Display the version and exit. -.TP -.B -f -Force access to the device even if it is already busy. By default, i2cget -will refuse to access a device which is already under the control of a -kernel driver. Using this flag is dangerous, it can seriously confuse the -kernel driver in question. It can also cause i2cget to return an invalid -value. So use at your own risk and only if you know what you're doing. -.TP -.B -y -Disable interactive mode. By default, i2cget will wait for a confirmation -from the user before messing with the I2C bus. When this flag is used, it -will perform the operation directly. This is mainly meant to be used in -scripts. Use with caution. -.PP -There are two required options to i2cget. \fIi2cbus\fR indicates the number -of the I2C bus to be scanned. This number should correspond to one of -the busses listed by \fIi2cdetect -l\fR. \fIchip-address\fR specifies the -address of the chip on that bus, and is an integer between 0x03 and 0x77. -.PP -\fIdata-address\fR specifies the address on that chip to read from, and is -an integer between 0x00 and 0xFF. If omitted, the currently active register -will be read (if that makes sense for the considered chip). -.PP -The \fImode\fR parameter, if specified, is one of the letters \fBb\fP, -\fBw\fP or \fBc\fP, corresponding to a read byte data, a read word data or a -write byte/read byte transaction, respectively. A \fBp\fP can also be appended -to the \fImode\fR parameter to enable PEC. If the \fImode\fR parameter is omitted, -i2cget defaults to a read byte data transaction, unless \fIdata-address\fR is -also omitted, in which case the default (and only valid) transaction is a -single read byte. - -.SH WARNING -i2cget can be extremely dangerous if used improperly. I2C and SMBus are designed -in such a way that an SMBus read transaction can be seen as a write transaction by -certain chips. This is particularly true if setting \fImode\fR to \fBcp\fP (write byte/read -byte with PEC). Be extremely careful using this program. - -.SH SEE ALSO -i2cdump(8), i2cset(8) - -.SH AUTHOR -Jean Delvare -http://www.lm-sensors.org/ -This manual page was strongly inspired from those written by David Z Maze -for i2cset. diff --git a/prog/dump/i2cget.c b/prog/dump/i2cget.c deleted file mode 100644 index 314b5192..00000000 --- a/prog/dump/i2cget.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - i2cget.c - A user-space program to read an I2C register. - Copyright (C) 2005 Jean Delvare - - Based on i2cset.c: - Copyright (C) 2001-2003 Frodo Looijaard , and - Mark D. Studebaker - Copyright (C) 2004-2005 Jean Delvare - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "util.h" -#include "i2cbusses.h" -#include "i2c-dev.h" -#include "version.h" - -void help(void) __attribute__ ((noreturn)); - -void help(void) -{ - fprintf(stderr, "Syntax: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS " - "[DATA-ADDRESS [MODE]]\n" - " i2cget -V\n" - " MODE can be: 'b' (read byte data, default)\n" - " 'w' (read word data)\n" - " 'c' (write byte/read byte)\n" - " If DATA-ADDRESS is omitted, a single read byte command is " - "issued\n" - " Append 'p' to MODE for PEC checking\n" - " I2CBUS is an integer\n"); - print_i2c_busses(0); - exit(1); -} - -int check_funcs(int file, int i2cbus, int size, int daddress, int pec) -{ - unsigned long funcs; - - /* check adapter functionality */ - if (ioctl(file, I2C_FUNCS, &funcs) < 0) { - fprintf(stderr, "Error: Could not get the adapter " - "functionality matrix: %s\n", strerror(errno)); - return -1; - } - - switch (size) { - case I2C_SMBUS_BYTE: - if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have read byte capability\n", i2cbus); - return -1; - } - if (daddress >= 0 - && !(funcs & I2C_FUNC_SMBUS_WRITE_BYTE)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have write byte capability\n", i2cbus); - return -1; - } - break; - - case I2C_SMBUS_BYTE_DATA: - if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have read byte data capability\n", i2cbus); - return -1; - } - break; - - case I2C_SMBUS_WORD_DATA: - if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have read word data capability\n", i2cbus); - return -1; - } - break; - } - - if (pec - && !(funcs & (I2C_FUNC_SMBUS_HWPEC_CALC | I2C_FUNC_I2C))) { - fprintf(stderr, "Warning: Adapter for i2c bus %d does " - "not seem to support PEC\n", i2cbus); - } - - return 0; -} - -int confirm(const char *filename, int address, int size, int daddress, int pec) -{ - int dont = 0; - - fprintf(stderr, "WARNING! This program can confuse your I2C " - "bus, cause data loss and worse!\n"); - - /* Don't let the user break his/her EEPROMs */ - if (address >= 0x50 && address <= 0x57 && pec) { - fprintf(stderr, "STOP! EEPROMs are I2C devices, not " - "SMBus devices. Using PEC\non I2C devices may " - "result in unexpected results, such as\n" - "trashing the contents of EEPROMs. We can't " - "let you do that, sorry.\n"); - return 0; - } - - if (size == I2C_SMBUS_BYTE && daddress >= 0 && pec) { - fprintf(stderr, "WARNING! All I2C chips and some SMBus chips " - "will interpret a write\nbyte command with PEC as a" - "write byte data command, effectively writing a\n" - "value into a register!\n"); - dont++; - } - - fprintf(stderr, "I will read from device file %s, chip " - "address 0x%02x, ", filename, address); - if (daddress < 0) - fprintf(stderr, "current data\naddress"); - else - fprintf(stderr, "data address\n0x%02x", daddress); - fprintf(stderr, ", using %s.\n", - size == I2C_SMBUS_BYTE ? (daddress < 0 ? - "read byte" : "write byte/read byte") : - size == I2C_SMBUS_BYTE_DATA ? "read byte data" : - "read word data"); - if (pec) - fprintf(stderr, "PEC checking enabled.\n"); - - fprintf(stderr, "Continue? [%s] ", dont ? "y/N" : "Y/n"); - fflush(stderr); - if (!user_ack(!dont)) { - fprintf(stderr, "Aborting on user request.\n"); - return 0; - } - - return 1; -} - -int main(int argc, char *argv[]) -{ - char *end; - int res, i2cbus, address, file; - int size = I2C_SMBUS_BYTE_DATA; - int daddress; - char filename[20]; - int pec = 0; - int flags = 0; - int force = 0, yes = 0, version = 0; - - /* handle (optional) flags first */ - while (1+flags < argc && argv[1+flags][0] == '-') { - switch (argv[1+flags][1]) { - case 'V': version = 1; break; - case 'f': force = 1; break; - case 'y': yes = 1; break; - default: - fprintf(stderr, "Warning: Unsupported flag " - "\"-%c\"!\n", argv[1+flags][1]); - help(); - exit(1); - } - flags++; - } - - if (version) { - fprintf(stderr, "i2cget version %s\n", LM_VERSION); - exit(0); - } - - if (argc - flags < 3) - help(); - - i2cbus = strtol(argv[flags+1], &end, 0); - if (*end || i2cbus < 0 || i2cbus > 0x3f) { - fprintf(stderr, "Error: I2CBUS argument invalid!\n"); - help(); - } - - address = strtol(argv[flags+2], &end, 0); - if (*end || address < 3 || address > 0x77) { - fprintf(stderr, "Error: Chip address invalid!\n"); - help(); - } - - if (!(flags+3 < argc)) { - size = I2C_SMBUS_BYTE; - daddress = -1; - } else { - daddress = strtol(argv[flags+3], &end, 0); - if (*end || daddress < 0 || daddress > 0xff) { - fprintf(stderr, "Error: Data address invalid!\n"); - help(); - } - } - - if (flags+4 < argc) { - switch (argv[flags+4][0]) { - case 'b': size = I2C_SMBUS_BYTE_DATA; break; - case 'w': size = I2C_SMBUS_WORD_DATA; break; - case 'c': size = I2C_SMBUS_BYTE; break; - default: - fprintf(stderr, "Error: Invalid mode!\n"); - help(); - } - pec = argv[flags+4][1] == 'p'; - } - - file = open_i2c_dev(i2cbus, filename, 0); - if (file < 0 - || check_funcs(file, i2cbus, size, daddress, pec) - || set_slave_addr(file, address, force)) - exit(1); - - if (!yes && !confirm(filename, address, size, daddress, pec)) - exit(0); - - if (pec && ioctl(file, I2C_PEC, 1) < 0) { - fprintf(stderr, "Error: Could not set PEC: %s\n", - strerror(errno)); - exit(1); - } - - switch (size) { - case I2C_SMBUS_BYTE: - if (daddress >= 0) { - res = i2c_smbus_write_byte(file, daddress); - if (res < 0) - fprintf(stderr, "Warning - write failed\n"); - } - res = i2c_smbus_read_byte(file); - break; - case I2C_SMBUS_WORD_DATA: - res = i2c_smbus_read_word_data(file, daddress); - break; - default: /* I2C_SMBUS_BYTE_DATA */ - res = i2c_smbus_read_byte_data(file, daddress); - } - close(file); - - if (res < 0) { - fprintf(stderr, "Error: Read failed\n"); - exit(2); - } - - printf("0x%0*x\n", size == I2C_SMBUS_WORD_DATA ? 4 : 2, res); - - exit(0); -} diff --git a/prog/dump/i2cset.8 b/prog/dump/i2cset.8 deleted file mode 100644 index de7971a6..00000000 --- a/prog/dump/i2cset.8 +++ /dev/null @@ -1,77 +0,0 @@ -.TH I2CSET 8 "June 2007" -.SH "NAME" -i2cset \- set I2C registers - -.SH SYNOPSIS -.B i2cset -.RB [ -f ] -.RB [ -y ] -.I i2cbus -.I chip-address -.I data-address -.I value -.RI [ mode ] -.RI [ mask ] -.br -.B i2cset -.B -V - -.SH DESCRIPTION -i2cset is a small helper program to set registers visible through the I2C -bus. - -.SH OPTIONS -.TP -.B -V -Display the version and exit. -.TP -.B -f -Force access to the device even if it is already busy. By default, i2cset -will refuse to access a device which is already under the control of a -kernel driver. Using this flag is dangerous, it can seriously confuse the -kernel driver in question. It can also cause i2cset to silently write to -the wrong register. So use at your own risk and only if you know what -you're doing. -.TP -.B -y -Disable interactive mode. By default, i2cset will wait for a confirmation -from the user before messing with the I2C bus. When this flag is used, it -will perform the operation directly. This is mainly meant to be used in -scripts. -.PP -There are four required options to i2cset. \fIi2cbus\fR indicates the number -of the I2C bus to be scanned. This number should correspond to one of -the busses listed by \fIi2cdetect -l\fR. \fIchip-address\fR specifies the -address of the chip on that bus, and is an integer between 0x00 and 0x7F. -\fIdata-address\fR specifies the address on that chip to write to, and is an -integer between 0x00 and 0xFF. \fIvalue\fR is the value to write to that -location on the chip. -.PP -The \fImode\fR parameter, if specified, is one of the letters \fBb\fP or -\fBw\fP, corresponding to a write size of a single byte or a 16-bit word, -respectively. A \fBp\fP can also be appended to the \fImode\fR parameter to -enable PEC. If the \fImode\fR parameter is omitted, i2cset defaults to byte -mode without PEC. The \fIvalue\fR provided must be within range for the -specified data type (0x00-0xFF for bytes, 0x0000-0xFFFF for words). -.PP -The \fImask\fR parameter, if specified, describes which bits of \fIvalue\fR -will be actually written to \fIdata-address\fR. Bits set to 1 in the mask -are taken from \fIvalue\fR, while bits set to 0 will be read from -\fIdata-address\fR and thus preserved by the operation. - -.SH WARNING -i2cset can be extremely dangerous if used improperly. It can confuse your -I2C bus, cause data loss, or have more serious side effects. Writing to -a serial EEPROM on a memory DIMM (chip addresses between 0x50 and 0x57) may -DESTROY your memory, leaving your system unbootable! Be extremely careful -using this program. - -.SH SEE ALSO -i2cdump(8), isaset(8) - -.SH AUTHOR -Frodo Looijaard, Mark D. Studebaker, and the lm_sensors group -http://www.lm-sensors.org/ -This manual page was originally written by David Z Maze for -the Debian GNU/Linux system. It was then reviewed by the lm_sensors team and -is now part of the lm_sensors source distribution. diff --git a/prog/dump/i2cset.c b/prog/dump/i2cset.c deleted file mode 100644 index 3be4a9c4..00000000 --- a/prog/dump/i2cset.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - i2cset.c - A user-space program to write an I2C register. - Copyright (C) 2001-2003 Frodo Looijaard , and - Mark D. Studebaker - Copyright (C) 2004-2005 Jean Delvare - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include "i2cbusses.h" -#include "util.h" -#include "i2c-dev.h" -#include "version.h" - -void help(void) __attribute__ ((noreturn)); - -void help(void) -{ - fprintf(stderr, "Syntax: i2cset [-f] [-y] I2CBUS CHIP-ADDRESS DATA-ADDRESS " - "VALUE [MODE] [MASK]\n" - " i2cset -V\n" - " MODE is 'b[yte]' or 'w[ord]' (default b)\n" - " Append 'p' to MODE for PEC checking\n" - " I2CBUS is an integer\n"); - print_i2c_busses(0); - exit(1); -} - -int main(int argc, char *argv[]) -{ - char *end; - int res, i2cbus, address, size, file; - int value, daddress, vmask = 0; - int e1; - char filename[20]; - unsigned long funcs; - int pec = 0; - int flags = 0; - int force = 0, yes = 0, version = 0; - - /* handle (optional) flags first */ - while (1+flags < argc && argv[1+flags][0] == '-') { - switch (argv[1+flags][1]) { - case 'V': version = 1; break; - case 'f': force = 1; break; - case 'y': yes = 1; break; - default: - fprintf(stderr, "Warning: Unsupported flag " - "\"-%c\"!\n", argv[1+flags][1]); - help(); - exit(1); - } - flags++; - } - - if (version) { - fprintf(stderr, "i2cset version %s\n", LM_VERSION); - exit(0); - } - - if (argc < flags + 5) - help(); - - i2cbus = strtol(argv[flags+1], &end, 0); - if (*end || i2cbus < 0 || i2cbus > 0x3f) { - fprintf(stderr, "Error: I2CBUS argument invalid!\n"); - help(); - } - - address = strtol(argv[flags+2], &end, 0); - if (*end || address < 0 || address > 0x7f) { - fprintf(stderr, "Error: Chip address invalid!\n"); - help(); - } - - daddress = strtol(argv[flags+3], &end, 0); - if (*end || daddress < 0 || daddress > 0xff) { - fprintf(stderr, "Error: Data address invalid!\n"); - help(); - } - - value = strtol(argv[flags+4], &end, 0); - if (*end) { - fprintf(stderr, "Error: Data value invalid!\n"); - help(); - } - - if (argc < flags + 6) { - fprintf(stderr, "No size specified (using byte-data access)\n"); - size = I2C_SMBUS_BYTE_DATA; - } else if (argv[flags+5][0] == 'b') { - size = I2C_SMBUS_BYTE_DATA; - pec = argv[flags+5][1] == 'p'; - } else if (argv[flags+5][0] == 'w') { - size = I2C_SMBUS_WORD_DATA; - pec = argv[flags+5][1] == 'p'; - } else { - fprintf(stderr, "Error: Invalid mode!\n"); - help(); - } - - if (argc >= flags + 7) { - vmask = strtol(argv[flags+6], &end, 0); - if (*end || vmask == 0) { - fprintf(stderr, "Error: Data value mask invalid!\n"); - help(); - } - } - - if (value < 0 - || (size == I2C_SMBUS_BYTE_DATA && value > 0xff) - || (size == I2C_SMBUS_WORD_DATA && value > 0xffff)) { - fprintf(stderr, "Error: Data value out of range!\n"); - help(); - } - - file = open_i2c_dev(i2cbus, filename, 0); - if (file < 0) { - exit(1); - } - - /* check adapter functionality */ - if (ioctl(file, I2C_FUNCS, &funcs) < 0) { - fprintf(stderr, "Error: Could not get the adapter " - "functionality matrix: %s\n", strerror(errno)); - exit(1); - } - - switch (size) { - case I2C_SMBUS_BYTE_DATA: - if (!(funcs & I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have byte write capability\n", i2cbus); - exit(1); - } - break; - - case I2C_SMBUS_WORD_DATA: - if (!(funcs & I2C_FUNC_SMBUS_WRITE_WORD_DATA)) { - fprintf(stderr, "Error: Adapter for i2c bus %d does " - "not have word write capability\n", i2cbus); - exit(1); - } - break; - } - - if (set_slave_addr(file, address, force) < 0) - exit(1); - - if (!yes) { - int dont = 0; - - fprintf(stderr, "WARNING! This program can confuse your I2C " - "bus, cause data loss and worse!\n"); - - if (address >= 0x50 && address <= 0x57) { - fprintf(stderr, "DANGEROUS! Writing to a serial " - "EEPROM on a memory DIMM\nmay render your " - "memory USELESS and make your system " - "UNBOOTABLE!\n"); - dont = 1; - } - - fprintf(stderr, "I will write to device file %s, chip address " - "0x%02x, data address\n0x%02x, data 0x%02x%s, mode " - "%s.\n", filename, address, daddress, value, - vmask ? " (masked)" : "", - size == I2C_SMBUS_BYTE_DATA ? "byte" : "word"); - if (pec) - fprintf(stderr, "PEC checking enabled.\n"); - - fprintf(stderr, "Continue? [%s] ", dont ? "y/N" : "Y/n"); - fflush(stderr); - if (!user_ack(!dont)) { - fprintf(stderr, "Aborting on user request.\n"); - exit(0); - } - } - - if (vmask) { - int oldvalue; - - if (size == I2C_SMBUS_WORD_DATA) { - oldvalue = i2c_smbus_read_word_data(file, daddress); - } else { - oldvalue = i2c_smbus_read_byte_data(file, daddress); - } - - if (oldvalue < 0) { - fprintf(stderr, "Error: Failed to read old value\n"); - exit(1); - } - - value = (value & vmask) | (oldvalue & ~vmask); - - if (!yes) { - fprintf(stderr, "Old value 0x%0*x, write mask " - "0x%0*x: Will write 0x%0*x to register " - "0x%02x\n", - size == I2C_SMBUS_WORD_DATA ? 4 : 2, oldvalue, - size == I2C_SMBUS_WORD_DATA ? 4 : 2, vmask, - size == I2C_SMBUS_WORD_DATA ? 4 : 2, value, - daddress); - - fprintf(stderr, "Continue? [Y/n] "); - fflush(stderr); - if (!user_ack(1)) { - fprintf(stderr, "Aborting on user request.\n"); - exit(0); - } - } - } - - if (pec) { - if (ioctl(file, I2C_PEC, 1) < 0) { - fprintf(stderr, "Error: Could not set PEC: %s\n", - strerror(errno)); - exit(1); - } - if (!(funcs & (I2C_FUNC_SMBUS_HWPEC_CALC | I2C_FUNC_I2C))) { - fprintf(stderr, "Warning: Adapter for i2c bus %d does " - "not seem to actually support PEC\n", i2cbus); - } - } - - e1 = 0; - if (size == I2C_SMBUS_WORD_DATA) { - res = i2c_smbus_write_word_data(file, daddress, value); - } else { - res = i2c_smbus_write_byte_data(file, daddress, value); - } - if (res < 0) { - fprintf(stderr, "Warning - write failed\n"); - e1++; - } - - if (pec) { - if (ioctl(file, I2C_PEC, 0) < 0) { - fprintf(stderr, "Error: Could not clear PEC: %s\n", - strerror(errno)); - close(file); - exit(e1); - } - } - - if (size == I2C_SMBUS_WORD_DATA) { - res = i2c_smbus_read_word_data(file, daddress); - } else { - res = i2c_smbus_read_byte_data(file, daddress); - } - close(file); - - if (res < 0) { - fprintf(stderr, "Warning - readback failed\n"); - e1++; - } else - if (res != value) { - e1++; - fprintf(stderr, "Warning - data mismatch - wrote " - "0x%0*x, read back 0x%0*x\n", - size == I2C_SMBUS_WORD_DATA ? 4 : 2, value, - size == I2C_SMBUS_WORD_DATA ? 4 : 2, res); - } else { - fprintf(stderr, "Value 0x%0*x written, readback matched\n", - size == I2C_SMBUS_WORD_DATA ? 4 : 2, value); - } - - exit(e1); -} From 60e6bd2f701ac3d5f545377f44b722737819e0c7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 27 Jun 2007 08:30:45 +0000 Subject: [PATCH 071/718] Update our copies of the GPL v2 to the latest version. The only real change if the FSF address. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4483 7894878c-1315-0410-8ee3-d5d059ff63e0 --- COPYING | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/COPYING b/COPYING index a43ea212..d511905c 100644 --- a/COPYING +++ b/COPYING @@ -1,8 +1,8 @@ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -278,8 +278,8 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - Copyright (C) 19yy + Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -303,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -335,5 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. From cb6e7eed56f1d0b7d34a099c4c73d05b743176b0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 27 Jun 2007 08:42:40 +0000 Subject: [PATCH 072/718] Drop the section about procfs access. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4484 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/developers/applications | 47 ++++++------------------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/doc/developers/applications b/doc/developers/applications index a8d1e654..60c89564 100644 --- a/doc/developers/applications +++ b/doc/developers/applications @@ -11,8 +11,7 @@ From lowest-level to the highest-level, the access methods are: 1) Character device access to the i2c bus driver via /dev/i2c-x 2) I2C bus access functions as defined in kernel/include/i2c-dev.h - 3A) /proc access to the chip device driver - 3B) sysfs access to the chip device driver + 3) sysfs access to the chip device driver 4) libsensors library 5) sensors program @@ -60,40 +59,8 @@ Details: i2c-tools package). -3A. /proc access (2.4 kernels) ------------------------------ - Chip drivers using the i2c-proc module create subdirectories in - /proc/sys/dev/sensors which can be accessed directly by applications. - Naming and content standards for the entries in these subdirectories - is documented in the file doc/developers/proc. Note that these - standards may not be strictly followed. - - If a new driver adheres to these standards then an application may - be able to support new devices on-the-fly. - - /proc access provides a method to read and write sensor values - for any driver using i2c-proc, including ISA chip drivers. - - This method also works well for shell and perl scripts - written to access a specific device. Note that i2c-proc is - standard in the kernel as of kernel 2.4.13. - - Note that most drivers provide only raw sensor readings via /proc; - many readings must be scaled or adjusted, and these adjustments - must often be changed by the user. An application using /proc must - generally provide adjustment facilities and the requirements - of the adjustments can be quite complex. If you need adjustment - facilities, consider the libsensors library, below. - - For examples of programs using /proc accesses, see - prog/eeprom/decode-dimms.pl, prog/matorb/displayit.pl, - prog/maxilife/writelcd.sh, prog/rrd/sens_update_rrd, - prog/pwm/fancontrol, and prog/pwm/pwmconfig. - Also search freshmeat for sensors applications. - - -3B. sysfs access (2.6 kernels) ------------------------------- +3. sysfs access +--------------- Chip drivers using the i2c-sensor module create subdirectories in the sysfs filesystem (usually /sys) which can be accessed directly by applications. @@ -106,7 +73,7 @@ Details: be able to support new devices on-the-fly. sysfs access provides a method to read and write sensor values - for any driver using i2c-sensor, including ISA chip drivers. + for any driver, including ISA chip drivers. This method may also works well for shell and perl scripts written to access a specific device. Note that sysfs is @@ -114,14 +81,14 @@ Details: Note that most drivers provide only raw sensor readings via /sys; many readings must be scaled or adjusted, and these adjustments - must often be changed by the user. An application using /proc must + must often be changed by the user. An application using /sys must generally provide adjustment facilities and the requirements of the adjustments can be quite complex. If you need adjustment facilities, consider the libsensors library, below. For an examples of a program using /sys accesses, see gkrellm. - See also lib/proc.c and prog/dump/i2cbusses.c for examples. - The sysfsutils package may also be helpful. + See also lib/proc.c and i2cbusses.c (in the i2c-tools package) for + examples. The sysfsutils package may also be helpful. Also search freshmeat for sensors and sysfs applications. From 4133206de96a893e04d8f2c6f708f294acc47091 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 27 Jun 2007 09:13:05 +0000 Subject: [PATCH 073/718] Move i2c-dev.h to the i2c-tools package. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4485 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/include/i2c-dev.h | 334 --------------------------------------- 1 file changed, 334 deletions(-) delete mode 100644 kernel/include/i2c-dev.h diff --git a/kernel/include/i2c-dev.h b/kernel/include/i2c-dev.h deleted file mode 100644 index 5284cf11..00000000 --- a/kernel/include/i2c-dev.h +++ /dev/null @@ -1,334 +0,0 @@ -/* - i2c-dev.h - i2c-bus driver, char device interface - - Copyright (C) 1995-97 Simon G. Vogl - Copyright (C) 1998-99 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* $Id$ */ - -#ifndef LIB_I2CDEV_H -#define LIB_I2CDEV_H - -#include -#include - - -/* -- i2c.h -- */ - - -/* - * I2C Message - used for pure i2c transaction, also from /dev interface - */ -struct i2c_msg { - __u16 addr; /* slave address */ - unsigned short flags; -#define I2C_M_TEN 0x10 /* we have a ten bit chip address */ -#define I2C_M_RD 0x01 -#define I2C_M_NOSTART 0x4000 -#define I2C_M_REV_DIR_ADDR 0x2000 -#define I2C_M_IGNORE_NAK 0x1000 -#define I2C_M_NO_RD_ACK 0x0800 - short len; /* msg length */ - char *buf; /* pointer to msg data */ -}; - -/* To determine what functionality is present */ - -#define I2C_FUNC_I2C 0x00000001 -#define I2C_FUNC_10BIT_ADDR 0x00000002 -#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ -#define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */ -#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ -#define I2C_FUNC_SMBUS_QUICK 0x00010000 -#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 -#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 -#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 -#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 -#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 -#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 -#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 -#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 -#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 -#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ -#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ -#define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ -#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */ - -#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ - I2C_FUNC_SMBUS_WRITE_BYTE) -#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ - I2C_FUNC_SMBUS_WRITE_BYTE_DATA) -#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ - I2C_FUNC_SMBUS_WRITE_WORD_DATA) -#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ - I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) -#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) -#define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \ - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2) - -/* - * Data for SMBus Messages - */ -#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ -#define I2C_SMBUS_I2C_BLOCK_MAX 32 /* Not specified but we use same structure */ -union i2c_smbus_data { - __u8 byte; - __u16 word; - __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ - /* and one more for PEC */ -}; - -/* smbus_access read or write markers */ -#define I2C_SMBUS_READ 1 -#define I2C_SMBUS_WRITE 0 - -/* SMBus transaction types (size parameter in the above functions) - Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ -#define I2C_SMBUS_QUICK 0 -#define I2C_SMBUS_BYTE 1 -#define I2C_SMBUS_BYTE_DATA 2 -#define I2C_SMBUS_WORD_DATA 3 -#define I2C_SMBUS_PROC_CALL 4 -#define I2C_SMBUS_BLOCK_DATA 5 -#define I2C_SMBUS_I2C_BLOCK_BROKEN 6 -#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ -#define I2C_SMBUS_I2C_BLOCK_DATA 8 - - -/* ----- commands for the ioctl like i2c_command call: - * note that additional calls are defined in the algorithm and hw - * dependent layers - these can be listed here, or see the - * corresponding header files. - */ - /* -> bit-adapter specific ioctls */ -#define I2C_RETRIES 0x0701 /* number of times a device address */ - /* should be polled when not */ - /* acknowledging */ -#define I2C_TIMEOUT 0x0702 /* set timeout - call with int */ - - -/* this is for i2c-dev.c */ -#define I2C_SLAVE 0x0703 /* Change slave address */ - /* Attn.: Slave address is 7 or 10 bits */ -#define I2C_SLAVE_FORCE 0x0706 /* Change slave address */ - /* Attn.: Slave address is 7 or 10 bits */ - /* This changes the address, even if it */ - /* is already taken! */ -#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ - -#define I2C_FUNCS 0x0705 /* Get the adapter functionality */ -#define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/ -#define I2C_PEC 0x0708 /* != 0 for SMBus PEC */ - -#define I2C_SMBUS 0x0720 /* SMBus-level access */ - -/* -- i2c.h -- */ - - -/* Note: 10-bit addresses are NOT supported! */ - -/* This is the structure as used in the I2C_SMBUS ioctl call */ -struct i2c_smbus_ioctl_data { - char read_write; - __u8 command; - int size; - union i2c_smbus_data *data; -}; - -/* This is the structure as used in the I2C_RDWR ioctl call */ -struct i2c_rdwr_ioctl_data { - struct i2c_msg *msgs; /* pointers to i2c_msgs */ - int nmsgs; /* number of i2c_msgs */ -}; - - -static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command, - int size, union i2c_smbus_data *data) -{ - struct i2c_smbus_ioctl_data args; - - args.read_write = read_write; - args.command = command; - args.size = size; - args.data = data; - return ioctl(file,I2C_SMBUS,&args); -} - - -static inline __s32 i2c_smbus_write_quick(int file, __u8 value) -{ - return i2c_smbus_access(file,value,0,I2C_SMBUS_QUICK,NULL); -} - -static inline __s32 i2c_smbus_read_byte(int file) -{ - union i2c_smbus_data data; - if (i2c_smbus_access(file,I2C_SMBUS_READ,0,I2C_SMBUS_BYTE,&data)) - return -1; - else - return 0x0FF & data.byte; -} - -static inline __s32 i2c_smbus_write_byte(int file, __u8 value) -{ - return i2c_smbus_access(file,I2C_SMBUS_WRITE,value, - I2C_SMBUS_BYTE,NULL); -} - -static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command) -{ - union i2c_smbus_data data; - if (i2c_smbus_access(file,I2C_SMBUS_READ,command, - I2C_SMBUS_BYTE_DATA,&data)) - return -1; - else - return 0x0FF & data.byte; -} - -static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command, - __u8 value) -{ - union i2c_smbus_data data; - data.byte = value; - return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, - I2C_SMBUS_BYTE_DATA, &data); -} - -static inline __s32 i2c_smbus_read_word_data(int file, __u8 command) -{ - union i2c_smbus_data data; - if (i2c_smbus_access(file,I2C_SMBUS_READ,command, - I2C_SMBUS_WORD_DATA,&data)) - return -1; - else - return 0x0FFFF & data.word; -} - -static inline __s32 i2c_smbus_write_word_data(int file, __u8 command, - __u16 value) -{ - union i2c_smbus_data data; - data.word = value; - return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, - I2C_SMBUS_WORD_DATA, &data); -} - -static inline __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value) -{ - union i2c_smbus_data data; - data.word = value; - if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command, - I2C_SMBUS_PROC_CALL,&data)) - return -1; - else - return 0x0FFFF & data.word; -} - - -/* Returns the number of read bytes */ -static inline __s32 i2c_smbus_read_block_data(int file, __u8 command, - __u8 *values) -{ - union i2c_smbus_data data; - int i; - if (i2c_smbus_access(file,I2C_SMBUS_READ,command, - I2C_SMBUS_BLOCK_DATA,&data)) - return -1; - else { - for (i = 1; i <= data.block[0]; i++) - values[i-1] = data.block[i]; - return data.block[0]; - } -} - -static inline __s32 i2c_smbus_write_block_data(int file, __u8 command, - __u8 length, __u8 *values) -{ - union i2c_smbus_data data; - int i; - if (length > 32) - length = 32; - for (i = 1; i <= length; i++) - data.block[i] = values[i-1]; - data.block[0] = length; - return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, - I2C_SMBUS_BLOCK_DATA, &data); -} - -/* Returns the number of read bytes */ -/* Until kernel 2.6.22, the length is hardcoded to 32 bytes. If you - ask for less than 32 bytes, your code will only work with kernels - 2.6.23 and later. */ -static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, - __u8 length, __u8 *values) -{ - union i2c_smbus_data data; - int i; - - if (length > 32) - length = 32; - data.block[0] = length; - if (i2c_smbus_access(file,I2C_SMBUS_READ,command, - length == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN : - I2C_SMBUS_I2C_BLOCK_DATA,&data)) - return -1; - else { - for (i = 1; i <= data.block[0]; i++) - values[i-1] = data.block[i]; - return data.block[0]; - } -} - -static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, - __u8 length, __u8 *values) -{ - union i2c_smbus_data data; - int i; - if (length > 32) - length = 32; - for (i = 1; i <= length; i++) - data.block[i] = values[i-1]; - data.block[0] = length; - return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, - I2C_SMBUS_I2C_BLOCK_BROKEN, &data); -} - -/* Returns the number of read bytes */ -static inline __s32 i2c_smbus_block_process_call(int file, __u8 command, - __u8 length, __u8 *values) -{ - union i2c_smbus_data data; - int i; - if (length > 32) - length = 32; - for (i = 1; i <= length; i++) - data.block[i] = values[i-1]; - data.block[0] = length; - if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command, - I2C_SMBUS_BLOCK_PROC_CALL,&data)) - return -1; - else { - for (i = 1; i <= data.block[0]; i++) - values[i-1] = data.block[i]; - return data.block[0]; - } -} - - -#endif /* LIB_I2CDEV_H */ From d5cc9ae889f7bb2ac765bd9da474c5c8795bc6b0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 27 Jun 2007 10:10:34 +0000 Subject: [PATCH 074/718] Move the eeprom decoding scripts to the i2c-tools package. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4489 7894878c-1315-0410-8ee3-d5d059ff63e0 --- Makefile | 4 +- prog/eeprom/Module.mk | 35 - prog/eeprom/ddcmon | 566 ---------------- prog/eeprom/decode-dimms.pl | 1251 ----------------------------------- prog/eeprom/decode-edid.pl | 224 ------- prog/eeprom/decode-vaio.pl | 240 ------- prog/xeon/Module.mk | 32 - prog/xeon/decode-xeon.pl | 197 ------ 8 files changed, 2 insertions(+), 2547 deletions(-) delete mode 100644 prog/eeprom/Module.mk delete mode 100755 prog/eeprom/ddcmon delete mode 100755 prog/eeprom/decode-dimms.pl delete mode 100755 prog/eeprom/decode-edid.pl delete mode 100755 prog/eeprom/decode-vaio.pl delete mode 100644 prog/xeon/Module.mk delete mode 100755 prog/xeon/decode-xeon.pl diff --git a/Makefile b/Makefile index df32bfcc..69f33530 100644 --- a/Makefile +++ b/Makefile @@ -110,8 +110,8 @@ MACHINE := $(shell uname -m) # The subdirectories we need to build things in SRCDIRS := SRCDIRS += kernel/include -SRCDIRS += lib prog/detect prog/dump prog/eeprom prog/pwm \ - prog/sensors prog/xeon ${PROG_EXTRA:%=prog/%} etc +SRCDIRS += lib prog/detect prog/dump prog/pwm \ + prog/sensors ${PROG_EXTRA:%=prog/%} etc SRCDIRS += lib/test # Some often-used commands with default options diff --git a/prog/eeprom/Module.mk b/prog/eeprom/Module.mk deleted file mode 100644 index 126a650b..00000000 --- a/prog/eeprom/Module.mk +++ /dev/null @@ -1,35 +0,0 @@ -# Module.mk -# Copyright (c) 1998, 1999 Frodo Looijaard -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -MODULE_DIR := prog/eeprom -PROGEEPROMDIR := $(MODULE_DIR) - -PROGEEPROMTARGETS := $(MODULE_DIR)/ddcmon \ - $(MODULE_DIR)/decode-dimms.pl \ - $(MODULE_DIR)/decode-edid.pl \ - $(MODULE_DIR)/decode-vaio.pl - -REMOVEEEPROMBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGEEPROMTARGETS)) - -install-prog-eeprom: $(PROGEEPROMTARGETS) - $(MKDIR) $(DESTDIR)$(BINDIR) - $(INSTALL) -m 755 $(PROGEEPROMTARGETS) $(DESTDIR)$(BINDIR) - -user_install :: install-prog-eeprom - -user_uninstall:: - $(RM) $(REMOVEEEPROMBIN) diff --git a/prog/eeprom/ddcmon b/prog/eeprom/ddcmon deleted file mode 100755 index fd4bea21..00000000 --- a/prog/eeprom/ddcmon +++ /dev/null @@ -1,566 +0,0 @@ -#!/usr/bin/perl -w -# -# Copyright (C) 2004-2005 Jean Delvare -# -# Parts inspired from decode-edid.pl. -# Copyright (C) 2003-2004 Jean Delvare -# -# Parts inspired from the ddcmon driver and sensors' print_ddcmon function. -# Copyright (C) 1998-2004 The LM Sensors Group -# -# Parts inspired from the fbmon driver (Linux 2.6.10). -# Copyright (C) 2002 James Simmons -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Version 1.0 2005-01-04 Jean Delvare -# -# This script is a replacement for the now deprecated ddcmon kernel driver. -# Instead of having a dedicated driver, it is better to reuse the standard -# eeprom driver and implement the EDID-specific code in user-space. -# -# EDID (Extended Display Identification Data) is a VESA standard which -# allows storing (on manufacturer's side) and retrieving (on user's side) -# of configuration information about displays, such as manufacturer, -# serial number, physical dimensions and allowed horizontal and vertical -# refresh rates. -# -# Syntax: ddcmon [bus [address]] -# Address can be given in decimal or hexadecimal (with a 0x prefix). -# If no address is given, default is 0x50. -# Bus number must be given in decimal. If no bus number is given, -# try them all. - -use strict; -use Fcntl qw(:DEFAULT :seek); -use vars qw(@standard_scales); - -@standard_scales = ([1, 1], [3, 4], [4, 5], [16, 9]); - -# Make sure the eeprom module is loaded. -# For non-modular kernels, we can't help. -if (-r '/proc/modules') -{ - my $found = 0; - open(MODULES, '/proc/modules'); - while (!$found && defined ($_ = )) - { - $found++ if m/^eeprom\s+/; - } - close(MODULES); - - unless ($found) - { - print STDERR - "This script required the eeprom module to be loaded.\n"; - exit 1; - } -} - -# Only used for sysfs -sub rawread -{ - my $filename = shift; - my $length = shift; - my $offset = shift || 0; - my $bytes = ''; - - sysopen(FH, $filename, O_RDONLY) - or die "Can't open $filename"; - if ($offset) - { - sysseek(FH, $offset, SEEK_SET) - or die "Can't seek in $filename"; - } - - $offset = 0; - while ($length) - { - my $r = sysread(FH, $bytes, $length, $offset); - die "Can't read $filename" - unless defined($r); - die "Unexpected EOF in $filename" - unless $r; - $offset += $r; - $length -= $r; - } - close(FH); - - return $bytes; -} - -sub get_edid_sysfs -{ - my ($bus, $addr) = @_; - - my @bytes = unpack("C*", rawread("/sys/bus/i2c/devices/$bus-00$addr/eeprom", 128)); - - return \@bytes; -} - -sub get_edid_procfs -{ - my ($bus, $addr) = @_; - - my @bytes; - - for (my $i = 0 ; $i < 0x80; $i += 0x10) - { - my $filename = sprintf("/proc/sys/dev/sensors/eeprom-i2c-\%s-\%s/\%02x", - $bus, $addr, $i); - open(EEDATA, $filename) - or die "Can't read $filename"; - push @bytes, split(/\s+/, ); - close(EEDATA); - } - - return \@bytes; -} - -sub print_line -{ - my $label = shift; - my $pattern = shift; - - printf("\%-24s$pattern\n", $label.':', @_); -} - -sub extract_byte -{ - my ($bytes, $offset) = @_; - - return $bytes->[$offset]; -} - -sub extract_word -{ - my ($bytes, $offset) = @_; - - return ($bytes->[$offset] - | ($bytes->[$offset+1] << 8)); -} - -sub extract_manufacturer -{ - my ($bytes, $offset) = @_; - my $i = ($bytes->[$offset+1] | ($bytes->[$offset] << 8)); - - return sprintf('%c%c%c', - (($i >> 10) & 0x1f) + ord('A') - 1, - (($i >> 5) & 0x1f) + ord('A') - 1, - ($i & 0x1f) + ord('A') - 1); -} - -sub extract_sesquiword -{ - my ($bytes, $offset) = @_; - - return ($bytes->[$offset] - | ($bytes->[$offset+1] << 8) - | ($bytes->[$offset+2] << 16)); -} - -sub extract_dword -{ - my ($bytes, $offset) = @_; - - return ($bytes->[$offset] - | ($bytes->[$offset+1] << 8) - | ($bytes->[$offset+2] << 16) - | ($bytes->[$offset+3] << 24)); -} - -sub extract_display_input -{ - my ($bytes, $offset) = @_; - - my @voltage = ('0.700V/0.300V', '0.714V/0.286V', - '1.000V/0.400V', '0.700V/0.000V'); - - return 'Digital' - if ($bytes->[$offset] & 0x80); - - return 'Analog ('.$voltage[($bytes->[$offset] & 0x60) >> 5].')'; -} - -sub extract_dpms -{ - my ($bytes, $offset) = @_; - - my @supported; - - push @supported, 'Active Off' if ($bytes->[$offset] & 0x20); - push @supported, 'Suspend' if ($bytes->[$offset] & 0x40); - push @supported, 'Standby' if ($bytes->[$offset] & 0x80); - - return join(', ', @supported) - if (@supported); - - return 'None supported'; -} - -sub extract_color_mode -{ - my ($bytes, $offset) = @_; - - my @mode = ('Monochrome', 'RGB Multicolor', 'Non-RGB Multicolor'); - - return $mode[($bytes->[$offset] >> 3) & 0x03]; -} - -sub good_signature -{ - my $bytes = shift; - - return $bytes->[0] == 0x00 - && $bytes->[1] == 0xff - && $bytes->[2] == 0xff - && $bytes->[3] == 0xff - && $bytes->[4] == 0xff - && $bytes->[5] == 0xff - && $bytes->[6] == 0xff - && $bytes->[7] == 0x00; -} - -sub verify_checksum -{ - my $bytes = shift; - my $cs; - - for (my $i = 0, $cs = 0; $i < 0x80; $i++) - { - $cs += $bytes->[$i]; - } - - return (($cs & 0xff) == 0 ? 'OK' : 'Not OK'); -} - -sub add_timing -{ - my ($timings, $new) = @_; - - my $mode = sprintf('%ux%u@%u%s', $new->[0], $new->[1], - $new->[2], defined ($new->[3]) && - $new->[3] eq 'interlaced' ? 'i' : ''); - - $timings->{$mode} = $new; -} - -sub add_standard_timing -{ - my ($timings, $byte0, $byte1) = @_; - - # Unused slot - return if ($byte0 == $byte1) - && ($byte0 == 0x01 || $byte0 == 0x00 || $byte0 == 0x20); - - my $width = ($byte0 + 31) * 8; - my $height = $width * $standard_scales[$byte1 >> 6]->[0] - / $standard_scales[$byte1 >> 6]->[1]; - my $refresh = 60 + ($byte1 & 0x3f); - - add_timing($timings, [$width, $height, $refresh]); -} - -sub sort_timings -{ - # First order by width - return -1 if $a->[0] < $b->[0]; - return 1 if $a->[0] > $b->[0]; - - # Second by height - return -1 if $a->[1] < $b->[1]; - return 1 if $a->[1] > $b->[1]; - - # Third by frequency - # Interlaced modes count for half their frequency - my $freq_a = $a->[2]; - my $freq_b = $b->[2]; - $freq_a /= 2 if defined $a->[3] && $a->[3] eq 'interlaced'; - $freq_b /= 2 if defined $b->[3] && $b->[3] eq 'interlaced'; - return -1 if $freq_a < $freq_b; - return 1 if $freq_a > $freq_b; - - return 0; -} - -sub print_timings -{ - my ($bytes, $timings) = @_; - - # Established Timings - my @established = - ( - [720, 400, 70], - [720, 400, 88], - [640, 480, 60], - [640, 480, 67], - [640, 480, 72], - [640, 480, 75], - [800, 600, 56], - [800, 600, 60], - [800, 600, 72], - [800, 600, 75], - [832, 624, 75], - [1024, 768, 87, 'interlaced'], - [1024, 768, 60], - [1024, 768, 70], - [1024, 768, 75], - [1280, 1024, 75], - undef, undef, undef, - [1152, 870, 75], - ); - my $temp = extract_sesquiword($bytes, 0x23); - for (my $i = 0; $i < 24; $i++) - { - next unless defined($established[$i]); - add_timing($timings, $established[$i]) - if ($temp & (1 << $i)); - } - - # Standard Timings - for (my $i = 0x26; $i < 0x36; $i += 2) - { - add_standard_timing($timings, $bytes->[$i], $bytes->[$i+1]); - } - - foreach my $v (sort sort_timings values(%{$timings})) - { - print_line("Timing", '%ux%u @ %u Hz%s', - $v->[0], $v->[1], $v->[2], - defined($v->[3]) ? ' ('.$v->[3].')' : ''); - } -} - -sub extract_string -{ - my ($bytes, $offset) = @_; - my $string = ''; - - for (my $i = 5; $i < 18; $i++) - { - last if $bytes->[$offset+$i] == 0x0a - || $bytes->[$offset+$i] == 0x00; - $string .= chr($bytes->[$offset+$i]) - if ($bytes->[$offset+$i] >= 32 - && $bytes->[$offset+$i] < 127); - } - $string =~ s/\s+$//; - - return $string; -} - -# Some blocks contain different information: -# 0x00, 0x00, 0x00, 0xfa: Additional standard timings block -# 0x00, 0x00, 0x00, 0xfc: Monitor block -# 0x00, 0x00, 0x00, 0xfd: Limits block -# 0x00, 0x00, 0x00, 0xfe: Ascii block -# 0x00, 0x00, 0x00, 0xff: Serial block -# Return a reference to a hash containing all information. -sub extract_detailed_timings -{ - my ($bytes) = @_; - - my %info = ('timings' => {}); - - for (my $offset = 0x36; $offset < 0x7e; $offset += 18) - { - if ($bytes->[$offset] == 0x00 - && $bytes->[$offset+1] == 0x00 - && $bytes->[$offset+2] == 0x00 - && $bytes->[$offset+4] == 0x00) - { - if ($bytes->[$offset+3] == 0xfa) - { - for (my $i = $offset + 5; $i < $offset + 17; $i += 2) - { - add_standard_timing($info{'timings'}, - $bytes->[$i], - $bytes->[$i+1]); - } - } - - elsif ($bytes->[$offset+3] == 0xfc) - { - $info{'monitor'} .= extract_string($bytes, $offset); - } - - elsif ($bytes->[$offset+3] == 0xfd) - { - $info{'limits'}{'vsync_min'} = $bytes->[$offset+5]; - $info{'limits'}{'vsync_max'} = $bytes->[$offset+6]; - $info{'limits'}{'hsync_min'} = $bytes->[$offset+7]; - $info{'limits'}{'hsync_max'} = $bytes->[$offset+8]; - $info{'limits'}{'clock_max'} = $bytes->[$offset+9]; - } - - elsif ($bytes->[$offset+3] == 0xfe) - { - $info{'ascii'} .= extract_string($bytes, $offset); - } - - elsif ($bytes->[$offset+3] == 0xff) - { - $info{'serial'} .= extract_string($bytes, $offset); - } - - next; - } - - # Detailed Timing - my $width = $bytes->[$offset+2] + (($bytes->[$offset+4] & 0xf0) << 4); - my $height = $bytes->[$offset+5] + (($bytes->[$offset+7] & 0xf0) << 4); - my $clock = extract_word($bytes, $offset) * 10000; - my $hblank = $bytes->[$offset+3] + (($bytes->[$offset+4] & 0x0f) << 8); - my $vblank = $bytes->[$offset+6] + (($bytes->[$offset+7] & 0x0f) << 8); - my $area = ($width + $hblank) * ($height + $vblank); - next unless $area; # Should not happen, but... - my $refresh = ($clock + $area / 2) / $area; # Proper rounding - add_timing($info{'timings'}, [$width, $height, $refresh]); - } - - return \%info; -} - -sub print_edid -{ - my ($bus, $address) = @_; - my $bytes; - - if (-r "/sys/bus/i2c/devices/$bus-00$address/eeprom") - { - $bytes = get_edid_sysfs($bus, $address); - } - elsif (-r "/proc/sys/dev/sensors/eeprom-i2c-$bus-$address/00") - { - $bytes = get_edid_procfs($bus, $address); - } - - return 1 unless defined $bytes; - return 2 unless good_signature($bytes); - - print_line('Checksum', '%s', verify_checksum($bytes)); - my $edid_version = extract_byte($bytes, 0x12); - my $edid_revision = extract_byte($bytes, 0x13); - print_line('EDID Version', '%u.%u', $edid_version, - $edid_revision); - if ($edid_version > 1 || $edid_revision > 2) - { - $standard_scales[0][0] = 16; - $standard_scales[0][1] = 10; - } - else - { - $standard_scales[0][0] = 1; - $standard_scales[0][1] = 1; - } - - my $info = extract_detailed_timings($bytes); - - print_line('Manufacturer ID', '%s', extract_manufacturer($bytes, 0x08)); - print_line('Model Number', '0x%04X', extract_word($bytes, 0x0A)); - print_line('Model Name', '%s', $info->{'monitor'}) - if defined $info->{'monitor'}; - - if ($info->{'serial'}) - { - print_line('Serial Number', '%s', $info->{'serial'}) - } - elsif ((my $temp = extract_dword($bytes, 0x0C))) - { - print_line('Serial Number', '%u', $temp) - } - - print_line('Manufacture Time', '%u-W%02u', - 1990 + extract_byte($bytes, 0x11), - extract_byte($bytes, 0x10)); - print_line('Display Input', '%s', extract_display_input($bytes, 0x14)); - print_line('Monitor Size (cm)', '%ux%u', extract_byte($bytes, 0x15), - extract_byte($bytes, 0x16)); - print_line('Gamma Factor', '%.2f', - 1 + extract_byte($bytes, 0x17) / 100.0); - print_line('DPMS Modes', '%s', extract_dpms($bytes, 0x18)); - print_line('Color Mode', '%s', extract_color_mode($bytes, 0x18)) - if (($bytes->[0x18] & 0x18) != 0x18); - print_line('Additional Info', '%s', $info->{'ascii'}) - if $info->{'ascii'}; - - if (defined($info->{'limits'})) - { - print_line('Vertical Sync (Hz)', '%u-%u', - $info->{'limits'}{'vsync_min'}, - $info->{'limits'}{'vsync_max'}); - print_line('Horizontal Sync (kHz)', '%u-%u', - $info->{'limits'}{'hsync_min'}, - $info->{'limits'}{'hsync_max'}); - print_line('Max Pixel Clock (MHz)', '%u', - $info->{'limits'}{'clock_max'} * 10) - unless $info->{'limits'}{'clock_max'} == 0xff; - } - - print_timings($bytes, $info->{'timings'}); - print("\n"); - return 0; -} - -# Get the address. Default to 0x50 if not given. -my $address; -if (defined($ARGV[1])) -{ - $address = $ARGV[1]; - # Convert to decimal, whatever the value. - $address = oct $address if $address =~ m/^0/; - # Convert to an hexadecimal string. - $address = sprintf '%02x', $address; -} -else -{ - $address = '50'; -} - -if (defined($ARGV[0])) -{ - my $error = print_edid($ARGV[0], $address); - - if ($error == 1) - { - print STDERR - "No EEPROM found at 0x$address on bus $ARGV[0].\n"; - exit 1; - } - elsif ($error == 2) - { - print STDERR - "EEPROM found at 0x$address on bus $ARGV[0], but is not an EDID EEPROM.\n"; - exit 1; - } -} -# If no bus is given, try them all. -else -{ - my $total = 0; - - for (my $i = 0; $i < 16; $i++) - { - $total++ unless print_edid($i, $address); - } - - unless ($total) - { - print STDERR - "No EDID EEPROM found.\n"; - exit 1; - } -} diff --git a/prog/eeprom/decode-dimms.pl b/prog/eeprom/decode-dimms.pl deleted file mode 100755 index d227879e..00000000 --- a/prog/eeprom/decode-dimms.pl +++ /dev/null @@ -1,1251 +0,0 @@ -#!/usr/bin/perl -w -# -# Copyright 1998, 1999 Philip Edelbrock -# modified by Christian Zuckschwerdt -# modified by Burkart Lingner -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Version 0.4 1999 Philip Edelbrock -# Version 0.5 2000-03-30 Christian Zuckschwerdt -# html output (selectable by commandline switches) -# Version 0.6 2000-09-16 Christian Zuckschwerdt -# updated according to SPD Spec Rev 1.2B -# see http://developer.intel.com/technology/memory/pc133sdram/spec/Spdsd12b.htm -# Version 0.7 2002-11-08 Jean Delvare -# pass -w and use strict -# valid HTML 3.2 output (--format mode) -# miscellaneous formatting enhancements and bug fixes -# clearer HTML output (original patch by Nick Kurshev ) -# stop decoding on checksum error by default (--checksum option forces) -# Version 0.8 2005-06-20 Burkart Lingner -# adapted to Kernel 2.6's /sys filesystem -# Version 0.9 2005-07-15 Jean Delvare -# fix perl warning -# fix typo -# refactor some code -# Version 1.0 2005-09-18 Jean Delvare -# add large lookup tables for manufacturer names, based on data -# provided by Rudolf Marek, taken from: -# http://www.jedec.org/download/search/JEP106r.pdf -# Version 1.1 2006-01-22 Jean Delvare -# improve the text output, making it hopefully clearer -# read eeprom by 64-byte blocks, this allows some code cleanups -# use sysopen/sysread instead of open/read for better performance -# verify checksum before decoding anything -# Version 1.2 2006-05-15 Jean Delvare -# implement per-memory-type decoding -# don't decode revision code, manufacturing date and assembly serial -# number where not set -# decode the manufacturing date to an ISO8601 date -# Version 1.3 2006-05-21 Jean Delvare -# detect undefined manufacturer code and handle it properly -# round up timing data -# minor display adjustments -# group cycle and access times, display the CAS value for each (SDRAM) -# refactor some bitfield tests into loops (SDRAM) -# display latencies and burst length on a single line (SDRAM) -# don't display manufacturing location when undefined -# check that the manufacturing date is proper BCD, else fall back to -# hexadecimal display -# Version 1.4 2006-05-26 Jean Delvare -# fix latencies decoding (SDRAM) -# fix CAS latency decoding (DDR SDRAM) -# decode latencies, timings and module height (DDR SDRAM) -# decode size (Direct Rambus, Rambus) -# decode latencies and timings (DDR2 SDRAM) -# SPD revision decoding depends on memory type -# use more user-friendly labels -# fix HTML formatted output on checksum error -# -# -# EEPROM data decoding for SDRAM DIMM modules. -# -# Two assumptions: lm_sensors-2.x installed, -# and Perl is at /usr/bin/perl -# -# use the following command line switches -# -f, --format print nice html output -# -b, --bodyonly don't print html header -# (useful for postprocessing the output) -# -c, --checksum decode completely even if checksum fails -# -h, --help display this usage summary -# -# References: -# PC SDRAM Serial Presence -# Detect (SPD) Specification, Intel, -# 1997,1999, Rev 1.2B -# -# Jedec Standards 4.1.x & 4.5.x -# http://www.jedec.org -# - -require 5.004; - -use strict; -use POSIX; -use Fcntl qw(:DEFAULT :seek); -use vars qw($opt_html $opt_body $opt_bodyonly $opt_igncheck $use_sysfs - @vendors %decode_callback); - -@vendors = ( -["AMD", "AMI", "Fairchild", "Fujitsu", - "GTE", "Harris", "Hitachi", "Inmos", - "Intel", "I.T.T.", "Intersil", "Monolithic Memories", - "Mostek", "Freescale (formerly Motorola)", "National", "NEC", - "RCA", "Raytheon", "Conexant (Rockwell)", "Seeq", - "Philips Semi. (Signetics)", "Synertek", "Texas Instruments", "Toshiba", - "Xicor", "Zilog", "Eurotechnique", "Mitsubishi", - "Lucent (AT&T)", "Exel", "Atmel", "SGS/Thomson", - "Lattice Semi.", "NCR", "Wafer Scale Integration", "IBM", - "Tristar", "Visic", "Intl. CMOS Technology", "SSSI", - "MicrochipTechnology", "Ricoh Ltd.", "VLSI", "Micron Technology", - "Hyundai Electronics", "OKI Semiconductor", "ACTEL", "Sharp", - "Catalyst", "Panasonic", "IDT", "Cypress", - "DEC", "LSI Logic", "Zarlink (formerly Plessey)", "UTMC", - "Thinking Machine", "Thomson CSF", "Integrated CMOS (Vertex)", "Honeywell", - "Tektronix", "Sun Microsystems", "SST", "ProMos/Mosel Vitelic", - "Infineon (formerly Siemens)", "Macronix", "Xerox", "Plus Logic", - "SunDisk", "Elan Circuit Tech.", "European Silicon Str.", "Apple Computer", - "Xilinx", "Compaq", "Protocol Engines", "SCI", - "Seiko Instruments", "Samsung", "I3 Design System", "Klic", - "Crosspoint Solutions", "Alliance Semiconductor", "Tandem", "Hewlett-Packard", - "Intg. Silicon Solutions", "Brooktree", "New Media", "MHS Electronic", - "Performance Semi.", "Winbond Electronic", "Kawasaki Steel", "Bright Micro", - "TECMAR", "Exar", "PCMCIA", "LG Semi (formerly Goldstar)", - "Northern Telecom", "Sanyo", "Array Microsystems", "Crystal Semiconductor", - "Analog Devices", "PMC-Sierra", "Asparix", "Convex Computer", - "Quality Semiconductor", "Nimbus Technology", "Transwitch", "Micronas (ITT Intermetall)", - "Cannon", "Altera", "NEXCOM", "QUALCOMM", - "Sony", "Cray Research", "AMS(Austria Micro)", "Vitesse", - "Aster Electronics", "Bay Networks (Synoptic)", "Zentrum or ZMD", "TRW", - "Thesys", "Solbourne Computer", "Allied-Signal", "Dialog", - "Media Vision", "Level One Communication"], -["Cirrus Logic", "National Instruments", "ILC Data Device", "Alcatel Mietec", - "Micro Linear", "Univ. of NC", "JTAG Technologies", "BAE Systems", - "Nchip", "Galileo Tech", "Bestlink Systems", "Graychip", - "GENNUM", "VideoLogic", "Robert Bosch", "Chip Express", - "DATARAM", "United Microelec Corp.", "TCSI", "Smart Modular", - "Hughes Aircraft", "Lanstar Semiconductor", "Qlogic", "Kingston", - "Music Semi", "Ericsson Components", "SpaSE", "Eon Silicon Devices", - "Programmable Micro Corp", "DoD", "Integ. Memories Tech.", "Corollary Inc.", - "Dallas Semiconductor", "Omnivision", "EIV(Switzerland)", "Novatel Wireless", - "Zarlink (formerly Mitel)", "Clearpoint", "Cabletron", "Silicon Technology", - "Vanguard", "Hagiwara Sys-Com", "Vantis", "Celestica", - "Century", "Hal Computers", "Rohm Company Ltd.", "Juniper Networks", - "Libit Signal Processing", "Mushkin Enhanced Memory", "Tundra Semiconductor", "Adaptec Inc.", - "LightSpeed Semi.", "ZSP Corp.", "AMIC Technology", "Adobe Systems", - "Dynachip", "PNY Electronics", "Newport Digital", "MMC Networks", - "T Square", "Seiko Epson", "Broadcom", "Viking Components", - "V3 Semiconductor", "Flextronics (formerly Orbit)", "Suwa Electronics", "Transmeta", - "Micron CMS", "American Computer & Digital Components Inc", "Enhance 3000 Inc", "Tower Semiconductor", - "CPU Design", "Price Point", "Maxim Integrated Product", "Tellabs", - "Centaur Technology", "Unigen Corporation", "Transcend Information", "Memory Card Technology", - "CKD Corporation Ltd.", "Capital Instruments, Inc.", "Aica Kogyo, Ltd.", "Linvex Technology", - "MSC Vertriebs GmbH", "AKM Company, Ltd.", "Dynamem, Inc.", "NERA ASA", - "GSI Technology", "Dane-Elec (C Memory)", "Acorn Computers", "Lara Technology", - "Oak Technology, Inc.", "Itec Memory", "Tanisys Technology", "Truevision", - "Wintec Industries", "Super PC Memory", "MGV Memory", "Galvantech", - "Gadzoox Nteworks", "Multi Dimensional Cons.", "GateField", "Integrated Memory System", - "Triscend", "XaQti", "Goldenram", "Clear Logic", - "Cimaron Communications", "Nippon Steel Semi. Corp.", "Advantage Memory", "AMCC", - "LeCroy", "Yamaha Corporation", "Digital Microwave", "NetLogic Microsystems", - "MIMOS Semiconductor", "Advanced Fibre", "BF Goodrich Data.", "Epigram", - "Acbel Polytech Inc.", "Apacer Technology", "Admor Memory", "FOXCONN", - "Quadratics Superconductor", "3COM"], -["Camintonn Corporation", "ISOA Incorporated", "Agate Semiconductor", "ADMtek Incorporated", - "HYPERTEC", "Adhoc Technologies", "MOSAID Technologies", "Ardent Technologies", - "Switchcore", "Cisco Systems, Inc.", "Allayer Technologies", "WorkX AG", - "Oasis Semiconductor", "Novanet Semiconductor", "E-M Solutions", "Power General", - "Advanced Hardware Arch.", "Inova Semiconductors GmbH", "Telocity", "Delkin Devices", - "Symagery Microsystems", "C-Port Corporation", "SiberCore Technologies", "Southland Microsystems", - "Malleable Technologies", "Kendin Communications", "Great Technology Microcomputer", "Sanmina Corporation", - "HADCO Corporation", "Corsair", "Actrans System Inc.", "ALPHA Technologies", - "Silicon Laboratories, Inc. (Cygnal)", "Artesyn Technologies", "Align Manufacturing", "Peregrine Semiconductor", - "Chameleon Systems", "Aplus Flash Technology", "MIPS Technologies", "Chrysalis ITS", - "ADTEC Corporation", "Kentron Technologies", "Win Technologies", "Tachyon Semiconductor (formerly ASIC Designs Inc.)", - "Extreme Packet Devices", "RF Micro Devices", "Siemens AG", "Sarnoff Corporation", - "Itautec Philco SA", "Radiata Inc.", "Benchmark Elect. (AVEX)", "Legend", - "SpecTek Incorporated", "Hi/fn", "Enikia Incorporated", "SwitchOn Networks", - "AANetcom Incorporated", "Micro Memory Bank", "ESS Technology", "Virata Corporation", - "Excess Bandwidth", "West Bay Semiconductor", "DSP Group", "Newport Communications", - "Chip2Chip Incorporated", "Phobos Corporation", "Intellitech Corporation", "Nordic VLSI ASA", - "Ishoni Networks", "Silicon Spice", "Alchemy Semiconductor", "Agilent Technologies", - "Centillium Communications", "W.L. Gore", "HanBit Electronics", "GlobeSpan", - "Element 14", "Pycon", "Saifun Semiconductors", "Sibyte, Incorporated", - "MetaLink Technologies", "Feiya Technology", "I & C Technology", "Shikatronics", - "Elektrobit", "Megic", "Com-Tier", "Malaysia Micro Solutions", - "Hyperchip", "Gemstone Communications", "Anadigm (formerly Anadyne)", "3ParData", - "Mellanox Technologies", "Tenx Technologies", "Helix AG", "Domosys", - "Skyup Technology", "HiNT Corporation", "Chiaro", "MCI Computer GMBH", - "Exbit Technology A/S", "Integrated Technology Express", "AVED Memory", "Legerity", - "Jasmine Networks", "Caspian Networks", "nCUBE", "Silicon Access Networks", - "FDK Corporation", "High Bandwidth Access", "MultiLink Technology", "BRECIS", - "World Wide Packets", "APW", "Chicory Systems", "Xstream Logic", - "Fast-Chip", "Zucotto Wireless", "Realchip", "Galaxy Power", - "eSilicon", "Morphics Technology", "Accelerant Networks", "Silicon Wave", - "SandCraft", "Elpida"], -["Solectron", "Optosys Technologies", "Buffalo (Formerly Melco)", "TriMedia Technologies", - "Cyan Technologies", "Global Locate", "Optillion", "Terago Communications", - "Ikanos Communications", "Princeton Technology", "Nanya Technology", "Elite Flash Storage", - "Mysticom", "LightSand Communications", "ATI Technologies", "Agere Systems", - "NeoMagic", "AuroraNetics", "Golden Empire", "Mushkin", - "Tioga Technologies", "Netlist", "TeraLogic", "Cicada Semiconductor", - "Centon Electronics", "Tyco Electronics", "Magis Works", "Zettacom", - "Cogency Semiconductor", "Chipcon AS", "Aspex Technology", "F5 Networks", - "Programmable Silicon Solutions", "ChipWrights", "Acorn Networks", "Quicklogic", - "Kingmax Semiconductor", "BOPS", "Flasys", "BitBlitz Communications", - "eMemory Technology", "Procket Networks", "Purple Ray", "Trebia Networks", - "Delta Electronics", "Onex Communications", "Ample Communications", "Memory Experts Intl", - "Astute Networks", "Azanda Network Devices", "Dibcom", "Tekmos", - "API NetWorks", "Bay Microsystems", "Firecron Ltd", "Resonext Communications", - "Tachys Technologies", "Equator Technology", "Concept Computer", "SILCOM", - "3Dlabs", "c't Magazine", "Sanera Systems", "Silicon Packets", - "Viasystems Group", "Simtek", "Semicon Devices Singapore", "Satron Handelsges", - "Improv Systems", "INDUSYS GmbH", "Corrent", "Infrant Technologies", - "Ritek Corp", "empowerTel Networks", "Hypertec", "Cavium Networks", - "PLX Technology", "Massana Design", "Intrinsity", "Valence Semiconductor", - "Terawave Communications", "IceFyre Semiconductor", "Primarion", "Picochip Designs Ltd", - "Silverback Systems", "Jade Star Technologies", "Pijnenburg Securealink", - "TakeMS International AG", "Cambridge Silicon Radio", - "Swissbit", "Nazomi Communications", "eWave System", - "Rockwell Collins", "Picocel Co., Ltd.", "Alphamosaic Ltd", "Sandburst", - "SiCon Video", "NanoAmp Solutions", "Ericsson Technology", "PrairieComm", - "Mitac International", "Layer N Networks", "MtekVision", "Allegro Networks", - "Marvell Semiconductors", "Netergy Microelectronic", "NVIDIA", "Internet Machines", - "Peak Electronics", "Litchfield Communication", "Accton Technology", "Teradiant Networks", - "Europe Technologies", "Cortina Systems", "RAM Components", "Raqia Networks", - "ClearSpeed", "Matsushita Battery", "Xelerated", "SimpleTech", - "Utron Technology", "Astec International", "AVM gmbH", "Redux Communications", - "Dot Hill Systems", "TeraChip"], -["T-RAM Incorporated", "Innovics Wireless", "Teknovus", "KeyEye Communications", - "Runcom Technologies", "RedSwitch", "Dotcast", "Silicon Mountain Memory", - "Signia Technologies", "Pixim", "Galazar Networks", "White Electronic Designs", - "Patriot Scientific", "Neoaxiom Corporation", "3Y Power Technology", "Europe Technologies", - "Potentia Power Systems", "C-guys Incorporated", "Digital Communications Technology Incorporated", "Silicon-Based Technology", - "Fulcrum Microsystems", "Positivo Informatica Ltd", "XIOtech Corporation", "PortalPlayer", - "Zhiying Software", "Direct2Data", "Phonex Broadband", "Skyworks Solutions", - "Entropic Communications", "Pacific Force Technology", "Zensys A/S", "Legend Silicon Corp.", - "sci-worx GmbH", "Oasis Silicon Systems", "Renesas Technology", "Raza Microelectronics", - "Phyworks", "MediaTek", "Non-cents Productions", "US Modular", - "Wintegra Ltd", "Mathstar", "StarCore", "Oplus Technologies", - "Mindspeed", "Just Young Computer", "Radia Communications", "OCZ", - "Emuzed", "LOGIC Devices", "Inphi Corporation", "Quake Technologies", - "Vixel", "SolusTek", "Kongsberg Maritime", "Faraday Technology", - "Altium Ltd.", "Insyte", "ARM Ltd.", "DigiVision", - "Vativ Technologies", "Endicott Interconnect Technologies", "Pericom", "Bandspeed", - "LeWiz Communications", "CPU Technology", "Ramaxel Technology", "DSP Group", - "Axis Communications", "Legacy Electronics", "Chrontel", "Powerchip Semiconductor", - "MobilEye Technologies", "Excel Semiconductor", "A-DATA Technology", "VirtualDigm", - "G Skill Intl", "Quanta Computer", "Yield Microelectronics", "Afa Technologies", - "KINGBOX Technology Co. Ltd.", "Ceva", "iStor Networks", "Advance Modules", - "Microsoft", "Open-Silicon", "Goal Semiconductor", "ARC International", - "Simmtec", "Metanoia", "Key Stream", "Lowrance Electronics", - "Adimos", "SiGe Semiconductor", "Fodus Communications", "Credence Systems Corp.", - "Genesis Microchip Inc.", "Vihana, Inc.", "WIS Technologies", "GateChange Technologies", - "High Density Devices AS", "Synopsys", "Gigaram", "Enigma Semiconductor Inc.", - "Century Micro Inc.", "Icera Semiconductor", "Mediaworks Integrated Systems", "O'Neil Product Development", - "Supreme Top Technology Ltd.", "MicroDisplay Corporation", "Team Group Inc.", "Sinett Corporation", - "Toshiba Corporation", "Tensilica", "SiRF Technology", "Bacoc Inc.", - "SMaL Camera Technologies", "Thomson SC", "Airgo Networks", "Wisair Ltd.", - "SigmaTel", "Arkados", "Compete IT gmbH Co. KG", "Eudar Technology Inc.", - "Focus Enhancements", "Xyratex"], -["Specular Networks", "Patriot Memory", "U-Chip Technology Corp.", "Silicon Optix", - "Greenfield Networks", "CompuRAM GmbH", "Stargen, Inc.", "NetCell Corporation", - "Excalibrus Technologies Ltd", "SCM Microsystems", "Xsigo Systems, Inc.", "CHIPS & Systems Inc", - "Tier 1 Multichip Solutions", "CWRL Labs", "Teradici", "Gigaram, Inc.", - "g2 Microsystems", "PowerFlash Semiconductor", "P.A. Semi, Inc.", "NovaTech Solutions, S.A.", - "c2 Microsystems, Inc.", "Level5 Networks", "COS Memory AG", "Innovasic Semiconductor", - "02IC Co. Ltd", "Tabula, Inc.", "Crucial Technology", "Chelsio Communications", - "Solarflare Communications", "Xambala Inc.", "EADS Astrium", "ATO Semicon Co. Ltd.", - "Imaging Works, Inc.", "Astute Networks, Inc.", "Tzero", "Emulex", - "Power-One", "Pulse~LINK Inc.", "Hon Hai Precision Industry", "White Rock Networks Inc.", - "Telegent Systems USA, Inc.", "Atrua Technologies, Inc.", "Acbel Polytech Inc.", - "eRide Inc.","ULi Electronics Inc.", "Magnum Semiconductor Inc.", "neoOne Technology, Inc.", - "Connex Technology, Inc.", "Stream Processors, Inc.", "Focus Enhancements", "Telecis Wireless, Inc.", - "uNav Microelectronics", "Tarari, Inc.", "Ambric, Inc.", "Newport Media, Inc.", "VMTS", - "Enuclia Semiconductor, Inc.", "Virtium Technology Inc.", "Solid State System Co., Ltd.", "Kian Tech LLC", - "Artimi", "Power Quotient International", "Avago Technologies", "ADTechnology", "Sigma Designs", - "SiCortex, Inc.", "Ventura Technology Group", "eASIC", "M.H.S. SAS", "Micro Star International", - "Rapport Inc.", "Makway International", "Broad Reach Engineering Co.", - "Semiconductor Mfg Intl Corp", "SiConnect", "FCI USA Inc.", "Validity Sensors", - "Coney Technology Co. Ltd.", "Spans Logic", "Neterion Inc.", "Qimonda", - "New Japan Radio Co. Ltd.", "Velogix", "Montalvo Systems", "iVivity Inc.", "Walton Chaintech", - "AENEON", "Lorom Industrial Co. Ltd.", "Radiospire Networks", "Sensio Technologies, Inc.", - "Nethra Imaging", "Hexon Technology Pte Ltd", "CompuStocx (CSX)", "Methode Electronics, Inc.", - "Connect One Ltd.", "Opulan Technologies", "Septentrio NV", "Goldenmars Technology Inc.", - "Kreton Corporation", "Cochlear Ltd.", "Altair Semiconductor", "NetEffect, Inc.", - "Spansion, Inc.", "Taiwan Semiconductor Mfg", "Emphany Systems Inc.", - "ApaceWave Technologies", "Mobilygen Corporation", "Tego", "Cswitch Corporation", - "Haier (Beijing) IC Design Co.", "MetaRAM", "Axel Electronics Co. Ltd."]); - -$use_sysfs = -d '/sys/bus'; - -# We consider that no data was written to this area of the SPD EEPROM if -# all bytes read 0x00 or all bytes read 0xff -sub spd_written(@) -{ - my $all_00 = 1; - my $all_ff = 1; - - foreach my $b (@_) { - $all_00 = 0 unless $b == 0x00; - $all_ff = 0 unless $b == 0xff; - return 1 unless $all_00 or $all_ff; - } - - return 0; -} - -sub parity($) -{ - my $n = shift; - my $parity = 0; - - while ($n) { - $parity++ if ($n & 1); - $n >>= 1; - } - - return ($parity & 1); -} - -sub manufacturer(@) -{ - my @bytes = @_; - my $ai = 0; - my $first; - - return ("Undefined", []) unless spd_written(@bytes); - - while (defined($first = shift(@bytes)) && $first == 0x7F) { - $ai++; - } - - return ("Invalid", []) unless defined $first; - return ("Invalid", [$first, @bytes]) if parity($first) != 1; - return ("Unknown", \@bytes) unless (($first & 0x7F) - 1 <= $vendors[$ai]); - - return ($vendors[$ai][($first & 0x7F) - 1], \@bytes); -} - -sub manufacturer_data(@) -{ - my $hex = ""; - my $asc = ""; - - return unless spd_written(@_); - - foreach my $byte (@_) { - $hex .= sprintf("\%02X ", $byte); - $asc .= ($byte >= 32 && $byte < 127) ? chr($byte) : '?'; - } - - return "$hex(\"$asc\")"; -} - -sub part_number(@) -{ - my $asc = ""; - my $byte; - - while (defined ($byte = shift) && $byte >= 32 && $byte < 127) { - $asc .= chr($byte); - } - - return ($asc eq "") ? "Undefined" : $asc; -} - -sub printl ($$) # print a line w/ label and value -{ - my ($label, $value) = @_; - if ($opt_html) { - $label =~ s//\>/sg; - $label =~ s/\n/
    \n/sg; - $value =~ s//\>/sg; - $value =~ s/\n/
    \n/sg; - print "$label$value\n"; - } else { - my @values = split /\n/, $value; - printf "%-47s %s\n", $label, shift @values; - printf "%-47s %s\n", "", $_ foreach (@values); - } -} - -sub printl2 ($$) # print a line w/ label and value (outside a table) -{ - my ($label, $value) = @_; - if ($opt_html) { - $label =~ s//\>/sg; - $label =~ s/\n/
    \n/sg; - $value =~ s//\>/sg; - $value =~ s/\n/
    \n/sg; - } - print "$label: $value\n"; -} - -sub prints ($) # print seperator w/ given text -{ - my ($label) = @_; - if ($opt_html) { - $label =~ s//\>/sg; - $label =~ s/\n/
    \n/sg; - print "$label\n"; - } else { - print "\n---=== $label ===---\n"; - } -} - -sub printh ($$) # print header w/ given text -{ - my ($header, $sub) = @_; - if ($opt_html) { - $header =~ s//\>/sg; - $header =~ s/\n/
    \n/sg; - $sub =~ s//\>/sg; - $sub =~ s/\n/
    \n/sg; - print "

    $header

    \n"; - print "

    $sub

    \n"; - } else { - print "\n$header\n$sub\n"; - } -} - -# Parameter: bytes 0-63 -sub decode_sdr_sdram($) -{ - my $bytes = shift; - my ($l, $temp); - -# SPD revision - printl "SPD Revision", $bytes->[62]; - -#size computation - - prints "Memory Characteristics"; - - my $k=0; - my $ii=0; - - $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; - if (($bytes->[5] <= 8) && ($bytes->[17] <= 8)) { - $k = $bytes->[5] * $bytes->[17]; - } - - if($ii > 0 && $ii <= 12 && $k > 0) { - printl "Size", ((1 << $ii) * $k) . " MB"; } - else { - printl "INVALID SIZE", $bytes->[3] . "," . $bytes->[4] . "," . - $bytes->[5] . "," . $bytes->[17]; - } - - my @cas; - for ($ii = 0; $ii < 7; $ii++) { - push(@cas, $ii + 1) if ($bytes->[18] & (1 << $ii)); - } - - my $trcd; - my $trp; - my $tras; - my $ctime = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; - - $trcd =$bytes->[29]; - $trp =$bytes->[27];; - $tras =$bytes->[30]; - - printl "tCL-tRCD-tRP-tRAS", - $cas[$#cas] . "-" . - ceil($trcd/$ctime) . "-" . - ceil($trp/$ctime) . "-" . - ceil($tras/$ctime); - - $l = "Number of Row Address Bits"; - if ($bytes->[3] == 0) { printl $l, "Undefined!"; } - elsif ($bytes->[3] == 1) { printl $l, "1/16"; } - elsif ($bytes->[3] == 2) { printl $l, "2/17"; } - elsif ($bytes->[3] == 3) { printl $l, "3/18"; } - else { printl $l, $bytes->[3]; } - - $l = "Number of Col Address Bits"; - if ($bytes->[4] == 0) { printl $l, "Undefined!"; } - elsif ($bytes->[4] == 1) { printl $l, "1/16"; } - elsif ($bytes->[4] == 2) { printl $l, "2/17"; } - elsif ($bytes->[4] == 3) { printl $l, "3/18"; } - else { printl $l, $bytes->[4]; } - - $l = "Number of Module Rows"; - if ($bytes->[5] == 0 ) { printl $l, "Undefined!"; } - else { printl $l, $bytes->[5]; } - - $l = "Data Width"; - if ($bytes->[7] > 1) { - printl $l, "Undefined!" - } else { - $temp = ($bytes->[7] * 256) + $bytes->[6]; - printl $l, $temp; - } - - $l = "Module Interface Signal Levels"; - if ($bytes->[8] == 0) { printl $l, "5.0 Volt/TTL"; } - elsif ($bytes->[8] == 1) { printl $l, "LVTTL"; } - elsif ($bytes->[8] == 2) { printl $l, "HSTL 1.5"; } - elsif ($bytes->[8] == 3) { printl $l, "SSTL 3.3"; } - elsif ($bytes->[8] == 4) { printl $l, "SSTL 2.5"; } - elsif ($bytes->[8] == 255) { printl $l, "New Table"; } - else { printl $l, "Undefined!"; } - - $l = "Module Configuration Type"; - if ($bytes->[11] == 0) { printl $l, "No Parity"; } - elsif ($bytes->[11] == 1) { printl $l, "Parity"; } - elsif ($bytes->[11] == 2) { printl $l, "ECC"; } - else { printl $l, "Undefined!"; } - - $l = "Refresh Type"; - if ($bytes->[12] > 126) { printl $l, "Self Refreshing"; } - else { printl $l, "Not Self Refreshing"; } - - $l = "Refresh Rate"; - $temp = $bytes->[12] & 0x7f; - if ($temp == 0) { printl $l, "Normal (15.625 us)"; } - elsif ($temp == 1) { printl $l, "Reduced (3.9 us)"; } - elsif ($temp == 2) { printl $l, "Reduced (7.8 us)"; } - elsif ($temp == 3) { printl $l, "Extended (31.3 us)"; } - elsif ($temp == 4) { printl $l, "Extended (62.5 us)"; } - elsif ($temp == 5) { printl $l, "Extended (125 us)"; } - else { printl $l, "Undefined!"; } - - $l = "Primary SDRAM Component Bank Config"; - if ($bytes->[13] > 126) { printl $l, "Bank2 = 2 x Bank1"; } - else { printl $l, "No Bank2 OR Bank2 = Bank1 width"; } - - $l = "Primary SDRAM Component Widths"; - $temp = $bytes->[13] & 0x7f; - if ($temp == 0) { printl $l, "Undefined!\n"; } - else { printl $l, $temp; } - - $l = "Error Checking SDRAM Component Bank Config"; - if ($bytes->[14] > 126) { printl $l, "Bank2 = 2 x Bank1"; } - else { printl $l, "No Bank2 OR Bank2 = Bank1 width"; } - - $l = "Error Checking SDRAM Component Widths"; - $temp = $bytes->[14] & 0x7f; - if ($temp == 0) { printl $l, "Undefined!"; } - else { printl $l, $temp; } - - $l = "Min Clock Delay for Back to Back Random Access"; - if ($bytes->[15] == 0) { printl $l, "Undefined!"; } - else { printl $l, $bytes->[15]; } - - $l = "Burst lengths supported"; - my @array; - for ($ii = 0; $ii < 4; $ii++) { - push(@array, 1 << $ii) if ($bytes->[16] & (1 << $ii)); - } - push(@array, "Page") if ($bytes->[16] & 128); - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl $l, $temp; - - $l = "Number of Device Banks"; - if ($bytes->[17] == 0) { printl $l, "Undefined/Reserved!"; } - else { printl $l, $bytes->[17]; } - - $l = "Supported CAS Latencies"; - if (@cas) { $temp = join ', ', @cas; } - else { $temp = "None"; } - printl $l, $temp; - - $l = "Supported CS Latencies"; - @array = (); - for ($ii = 0; $ii < 7; $ii++) { - push(@array, $ii) if ($bytes->[19] & (1 << $ii)); - } - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl $l, $temp; - - $l = "Supported WE Latencies"; - @array = (); - for ($ii = 0; $ii < 7; $ii++) { - push(@array, $ii) if ($bytes->[20] & (1 << $ii)); - } - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl $l, $temp; - - if (@cas >= 1) { - $l = "Cycle Time (CAS ".$cas[$#cas].")"; - printl $l, "$ctime ns"; - - $l = "Access Time (CAS ".$cas[$#cas].")"; - $temp = ($bytes->[10] >> 4) + ($bytes->[10] & 0xf) * 0.1; - printl $l, "$temp ns"; - } - - if (@cas >= 2 && spd_written(@$bytes[23..24])) { - $l = "Cycle Time (CAS ".$cas[$#cas-1].")"; - $temp = $bytes->[23] >> 4; - if ($temp == 0) { printl $l, "Undefined!"; } - else { - if ($temp < 4 ) { $temp=$temp + 15; } - printl $l, $temp + (($bytes->[23] & 0xf) * 0.1) . " ns"; - } - - $l = "Access Time (CAS ".$cas[$#cas-1].")"; - $temp = $bytes->[24] >> 4; - if ($temp == 0) { printl $l, "Undefined!"; } - else { - if ($temp < 4 ) { $temp=$temp + 15; } - printl $l, $temp + (($bytes->[24] & 0xf) * 0.1) . " ns"; - } - } - - if (@cas >= 3 && spd_written(@$bytes[25..26])) { - $l = "Cycle Time (CAS ".$cas[$#cas-2].")"; - $temp = $bytes->[25] >> 2; - if ($temp == 0) { printl $l, "Undefined!"; } - else { printl $l, $temp + ($bytes->[25] & 0x3) * 0.25 . " ns"; } - - $l = "Access Time (CAS ".$cas[$#cas-2].")"; - $temp = $bytes->[26] >> 2; - if ($temp == 0) { printl $l, "Undefined!"; } - else { printl $l, $temp + ($bytes->[26] & 0x3) * 0.25 . " ns"; } - } - - $l = "SDRAM Module Attributes"; - $temp = ""; - if ($bytes->[21] & 1) { $temp .= "Buffered Address/Control Inputs\n"; } - if ($bytes->[21] & 2) { $temp .= "Registered Address/Control Inputs\n"; } - if ($bytes->[21] & 4) { $temp .= "On card PLL (clock)\n"; } - if ($bytes->[21] & 8) { $temp .= "Buffered DQMB Inputs\n"; } - if ($bytes->[21] & 16) { $temp .= "Registered DQMB Inputs\n"; } - if ($bytes->[21] & 32) { $temp .= "Differential Clock Input\n"; } - if ($bytes->[21] & 64) { $temp .= "Redundant Row Address\n"; } - if ($bytes->[21] & 128) { $temp .= "Undefined (bit 7)\n"; } - if ($bytes->[21] == 0) { $temp .= "(None Reported)\n"; } - printl $l, $temp; - - $l = "SDRAM Device Attributes (General)"; - $temp = ""; - if ($bytes->[22] & 1) { $temp .= "Supports Early RAS# Recharge\n"; } - if ($bytes->[22] & 2) { $temp .= "Supports Auto-Precharge\n"; } - if ($bytes->[22] & 4) { $temp .= "Supports Precharge All\n"; } - if ($bytes->[22] & 8) { $temp .= "Supports Write1/Read Burst\n"; } - if ($bytes->[22] & 16) { $temp .= "Lower VCC Tolerance: 5%\n"; } - else { $temp .= "Lower VCC Tolerance: 10%\n"; } - if ($bytes->[22] & 32) { $temp .= "Upper VCC Tolerance: 5%\n"; } - else { $temp .= "Upper VCC Tolerance: 10%\n"; } - if ($bytes->[22] & 64) { $temp .= "Undefined (bit 6)\n"; } - if ($bytes->[22] & 128) { $temp .= "Undefined (bit 7)\n"; } - printl $l, $temp; - - $l = "Minimum Row Precharge Time"; - if ($bytes->[27] == 0) { printl $l, "Undefined!"; } - else { printl $l, "$bytes->[27] ns"; } - - $l = "Row Active to Row Active Min"; - if ($bytes->[28] == 0) { printl $l, "Undefined!"; } - else { printl $l, "$bytes->[28] ns"; } - - $l = "RAS to CAS Delay"; - if ($bytes->[29] == 0) { printl $l, "Undefined!"; } - else { printl $l, "$bytes->[29] ns"; } - - $l = "Min RAS Pulse Width"; - if ($bytes->[30] == 0) { printl $l, "Undefined!"; } - else { printl $l, "$bytes->[30] ns"; } - - $l = "Row Densities"; - $temp = ""; - if ($bytes->[31] & 1) { $temp .= "4 MByte\n"; } - if ($bytes->[31] & 2) { $temp .= "8 MByte\n"; } - if ($bytes->[31] & 4) { $temp .= "16 MByte\n"; } - if ($bytes->[31] & 8) { $temp .= "32 MByte\n"; } - if ($bytes->[31] & 16) { $temp .= "64 MByte\n"; } - if ($bytes->[31] & 32) { $temp .= "128 MByte\n"; } - if ($bytes->[31] & 64) { $temp .= "256 MByte\n"; } - if ($bytes->[31] & 128) { $temp .= "512 MByte\n"; } - if ($bytes->[31] == 0) { $temp .= "(Undefined! -- None Reported!)\n"; } - printl $l, $temp; - - if (($bytes->[32] & 0xf) <= 9) { - $l = "Command and Address Signal Setup Time"; - $temp = (($bytes->[32] & 0x7f) >> 4) + ($bytes->[32] & 0xf) * 0.1; - printl $l, (($bytes->[32] >> 7) ? -$temp : $temp) . " ns"; - } - - if (($bytes->[33] & 0xf) <= 9) { - $l = "Command and Address Signal Hold Time"; - $temp = (($bytes->[33] & 0x7f) >> 4) + ($bytes->[33] & 0xf) * 0.1; - printl $l, (($bytes->[33] >> 7) ? -$temp : $temp) . " ns"; - } - - if (($bytes->[34] & 0xf) <= 9) { - $l = "Data Signal Setup Time"; - $temp = (($bytes->[34] & 0x7f) >> 4) + ($bytes->[34] & 0xf) * 0.1; - printl $l, (($bytes->[34] >> 7) ? -$temp : $temp) . " ns"; - } - - if (($bytes->[35] & 0xf) <= 9) { - $l = "Data Signal Hold Time"; - $temp = (($bytes->[35] & 0x7f) >> 4) + ($bytes->[35] & 0xf) * 0.1; - printl $l, (($bytes->[35] >> 7) ? -$temp : $temp) . " ns"; - } -} - -# Parameter: bytes 0-63 -sub decode_ddr_sdram($) -{ - my $bytes = shift; - my ($l, $temp); - -# SPD revision - if ($bytes->[62] != 0xff) { - printl "SPD Revision", ($bytes->[62] >> 4) . "." . - ($bytes->[62] & 0xf); - } - -# speed - prints "Memory Characteristics"; - - $l = "Maximum module speed"; - $temp = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; - my $ddrclk = 2 * (1000 / $temp); - my $tbits = ($bytes->[7] * 256) + $bytes->[6]; - if (($bytes->[11] == 2) || ($bytes->[11] == 1)) { $tbits = $tbits - 8; } - my $pcclk = int ($ddrclk * $tbits / 8); - $pcclk += 100 if ($pcclk % 100) >= 50; # Round properly - $pcclk = $pcclk - ($pcclk % 100); - $ddrclk = int ($ddrclk); - printl $l, "${ddrclk}MHz (PC${pcclk})"; - -#size computation - my $k=0; - my $ii=0; - - $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; - if (($bytes->[5] <= 8) && ($bytes->[17] <= 8)) { - $k = $bytes->[5] * $bytes->[17]; - } - - if($ii > 0 && $ii <= 12 && $k > 0) { - printl "Size", ((1 << $ii) * $k) . " MB"; } - else { - printl "INVALID SIZE", $bytes->[3] . ", " . $bytes->[4] . ", " . - $bytes->[5] . ", " . $bytes->[17]; - } - - my $highestCAS = 0; - my %cas; - for ($ii = 0; $ii < 7; $ii++) { - if ($bytes->[18] & (1 << $ii)) { - $highestCAS = 1+$ii*0.5; - $cas{$highestCAS}++; - } - } - - my $trcd; - my $trp; - my $tras; - my $ctime = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; - - $trcd =($bytes->[29] >> 2)+(($bytes->[29] & 3)*0.25); - $trp =($bytes->[27] >> 2)+(($bytes->[27] & 3)*0.25); - $tras = $bytes->[30]; - - printl "tCL-tRCD-tRP-tRAS", - $highestCAS . "-" . - ceil($trcd/$ctime) . "-" . - ceil($trp/$ctime) . "-" . - ceil($tras/$ctime); - -# latencies - if (keys %cas) { $temp = join ', ', sort { $b <=> $a } keys %cas; } - else { $temp = "None"; } - printl "Supported CAS Latencies", $temp; - - my @array; - for ($ii = 0; $ii < 7; $ii++) { - push(@array, $ii) if ($bytes->[19] & (1 << $ii)); - } - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl "Supported CS Latencies", $temp; - - @array = (); - for ($ii = 0; $ii < 7; $ii++) { - push(@array, $ii) if ($bytes->[20] & (1 << $ii)); - } - if (@array) { $temp = join ', ', @array; } - else { $temp = "None"; } - printl "Supported WE Latencies", $temp; - -# timings - if (exists $cas{$highestCAS}) { - printl "Minimum Cycle Time (CAS $highestCAS)", - "$ctime ns"; - - printl "Maximum Access Time (CAS $highestCAS)", - (($bytes->[10] >> 4) * 0.1 + ($bytes->[10] & 0xf) * 0.01) . " ns"; - } - - if (exists $cas{$highestCAS-0.5} && spd_written(@$bytes[23..24])) { - printl "Minimum Cycle Time (CAS ".($highestCAS-0.5).")", - (($bytes->[23] >> 4) + ($bytes->[23] & 0xf) * 0.1) . " ns"; - - printl "Maximum Access Time (CAS ".($highestCAS-0.5).")", - (($bytes->[24] >> 4) * 0.1 + ($bytes->[24] & 0xf) * 0.01) . " ns"; - } - - if (exists $cas{$highestCAS-1} && spd_written(@$bytes[25..26])) { - printl "Minimum Cycle Time (CAS ".($highestCAS-1).")", - (($bytes->[25] >> 4) + ($bytes->[25] & 0xf) * 0.1) . " ns"; - - printl "Maximum Access Time (CAS ".($highestCAS-1).")", - (($bytes->[26] >> 4) * 0.1 + ($bytes->[26] & 0xf) * 0.01) . " ns"; - } - -# module attributes - if ($bytes->[47] & 0x03) { - if (($bytes->[47] & 0x03) == 0x01) { $temp = "1.125\" to 1.25\""; } - elsif (($bytes->[47] & 0x03) == 0x02) { $temp = "1.7\""; } - elsif (($bytes->[47] & 0x03) == 0x03) { $temp = "Other"; } - printl "Module Height", $temp; - } -} - -sub ddr2_sdram_ctime($) -{ - my $byte = shift; - my $ctime; - - $ctime = $byte >> 4; - if (($byte & 0xf) <= 9) { $ctime += ($byte & 0xf) * 0.1; } - elsif (($byte & 0xf) == 10) { $ctime += 0.25; } - elsif (($byte & 0xf) == 11) { $ctime += 0.33; } - elsif (($byte & 0xf) == 12) { $ctime += 0.66; } - elsif (($byte & 0xf) == 13) { $ctime += 0.75; } - - return $ctime; -} - -sub ddr2_sdram_atime($) -{ - my $byte = shift; - my $atime; - - $atime = ($byte >> 4) * 0.1 + ($byte & 0xf) * 0.01; - - return $atime; -} - -# Parameter: bytes 0-63 -sub decode_ddr2_sdram($) -{ - my $bytes = shift; - my ($l, $temp); - -# SPD revision - if ($bytes->[62] != 0xff) { - printl "SPD Revision", ($bytes->[62] >> 4) . "." . - ($bytes->[62] & 0xf); - } - -# speed - prints "Memory Characteristics"; - - $l = "Maximum module speed"; - $temp = ($bytes->[9] >> 4) + ($bytes->[9] & 0xf) * 0.1; - my $ddrclk = 4 * (1000 / $temp); - my $tbits = ($bytes->[7] * 256) + $bytes->[6]; - if (($bytes->[11] == 2) || ($bytes->[11] == 1)) { $tbits = $tbits - 8; } - my $pcclk = int ($ddrclk * $tbits / 8); - $pcclk += 100 if ($pcclk % 100) >= 50; # Round properly - $pcclk = $pcclk - ($pcclk % 100); - $ddrclk = int ($ddrclk); - printl $l, "${ddrclk}MHz (PC${pcclk})"; - -#size computation - my $k=0; - my $ii=0; - - $ii = ($bytes->[3] & 0x0f) + ($bytes->[4] & 0x0f) - 17; - $k = (($bytes->[5] & 0x7) + 1) * $bytes->[17]; - - if($ii > 0 && $ii <= 12 && $k > 0) { - printl "Size", ((1 << $ii) * $k) . " MB"; - } else { - printl "INVALID SIZE", $bytes->[3] . "," . $bytes->[4] . "," . - $bytes->[5] . "," . $bytes->[17]; - } - - my $highestCAS = 0; - my %cas; - for ($ii = 2; $ii < 7; $ii++) { - if ($bytes->[18] & (1 << $ii)) { - $highestCAS = $ii; - $cas{$highestCAS}++; - } - } - - my $trcd; - my $trp; - my $tras; - my $ctime; - - $ctime = ddr2_sdram_ctime($bytes->[9]); - - $trcd =($bytes->[29] >> 2)+(($bytes->[29] & 3)*0.25); - $trp =($bytes->[27] >> 2)+(($bytes->[27] & 3)*0.25); - $tras =$bytes->[30]; - - printl "tCL-tRCD-tRP-tRAS", - $highestCAS . "-" . - ceil($trcd/$ctime) . "-" . - ceil($trp/$ctime) . "-" . - ceil($tras/$ctime); - -# latencies - if (keys %cas) { $temp = join ', ', sort { $b <=> $a } keys %cas; } - else { $temp = "None"; } - printl "Supported CAS Latencies", $temp; - -# timings - if (exists $cas{$highestCAS}) { - printl "Minimum Cycle Time (CAS $highestCAS)", - "$ctime ns"; - printl "Maximum Access Time (CAS $highestCAS)", - ddr2_sdram_atime($bytes->[10]) . " ns"; - } - - if (exists $cas{$highestCAS-1} && spd_written(@$bytes[23..24])) { - printl "Minimum Cycle Time (CAS ".($highestCAS-1).")", - ddr2_sdram_ctime($bytes->[23]) . " ns"; - printl "Maximum Access Time (CAS ".($highestCAS-1).")", - ddr2_sdram_atime($bytes->[24]) . " ns"; - } - - if (exists $cas{$highestCAS-2} && spd_written(@$bytes[25..26])) { - printl "Minimum Cycle Time (CAS ".($highestCAS-2).")", - ddr2_sdram_ctime($bytes->[25]) . " ns"; - printl "Maximum Access Time (CAS ".($highestCAS-2).")", - ddr2_sdram_atime($bytes->[26]) . " ns"; - } -} - -# Parameter: bytes 0-63 -sub decode_direct_rambus($) -{ - my $bytes = shift; - -#size computation - prints "Memory Characteristics"; - - my $ii; - - $ii = ($bytes->[4] & 0x0f) + ($bytes->[4] >> 4) + ($bytes->[5] & 0x07) - 13; - - if ($ii > 0 && $ii < 16) { - printl "Size", (1 << $ii) . " MB"; - } else { - printl "INVALID SIZE", sprintf("0x%02x, 0x%02x", - $bytes->[4], $bytes->[5]); - } -} - -# Parameter: bytes 0-63 -sub decode_rambus($) -{ - my $bytes = shift; - -#size computation - prints "Memory Characteristics"; - - my $ii; - - $ii = ($bytes->[3] & 0x0f) + ($bytes->[3] >> 4) + ($bytes->[5] & 0x07) - 13; - - if ($ii > 0 && $ii < 16) { - printl "Size", (1 << $ii) . " MB"; - } else { - printl "INVALID SIZE", sprintf("0x%02x, 0x%02x", - $bytes->[3], $bytes->[5]); - } -} - -%decode_callback = ( - "SDR SDRAM" => \&decode_sdr_sdram, - "DDR SDRAM" => \&decode_ddr_sdram, - "DDR2 SDRAM" => \&decode_ddr2_sdram, - "Direct Rambus" => \&decode_direct_rambus, - "Rambus" => \&decode_rambus, -); - -# Parameter: bytes 64-127 -sub decode_intel_spec_freq($) -{ - my $bytes = shift; - my ($l, $temp); - - prints "Intel Specification"; - - $l = "Frequency"; - if ($bytes->[62] == 0x66) { $temp = "66MHz\n"; } - elsif ($bytes->[62] == 100) { $temp = "100MHz or 133MHz\n"; } - elsif ($bytes->[62] == 133) { $temp = "133MHz\n"; } - else { $temp = "Undefined!\n"; } - printl $l, $temp; - - $l = "Details for 100MHz Support"; - $temp=""; - if ($bytes->[63] & 1) { $temp .= "Intel Concurrent Auto-precharge\n"; } - if ($bytes->[63] & 2) { $temp .= "CAS Latency = 2\n"; } - if ($bytes->[63] & 4) { $temp .= "CAS Latency = 3\n"; } - if ($bytes->[63] & 8) { $temp .= "Junction Temp A (100 degrees C)\n"; } - else { $temp .= "Junction Temp B (90 degrees C)\n"; } - if ($bytes->[63] & 16) { $temp .= "CLK 3 Connected\n"; } - if ($bytes->[63] & 32) { $temp .= "CLK 2 Connected\n"; } - if ($bytes->[63] & 64) { $temp .= "CLK 1 Connected\n"; } - if ($bytes->[63] & 128) { $temp .= "CLK 0 Connected\n"; } - if (($bytes->[63] & 192) == 192) { $temp .= "Double-sided DIMM\n"; } - elsif (($bytes->[63] & 192) != 0) { $temp .= "Single-sided DIMM\n"; } - printl $l, $temp; -} - -sub readspd64 ($$) { # reads 64 bytes from SPD-EEPROM - my ($offset, $dimm_i) = @_; - my @bytes; - if ($use_sysfs) { - # Kernel 2.6 with sysfs - sysopen(HANDLE, "/sys/bus/i2c/drivers/eeprom/$dimm_i/eeprom", O_RDONLY) - or die "Cannot open /sys/bus/i2c/drivers/eeprom/$dimm_i/eeprom"; - binmode HANDLE; - sysseek(HANDLE, $offset, SEEK_SET); - sysread(HANDLE, my $eeprom, 64); - close HANDLE; - @bytes = unpack("C64", $eeprom); - } else { - # Kernel 2.4 with procfs - for my $i (0 .. 3) { - my $hexoff = sprintf('%02x', $offset + $i * 16); - push @bytes, split(" ", `cat /proc/sys/dev/sensors/$dimm_i/$hexoff`); - } - } - return @bytes; -} - -for (@ARGV) { - if (/-h/) { - print "Usage: $0 [-c] [-f [-b]]\n", - " $0 -h\n\n", - " -f, --format print nice html output\n", - " -b, --bodyonly don't print html header\n", - " (useful for postprocessing the output)\n", - " -c, --checksum decode completely even if checksum fails\n", - " -h, --help display this usage summary\n"; - exit; - } - $opt_html = 1 if (/-f/); - $opt_bodyonly = 1 if (/-b/); - $opt_igncheck = 1 if (/-c/); -} -$opt_body = $opt_html && ! $opt_bodyonly; - -if ($opt_body) -{ - print "\n", - "\n", - "\t\n", - "\tPC DIMM Serial Presence Detect Tester/Decoder Output\n", - "\n"; -} - -printh 'Memory Serial Presence Detect Decoder', -'By Philip Edelbrock, Christian Zuckschwerdt, Burkart Lingner, -Jean Delvare and others -Version 2.10.2'; - - -my $dimm_count=0; -my @dimm_list; -my $dir; -if ($use_sysfs) { $dir = '/sys/bus/i2c/drivers/eeprom'; } -else { $dir = '/proc/sys/dev/sensors'; } -if (-d $dir) { - @dimm_list = split(/\s+/, `ls $dir`); -} elsif (! -d '/sys/module/eeprom') { - print "No EEPROM found, are you sure the eeprom module is loaded?\n"; - exit; -} - -for my $i ( 0 .. $#dimm_list ) { - $_=$dimm_list[$i]; - if (($use_sysfs && /^\d+-\d+$/) - || (!$use_sysfs && /^eeprom-/)) { - print "" if $opt_html; - printl2 "\n\nDecoding EEPROM", ($use_sysfs ? - "/sys/bus/i2c/drivers/eeprom/$dimm_list[$i]" : - "/proc/sys/dev/sensors/$dimm_list[$i]"); - print "" if $opt_html; - print "\n" if $opt_html; - if (($use_sysfs && /^[^-]+-([^-]+)$/) - || (!$use_sysfs && /^[^-]+-[^-]+-[^-]+-([^-]+)$/)) { - my $dimm_num=$1 - 49; - printl "Guessing DIMM is in", "bank $dimm_num"; - } - -# Decode first 3 bytes (0-2) - prints "SPD EEPROM Information"; - - my @bytes = readspd64(0, $dimm_list[$i]); - my $dimm_checksum = 0; - $dimm_checksum += $bytes[$_] foreach (0 .. 62); - $dimm_checksum &= 0xff; - - my $l = "EEPROM Checksum of bytes 0-62"; - printl $l, ($bytes[63] == $dimm_checksum ? - sprintf("OK (0x%.2X)", $bytes[63]): - sprintf("Bad\n(found 0x%.2X, calculated 0x%.2X)\n", - $bytes[63], $dimm_checksum)); - - unless ($bytes[63] == $dimm_checksum or $opt_igncheck) { - print "
    \n" if $opt_html; - next; - } - - $dimm_count++; - # Simple heuristic to detect Rambus - my $is_rambus = $bytes[0] < 4; - my $temp; - if ($is_rambus) { - if ($bytes[0] == 1) { $temp = "0.7"; } - elsif ($bytes[0] == 2) { $temp = "1.0"; } - elsif ($bytes[0] == 0 || $bytes[0] == 255) { $temp = "Invalid"; } - else { $temp = "Reserved"; } - printl "SPD Revision", $temp; - } else { - printl "# of bytes written to SDRAM EEPROM", - $bytes[0]; - } - - $l = "Total number of bytes in EEPROM"; - if ($bytes[1] <= 14) { - printl $l, 2**$bytes[1]; - } elsif ($bytes[1] == 0) { - printl $l, "RFU"; - } else { printl $l, "ERROR!"; } - - $l = "Fundamental Memory type"; - my $type = "Unknown"; - if ($is_rambus) { - if ($bytes[2] == 1) { $type = "Direct Rambus"; } - elsif ($bytes[2] == 17) { $type = "Rambus"; } - } else { - if ($bytes[2] == 1) { $type = "FPM DRAM"; } - elsif ($bytes[2] == 2) { $type = "EDO"; } - elsif ($bytes[2] == 3) { $type = "Pipelined Nibble"; } - elsif ($bytes[2] == 4) { $type = "SDR SDRAM"; } - elsif ($bytes[2] == 5) { $type = "Multiplexed ROM"; } - elsif ($bytes[2] == 6) { $type = "DDR SGRAM"; } - elsif ($bytes[2] == 7) { $type = "DDR SDRAM"; } - elsif ($bytes[2] == 8) { $type = "DDR2 SDRAM"; } - } - printl $l, $type; - -# Decode next 61 bytes (3-63, depend on memory type) - $decode_callback{$type}->(\@bytes) - if exists $decode_callback{$type}; - -# Decode next 35 bytes (64-98, common to all memory types) - prints "Manufacturing Information"; - - @bytes = readspd64(64, $dimm_list[$i]); - - $l = "Manufacturer"; - # $extra is a reference to an array containing up to - # 7 extra bytes from the Manufacturer field. Sometimes - # these bytes are filled with interesting data. - ($temp, my $extra) = manufacturer(@bytes[0..7]); - printl $l, $temp; - $l = "Custom Manufacturer Data"; - $temp = manufacturer_data(@{$extra}); - printl $l, $temp if defined $temp; - - if (spd_written($bytes[8])) { - # Try the location code as ASCII first, as earlier specifications - # suggested this. As newer specifications don't mention it anymore, - # we still fall back to binary. - $l = "Manufacturing Location Code"; - $temp = (chr($bytes[8]) =~ m/^[\w\d]$/) ? chr($bytes[8]) - : sprintf("0x%.2X", $bytes[8]); - printl $l, $temp; - } - - $l = "Part Number"; - $temp = part_number(@bytes[9..26]); - printl $l, $temp; - - if (spd_written(@bytes[27..28])) { - $l = "Revision Code"; - $temp = sprintf("0x%02X%02X\n", @bytes[27..28]); - printl $l, $temp; - } - - if (spd_written(@bytes[29..30])) { - $l = "Manufacturing Date"; - # In theory the year and week are in BCD format, but - # this is not always true in practice :( - if (($bytes[29] & 0xf0) <= 0x90 - && ($bytes[29] & 0x0f) <= 0x09 - && ($bytes[30] & 0xf0) <= 0x90 - && ($bytes[30] & 0x0f) <= 0x09) { - # Note that this heuristic will break in year 2080 - $temp = sprintf("%d%02X-W%02X\n", - $bytes[29] >= 0x80 ? 19 : 20, - @bytes[29..30]); - } else { - $temp = sprintf("0x%02X%02X\n", - @bytes[29..30]); - } - printl $l, $temp; - } - - if (spd_written(@bytes[31..34])) { - $l = "Assembly Serial Number"; - $temp = sprintf("0x%02X%02X%02X%02X\n", - @bytes[31..34]); - printl $l, $temp; - } - -# Next 27 bytes (99-125) are manufacturer specific, can't decode - -# Last 2 bytes (126-127) are reserved, Intel used them as an extension - if ($type eq "SDR SDRAM") { - decode_intel_spec_freq(\@bytes); - } - - print "\n" if $opt_html; - } -} -printl2 "\n\nNumber of SDRAM DIMMs detected and decoded", $dimm_count; - -print "\n" if $opt_body; diff --git a/prog/eeprom/decode-edid.pl b/prog/eeprom/decode-edid.pl deleted file mode 100755 index dc793e72..00000000 --- a/prog/eeprom/decode-edid.pl +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/perl -w -# -# Copyright (C) 2003-2006 Jean Delvare -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Version 0.1 2003-07-17 Jean Delvare -# Version 0.2 2003-07-22 Jean Delvare -# Use print instead of syswrite. -# Version 0.3 2003-08-24 Jean Delvare -# Fix data block length (128 bytes instead of 256). -# Version 1.0 2004-02-08 Jean Delvare -# Added support for Linux 2.5/2.6 (i.e. sysfs). -# Version 1.1 2006-09-01 Jean Delvare -# Append /usr/sbin or /usr/local/sbin to $PATH if needed. -# -# EEPROM data decoding for EDID. EDID (Extended Display Identification -# Data) is a VESA standard which allows storing (on manufacturer's side) -# and retrieving (on user's side) of configuration information about -# displays, such as manufacturer, serial number, physical dimensions and -# allowed horizontal and vertical refresh rates. -# -# Using the LM Sensors modules and tools, you have two possibilities to -# make use of these data: -# 1* Use the ddcmon driver and run sensors. -# 2* Use the eeprom driver and run this script. -# Both solutions will return a different kind of information. The first -# method will report user-interesting information, such as the model number -# or the year of manufacturing. The second method will report video-card- -# interesting information, such as video modes and refresh rates. -# -# Note that this script does almost nothing by itself. It simply converts -# what it finds in /proc to binary data to feed the parse-edid program. -# The parse-edid program was written by John Fremlin and is available at -# the following address: -# http://john.fremlin.de/programs/linux/read-edid/ - -use strict; -use Fcntl qw(:DEFAULT :seek); -use vars qw($bus $address); -use constant PROCFS => 1; -use constant SYSFS => 2; - -# parse-edid will typically be installed in /usr/sbin or /usr/local/sbin -# even though regular users can run it -$ENV{PATH} .= ':/usr/local/sbin' - if $ENV{PATH} !~ m,(^|:)/usr/local/sbin/?(:|$), - && -x '/usr/local/sbin/parse-edid'; -$ENV{PATH} .= ':/usr/sbin' - if $ENV{PATH} !~ m,(^|:)/usr/sbin/?(:|$), - && -x '/usr/sbin/parse-edid'; - -sub edid_valid_procfs -{ - my ($bus, $addr) = @_; - - open EEDATA, "/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/00"; - my $line = ; - close EEDATA; - return 1 - if $line =~ m/^0 255 255 255 255 255 255 0 /; - return 0; -} - -# Only used for sysfs -sub rawread -{ - my ($filename, $length, $offset) = @_; - my $bytes = ''; - - sysopen(FH, $filename, O_RDONLY) - or die "Can't open $filename"; - if ($offset) - { - sysseek(FH, $offset, SEEK_SET) - or die "Can't seek in $filename"; - } - - $offset = 0; - while ($length) - { - my $r = sysread(FH, $bytes, $length, $offset); - die "Can't read $filename" - unless defined($r); - die "Unexpected EOF in $filename" - unless $r; - $offset += $r; - $length -= $r; - } - close(FH); - - return $bytes; -} - -sub edid_valid_sysfs -{ - my ($bus, $addr) = @_; - my $bytes = rawread("/sys/bus/i2c/devices/$bus-00$addr/eeprom", 8, 0); - - return 1 - if $bytes eq "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00"; - return 0; -} - -sub bus_detect -{ - my $max = shift; - - for (my $i=0; $i<$max; $i++) - { - if (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-50/00") - { - if (edid_valid_procfs($i, '50')) - { - print STDERR - "decode-edid: using bus $i (autodetected)\n"; - return $i; - } - } - elsif (-r "/sys/bus/i2c/devices/$i-0050/eeprom") - { - if (edid_valid_sysfs($i, '50')) - { - print STDERR - "decode-edid: using bus $i (autodetected)\n"; - return $i; - } - } - } - - return; # default -} - -sub edid_decode -{ - my ($bus, $addr, $mode) = @_; - - # Make sure it is an EDID EEPROM. - - unless (($mode == PROCFS && edid_valid_procfs ($bus, $addr)) - || ($mode == SYSFS && edid_valid_sysfs ($bus, $addr))) - { - print STDERR - "decode-edid: not an EDID EEPROM at $bus-$addr\n"; - return; - } - - $SIG{__WARN__} = sub { }; - open PIPE, "| parse-edid" - or die "Can't open parse-edid. Please install read-edid.\n"; - delete $SIG{__WARN__}; - binmode PIPE; - - if ($mode == PROCFS) - { - for (my $i=0; $i<=0x70; $i+=0x10) - { - my $file = sprintf '%02x', $i; - my $output = ''; - open EEDATA, "/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/$file" - or die "Can't read /proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/$file"; - while() - { - foreach my $item (split) - { - $output .= pack "C", $item; - } - } - close EEDATA; - print PIPE $output; - } - } - elsif ($mode == SYSFS) - { - print PIPE rawread("/sys/bus/i2c/devices/$bus-00$address/eeprom", 128, 0); - } - - close PIPE; -} - -# Get the address. Default to 0x50 if not given. -$address = $ARGV[1] || 0x50; -# Convert to decimal, whatever the value. -$address = oct $address if $address =~ m/^0/; -# Convert to an hexadecimal string. -$address = sprintf '%02x', $address; - -# Get the bus. Try to autodetect if not given. -$bus = $ARGV[0] if defined $ARGV[0]; -$bus = bus_detect(8) unless defined $bus; - -if(defined $bus) -{ - print STDERR - "decode-edid: decode-edid version 1.1\n"; - if (-r "/proc/sys/dev/sensors/eeprom-i2c-$bus-$address") - { - edid_decode ($bus, $address, PROCFS); - exit 0; - } - elsif (-r "/sys/bus/i2c/devices/$bus-00$address") - { - edid_decode ($bus, $address, SYSFS); - exit 0; - } -} - -print STDERR - "EDID EEPROM not found. Please make sure that the eeprom module is loaded.\n"; -print STDERR - "Maybe your EDID EEPROM is on another bus. Try \"decode-edid ".($bus+1)."\".\n" - if defined $bus; diff --git a/prog/eeprom/decode-vaio.pl b/prog/eeprom/decode-vaio.pl deleted file mode 100755 index 792fc0fa..00000000 --- a/prog/eeprom/decode-vaio.pl +++ /dev/null @@ -1,240 +0,0 @@ -#!/usr/bin/perl -w -# -# Copyright (C) 2002-2006 Jean Delvare -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Version 0.1 2002-02-06 Jean Delvare -# Version 0.2 2002-02-16 Jean Delvare -# Fixed to work with the new, simplified /proc interface names of the eeprom -# driver (lm_sensors 2.6.3 and greater). -# Shifted data display by 4 columns left. -# Version 0.3 2002-02-17 Jean Delvare -# Added UUID field at 0x10 (added decode_uuid). -# Merged decode_string and decode_string32. -# Added unknown field at 0x20. -# Moved header and footer to BEGIN and END, respectively. -# Reformated history to match those of the other decode scripts. -# Deleted decode_char (made useless by decode_string). -# Reordered field display, changed some labels. -# Added old /proc interface check. -# Version 1.0 2002-11-15 Jean Delvare -# Gave the label "OEM Data" to the field at 0x20. -# Gave the label "Timestamp" to the field at 0xE0. -# Renamed "Model Number" to "Model Name". -# Added some documentation. -# Version 1.1 2004-01-17 Jean Delvare -# Added support for Linux 2.5/2.6 (i.e. sysfs). -# Version 1.2 2004-11-28 Jean Delvare -# Support bus number 0 to 4 instead of only 0. -# Version 1.3 2005-01-18 Jean Delvare -# Revision might be a Service Tag. -# Version 1.4 2006-09-20 Jean Delvare -# Detect and skip false positives (e.g. EDID EEPROMs). -# -# EEPROM data decoding for Sony Vaio laptops. -# -# Two assumptions: lm_sensors-2.6.3 or greater installed, -# and Perl is at /usr/bin/perl -# -# Please note that this is a guess-only work. Sony support refused to help -# me, so if someone can provide information, please contact me. -# My knowledge is summarized on this page: -# http://khali.linux-fr.org/vaio/eeprom.html -# -# It seems that if present, the EEPROM is always at 0x57. -# -# Models tested so far: -# PCG-F403 : No EEPROM -# PCG-F707 : No EEPROM -# PCG-GR114EK : OK -# PCG-GR114SK : OK -# PCG-GR214EP : OK -# PCG-GRX316G : OK -# PCG-GRX570 : OK -# PCG-GRX600K : OK -# PCG-U1 : OK -# PCG-Z600LEK : No EEPROM -# PCG-Z600NE : No EEPROM -# VGN-S260 : OK -# VGN-S4M/S : OK -# Any feedback appreciated anyway. -# -# Thanks to Werner Heuser, Carsten Blume, Christian Gennerat, Joe Wreschnig, -# Xavier Roche, Sebastien Lefevre, Lars Heer, Steve Dobson, Kent Hunt and -# others for their precious help. - - -use strict; -use Fcntl qw(:DEFAULT :seek); -use vars qw($sysfs $found); - -sub print_item -{ - my ($label,$value) = @_; - - printf("\%16s : \%s\n",$label,$value); -} - -# Abstract reads so that other functions don't have to care wether -# we need to use procfs or sysfs -sub read_eeprom_bytes -{ - my ($bus, $addr, $offset, $length) = @_; - my $filename; - - if ($sysfs) - { - $filename = "/sys/bus/i2c/devices/$bus-00$addr/eeprom"; - sysopen(FH, $filename, O_RDONLY) - or die "Can't open $filename"; - sysseek(FH, $offset, SEEK_SET) - or die "Can't seek in $filename"; - - my ($r, $bytes); - $bytes = ''; - $offset = 0; - while($length) - { - $r = sysread(FH, $bytes, $length, $offset); - die "Can't read $filename" - unless defined($r); - die "Unexpected EOF in $filename" - unless $r; - $offset += $r; - $length -= $r; - } - close(FH); - - return $bytes; - } - else - { - my $base = $offset & 0xf0; - $offset -= $base; - my $values = ''; - my $remains = $length + $offset; - - # Get all lines in a single string - while ($remains > 0) - { - $filename = "/proc/sys/dev/sensors/eeprom-i2c-$bus-$addr/" - . sprintf('%02x', $base); - open(FH, $filename) - or die "Can't open $filename"; - $values .= ; - close(FH); - $remains -= 16; - $base += 16; - } - - # Store the useful part in an array - my @bytes = split(/[ \n]/, $values); - @bytes = @bytes[$offset..$offset+$length-1]; - - # Back to a binary string - return pack('C*', @bytes); - } -} - -sub decode_string -{ - my ($bus, $addr, $offset, $length) = @_; - - my $string = read_eeprom_bytes($bus, $addr, $offset, $length); - $string =~ s/\x00.*$//; - - return($string); -} - -sub decode_uuid -{ - my ($bus,$addr,$base) = @_; - - my @bytes = unpack('C16', read_eeprom_bytes($bus, $addr, $base, 16)); - my $string=''; - - for(my $i=0;$i<16;$i++) - { - $string.=sprintf('%02x',shift(@bytes)); - if(($i==3)||($i==5)||($i==7)||($i==9)) - { - $string.='-'; - } - } - - return($string); -} - -sub vaio_decode -{ - my ($bus,$addr) = @_; - - my $name = decode_string($bus, $addr, 128, 32); - # Simple heuristic to skip false positives - return 0 unless $name =~ m/^[A-Z-]{4}/; - - print_item('Machine Name', $name); - print_item('Serial Number', decode_string($bus, $addr, 192, 32)); - print_item('UUID', decode_uuid($bus, $addr, 16)); - my $revision = decode_string($bus, $addr, 160, 10); - print_item(length($revision) > 2 ? 'Service Tag' : 'Revision', - $revision); - print_item('Model Name', 'PCG-'.decode_string($bus, $addr, 170, 4)); - print_item('OEM Data', decode_string($bus, $addr, 32, 16)); - print_item('Timestamp', decode_string($bus, $addr, 224, 32)); - return 1; -} - -BEGIN -{ - print("Sony Vaio EEPROM Decoder\n"); - print("Copyright (C) 2002-2006 Jean Delvare\n"); - print("Version 1.4\n\n"); -} - -END -{ - print("\n"); -} - -for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) -{ - if (-r "/sys/bus/i2c/devices/$i-0057/eeprom") - { - $sysfs = 1; - $found += vaio_decode($i, '57'); - } - elsif (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-57") - { - if (-r "/proc/sys/dev/sensors/eeprom-i2c-$i-57/data0-15") - { - print("Deprecated old interface found. Please upgrade to lm_sensors 2.6.3 or greater."); - exit; - } - else - { - $sysfs = 0; - $found += vaio_decode($i, '57'); - } - } -} - -if (!$found) -{ - print("Vaio EEPROM not found. Please make sure that the eeprom module is loaded.\n"); - print("If you believe this is an error, please contact me \n"); - print("so that we may see how to fix the problem.\n"); -} diff --git a/prog/xeon/Module.mk b/prog/xeon/Module.mk deleted file mode 100644 index b356f95d..00000000 --- a/prog/xeon/Module.mk +++ /dev/null @@ -1,32 +0,0 @@ -# Module.mk -# Copyright (c) 1998, 1999 Frodo Looijaard -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -MODULE_DIR := prog/xeon -PROGXEONDIR := $(MODULE_DIR) - -PROGXEONTARGETS := $(MODULE_DIR)/decode-xeon.pl - -REMOVEXEONBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGXEONTARGETS)) - -install-prog-xeon: $(PROGXEONTARGETS) - $(MKDIR) $(DESTDIR)$(BINDIR) - $(INSTALL) -m 755 $(PROGXEONTARGETS) $(DESTDIR)$(BINDIR) - -user_install :: install-prog-xeon - -user_uninstall:: - $(RM) $(REMOVEXEONBIN) diff --git a/prog/xeon/decode-xeon.pl b/prog/xeon/decode-xeon.pl deleted file mode 100755 index 209730a0..00000000 --- a/prog/xeon/decode-xeon.pl +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/perl -# -# Copyright 1998, 1999 Philip Edelbrock -# and Mark Studebaker -# -# Version 0.1 -# -# -# ID ROM data decoding for Xeon processors. -# Each Xeon processor contains two memories: -# - A scratch EEPROM at an even location 0x50, 52, 54, or 56; -# - An ID ROM at an odd location 0x51, 53, 55, or 57. -# This program decodes the ID ROM's only. -# The scratch EEPROMs have no prescribed format. -# If the output of this program makes no sense for a particular device, -# it is probably decoding a DIMM Serial Presence Detect (SPD) EEPROM. -# See ../eeprom/decode-dimms.pl to decode those devices. -# -# -# Two assumptions: lm_sensors-2.3.1 or greater installed, -# and Perl is at /usr/bin/perl -# -# To do: -# Calculate and check checksums for each section -# Decode flags in byte 0x7B (cartridge feature flags) -# -# References: -# "Pentium II Xeon Processor at 400 and 450 MHz" Data Sheet -# Intel -# -# -# - -print "Xeon Processor Information ROM Decoder\n"; -print "Written by Philip Edelbrock and Mark Studebaker. Copyright 1998, 1999.\n"; -print "Version 2.6.3\n\n"; - -$dimm_count=0; -$_=`ls /proc/sys/dev/sensors/`; -@dimm_list=split(); - -for $i ( 0 .. $#dimm_list ) { - $_=$dimm_list[$i]; - if ((/^eeprom-/) && (/-51$/ || /-53$/ || /-55$/ || /-57$/)) { - $dimm_count=$dimm_count + 1; - - print "\nDecoding Xeon ROM: /proc/sys/dev/sensors/$dimm_list[$i]\n"; - if (/^[^-]+-[^-]+-[^-]+-([^-]+)$/) { - $dimm_num=($1 - 49) / 2; - print "Guessing Xeon is number $dimm_num\n"; - } -# Decode first 16 bytes - print "\t\t----=== Xeon ROM Header Data ===----\n"; - - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/00`; - @bytes=split(" "); - - printf("\tData Format Revision: \t\t\t\t0x%.4X\n", $bytes[0]); - - print "\tTotal number of bytes in EEPROM:\t\t"; - print ($bytes[1] << 4) + $bytes[2]; - print "\n"; - - printf("\tProcessor Data Address:\t\t\t\t0x%.2X\n", $bytes[3]); - printf("\tProcessor Core Data Address:\t\t\t0x%.2X\n", $bytes[4]); - printf("\tL2 Cache Data Address:\t\t\t\t0x%.2X\n", $bytes[5]); - printf("\tSEC Cartridge Data Address:\t\t\t0x%.2X\n", $bytes[6]); - printf("\tPart Number Data Address:\t\t\t0x%.2X\n", $bytes[7]); - printf("\tThermal Reference Data Address:\t\t\t0x%.2X\n", $bytes[8]); - printf("\tFeature Data Address:\t\t\t\t0x%.2X\n", $bytes[9]); - printf("\tOther Data Address:\t\t\t\t0x%.2X\n", $bytes[10]); - - print "\t\t----=== Xeon ROM Processor Data ===----\n"; - -# Decode next 16 bytes - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/10`; - @bbytes=split(" "); - print "\tS-spec/QDF Number:\t\t\t\t\""; - print pack("cccccc",$bytes[14],$bytes[15],$bbytes[0], - $bbytes[1],$bbytes[2],$bbytes[3]); - print "\"\n"; - $tmp = $bbytes[4] & 0xC0 >> 6; - printf("\tSample / Production:\t\t\t\t0x%.2X", $tmp); - if($tmp) { - print " (Production)\n"; - } else { - print " (Sample)\n"; - } - - print "\t\t----=== Xeon ROM Core Data ===----\n"; - - printf("\tProcessor Core Type:\t\t\t\t0x%.2X\n", - ($bbytes[6] & 0xC0) >> 6); - printf("\tProcessor Core Family:\t\t\t\t0x%.2X\n", - ($bbytes[6] & 0x3C) >> 2); - printf("\tProcessor Core Model:\t\t\t\t0x%.2X\n", - (($bbytes[6] & 0x03) << 2) + (($bbytes[7] & 0xC0) >> 6)); - printf("\tProcessor Core Stepping:\t\t\t0x%.2X\n", - ($bbytes[7] & 0x30) >> 4); - print "\tMaximum Core Frequency (Mhz):\t\t\t"; - print ($bbytes[13] << 4) + $bbytes[14]; - print "\n"; - -# Decode next 16 bytes (32-47) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/20`; - @bytes=split(" "); - print "\tCore Voltage ID (mV):\t\t\t\t"; - print ($bbytes[15] << 4) + $bytes[0]; - print "\n"; - print "\tCore Voltage Tolerance, High (mV):\t\t"; - print $bytes[1]; - print "\n"; - print "\tCore Voltage Tolerance, Low (mV):\t\t"; - print $bytes[2]; - print "\n"; - - print "\t\t----=== Xeon ROM L2 Cache Data ===----\n"; - - print "\tL2 Cache Size (KB):\t\t\t\t"; - print ($bytes[9] << 4) + $bytes[10]; - print "\n"; - printf("\tNumber of SRAM Components:\t\t\t%d\n", - ($bytes[11] & 0xF0) >> 4); - print "\tL2 Cache Voltage ID (mV):\t\t\t"; - print ($bytes[12] << 4) + $bytes[13]; - print "\n"; - print "\tL2 Cache Voltage Tolerance, High (mV):\t\t"; - print $bytes[14]; - print "\n"; - print "\tL2 Cache Voltage Tolerance, Low (mV):\t\t"; - print $bytes[15]; - print "\n"; - -# Decode next 16 bytes (48-63) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/30`; - @bytes=split(" "); - - printf("\tCache/Tag Stepping ID:\t\t\t\t0x%.2X\n", - ($bytes[0] & 0xF0) >> 4); - - print "\t\t----=== Xeon ROM Cartridge Data ===----\n"; - - print "\tCartridge Revision:\t\t\t\t\""; - print pack("cccc",$bytes[2],$bytes[3],$bytes[4],$bytes[5]); - print "\"\n"; - printf("\tSubstrate Rev. Software ID:\t\t\t0x%.2X\n", - ($bbytes[6] & 0xC0) >> 6); - - print "\t\t----=== Xeon ROM Part Number Data ===----\n"; - - print "\tProcessor Part Number:\t\t\t\t\""; - print pack("ccccccc",$bytes[8],$bytes[9],$bytes[10], - $bytes[11],$bytes[12],$bytes[13],$bytes[14]); - print "\"\n"; - $byte15=$byte[15]; - -# Decode next 16 bytes (64-79) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/40`; - @bytes=split(" "); - - print "\tProcessor BOM ID:\t\t\t\t\""; - print pack("cccccccccccccc",$byte15,$bytes[0],$bytes[1], - $bytes[2],$bytes[3],$bytes[4],$bytes[5],$bytes[6], - $bytes[7],$bytes[8],$bytes[9],$bytes[10],$bytes[11], - $bytes[12]); - print "\"\n"; - -# Decode next 16 bytes (80-95) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/50`; - @bbytes=split(" "); - printf("\tProcessor Electronic Signature: \t\t0x%.2X%.2X%.2X%.2X%.2X%.2X%.2X%.2X\n", - $bytes[13],$bytes[14],$bytes[15],$bbytes[0], - $bbytes[1],$bbytes[2],$bbytes[3],$bbytes[4]); - -# Decode next 16 bytes (96-111) -# Not used... - -# Decode next 16 bytes (112-127) - $_=`cat /proc/sys/dev/sensors/$dimm_list[$i]/70`; - @bytes=split(" "); - - print "\t\t----=== Xeon Thermal Reference Data ===----\n"; - - printf("\tThermal Reference Byte: \t\t\t0x%.2X\n", $bytes[0]); - - print "\t\t----=== Xeon ROM Feature Data ===----\n"; - - printf("\tProcessor Core Feature Flags: \t\t\t0x%.2X%.2X%.2X%.2X\n", - $bytes[4],$bytes[5],$bytes[6],$bytes[7]); - printf("\tCartridge Feature Flags: \t\t\t0x%.2X%.2X%.2X%.2X\n", - $bytes[8],$bytes[9],$bytes[10],$bytes[11]); - printf("\tNumber of Devices in TAP Chain:\t\t\t%d\n", - ($bytes[12] & 0xF0) >> 4); - - } -} -print "\n\nNumber of Xeon ROMs detected and decoded: $dimm_count\n"; From afcf44fe66ae9c7da348995a70ae344e5443d262 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 27 Jun 2007 12:12:39 +0000 Subject: [PATCH 075/718] Drop the references to the now gone eeprom decoding scripts and SMBus unhiding kernel modules. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4491 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CONTRIBUTORS | 3 --- doc/progs | 24 ------------------------ 2 files changed, 27 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 02d30103..7a802016 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -31,7 +31,6 @@ suggestions or problems. Added max1617, thmc10, gl523sm, and lm84 support to the adm1021 driver. Added lm81 support to the adm9240 driver. Added DDC support and i2c-algo-bit layer to the i2c-voodoo3 bus driver. - Author of the decode-xeon.pl xeon EEPROM decoder. Added the RRD interface. Author of the ddcmon, icspll, smbus-arp, smsc47m1, vt1211, and vt8231 chip drivers. @@ -82,8 +81,6 @@ suggestions or problems. Author of the lm63, lm83, lm90 and w83l785ts SMBus chip drivers. Author of the f71805f and pc87360 Super-I/O chip drivers. Author of the i2c-amd756-s4882 and pca9540 SMBus multiplexing drivers. - Author of the decode-vaio.pl Vaio EEPROM decoder. - Author of the decode-edid.pl EDID data decoder. Perl scripts maintainer, tester, bug fixer, general support. * Vojtech Pavlik Author of the i2c-amd8111 bus driver. diff --git a/doc/progs b/doc/progs index 9de8a0b0..5dc6baee 100644 --- a/doc/progs +++ b/doc/progs @@ -29,31 +29,10 @@ see useful_addresses.html. isadump 0x295 0x296 isadump -k 0x55 0x2e 0x2f -* prog/eeprom/decode-dimms.pl (perl script, installed by 'make install') - This program decodes the information found in a memory module SPD EEPROM. - -* prog/eeprom/decode-vaio.pl (perl script, installed by 'make install') - This program decodes the information in a Sony Vaio laptop - identification eeprom at 0x57. - -* prog/eeprom/ddcmon (perl script, installed by 'make install') - prog/eeprom/decode-edid.pl (perl script, installed by 'make install') - These programs decode the information found in a display EEPROM. They - require a bus driver for your video adapter, for DDC access to the display. - * prog/eepromer/eepromer (written in C, not installed) This program reads and writes eeproms. Danger: Do not use this to write your DRAM DIMM eeproms. -* prog/hotplug/m7101.o (kernel module, not installed) - An experimental kernel module to enable the Acer Labs 7101 PCI device. - See prog/hotplug/README for details. - -* prog/hotplug/p4b_smbus.o (kernel module, not installed) - An experimental kernel module to enable the i801 2443 PCI device - on Asus P4B boards. - See prog/hotplug/README.p4b for details. - * prog/hotplug/unhide_ICH_SMBus (shell script, not installed) It unhides the ICH Intel SMBus for 2.6 kernels @@ -109,6 +88,3 @@ see useful_addresses.html. * prog/tellerstats/gather.sh, tellerstats.sh (written in bash, not installed) These scripts gather sensors data and graph the data for web pages. See prog/tellerstats/README for more information. - -* prog/xeon/decode-xeon.pl (written in Perl, installed by 'make install') - ID ROM data decoding for Xeon processors. From f51bf1e7b938e9bfbae3e7d03b4a545c099c7f5d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 27 Jun 2007 12:53:02 +0000 Subject: [PATCH 076/718] Move the eeprom writing tools to the i2c-tools package. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4494 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/progs | 4 - prog/eepromer/24cXX.c | 182 --------- prog/eepromer/24cXX.h | 58 --- prog/eepromer/Makefile | 14 - prog/eepromer/README | 31 -- prog/eepromer/README.eeprog | 12 - prog/eepromer/README.eeprom | 85 ---- prog/eepromer/README.eepromer | 27 -- prog/eepromer/eeprog.c | 283 -------------- prog/eepromer/eeprom.c | 297 -------------- prog/eepromer/eepromer.c | 718 ---------------------------------- 11 files changed, 1711 deletions(-) delete mode 100644 prog/eepromer/24cXX.c delete mode 100644 prog/eepromer/24cXX.h delete mode 100644 prog/eepromer/Makefile delete mode 100644 prog/eepromer/README delete mode 100644 prog/eepromer/README.eeprog delete mode 100644 prog/eepromer/README.eeprom delete mode 100644 prog/eepromer/README.eepromer delete mode 100644 prog/eepromer/eeprog.c delete mode 100644 prog/eepromer/eeprom.c delete mode 100644 prog/eepromer/eepromer.c diff --git a/doc/progs b/doc/progs index 5dc6baee..a583dca9 100644 --- a/doc/progs +++ b/doc/progs @@ -29,10 +29,6 @@ see useful_addresses.html. isadump 0x295 0x296 isadump -k 0x55 0x2e 0x2f -* prog/eepromer/eepromer (written in C, not installed) - This program reads and writes eeproms. - Danger: Do not use this to write your DRAM DIMM eeproms. - * prog/hotplug/unhide_ICH_SMBus (shell script, not installed) It unhides the ICH Intel SMBus for 2.6 kernels diff --git a/prog/eepromer/24cXX.c b/prog/eepromer/24cXX.c deleted file mode 100644 index 00a21fd7..00000000 --- a/prog/eepromer/24cXX.c +++ /dev/null @@ -1,182 +0,0 @@ -/*************************************************************************** - copyright : (C) by 2002-2003 Stefano Barbato - email : stefano@codesink.org - - $Id$ - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "24cXX.h" - -static int i2c_write_1b(struct eeprom *e, __u8 buf) -{ - int r; - // we must simulate a plain I2C byte write with SMBus functions - r = i2c_smbus_write_byte(e->fd, buf); - if(r < 0) - fprintf(stderr, "Error i2c_write_1b: %s\n", strerror(errno)); - usleep(10); - return r; -} - -static int i2c_write_2b(struct eeprom *e, __u8 buf[2]) -{ - int r; - // we must simulate a plain I2C byte write with SMBus functions - r = i2c_smbus_write_byte_data(e->fd, buf[0], buf[1]); - if(r < 0) - fprintf(stderr, "Error i2c_write_2b: %s\n", strerror(errno)); - usleep(10); - return r; -} - -static int i2c_write_3b(struct eeprom *e, __u8 buf[3]) -{ - int r; - // we must simulate a plain I2C byte write with SMBus functions - // the __u16 data field will be byte swapped by the SMBus protocol - r = i2c_smbus_write_word_data(e->fd, buf[0], buf[2] << 8 | buf[1]); - if(r < 0) - fprintf(stderr, "Error i2c_write_3b: %s\n", strerror(errno)); - usleep(10); - return r; -} - - -#define CHECK_I2C_FUNC( var, label ) \ - do { if(0 == (var & label)) { \ - fprintf(stderr, "\nError: " \ - #label " function is required. Program halted.\n\n"); \ - exit(1); } \ - } while(0); - -int eeprom_open(char *dev_fqn, int addr, int type, struct eeprom* e) -{ - int fd, r; - unsigned long funcs; - e->fd = e->addr = 0; - e->dev = 0; - - fd = open(dev_fqn, O_RDWR); - if(fd <= 0) - return -1; - - // get funcs list - if((r = ioctl(fd, I2C_FUNCS, &funcs) < 0)) - return r; - - - // check for req funcs - CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_READ_BYTE ); - CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_WRITE_BYTE ); - CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_READ_BYTE_DATA ); - CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_WRITE_BYTE_DATA ); - CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_READ_WORD_DATA ); - CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_WRITE_WORD_DATA ); - - // set working device - if( ( r = ioctl(fd, I2C_SLAVE, addr)) < 0) - return r; - e->fd = fd; - e->addr = addr; - e->dev = dev_fqn; - e->type = type; - return 0; -} - -int eeprom_close(struct eeprom *e) -{ - close(e->fd); - e->fd = -1; - e->dev = 0; - e->type = EEPROM_TYPE_UNKNOWN; - return 0; -} - -#if 0 -int eeprom_24c32_write_byte(struct eeprom *e, __u16 mem_addr, __u8 data) -{ - __u8 buf[3] = { (mem_addr >> 8) & 0x00ff, mem_addr & 0x00ff, data }; - return i2c_write_3b(e, buf); -} - - -int eeprom_24c32_read_current_byte(struct eeprom* e) -{ - ioctl(e->fd, BLKFLSBUF); // clear kernel read buffer - return i2c_smbus_read_byte(e->fd); -} - -int eeprom_24c32_read_byte(struct eeprom* e, __u16 mem_addr) -{ - int r; - ioctl(e->fd, BLKFLSBUF); // clear kernel read buffer - __u8 buf[2] = { (mem_addr >> 8) & 0x0ff, mem_addr & 0x0ff }; - r = i2c_write_2b(e, buf); - if (r < 0) - return r; - r = i2c_smbus_read_byte(e->fd); - return r; -} -#endif - - -int eeprom_read_current_byte(struct eeprom* e) -{ - ioctl(e->fd, BLKFLSBUF); // clear kernel read buffer - return i2c_smbus_read_byte(e->fd); -} - -int eeprom_read_byte(struct eeprom* e, __u16 mem_addr) -{ - int r; - ioctl(e->fd, BLKFLSBUF); // clear kernel read buffer - if(e->type == EEPROM_TYPE_8BIT_ADDR) - { - __u8 buf = mem_addr & 0x0ff; - r = i2c_write_1b(e, buf); - } else if(e->type == EEPROM_TYPE_16BIT_ADDR) { - __u8 buf[2] = { (mem_addr >> 8) & 0x0ff, mem_addr & 0x0ff }; - r = i2c_write_2b(e, buf); - } else { - fprintf(stderr, "ERR: unknown eeprom type\n"); - return -1; - } - if (r < 0) - return r; - r = i2c_smbus_read_byte(e->fd); - return r; -} - -int eeprom_write_byte(struct eeprom *e, __u16 mem_addr, __u8 data) -{ - if(e->type == EEPROM_TYPE_8BIT_ADDR) { - __u8 buf[2] = { mem_addr & 0x00ff, data }; - return i2c_write_2b(e, buf); - } else if(e->type == EEPROM_TYPE_16BIT_ADDR) { - __u8 buf[3] = - { (mem_addr >> 8) & 0x00ff, mem_addr & 0x00ff, data }; - return i2c_write_3b(e, buf); - } else { - fprintf(stderr, "ERR: unknown eeprom type\n"); - return -1; - } -} - diff --git a/prog/eepromer/24cXX.h b/prog/eepromer/24cXX.h deleted file mode 100644 index caac05b0..00000000 --- a/prog/eepromer/24cXX.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - copyright : (C) by 2002-2003 Stefano Barbato - email : stefano@codesink.org - - $Id$ - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ -#ifndef _24CXX_H_ -#define _24CXX_H_ -#include "i2c-dev.h" - -#define EEPROM_TYPE_UNKNOWN 0 -#define EEPROM_TYPE_8BIT_ADDR 1 -#define EEPROM_TYPE_16BIT_ADDR 2 - -struct eeprom -{ - char *dev; // device file i.e. /dev/i2c-N - int addr; // i2c address - int fd; // file descriptor - int type; // eeprom type -}; - -/* - * opens the eeprom device at [dev_fqn] (i.e. /dev/i2c-N) whose address is - * [addr] and set the eeprom_24c32 [e] - */ -int eeprom_open(char *dev_fqn, int addr, int type, struct eeprom*); -/* - * closees the eeprom device [e] - */ -int eeprom_close(struct eeprom *e); -/* - * read and returns the eeprom byte at memory address [mem_addr] - * Note: eeprom must have been selected by ioctl(fd,I2C_SLAVE,address) - */ -int eeprom_read_byte(struct eeprom* e, __u16 mem_addr); -/* - * read the current byte - * Note: eeprom must have been selected by ioctl(fd,I2C_SLAVE,address) - */ -int eeprom_read_current_byte(struct eeprom *e); -/* - * writes [data] at memory address [mem_addr] - * Note: eeprom must have been selected by ioctl(fd,I2C_SLAVE,address) - */ -int eeprom_write_byte(struct eeprom *e, __u16 mem_addr, __u8 data); - -#endif - diff --git a/prog/eepromer/Makefile b/prog/eepromer/Makefile deleted file mode 100644 index 2f6a9826..00000000 --- a/prog/eepromer/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -#eepromer Makefile - -CFLAGS = -O2 -I../../kernel/include -Wall - -all: eepromer eeprom eeprog - -eepromer: eepromer.o - -eeprom: eeprom.o - -eeprog: eeprog.o 24cXX.o - -clean: - rm -rf *~ *.o eepromer eeprom eeprog diff --git a/prog/eepromer/README b/prog/eepromer/README deleted file mode 100644 index ff89c730..00000000 --- a/prog/eepromer/README +++ /dev/null @@ -1,31 +0,0 @@ -These programs are used to read and write eeproms. - -Use eeprom for small eeproms with one-byte addresses: - 24C01, 24C01A, 24C02, 24C04, 24C08, and 24C16 - It works only on true i2c bus adapters. - See README.eeprom for details. - -Use eepromer for large eeproms with two-byte addresses: - 24C32, 24C64, 24C128, 24C256, and 24C512 - It works only on true i2c bus adapters. - See README.eepromer for details. - -Use eeprog for either small or large eeproms. - Use the -16 switch for large eeproms. - It works on both i2c and smbus bus adapters. - See README.eeprog for details. - - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!! ! -!!! These programs should only be used on external busses such as i2c-pport ! -!!! unless you REALLY know what you are doing. ! -!!! ! -!!! Your computer probably contains eeproms for saving data vital to its ! -!!! operation. If you are not careful you might overwrite this data with ! -!!! this program and your computer may no longer boot! ! -!!! ! -!!! An example are the EEPROMS on your SDRAM DIMMs, your computer may no ! -!!! longer detect the RAM module rendering it essentially USELESS! ! -!!! ! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/prog/eepromer/README.eeprog b/prog/eepromer/README.eeprog deleted file mode 100644 index 6cccd004..00000000 --- a/prog/eepromer/README.eeprog +++ /dev/null @@ -1,12 +0,0 @@ -Important! See the README file for important warnings. - -eeprog reads and writes 24Cxx EEPROMs connected to I2C serial bus. - -It uses the SMBus protocol used by most of the recent chipsets. Don't forget to load -your i2c chipset and the i2c-dev drivers. - -Use -16 switch for EEPROM larger then 24C16 (16 bit addressing mode). - -Again, it's really important that you read the README file. - -Type "make" to compile. diff --git a/prog/eepromer/README.eeprom b/prog/eepromer/README.eeprom deleted file mode 100644 index 481d60bf..00000000 --- a/prog/eepromer/README.eeprom +++ /dev/null @@ -1,85 +0,0 @@ -You can use this program to read/write to i2c-eeproms -like the popular 24C16, 24C08, 24C04,.. In contrast to lm_sensor's eeprommer -which supports 24C256-type eeproms 24C16ss use 1-byte addresses! - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!! ! -!!! This program should only be used on external busses such as i2c-pport. ! -!!! ! -!!! Your computer may contain i2c-eeproms for saving data vital to its ! -!!! operation. If you are not careful you might overwrite this data with ! -!!! this program and your computer may no longer boot! ! -!!! ! -!!! An example are the EEPROMS on your SDRAM DIMMs, your computer may no ! -!!! longer detect the RAM module rendering it essentially USELESS! ! -!!! ! -!!! IBM Thinkpads are said to store their configuration data in a eeprom, ! -!!! if you manage to overwrite this eeprom you will have to send your ! -!!! computer to the manufacturer for a costly repair! ! -!!! ! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -It has several options: - - -d devicenode - - set this to the device-node of the i2c-bus - you want to use like /dev/i2c-0. - Use /dev/i2c-1 for the second bus, i2c-2 for the third... - - The default /dev/i2c-0 should work most of the time. - - -a address - - set this to the device-address of your - eeprom. For a 24C16 the address is hardcoded to - 0x50, which is -you guessed it- the default. - - For a 24C08 and smaller types you can choose which - addresses they occupy by forcing the address-pins - of the chip to High or Low so here the address may differ. - - -p number_of_pages - - set this to the number of pages you want to read - from or write to the eeprom. The 24C16 maps it's - pages to consecutive addresses on the i2c-bus so - we will try to read 256 bytes from every i2c - address between 'address' (inclusive) and - 'address + number_of_pages' (exclusive)... - - A 24C16 has 8 pages so that's the default for this - parameter. - - -f filename - - read data from this file (when writing to eeprom) or - write data to this file (when reading from eeprom). - - When reading a file that's smaller than the - eeprom's storage size we will pad the eeprom - with zeroes. - - If no file is given we will just read the - eeprom (while in read-mode) and test it's presence - this way. In write-mode we will just write zeroes - to the eeprom. - - -w When '-w' is present we will *write* to the eeprom. - If you do not specify '-w' we will read the contents - of the eeprom. - - -y This flag will suppress the warning when you write to the - eeprom. You will not be required to enter 'yes' so be careful - when using this switch! - - -I wrote that program to clear a 24C16 eeprom that sit's in my crappy -satellite receiver because sometimes its Z80 processor likes to -write garbage to it and then crash.... - -No further testing besides writing a long series of "The quick brown -fox jumps over the lazy dog!" and reading it back has been done so -of course this comes without any warranty. - - Chris diff --git a/prog/eepromer/README.eepromer b/prog/eepromer/README.eepromer deleted file mode 100644 index 444103f3..00000000 --- a/prog/eepromer/README.eepromer +++ /dev/null @@ -1,27 +0,0 @@ -Simple program for storing data to I2C EEPROM. - -!!!!!!!!!!!!!!!!!!!!!!!!Warning!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -The EEPROM must be a large EEPROM which uses a 2-byte address -field (24C32 or larger). It will NOT WORK on small EEPROMs -(24C01 - 24C16) such as those used on SDRAM DIMMs. - -Tested only on 24C256. - -!!!!!!!!!!!!!!!!!!!!!!!!Warning!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -This program is intended for use on eeproms using external busses such as -i2c-pport. -Do not use this on your SDRAM DIMM EEPROMS, it won't work!!!!!!!!! -Doing so will render your SDRAM USELESS and leave your system UNBOOTABLE!!! - -!!!!!!!!!!!!!!!!!!!!!!!!Warning!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -Options: - -r read - -w write - -e erase - -p print "super block of EEPROM" (date and size stored data) - -Daniel Smolik -marvin@sitour.cz diff --git a/prog/eepromer/eeprog.c b/prog/eepromer/eeprog.c deleted file mode 100644 index 5006e5ac..00000000 --- a/prog/eepromer/eeprog.c +++ /dev/null @@ -1,283 +0,0 @@ -/*************************************************************************** - copyright : (C) by 2002-2003 Stefano Barbato - email : stefano@codesink.org - - $Id$ - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "24cXX.h" - -#define VERSION "0.7.5" - -#define ENV_DEV "EEPROG_DEV" -#define ENV_I2C_ADDR "EEPROG_I2C_ADDR" - -int g_quiet; - -#define usage_if(a) do { do_usage_if( a , __LINE__); } while(0); -void do_usage_if(int b, int line) -{ -const static char *eeprog_usage = -"eeprog " VERSION ", a 24Cxx EEPROM reader/writer\n" -"Copyright (c) 2003 by Stefano Barbato - All rights reserved.\n" -"Usage: eeprog [-fqxdh] [-16|-8] [ -r addr[:count] | -w addr ] /dev/i2c-N i2c-address\n" -"\n" -" Address modes:\n" -" -8 Use 8bit address mode for 24c0x...24C16 [default]\n" -" -16 Use 16bit address mode for 24c32...24C256\n" -" Actions:\n" -" -r addr[:count] Read [count] (1 if omitted) bytes from [addr]\n" -" and print them to the standard output\n" -" -w addr Write input (stdin) at address [addr] of the EEPROM\n" -" -h Print this help\n" -" Options:\n" -" -x Set hex output mode\n" -" -d Dummy mode, display what *would* have been done\n" -" -f Disable warnings and don't ask confirmation\n" -" -q Quiet mode\n" -"\n" -"The following environment variables could be set instead of the command\n" -"line arguments:\n" -" EEPROG_DEV device name(/dev/i2c-N)\n" -" EEPROG_I2C_ADDR i2c-address\n" -"\n" -" Examples\n" -" 1- read 64 bytes from the EEPROM at address 0x54 on bus 0 starting\n" -" at address 123 (decimal)\n" -" eeprog /dev/i2c-0 0x54 -r 123:64\n" -" 2- prints the hex codes of the first 32 bytes read from bus 1\n" -" at address 0x22\n" -" eeprog /dev/i2c-1 0x51 -x -r 0x22:0x20\n" -" 3- write the current timestamp at address 0x200 of the EEPROM on\n" -" bus 0 at address 0x33\n" -" date | eeprog /dev/i2c-0 0x33 -w 0x200\n"; - - if(!b) - return; - fprintf(stderr, "%s\n[line %d]\n", eeprog_usage, line); - exit(1); -} - - -#define die_if(a, msg) do { do_die_if( a , msg, __LINE__); } while(0); -void do_die_if(int b, char* msg, int line) -{ - if(!b) - return; - fprintf(stderr, "Error at line %d: %s\n", line, msg); - //fprintf(stderr, " sysmsg: %s\n", strerror(errno)); - exit(1); -} - -#define print_info(args...) do { if(!g_quiet) fprintf(stderr, args); } while(0); - -void parse_arg(char *arg, int* paddr, int *psize) -{ - char *end; - *paddr = strtoul(arg, &end, 0); - if(*end == ':') - *psize = strtoul(++end, 0, 0); -} - -int confirm_action() -{ - fprintf(stderr, - "\n" - "____________________________WARNING____________________________\n" - "Erroneously writing to a system EEPROM (like DIMM SPD modules)\n" - "can break your system. It will NOT boot anymore so you'll not\n" - "be able to fix it.\n" - "\n" - "Reading from 8bit EEPROMs (like that in your DIMM) without using\n" - "the -8 switch can also UNEXPECTEDLY write to them, so be sure to\n" - "use the -8 command param when required.\n" - "\n" - "Use -f to disable this warning message\n" - "\n" - "Press ENTER to continue or hit CTRL-C to exit\n" - "\n" - ); - getchar(); - return 1; -} - - -int read_from_eeprom(struct eeprom *e, int addr, int size, int hex) -{ - - int ch, i; - // hex print out - die_if((ch = eeprom_read_byte(e, addr)) < 0, "read error"); - i = 1; - if(hex) - printf("\n %.4x| %.2x ", addr, ch); - else - putchar(ch); - while(--size) - { - die_if((ch = eeprom_read_current_byte(e)) < 0, "read error"); - if(hex) - { - addr++; - if( (i % 16) == 0 ) - printf("\n %.4x| ", addr); - else if( (i % 8) == 0 ) - printf(" "); - i++; - printf("%.2x ", ch); - } else { - putchar(ch); - } - } - if(hex) - printf("\n\n"); - fflush(stdout); - return 0; -} - -int write_to_eeprom(struct eeprom *e, int addr) -{ - int c; - while((c = getchar()) != EOF) - { - print_info("."); - fflush(stdout); - die_if(eeprom_write_byte(e, addr++, c), "write error"); - } - print_info("\n\n"); - return 0; -} - -int main(int argc, char** argv) -{ - struct eeprom e; - int ret, op, i2c_addr, memaddr, size, want_hex, dummy, force, sixteen; - char *device, *arg = 0, *i2c_addr_s; - struct stat st; - int eeprom_type = 0; - - op = want_hex = dummy = force = sixteen = 0; - g_quiet = 0; - - while((ret = getopt(argc, argv, "1:8fr:qhw:xd")) != -1) - { - switch(ret) - { - case '1': - usage_if(*optarg != '6' || strlen(optarg) != 1); - die_if(eeprom_type, "EEPROM type switch (-8 or -16) used twice"); - eeprom_type = EEPROM_TYPE_16BIT_ADDR; - break; - case 'x': - want_hex++; - break; - case 'd': - dummy++; - break; - case '8': - die_if(eeprom_type, "EEPROM type switch (-8 or -16) used twice"); - eeprom_type = EEPROM_TYPE_8BIT_ADDR; - break; - case 'f': - force++; - break; - case 'q': - g_quiet++; - break; - case 'h': - usage_if(1); - break; - default: - die_if(op != 0, "Both read and write requested"); - arg = optarg; - op = ret; - } - } - if(!eeprom_type) - eeprom_type = EEPROM_TYPE_8BIT_ADDR; // default - - usage_if(op == 0); // no switches - // set device and i2c_addr reading from cmdline or env - device = i2c_addr_s = 0; - switch(argc - optind) - { - case 0: - device = getenv(ENV_DEV); - i2c_addr_s = getenv(ENV_I2C_ADDR); - break; - case 1: - if(stat(argv[optind], &st) != -1) - { - device = argv[optind]; - i2c_addr_s = getenv(ENV_I2C_ADDR); - } else { - device = getenv(ENV_DEV); - i2c_addr_s = argv[optind]; - } - break; - case 2: - device = argv[optind++]; - i2c_addr_s = argv[optind]; - break; - default: - usage_if(1); - } - usage_if(!device || !i2c_addr_s); - i2c_addr = strtoul(i2c_addr_s, 0, 0); - - print_info("eeprog %s, a 24Cxx EEPROM reader/writer\n", VERSION); - print_info("Copyright (c) 2003 by Stefano Barbato - All rights reserved.\n"); - print_info(" Bus: %s, Address: 0x%x, Mode: %dbit\n", - device, i2c_addr, - (eeprom_type == EEPROM_TYPE_8BIT_ADDR ? 8 : 16) ); - if(dummy) - { - fprintf(stderr, "Dummy mode selected, nothing done.\n"); - return 0; - } - die_if(eeprom_open(device, i2c_addr, eeprom_type, &e) < 0, - "unable to open eeprom device file (check that the file exists and that it's readable)"); - switch(op) - { - case 'r': - if(force == 0) - confirm_action(); - size = 1; // default - parse_arg(arg, &memaddr, &size); - print_info(" Reading %d bytes from 0x%x\n", size, memaddr); - read_from_eeprom(&e, memaddr, size, want_hex); - break; - case 'w': - if(force == 0) - confirm_action(); - parse_arg(arg, &memaddr, &size); - print_info(" Writing stdin starting at address 0x%x\n", - memaddr); - write_to_eeprom(&e, memaddr); - break; - default: - usage_if(1); - exit(1); - } - eeprom_close(&e); - - return 0; -} - diff --git a/prog/eepromer/eeprom.c b/prog/eepromer/eeprom.c deleted file mode 100644 index 061750f4..00000000 --- a/prog/eepromer/eeprom.c +++ /dev/null @@ -1,297 +0,0 @@ -/* -This program is hereby placed into the public domain. -Of course the program is provided without warranty of any kind. -*/ -#include -#include -#include -#include -#include -#include -#include -#include "i2c-dev.h" - -/* - this program can read 24C16 (and probably smaller ones, too) - I wrote it as a quick and dirty hack because my satellite receiver - hung again... so I had to reprogram the eeprom where is stores it's - settings. - */ - -#define DEFAULT_I2C_BUS "/dev/i2c-0" -#define DEFAULT_EEPROM_ADDR 0x50 /* the 24C16 sits on i2c address 0x50 */ -#define DEFAULT_NUM_PAGES 8 /* we default to a 24C16 eeprom which has 8 pages */ -#define BYTES_PER_PAGE 256 /* one eeprom page is 256 byte */ -#define MAX_BYTES 8 /* max number of bytes to write in one chunk */ - /* ... note: 24C02 and 24C01 only allow 8 bytes to be written in one chunk. * - * if you are going to write 24C04,8,16 you can change this to 16 */ - -/* write len bytes (stored in buf) to eeprom at address addr, page-offset offset */ -/* if len=0 (buf may be NULL in this case) you can reposition the eeprom's read-pointer */ -/* return 0 on success, -1 on failure */ -int eeprom_write(int fd, - unsigned int addr, - unsigned int offset, - unsigned char *buf, - unsigned char len -){ - struct i2c_rdwr_ioctl_data msg_rdwr; - struct i2c_msg i2cmsg; - int i; - char _buf[MAX_BYTES + 1]; - - if(len>MAX_BYTES){ - fprintf(stderr,"I can only write MAX_BYTES bytes at a time!\n"); - return -1; - } - - if(len+offset >256){ - fprintf(stderr,"Sorry, len(%d)+offset(%d) > 256 (page boundary)\n", - len,offset); - return -1; - } - - _buf[0]=offset; /* _buf[0] is the offset into the eeprom page! */ - for(i=0;i _buf[1..n+1] */ - _buf[1+i]=buf[i]; - - msg_rdwr.msgs = &i2cmsg; - msg_rdwr.nmsgs = 1; - - i2cmsg.addr = addr; - i2cmsg.flags = 0; - i2cmsg.len = 1+len; - i2cmsg.buf = _buf; - - if((i=ioctl(fd,I2C_RDWR,&msg_rdwr))<0){ - perror("ioctl()"); - fprintf(stderr,"ioctl returned %d\n",i); - return -1; - } - - if(len>0) - fprintf(stderr,"Wrote %d bytes to eeprom at 0x%02x, offset %08x\n", - len,addr,offset); - else - fprintf(stderr,"Positioned pointer in eeprom at 0x%02x to offset %08x\n", - addr,offset); - - return 0; -} - -/* read len bytes stored in eeprom at address addr, offset offset in array buf */ -/* return -1 on error, 0 on success */ -int eeprom_read(int fd, - unsigned int addr, - unsigned int offset, - unsigned char *buf, - unsigned char len -){ - struct i2c_rdwr_ioctl_data msg_rdwr; - struct i2c_msg i2cmsg; - int i; - - if(len>MAX_BYTES){ - fprintf(stderr,"I can only write MAX_BYTES bytes at a time!\n"); - return -1; - } - - if(eeprom_write(fd,addr,offset,NULL,0)<0) - return -1; - - msg_rdwr.msgs = &i2cmsg; - msg_rdwr.nmsgs = 1; - - i2cmsg.addr = addr; - i2cmsg.flags = I2C_M_RD; - i2cmsg.len = len; - i2cmsg.buf = buf; - - if((i=ioctl(fd,I2C_RDWR,&msg_rdwr))<0){ - perror("ioctl()"); - fprintf(stderr,"ioctl returned %d\n",i); - return -1; - } - - fprintf(stderr,"Read %d bytes from eeprom at 0x%02x, offset %08x\n", - len,addr,offset); - - return 0; -} - - - -int main(int argc, char **argv){ - int i,j; - - /* filedescriptor and name of device */ - int d; - char *dn=DEFAULT_I2C_BUS; - - /* filedescriptor and name of data file */ - int f=-1; - char *fn=NULL; - - unsigned int addr=DEFAULT_EEPROM_ADDR; - int rwmode=0; - int pages=DEFAULT_NUM_PAGES; - - int force=0; /* suppress warning on write! */ - - while((i=getopt(argc,argv,"d:a:p:wyf:h"))>=0){ - switch(i){ - case 'h': - fprintf(stderr,"%s [-d dev] [-a adr] [-p pgs] [-w] [-y] [-f file]\n",argv[0]); - fprintf(stderr,"\tdev: device, e.g. /dev/i2c-0 (def)\n"); - fprintf(stderr,"\tadr: base address of eeprom, eg 0xA0 (def)\n"); - fprintf(stderr,"\tpgs: number of pages to read, eg 8 (def)\n"); - fprintf(stderr,"\t-w : write to eeprom (default is reading!)\n"); - fprintf(stderr,"\t-y : suppress warning when writing (default is to warn!)\n"); - fprintf(stderr,"\t-f file: copy eeprom contents to/from file\n"); - fprintf(stderr,"\t (default for read is test only; for write is all zeros)\n"); - fprintf(stderr,"Note on pages/addresses:\n"); - fprintf(stderr,"\teeproms with more than 256 byte appear as if they\n"); - fprintf(stderr,"\twere several eeproms with consecutive addresses on the bus\n"); - fprintf(stderr,"\tso we might as well address several seperate eeproms with\n"); - fprintf(stderr,"\tincreasing addresses....\n\n"); - exit(1); - break; - case 'd': - dn=optarg; - break; - case 'a': - if(sscanf(optarg,"0x%x",&addr)!=1){ - fprintf(stderr,"Cannot parse '%s' as addrs., example: 0xa0\n", - optarg); - exit(1); - } - break; - case 'p': - if(sscanf(optarg,"%d",&pages)!=1){ - fprintf(stderr,"Cannot parse '%s' as number of pages, example: 8\n", - optarg); - exit(1); - } - break; - case 'w': - rwmode++; - break; - case 'f': - fn=optarg; - break; - case 'y': - force++; - break; - } - - } - - fprintf(stderr,"base-address of eeproms : 0x%02x\n",addr); - fprintf(stderr,"number of pages to read : %d (0x%02x .. 0x%02x)\n", - pages,addr,addr+pages-1); - - if(fn){ - if(!rwmode) /* if we are reading, *WRITE* to file */ - f=open(fn,O_WRONLY|O_CREAT,0666); - else /* if we are writing to eeprom, *READ* from file */ - f=open(fn,O_RDONLY); - if(f<0){ - fprintf(stderr,"Could not open data-file %s for reading or writing\n",fn); - perror(fn); - exit(1); - } - fprintf(stderr,"file opened for %7s : %s\n",rwmode?"reading":"writing",fn); - fprintf(stderr," on filedescriptor : %d\n",f); - } - - if((d=open(dn,O_RDWR))<0){ - fprintf(stderr,"Could not open i2c at %s\n",dn); - perror(dn); - exit(1); - } - - fprintf(stderr,"i2c-devicenode is : %s\n",dn); - fprintf(stderr," on filedescriptor : %d\n\n",d); - - /*** - *** I'm not the one to blame of you screw your computer! - ***/ - if(rwmode & ! force){ - unsigned char warnbuf[4]; - fprintf(stderr,"**WARNING**\n"); - fprintf(stderr," - \tYou have chosen to WRITE to this eeprom.\n"); - fprintf(stderr,"\tMake sure that this tiny chip is *NOT* vital to the\n"); - fprintf(stderr,"\toperation of your computer as you can easily corrupt\n"); - fprintf(stderr,"\tthe configuration memory of your SDRAM-memory-module,\n"); - fprintf(stderr,"\tyour IBM ThinkPad or whatnot...! Fixing these errors can be\n"); - fprintf(stderr,"\ta time-consuming and very costly process!\n\n"); - fprintf(stderr,"Things to consider:\n"); - fprintf(stderr," - \tYou can have more than one i2c-bus, check in /proc/bus/i2c\n"); - fprintf(stderr,"\tand specify the correct one with -d\n"); - fprintf(stderr,"\tright now you have chosen to use '%s'\n",dn); - fprintf(stderr," - \tA eeprom can occupy several i2c-addresses (one per page)\n"); - fprintf(stderr,"\tso please make sure that there is no vital eeprom in your computer\n"); - fprintf(stderr,"\tsitting at addresses between 0x%02x and 0x%02x\n",addr,addr+pages-1); - - fprintf(stderr,"Enter 'yes' to continue:"); - fflush(stderr); - if(!fgets(warnbuf,sizeof(warnbuf),stdin)){ - fprintf(stderr,"\nCould not read confirmation from stdin!\n"); - exit(1); - } - if(strncmp(warnbuf,"yes",3)){ - fprintf(stderr,"\n** ABORTING WRITE! **, you did not answer 'yes'\n"); - exit(1); - } - } - - for(i=0;i=0){ - j=read(f,buf,sizeof(buf)); - if(j<0){ - fprintf(stderr,"Cannot read from file '%s'\n",fn); - perror(fn); - exit(1); - } - if(j!=sizeof(buf)){ - fprintf(stderr,"File '%s' is too small, padding eeprom with zeroes\n",fn); - while(j=0){ - j=write(f,buf,sizeof(buf)); - if(j!=sizeof(buf)){ - fprintf(stderr,"Cannot write to file '%s'\n",fn); - perror(fn); - exit(1); - } - } - - } - - if(f>=0) - close(f); - - close(d); - - exit(0); - -} diff --git a/prog/eepromer/eepromer.c b/prog/eepromer/eepromer.c deleted file mode 100644 index 8273b26c..00000000 --- a/prog/eepromer/eepromer.c +++ /dev/null @@ -1,718 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "i2c-dev.h" - - -#define MAX_BLK_SIZE 64 -#define EEPROM_SIZE 32768 -#define READ 1 -#define WRITE 0 -#define ERASE 2 -#define PHEADER 3 -#define VER "eepromer v 0.4 (c) Daniel Smolik 2001\n" -#define HEAD_SIZE sizeof(struct mini_inode) -#define START_ADDR 0 -#define FORCE 1 -/* -To disable startup warning #undef WARNINC - - -*/ - -#define WARNINC - - -int block_write(int file,int dev_addr,int eeprom_addr,unsigned char *buf,int lenght);int block_write(int file,int dev_addr,int eeprom_addr,unsigned char *buf,int lenght); -int block_read(int file,int dev_addr,int eeprom_addr,unsigned char *buf); - -/* block_read read block 64 bytes length and returns actual length of data*/ -void help(void); -int init(char *device,int addr); -int content_write(int file, int addr); -int content_read(int file, int addr); -int inode_write(int file, int dev_addr, int lenght); -int inode_read(int file, int dev_addr, void *p_inode); -void pheader(int file, int addr); -void erase(int file,int addr,int eeprom_size); -void made_address(int addr,unsigned char *buf); -void warn(void); -void bar(void); - - -static int stav=0; - - - -static struct mini_inode { - - time_t timestamp; - int data_len; - char data[56]; - - } m_ind,*p_ind; - - - -void help(void) -{ - FILE *fptr; - char s[100]; - - fprintf(stderr,"Syntax: eepromer [-r|-w|-e|-p] -f /dev/i2c-X ADDRESS \n\n"); - fprintf(stderr," ADDRESS is address of i2c device eg. 0x51\n"); - - if((fptr = fopen("/proc/bus/i2c", "r"))) { - fprintf(stderr," Installed I2C busses:\n"); - while(fgets(s, 100, fptr)) - fprintf(stderr, " %s", s); - fclose(fptr); - } -} - - - - - -int main(int argc, char *argv[]){ - - int i, file, addr; - int action; //in this variable will be (-r,-w,-e) - char device[45]; - int force; - - p_ind=&m_ind; - force=0; - - - - - for(i=1; i < argc;i++){ - - - if(!strcmp("-r",argv[i])) { - action=READ; - break; - } - if(!strcmp("-e",argv[i])) { - action=ERASE; - break; - } - if(!strcmp("-w",argv[i])) { - action=WRITE; - break; - } - if(!strcmp("-p",argv[i])) { - action=PHEADER; - break; - } - if(!strcmp("-force",argv[i])) { - force=FORCE; - break; - } - if(!strcmp("-v",argv[i])) { - fprintf(stderr,VER); - exit(0); - break; - } - else { - - fprintf(stderr,"Error: No action specified !\n"); - help(); - exit(1); - } - - } - - -#ifdef WARNINC - - if(force!=FORCE) warn(); - -#endif - - - if(argc < 5) { - fprintf(stderr,"Error: No i2c address specified !\n"); - help(); - exit(1); - - } - - - for(i=1; i < argc;i++){ - - - if(!strcmp("-f",argv[i])) { - strcpy(device,argv[i+1]); - break; - } - - } - - if(!strlen(device)) { - - fprintf(stderr,"Error: No device specified !\n"); - help(); - exit(1); - } - - - if(! (addr=strtol(argv[4],NULL,16))) { - - fprintf(stderr,"Error: Bad device address !\n"); - help(); - exit(1); - } - - if(! (file=init(device,addr))){ - - fprintf(stderr,"Error: Init failed !\n"); - exit(1); - } - - - switch(action){ - - case READ: - content_read(file,addr); - break; - - case WRITE: - content_write(file,addr); - break; - - case ERASE: erase(file,addr,EEPROM_SIZE); - break; - case PHEADER: pheader(file,addr); - break; - - default: - fprintf(stderr,"Internal error!\n"); - exit(1); break; - - } - - - close(file); - exit(0); - -} - - - -/****************************************************************************/ -/* Low level function */ -/* */ -/****************************************************************************/ - - - - - -int block_write(int file,int dev_addr,int eeprom_addr,unsigned char *buf,int lenght){ - - unsigned char buff[2]; - struct i2c_msg msg[2]; - - struct i2c_ioctl_rdwr_data { - - struct i2c_msg *msgs; /* ptr to array of simple messages */ - int nmsgs; /* number of messages to exchange */ - } msgst; - - - - if ( lenght > (MAX_BLK_SIZE) ) { - - fprintf(stderr, - "Error: Block too large:\n"); - - } - - - //bar(); - - made_address(eeprom_addr,buff); - - - msg[0].addr = dev_addr; - msg[0].flags = 0; - msg[0].len = 2; - msg[0].buf = buff; - - - msg[1].addr = dev_addr; - msg[1].flags = I2C_M_NOSTART; - msg[1].len = lenght; - msg[1].buf = buf; - - - msgst.msgs = msg; - msgst.nmsgs = 2; - - - if (ioctl(file,I2C_RDWR,&msgst) < 0){ - - fprintf(stderr, - "Error: Transaction failed: %s\n", - strerror(errno)); - - return 1; - - } - - return 0; - -} - - - - -int block_read(int file,int dev_addr,int eeprom_addr,unsigned char *buf){ - - int ln; - char buff[2]; //={0x0,0x0}; - - struct i2c_msg msg[2]; - - struct i2c_ioctl_rdwr_data { - - struct i2c_msg *msgs; /* ptr to array of simple messages */ - int nmsgs; /* number of messages to exchange */ - } msgst; - - - - made_address(eeprom_addr,buff); - ln=0; - //bar(); - - msg[0].addr = dev_addr; - msg[0].flags = 0; - msg[0].len = 2; - msg[0].buf = buff; - - - msg[1].addr = dev_addr; - msg[1].flags = I2C_M_RD; - msg[1].len = MAX_BLK_SIZE; - msg[1].buf = buf; - - - - - msgst.msgs = msg; - msgst.nmsgs = 2; - - - - - if ((ln = ioctl(file, I2C_RDWR, &msgst)) < 0) { - - fprintf(stderr, - "Error: Read error:%d\n",ln); - return ln; - } - - return ln; - -} - - - - - - - - - - - - - - - - -void made_address(int addr,unsigned char *buf){ - - int k; - - //addr = addr & 0xFFFF; /*odstranim nepoterbne bity*/ - - k=addr; - buf[1]=(unsigned char) (k & 0xFF); //vyrobim druhy byte adresy - k=addr & 0xFF00 ; - buf[0]= ((unsigned char) (k >> 8)) & 0x7F; - - - return; -} - - -int init(char *device,int addr) { - - int file; - unsigned long funcs; - - if ((file = open(device,O_RDWR)) < 0) { - - fprintf(stderr,"Error: Could not open file %s\n", - device); - - return 0; - } - - - /* check adapter functionality */ - if (ioctl(file,I2C_FUNCS,&funcs) < 0) { - fprintf(stderr, - "Error: Could not get the adapter functionality matrix: %s\n", - strerror(errno)); - close(file); - return 0; - } - - /* The I2C address */ - if (ioctl(file,I2C_SLAVE,addr) < 0) { - /* ERROR HANDLING; you can check errno to see what went wrong */ - fprintf(stderr, - "Error: Cannot communicate with slave: %s\n", - strerror(errno)); - - close(file); - return 0; - } - - return file; -} - - -int content_write(int file, int addr){ - - unsigned char buf[MAX_BLK_SIZE]; - unsigned char pom; - int i, j, k, delka, addr_cnt; - - delka=0; - addr_cnt=HEAD_SIZE; - k=0; - - for(j=0;j<=MAX_BLK_SIZE;j++)buf[j]=0; - - - - i=0; - - for(;;) { - - delka=fread(&pom,1,1,stdin); - - if( delka > 0 ){ - buf[i]=pom; - } - - if(i==(MAX_BLK_SIZE-1) || (delka < 1)) { - - - - if(block_write(file,addr,addr_cnt,buf,delka<1?i:(i+1)) !=0) { - - fprintf(stderr,"Block write failed\n"); - return 1; - - } - //printf("i:%d\n",i); - addr_cnt=addr_cnt + i + (delka==1?1:0); //+i - - for(j=0;j<=MAX_BLK_SIZE;j++)buf[j]=0; - - i=0; - if(delka<1) { - - //pisu EOF - - - if(inode_write(file,addr,(addr_cnt-HEAD_SIZE)) !=0) { - - fprintf(stderr,"Inode write failed\n"); - return 1; - - } - break; - } - - - } else i++; - - } - - return 0; - -} - - -int content_read(int file, int addr){ - - unsigned char buf[MAX_BLK_SIZE]; - int i, j, k, delka; - - delka=0; - k=0; - - - inode_read(file,addr,p_ind ); - - - for(i=HEAD_SIZE;i<= (HEAD_SIZE + p_ind->data_len);i=i+MAX_BLK_SIZE ) { - - - if(block_read(file,addr,i,buf) !=0) { - - fprintf(stderr,"Block read failed\n"); - return 1; - - } - - if( (HEAD_SIZE + p_ind->data_len - i) < MAX_BLK_SIZE ) { - k= HEAD_SIZE + p_ind->data_len - i; - }else { - k=MAX_BLK_SIZE; - } - - - for(j=0;j 70 ) stav=0; - - - switch(stav) { - - - case 10: fwrite("\\",1,1,stderr); - fflush(stderr); - rewind(stderr); - break; - case 20: fwrite("|",1,1,stderr); - fflush(stderr); - rewind(stderr); - break; - case 30: fwrite("/",1,1,stderr); - fflush(stderr); - rewind(stderr); - break; - case 40: fwrite("-",1,1,stderr); - fflush(stderr); - rewind(stderr); - break; - case 50: fwrite("\\",1,1,stderr); - fflush(stderr); - rewind(stderr); - break; - case 60: fwrite("|",1,1,stderr); - fflush(stderr); - rewind(stderr); - break; - case 70: fwrite("/",1,1,stderr); - fflush(stderr); - rewind(stderr); - break; - } - stav++; - -} - - - - - -int inode_write(int file,int dev_addr,int lenght){ - - unsigned char buff[2]; - struct i2c_msg msg[2]; - - struct i2c_ioctl_rdwr_data { - - struct i2c_msg *msgs; /* ptr to array of simple messages */ - int nmsgs; /* number of messages to exchange */ - } msgst; - - - m_ind.timestamp=time(NULL); - m_ind.data_len=lenght; - - - - - - //bar(); - - made_address(START_ADDR,buff); - - - msg[0].addr = dev_addr; - msg[0].flags = 0; - msg[0].len = 2; - msg[0].buf = buff; - - - msg[1].addr = dev_addr; - msg[1].flags = I2C_M_NOSTART; - msg[1].len = sizeof(struct mini_inode); - msg[1].buf = (char *) &m_ind; - - - - msgst.msgs = msg; - msgst.nmsgs = 2; - - - if (ioctl(file,I2C_RDWR,&msgst) < 0){ - - fprintf(stderr, - "Error: Transaction failed: %s\n", - strerror(errno)); - - return 1; - - } - - return 0; - -} - - - -int inode_read(int file,int dev_addr,void *p_inode ){ - - - #define POK 32 - int ln; - char buff[2]; //={0x0,0x0}; - - struct i2c_msg msg[2]; - - struct i2c_ioctl_rdwr_data { - - struct i2c_msg *msgs; /* ptr to array of simple messages */ - int nmsgs; /* number of messages to exchange */ - } msgst; - - made_address(START_ADDR,buff); - - ln=0; - //bar(); - - msg[0].addr = dev_addr; - msg[0].flags = 0; - msg[0].len = 2; - msg[0].buf = buff; - - - msg[1].addr = dev_addr; - msg[1].flags = I2C_M_RD; - msg[1].len = sizeof(struct mini_inode); - msg[1].buf = p_inode; - - - - - msgst.msgs = msg; - msgst.nmsgs = 2; - - - if ((ln = ioctl(file, I2C_RDWR, &msgst)) < 0) { - - fprintf(stderr, - "Error: Read error:%d\n",ln); - return ln; - } - - - - return ln; - -} - - -void pheader(int file,int dev_addr){ - - struct tm *p_tm; - char time_buf[15],*p_buf; - - p_buf=time_buf; - inode_read(file,dev_addr,p_ind ); - p_tm=localtime(&p_ind->timestamp); - strftime(p_buf,sizeof(time_buf),"%Y%m%d%H%M%S",p_tm); - printf("LEN=%d,TIME=%s\n",p_ind->data_len,p_buf); - return; -} - - - - -#ifdef WARNINC -void warn(void) -{ - - fprintf(stderr,"\n\n!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!\n"); - fprintf(stderr,"This program is intended for use on eeproms\nusing external busses such as i2c-pport.\n"); - fprintf(stderr,"Do not use this on your SDRAM DIMM EEPROMS\nunless you REALLY REALLY know what you are\ndoing!!! Doing so will render your SDRAM\nUSELESS and leave your system UNBOOTABLE!!!\n"); - fprintf(stderr,"To disable this warning use -force\n"); - fprintf(stderr,"\n\nPress ENTER to continue or hit Control-C NOW !!!!\n\n\n"); - - getchar(); -} -#endif From 28ba499f12657bbb86ce0ef80ab9d37ee5e3c2e3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 27 Jun 2007 13:03:44 +0000 Subject: [PATCH 077/718] Move py-smbus to the i2c-tools package. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4497 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/py-smbus/README | 28 -- prog/py-smbus/setup.py | 14 - prog/py-smbus/smbusmodule.c | 697 ------------------------------------ 3 files changed, 739 deletions(-) delete mode 100644 prog/py-smbus/README delete mode 100644 prog/py-smbus/setup.py delete mode 100644 prog/py-smbus/smbusmodule.c diff --git a/prog/py-smbus/README b/prog/py-smbus/README deleted file mode 100644 index b97801d4..00000000 --- a/prog/py-smbus/README +++ /dev/null @@ -1,28 +0,0 @@ - -README: py-smbus - -Prerequisites: -Be sure to build and install the lm-sensors userspace first. This package -requires one of the header files from that. - -To build: - $ python setup.py build - -To install (will also build if necessary): - $ python setup.py install - -For general build/install help: - $ python setup.py --help-commands - -Frequently Answered Question: - -Q: It's throwing exceptions, nothing works, what's wrong? - - A1: You need write permissions to the i2c-dev devices. Try running as root. - - A2: Addresses in Linux/I2C are the most-sig 7 bits, right-justified. E.g. - if your device uses address 0xc0 to write and 0xc1 to read, then use - address 0x60 with this module. - - A3: Some other kernel driver has claimed that I2C address. Unload it first. - diff --git a/prog/py-smbus/setup.py b/prog/py-smbus/setup.py deleted file mode 100644 index d85c8083..00000000 --- a/prog/py-smbus/setup.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python - -from distutils.core import setup, Extension - -setup( name="smbus", - version="1.1", - description="Python bindings for Linux SMBus access through i2c-dev", - author="Mark M. Hoffman", - author_email="mhoffman@lightlink.com", - maintainer="Mark M. Hoffman", - maintainer_email="lm-sensors@lm-sensors.org", - license="GPLv2", - url="http://lm-sensors.org/", - ext_modules=[Extension("smbus", ["smbusmodule.c"])]) diff --git a/prog/py-smbus/smbusmodule.c b/prog/py-smbus/smbusmodule.c deleted file mode 100644 index afc54a41..00000000 --- a/prog/py-smbus/smbusmodule.c +++ /dev/null @@ -1,697 +0,0 @@ -/* - * smbusmodule.c - Python bindings for Linux SMBus access through i2c-dev - * Copyright (C) 2005-2007 Mark M. Hoffman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include "structmember.h" -#include -#include -#include -#include - -/* -** These are required to build this module against Linux older than 2.6.23. -*/ -#ifndef I2C_SMBUS_I2C_BLOCK_BROKEN -#undef I2C_SMBUS_I2C_BLOCK_DATA -#define I2C_SMBUS_I2C_BLOCK_BROKEN 6 -#define I2C_SMBUS_I2C_BLOCK_DATA 8 -#endif - -PyDoc_STRVAR(SMBus_module_doc, - "This module defines an object type that allows SMBus transactions\n" - "on Linux hosts. The host kernel must have I2C support, I2C device\n" - "interface support, and a bus adapter driver. All of these can be\n" - "either built-in to the kernel, or loaded from modules.\n" - "\n" - "Because the I2C device interface is opened R/W, users of this\n" - "module usually must have root permissions.\n"); - -typedef struct { - PyObject_HEAD - - int fd; /* open file descriptor: /dev/i2c-?, or -1 */ - int addr; /* current client SMBus address */ - int pec; /* !0 => Packet Error Codes enabled */ -} SMBus; - -static PyObject * -SMBus_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - SMBus *self; - - if ((self = (SMBus *)type->tp_alloc(type, 0)) == NULL) - return NULL; - - self->fd = -1; - self->addr = -1; - self->pec = 0; - - return (PyObject *)self; -} - -PyDoc_STRVAR(SMBus_close_doc, - "close()\n\n" - "Disconnects the object from the bus.\n"); - -static PyObject * -SMBus_close(SMBus *self) -{ - if ((self->fd != -1) && (close(self->fd) == -1)) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - self->fd = -1; - self->addr = -1; - self->pec = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -static void -SMBus_dealloc(SMBus *self) -{ - PyObject *ref = SMBus_close(self); - Py_XDECREF(ref); - - self->ob_type->tp_free((PyObject *)self); -} - -#define MAXPATH 16 - -PyDoc_STRVAR(SMBus_open_doc, - "open(bus)\n\n" - "Connects the object to the specified SMBus.\n"); - -static PyObject * -SMBus_open(SMBus *self, PyObject *args, PyObject *kwds) -{ - int bus; - char path[MAXPATH]; - - static char *kwlist[] = {"bus", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "i:open", kwlist, &bus)) - return NULL; - - if (snprintf(path, MAXPATH, "/dev/i2c-%d", bus) >= MAXPATH) { - PyErr_SetString(PyExc_OverflowError, - "Bus number is invalid."); - return NULL; - } - - if ((self->fd = open(path, O_RDWR, 0)) == -1) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -static int -SMBus_init(SMBus *self, PyObject *args, PyObject *kwds) -{ - int bus = -1; - - static char *kwlist[] = {"bus", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i:__init__", - kwlist, &bus)) - return -1; - - if (bus >= 0) { - SMBus_open(self, args, kwds); - if (PyErr_Occurred()) - return -1; - } - - return 0; -} - -/* - * private helper function, 0 => success, !0 => error - */ -static int -SMBus_set_addr(SMBus *self, int addr) -{ - int ret = 0; - - if (self->addr != addr) { - ret = ioctl(self->fd, I2C_SLAVE, addr); - self->addr = addr; - } - - return ret; -} - -#define SMBus_SET_ADDR(self, addr) do { \ - if (SMBus_set_addr(self, addr)) { \ - PyErr_SetFromErrno(PyExc_IOError); \ - return NULL; \ - } \ -} while(0) - -PyDoc_STRVAR(SMBus_write_quick_doc, - "write_quick(addr)\n\n" - "Perform SMBus Quick transaction.\n"); - -static PyObject * -SMBus_write_quick(SMBus *self, PyObject *args) -{ - int addr; - __s32 result; - - if (!PyArg_ParseTuple(args, "i:write_quick", &addr)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - if ((result = i2c_smbus_write_quick(self->fd, I2C_SMBUS_WRITE))) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(SMBus_read_byte_doc, - "read_byte(addr) -> result\n\n" - "Perform SMBus Read Byte transaction.\n"); - -static PyObject * -SMBus_read_byte(SMBus *self, PyObject *args) -{ - int addr; - __s32 result; - - if (!PyArg_ParseTuple(args, "i:read_byte", &addr)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - if ((result = i2c_smbus_read_byte(self->fd)) == -1) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return Py_BuildValue("l", (long)result); -} - -PyDoc_STRVAR(SMBus_write_byte_doc, - "write_byte(addr, val)\n\n" - "Perform SMBus Write Byte transaction.\n"); - -static PyObject * -SMBus_write_byte(SMBus *self, PyObject *args) -{ - int addr, val; - __s32 result; - - if (!PyArg_ParseTuple(args, "ii:write_byte", &addr, &val)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - if ((result = i2c_smbus_write_byte(self->fd, (__u8)val)) == -1) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(SMBus_read_byte_data_doc, - "read_byte_data(addr, cmd) -> result\n\n" - "Perform SMBus Read Byte Data transaction.\n"); - -static PyObject * -SMBus_read_byte_data(SMBus *self, PyObject *args) -{ - int addr, cmd; - __s32 result; - - if (!PyArg_ParseTuple(args, "ii:read_byte_data", &addr, &cmd)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - if ((result = i2c_smbus_read_byte_data(self->fd, (__u8)cmd)) == -1) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return Py_BuildValue("l", (long)result); -} - -PyDoc_STRVAR(SMBus_write_byte_data_doc, - "write_byte_data(addr, cmd, val)\n\n" - "Perform SMBus Write Byte Data transaction.\n"); - -static PyObject * -SMBus_write_byte_data(SMBus *self, PyObject *args) -{ - int addr, cmd, val; - __s32 result; - - if (!PyArg_ParseTuple(args, "iii:write_byte_data", &addr, &cmd, &val)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - if ((result = i2c_smbus_write_byte_data(self->fd, - (__u8)cmd, (__u8)val)) == -1) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(SMBus_read_word_data_doc, - "read_word_data(addr, cmd) -> result\n\n" - "Perform SMBus Read Word Data transaction.\n"); - -static PyObject * -SMBus_read_word_data(SMBus *self, PyObject *args) -{ - int addr, cmd; - __s32 result; - - if (!PyArg_ParseTuple(args, "ii:read_word_data", &addr, &cmd)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - if ((result = i2c_smbus_read_word_data(self->fd, (__u8)cmd)) == -1) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return Py_BuildValue("l", (long)result); -} - -PyDoc_STRVAR(SMBus_write_word_data_doc, - "write_word_data(addr, cmd, val)\n\n" - "Perform SMBus Write Word Data transaction.\n"); - -static PyObject * -SMBus_write_word_data(SMBus *self, PyObject *args) -{ - int addr, cmd, val; - __s32 result; - - if (!PyArg_ParseTuple(args, "iii:write_word_data", &addr, &cmd, &val)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - if ((result = i2c_smbus_write_word_data(self->fd, - (__u8)cmd, (__u16)val)) == -1) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(SMBus_process_call_doc, - "process_call(addr, cmd, val)\n\n" - "Perform SMBus Process Call transaction.\n"); - -static PyObject * -SMBus_process_call(SMBus *self, PyObject *args) -{ - int addr, cmd, val; - __s32 result; - - if (!PyArg_ParseTuple(args, "iii:process_call", &addr, &cmd, &val)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - if ((result = i2c_smbus_process_call(self->fd, - (__u8)cmd, (__u16)val)) == -1) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -/* - * private helper function; returns a new list of integers - */ -static PyObject * -SMBus_buf_to_list(__u8 const *buf, int len) -{ - PyObject *list = PyList_New(len); - int ii; - - if (list == NULL) - return NULL; - - for (ii = 0; ii < len; ii++) { - PyObject *val = Py_BuildValue("l", (long)buf[ii]); - PyList_SET_ITEM(list, ii, val); - } - return list; -} - -PyDoc_STRVAR(SMBus_read_block_data_doc, - "read_block_data(addr, cmd) -> results\n\n" - "Perform SMBus Read Block Data transaction.\n"); - -static PyObject * -SMBus_read_block_data(SMBus *self, PyObject *args) -{ - int addr, cmd; - union i2c_smbus_data data; - - if (!PyArg_ParseTuple(args, "ii:read_block_data", &addr, &cmd)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - /* save a bit of code by calling the access function directly */ - if (i2c_smbus_access(self->fd, I2C_SMBUS_READ, (__u8)cmd, - I2C_SMBUS_BLOCK_DATA, &data)) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - /* first byte of the block contains (remaining) data length */ - return SMBus_buf_to_list(&data.block[1], data.block[0]); -} - -/* - * private helper function: convert an integer list to union i2c_smbus_data - */ -static int -SMBus_list_to_data(PyObject *list, union i2c_smbus_data *data) -{ - static char *msg = "Third argument must be a list of at least one, " - "but not more than 32 integers"; - int ii, len; - - if (!PyList_Check(list)) { - PyErr_SetString(PyExc_TypeError, msg); - return 0; /* fail */ - } - - if ((len = PyList_GET_SIZE(list)) > 32) { - PyErr_SetString(PyExc_OverflowError, msg); - return 0; /* fail */ - } - - /* first byte is the length */ - data->block[0] = (__u8)len; - - for (ii = 0; ii < len; ii++) { - PyObject *val = PyList_GET_ITEM(list, ii); - if (!PyInt_Check(val)) { - PyErr_SetString(PyExc_TypeError, msg); - return 0; /* fail */ - } - data->block[ii+1] = (__u8)PyInt_AS_LONG(val); - } - - return 1; /* success */ -} - -PyDoc_STRVAR(SMBus_write_block_data_doc, - "write_block_data(addr, cmd, [vals])\n\n" - "Perform SMBus Write Block Data transaction.\n"); - -static PyObject * -SMBus_write_block_data(SMBus *self, PyObject *args) -{ - int addr, cmd; - union i2c_smbus_data data; - - if (!PyArg_ParseTuple(args, "iiO&:write_block_data", &addr, &cmd, - SMBus_list_to_data, &data)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - /* save a bit of code by calling the access function directly */ - if (i2c_smbus_access(self->fd, I2C_SMBUS_WRITE, (__u8)cmd, - I2C_SMBUS_BLOCK_DATA, &data)) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(SMBus_block_process_call_doc, - "block_process_call(addr, cmd, [vals]) -> results\n\n" - "Perform SMBus Block Process Call transaction.\n"); - -static PyObject * -SMBus_block_process_call(SMBus *self, PyObject *args) -{ - int addr, cmd; - union i2c_smbus_data data; - - if (!PyArg_ParseTuple(args, "iiO&:block_process_call", &addr, &cmd, - SMBus_list_to_data, &data)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - /* save a bit of code by calling the access function directly */ - if (i2c_smbus_access(self->fd, I2C_SMBUS_WRITE, (__u8)cmd, - I2C_SMBUS_BLOCK_PROC_CALL, &data)) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - /* first byte of the block contains (remaining) data length */ - return SMBus_buf_to_list(&data.block[1], data.block[0]); -} - -PyDoc_STRVAR(SMBus_read_i2c_block_data_doc, - "read_i2c_block_data(addr, cmd, len=32) -> results\n\n" - "Perform I2C Block Read transaction.\n"); - -static PyObject * -SMBus_read_i2c_block_data(SMBus *self, PyObject *args) -{ - int addr, cmd, len=32; - union i2c_smbus_data data; - - if (!PyArg_ParseTuple(args, "ii|i:read_i2c_block_data", &addr, &cmd, - &len)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - data.block[0] = len; - /* save a bit of code by calling the access function directly */ - if (i2c_smbus_access(self->fd, I2C_SMBUS_READ, (__u8)cmd, - len == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN: - I2C_SMBUS_I2C_BLOCK_DATA, &data)) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - /* first byte of the block contains (remaining) data length */ - return SMBus_buf_to_list(&data.block[1], data.block[0]); -} - -PyDoc_STRVAR(SMBus_write_i2c_block_data_doc, - "write_i2c_block_data(addr, cmd, [vals])\n\n" - "Perform I2C Block Write transaction.\n"); - -static PyObject * -SMBus_write_i2c_block_data(SMBus *self, PyObject *args) -{ - int addr, cmd; - union i2c_smbus_data data; - - if (!PyArg_ParseTuple(args, "iiO&:write_i2c_block_data", &addr, &cmd, - SMBus_list_to_data, &data)) - return NULL; - - SMBus_SET_ADDR(self, addr); - - /* save a bit of code by calling the access function directly */ - if (i2c_smbus_access(self->fd, I2C_SMBUS_WRITE, (__u8)cmd, - I2C_SMBUS_I2C_BLOCK_BROKEN, &data)) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(SMBus_type_doc, - "SMBus([bus]) -> SMBus\n\n" - "Return a new SMBus object that is (optionally) connected to the\n" - "specified I2C device interface.\n"); - -static PyMethodDef SMBus_methods[] = { - {"open", (PyCFunction)SMBus_open, METH_VARARGS | METH_KEYWORDS, - SMBus_open_doc}, - {"close", (PyCFunction)SMBus_close, METH_NOARGS, - SMBus_close_doc}, - {"write_quick", (PyCFunction)SMBus_write_quick, METH_VARARGS, - SMBus_write_quick_doc}, - {"read_byte", (PyCFunction)SMBus_read_byte, METH_VARARGS, - SMBus_read_byte_doc}, - {"write_byte", (PyCFunction)SMBus_write_byte, METH_VARARGS, - SMBus_write_byte_doc}, - {"read_byte_data", (PyCFunction)SMBus_read_byte_data, METH_VARARGS, - SMBus_read_byte_data_doc}, - {"write_byte_data", (PyCFunction)SMBus_write_byte_data, METH_VARARGS, - SMBus_write_byte_data_doc}, - {"read_word_data", (PyCFunction)SMBus_read_word_data, METH_VARARGS, - SMBus_read_word_data_doc}, - {"write_word_data", (PyCFunction)SMBus_write_word_data, METH_VARARGS, - SMBus_write_word_data_doc}, - {"process_call", (PyCFunction)SMBus_process_call, METH_VARARGS, - SMBus_process_call_doc}, - {"read_block_data", (PyCFunction)SMBus_read_block_data, METH_VARARGS, - SMBus_read_block_data_doc}, - {"write_block_data", (PyCFunction)SMBus_write_block_data, METH_VARARGS, - SMBus_write_block_data_doc}, - {"block_process_call", (PyCFunction)SMBus_block_process_call, - METH_VARARGS, SMBus_block_process_call_doc}, - {"read_i2c_block_data", (PyCFunction)SMBus_read_i2c_block_data, - METH_VARARGS, SMBus_read_i2c_block_data_doc}, - {"write_i2c_block_data", (PyCFunction)SMBus_write_i2c_block_data, - METH_VARARGS, SMBus_write_i2c_block_data_doc}, - {NULL}, -}; - -static PyObject * -SMBus_get_pec(SMBus *self, void *closure) -{ - PyObject *result = self->pec ? Py_True : Py_False; - Py_INCREF(result); - return result; -} - -static int -SMBus_set_pec(SMBus *self, PyObject *val, void *closure) -{ - int pec; - - pec = PyObject_IsTrue(val); - - if (val == NULL) { - PyErr_SetString(PyExc_TypeError, - "Cannot delete attribute"); - return -1; - } - else if (pec == -1) { - PyErr_SetString(PyExc_TypeError, - "The pec attribute must be a boolean."); - return -1; - } - - if (self->pec != pec) { - if (ioctl(self->fd, I2C_PEC, pec)) { - PyErr_SetFromErrno(PyExc_IOError); - return -1; - } - self->pec = pec; - } - - return 0; -} - -static PyGetSetDef SMBus_getset[] = { - {"pec", (getter)SMBus_get_pec, (setter)SMBus_set_pec, - "True if Packet Error Codes (PEC) are enabled"}, - {NULL}, -}; - -static PyTypeObject SMBus_type = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "SMBus", /* tp_name */ - sizeof(SMBus), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SMBus_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - SMBus_type_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - SMBus_methods, /* tp_methods */ - 0, /* tp_members */ - SMBus_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SMBus_init, /* tp_init */ - 0, /* tp_alloc */ - SMBus_new, /* tp_new */ -}; - -static PyMethodDef SMBus_module_methods[] = { - {NULL} -}; - -#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ -#define PyMODINIT_FUNC void -#endif -PyMODINIT_FUNC -initsmbus(void) -{ - PyObject* m; - - if (PyType_Ready(&SMBus_type) < 0) - return; - - m = Py_InitModule3("smbus", SMBus_module_methods, SMBus_module_doc); - - Py_INCREF(&SMBus_type); - PyModule_AddObject(m, "SMBus", (PyObject *)&SMBus_type); -} - From 0d39567685f823f758e6e41e321f424b2a35a5a5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 27 Jun 2007 14:53:36 +0000 Subject: [PATCH 078/718] i2c-dev.h is no longer there. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4498 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/developers/applications | 8 ++++---- kernel/include/Module.mk | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/developers/applications b/doc/developers/applications index 60c89564..d928dd53 100644 --- a/doc/developers/applications +++ b/doc/developers/applications @@ -10,7 +10,7 @@ From lowest-level to the highest-level, the access methods are: 1) Character device access to the i2c bus driver via /dev/i2c-x - 2) I2C bus access functions as defined in kernel/include/i2c-dev.h + 2) I2C bus access functions as defined in 3) sysfs access to the chip device driver 4) libsensors library 5) sensors program @@ -39,14 +39,14 @@ Details: 2. Direct /dev access using inline functions -------------------------------------------- - I2C bus access inline functions as defined in kernel/include/i2c-dev.h, + I2C bus access inline functions as defined in , and in doc/dev-interface in the i2c package or Documentation/i2c/dev-interface in the linux kernel sources. Note that these used to be defined in in the kernel source tree. However, userspace applications are not supposed to include kernel headers, so the inline functions were removed from - the kernel file in recent kernels. Use the header file in this package - instead. + the kernel file in recent kernels. Use the header file from the + i2c-tools package instead. This method does not use a chip device driver at all. However it does require the i2c-dev module. diff --git a/kernel/include/Module.mk b/kernel/include/Module.mk index 2f62f1ff..0b41678f 100644 --- a/kernel/include/Module.mk +++ b/kernel/include/Module.mk @@ -21,7 +21,7 @@ MODULE_DIR := kernel/include KERNELINCLUDEDIR := $(MODULE_DIR) -KERNELINCLUDEFILES := $(MODULE_DIR)/i2c-dev.h $(MODULE_DIR)/sensors.h +KERNELINCLUDEFILES := $(MODULE_DIR)/sensors.h REMOVEKERNELINC := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SYSINCLUDEDIR)/%,$(KERNELINCLUDEFILES)) From 3e69b5182a1bbbb51bf0edc118ffa22da9c66273 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 07:29:43 +0000 Subject: [PATCH 079/718] No longer need to include "kernel/sensors.h". git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4501 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/chips.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/chips.c b/lib/chips.c index 18c53c09..56a69535 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -20,7 +20,6 @@ #include "chips.h" #include "data.h" #include "sensors.h" -#include "kernel/include/sensors.h" #define PLACEHOLDER_ELEMENTS {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} From 6a6cf217d4bfa96e9300027ef0e2a926b2a7343c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 08:52:37 +0000 Subject: [PATCH 080/718] Drop all the chip-specific handling and printing code from sensors. The generic printing code should work now, and what doesn't work, will get fixed. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4503 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 3 +- prog/sensors/chips.c | 5912 ------------------------------------------ prog/sensors/chips.h | 54 - prog/sensors/main.c | 123 +- 4 files changed, 3 insertions(+), 6089 deletions(-) diff --git a/CHANGES b/CHANGES index 2003f9b1..1a56acf9 100644 --- a/CHANGES +++ b/CHANGES @@ -35,8 +35,7 @@ SVN HEAD Look for rrd in /usr/bin by default Add missing shell declarations Update URI - Program sensors: Drop ddcmon and eeprom support - Add dme1737 support + Program sensors: Drop all the chip-specific support Fix alignment of alarm for one-limit temperatures Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index ee173337..9a71850a 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -25,9 +25,6 @@ #include "chips.h" #include "lib/sensors.h" -#include "lib/chips.h" -#include "lib/error.h" -#include "kernel/include/sensors.h" void print_label(const char *label, int space); static inline float deg_ctof( float ); @@ -131,5915 +128,6 @@ void print_vid_info(const sensors_chip_name *name, int f_vid, int f_vrm) print_vid_info_real(name, f_vid, f_vrm, 10); } -/* Chip-specific print routines start here */ - -void print_ds1621(const sensors_chip_name *name) -{ - char *label; - double cur,hyst,over; - int alarms, valid; - - if (!sensors_get_feature(*name,SENSORS_DS1621_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_DS1621_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_DS1621_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_DS1621_TEMP_HYST,&hyst) && - !sensors_get_feature(*name,SENSORS_DS1621_TEMP_OVER,&over)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, over, hyst, MINMAX, 2, 1); - if (alarms & (DS1621_ALARM_TEMP_HIGH | DS1621_ALARM_TEMP_LOW)) { - printf("ALARM ("); - if (alarms & DS1621_ALARM_TEMP_LOW) { - printf("LOW"); - } - if (alarms & DS1621_ALARM_TEMP_HIGH) - printf("%sHIGH",(alarms & DS1621_ALARM_TEMP_LOW)?",":""); - printf(")"); - } - printf("\n"); - } - } else - printf("ERROR: Can't get temperature data!\n"); - free(label); -} - -void print_lm75(const sensors_chip_name *name) -{ - char *label; - double cur,hyst,over; - int valid; - - if (!sensors_get_label_and_valid(*name,SENSORS_LM75_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM75_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_LM75_TEMP_HYST,&hyst) && - !sensors_get_feature(*name,SENSORS_LM75_TEMP_OVER,&over)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, over, hyst, HYST, 1, 1); - printf( "\n" ); - } - } else - printf("ERROR: Can't get temperature data!\n"); - free(label); -} - -void print_adm1021(const sensors_chip_name *name) -{ - char *label; - double cur,hyst,over; - int alarms,i,valid; - - if (!sensors_get_feature(*name,SENSORS_ADM1021_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1021_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1021_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1021_TEMP_HYST,&hyst) && - !sensors_get_feature(*name,SENSORS_ADM1021_TEMP_OVER,&over)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, over, hyst, MINMAX, 0, 0); - if (alarms & (ADM1021_ALARM_TEMP_HIGH | ADM1021_ALARM_TEMP_LOW)) { - printf("ALARM ("); - i = 0; - if (alarms & ADM1021_ALARM_TEMP_LOW) { - printf("LOW"); - i++; - } - if (alarms & ADM1021_ALARM_TEMP_HIGH) - printf("%sHIGH",i?",":""); - printf(")"); - } - printf("\n"); - } - } else - printf("ERROR: Can't get temperature data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1021_REMOTE_TEMP, - &label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1021_REMOTE_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1021_REMOTE_TEMP_HYST,&hyst) && - !sensors_get_feature(*name,SENSORS_ADM1021_REMOTE_TEMP_OVER,&over)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, over, hyst, MINMAX, 0, 0); - if (alarms & (ADM1021_ALARM_RTEMP_HIGH | ADM1021_ALARM_RTEMP_LOW | - ADM1021_ALARM_RTEMP_NA)) { - printf("ALARM ("); - i = 0; - if (alarms & ADM1021_ALARM_RTEMP_NA) { - printf("N/A"); - i++; - } - if (alarms & ADM1021_ALARM_RTEMP_LOW) { - printf("%sLOW",i?",":""); - i++; - } - if (alarms & ADM1021_ALARM_RTEMP_HIGH) - printf("%sHIGH",i?",":""); - printf(")"); - } - printf("\n"); - } - } else - printf("ERROR: Can't get temperature data!\n"); - free(label); - - if (!strcmp(name->prefix,"adm1021")) { - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1021_DIE_CODE, - &label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1021_DIE_CODE,&cur)) { - if (valid) { - print_label(label,10); - printf("%4.0f\n",cur); - } - } else - printf("ERROR: Can't get die-code data!\n"); - free(label); - } -} - -void print_adm9240(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms; - int valid; - - if (!sensors_get_feature(*name,SENSORS_ADM9240_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf( "%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM9240_ALARM_IN0?"ALARM":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM9240_ALARM_IN1?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM9240_ALARM_IN2?"ALARM":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM9240_ALARM_IN3?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM9240_ALARM_IN4?"ALARM":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM9240_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM9240_ALARM_IN5?"ALARM":""); - } - } else - printf("ERROR: Can't get IN5 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_ADM9240_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_ADM9240_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&ADM9240_ALARM_FAN1?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_ADM9240_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_ADM9240_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&ADM9240_ALARM_FAN2?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_ADM9240_TEMP_HYST,&min) && - !sensors_get_feature(*name,SENSORS_ADM9240_TEMP_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf( " %s\n", alarms & ADM9240_ALARM_TEMP ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_VID,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM9240_VID,&cur)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V\n",cur); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM9240_ALARMS,&label,&valid)) { - if (valid) { - print_label(label,10); - if(alarms & ADM9240_ALARM_CHAS) - printf("Chassis intrusion detection ALARM\n"); - else - printf("\n"); - } - } - free(label); -} - -void print_adm1024(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms; - int valid; - - if (!sensors_get_feature(*name,SENSORS_ADM1024_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf( "%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM1024_ALARM_IN0?"ALARM":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM1024_ALARM_IN1?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM1024_ALARM_IN2?"ALARM":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM1024_ALARM_IN3?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM1024_ALARM_IN4?"ALARM":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_ADM1024_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&ADM1024_ALARM_IN5?"ALARM":""); - } - } else - printf("ERROR: Can't get IN5 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_ADM1024_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&ADM1024_ALARM_FAN1?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_ADM1024_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&ADM1024_ALARM_FAN2?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_TEMP_HYST,&min) && - !sensors_get_feature(*name,SENSORS_ADM1024_TEMP_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, min, max, HYST, 1, 0); - printf( " %s\n", alarms & ADM1024_ALARM_TEMP ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_TEMP1,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_TEMP1_HYST,&min) && - !sensors_get_feature(*name,SENSORS_ADM1024_TEMP1_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, min, max, HYST, 1, 0); - printf( " %s\n", alarms & ADM1024_ALARM_TEMP1 ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1024_TEMP2_HYST,&min) && - !sensors_get_feature(*name,SENSORS_ADM1024_TEMP2_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, min, max, HYST, 1, 0); - printf( " %s\n", alarms & ADM1024_ALARM_TEMP2 ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_VID,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1024_VID,&cur)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V\n",cur); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1024_ALARMS,&label,&valid)) { - if (valid) { - print_label(label,10); - if(alarms & ADM1024_ALARM_CHAS) - printf("Chassis intrusion detection ALARM\n"); - else - printf("\n"); - } - } - free(label); -} - -void print_sis5595(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms,valid; - - if (!sensors_get_feature(*name,SENSORS_SIS5595_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&SIS5595_ALARM_IN0?"ALARM":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&SIS5595_ALARM_IN1?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&SIS5595_ALARM_IN2?"ALARM":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&SIS5595_ALARM_IN3?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_SIS5595_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&SIS5595_ALARM_IN4?"ALARM":""); - } - } else - /* No error if IN4 is missing as it will happen with 2.6 kernels when - the chip is configured in 4 voltage + 1 temperature sensors. */ - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_SIS5595_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_SIS5595_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_SIS5595_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&SIS5595_ALARM_FAN1?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_SIS5595_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_SIS5595_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_SIS5595_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&SIS5595_ALARM_FAN2?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_SIS5595_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_SIS5595_TEMP_HYST,&min) && - !sensors_get_feature(*name,SENSORS_SIS5595_TEMP_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 0, 0); - printf( " %s\n", alarms & SIS5595_ALARM_TEMP ? "ALARM" : "" ); - } - } else - /* No error if TEMP is missing as it will happen with 2.6 kernels when - the chip is configured in 5 voltage sensors mode. */ - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_SIS5595_ALARMS,&label,&valid) - && valid) { - print_label(label,10); - printf("Board temperature input (usually LM75 chips) %s\n", - alarms & SIS5595_ALARM_BTI ?"ALARM":" "); - } - free(label); - -} - -void print_via686a(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms,valid; - - if (!sensors_get_feature(*name,SENSORS_VIA686A_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VIA686A_ALARM_IN0?"ALARM":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VIA686A_ALARM_IN1?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VIA686A_ALARM_IN2?"ALARM":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VIA686A_ALARM_IN3?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VIA686A_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VIA686A_ALARM_IN4?"ALARM":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_VIA686A_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&VIA686A_ALARM_FAN1?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_VIA686A_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&VIA686A_ALARM_FAN2?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_TEMP_HYST,&min) && - !sensors_get_feature(*name,SENSORS_VIA686A_TEMP_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VIA686A_ALARM_TEMP ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_TEMP2_HYST,&min) && - !sensors_get_feature(*name,SENSORS_VIA686A_TEMP2_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VIA686A_ALARM_TEMP2 ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VIA686A_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VIA686A_TEMP3,&cur) && - !sensors_get_feature(*name,SENSORS_VIA686A_TEMP3_HYST,&min) && - !sensors_get_feature(*name,SENSORS_VIA686A_TEMP3_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VIA686A_ALARM_TEMP3 ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - -} - -void print_lm78(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms,valid; - - if (!sensors_get_feature(*name,SENSORS_LM78_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM78_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM78_ALARM_IN0?"ALARM":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM78_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM78_ALARM_IN1?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM78_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM78_ALARM_IN2?"ALARM":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM78_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM78_ALARM_IN3?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM78_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM78_ALARM_IN4?"ALARM":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM78_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM78_ALARM_IN5?"ALARM":""); - } - } else - printf("ERROR: Can't get IN5 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_IN6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_IN6,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_IN6_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM78_IN6_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM78_ALARM_IN6?"ALARM":""); - } - } else - printf("ERROR: Can't get IN6 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_LM78_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&LM78_ALARM_FAN1?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_LM78_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&LM78_ALARM_FAN2?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_FAN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_FAN3,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_FAN3_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_LM78_FAN3_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&LM78_ALARM_FAN3?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_LM78_TEMP_HYST,&min) && - !sensors_get_feature(*name,SENSORS_LM78_TEMP_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf( " %s\n", alarms & LM78_ALARM_TEMP ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_VID,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM78_VID,&cur)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V\n",cur); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM78_ALARMS,&label,&valid) - && valid) { - if(alarms & LM78_ALARM_BTI) { - print_label(label,10); - printf("Board temperature input (LM75) ALARM\n"); - } - if(alarms & LM78_ALARM_CHAS) { - print_label(label,10); - printf("Chassis intrusion detection ALARM\n"); - } - } - free(label); -} - -void print_gl518(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms,beeps,valid; - - if (!sensors_get_feature(*name,SENSORS_GL518_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get ALARMS data!\n"); - alarms = 0; - } - if (!sensors_get_feature(*name,SENSORS_GL518_BEEPS,&cur)) - beeps = cur + 0.5; - else { - printf("ERROR: Can't get BEEPS data!\n"); - beeps = 0; - } - -/* VCC, VIN1 and VIN2 are handled specially because on early releases (0x00) - * of the GL518SM, we cannot read their values. This is detected when the - * reading would be 0.0 V and displayed as "(n/a)" instead. */ - if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VDD,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL518_VDD,&cur) && - !sensors_get_feature(*name,SENSORS_GL518_VDD_MIN,&min) && - !sensors_get_feature(*name,SENSORS_GL518_VDD_MAX,&max)) { - if (valid) { - print_label(label,10); - if (cur == 0.0) - printf("(n/a) "); - else - printf("%+6.2f V ",cur); - printf( "(min = %+6.2f V, max = %+6.2f V) %s %s\n", - min,max,alarms&GL518_ALARM_VDD?"ALARM":" ", - beeps&GL518_ALARM_VDD?"(beep)":""); - } - } else - printf("ERROR: Can't get VDD data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL518_VIN1,&cur) && - !sensors_get_feature(*name,SENSORS_GL518_VIN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_GL518_VIN1_MAX,&max)) { - if (valid) { - print_label(label,10); - if (cur == 0.0) - printf("(n/a) "); - else - printf("%+6.2f V ",cur); - printf("(min = %+6.2f V, max = %+6.2f V) %s %s\n", - min,max,alarms&GL518_ALARM_VIN1?"ALARM":" ", - beeps&GL518_ALARM_VIN1?"(beep)":""); - } - } else - printf("ERROR: Can't get VIN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL518_VIN2,&cur) && - !sensors_get_feature(*name,SENSORS_GL518_VIN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_GL518_VIN2_MAX,&max)) { - if (valid) { - print_label(label,10); - if (cur == 0.0) - printf("(n/a) "); - else - printf("%+6.2f V ",cur); - printf("(min = %+6.2f V, max = %+6.2f V) %s %s\n", - min,max,alarms&GL518_ALARM_VIN2?"ALARM":" ", - beeps&GL518_ALARM_VIN2?"(beep)":""); - } - } else - printf("ERROR: Can't get VIN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL518_VIN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL518_VIN3,&cur) && - !sensors_get_feature(*name,SENSORS_GL518_VIN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_GL518_VIN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&GL518_ALARM_VIN3?"ALARM":" ", - beeps&GL518_ALARM_VIN3?"(beep)":""); - } - } else - printf("ERROR: Can't get VIN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL518_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL518_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_GL518_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_GL518_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n", - cur,min,fdiv, alarms&GL518_ALARM_FAN1?"ALARM":" ", - beeps&GL518_ALARM_FAN1?"(beep)":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL518_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL518_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_GL518_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_GL518_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n", - cur,min,fdiv, alarms&GL518_ALARM_FAN2?"ALARM":" ", - beeps&GL518_ALARM_FAN2?"(beep)":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL518_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL518_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_GL518_TEMP_OVER,&max) && - !sensors_get_feature(*name,SENSORS_GL518_TEMP_HYST,&min)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf("%s %s\n", alarms&GL518_ALARM_TEMP?"ALARM":" ", - beeps&GL518_ALARM_TEMP?"(beep)":""); - } - } else - printf("ERROR: Can't get TEMP data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL518_BEEP_ENABLE,&label,&valid) - && valid) { - if (!sensors_get_feature(*name,SENSORS_GL518_BEEP_ENABLE,&cur)) { - print_label(label,10); - if (cur < 0.5) - printf("Sound alarm disabled\n"); - else - printf("Sound alarm enabled\n"); - } else - printf("ERROR: Can't get BEEP ENABLE data!\n"); - } - free(label); -} - -void print_gl520(const sensors_chip_name *name) -{ - char *label; - double cur,min,max; - int alarms,beeps,valid; - int two_temps = 0; - - if (!sensors_get_feature(*name,SENSORS_GL520_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get ALARMS data!\n"); - alarms = 0; - } - if (!sensors_get_feature(*name,SENSORS_GL520_BEEPS,&cur)) - beeps = cur + 0.5; - else { - printf("ERROR: Can't get BEEPS data!\n"); - beeps = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_VID,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_VID,&cur)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V\n",cur); - } - } else - printf("ERROR: Can't get VID data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_VDD,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_VDD,&cur) && - !sensors_get_feature(*name,SENSORS_GL520_VDD_MIN,&min) && - !sensors_get_feature(*name,SENSORS_GL520_VDD_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V ",cur); - printf( "(min = %+6.2f V, max = %+6.2f V) %s %s\n", - min,max,alarms&GL520_ALARM_VDD?"ALARM":" ", - beeps&GL520_ALARM_VDD?"(beep)":""); - } - } else - printf("ERROR: Can't get VDD data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_VIN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_VIN1,&cur) && - !sensors_get_feature(*name,SENSORS_GL520_VIN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_GL520_VIN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V ",cur); - printf("(min = %+6.2f V, max = %+6.2f V) %s %s\n", - min,max,alarms&GL520_ALARM_VIN1?"ALARM":" ", - beeps&GL520_ALARM_VIN1?"(beep)":""); - } - } else - printf("ERROR: Can't get VIN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_VIN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_VIN2,&cur) && - !sensors_get_feature(*name,SENSORS_GL520_VIN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_GL520_VIN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V ",cur); - printf("(min = %+6.2f V, max = %+6.2f V) %s %s\n", - min,max,alarms&GL520_ALARM_VIN2?"ALARM":" ", - beeps&GL520_ALARM_VIN2?"(beep)":""); - } - } else - printf("ERROR: Can't get VIN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_VIN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_VIN3,&cur) && - !sensors_get_feature(*name,SENSORS_GL520_VIN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_GL520_VIN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&GL520_ALARM_VIN3?"ALARM":" ", - beeps&GL520_ALARM_VIN3?"(beep)":""); - } - } else - printf("ERROR: Can't get VIN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_VIN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_VIN4,&cur) && - !sensors_get_feature(*name,SENSORS_GL520_VIN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_GL520_VIN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&GL520_ALARM_VIN4?"ALARM":" ", - beeps&GL520_ALARM_VIN4?"(beep)":""); - } - } else - two_temps = 1; - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_GL520_FAN1_DIV,&max) && - !sensors_get_feature(*name,SENSORS_GL520_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n", - cur,min,max, alarms&GL520_ALARM_FAN1?"ALARM":" ", - beeps&GL520_ALARM_FAN1?"(beep)":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_GL520_FAN2_DIV,&max) && - !sensors_get_feature(*name,SENSORS_GL520_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n", - cur,min,max, alarms&GL520_ALARM_FAN2?"ALARM":" ", - beeps&GL520_ALARM_FAN2?"(beep)":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_TEMP1,&cur) && - !sensors_get_feature(*name,SENSORS_GL520_TEMP1_OVER,&max) && - !sensors_get_feature(*name,SENSORS_GL520_TEMP1_HYST,&min)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf("%s %s\n", alarms&GL520_ALARM_TEMP1?"ALARM":" ", - beeps&GL520_ALARM_TEMP1?"(beep)":""); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (two_temps) { - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_GL520_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_GL520_TEMP2_OVER,&max) && - !sensors_get_feature(*name,SENSORS_GL520_TEMP2_HYST,&min)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf("%s %s\n", alarms&GL520_ALARM_TEMP2?"ALARM":" ", - beeps&GL520_ALARM_TEMP2?"(beep)":""); - } - } else - printf("ERROR: Can't get TEMP2 or VIN4 data!\n"); - free(label); - } - - if (!sensors_get_label_and_valid(*name,SENSORS_GL520_BEEP_ENABLE,&label,&valid) - && valid) { - if (!sensors_get_feature(*name,SENSORS_GL520_BEEP_ENABLE,&cur)) { - print_label(label,10); - if (cur < 0.5) - printf("Sound alarm disabled\n"); - else - printf("Sound alarm enabled\n"); - } else - printf("ERROR: Can't get BEEP ENABLE data!\n"); - } - free(label); -} - -void print_adm1025(const sensors_chip_name *name) -{ - char *label; - double cur,min,max; - int alarms,valid,i; - - if (!sensors_get_feature(*name,SENSORS_ADM1025_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - for (i=0; i<6; i++) { - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1025_IN0+i,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1025_IN0+i,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1025_IN0_MIN+i,&min) && - !sensors_get_feature(*name,SENSORS_ADM1025_IN0_MAX+i,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&(ADM1025_ALARM_IN0<<(i+(i/4)*4))?"ALARM":""); - } - } else - if (i!=4) /* Chip may have +12V input used for VID instead */ - printf("ERROR: Can't get IN%d data!\n", i); - free(label); - } - - for (i=0; i<2; i++) { - if (!sensors_get_label_and_valid(*name,SENSORS_ADM1025_TEMP1+3*i,&label,&valid) && - !sensors_get_feature(*name,SENSORS_ADM1025_TEMP1+3*i,&cur) && - !sensors_get_feature(*name,SENSORS_ADM1025_TEMP1_LOW+3*i,&min) && - !sensors_get_feature(*name,SENSORS_ADM1025_TEMP1_HIGH+3*i,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, 1, 0); - printf(" %s\n", i==0&&(alarms&ADM1025_ALARM_RFAULT)?"FAULT": - alarms&(ADM1025_ALARM_RTEMP>>i)?"ALARM":""); - } - } else - printf("ERROR: Can't get TEMP%d data!\n", i+1); - free(label); - } - - print_vid_info(name, SENSORS_ADM1025_VID, SENSORS_ADM1025_VRM); -} - -void print_lm80(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,min2,max2,fdiv; - int alarms,valid; - - if (!sensors_get_feature(*name,SENSORS_LM80_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM80_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM80_ALARM_IN0?"ALARM":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM80_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM80_ALARM_IN1?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM80_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM80_ALARM_IN2?"ALARM":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM80_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM80_ALARM_IN3?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM80_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM80_ALARM_IN4?"ALARM":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM80_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM80_ALARM_IN5?"ALARM":""); - } - } else - printf("ERROR: Can't get IN5 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_IN6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_IN6,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_IN6_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM80_IN6_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM80_ALARM_IN6?"ALARM":""); - } - } else - printf("ERROR: Can't get IN6 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_LM80_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&LM80_ALARM_FAN1?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_LM80_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&LM80_ALARM_FAN2?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_TEMP,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM80_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_LM80_TEMP_HOT_HYST,&min) && - !sensors_get_feature(*name,SENSORS_LM80_TEMP_HOT_MAX,&max) && - !sensors_get_feature(*name,SENSORS_LM80_TEMP_OS_HYST,&min2) && - !sensors_get_feature(*name,SENSORS_LM80_TEMP_OS_MAX,&max2)) { - if (valid) { - if (fahrenheit) { - cur = deg_ctof(cur); - max = deg_ctof(max); - min = deg_ctof(min); - max2 = deg_ctof(max2); - min2 = deg_ctof(min2); - } - - print_label(label,10); - printf("%+6.2f%s (hot: limit = %+3.0f%s, hyst = %+3.0f%s) %s\n", - cur, degstr, max, degstr, min, degstr, - alarms&LM80_ALARM_TEMP_HOT?"ALARM":""); - print_label("",10); - printf(" (os: limit = %+3.0f%s, hyst = %+3.0f%s) %s\n", - max2, degstr, min2, degstr, - alarms&LM80_ALARM_TEMP_OS?"ALARM":""); - } - } else - printf("ERROR: Can't get TEMP data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM80_ALARMS,&label,&valid) - && valid) { - if (alarms & LM80_ALARM_BTI) { - print_label(label,10); - printf("Board temperature input (LM75) ALARM\n"); - } - if (alarms & LM80_ALARM_CHAS) { - print_label(label,10); - printf("Chassis intrusion detection ALARM\n"); - } - } - free(label); -} - -void print_lm85(const sensors_chip_name *name) -{ - char *label; - double cur, min, max; - int alarms, alarm_mask = 0, valid; - int is1027, is7463, is6d100; - - is1027 = !strcmp(name->prefix,"adm1027") - || !strcmp(name->prefix,"adt7463") ; - is7463 = !strcmp(name->prefix, "adt7463"); - is6d100 = !strcmp(name->prefix,"emc6d100") ; - - if (!sensors_get_feature(*name,SENSORS_LM85_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (is1027 && - !sensors_get_feature(*name, SENSORS_ADM1027_ALARM_MASK, &cur)) { - alarm_mask = cur + 0.5; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s", - (is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN0?"ALARM":""); - if (is1027) { printf(alarm_mask&LM85_ALARM_IN0?" MASKED":""); } - putchar( '\n' ); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s", - (is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN1?"ALARM":""); - if (is1027) { printf(alarm_mask&LM85_ALARM_IN1?" MASKED":""); } - putchar( '\n' ); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s", - (is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN2?"ALARM":""); - if (is1027) { printf(alarm_mask&LM85_ALARM_IN2?" MASKED":""); } - putchar( '\n' ); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s", - (is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN3?"ALARM":""); - if (is1027) { printf(alarm_mask&LM85_ALARM_IN3?" MASKED":""); } - putchar( '\n' ); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s", - (is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN4?"ALARM":""); - if (is1027) { printf(alarm_mask&LM85_ALARM_IN4?" MASKED":""); } - putchar( '\n' ); - } - } else if (!is7463) - printf("ERROR: Can't get IN4 data!\n"); - free(label); - - if( is6d100 ) { - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+7.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM85_ALARM_IN5?"ALARM":""); - } - } else - printf("ERROR: Can't get IN5 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_IN6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_IN6,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_IN6_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_IN6_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+7.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM85_ALARM_IN6?"ALARM":""); - } - } else - printf("ERROR: Can't get IN6 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_IN7,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_IN7,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_IN7_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_IN7_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+7.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM85_ALARM_IN7?"ALARM":""); - } - } else - printf("ERROR: Can't get IN7 data!\n"); - free(label); - } - - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%5.0f RPM (min = %4.0f RPM) %s", - cur,min, alarms&LM85_ALARM_FAN1?"ALARM":""); - if (is1027) { printf(alarm_mask&LM85_ALARM_FAN1?" MASKED":""); } - putchar( '\n' ); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%5.0f RPM (min = %4.0f RPM) %s", - cur,min, alarms&LM85_ALARM_FAN2?"ALARM":""); - if (is1027) { printf(alarm_mask&LM85_ALARM_FAN2?" MASKED":""); } - putchar( '\n' ); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_FAN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_FAN3,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_FAN3_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%5.0f RPM (min = %4.0f RPM) %s", - cur,min, alarms&LM85_ALARM_FAN3?"ALARM":""); - if (is1027) { printf(alarm_mask&LM85_ALARM_FAN3?" MASKED":""); } - putchar( '\n' ); - } - } else - printf("ERROR: Can't get FAN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_FAN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_FAN4,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_FAN4_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%5.0f RPM (min = %4.0f RPM) %s", - cur,min, alarms&LM85_ALARM_FAN4?"ALARM":""); - if (is1027) { printf(alarm_mask&LM85_ALARM_FAN4?" MASKED":""); } - putchar( '\n' ); - } - } else - printf("ERROR: Can't get FAN4 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_TEMP1,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_TEMP1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_TEMP1_MAX,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, (is1027 ? 2 : 0), 0); - printf( " %s %s %s\n", - alarms&LM85_ALARM_TEMP1?"ALARM":"", - alarms&LM85_ALARM_TEMP1_FAULT?"FAULT":"", - is1027&&(alarm_mask&LM85_ALARM_TEMP1)?"MASKED":"" - ); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_TEMP2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_TEMP2_MAX,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, (is1027 ? 2 : 0), 0); - printf( " %s %s\n", - alarms&LM85_ALARM_TEMP2?"ALARM":"", - is1027&&(alarm_mask&LM85_ALARM_TEMP2)?"MASKED":"" - ); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_TEMP3,&cur) && - !sensors_get_feature(*name,SENSORS_LM85_TEMP3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM85_TEMP3_MAX,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, (is1027 ? 2 : 0), 0); - printf( " %s %s %s\n", - alarms&LM85_ALARM_TEMP3?"ALARM":"", - alarms&LM85_ALARM_TEMP3_FAULT?"FAULT":"", - is1027&&(alarm_mask&LM85_ALARM_TEMP3)?"MASKED":"" - ); - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_PWM1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_PWM1,&cur)) { - if (valid) { - print_label(label,10); - printf("%4.0f\n", cur); - } - } else - printf("ERROR: Can't get PWM1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_PWM2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_PWM2,&cur)) { - if (valid) { - print_label(label,10); - printf("%4.0f\n", cur); - } - } else - printf("ERROR: Can't get PWM2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM85_PWM3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM85_PWM3,&cur)) { - if (valid) { - print_label(label,10); - printf("%4.0f\n", cur); - } - } else - printf("ERROR: Can't get PWM3 data!\n"); - free(label); - - print_vid_info(name, SENSORS_LM85_VID, SENSORS_LM85_VRM); -} - -void print_lm87(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms,valid; - - if (!sensors_get_feature(*name,SENSORS_LM87_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM87_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM87_ALARM_IN0?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM87_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM87_ALARM_IN1?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM87_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM87_ALARM_IN2?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM87_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM87_ALARM_IN3?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM87_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM87_ALARM_IN4?"ALARM":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM87_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM87_ALARM_IN5?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_AIN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_AIN1,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_AIN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM87_AIN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM87_ALARM_FAN1?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_AIN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_AIN2,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_AIN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_LM87_AIN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&LM87_ALARM_FAN2?"ALARM":""); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_LM87_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&LM87_ALARM_FAN1?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_LM87_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&LM87_ALARM_FAN2 ?"ALARM":""); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_TEMP1,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_TEMP1_HYST,&min) && - !sensors_get_feature(*name,SENSORS_LM87_TEMP1_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, 0, 0); - printf(" %s%s\n", alarms&LM87_ALARM_TEMP1?"ALARM":"", - alarms&LM87_ALARM_THERM_SIG?" THERM#":""); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_TEMP2_HYST,&min) && - !sensors_get_feature(*name,SENSORS_LM87_TEMP2_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, 0, 0); - printf(" %s%s\n", alarms&LM87_ALARM_TEMP2?"ALARM":"", - alarms&LM87_ALARM_TEMP2_FAULT?" FAULT":""); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_LM87_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_LM87_TEMP3,&cur) && - !sensors_get_feature(*name,SENSORS_LM87_TEMP3_HYST,&min) && - !sensors_get_feature(*name,SENSORS_LM87_TEMP3_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, 0, 0); - printf(" %s%s\n", alarms&LM87_ALARM_TEMP3?"ALARM":"", - alarms&LM87_ALARM_TEMP3_FAULT?" FAULT":""); - } - } - free(label); - - print_vid_info(name, SENSORS_LM87_VID, SENSORS_LM87_VRM); -} - -void print_mtp008(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms,valid; - - if (!sensors_get_feature(*name,SENSORS_MTP008_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&MTP008_ALARM_IN0?"ALARM":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&MTP008_ALARM_IN1?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&MTP008_ALARM_IN2?"ALARM":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&MTP008_ALARM_IN3?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&MTP008_ALARM_IN4?"ALARM":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&MTP008_ALARM_IN5?"ALARM":""); - } - } else - printf("ERROR: Can't get IN5 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_IN6,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_IN6_MIN,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_IN6_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&MTP008_ALARM_IN6?"ALARM":""); - } - } else - printf("ERROR: Can't get IN6 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_MTP008_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&MTP008_ALARM_FAN1?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_MTP008_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&MTP008_ALARM_FAN2?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_FAN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_FAN3,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_FAN3_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_MTP008_FAN3_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&MTP008_ALARM_FAN3?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_TEMP1,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_TEMP1_HYST,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_TEMP1_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 0, 0); - printf(" %s\n", alarms&MTP008_ALARM_TEMP1?"ALARM":""); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_TEMP2_HYST,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_TEMP2_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 0, 0); - printf(" %s\n", alarms&MTP008_ALARM_TEMP2?"ALARM":""); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_TEMP3,&cur) && - !sensors_get_feature(*name,SENSORS_MTP008_TEMP3_HYST,&min) && - !sensors_get_feature(*name,SENSORS_MTP008_TEMP3_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 0, 0); - printf(" %s\n", alarms&MTP008_ALARM_TEMP3?"ALARM":""); - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_VID,&label,&valid) && - !sensors_get_feature(*name,SENSORS_MTP008_VID,&cur)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V\n",cur); - } - } - free(label); -} - -void print_w83781d(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv,sens; - int alarms,beeps; - int beep_mask; - int is81d, is82d, is83s, is91d, is697hf, is627thf, valid; - - is81d = !strcmp(name->prefix,"w83781d"); - is82d = (!strcmp(name->prefix,"w83782d")) || - (!strcmp(name->prefix,"w83627hf")) || - (!strcmp(name->prefix,"w83637hf")) || - (!strcmp(name->prefix, "w83627thf")) || - (!strcmp(name->prefix, "w83687thf")); - is83s = !strcmp(name->prefix,"w83783s"); - is91d = !strcmp(name->prefix,"w83791d"); - is627thf = (!strcmp(name->prefix,"w83627thf")) || - (!strcmp(name->prefix, "w83637hf")) || - (!strcmp(name->prefix, "w83687thf")); - is697hf = !strcmp(name->prefix,"w83697hf"); - - if (!sensors_get_feature(*name,SENSORS_W83781D_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_feature(*name,SENSORS_W83781D_BEEPS,&cur)) { - beeps = cur + 0.5; - } else { - printf("ERROR: Can't get beep data!\n"); - beeps = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83781D_ALARM_IN0?"ALARM":" ", - beeps&W83781D_ALARM_IN0?"(beep)":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if ((!is83s) && (!is697hf)) { - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_IN1_MAX,&max)) { - if (valid) { - /* for the w83791d, beep mask is different than the alarm mask */ - if (is91d) - beep_mask = W83791D_BEEP_IN1; - else - beep_mask = W83781D_ALARM_IN1; - - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83781D_ALARM_IN1?"ALARM":" ", - beeps&beep_mask?"(beep)":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - } - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83781D_ALARM_IN2?"ALARM":" ", - beeps&W83781D_ALARM_IN2?"(beep)":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83781D_ALARM_IN3?"ALARM":" ", - beeps&W83781D_ALARM_IN3?"(beep)":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83781D_ALARM_IN4?"ALARM":" ", - beeps&W83781D_ALARM_IN4?"(beep)":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - if (!is627thf) { - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83781D_ALARM_IN5?"ALARM":" ", - beeps&W83781D_ALARM_IN5?"(beep)":""); - } - } else - printf("ERROR: Can't get IN5 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_IN6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_IN6,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_IN6_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_IN6_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83781D_ALARM_IN6?"ALARM":" ", - beeps&W83781D_ALARM_IN6?"(beep)":""); - } - } else - printf("ERROR: Can't get IN6 data!\n"); - free(label); - } /* !is627thf */ - if (is82d || is697hf || is627thf) { - if (!sensors_get_label_and_valid(*name,SENSORS_W83782D_IN7,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83782D_IN7,&cur) && - !sensors_get_feature(*name,SENSORS_W83782D_IN7_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83782D_IN7_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83782D_ALARM_IN7?"ALARM":" ", - beeps&W83782D_ALARM_IN7?"(beep)":""); - } - } else - printf("ERROR: Can't get IN7 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_W83782D_IN8,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83782D_IN8,&cur) && - !sensors_get_feature(*name,SENSORS_W83782D_IN8_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83782D_IN8_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83782D_ALARM_IN8?"ALARM":" ", - beeps&W83782D_ALARM_IN8?"(beep)":""); - } - } else - printf("ERROR: Can't get IN8 data!\n"); - free(label); - } - - if (is91d) { - if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_IN7,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83791D_IN7,&cur) && - !sensors_get_feature(*name,SENSORS_W83791D_IN7_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83791D_IN7_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83791D_ALARM_IN7?"ALARM":" ", - beeps&W83791D_BEEP_IN7?"(beep)":""); - } - } else - printf("ERROR: Can't get IN7 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_IN8,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83791D_IN8,&cur) && - !sensors_get_feature(*name,SENSORS_W83791D_IN8_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83791D_IN8_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83791D_ALARM_IN8?"ALARM":" ", - beeps&W83791D_BEEP_IN8?"(beep)":""); - } - } else - printf("ERROR: Can't get IN8 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_IN9,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83791D_IN9,&cur) && - !sensors_get_feature(*name,SENSORS_W83791D_IN9_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83791D_IN9_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s %s\n", - cur,min,max,alarms&W83791D_ALARM_IN9?"ALARM":" ", - beeps&W83791D_ALARM_IN9?"(beep)":""); - } - } else - printf("ERROR: Can't get IN9 data!\n"); - free(label); - } - - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83781D_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n", - cur,min,fdiv, alarms&W83781D_ALARM_FAN1?"ALARM":" ", - beeps&W83781D_ALARM_FAN1?"(beep)":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83781D_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n", - cur,min,fdiv, alarms&W83781D_ALARM_FAN2?"ALARM":" ", - beeps&W83781D_ALARM_FAN2?"(beep)":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if(!is697hf) { - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_FAN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_FAN3,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_FAN3_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83781D_FAN3_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n", - cur,min,fdiv, alarms&W83781D_ALARM_FAN3?"ALARM":" ", - beeps&W83781D_ALARM_FAN3?"(beep)":""); - } - } else - printf("ERROR: Can't get FAN3 data!\n"); - free(label); - } - - if(is91d) { - if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_FAN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83791D_FAN4,&cur) && - !sensors_get_feature(*name,SENSORS_W83791D_FAN4_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83791D_FAN4_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n", - cur,min,fdiv, alarms&W83791D_ALARM_FAN4?"ALARM":" ", - beeps&W83791D_ALARM_FAN4?"(beep)":""); - } - } else - printf("ERROR: Can't get FAN4 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_W83791D_FAN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83791D_FAN5,&cur) && - !sensors_get_feature(*name,SENSORS_W83791D_FAN5_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83791D_FAN5_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s %s\n", - cur,min,fdiv, alarms&W83791D_ALARM_FAN5?"ALARM":" ", - beeps&W83791D_ALARM_FAN5?"(beep)":""); - } - } else - printf("ERROR: Can't get FAN5 data!\n"); - free(label); - } - - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_TEMP1,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_TEMP1_HYST,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_TEMP1_OVER,&max)) { - if (valid) { - if((!is82d) && (!is83s) && (!is697hf)) { - print_label(label,10); - if(min == 127) - print_temp_info( cur, max, 0, MAXONLY, 0, 0); - else - print_temp_info( cur, max, min, HYST, 0, 0); - printf(" %s %s\n", alarms&W83781D_ALARM_TEMP1 ?"ALARM":" ", - beeps&W83781D_ALARM_TEMP1?"(beep)":""); - } else { - if(!sensors_get_feature(*name,SENSORS_W83781D_SENS1,&sens)) { - print_label(label,10); - if(min == 127) - print_temp_info( cur, max, 0, MAXONLY, 0, 0); - else - print_temp_info( cur, max, min, HYST, 0, 0); - printf( " sensor = %s %s %s\n", - (((int)sens)==1)?"diode":(((int)sens)==2)? - "transistor":"thermistor", - alarms&W83781D_ALARM_TEMP1?"ALARM":" ", - beeps&W83781D_ALARM_TEMP1?"(beep)":""); - } else { - printf("ERROR: Can't get TEMP1 data!\n"); - } - } - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_TEMP2_HYST,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_TEMP2_OVER,&max)) { - if (valid) { - if((!is82d) && (!is83s) && (!is697hf)) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s %s\n", alarms&W83781D_ALARM_TEMP2 ?"ALARM":" ", - beeps&W83781D_ALARM_TEMP2?"(beep)":""); - } else { - if(!sensors_get_feature(*name,SENSORS_W83781D_SENS2,&sens)) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf( " sensor = %s %s %s\n", - (((int)sens)==1)?"diode":(((int)sens)==2)? - "transistor":"thermistor", - alarms&W83781D_ALARM_TEMP2?"ALARM":" ", - beeps&W83781D_ALARM_TEMP2?"(beep)":""); - } else { - printf("ERROR: Can't get TEMP2 data!\n"); - } - } - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - - if ((!is83s) && (!is697hf)) { - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83781D_TEMP3,&cur) && - !sensors_get_feature(*name,SENSORS_W83781D_TEMP3_HYST,&min) && - !sensors_get_feature(*name,SENSORS_W83781D_TEMP3_OVER,&max)) { - if (valid) { - if(!is82d) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - if (!is81d) { - /* for the w83791d, beep mask is different than the alarm mask */ - if (is91d) - beep_mask = W83791D_BEEP_TEMP3; - else - beep_mask = W83781D_ALARM_TEMP3; - printf(" %s %s\n", alarms&W83781D_ALARM_TEMP3?"ALARM":" ", - beeps&beep_mask?"(beep)":""); - } else - printf(" %s %s\n", alarms&W83781D_ALARM_TEMP23?"ALARM":" ", - beeps&W83781D_ALARM_TEMP23?"(beep)":""); - } else { - if(!sensors_get_feature(*name,SENSORS_W83781D_SENS3,&sens)) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf( " sensor = %s %s %s\n", - (((int)sens)==1)?"diode":(((int)sens)==2)? - "transistor":"thermistor", - alarms&W83781D_ALARM_TEMP3?"ALARM":" ", - beeps&W83781D_ALARM_TEMP3?"(beep)":""); - } else { - printf("ERROR: Can't get TEMP3 data!\n"); - } - } - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - } - - if(!is697hf) { - print_vid_info(name, SENSORS_W83781D_VID, SENSORS_W83781D_VRM); - } - - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_ALARMS,&label,&valid) - && valid && !is83s) { - print_label(label,10); - if (alarms & W83781D_ALARM_CHAS) - printf("Chassis intrusion detection ALARM\n"); - else - printf("\n"); - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83781D_BEEP_ENABLE,&label,&valid) - && valid) { - if (!sensors_get_feature(*name,SENSORS_W83781D_BEEP_ENABLE,&cur)) { - print_label(label,10); - if (cur < 0.5) - printf("Sound alarm disabled\n"); - else - printf("Sound alarm enabled\n"); - } else - printf("ERROR: Can't get BEEP data!\n"); - } - free(label); -} - - -void print_w83792d(const sensors_chip_name *name) -{ - char *label; - int alarms; - double cur,min,max,fdiv; - int valid = 0; - - if (!sensors_get_feature(*name,SENSORS_W83792D_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max, (alarms&W83792D_ALARM_IN0)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max, (alarms&W83792D_ALARM_IN1)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max, (alarms&W83792D_ALARM_IN2)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max, (alarms&W83792D_ALARM_IN3)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max, (alarms&W83792D_ALARM_IN4)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max, (alarms&W83792D_ALARM_IN5)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN5 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_IN6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_IN6,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_IN6_MIN,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_IN6_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max, (alarms&W83792D_ALARM_IN6)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN6 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_W83792D_IN7, - &label, &valid) && - !sensors_get_feature(*name, SENSORS_W83792D_IN7, &cur) && - !sensors_get_feature(*name, SENSORS_W83792D_IN7_MIN, &min) && - !sensors_get_feature(*name, SENSORS_W83792D_IN7_MAX, &max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max, (alarms&W83792D_ALARM_IN7)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN7 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_W83792D_IN8, - &label, &valid) && - !sensors_get_feature(*name, SENSORS_W83792D_IN8, &cur) && - !sensors_get_feature(*name, SENSORS_W83792D_IN8_MIN, &min) && - !sensors_get_feature(*name, SENSORS_W83792D_IN8_MAX, &max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max, (alarms&W83792D_ALARM_IN8)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN8 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, (alarms&W83792D_ALARM_FAN1)?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, (alarms&W83792D_ALARM_FAN2)?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_FAN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN3,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN3_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN3_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, (alarms&W83792D_ALARM_FAN3)?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_FAN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN4,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN4_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN4_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, (alarms&W83792D_ALARM_FAN4)?"ALARM":""); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_FAN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN5,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN5_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN5_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, (alarms&W83792D_ALARM_FAN5)?"ALARM":""); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_FAN6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN6,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN6_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN6_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, (alarms&W83792D_ALARM_FAN6)?"ALARM":""); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_FAN7,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN7,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN7_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_W83792D_FAN7_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, (alarms&W83792D_ALARM_FAN7)?"ALARM":""); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_TEMP1,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_TEMP1_HYST,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_TEMP1_OVER,&max)) { - if (valid) { - print_label(label,10); - if(min == 127){ - print_temp_info( cur, max, 0, MAXONLY, 1, 1); - printf(" %s\n", (cur>max)?"ALARM":""); - }else{ - print_temp_info( cur, max, min, HYST, 1, 1); - printf(" %s\n", (alarms&W83792D_ALARM_TEMP1)?"ALARM":""); - } - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_TEMP2_HYST,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_TEMP2_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 1); - printf(" %s\n", (alarms&W83792D_ALARM_TEMP2)?"ALARM":""); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_TEMP3,&cur) && - !sensors_get_feature(*name,SENSORS_W83792D_TEMP3_HYST,&min) && - !sensors_get_feature(*name,SENSORS_W83792D_TEMP3_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 1); - printf(" %s\n", (alarms&W83792D_ALARM_TEMP3)?"ALARM":""); - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - - /* print_vid_info(name, SENSORS_W83792D_VID, SENSORS_W83792D_VRM); */ - - if (!sensors_get_label_and_valid(*name,SENSORS_W83792D_CHASSIS,&label,&valid) && - !sensors_get_feature(*name,SENSORS_W83792D_CHASSIS,&cur) ) - { - if (valid) { - print_label(label,10); - if (cur==1) { - printf("Chassis intrusion detection ALARM\n"); - }else{ - printf("Chassis is normal.\n"); - } - } - }else{ - printf("ERROR: Can't get Chassis data!\n"); - } - free(label); -} - -void print_w83l785ts(const sensors_chip_name *name) -{ - char *label; - double cur, over; - int valid; - - if (!sensors_get_label_and_valid(*name, SENSORS_W83L785TS_TEMP, &label, &valid) - && !sensors_get_feature(*name, SENSORS_W83L785TS_TEMP, &cur) - && !sensors_get_feature(*name, SENSORS_W83L785TS_TEMP_OVER, &over)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, over, 0, MAXONLY, 0, 0); - printf("\n"); - } - } else - printf("ERROR: Can't get temperature data!\n"); - free(label); -} - -void print_w83627ehf(const sensors_chip_name *name) -{ - char *label; - int i, valid, num_in; - double cur, min, fdiv, max, alarm, over, hyst; - - if (!strcmp(name->prefix, "w83627dhg")) - num_in = 9; - else - num_in = 10; - - for (i = 0; i < num_in; i++) { - if (!sensors_get_label_and_valid(*name,SENSORS_W83627EHF_IN0+i, - &label,&valid) - && !sensors_get_feature(*name,SENSORS_W83627EHF_IN0+i,&cur) - && !sensors_get_feature(*name,SENSORS_W83627EHF_IN0_MIN+i,&min) - && !sensors_get_feature(*name,SENSORS_W83627EHF_IN0_MAX+i,&max) - && !sensors_get_feature(*name,SENSORS_W83627EHF_IN0_ALARM+i,&alarm)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarm ? "ALARM" : ""); - } - } - /* Earlier versions of the driver did not have voltage support, so we - keep quiet on error */ - free(label); - } - - for (i = 0; i < 5; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_W83627EHF_FAN1+i, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_W83627EHF_FAN1+i, &cur) - && !sensors_get_feature(*name, SENSORS_W83627EHF_FAN1_MIN+i, &min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM", cur, min); - if (!sensors_get_feature(*name, SENSORS_W83627EHF_FAN1_DIV+i, &fdiv)) - printf(", div = %1.0f", fdiv); - printf(")"); - if (!sensors_get_feature(*name, SENSORS_W83627EHF_FAN1_ALARM+i, - &alarm) && alarm) - printf(" ALARM"); - printf("\n"); - } - } else if (i < 3) - printf("ERROR: Can't get FAN%d data!\n", i + 1); - free(label); - } - - for (i = 0; i < 3; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_W83627EHF_TEMP1+i, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_W83627EHF_TEMP1+i, &cur) - && !sensors_get_feature(*name, SENSORS_W83627EHF_TEMP1_OVER+i, &over) - && !sensors_get_feature(*name, SENSORS_W83627EHF_TEMP1_HYST+i, &hyst)) { - if (valid) { - print_label(label,10); - print_temp_info(cur, over, hyst, HYST, i ? 1 : 0, i ? 1 : 0); - if (!sensors_get_feature(*name, SENSORS_W83627EHF_TEMP1_ALARM+i, - &alarm) && alarm) - printf(" ALARM"); - printf("\n"); - } - } else - printf("ERROR: Can't get TEMP%d data!\n", i + 1); - free(label); - } -} - -void print_w83793(const sensors_chip_name *name) -{ - char *label; - int i, valid; - double cur, min, max, over, hyst, alarm; - - for (i = 0; i < 10; i++) { - if (!sensors_get_label_and_valid(*name,SENSORS_W83793_IN(i), - &label, &valid) && - !sensors_get_feature(*name, SENSORS_W83793_IN(i), &cur) && - !sensors_get_feature(*name, SENSORS_W83793_IN_MIN(i), &min) && - !sensors_get_feature(*name, SENSORS_W83793_IN_MAX(i), &max) && - !sensors_get_feature(*name, SENSORS_W83793_IN_ALARM(i), &alarm)) { - if (valid) { - print_label(label, 10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur, min, max, alarm ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get IN%d data!\n", i); - free(label); - } - - for (i = 1; i <= 12; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_W83793_FAN(i), - &label, &valid) && - !sensors_get_feature(*name, SENSORS_W83793_FAN(i), &cur) && - !sensors_get_feature(*name, SENSORS_W83793_FAN_MIN(i), &min) && - !sensors_get_feature(*name, SENSORS_W83793_FAN_ALARM(i), &alarm)) { - if (valid) { - print_label(label, 10); - printf("%4.0f RPM (min = %4.0f RPM) %s\n", - cur, min, alarm ? "ALARM" : ""); - } - } else if (i <= 5) - printf("ERROR: Can't get FAN%d data!\n", i); - free(label); - } - - for (i = 1; i <= 6; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_W83793_TEMP(i), - &label, &valid) && - !sensors_get_feature(*name, SENSORS_W83793_TEMP(i), &cur) && - !sensors_get_feature(*name, SENSORS_W83793_TEMP_CRIT(i), &over) && - !sensors_get_feature(*name, SENSORS_W83793_TEMP_CRIT_HYST(i), &hyst) && - !sensors_get_feature(*name, SENSORS_W83793_TEMP_ALARM(i), &alarm)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, over, hyst, HYST, i <= 4 ? 1 : 0, i <= 4 ? 1 : 0); - printf(" %s\n", alarm ? "ALARM" : ""); - } - } - free(label); - } - - print_vid_info(name, SENSORS_W83793_VID0, SENSORS_W83793_VRM); - print_vid_info(name, SENSORS_W83793_VID1, SENSORS_W83793_VRM); -} - -void print_maxilife(const sensors_chip_name *name) -{ - char *label; - double cur, min, max; - int alarms,valid; - - if (!sensors_get_feature(*name, SENSORS_MAXI_CG_ALARMS, &cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_TEMP1, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP1, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP1_MAX, &max) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP1_HYST, &min)) { - if (valid && (cur || max || min)) { - print_label(label, 12); - print_temp_info( cur, max, min, HYST, 1, 0); - printf("\n"); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_TEMP2, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP2, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP2_MAX, &max) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP2_HYST, &min)) { - if (valid && (cur || max || min)) { - print_label(label, 12); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms&MAXI_ALARM_TEMP2 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_TEMP3, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP3, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP3_MAX, &max) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP3_HYST, &min)) { - if (valid && (cur || max || min)) { - print_label(label, 12); - print_temp_info( cur, max, min, HYST, 1, 0); - printf("\n"); - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_TEMP4, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP4, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP4_MAX, &max) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP4_HYST, &min)) { - if (valid && (cur || max || min)) { - print_label(label, 12); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms&MAXI_ALARM_TEMP4 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get TEMP4 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_TEMP5, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP5, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP5_MAX, &max) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_TEMP5_HYST, &min)) { - if (valid && (cur || max || min)) { - print_label(label, 12); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms&MAXI_ALARM_TEMP5 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get TEMP5 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_FAN1, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_FAN1, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_FAN1_MIN, &min) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_FAN1_DIV, &max)) { - if (valid && (cur || min || max)) { - print_label(label, 12); - if (cur < 0) - printf(" OFF (min = %4.0f RPM, div = %1.0f) %s\n", - min/max, max, alarms&MAXI_ALARM_FAN1 ? "ALARM" : ""); - else - printf("%5.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur/max, min/max, max, alarms&MAXI_ALARM_FAN1 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_FAN2, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_FAN2, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_FAN2_MIN, &min) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_FAN2_DIV, &max)) { - if (valid && (cur || min || max)) { - print_label(label, 12); - if (cur < 0) - printf(" OFF (min = %4.0f RPM, div = %1.0f) %s\n", - min/max, max, alarms&MAXI_ALARM_FAN2 ? "ALARM" : ""); - else - printf("%5.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur/max, min/max, max, alarms&MAXI_ALARM_FAN2 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_FAN3, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_FAN3, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_FAN3_MIN, &min) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_FAN3_DIV, &max)) { - if (valid && (cur || min || max)) { - print_label(label, 12); - if (cur < 0) - printf(" OFF (min = %4.0f RPM, div = %1.0f) %s\n", - min/max, max, alarms&MAXI_ALARM_FAN3 ? "ALARM" : ""); - else - printf("%5.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur/max, min/max, max, alarms&MAXI_ALARM_FAN3 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get FAN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_PLL, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_PLL, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_PLL_MIN, &min) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_PLL_MAX, &max)) { - if (valid && (cur || min || max)) { - print_label(label, 12); - printf("%4.2f MHz (min = %4.2f MHz, max = %4.2f MHz) %s\n", - cur, min, max, alarms&MAXI_ALARM_PLL ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get PLL data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_VID1, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID1, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID1_MIN, &min) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID1_MAX, &max)) { - if (valid && (cur || min || max)) { - print_label(label, 12); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur, min, max, alarms&MAXI_ALARM_VID1 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get VID1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_VID2, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID2, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID2_MIN, &min) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID2_MAX, &max)) { - if (valid && (cur || min || max)) { - print_label(label, 12); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur, min, max, alarms&MAXI_ALARM_VID2 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get VID2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_VID3, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID3, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID3_MIN, &min) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID3_MAX, &max)) { - if (valid && (cur || min || max)) { - print_label(label, 12); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur, min, max, alarms&MAXI_ALARM_VID3 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get VID3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAXI_CG_VID4, &label,&valid) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID4, &cur) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID4_MIN, &min) && - !sensors_get_feature(*name, SENSORS_MAXI_CG_VID4_MAX, &max)) { - if (valid && (cur || min || max)) { - print_label(label, 12); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur, min, max, alarms&MAXI_ALARM_VID4 ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get VID4 data!\n"); - free(label); -} - -void print_it87(const sensors_chip_name *name) -{ - char *label; - double cur, min, max, fdiv, sens; - int alarms, valid; - - if (!sensors_get_feature(*name,SENSORS_IT87_ALARMS, &cur)) { - alarms = cur + 0.5; - } - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_IT87_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&IT87_ALARM_IN0?"ALARM":""); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_IT87_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&IT87_ALARM_IN1?"ALARM":""); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_IT87_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&IT87_ALARM_IN2?"ALARM":""); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_IT87_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&IT87_ALARM_IN3?"ALARM":""); - } - } else - printf("ERROR: Can't get IN3 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_IT87_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&IT87_ALARM_IN4?"ALARM":""); - } - } else - printf("ERROR: Can't get IN4 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_IT87_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&IT87_ALARM_IN5?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_IN6,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_IN6_MIN,&min) && - !sensors_get_feature(*name,SENSORS_IT87_IN6_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&IT87_ALARM_IN6?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN7,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_IN7,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_IN7_MIN,&min) && - !sensors_get_feature(*name,SENSORS_IT87_IN7_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&IT87_ALARM_IN7?"ALARM":""); - } - } else - printf("ERROR: Can't get IN7 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_IN8,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_IN8,&cur)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V\n", cur); - } - } else - printf("ERROR: Can't get IN8 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM", cur, min); - /* fan1_div is optional */ - if (!sensors_get_feature(*name, SENSORS_IT87_FAN1_DIV, &fdiv)) - printf(", div = %1.0f)", fdiv); - else - printf(") "); - printf(" %s\n", alarms&IT87_ALARM_FAN1?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM", cur, min); - /* fan2_div is optional */ - if (!sensors_get_feature(*name, SENSORS_IT87_FAN2_DIV, &fdiv)) - printf(", div = %1.0f)", fdiv); - else - printf(") "); - printf(" %s\n", alarms&IT87_ALARM_FAN2?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_FAN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_FAN3,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_FAN3_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM", cur, min); - /* fan3_div is optional */ - if (!sensors_get_feature(*name, SENSORS_IT87_FAN3_DIV, &fdiv)) - printf(", div = %1.0f)", fdiv); - else - printf(") "); - printf(" %s\n", alarms&IT87_ALARM_FAN3?"ALARM":""); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_TEMP1,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_TEMP1_LOW,&min) && - !sensors_get_feature(*name,SENSORS_IT87_SENS1,&sens) && - !sensors_get_feature(*name,SENSORS_IT87_TEMP1_HIGH,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, 0, 0); - printf(" sensor = %s ", (((int)sens)==3) ? "diode" : - (((int)sens)==2) ? "thermistor" : - (((int)sens)==0) ? "disabled" : "invalid"); - printf( " %s\n", alarms & IT87_ALARM_TEMP1 ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_TEMP2_LOW,&min) && - !sensors_get_feature(*name,SENSORS_IT87_SENS2,&sens) && - !sensors_get_feature(*name,SENSORS_IT87_TEMP2_HIGH,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, 0, 0); - printf(" sensor = %s ", (((int)sens)==3) ? "diode" : - (((int)sens)==2) ? "thermistor" : - (((int)sens)==0) ? "disabled" : "invalid"); - printf( " %s\n", alarms & IT87_ALARM_TEMP2 ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_TEMP3,&cur) && - !sensors_get_feature(*name,SENSORS_IT87_TEMP3_LOW,&min) && - !sensors_get_feature(*name,SENSORS_IT87_SENS3,&sens) && - !sensors_get_feature(*name,SENSORS_IT87_TEMP3_HIGH,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, 0, 0); - printf(" sensor = %s ", (((int)sens)==3) ? "diode" : - (((int)sens)==2) ? "thermistor" : - (((int)sens)==0) ? "disabled" : "invalid"); - printf( " %s\n", alarms & IT87_ALARM_TEMP3 ? "ALARM" : "" ); - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_IT87_VID,&label,&valid) && - !sensors_get_feature(*name,SENSORS_IT87_VID,&cur)) { - if (valid) { - print_label(label,10); - printf("%+6.3f V\n", cur); - } - } - free(label); -} - -void print_fscpos(const sensors_chip_name *name) -{ - char *label; - double voltage, temp, state, fan; - int valid; - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCPOS_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCPOS_TEMP1,&temp) && - !sensors_get_feature(*name,SENSORS_FSCPOS_TEMP1_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C\n", temp); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCPOS_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCPOS_TEMP2,&temp) && - !sensors_get_feature(*name,SENSORS_FSCPOS_TEMP2_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C\n", temp); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCPOS_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCPOS_TEMP3,&temp) && - !sensors_get_feature(*name,SENSORS_FSCPOS_TEMP3_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C\n", temp); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCPOS_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCPOS_FAN1,&fan) && - !sensors_get_feature(*name,SENSORS_FSCPOS_FAN1_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x04) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCPOS_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCPOS_FAN2,&fan) && - !sensors_get_feature(*name,SENSORS_FSCPOS_FAN2_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x04) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCPOS_FAN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCPOS_FAN3,&fan) && - !sensors_get_feature(*name,SENSORS_FSCPOS_FAN3_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x04) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCPOS_VOLTAGE1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCPOS_VOLTAGE1,&voltage)) { - if (valid) { - print_label(label,10); - printf("\t%+6.2f V\n",voltage); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCPOS_VOLTAGE2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCPOS_VOLTAGE2,&voltage)) { - if (valid) { - print_label(label,10); - printf("\t%+6.2f V\n",voltage); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCPOS_VOLTAGE3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCPOS_VOLTAGE3,&voltage)) { - if (valid) { - print_label(label,10); - printf("\t%+6.2f V\n",voltage); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); -} - -void print_fscscy(const sensors_chip_name *name) -{ - char *label; - double voltage, temp, tempmin, tempmax, templim, state, fan; - int valid; - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_TEMP1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP1,&temp) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP1_LIM,&templim) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP1_MIN,&tempmin) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP1_MAX,&tempmax) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP1_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C (Min = %+6.2f C, Max = %+6.2f C, Lim = %+6.2f C)\n", - temp,tempmin,tempmax,templim); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP2,&temp) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP2_LIM,&templim) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP2_MIN,&tempmin) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP2_MAX,&tempmax) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP2_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C (Min = %+6.2f C, Max = %+6.2f C, Lim = %+6.2f C)\n", - temp,tempmin,tempmax,templim); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP3,&temp) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP3_LIM,&templim) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP3_MIN,&tempmin) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP3_MAX,&tempmax) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP3_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C (Min = %+6.2f C, Max = %+6.2f C, Lim = %+6.2f C)\n", - temp,tempmin,tempmax,templim); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_TEMP4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP4,&temp) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP4_LIM,&templim) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP4_MIN,&tempmin) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP4_MAX,&tempmax) && - !sensors_get_feature(*name,SENSORS_FSCSCY_TEMP4_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C (Min = %+6.2f C, Max = %+6.2f C, Lim = %+6.2f C)\n", - temp,tempmin,tempmax,templim); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP4 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN1,&fan) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN1_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x02) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN2,&fan) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN2_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x02) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_FAN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN3,&fan) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN3_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x02) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_FAN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN4,&fan) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN4_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x02) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN4 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_FAN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN5,&fan) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN5_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x02) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN5 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_FAN6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN6,&fan) && - !sensors_get_feature(*name,SENSORS_FSCSCY_FAN6_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x02) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN6 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_VOLTAGE1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_VOLTAGE1,&voltage)) { - if (valid) { - print_label(label,10); - printf("\t%+6.2f V\n",voltage); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_VOLTAGE2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_VOLTAGE2,&voltage)) { - if (valid) { - print_label(label,10); - printf("\t%+6.2f V\n",voltage); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCSCY_VOLTAGE3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_FSCSCY_VOLTAGE3,&voltage)) { - if (valid) { - print_label(label,10); - printf("\t%+6.2f V\n",voltage); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); -} - -void print_fscher(const sensors_chip_name *name) -{ - char *label; - double voltage, temp, state, fan; - int valid; - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCHER_TEMP1,&label,&valid) - && !sensors_get_feature(*name,SENSORS_FSCHER_TEMP1,&temp) - && !sensors_get_feature(*name,SENSORS_FSCHER_TEMP1_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C\n", temp); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCHER_TEMP2,&label,&valid) - && !sensors_get_feature(*name,SENSORS_FSCHER_TEMP2,&temp) - && !sensors_get_feature(*name,SENSORS_FSCHER_TEMP2_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C\n", temp); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCHER_TEMP3,&label,&valid) - && !sensors_get_feature(*name,SENSORS_FSCHER_TEMP3,&temp) - && !sensors_get_feature(*name,SENSORS_FSCHER_TEMP3_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x01) - printf("\t%+6.2f C\n", temp); - else - printf("\tfailed\n"); - } - } else - printf("ERROR: Can't get TEMP3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCHER_FAN1,&label,&valid) - && !sensors_get_feature(*name,SENSORS_FSCHER_FAN1,&fan) - && !sensors_get_feature(*name,SENSORS_FSCHER_FAN1_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x04) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCHER_FAN2,&label,&valid) - && !sensors_get_feature(*name,SENSORS_FSCHER_FAN2,&fan) - && !sensors_get_feature(*name,SENSORS_FSCHER_FAN2_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x04) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCHER_FAN3,&label,&valid) - && !sensors_get_feature(*name,SENSORS_FSCHER_FAN3,&fan) - && !sensors_get_feature(*name,SENSORS_FSCHER_FAN3_STATE,&state)) { - if (valid) { - print_label(label,10); - if((int) state & 0x04) - printf("\tfaulty\n"); - else - printf("\t%6.0f RPM\n", fan); - } - } else - printf("ERROR: Can't get FAN3 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCHER_VOLTAGE1,&label,&valid) - && !sensors_get_feature(*name,SENSORS_FSCHER_VOLTAGE1,&voltage)) { - if (valid) { - print_label(label,10); - printf("\t%+6.2f V\n",voltage); - } - } else - printf("ERROR: Can't get IN0 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCHER_VOLTAGE2,&label,&valid) - && !sensors_get_feature(*name,SENSORS_FSCHER_VOLTAGE2,&voltage)) { - if (valid) { - print_label(label,10); - printf("\t%+6.2f V\n",voltage); - } - } else - printf("ERROR: Can't get IN1 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_FSCHER_VOLTAGE3,&label,&valid) - && !sensors_get_feature(*name,SENSORS_FSCHER_VOLTAGE3,&voltage)) { - if (valid) { - print_label(label,10); - printf("\t%+6.2f V\n",voltage); - } - } else - printf("ERROR: Can't get IN2 data!\n"); - free(label); -} - -void print_pcf8591(const sensors_chip_name *name) -{ - char *label; - int ain_conf = -1; - double ain; - double aout_enable, aout; - int valid; - - if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_AIN_CONF,&label,&valid) && - !sensors_get_feature(*name, SENSORS_PCF8591_AIN_CONF, &ain)) { - ain_conf = (int)ain; - if (valid) { - print_label(label,10); - switch (ain_conf) - { - case 0: printf("four single ended inputs\n"); - break; - case 1: printf("three differential inputs\n"); - break; - case 2: printf("single ended and differential mixed\n"); - break; - case 3: printf("two differential inputs\n"); - break; - } - } - } - /* display no error, 2.6 driver doesn't have that file */ - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH0,&label,&valid) && - !sensors_get_feature(*name, SENSORS_PCF8591_CH0, &ain)) { - if (valid) { - print_label(label,10); - printf("%6.2f V\n", ain); - } - } - else printf("ERROR: Can't read ch0!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH1,&label,&valid) && - !sensors_get_feature(*name, SENSORS_PCF8591_CH1, &ain)) { - if (valid) { - print_label(label,10); - printf("%6.2f V\n", ain); - } - } - else printf("ERROR: Can't read ch1!\n"); - free(label); - - if (ain_conf != 3) { - if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH2,&label,&valid) && - !sensors_get_feature(*name, SENSORS_PCF8591_CH2, &ain)) { - if (valid) { - print_label(label,10); - printf("%6.2f V\n", ain); - } - } - else if (ain_conf >= 0) /* hide error for 2.6 kernel driver */ - printf("ERROR: Can't read ch2!\n"); - free(label); - } - - if (ain_conf <= 0) { - if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH3,&label,&valid) && - !sensors_get_feature(*name, SENSORS_PCF8591_CH3, &ain)) { - if (valid) { - print_label(label,10); - printf("%6.2f V\n", ain); - } - } - else if (ain_conf >= 0) /* hide error for 2.6 kernel driver */ - printf("ERROR: Can't read ch3!\n"); - free(label); - } - - if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_AOUT,&label,&valid) && - !sensors_get_feature(*name,SENSORS_PCF8591_AOUT,&aout) && - !sensors_get_feature(*name,SENSORS_PCF8591_AOUT_ENABLE,&aout_enable)) { - if (valid) { - print_label(label,10); - printf("%6.2f V (%s)\n", aout, aout_enable?"enabled":"disabled"); - } - } - else printf("ERROR: Can't read aout!\n"); - free(label); - -} - -void print_vt1211(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms,valid; - int err; - - /* per vt1211.c driver, temps 1,5,6,7 and inputs 0,1,6 are optional */ - /* supress error messages reading from them */ - - if (!sensors_get_feature(*name,SENSORS_VT1211_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_IN0,&label,&valid)) { - printf("ERROR: Can't get IN0 config!\n"); - } else if (valid) { - if (!(err = sensors_get_feature(*name,SENSORS_VT1211_IN0,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN0_MIN,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN0_MAX,&max))) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT1211_ALARM_IN0?"ALARM":""); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get IN0 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_IN1,&label,&valid)) { - printf("ERROR: Can't get IN1 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_IN1,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN1_MIN,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN1_MAX,&max))) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT1211_ALARM_IN1?"ALARM":""); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get IN1 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_IN2,&label,&valid)) { - printf("ERROR: Can't get IN2 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_IN2,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN2_MIN,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN2_MAX,&max))) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT1211_ALARM_IN2?"ALARM":""); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get IN2 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_IN3,&label,&valid)) { - printf("ERROR: Can't get IN3 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_IN3,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN3_MIN,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN3_MAX,&max))) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT1211_ALARM_IN3?"ALARM":""); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get IN3 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_IN4,&label,&valid)) { - printf("ERROR: Can't get IN4 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_IN4,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN4_MIN,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN4_MAX,&max))) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT1211_ALARM_IN4?"ALARM":""); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get IN4 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_IN5,&label,&valid)) { - printf("ERROR: Can't get IN5 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_IN5,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN5_MIN,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_IN5_MAX,&max))) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT1211_ALARM_IN5?"ALARM":""); - } - } - free(label); - - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_FAN1,&label,&valid)) { - printf("ERROR: Can't get FAN1 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_FAN1,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_FAN1_DIV,&fdiv)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_FAN1_MIN,&min))) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&VT1211_ALARM_FAN1?"ALARM":""); - } else - printf("ERROR: Can't get FAN1 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_FAN2,&label,&valid)) { - printf("ERROR: Can't get FAN2 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_FAN2,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_FAN2_DIV,&fdiv)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_FAN2_MIN,&min))) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&VT1211_ALARM_FAN2?"ALARM":""); - } else - printf("ERROR: Can't get FAN2 data!\n"); - } - free(label); - - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_TEMP1,&label,&valid)) { - printf("ERROR: Can't get TEMP1 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP1,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP1_HYST,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP1_OVER,&max))) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT1211_ALARM_TEMP1 ? "ALARM" : "" ); - } else - printf("ERROR: Can't get TEMP1 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_TEMP2,&label,&valid)) { - printf("ERROR: Can't get TEMP2 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP2,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP2_HYST,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP2_OVER,&max))) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT1211_ALARM_TEMP2 ? "ALARM" : "" ); - } else - printf("ERROR: Can't get TEMP2 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_TEMP3,&label,&valid)) { - printf("ERROR: Can't get TEMP3 config!\n"); - } else if (valid) { - if (!(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP3,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP3_HYST,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP3_OVER,&max))) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT1211_ALARM_TEMP3 ? "ALARM" : "" ); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get TEMP3 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_TEMP4,&label,&valid)) { - printf("ERROR: Can't get TEMP4 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP4,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP4_HYST,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP4_OVER,&max))) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT1211_ALARM_TEMP4 ? "ALARM" : "" ); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get TEMP4 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_TEMP5,&label,&valid)) { - printf("ERROR: Can't get TEMP5 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP5,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP5_HYST,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP5_OVER,&max))) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT1211_ALARM_TEMP5 ? "ALARM" : "" ); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get TEMP5 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_TEMP6,&label,&valid)) { - printf("ERROR: Can't get TEMP6 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP6,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP6_HYST,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP6_OVER,&max))) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT1211_ALARM_TEMP6 ? "ALARM" : "" ); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get TEMP6 data!\n"); - } - free(label); - if (sensors_get_label_and_valid(*name,SENSORS_VT1211_TEMP7,&label,&valid)) { - printf("ERROR: Can't get TEMP7 config!\n"); - } else if (valid) { - if(!(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP7,&cur)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP7_HYST,&min)) && - !(err = sensors_get_feature(*name,SENSORS_VT1211_TEMP7_OVER,&max))) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT1211_ALARM_TEMP7 ? "ALARM" : "" ); - } else if (err != -SENSORS_ERR_PROC) - printf("ERROR: Can't get TEMP7 data!\n"); - } - free(label); - - print_vid_info(name, SENSORS_VT1211_VID, SENSORS_VT1211_VRM); -} - -void print_smsc47m1(const sensors_chip_name *name) -{ - char *label; - double cur, min, fdiv; - int alarms, valid, i; - int is_m2 = !strcmp(name->prefix, "smsc47m2"); - - if (!sensors_get_feature(*name,SENSORS_SMSC47M1_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - for (i = 0; i < (is_m2 ? 3 : 2); i++) { /* 2 or 3 fans */ - if (!sensors_get_label_and_valid(*name, SENSORS_SMSC47M1_FAN1+i, &label, &valid) - && !sensors_get_feature(*name, SENSORS_SMSC47M1_FAN1+i, &cur) - && !sensors_get_feature(*name, SENSORS_SMSC47M1_FAN1_DIV+i, &fdiv) - && !sensors_get_feature(*name, SENSORS_SMSC47M1_FAN1_MIN+i, &min)) { - if (valid) { - print_label(label, 10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur, min, fdiv, alarms&(SMSC47M1_ALARM_FAN1< 0.5) - printf("ALARM"); - printf("\n"); - } - } else - if (i!=4) /* Chip may have +12V input used for VID instead */ - printf("ERROR: Can't get IN%d data!\n", i); - free(label); - } - for (i=1; i<=3; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_SMSC47M192_TEMP(i), - &label, &valid) && - !sensors_get_feature(*name, SENSORS_SMSC47M192_TEMP(i), &cur) && - !sensors_get_feature(*name, SENSORS_SMSC47M192_TEMP_MIN(i), &min) && - !sensors_get_feature(*name, SENSORS_SMSC47M192_TEMP_MAX(i), &max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, MINMAX, 1, 0); - if (i > 1 && !sensors_get_feature(*name, - SENSORS_SMSC47M192_TEMP_FAULT(i), &cur)) { - if (cur > 0.5) - printf("FAULT"); - } else - if (!sensors_get_feature(*name, SENSORS_SMSC47M192_TEMP_ALARM(i), &cur)) - if (cur > 0.5) - printf("ALARM"); - printf("\n"); - } - } else - printf("ERROR: Can't get TEMP%d data!\n", i); - free(label); - } - print_vid_info(name, SENSORS_SMSC47M192_VID, SENSORS_SMSC47M192_VRM); -} - -void print_pc87360(const sensors_chip_name *name) -{ - char *label; - double cur, min, fdiv, tmp; - int status, valid; - - if (!sensors_get_label_and_valid(*name, SENSORS_PC87360_FAN1, &label, &valid) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN1, &cur) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN1_DIV, &fdiv) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN1_MIN, &min) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN1_STATUS, &tmp)) { - if (valid) { - print_label(label, 10); - status = tmp + 0.5; - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur, min, fdiv, - status&PC87360_STATUS_FAN_OVERFLOW?"OVERFLOW": - status&PC87360_STATUS_FAN_LOW?"ALARM":""); - } - } - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_PC87360_FAN2, &label, &valid) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN2, &cur) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN2_DIV, &fdiv) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN2_MIN, &min) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN2_STATUS, &tmp)) { - if (valid) { - print_label(label, 10); - status = tmp + 0.5; - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur, min, fdiv, - status&PC87360_STATUS_FAN_OVERFLOW?"OVERFLOW": - status&PC87360_STATUS_FAN_LOW?"ALARM":""); - } - } - free(label); -} - -void print_pc87364(const sensors_chip_name *name) -{ - char *label; - double cur, min, fdiv, tmp; - int status, valid; - - print_pc87360(name); - - if (!sensors_get_label_and_valid(*name, SENSORS_PC87360_FAN3, &label, &valid) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN3, &cur) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN3_DIV, &fdiv) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN3_MIN, &min) - && !sensors_get_feature(*name, SENSORS_PC87360_FAN3_STATUS, &tmp)) { - if (valid) { - print_label(label, 10); - status = tmp + 0.5; - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur, min, fdiv, - status&PC87360_STATUS_FAN_OVERFLOW?"OVERFLOW": - status&PC87360_STATUS_FAN_LOW?"ALARM":""); - } - } - free(label); -} - -void print_pc87366(const sensors_chip_name *name) -{ - char *label; - double cur, min, max; - int status, valid, i, tempnr = 2; - - for (i = 0; i < 11; i++) { - if (!sensors_get_feature(*name, SENSORS_PC87360_IN0_STATUS + i, &cur)) - status = cur + 0.5; - else { - printf("ERROR: Can't get IN%d status data!\n", i); - status = 0; - } - - if (!sensors_get_label_and_valid(*name, SENSORS_PC87360_IN0 + i, &label, &valid) - && !sensors_get_feature(*name, SENSORS_PC87360_IN0 + i, &cur) - && !sensors_get_feature(*name, SENSORS_PC87360_IN0_MIN + i, &min) - && !sensors_get_feature(*name, SENSORS_PC87360_IN0_MAX + i, &max)) { - if (valid) { - print_label(label, 10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur, min, max, - status&(PC87365_STATUS_IN_MIN - |PC87365_STATUS_IN_MAX)?"ALARM":""); - } - } else - printf("ERROR: Can't get IN%d data!\n", i); - free(label); - } - - print_pc87364(name); - - if (!strcmp(name->prefix, "pc87366")) - tempnr = 6; - - for (i = 0; i < tempnr; i++) { - if (!sensors_get_feature(*name, SENSORS_PC87360_TEMP1_STATUS + i, &cur)) - status = cur + 0.5; - else { - printf("ERROR: Can't get TEMP%d status data!\n", i + 1); - status = 0; - } - - if (!sensors_get_label_and_valid(*name, SENSORS_PC87360_TEMP1 + i, &label, &valid) - && !sensors_get_feature(*name, SENSORS_PC87360_TEMP1 + i, &cur) - && !sensors_get_feature(*name, SENSORS_PC87360_TEMP1_MIN + i, &min) - && !sensors_get_feature(*name, SENSORS_PC87360_TEMP1_MAX + i, &max)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, max, min, MINMAX, 0, 0); - if (i<3 && status&PC87365_STATUS_TEMP_OPEN) - printf(" OPEN"); - else if (status&(PC87365_STATUS_TEMP_MIN|PC87365_STATUS_TEMP_MAX)) - printf(" ALARM"); - printf("\n"); - } - } else - printf("ERROR: Can't get TEMP%d data!\n", i + 1); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_PC87360_TEMP1_CRIT + i, &label, &valid) - && !sensors_get_feature(*name, SENSORS_PC87360_TEMP1_CRIT + i, &cur)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, 0, 0, SINGLE, 0, 0); - if (status&PC87365_STATUS_TEMP_CRIT) - printf(" ALARM"); - printf("\n"); - } - } else - printf("ERROR: Can't get TEMP%d overtemperature data!\n", i + 1); - free(label); - } - - print_vid_info(name, SENSORS_PC87360_VID, SENSORS_PC87360_VRM); -} - -void print_pc87427(const sensors_chip_name *name) -{ - char *label; - double cur, min, alarm, fault; - int valid, i; - - for (i = 1; i <= 8; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_PC87427_FAN(i), - &label, &valid) && - !sensors_get_feature(*name, SENSORS_PC87427_FAN(i), &cur) && - !sensors_get_feature(*name, SENSORS_PC87427_FAN_MIN(i), &min) && - !sensors_get_feature(*name, SENSORS_PC87427_FAN_ALARM(i), &alarm) && - !sensors_get_feature(*name, SENSORS_PC87427_FAN_FAULT(i), &fault)) { - if (valid) { - print_label(label, 10); - printf("%4.0f RPM (min = %4.0f RPM) %s\n", - cur, min, - fault ? "FAULT" : alarm ? "ALARM" : ""); - } - } - } - free(label); -} - -static void lm92_print_temp (float n_cur,float n_high,float n_low,float n_crit,float n_hyst) -{ - if (fahrenheit) { - n_cur = deg_ctof (n_cur); - n_high = deg_ctof (n_high); - n_low = deg_ctof (n_low); - n_crit = deg_ctof (n_crit); - n_hyst = deg_ctof (n_hyst); - } - - printf ("%+6.4f%s (high = %+6.4f%s, low = %+6.4f%s, crit = %+6.4f%s, hyst = %+6.4f%s)", - n_cur, degstr, - n_high, degstr, - n_low, degstr, - n_crit, degstr, - n_hyst, degstr); -} - -void print_lm92 (const sensors_chip_name *name) -{ - char *label; - double temp[5]; - int valid,alarms; - - if (!sensors_get_feature (*name,SENSORS_LM92_ALARMS,temp)) { - alarms = *temp + 0.5; - } else { - printf ("ERROR: Can't get alarm data!\n"); - return; - } - - if (!sensors_get_label_and_valid (*name,SENSORS_LM92_TEMP,&label,&valid) && - !sensors_get_feature (*name,SENSORS_LM92_TEMP,temp) && - !sensors_get_feature (*name,SENSORS_LM92_TEMP_HIGH,temp + 1) && - !sensors_get_feature (*name,SENSORS_LM92_TEMP_LOW,temp + 2) && - !sensors_get_feature (*name,SENSORS_LM92_TEMP_CRIT,temp + 3) && - !sensors_get_feature (*name,SENSORS_LM92_TEMP_HYST,temp + 4)) { - if (valid) { - print_label (label,10); - lm92_print_temp (temp[0],temp[1],temp[2],temp[3],temp[4]); - if (alarms) { - printf (" ALARMS ("); - - if ((alarms & LM92_ALARM_TEMP_HIGH)) - printf ("HIGH"); - - if (alarms & LM92_ALARM_TEMP_LOW) - printf ("%sLOW",(alarms & LM92_ALARM_TEMP_HIGH) ? "," : ""); - - if (alarms & LM92_ALARM_TEMP_CRIT) - printf ("%sCRIT",(alarms & (LM92_ALARM_TEMP_HIGH | LM92_ALARM_TEMP_LOW)) ? "," : ""); - - printf (")"); - } - printf ("\n"); - } - } else printf ("ERROR: Can't get temperature data!\n"); - - free(label); -} - -void print_vt8231(const sensors_chip_name *name) -{ - char *label; - double cur,min,max,fdiv; - int alarms,valid; - - if (!sensors_get_feature(*name,SENSORS_VT8231_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN0,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_IN0,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_IN0_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_IN0_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT8231_ALARM_IN0?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_IN1,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_IN1_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_IN1_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT8231_ALARM_IN1?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_IN2,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_IN2_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_IN2_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT8231_ALARM_IN2?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_IN3,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_IN3_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_IN3_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT8231_ALARM_IN3?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_IN4,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_IN4_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_IN4_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT8231_ALARM_IN4?"ALARM":""); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_IN5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_IN5,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_IN5_MIN,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_IN5_MAX,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&VT8231_ALARM_IN5?"ALARM":""); - } - } else - printf("ERROR: Can't get IN5 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_FAN1,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_FAN1,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_FAN1_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_VT8231_FAN1_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&VT8231_ALARM_FAN1?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_FAN2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_FAN2,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_FAN2_DIV,&fdiv) && - !sensors_get_feature(*name,SENSORS_VT8231_FAN2_MIN,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,fdiv, alarms&VT8231_ALARM_FAN2?"ALARM":""); - } - } else - printf("ERROR: Can't get FAN2 data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_VT8231_TEMP, - &label, &valid) && - !sensors_get_feature(*name, SENSORS_VT8231_TEMP, &cur) && - !sensors_get_feature(*name, SENSORS_VT8231_TEMP_HYST, &min) && - !sensors_get_feature(*name, SENSORS_VT8231_TEMP_OVER, &max)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT8231_ALARM_TEMP ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get TEMP1 data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_TEMP2,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP2,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP2_HYST,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP2_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT8231_ALARM_TEMP2 ? "ALARM" : "" ); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_TEMP3,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP3,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP3_HYST,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP3_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT8231_ALARM_TEMP3 ? "ALARM" : "" ); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_TEMP4,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP4,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP4_HYST,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP4_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT8231_ALARM_TEMP4 ? "ALARM" : "" ); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_TEMP5,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP5,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP5_HYST,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP5_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT8231_ALARM_TEMP5 ? "ALARM" : "" ); - } - } - free(label); - if (!sensors_get_label_and_valid(*name,SENSORS_VT8231_TEMP6,&label,&valid) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP6,&cur) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP6_HYST,&min) && - !sensors_get_feature(*name,SENSORS_VT8231_TEMP6_OVER,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & VT8231_ALARM_TEMP6 ? "ALARM" : "" ); - } - } - free(label); - - print_vid_info(name, SENSORS_VT8231_VID, SENSORS_VT8231_VRM); -} - -#define BMC_MAX_INS 10 -#define BMC_MAX_FANS 10 -#define BMC_MAX_TEMPS 10 - -void print_bmc(const sensors_chip_name *name) -{ - char *label; - double cur,min,max; - int alarms, valid, i; - -/* - if (!sensors_get_feature(*name,SENSORS_VT8231_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } -*/ -#define BMC_ALARM_IN1 0 -#define BMC_ALARM_FAN1 0 -#define BMC_ALARM_TEMP1 0 - - alarms = 0; - for(i = 0; i < BMC_MAX_INS; i++) { - if (!sensors_get_label_and_valid(*name,SENSORS_BMC_IN1+i,&label,&valid) && - !sensors_get_feature(*name,SENSORS_BMC_IN1+i,&cur) && - !sensors_get_feature(*name,SENSORS_BMC_IN1_MIN+i,&min) && - !sensors_get_feature(*name,SENSORS_BMC_IN1_MAX+i,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,alarms&BMC_ALARM_IN1?"ALARM":""); - } - } - free(label); - } - - for(i = 0; i < BMC_MAX_FANS; i++) { - if (!sensors_get_label_and_valid(*name,SENSORS_BMC_FAN1+i,&label,&valid) && - !sensors_get_feature(*name,SENSORS_BMC_FAN1+i,&cur) && - !sensors_get_feature(*name,SENSORS_BMC_FAN1_MIN+i,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM) %s\n", - cur,min,alarms&BMC_ALARM_FAN1?"ALARM":""); - } - } - free(label); - } - - for(i = 0; i < BMC_MAX_TEMPS; i++) { - if (!sensors_get_label_and_valid(*name,SENSORS_BMC_TEMP1+i,&label,&valid) && - !sensors_get_feature(*name,SENSORS_BMC_TEMP1+i,&cur) && - !sensors_get_feature(*name,SENSORS_BMC_TEMP1_MIN+i,&min) && - !sensors_get_feature(*name,SENSORS_BMC_TEMP1_MAX+i,&max)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, max, min, HYST, 1, 0); - printf(" %s\n", alarms & BMC_ALARM_TEMP1 ? "ALARM" : "" ); - } - } - free(label); - } -} - -static long adm1026_alarms_in[] = { - ADM1026_ALARM_IN0, ADM1026_ALARM_IN1, ADM1026_ALARM_IN2, - ADM1026_ALARM_IN3, ADM1026_ALARM_IN4, ADM1026_ALARM_IN5, - ADM1026_ALARM_IN6, ADM1026_ALARM_IN7, ADM1026_ALARM_IN8, - ADM1026_ALARM_IN9, ADM1026_ALARM_IN10, ADM1026_ALARM_IN11, - ADM1026_ALARM_IN12, ADM1026_ALARM_IN13, ADM1026_ALARM_IN14, - ADM1026_ALARM_IN15, ADM1026_ALARM_IN16 -}; -static long adm1026_alarms_temp[] = { - ADM1026_ALARM_TEMP1, ADM1026_ALARM_TEMP2, ADM1026_ALARM_TEMP3 -}; - -void print_adm1026(const sensors_chip_name *name) -{ - char *label; - double cur,min,max; - long alarms; - int valid, i; - - if (!sensors_get_feature(*name,SENSORS_ADM1026_ALARMS,&cur)) { - alarms = cur + 0.5; - } else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - /* Seventeen voltage sensors */ - for (i = 0; i <= 16 ; ++i) { - int feat_base = SENSORS_ADM1026_IN0 + (3 * i); - int feat_max = feat_base +1, feat_min = feat_base +2; - if (!sensors_get_label_and_valid(*name,feat_base,&label,&valid) && - !sensors_get_feature(*name,feat_base,&cur) && - !sensors_get_feature(*name,feat_min,&min) && - !sensors_get_feature(*name,feat_max,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur,min,max,(alarms&adm1026_alarms_in[i])?"ALARM":""); - } - } else { - printf("ERROR: Can't get IN%d data!\n",i); - } - free(label); - }; - - /* Eight fan sensors */ - for (i = 0; i <= 7 ; ++i) { - int feat_base = SENSORS_ADM1026_FAN0 + (3 * i); - int feat_div = feat_base +1, feat_min = feat_base +2; - if (!sensors_get_label_and_valid(*name,feat_base,&label,&valid) && - !sensors_get_feature(*name,feat_base,&cur) && - !sensors_get_feature(*name,feat_min,&min) && - !sensors_get_feature(*name,feat_div,&max)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur,min,max,(alarms&(ADM1026_ALARM_FAN0<prefix, 7); - - if (!sensors_get_feature(*name, SENSORS_ADM1031_ALARMS, &cur)) - alarms = cur; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - for(i=0; i<(is_1031?2:1);i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_ADM1031_FAN1+i*10, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_ADM1031_FAN1+i*10, &cur) - && !sensors_get_feature(*name, SENSORS_ADM1031_FAN1_MIN+i*10, &low) - && !sensors_get_feature(*name, SENSORS_ADM1031_FAN1_DIV+i*10, &fdiv)) { - if (valid) { - print_label(label, 10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f)", cur, low, fdiv); - printf(" %s\n", - alarms&(ADM1031_ALARM_FAN1_FLT<<(i*8))?"FAULT": - alarms&(ADM1031_ALARM_FAN1_MIN<<(i*8))?"ALARM":""); - } - } else - printf("ERROR: Can't get fan%d data!\n", i+1); - free(label); - } - - if (!sensors_get_label_and_valid(*name, SENSORS_ADM1031_TEMP1, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_ADM1031_TEMP1, &cur) - && !sensors_get_feature(*name, SENSORS_ADM1031_TEMP1_MIN, &low) - && !sensors_get_feature(*name, SENSORS_ADM1031_TEMP1_MAX, &high) - && !sensors_get_feature(*name, SENSORS_ADM1031_TEMP1_CRIT, &crit)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, high, low, MINMAX, 1, 0); - printf(" %s\n", - alarms&(ADM1031_ALARM_TEMP1_HIGH|ADM1031_ALARM_TEMP1_LOW)?"ALARM":""); - } - } else - printf("ERROR: Can't get temp1 temperature data!\n"); - free(label); - if (!sensors_get_label_and_valid(*name, SENSORS_ADM1031_TEMP1_CRIT, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_ADM1031_TEMP1_CRIT, &cur)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, 0, 0, SINGLE, 0, 0); - printf(" %s\n", - alarms&ADM1031_ALARM_TEMP1_CRIT?"CRITICAL":""); - } - } else - printf("ERROR: Can't get temp1 temperature data!\n"); - free(label); - - for (i=0; i < (is_1031 ? 2 : 1); i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_ADM1031_TEMP2+i*10, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_ADM1031_TEMP2+i*10, &cur) - && !sensors_get_feature(*name, SENSORS_ADM1031_TEMP2_MIN+i*10, &low) - && !sensors_get_feature(*name, SENSORS_ADM1031_TEMP2_MAX+i*10, &high)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, high, low, MINMAX, 1, 0); - printf(" %s\n", - alarms&((ADM1031_ALARM_TEMP2_DIODE<<(i*8)))?"DISCONNECT": - alarms&((ADM1031_ALARM_TEMP2_HIGH<<(i*8))| - (ADM1031_ALARM_TEMP2_LOW<<(i*8)))?"ALARM":""); - } - } else - printf("ERROR: Can't get temp%d temperature data!\n", i+2); - free(label); - if (!sensors_get_label_and_valid(*name, SENSORS_ADM1031_TEMP2_CRIT+i*10, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_ADM1031_TEMP2_CRIT+i*10, &cur)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, 0, 0, SINGLE, 0, 0); - printf(" %s\n", - alarms&((ADM1031_ALARM_TEMP2_CRIT<<(i*8)))?"CRITICAL":""); - } - } else - printf("ERROR: Can't get temp%d crit temperature data!\n", i+2); - free(label); - } -} - -void print_xeontemp(const sensors_chip_name *name) -{ - char *label; - double cur,hyst,over; - int alarms,i,valid; - - if (!sensors_get_feature(*name,SENSORS_XEONTEMP_ALARMS,&cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name,SENSORS_XEONTEMP_REMOTE_TEMP, - &label,&valid) && - !sensors_get_feature(*name,SENSORS_XEONTEMP_REMOTE_TEMP,&cur) && - !sensors_get_feature(*name,SENSORS_XEONTEMP_REMOTE_TEMP_HYST,&hyst) && - !sensors_get_feature(*name,SENSORS_XEONTEMP_REMOTE_TEMP_OVER,&over)) { - if (valid) { - print_label(label,10); - print_temp_info( cur, over, hyst, MINMAX, 0, 0); - if (alarms & (XEONTEMP_ALARM_RTEMP_HIGH | XEONTEMP_ALARM_RTEMP_LOW | - XEONTEMP_ALARM_RTEMP_NA)) { - printf("ALARM ("); - i = 0; - if (alarms & XEONTEMP_ALARM_RTEMP_NA) { - printf("N/A"); - i++; - } - if (alarms & XEONTEMP_ALARM_RTEMP_LOW) { - printf("%sLOW",i?",":""); - i++; - } - if (alarms & XEONTEMP_ALARM_RTEMP_HIGH) - printf("%sHIGH",i?",":""); - printf(")"); - } - printf("\n"); - } - } else - printf("ERROR: Can't get temperature data!\n"); - free(label); -} - - -void print_max1619(const sensors_chip_name *name) -{ - char *label; - double cur, high, low; - int valid, alarms; - - if (!sensors_get_feature(*name, SENSORS_MAX1619_ALARMS, &cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarm data!\n"); - alarms = 0; - } - - if (!sensors_get_label_and_valid(*name, SENSORS_MAX1619_LOCAL_TEMP, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_MAX1619_LOCAL_TEMP, &cur)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur,0 ,0 ,SINGLE , 0, 0); - printf("\n"); - } - } else - printf("ERROR: Can't get local temperature data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAX1619_REMOTE_TEMP, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_MAX1619_REMOTE_TEMP, &cur) - && !sensors_get_feature(*name, SENSORS_MAX1619_REMOTE_LOW, &low) - && !sensors_get_feature(*name, SENSORS_MAX1619_REMOTE_HIGH, &high)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, low, high, MINMAX, 0, 0); - printf(" %s\n", - alarms&MAX1619_ALARM_REMOTE_OPEN?"DISCONNECT": - alarms&(MAX1619_ALARM_REMOTE_THIGH|MAX1619_ALARM_REMOTE_TLOW)?"ALARM":""); - } - } else - printf("ERROR: Can't get remote temperature data!\n"); - free(label); - - if (!sensors_get_label_and_valid(*name, SENSORS_MAX1619_REMOTE_MAX, - &label, &valid) - && !sensors_get_feature(*name, SENSORS_MAX1619_REMOTE_MAX, &high) - && !sensors_get_feature(*name, SENSORS_MAX1619_REMOTE_HYST, &low)) { - if (valid) { - print_label(label, 10); - print_temp_info(high, low, 0, HYSTONLY, 0, 0); - printf("\n"); - } - } else - printf("ERROR: Can't get remote temperature max data!\n"); - free(label); -} - -void print_max6650(const sensors_chip_name *name) -{ - char *label; - double tach, speed; - int valid, i; - - static const struct - { - int tag; - const char *name; - } - tach_list[] = - { - { SENSORS_MAX6650_FAN1_TACH, "FAN1" }, - { SENSORS_MAX6650_FAN2_TACH, "FAN2" }, - { SENSORS_MAX6650_FAN3_TACH, "FAN3" }, - { SENSORS_MAX6650_FAN4_TACH, "FAN4" } - }; - - /* Display full config for fan1, which is controlled */ - - if (!sensors_get_label_and_valid(*name,tach_list[0].tag,&label,&valid) && - !sensors_get_feature(*name,tach_list[0].tag,&tach) && - !sensors_get_feature(*name,SENSORS_MAX6650_SPEED,&speed)) { - if (valid) { - print_label(label,10); - printf("configured %4.0f RPM, actual %4.0f RPM.\n", speed, tach); - } - } else - printf("ERROR: Can't get %s data!\n", tach_list[0].name); - free(label); - - /* Just display the measured speed for the other three, uncontrolled fans */ - - for (i = 1; i < 4; i++) - { - if (!sensors_get_label_and_valid(*name,tach_list[i].tag,&label,&valid) && - !sensors_get_feature(*name,tach_list[i].tag,&tach)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM\n", tach); - } - } else - printf("ERROR: Can't get %s data!\n", tach_list[i].name); - - free(label); - } -} - -/* print_asb100_in() - * where in, in_min, and in_max are sensors feature IDs - */ -static void print_asb100_in(const sensors_chip_name *name, int alarm, - int in, int in_min, int in_max) -{ - char *label; - double cur, min, max; - int valid; - - if (!sensors_get_label_and_valid(*name,in,&label,&valid) && - !sensors_get_feature(*name,in,&cur) && - !sensors_get_feature(*name,in_min,&min) && - !sensors_get_feature(*name,in_max,&max)) { - if (valid) { - print_label(label,10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur, min, max, alarm ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get IN data! (0x%04x)\n", in); - free(label); -} - -#define PRINT_ASB100_IN(num, name, alarms) \ - print_asb100_in((name), ((alarms) & ASB100_ALARM_IN##num), \ - (SENSORS_ASB100_IN##num), \ - (SENSORS_ASB100_IN##num##_MIN), \ - (SENSORS_ASB100_IN##num##_MAX)) - -/* print_asb100_fan() - * where fan, fan_div, and fan_min are sensors feature IDs - */ -static void print_asb100_fan(const sensors_chip_name *name, int alarm, - int fan, int fan_div, int fan_min) -{ - char *label; - double cur, fdiv, min; - int valid; - - if (!sensors_get_label_and_valid(*name,fan,&label,&valid) && - !sensors_get_feature(*name,fan,&cur) && - !sensors_get_feature(*name,fan_div, &fdiv) && - !sensors_get_feature(*name,fan_min,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", - cur, min, fdiv, alarm ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get FAN data! (0x%04x)\n", fan); - free(label); -} - -#define PRINT_ASB100_FAN(num, name, alarms) \ - print_asb100_fan((name), ((alarms) & ASB100_ALARM_FAN##num), \ - (SENSORS_ASB100_FAN##num), \ - (SENSORS_ASB100_FAN##num##_DIV), \ - (SENSORS_ASB100_FAN##num##_MIN)) - -/* print_asb100_temp() - * where temp, temp_max, and temp_hyst are sensors feature IDs - */ -static void print_asb100_temp(const sensors_chip_name *name, int alarm, - int temp, int temp_max, int temp_hyst) -{ - char *label; - double cur, max, hyst; - int valid; - - if (!sensors_get_label_and_valid(*name,temp,&label,&valid) && - !sensors_get_feature(*name,temp,&cur) && - !sensors_get_feature(*name,temp_max,&max) && - !sensors_get_feature(*name,temp_hyst,&hyst)) { - if (valid) { - print_label(label,10); - if (hyst == 127) - print_temp_info(cur, max, 0, MAXONLY, 0, 0); - else - print_temp_info(cur, max, hyst, HYST, 0, 0); - - printf(" %s\n", alarm ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get TEMP data! (0x%04x)\n", temp); - - free(label); -} - -#ifndef ASB100_ALARM_TEMP4 -#define ASB100_ALARM_TEMP4 0 -#endif - -#define PRINT_ASB100_TEMP(num, name, alarms) \ - print_asb100_temp((name), ((alarms) & ASB100_ALARM_TEMP##num), \ - (SENSORS_ASB100_TEMP##num), \ - (SENSORS_ASB100_TEMP##num##_OVER), \ - (SENSORS_ASB100_TEMP##num##_HYST)) - - -void print_asb100(const sensors_chip_name *name) -{ - char *label; - double cur; - int valid, alarms = 0; - - if (!sensors_get_feature(*name,SENSORS_ASB100_ALARMS,&cur)) - alarms = cur + 0.5; - else - printf("ERROR: Can't get alarm data!\n"); - - PRINT_ASB100_IN(0, name, alarms); - PRINT_ASB100_IN(1, name, alarms); - PRINT_ASB100_IN(2, name, alarms); - PRINT_ASB100_IN(3, name, alarms); - PRINT_ASB100_IN(4, name, alarms); - PRINT_ASB100_IN(5, name, alarms); - PRINT_ASB100_IN(6, name, alarms); - - PRINT_ASB100_FAN(1, name, alarms); - PRINT_ASB100_FAN(2, name, alarms); - PRINT_ASB100_FAN(3, name, alarms); - - PRINT_ASB100_TEMP(1, name, alarms); - PRINT_ASB100_TEMP(2, name, alarms); - PRINT_ASB100_TEMP(3, name, alarms); - PRINT_ASB100_TEMP(4, name, alarms); - - print_vid_info(name, SENSORS_ASB100_VID, SENSORS_ASB100_VRM); - - if (!sensors_get_label_and_valid(*name,SENSORS_ASB100_ALARMS,&label,&valid)) { - print_label(label,10); - if (alarms & ASB100_ALARM_CHAS) - printf("Chassis intrusion detection ALARM\n"); - else - printf("\n"); - } - free(label); - -} - -/* happens to be similar to asb100*/ -#define PRINT_LM93_IN(num, name, alarms) \ - print_asb100_in((name), ((alarms) & LM93_ALARM_IN##num), \ - (SENSORS_LM93_IN##num), \ - (SENSORS_LM93_IN##num##_MIN), \ - (SENSORS_LM93_IN##num##_MAX)) - -/* print_lm93_fan() - * where fan and fan_min are sensors feature IDs - */ -static void print_lm93_fan(const sensors_chip_name *name, int alarm, - int fan, int fan_min) -{ - char *label; - double cur, min; - int valid; - - if (!sensors_get_label_and_valid(*name,fan,&label,&valid) && - !sensors_get_feature(*name,fan,&cur) && - !sensors_get_feature(*name,fan_min,&min)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM (min = %4.0f RPM) %s\n", - cur, min, alarm ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get FAN data! (0x%04x)\n", fan); - free(label); -} - -#define PRINT_LM93_FAN(num, name, alarms) \ - print_lm93_fan((name), ((alarms) & LM93_ALARM_FAN##num), \ - (SENSORS_LM93_FAN##num), \ - (SENSORS_LM93_FAN##num##_MIN)) - -/* print_lm93_temp() - * where temp, temp_min, and temp_max are sensors feature IDs - */ -static void print_lm93_temp(const sensors_chip_name *name, int alarm, - int temp, int temp_min, int temp_max) -{ - char *label; - double cur, min, max; - int valid; - - if (!sensors_get_label_and_valid(*name,temp,&label,&valid) && - !sensors_get_feature(*name,temp,&cur) && - !sensors_get_feature(*name,temp_min,&min) && - !sensors_get_feature(*name,temp_max,&max)) { - if (valid) { - print_label(label,10); - print_temp_info(cur, max, min, MINMAX, 0, 0); - printf(" %s\n", alarm ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get TEMP data! (0x%04x)\n", temp); - - free(label); -} - -#define PRINT_LM93_TEMP(num, name, alarms) \ - print_lm93_temp((name), ((alarms) & LM93_ALARM_TEMP##num), \ - (SENSORS_LM93_TEMP##num), \ - (SENSORS_LM93_TEMP##num##_MIN), \ - (SENSORS_LM93_TEMP##num##_MAX)) - -/* print_lm93_vid() - * where vid is a sensors feature ID - */ -static void print_lm93_vid(const sensors_chip_name *name, int vid) -{ - char *label; - double cur; - int valid; - - if (!sensors_get_label_and_valid(*name,vid,&label,&valid) && - !sensors_get_feature(*name,vid,&cur)) { - if (valid) { - print_label(label,10); - printf("%+5.3f V\n",cur); - } - } else { - printf("ERROR: Can't get VID data! (0x%04x)\n", vid); - } - free(label); -} - -void print_lm93(const sensors_chip_name *name) -{ - double cur; - int alarms = 0; - - if (!sensors_get_feature(*name,SENSORS_LM93_ALARMS,&cur)) - alarms = cur + 0.5; - else - printf("ERROR: Can't get alarm data!\n"); - - PRINT_LM93_IN(1, name, alarms); - PRINT_LM93_IN(2, name, alarms); - PRINT_LM93_IN(3, name, alarms); - PRINT_LM93_IN(4, name, alarms); - PRINT_LM93_IN(5, name, alarms); - PRINT_LM93_IN(6, name, alarms); - PRINT_LM93_IN(7, name, alarms); - PRINT_LM93_IN(8, name, alarms); - PRINT_LM93_IN(9, name, alarms); - PRINT_LM93_IN(10, name, alarms); - PRINT_LM93_IN(11, name, alarms); - PRINT_LM93_IN(12, name, alarms); - PRINT_LM93_IN(13, name, alarms); - PRINT_LM93_IN(14, name, alarms); - PRINT_LM93_IN(15, name, alarms); - PRINT_LM93_IN(16, name, alarms); - - PRINT_LM93_FAN(1, name, alarms); - PRINT_LM93_FAN(2, name, alarms); - PRINT_LM93_FAN(3, name, alarms); - PRINT_LM93_FAN(4, name, alarms); - - PRINT_LM93_TEMP(1, name, alarms); - PRINT_LM93_TEMP(2, name, alarms); - PRINT_LM93_TEMP(3, name, alarms); - - print_lm93_vid(name, SENSORS_LM93_VID1); - print_lm93_vid(name, SENSORS_LM93_VID2); -} - -/* print_smsc47b397_temp() - * where temp is a sensors feature ID - */ -static void print_smsc47b397_temp(const sensors_chip_name *name, int temp) -{ - char *label; - double cur; - int valid; - - if (!sensors_get_label_and_valid(*name,temp,&label,&valid) && - !sensors_get_feature(*name,temp,&cur)) { - if (valid) { - print_label(label,10); - print_temp_info(cur, 0, 0, SINGLE, 0, 0); - printf("\n"); - } - } else - printf("ERROR: Can't get TEMP data! (0x%04x)\n", temp); - - free(label); -} - -#define PRINT_SMSC47B397_TEMP(num, name) \ - print_smsc47b397_temp((name), (SENSORS_SMSC47B397_TEMP1 + (num))) - -/* print_smsc47b397_fan() - * where fan is a sensors feature ID - */ -static void print_smsc47b397_fan(const sensors_chip_name *name, int fan) -{ - char *label; - double cur; - int valid; - - if (!sensors_get_label_and_valid(*name,fan,&label,&valid) && - !sensors_get_feature(*name,fan,&cur)) { - if (valid) { - print_label(label,10); - printf("%4.0f RPM\n", cur); - } - } else - printf("ERROR: Can't get FAN data! (0x%04x)\n", fan); - free(label); -} - -#define PRINT_SMSC47B397_FAN(num, name) \ - print_smsc47b397_fan((name), (SENSORS_SMSC47B397_FAN1 + (num))) - -void print_smsc47b397(const sensors_chip_name *name) -{ - int ii; - - for (ii=0;ii<4;ii++) - PRINT_SMSC47B397_TEMP(ii, name); - - for (ii=0;ii<4;ii++) - PRINT_SMSC47B397_FAN(ii, name); -} - -void print_f71805f(const sensors_chip_name *name) -{ - char *label; - double cur, min, max; - int alarms, valid, i; - const int is_f71872f = !strcmp(name->prefix, "f71872f"); - - if (!sensors_get_feature(*name, SENSORS_F71805F_ALARMS_IN, &cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarms_in data!\n"); - alarms = 0; - } - - for (i = 0; i < (is_f71872f ? 11 : 9); i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_F71805F_IN(i), - &label, &valid) - && !sensors_get_feature(*name, SENSORS_F71805F_IN(i), &cur) - && !sensors_get_feature(*name, SENSORS_F71805F_IN_MIN(i), &min) - && !sensors_get_feature(*name, SENSORS_F71805F_IN_MAX(i), &max)) { - if (valid) { - print_label(label, 10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur, min, max, (alarms & (1 << i)) ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get in%d data!\n", i); - free(label); - } - - if (!sensors_get_feature(*name, SENSORS_F71805F_ALARMS_FAN, &cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarms_fan data!\n"); - alarms = 0; - } - - for (i = 1; i <= 3; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_F71805F_FAN(i), - &label, &valid) - && !sensors_get_feature(*name, SENSORS_F71805F_FAN(i), &cur) - && !sensors_get_feature(*name, SENSORS_F71805F_FAN_MIN(i), &min)) { - if (valid) { - print_label(label, 10); - printf("%4.0f RPM (min = %4.0f RPM) %s\n", - cur, min, (alarms & (1 << (i - 1))) ? "ALARM" : ""); - } - } - free(label); - } - - if (!sensors_get_feature(*name, SENSORS_F71805F_ALARMS_TEMP, &cur)) - alarms = cur + 0.5; - else { - printf("ERROR: Can't get alarms_temp data!\n"); - alarms = 0; - } - - for (i = 1; i <= 3; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_F71805F_TEMP(i), - &label, &valid) - && !sensors_get_feature(*name, SENSORS_F71805F_TEMP(i), &cur) - && !sensors_get_feature(*name, SENSORS_F71805F_TEMP_MAX(i), &max) - && !sensors_get_feature(*name, SENSORS_F71805F_TEMP_HYST(i), &min)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, max, min, HYST, 0, 0); - printf("%5s", (alarms & (1 << (i - 1))) ? "ALARM" : ""); - if (!sensors_get_feature(*name, SENSORS_F71805F_TEMP_TYPE(i), &cur)) { - int sensor = cur + 0.5; - printf(" [%s]", sensor == 3 ? "diode" : "thermistor"); - } - printf("\n"); - } - } else - printf("ERROR: Can't get temp%d data!\n", i); - free(label); - } -} - -/* print_abituguru_in() - * where in, in_min, in_min_alarm, in_max and in_max_alarm are sensors - * feature IDs - */ -static void print_abituguru_in(const sensors_chip_name *name, int in, - int in_min, int in_min_alarm, int in_max, int in_max_alarm) -{ - char *label; - double cur, min, max, alarm_low, alarm_high; - int valid; - - if (!sensors_get_label_and_valid(*name, in, &label, &valid)) { - if (valid) { - if (!sensors_get_feature(*name, in, &cur) && - !sensors_get_feature(*name, in_min, &min) && - !sensors_get_feature(*name, in_max, &max) && - !sensors_get_feature(*name, in_min_alarm, &alarm_low) && - !sensors_get_feature(*name, in_max_alarm, &alarm_high)) { - print_label(label, 23); - printf("%+6.2f V (min %+6.2f V, max %+6.2f V)", - cur, min, max); - if (alarm_low || alarm_high) { - printf(" ALARM ("); - if (alarm_low) - printf("LOW"); - if (alarm_high) - printf("%sHIGH", (alarm_low) ? "," : ""); - printf(")"); - } - printf("\n"); - } else - printf("ERROR: Can't get IN data! (0x%04x)\n", in); - } - free(label); - } -} - -/* print_abituguru_temp() - * where temp, temp_alarm, temp_max, and temp_crit are sensors feature IDs - */ -static void print_abituguru_temp(const sensors_chip_name *name, int temp, - int temp_alarm, int temp_max, int temp_crit) -{ - char *label; - double cur, alarm, max, crit; - int valid; - - if (!sensors_get_label_and_valid(*name, temp, &label, &valid)) { - if (valid) { - if (!sensors_get_feature(*name, temp, &cur) && - !sensors_get_feature(*name, temp_alarm, &alarm) && - !sensors_get_feature(*name, temp_max, &max) && - !sensors_get_feature(*name, temp_crit, &crit)) { - print_label(label, 23); - print_temp_info(cur, max, crit, CRIT, 0, 0); - if (alarm) - printf(" ALARM\n"); - else - printf("\n"); - } else - printf("ERROR: Can't get TEMP data! (0x%04x)\n", temp); - } - free(label); - } -} - -/* print_abituguru_fan() - * where fan, fan_alarm and fan_min are sensors feature IDs - */ -static void print_abituguru_fan(const sensors_chip_name *name, int fan, - int fan_alarm, int fan_min) -{ - char *label; - double cur, alarm, min; - int valid; - - if (!sensors_get_label_and_valid(*name, fan, &label, &valid)) { - if (valid) { - if (!sensors_get_feature(*name, fan, &cur) && - !sensors_get_feature(*name, fan_alarm, &alarm) && - !sensors_get_feature(*name, fan_min, &min)) { - print_label(label, 23); - printf("%4.0f RPM (min %4.0f RPM) %s\n", - cur, min, alarm ? "ALARM" : ""); - } else - printf("ERROR: Can't get FAN data! (0x%04x)\n", fan); - } - free(label); - } -} - -void print_abituguru(const sensors_chip_name *name) -{ - int i; - - for (i=0; i<11; i++) - print_abituguru_in(name, SENSORS_ABITUGURU_IN(i), - SENSORS_ABITUGURU_IN_MIN(i), SENSORS_ABITUGURU_IN_MIN_ALARM(i), - SENSORS_ABITUGURU_IN_MAX(i), SENSORS_ABITUGURU_IN_MAX_ALARM(i)); - - for (i=1; i<=7; i++) - print_abituguru_temp(name, SENSORS_ABITUGURU_TEMP(i), - SENSORS_ABITUGURU_TEMP_ALARM(i), SENSORS_ABITUGURU_TEMP_MAX(i), - SENSORS_ABITUGURU_TEMP_CRIT(i)); - - for (i=1; i<=6; i++) - print_abituguru_fan(name, SENSORS_ABITUGURU_FAN(i), - SENSORS_ABITUGURU_FAN_ALARM(i), SENSORS_ABITUGURU_FAN_MIN(i)); -} - -void print_k8temp(const sensors_chip_name *name) -{ - char *label; - double cur; - int valid, i; - - for (i = 0; i < 4; i++) { - if (!sensors_get_label_and_valid(*name, SENSORS_K8TEMP_TEMP1+i, &label, &valid) - && !sensors_get_feature(*name, SENSORS_K8TEMP_TEMP1+i, &cur)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, 0, 0, SINGLE, 0, 0); - printf("\n"); - } - } - free(label); - } -} - -void print_coretemp(const sensors_chip_name *name) -{ - char *label; - double cur, over, alarm; - int valid; - - if (!sensors_get_label_and_valid(*name, SENSORS_CORETEMP_TEMP1, &label, &valid) - && !sensors_get_feature(*name, SENSORS_CORETEMP_TEMP1, &cur) - && !sensors_get_feature(*name, SENSORS_CORETEMP_TEMP1_CRIT_ALARM, &alarm) - && !sensors_get_feature(*name, SENSORS_CORETEMP_TEMP1_CRIT, &over)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, over, 0, MAXONLY, 0, 0); - printf(" %s\n", alarm ? "ALARM" : ""); - } - } else - printf("ERROR: Can't get temperature data!\n"); - free(label); -} - -static void print_dme1737_in(const sensors_chip_name *name, int i) -{ - char *label; - double cur, min, max, alarm; - int valid; - - if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_IN(i), &label, - &valid) && - !sensors_get_feature(*name, SENSORS_DME1737_IN(i), &cur) && - !sensors_get_feature(*name, SENSORS_DME1737_IN_MIN(i), &min) && - !sensors_get_feature(*name, SENSORS_DME1737_IN_MAX(i), &max) && - !sensors_get_feature(*name, SENSORS_DME1737_IN_ALARM(i), &alarm)) { - if (valid) { - print_label(label, 10); - printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", - cur, min, max, alarm ? "ALARM" : ""); - } - } else { - printf("ERROR: Can't get in%d data!\n", i); - } - free(label); -} - -static void print_dme1737_temp(const sensors_chip_name *name, int i) -{ - char *label; - double cur, min, max, alarm, fault; - int valid; - - if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_TEMP(i), &label, - &valid) && - !sensors_get_feature(*name, SENSORS_DME1737_TEMP(i), &cur) && - !sensors_get_feature(*name, SENSORS_DME1737_TEMP_MIN(i), &min) && - !sensors_get_feature(*name, SENSORS_DME1737_TEMP_MAX(i), &max) && - !sensors_get_feature(*name, SENSORS_DME1737_TEMP_ALARM(i), &alarm) && - !sensors_get_feature(*name, SENSORS_DME1737_TEMP_FAULT(i), &fault)) { - if (valid) { - print_label(label, 10); - print_temp_info(cur, max, min, MINMAX, 0, 0); - printf("%s %s\n", fault ? "FAULT" : "", alarm ? "ALARM" : ""); - } - } else { - printf("ERROR: Can't get temp%d data!\n", i); - } - free(label); -} - -static void print_dme1737_fan(const sensors_chip_name *name, int i) -{ - char *label; - double cur, min, alarm; - int valid; - - if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_FAN(i), &label, - &valid) && - !sensors_get_feature(*name, SENSORS_DME1737_FAN(i), &cur) && - !sensors_get_feature(*name, SENSORS_DME1737_FAN_MIN(i), &min) && - !sensors_get_feature(*name, SENSORS_DME1737_FAN_ALARM(i), &alarm)) { - if (valid) { - print_label(label, 10); - printf("%4.0f RPM (min = %4.0f RPM) %s\n", - cur, min, alarm ? "ALARM" : ""); - } - } else { - printf("ERROR: Can't get fan%d data!\n", i); - } - free(label); -} - -static void print_dme1737_pwm(const sensors_chip_name *name, int i) -{ - char *label; - double cur, enable, freq; - int valid; - - if (!sensors_get_label_and_valid(*name, SENSORS_DME1737_PWM(i), &label, - &valid) && - !sensors_get_feature(*name, SENSORS_DME1737_PWM(i), &cur) && - !sensors_get_feature(*name, SENSORS_DME1737_PWM_ENABLE(i), &enable) && - !sensors_get_feature(*name, SENSORS_DME1737_PWM_FREQ(i), &freq)) { - if (valid) { - print_label(label, 10); - printf("%4.0f (enable = %1.0f, freq = %6.0f Hz)\n", cur, enable, freq); - } - } else { - printf("ERROR: Can't get pwm%d data!\n", i); - } - free(label); -} - -void print_dme1737(const sensors_chip_name *name) -{ - int i; - - for (i = 0; i < 7; i++) { - print_dme1737_in(name, i); - } - - for (i = 1; i < 4; i++) { - print_dme1737_temp(name, i); - } - - for (i = 1; i < 7; i++) { - print_dme1737_fan(name, i); - } - - for (i = 1; i < 7; i++) { - if (i == 4) - continue; - print_dme1737_pwm(name, i); - } - - print_vid_info(name, SENSORS_DME1737_VID, SENSORS_DME1737_VRM); -} - void print_unknown_chip(const sensors_chip_name *name) { int a,b,valid; diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index a2525526..26fa2e0a 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -24,60 +24,6 @@ extern void print_unknown_chip(const sensors_chip_name *name); -extern void print_asb100(const sensors_chip_name *name); -extern void print_ds1621(const sensors_chip_name *name); -extern void print_mtp008(const sensors_chip_name *name); -extern void print_lm75(const sensors_chip_name *name); -extern void print_adm1021(const sensors_chip_name *name); -extern void print_adm1024(const sensors_chip_name *name); -extern void print_adm1025(const sensors_chip_name *name); -extern void print_adm1026(const sensors_chip_name *name); -extern void print_adm9240(const sensors_chip_name *name); -extern void print_lm78(const sensors_chip_name *name); -extern void print_sis5595(const sensors_chip_name *name); -extern void print_via686a(const sensors_chip_name *name); -extern void print_gl518(const sensors_chip_name *name); -extern void print_gl520(const sensors_chip_name *name); -extern void print_lm80(const sensors_chip_name *name); -extern void print_lm85(const sensors_chip_name *name); -extern void print_w83781d(const sensors_chip_name *name); -extern void print_w83792d(const sensors_chip_name *name); -extern void print_w83793(const sensors_chip_name *name); -extern void print_w83l785ts(const sensors_chip_name *name); -extern void print_w83627ehf(const sensors_chip_name *name); -extern void print_maxilife(const sensors_chip_name *name); -extern void print_lm87(const sensors_chip_name *name); -extern void print_it87(const sensors_chip_name *name); -extern void print_fscpos(const sensors_chip_name *name); -extern void print_fscscy(const sensors_chip_name *name); -extern void print_fscher(const sensors_chip_name *name); -extern void print_pcf8591(const sensors_chip_name *name); -extern void print_vt1211(const sensors_chip_name *name); -extern void print_smsc47m1(const sensors_chip_name *name); -extern void print_smsc47m192(const sensors_chip_name *name); -extern void print_pc87360(const sensors_chip_name *name); -extern void print_pc87364(const sensors_chip_name *name); -extern void print_pc87366(const sensors_chip_name *name); -extern void print_pc87427(const sensors_chip_name *name); -extern void print_lm92(const sensors_chip_name *name); -extern void print_vt8231(const sensors_chip_name *name); -extern void print_bmc(const sensors_chip_name *name); -extern void print_lm83(const sensors_chip_name *name); -extern void print_lm90(const sensors_chip_name *name); -extern void print_lm63(const sensors_chip_name *name); -extern void print_lm93(const sensors_chip_name *name); -extern void print_max1619(const sensors_chip_name *name); -extern void print_xeontemp(const sensors_chip_name *name); -extern void print_max6650(const sensors_chip_name *name); -extern void print_adm1029(const sensors_chip_name *name); -extern void print_adm1031(const sensors_chip_name *name); -extern void print_smsc47b397(const sensors_chip_name *name); -extern void print_f71805f(const sensors_chip_name *name); -extern void print_abituguru(const sensors_chip_name *name); -extern void print_k8temp(const sensors_chip_name *name); -extern void print_coretemp(const sensors_chip_name *name); -extern void print_dme1737(const sensors_chip_name *name); - /* some functions used by chips_generic.c */ #define HYST 0 #define MINMAX 1 diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 6d2b372b..5b4346d3 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -316,122 +316,9 @@ const char *sprintf_chip_name(sensors_chip_name name) return buf; } -struct match { - const char * prefix; - void (*fn) (const sensors_chip_name *name); -}; - -struct match matches[] = { -/* { "ds1621", print_ds1621 }, */ - { "lm75", print_lm75 }, - { "adm1021", print_adm1021 }, - { "max1617", print_adm1021 }, - { "max1617a", print_adm1021 }, - { "thmc10", print_adm1021 }, - { "lm84", print_adm1021 }, - { "gl523", print_adm1021 }, - { "adm1023", print_adm1021 }, - { "mc1066", print_adm1021 }, - { "adm9240", print_adm9240 }, - { "ds1780", print_adm9240 }, - { "lm81", print_adm9240 }, - { "lm78", print_lm78 }, - { "lm78-j", print_lm78 }, - { "lm79", print_lm78 }, - { "mtp008", print_mtp008 }, - { "sis5595", print_sis5595 }, - { "via686a", print_via686a }, - { "lm80", print_lm80 }, - { "lm85", print_lm85 }, - { "lm85b", print_lm85 }, - { "lm85c", print_lm85 }, - { "adm1027", print_lm85 }, - { "adt7463", print_lm85 }, - { "emc6d100", print_lm85 }, - { "emc6d102", print_lm85 }, - { "lm87", print_lm87 }, - { "gl518sm", print_gl518 }, - { "gl520sm", print_gl520 }, - { "adm1025", print_adm1025 }, - { "ne1619", print_adm1025 }, - { "adm1024", print_adm1024 }, - { "w83781d", print_w83781d }, - { "w83782d", print_w83781d }, - { "w83783d", print_w83781d }, - { "w83627hf", print_w83781d }, - { "w83627thf", print_w83781d }, - { "w83637hf", print_w83781d }, - { "w83697hf", print_w83781d }, - { "w83687thf", print_w83781d }, - { "w83627ehf", print_w83627ehf }, - { "w83627dhg", print_w83627ehf }, - { "w83791d", print_w83781d }, - { "w83792d", print_w83792d }, - { "w83793", print_w83793 }, - { "w83l785ts", print_w83l785ts }, - { "as99127f", print_w83781d }, - { "maxilife", print_maxilife }, - { "maxilife-cg", print_maxilife }, - { "maxilife-co", print_maxilife }, - { "maxilife-as", print_maxilife }, - { "maxilife-nba", print_maxilife }, - { "it87", print_it87 }, - { "it8712", print_it87 }, - { "it8716", print_it87 }, - { "it8718", print_it87 }, - { "fscpos", print_fscpos }, - { "fscscy", print_fscscy }, - { "fscher", print_fscher }, - { "pcf8591", print_pcf8591 }, - { "vt1211", print_vt1211 }, - { "smsc47m192", print_smsc47m192 }, - { "smsc47m1", print_smsc47m1 }, - { "smsc47m2", print_smsc47m1 }, - { "pc87360", print_pc87360 }, - { "pc87363", print_pc87360 }, - { "pc87364", print_pc87364 }, - { "pc87365", print_pc87366 }, - { "pc87366", print_pc87366 }, - { "pc87427", print_pc87427 }, - { "lm92", print_lm92 }, - { "vt8231", print_vt8231 }, - { "bmc", print_bmc }, - { "adm1026", print_adm1026 }, - { "lm83", print_lm83 }, -/* { "lm90", print_lm90 }, - { "adm1032", print_lm90 }, - { "lm99", print_lm90 }, - { "lm86", print_lm90 }, - { "max6657", print_lm90 }, - { "adt7461", print_lm90 }, */ - { "lm63", print_lm63 }, - { "xeontemp", print_xeontemp }, - { "max6650", print_max6650 }, - { "asb100", print_asb100 }, - { "adm1029", print_adm1029 }, - { "adm1030", print_adm1031 }, - { "adm1031", print_adm1031 }, - { "lm93", print_lm93 }, - { "smsc47b397", print_smsc47b397 }, -/* { "f71805f", print_f71805f }, - { "f71872f", print_f71805f }, */ -// { "abituguru", print_abituguru }, -// { "k8temp", print_k8temp }, - { "coretemp", print_coretemp }, - { "dme1737", print_dme1737 }, - { NULL, NULL } -}; - void do_a_print(sensors_chip_name name) { - struct match *m; - - /* do we know how to display it? */ - for(m = matches; m->prefix != NULL; m++) { - if(!strcmp(name.prefix, m->prefix)) break; - } - - if(m->prefix==NULL && hide_unknown) + if (hide_unknown) return; printf("%s\n",sprintf_chip_name(name)); @@ -444,13 +331,7 @@ void do_a_print(sensors_chip_name name) } if (do_unknown) print_unknown_chip(&name); - else if(do_generic) + else print_generic_chip(&name); - else { - if(m->prefix == NULL) - print_generic_chip(&name); - else - m->fn(&name); - } printf("\n"); } From 56e9e2da886447b0ef81f0628cda294acff530d3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 09:02:12 +0000 Subject: [PATCH 081/718] Delete needless forward declarations and wrapper. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4505 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 9a71850a..6e25116e 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -26,13 +26,10 @@ #include "chips.h" #include "lib/sensors.h" -void print_label(const char *label, int space); -static inline float deg_ctof( float ); - extern int fahrenheit; extern char degstr[5]; -inline float deg_ctof( float cel ) +static inline float deg_ctof(float cel) { return ( cel * ( 9.0F / 5.0F ) + 32.0F ); } @@ -123,11 +120,6 @@ void print_vid_info_real(const sensors_chip_name *name, int f_vid, int f_vrm, in free(label); } -void print_vid_info(const sensors_chip_name *name, int f_vid, int f_vrm) -{ - print_vid_info_real(name, f_vid, f_vrm, 10); -} - void print_unknown_chip(const sensors_chip_name *name) { int a,b,valid; From 75d55dc5aed97b8c6e29146cba9b6fc0020a5af9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 09:38:31 +0000 Subject: [PATCH 082/718] Delete the chip-specific code from libsensors. It's about time to get the generic code to work. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4506 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 3 +- lib/Module.mk | 6 +- lib/chips.c | 5841 ------------------------------------------------- lib/chips.h | 2228 ------------------- 4 files changed, 3 insertions(+), 8075 deletions(-) delete mode 100644 lib/chips.h diff --git a/CHANGES b/CHANGES index 1a56acf9..c69e30a6 100644 --- a/CHANGES +++ b/CHANGES @@ -11,11 +11,10 @@ SVN HEAD File lm_sensors.sysconfig: Delete, now generated by sensors-detect File README.patches: Delete, obsolete Library: Clean up pwm symbol names translation - Add dme1737 support - Delete support of non-sensor drivers (ddcmon, eeprom) Always build with sysfs support Delete procfs and sysctl support (Linux 2.4) Delete all remnants of algorithm names + Drop all the chip-specific support Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete Programs i2cdump, i2cget, i2cset: Do not force the slave address by default diff --git a/lib/Module.mk b/lib/Module.mk index 94cac2c7..61099e56 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -30,8 +30,7 @@ LIBMAN5FILES := $(MODULE_DIR)/sensors.conf.5 # The main and minor version of the library # The library soname (major number) must be changed if and only if the interface is # changed in a backward incompatible way. The interface is defined by -# the public header files - in this case they are error.h, sensors.h, -# chips.h. +# the public header files - in this case they are error.h and sensors.h. LIBMAINVER := 4 LIBMINORVER := 0.0 LIBVER := $(LIBMAINVER).$(LIBMINORVER) @@ -57,8 +56,7 @@ LIBSTOBJECTS := $(LIBCSOURCES:.c=.ao) $(LIBOTHEROBJECTS:.o=.ao) LIBEXTRACLEAN := $(MODULE_DIR)/conf-parse.h $(MODULE_DIR)/conf-parse.c \ $(MODULE_DIR)/conf-lex.c -LIBHEADERFILES := $(MODULE_DIR)/error.h $(MODULE_DIR)/sensors.h \ - $(MODULE_DIR)/chips.h +LIBHEADERFILES := $(MODULE_DIR)/error.h $(MODULE_DIR)/sensors.h # How to create the shared library $(MODULE_DIR)/$(LIBSHLIBNAME): $(LIBSHOBJECTS) diff --git a/lib/chips.c b/lib/chips.c index 56a69535..821466ba 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -17,5853 +17,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "chips.h" #include "data.h" -#include "sensors.h" #define PLACEHOLDER_ELEMENTS {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} -/* For each chip, a list of features; - For each feature, the number, its name, the logical mapping (for example, - fan1_div belongs to fan1), the compute mapping, an access field, - and the magnitude. - The access field indicates whether resources are readable and writable. - Sometimes, a resource is neither; in this case, it is just a catch-all - category, for mappings. - The magnitude is the 10-power through which the read value must be - divided. */ - - -#define NOMAP SENSORS_NO_MAPPING -#define R SENSORS_MODE_R -#define RW SENSORS_MODE_RW - -static sensors_chip_feature lm78_features[] = - { - { { SENSORS_LM78_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78_IN0_MIN, "in0_min", SENSORS_LM78_IN0, SENSORS_LM78_IN0, RW }, - 2 }, - { { SENSORS_LM78_IN1_MIN, "in1_min", SENSORS_LM78_IN1, SENSORS_LM78_IN1, RW }, - 2 }, - { { SENSORS_LM78_IN2_MIN, "in2_min", SENSORS_LM78_IN2, SENSORS_LM78_IN2, RW }, - 2 }, - { { SENSORS_LM78_IN3_MIN, "in3_min", SENSORS_LM78_IN3, SENSORS_LM78_IN3, RW }, - 2 }, - { { SENSORS_LM78_IN4_MIN, "in4_min", SENSORS_LM78_IN4, SENSORS_LM78_IN4, RW }, - 2 }, -/* swap 5 and 6 min/max because compute lines will be inverting */ - { { SENSORS_LM78_IN5_MIN, "in5_min", SENSORS_LM78_IN5, SENSORS_LM78_IN5, RW }, - 2, "in5_max", 3 }, - { { SENSORS_LM78_IN6_MIN, "in6_min", SENSORS_LM78_IN6, SENSORS_LM78_IN6, RW }, - 2, "in6_max", 3 }, - { { SENSORS_LM78_IN0_MAX, "in0_max", SENSORS_LM78_IN0, SENSORS_LM78_IN0, RW }, - 2 }, - { { SENSORS_LM78_IN1_MAX, "in1_max", SENSORS_LM78_IN1, SENSORS_LM78_IN1, RW }, - 2 }, - { { SENSORS_LM78_IN2_MAX, "in2_max", SENSORS_LM78_IN2, SENSORS_LM78_IN2, RW }, - 2 }, - { { SENSORS_LM78_IN3_MAX, "in3_max", SENSORS_LM78_IN3, SENSORS_LM78_IN3, RW }, - 2 }, - { { SENSORS_LM78_IN4_MAX, "in4_max", SENSORS_LM78_IN4, SENSORS_LM78_IN4, RW }, - 2 }, - { { SENSORS_LM78_IN5_MAX, "in5_max", SENSORS_LM78_IN5, SENSORS_LM78_IN5, RW }, - 2, "in5_min", 3 }, - { { SENSORS_LM78_IN6_MAX, "in6_max", SENSORS_LM78_IN6, SENSORS_LM78_IN6, RW }, - 2, "in6_min", 3 }, - { { SENSORS_LM78_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM78_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM78_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM78_FAN1_MIN, "fan1_min", SENSORS_LM78_FAN1, SENSORS_LM78_FAN1, - RW }, - 0 }, - { { SENSORS_LM78_FAN2_MIN, "fan2_min", SENSORS_LM78_FAN2, SENSORS_LM78_FAN2, - RW }, - 0 }, - { { SENSORS_LM78_FAN3_MIN, "fan3_min", SENSORS_LM78_FAN3, SENSORS_LM78_FAN3, - RW }, - 0 }, - { { SENSORS_LM78_TEMP, "temp", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_LM78_TEMP_HYST, "temp_hyst", SENSORS_LM78_TEMP, - SENSORS_LM78_TEMP, RW }, - 1 }, - { { SENSORS_LM78_TEMP_OVER, "temp_over", SENSORS_LM78_TEMP, - SENSORS_LM78_TEMP, RW }, - 1 }, - { { SENSORS_LM78_VID, "vid", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78_FAN1_DIV, "fan1_div", SENSORS_LM78_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_LM78_FAN2_DIV, "fan2_div", SENSORS_LM78_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_LM78_FAN3_DIV, "fan3_div", SENSORS_LM78_FAN3, NOMAP, R }, - 0 }, - { { SENSORS_LM78_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature lm78j_features[] = - { - { { SENSORS_LM78J_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78J_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78J_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78J_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78J_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78J_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78J_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78J_IN0_MIN, "in0_min", SENSORS_LM78J_IN0, SENSORS_LM78J_IN0, - RW }, - 2 }, - { { SENSORS_LM78J_IN1_MIN, "in1_min", SENSORS_LM78J_IN1, SENSORS_LM78J_IN1, - RW }, - 2 }, - { { SENSORS_LM78J_IN2_MIN, "in2_min", SENSORS_LM78J_IN2, SENSORS_LM78J_IN2, - RW }, - 2 }, - { { SENSORS_LM78J_IN3_MIN, "in3_min", SENSORS_LM78J_IN3, SENSORS_LM78J_IN3, - RW }, - 2 }, - { { SENSORS_LM78J_IN4_MIN, "in4_min", SENSORS_LM78J_IN4, SENSORS_LM78J_IN4, - RW }, - 2 }, -/* swap 5 and 6 min/max because compute lines will be inverting */ - { { SENSORS_LM78J_IN5_MIN, "in5_min", SENSORS_LM78J_IN5, SENSORS_LM78J_IN5, - RW }, - 2, "in5_max", 3 }, - { { SENSORS_LM78J_IN6_MIN, "in6_min", SENSORS_LM78J_IN6, SENSORS_LM78J_IN6, - RW }, - 2, "in6_max", 3 }, - { { SENSORS_LM78J_IN0_MAX, "in0_max", SENSORS_LM78J_IN0, SENSORS_LM78J_IN0, - RW }, - 2 }, - { { SENSORS_LM78J_IN1_MAX, "in1_max", SENSORS_LM78J_IN1, SENSORS_LM78J_IN1, - RW }, - 2 }, - { { SENSORS_LM78J_IN2_MAX, "in2_max", SENSORS_LM78J_IN2, SENSORS_LM78J_IN2, - RW }, - 2 }, - { { SENSORS_LM78J_IN3_MAX, "in3_max", SENSORS_LM78J_IN3, SENSORS_LM78J_IN3, - RW }, - 2 }, - { { SENSORS_LM78J_IN4_MAX, "in4_max", SENSORS_LM78J_IN4, SENSORS_LM78J_IN4, - RW }, - 2 }, - { { SENSORS_LM78J_IN5_MAX, "in5_max", SENSORS_LM78J_IN5, SENSORS_LM78J_IN5, - RW }, - 2, "in5_min", 3 }, - { { SENSORS_LM78J_IN6_MAX, "in6_max", SENSORS_LM78J_IN6, SENSORS_LM78J_IN6, - RW }, - 2, "in6_min", 3 }, - { { SENSORS_LM78J_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM78J_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM78J_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM78J_FAN1_MIN, "fan1_min", SENSORS_LM78J_FAN1, - SENSORS_LM78J_FAN1, RW }, - 0 }, - { { SENSORS_LM78J_FAN2_MIN, "fan2_min", SENSORS_LM78J_FAN2, - SENSORS_LM78J_FAN2, RW }, - 0 }, - { { SENSORS_LM78J_FAN3_MIN, "fan3_min", SENSORS_LM78J_FAN3, - SENSORS_LM78J_FAN3, RW }, - 0 }, - { { SENSORS_LM78J_TEMP, "temp", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_LM78J_TEMP_HYST, "temp_hyst", SENSORS_LM78J_TEMP, - SENSORS_LM78J_TEMP, RW }, - 1 }, - { { SENSORS_LM78J_TEMP_OVER, "temp_over", SENSORS_LM78J_TEMP, - SENSORS_LM78J_TEMP, RW }, - 1 }, - { { SENSORS_LM78J_VID, "vid", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM78J_FAN1_DIV, "fan1_div", SENSORS_LM78J_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_LM78J_FAN2_DIV, "fan2_div", SENSORS_LM78J_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_LM78J_FAN3_DIV, "fan3_div", SENSORS_LM78J_FAN3, NOMAP, R }, - 0 }, - { { SENSORS_LM78J_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature lm79_features[] = - { - { { SENSORS_LM79_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM79_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM79_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM79_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM79_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM79_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM79_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM79_IN0_MIN, "in0_min", SENSORS_LM79_IN0, SENSORS_LM79_IN0, RW }, - 2 }, - { { SENSORS_LM79_IN1_MIN, "in1_min", SENSORS_LM79_IN1, SENSORS_LM79_IN1, RW }, - 2 }, - { { SENSORS_LM79_IN2_MIN, "in2_min", SENSORS_LM79_IN2, SENSORS_LM79_IN2, RW }, - 2 }, - { { SENSORS_LM79_IN3_MIN, "in3_min", SENSORS_LM79_IN3, SENSORS_LM79_IN3, RW }, - 2 }, - { { SENSORS_LM79_IN4_MIN, "in4_min", SENSORS_LM79_IN4, SENSORS_LM79_IN4, RW }, - 2 }, -/* swap 5 and 6 min/max because compute lines will be inverting */ - { { SENSORS_LM79_IN5_MIN, "in5_min", SENSORS_LM79_IN5, SENSORS_LM79_IN5, RW }, - 2, "in5_max", 3 }, - { { SENSORS_LM79_IN6_MIN, "in6_min", SENSORS_LM79_IN6, SENSORS_LM79_IN6, RW }, - 2, "in6_max", 3 }, - { { SENSORS_LM79_IN0_MAX, "in0_max", SENSORS_LM79_IN0, SENSORS_LM79_IN0, RW }, - 2 }, - { { SENSORS_LM79_IN1_MAX, "in1_max", SENSORS_LM79_IN1, SENSORS_LM79_IN1, RW }, - 2 }, - { { SENSORS_LM79_IN2_MAX, "in2_max", SENSORS_LM79_IN2, SENSORS_LM79_IN2, RW }, - 2 }, - { { SENSORS_LM79_IN3_MAX, "in3_max", SENSORS_LM79_IN3, SENSORS_LM79_IN3, RW }, - 2 }, - { { SENSORS_LM79_IN4_MAX, "in4_max", SENSORS_LM79_IN4, SENSORS_LM79_IN4, RW }, - 2 }, - { { SENSORS_LM79_IN5_MAX, "in5_max", SENSORS_LM79_IN5, SENSORS_LM79_IN5, RW }, - 2, "in5_min", 3 }, - { { SENSORS_LM79_IN6_MAX, "in6_max", SENSORS_LM79_IN6, SENSORS_LM79_IN6, RW }, - 2, "in6_min", 3 }, - { { SENSORS_LM79_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM79_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM79_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM79_FAN1_MIN, "fan1_min", SENSORS_LM79_FAN1, SENSORS_LM79_FAN1, - RW }, - 0 }, - { { SENSORS_LM79_FAN2_MIN, "fan2_min", SENSORS_LM79_FAN2, SENSORS_LM79_FAN2, - RW }, - 0 }, - { { SENSORS_LM79_FAN3_MIN, "fan3_min", SENSORS_LM79_FAN3, SENSORS_LM79_FAN3, - RW }, - 0 }, - { { SENSORS_LM79_TEMP, "temp", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_LM79_TEMP_HYST, "temp_hyst", SENSORS_LM79_TEMP, - SENSORS_LM79_TEMP, RW }, - 1 }, - { { SENSORS_LM79_TEMP_OVER, "temp_over", SENSORS_LM79_TEMP, - SENSORS_LM79_TEMP, RW }, - 1 }, - { { SENSORS_LM79_VID, "vid", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM79_FAN1_DIV, "fan1_div", SENSORS_LM79_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_LM79_FAN2_DIV, "fan2_div", SENSORS_LM79_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_LM79_FAN3_DIV, "fan3_div", SENSORS_LM79_FAN3, NOMAP, R }, - 0 }, - { { SENSORS_LM79_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature lm75_features[] = - { - { { SENSORS_LM75_TEMP, "temp", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_LM75_TEMP_HYST, "temp_hyst", SENSORS_LM75_TEMP, - SENSORS_LM75_TEMP, RW }, - 1 }, - { { SENSORS_LM75_TEMP_OVER, "temp_over", SENSORS_LM75_TEMP, - SENSORS_LM75_TEMP, RW }, - 1 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature adm1021_features[] = - { - { { SENSORS_ADM1021_TEMP, "temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1021_TEMP_HYST, "temp_low", SENSORS_ADM1021_TEMP, - SENSORS_ADM1021_TEMP, RW }, - 0 }, - { { SENSORS_ADM1021_TEMP_OVER, "temp_over", SENSORS_ADM1021_TEMP, - SENSORS_ADM1021_TEMP, RW }, - 0 }, - { { SENSORS_ADM1021_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1021_REMOTE_TEMP_HYST, "remote_temp_low", - SENSORS_ADM1021_REMOTE_TEMP, - SENSORS_ADM1021_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_ADM1021_REMOTE_TEMP_OVER, "remote_temp_over", - SENSORS_ADM1021_REMOTE_TEMP, - SENSORS_ADM1021_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_ADM1021_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1021_DIE_CODE, "die_code", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature adm1023_features[] = - { - { { SENSORS_ADM1021_TEMP, "temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1021_TEMP_HYST, "temp_low", SENSORS_ADM1021_TEMP, - SENSORS_ADM1021_TEMP, RW }, - 0 }, - { { SENSORS_ADM1021_TEMP_OVER, "temp_over", SENSORS_ADM1021_TEMP, - SENSORS_ADM1021_TEMP, RW }, - 0 }, - { { SENSORS_ADM1021_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1021_REMOTE_TEMP_HYST, "remote_temp_low", - SENSORS_ADM1021_REMOTE_TEMP, - SENSORS_ADM1021_REMOTE_TEMP, RW }, - - 3 }, - { { SENSORS_ADM1021_REMOTE_TEMP_OVER, "remote_temp_over", - SENSORS_ADM1021_REMOTE_TEMP, - SENSORS_ADM1021_REMOTE_TEMP, RW }, - - 3 }, - { { SENSORS_ADM1021_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature adm1029_features[] = - { - { { SENSORS_ADM1029_TEMP1, "temp1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1029_TEMP1_MAX, "temp1_max", - SENSORS_ADM1029_TEMP1, SENSORS_ADM1029_TEMP1, RW }, - 3 }, - { { SENSORS_ADM1029_TEMP1_MIN, "temp1_min", - SENSORS_ADM1029_TEMP1, SENSORS_ADM1029_TEMP1, RW }, - 3 }, - - { { SENSORS_ADM1029_TEMP2, "temp2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1029_TEMP2_MAX, "temp2_max", - SENSORS_ADM1029_TEMP2, SENSORS_ADM1029_TEMP2, RW }, - 3 }, - { { SENSORS_ADM1029_TEMP2_MIN, "temp2_min", - SENSORS_ADM1029_TEMP2, SENSORS_ADM1029_TEMP2, RW }, - 3 }, - - { { SENSORS_ADM1029_TEMP3, "temp3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1029_TEMP3_MAX, "temp3_max", - SENSORS_ADM1029_TEMP3, SENSORS_ADM1029_TEMP3, RW }, - 3 }, - { { SENSORS_ADM1029_TEMP3_MIN, "temp3_min", - SENSORS_ADM1029_TEMP3, SENSORS_ADM1029_TEMP3, RW }, - 3 }, - - { { SENSORS_ADM1029_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1029_FAN1_MIN, "fan1_min", - SENSORS_ADM1029_FAN1, SENSORS_ADM1029_FAN1, RW }, - 0 }, - { { SENSORS_ADM1029_FAN1_DIV, "fan1_div", - SENSORS_ADM1029_FAN1, NOMAP, RW }, - 0 }, - - { { SENSORS_ADM1029_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1029_FAN2_MIN, "fan2_min", - SENSORS_ADM1029_FAN2, SENSORS_ADM1029_FAN2, RW }, - 0 }, - { { SENSORS_ADM1029_FAN2_DIV, "fan2_div", - SENSORS_ADM1029_FAN2, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature adm1030_features[] = - { - { { SENSORS_ADM1031_TEMP1, "temp1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1031_TEMP1_MAX, "temp1_max", SENSORS_ADM1031_TEMP1, - SENSORS_ADM1031_TEMP1, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP1_MIN, "temp1_min", SENSORS_ADM1031_TEMP1, - SENSORS_ADM1031_TEMP1, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP1_CRIT, "temp1_crit", SENSORS_ADM1031_TEMP1, - SENSORS_ADM1031_TEMP1, RW }, - 3 }, - - { { SENSORS_ADM1031_TEMP2, "temp2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1031_TEMP2_MAX, "temp2_max", SENSORS_ADM1031_TEMP2, - SENSORS_ADM1031_TEMP2, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP2_MIN, "temp2_min", SENSORS_ADM1031_TEMP2, - SENSORS_ADM1031_TEMP2, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP2_CRIT, "temp2_crit", SENSORS_ADM1031_TEMP2, - SENSORS_ADM1031_TEMP2, RW }, - 3 }, - - { { SENSORS_ADM1031_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1031_FAN1_MIN, "fan1_min", SENSORS_ADM1031_FAN1, - SENSORS_ADM1031_FAN1, RW }, - 0 }, - { { SENSORS_ADM1031_FAN1_DIV, "fan1_div", SENSORS_ADM1031_FAN1, NOMAP, RW }, - 0 }, - - { { SENSORS_ADM1031_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature adm1031_features[] = - { - { { SENSORS_ADM1031_TEMP1, "temp1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1031_TEMP1_MAX, "temp1_max", SENSORS_ADM1031_TEMP1, - SENSORS_ADM1031_TEMP1, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP1_MIN, "temp1_min", SENSORS_ADM1031_TEMP1, - SENSORS_ADM1031_TEMP1, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP1_CRIT, "temp1_crit", SENSORS_ADM1031_TEMP1, - SENSORS_ADM1031_TEMP1, RW }, - 3 }, - - { { SENSORS_ADM1031_TEMP2, "temp2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1031_TEMP2_MAX, "temp2_max", SENSORS_ADM1031_TEMP2, - SENSORS_ADM1031_TEMP2, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP2_MIN, "temp2_min", SENSORS_ADM1031_TEMP2, - SENSORS_ADM1031_TEMP2, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP2_CRIT, "temp2_crit", SENSORS_ADM1031_TEMP2, - SENSORS_ADM1031_TEMP2, RW }, - 3 }, - - { { SENSORS_ADM1031_TEMP3, "temp3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1031_TEMP3_MAX, "temp3_max", SENSORS_ADM1031_TEMP3, - SENSORS_ADM1031_TEMP3, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP3_MIN, "temp3_min", SENSORS_ADM1031_TEMP3, - SENSORS_ADM1031_TEMP3, RW }, - 3 }, - { { SENSORS_ADM1031_TEMP3_CRIT, "temp3_crit", SENSORS_ADM1031_TEMP3, - SENSORS_ADM1031_TEMP3, RW }, - 3 }, - - { { SENSORS_ADM1031_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1031_FAN1_MIN, "fan1_min", SENSORS_ADM1031_FAN1, - SENSORS_ADM1031_FAN1, RW }, - 0 }, - { { SENSORS_ADM1031_FAN1_DIV, "fan1_div", SENSORS_ADM1031_FAN1, NOMAP, RW }, - 0 }, - - { { SENSORS_ADM1031_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1031_FAN2_MIN, "fan2_min", SENSORS_ADM1031_FAN2, - SENSORS_ADM1031_FAN2, RW }, - 0 }, - { { SENSORS_ADM1031_FAN2_DIV, "fan2_div", SENSORS_ADM1031_FAN2, NOMAP, RW }, - 0 }, - - { { SENSORS_ADM1031_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature max1617_features[] = - { - { { SENSORS_MAX1617_TEMP, "temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX1617_TEMP_HYST, "temp_low", SENSORS_MAX1617_TEMP, - SENSORS_MAX1617_TEMP, RW }, - 0 }, - { { SENSORS_MAX1617_TEMP_OVER, "temp_over", SENSORS_MAX1617_TEMP, - SENSORS_MAX1617_TEMP, RW }, - 0 }, - { { SENSORS_MAX1617_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX1617_REMOTE_TEMP_HYST, "remote_temp_low", - SENSORS_MAX1617_REMOTE_TEMP, - SENSORS_MAX1617_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_MAX1617_REMOTE_TEMP_OVER, "remote_temp_over", - SENSORS_MAX1617_REMOTE_TEMP, - SENSORS_MAX1617_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_MAX1617_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature max1617a_features[] = - { - { { SENSORS_MAX1617A_TEMP, "temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX1617A_TEMP_HYST, "temp_low", SENSORS_MAX1617A_TEMP, - SENSORS_MAX1617A_TEMP, RW }, - 0 }, - { { SENSORS_MAX1617A_TEMP_OVER, "temp_over", SENSORS_MAX1617A_TEMP, - SENSORS_MAX1617A_TEMP, RW }, - 0 }, - { { SENSORS_MAX1617A_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX1617A_REMOTE_TEMP_HYST, "remote_temp_low", - SENSORS_MAX1617A_REMOTE_TEMP, - SENSORS_MAX1617A_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_MAX1617A_REMOTE_TEMP_OVER, "remote_temp_over", - SENSORS_MAX1617A_REMOTE_TEMP, - SENSORS_MAX1617A_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_MAX1617A_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature gl518_features[] = - { - { { SENSORS_GL518_VDD, "vdd", NOMAP, NOMAP, R }, - 2, "in0_input", 3 }, - { { SENSORS_GL518_VIN1, "vin1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_GL518_VIN2, "vin2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_GL518_VIN3, "vin3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_GL518_VDD_MIN, "vdd_min", SENSORS_GL518_VDD, SENSORS_GL518_VDD, - RW }, - 2 , "in0_min", 3 }, - { { SENSORS_GL518_VIN1_MIN, "vin1_min", SENSORS_GL518_VIN1, - SENSORS_GL518_VIN1, RW }, - 2 }, - { { SENSORS_GL518_VIN2_MIN, "vin2_min", SENSORS_GL518_VIN2, - SENSORS_GL518_VIN2, RW }, - 2 }, - { { SENSORS_GL518_VIN3_MIN, "vin3_min", SENSORS_GL518_VIN3, - SENSORS_GL518_VIN3, RW }, - 2 }, - { { SENSORS_GL518_VDD_MAX, "vdd_max", SENSORS_GL518_VDD, SENSORS_GL518_VDD, - RW }, - 2 , "in0_max", 3 }, - { { SENSORS_GL518_VIN1_MAX, "vin1_max", SENSORS_GL518_VIN1, - SENSORS_GL518_VIN1, RW }, - 2 }, - { { SENSORS_GL518_VIN2_MAX, "vin2_max", SENSORS_GL518_VIN2, - SENSORS_GL518_VIN2, RW }, - 2 }, - { { SENSORS_GL518_VIN3_MAX, "vin3_max", SENSORS_GL518_VIN3, - SENSORS_GL518_VIN3, RW }, - 2 }, - { { SENSORS_GL518_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_GL518_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_GL518_FAN1_MIN, "fan1_min", SENSORS_GL518_FAN1, - SENSORS_GL518_FAN1, RW }, - 0 }, - { { SENSORS_GL518_FAN2_MIN, "fan2_min", SENSORS_GL518_FAN2, - SENSORS_GL518_FAN2, RW }, - 0 }, - { { SENSORS_GL518_TEMP, "temp", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_GL518_TEMP_HYST, "temp_hyst", SENSORS_GL518_TEMP, - SENSORS_GL518_TEMP, RW }, - 1 }, - { { SENSORS_GL518_TEMP_OVER, "temp_over", SENSORS_GL518_TEMP, - SENSORS_GL518_TEMP, RW }, - 1 }, - { { SENSORS_GL518_FAN1_DIV, "fan1_div", SENSORS_GL518_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_GL518_FAN2_DIV, "fan2_div", SENSORS_GL518_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_GL518_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_GL518_BEEP_ENABLE, "beep_enable", SENSORS_GL518_ALARMS, NOMAP, - RW }, - 0 }, - { { SENSORS_GL518_BEEPS, "beeps", SENSORS_GL518_ALARMS, SENSORS_GL518_ALARMS, - RW }, - 0 }, - { { SENSORS_GL518_FAN1OFF, "fan1_off", SENSORS_GL518_FAN1, NOMAP, RW }, - 0, "fan1_auto", - 0 }, - { { SENSORS_GL518_FAN1PIN, "fan1_off_pin", SENSORS_GL518_FAN1OFF, NOMAP, RW }, - 0 }, - { { SENSORS_GL518_ITERATE, "iterate", NOMAP, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature gl520_features[] = - { - { { SENSORS_GL520_VDD, "vdd", NOMAP, NOMAP, R }, - 2, "in0_input", 3 }, - { { SENSORS_GL520_VIN1, "vin1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_GL520_VIN2, "vin2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_GL520_VIN3, "vin3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_GL520_VIN4, "vin4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_GL520_VDD_MIN, "vdd_min", SENSORS_GL520_VDD, SENSORS_GL520_VDD, - RW }, - 2, "in0_min", 3 }, - { { SENSORS_GL520_VIN1_MIN, "vin1_min", SENSORS_GL520_VIN1, - SENSORS_GL520_VIN1, RW }, - 2 }, - { { SENSORS_GL520_VIN2_MIN, "vin2_min", SENSORS_GL520_VIN2, - SENSORS_GL520_VIN2, RW }, - 2 }, - { { SENSORS_GL520_VIN3_MIN, "vin3_min", SENSORS_GL520_VIN3, - SENSORS_GL520_VIN3, RW }, - 2 }, - { { SENSORS_GL520_VIN4_MIN, "vin4_min", SENSORS_GL520_VIN4, - SENSORS_GL520_VIN4, RW }, - 2 }, - { { SENSORS_GL520_VDD_MAX, "vdd_max", SENSORS_GL520_VDD, SENSORS_GL520_VDD, - RW }, - 2, "in0_max", 3 }, - { { SENSORS_GL520_VIN1_MAX, "vin1_max", SENSORS_GL520_VIN1, - SENSORS_GL520_VIN1, RW }, - 2 }, - { { SENSORS_GL520_VIN2_MAX, "vin2_max", SENSORS_GL520_VIN2, - SENSORS_GL520_VIN2, RW }, - 2 }, - { { SENSORS_GL520_VIN3_MAX, "vin3_max", SENSORS_GL520_VIN3, - SENSORS_GL520_VIN3, RW }, - 2 }, - { { SENSORS_GL520_VIN4_MAX, "vin4_max", SENSORS_GL520_VIN4, - SENSORS_GL520_VIN4, RW }, - 2 }, - { { SENSORS_GL520_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_GL520_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_GL520_FAN1_MIN, "fan1_min", SENSORS_GL520_FAN1, - SENSORS_GL520_FAN1, RW }, - 0 }, - { { SENSORS_GL520_FAN2_MIN, "fan2_min", SENSORS_GL520_FAN2, - SENSORS_GL520_FAN2, RW }, - 0 }, - { { SENSORS_GL520_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_GL520_TEMP1_HYST, "temp1_hyst", SENSORS_GL520_TEMP1, - SENSORS_GL520_TEMP1, RW }, - 1 }, - { { SENSORS_GL520_TEMP1_OVER, "temp1_over", SENSORS_GL520_TEMP1, - SENSORS_GL520_TEMP1, RW }, - 1 }, - { { SENSORS_GL520_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_GL520_TEMP2_HYST, "temp2_hyst", SENSORS_GL520_TEMP2, - SENSORS_GL520_TEMP2, RW }, - 1 }, - { { SENSORS_GL520_TEMP2_OVER, "temp2_over", SENSORS_GL520_TEMP2, - SENSORS_GL520_TEMP2, RW }, - 1 }, - { { SENSORS_GL520_VID, "vid", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_GL520_FAN1_DIV, "fan1_div", SENSORS_GL520_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_GL520_FAN2_DIV, "fan2_div", SENSORS_GL520_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_GL520_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_GL520_BEEP_ENABLE, "beep_enable", SENSORS_GL520_ALARMS, NOMAP, - RW }, - 0 }, - { { SENSORS_GL520_BEEPS, "beeps", SENSORS_GL520_ALARMS, SENSORS_GL520_ALARMS, - RW }, - 0 }, - { { SENSORS_GL520_FAN1OFF, "fan1_off", SENSORS_GL520_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_GL520_TWOTEMPS, "two_temps", NOMAP, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature lm80_features[] = - { - { { SENSORS_LM80_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM80_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM80_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM80_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM80_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM80_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM80_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM80_IN0_MIN, "in0_min", SENSORS_LM80_IN0, SENSORS_LM80_IN0, RW }, - 2 }, - { { SENSORS_LM80_IN1_MIN, "in1_min", SENSORS_LM80_IN1, SENSORS_LM80_IN1, RW }, - 2 }, - { { SENSORS_LM80_IN2_MIN, "in2_min", SENSORS_LM80_IN2, SENSORS_LM80_IN2, RW }, - 2 }, - { { SENSORS_LM80_IN3_MIN, "in3_min", SENSORS_LM80_IN3, SENSORS_LM80_IN3, RW }, - 2 }, - { { SENSORS_LM80_IN4_MIN, "in4_min", SENSORS_LM80_IN4, SENSORS_LM80_IN4, RW }, - 2 }, - { { SENSORS_LM80_IN5_MIN, "in5_min", SENSORS_LM80_IN5, SENSORS_LM80_IN5, RW }, - 2 }, - { { SENSORS_LM80_IN6_MIN, "in6_min", SENSORS_LM80_IN6, SENSORS_LM80_IN6, RW }, - 2 }, - { { SENSORS_LM80_IN0_MAX, "in0_max", SENSORS_LM80_IN0, SENSORS_LM80_IN0, RW }, - 2 }, - { { SENSORS_LM80_IN1_MAX, "in1_max", SENSORS_LM80_IN1, SENSORS_LM80_IN1, RW }, - 2 }, - { { SENSORS_LM80_IN2_MAX, "in2_max", SENSORS_LM80_IN2, SENSORS_LM80_IN2, RW }, - 2 }, - { { SENSORS_LM80_IN3_MAX, "in3_max", SENSORS_LM80_IN3, SENSORS_LM80_IN3, RW }, - 2 }, - { { SENSORS_LM80_IN4_MAX, "in4_max", SENSORS_LM80_IN4, SENSORS_LM80_IN4, RW }, - 2 }, - { { SENSORS_LM80_IN5_MAX, "in5_max", SENSORS_LM80_IN5, SENSORS_LM80_IN5, RW }, - 2 }, - { { SENSORS_LM80_IN6_MAX, "in6_max", SENSORS_LM80_IN6, SENSORS_LM80_IN6, RW }, - 2 }, - { { SENSORS_LM80_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM80_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM80_FAN1_MIN, "fan1_min", SENSORS_LM80_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_LM80_FAN2_MIN, "fan2_min", SENSORS_LM80_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_LM80_TEMP, "temp", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM80_TEMP_HOT_HYST, "temp_hot_hyst", SENSORS_LM80_TEMP, - SENSORS_LM80_TEMP, RW }, - 2, - "temp1_max_hyst", 3 }, - { { SENSORS_LM80_TEMP_HOT_MAX, "temp_hot_max", SENSORS_LM80_TEMP, - SENSORS_LM80_TEMP, RW }, - 2, "temp1_max", - 3 }, - { { SENSORS_LM80_TEMP_OS_HYST, "temp_os_hyst", SENSORS_LM80_TEMP, - SENSORS_LM80_TEMP, RW }, - 2, - "temp1_crit_hyst", 3 }, - { { SENSORS_LM80_TEMP_OS_MAX, "temp_os_max", SENSORS_LM80_TEMP, - SENSORS_LM80_TEMP, RW }, - 2, "temp1_crit", - 3 }, - { { SENSORS_LM80_FAN1_DIV, "fan1_div", SENSORS_LM80_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_LM80_FAN2_DIV, "fan2_div", SENSORS_LM80_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_LM80_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature lm83_features[] = - { - { { SENSORS_LM83_LOCAL_TEMP, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM83_LOCAL_HIGH, "temp1_high", SENSORS_LM83_LOCAL_TEMP, - SENSORS_LM83_LOCAL_TEMP, RW }, - 0 }, - { { SENSORS_LM83_REMOTE1_TEMP, "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM83_REMOTE1_HIGH, "temp2_high", SENSORS_LM83_REMOTE1_TEMP, - SENSORS_LM83_REMOTE1_TEMP, RW }, - 0 }, - { { SENSORS_LM83_REMOTE2_TEMP, "temp3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM83_REMOTE2_HIGH, "temp3_high", SENSORS_LM83_REMOTE2_TEMP, - SENSORS_LM83_REMOTE2_TEMP, RW }, - 0 }, - { { SENSORS_LM83_REMOTE3_TEMP, "temp4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM83_REMOTE3_HIGH, "temp4_high", SENSORS_LM83_REMOTE3_TEMP, - SENSORS_LM83_REMOTE3_TEMP, RW }, - 0 }, - { { SENSORS_LM83_TCRIT, "tcrit", NOMAP, NOMAP, RW }, - 0, "temp3_crit", 3, - "temp_crit" }, - { { SENSORS_LM83_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature lm90_features[] = - { - { { SENSORS_LM90_LOCAL_TEMP, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM90_LOCAL_HIGH, "temp1_high", SENSORS_LM90_LOCAL_TEMP, - SENSORS_LM90_LOCAL_TEMP, RW }, - 0 }, - { { SENSORS_LM90_LOCAL_LOW, "temp1_low", SENSORS_LM90_LOCAL_TEMP, - SENSORS_LM90_LOCAL_TEMP, RW }, - 0 }, - { { SENSORS_LM90_REMOTE_TEMP, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_LM90_REMOTE_HIGH, "temp2_high", SENSORS_LM90_REMOTE_TEMP, - SENSORS_LM90_REMOTE_TEMP, RW }, - 1 }, - { { SENSORS_LM90_REMOTE_LOW, "temp2_low", SENSORS_LM90_REMOTE_TEMP, - SENSORS_LM90_REMOTE_TEMP, RW }, - 1 }, - { { SENSORS_LM90_LOCAL_TCRIT, "tcrit1", SENSORS_LM90_LOCAL_TEMP, - SENSORS_LM90_LOCAL_TEMP, RW }, - 0, - "temp1_crit", 3 }, - { { SENSORS_LM90_REMOTE_TCRIT, "tcrit2", SENSORS_LM90_REMOTE_TEMP, - SENSORS_LM90_REMOTE_TEMP, RW }, - 0, - "temp2_crit", 3 }, - { { SENSORS_LM90_LOCAL_TCRIT_HYST, "hyst1", SENSORS_LM90_LOCAL_TEMP, - SENSORS_LM90_LOCAL_TEMP, RW }, - 0, - "temp1_crit_hyst", 3 }, - { { SENSORS_LM90_REMOTE_TCRIT_HYST, "hyst2", SENSORS_LM90_REMOTE_TEMP, - SENSORS_LM90_REMOTE_TEMP, R }, - 0, - "temp2_crit_hyst", 3 }, - { { SENSORS_LM90_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature lm63_features[] = - { - { { SENSORS_LM63_LOCAL_TEMP, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM63_LOCAL_HIGH, "temp1_high", SENSORS_LM63_LOCAL_TEMP, - SENSORS_LM63_LOCAL_TEMP, RW }, - 0 }, - { { SENSORS_LM63_REMOTE_TEMP, "temp2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM63_REMOTE_HIGH, "temp2_high", SENSORS_LM63_REMOTE_TEMP, - SENSORS_LM63_REMOTE_TEMP, RW }, - 3 }, - { { SENSORS_LM63_REMOTE_LOW, "temp2_low", SENSORS_LM63_REMOTE_TEMP, - SENSORS_LM63_REMOTE_TEMP, RW }, - 3 }, - { { SENSORS_LM63_REMOTE_TCRIT, "temp2_crit", SENSORS_LM63_REMOTE_TEMP, - SENSORS_LM63_REMOTE_TEMP, R }, - 0 }, - { { SENSORS_LM63_REMOTE_TCRIT_HYST, "temp2_crit_hyst", - SENSORS_LM63_REMOTE_TEMP, - SENSORS_LM63_REMOTE_TEMP, RW }, - - 0, "temp2_crit_hyst", 3 }, - { { SENSORS_LM63_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM63_FAN_LOW, "fan1_min", SENSORS_LM63_FAN, SENSORS_LM63_FAN, RW }, - 0 }, - { { SENSORS_LM63_FAN, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM63_PWM, "pwm1", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_LM63_PWM_ENABLE, "pwm1_enable", SENSORS_LM63_PWM, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature w83781d_features[] = - { - { { SENSORS_W83781D_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83781D_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83781D_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83781D_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83781D_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83781D_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83781D_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83781D_IN0_MIN, "in0_min", SENSORS_W83781D_IN0, - SENSORS_W83781D_IN0, RW }, - 2 }, - { { SENSORS_W83781D_IN1_MIN, "in1_min", SENSORS_W83781D_IN1, - SENSORS_W83781D_IN1, RW }, - 2 }, - { { SENSORS_W83781D_IN2_MIN, "in2_min", SENSORS_W83781D_IN2, - SENSORS_W83781D_IN2, RW }, - 2 }, - { { SENSORS_W83781D_IN3_MIN, "in3_min", SENSORS_W83781D_IN3, - SENSORS_W83781D_IN3, RW }, - 2 }, - { { SENSORS_W83781D_IN4_MIN, "in4_min", SENSORS_W83781D_IN4, - SENSORS_W83781D_IN4, RW }, - 2 }, -/* swap 5 and 6 min/max because compute lines will be inverting */ - { { SENSORS_W83781D_IN5_MIN, "in5_min", SENSORS_W83781D_IN5, - SENSORS_W83781D_IN5, RW }, - 2, "in5_max", 3 }, - { { SENSORS_W83781D_IN6_MIN, "in6_min", SENSORS_W83781D_IN6, - SENSORS_W83781D_IN6, RW }, - 2, "in6_max", 3 }, - { { SENSORS_W83781D_IN0_MAX, "in0_max", SENSORS_W83781D_IN0, - SENSORS_W83781D_IN0, RW }, - 2 }, - { { SENSORS_W83781D_IN1_MAX, "in1_max", SENSORS_W83781D_IN1, - SENSORS_W83781D_IN1, RW }, - 2 }, - { { SENSORS_W83781D_IN2_MAX, "in2_max", SENSORS_W83781D_IN2, - SENSORS_W83781D_IN2, RW }, - 2 }, - { { SENSORS_W83781D_IN3_MAX, "in3_max", SENSORS_W83781D_IN3, - SENSORS_W83781D_IN3, RW }, - 2 }, - { { SENSORS_W83781D_IN4_MAX, "in4_max", SENSORS_W83781D_IN4, - SENSORS_W83781D_IN4, RW }, - 2 }, - { { SENSORS_W83781D_IN5_MAX, "in5_max", SENSORS_W83781D_IN5, - SENSORS_W83781D_IN5, RW }, - 2, "in5_min", 3 }, - { { SENSORS_W83781D_IN6_MAX, "in6_max", SENSORS_W83781D_IN6, - SENSORS_W83781D_IN6, RW }, - 2, "in6_min", 3 }, - { { SENSORS_W83781D_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83781D_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83781D_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83781D_FAN1_MIN, "fan1_min", SENSORS_W83781D_FAN1, - SENSORS_W83781D_FAN1, RW }, - 0 }, - { { SENSORS_W83781D_FAN2_MIN, "fan2_min", SENSORS_W83781D_FAN2, - SENSORS_W83781D_FAN2, RW }, - 0 }, - { { SENSORS_W83781D_FAN3_MIN, "fan3_min", SENSORS_W83781D_FAN3, - SENSORS_W83781D_FAN3, RW }, - 0 }, - { { SENSORS_W83781D_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83781D_TEMP1_HYST, "temp1_hyst", SENSORS_W83781D_TEMP1, - SENSORS_W83781D_TEMP1, RW }, - 1 }, - { { SENSORS_W83781D_TEMP1_OVER, "temp1_over", SENSORS_W83781D_TEMP1, - SENSORS_W83781D_TEMP1, RW }, - 1 }, - { { SENSORS_W83781D_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83781D_TEMP2_HYST, "temp2_hyst", SENSORS_W83781D_TEMP2, - SENSORS_W83781D_TEMP2, RW }, - 1 }, - { { SENSORS_W83781D_TEMP2_OVER, "temp2_over", SENSORS_W83781D_TEMP2, - SENSORS_W83781D_TEMP2, RW }, - 1 }, - { { SENSORS_W83781D_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83781D_TEMP3_HYST, "temp3_hyst", SENSORS_W83781D_TEMP3, - SENSORS_W83781D_TEMP3, RW }, - 1 }, - { { SENSORS_W83781D_TEMP3_OVER, "temp3_over", SENSORS_W83781D_TEMP3, - SENSORS_W83781D_TEMP3, RW }, - 1 }, - { { SENSORS_W83781D_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83781D_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_W83781D_FAN1_DIV, "fan1_div", SENSORS_W83781D_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_W83781D_FAN2_DIV, "fan2_div", SENSORS_W83781D_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_W83781D_FAN3_DIV, "fan3_div", SENSORS_W83781D_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_W83781D_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83781D_BEEP_ENABLE, "beep_enable", SENSORS_W83781D_ALARMS, - NOMAP, RW }, - 0 }, - { { SENSORS_W83781D_BEEPS, "beeps", SENSORS_W83781D_ALARMS, - SENSORS_W83781D_ALARMS, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature as99127f_features[] = - { - { { SENSORS_W83782D_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN0_MIN, "in0_min", SENSORS_W83782D_IN0, - SENSORS_W83782D_IN0, RW }, - 2 }, - { { SENSORS_W83782D_IN1_MIN, "in1_min", SENSORS_W83782D_IN1, - SENSORS_W83782D_IN1, RW }, - 2 }, - { { SENSORS_W83782D_IN2_MIN, "in2_min", SENSORS_W83782D_IN2, - SENSORS_W83782D_IN2, RW }, - 2 }, - { { SENSORS_W83782D_IN3_MIN, "in3_min", SENSORS_W83782D_IN3, - SENSORS_W83782D_IN3, RW }, - 2 }, - { { SENSORS_W83782D_IN4_MIN, "in4_min", SENSORS_W83782D_IN4, - SENSORS_W83782D_IN4, RW }, - 2 }, -/* swap 5 and 6 min/max because compute lines will be inverting */ - { { SENSORS_W83782D_IN5_MIN, "in5_min", SENSORS_W83782D_IN5, - SENSORS_W83782D_IN5, RW }, - 2, "in5_max", 3 }, - { { SENSORS_W83782D_IN6_MIN, "in6_min", SENSORS_W83782D_IN6, - SENSORS_W83782D_IN6, RW }, - 2, "in6_max", 3 }, - { { SENSORS_W83782D_IN0_MAX, "in0_max", SENSORS_W83782D_IN0, - SENSORS_W83782D_IN0, RW }, - 2 }, - { { SENSORS_W83782D_IN1_MAX, "in1_max", SENSORS_W83782D_IN1, - SENSORS_W83782D_IN1, RW }, - 2 }, - { { SENSORS_W83782D_IN2_MAX, "in2_max", SENSORS_W83782D_IN2, - SENSORS_W83782D_IN2, RW }, - 2 }, - { { SENSORS_W83782D_IN3_MAX, "in3_max", SENSORS_W83782D_IN3, - SENSORS_W83782D_IN3, RW }, - 2 }, - { { SENSORS_W83782D_IN4_MAX, "in4_max", SENSORS_W83782D_IN4, - SENSORS_W83782D_IN4, RW }, - 2 }, - { { SENSORS_W83782D_IN5_MAX, "in5_max", SENSORS_W83782D_IN5, - SENSORS_W83782D_IN5, RW }, - 2, "in5_min", 3 }, - { { SENSORS_W83782D_IN6_MAX, "in6_max", SENSORS_W83782D_IN6, - SENSORS_W83782D_IN6, RW }, - 2, "in6_min", 3 }, - { { SENSORS_W83782D_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83782D_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83781D_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83782D_FAN1_MIN, "fan1_min", SENSORS_W83782D_FAN1, - SENSORS_W83782D_FAN1, RW }, - 0 }, - { { SENSORS_W83782D_FAN2_MIN, "fan2_min", SENSORS_W83782D_FAN2, - SENSORS_W83782D_FAN2, RW }, - 0 }, - { { SENSORS_W83781D_FAN3_MIN, "fan3_min", SENSORS_W83781D_FAN3, - SENSORS_W83782D_FAN3, RW }, - 0 }, - { { SENSORS_W83782D_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83782D_TEMP1_HYST, "temp1_hyst", SENSORS_W83782D_TEMP1, - SENSORS_W83782D_TEMP1, RW }, - 1 }, - { { SENSORS_W83782D_TEMP1_OVER, "temp1_over", SENSORS_W83782D_TEMP1, - SENSORS_W83782D_TEMP1, RW }, - 1 }, - { { SENSORS_W83782D_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83782D_TEMP2_HYST, "temp2_hyst", SENSORS_W83782D_TEMP2, - SENSORS_W83782D_TEMP2, RW }, - 1 }, - { { SENSORS_W83782D_TEMP2_OVER, "temp2_over", SENSORS_W83782D_TEMP2, - SENSORS_W83782D_TEMP2, RW }, - 1 }, - { { SENSORS_W83782D_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83782D_TEMP3_HYST, "temp3_hyst", SENSORS_W83782D_TEMP3, - SENSORS_W83782D_TEMP3, RW }, - 1 }, - { { SENSORS_W83782D_TEMP3_OVER, "temp3_over", SENSORS_W83782D_TEMP3, - SENSORS_W83782D_TEMP3, RW }, - 1 }, - { { SENSORS_W83782D_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83782D_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_W83782D_FAN1_DIV, "fan1_div", SENSORS_W83782D_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_FAN2_DIV, "fan2_div", SENSORS_W83782D_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_FAN3_DIV, "fan3_div", SENSORS_W83781D_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83782D_BEEP_ENABLE, "beep_enable", SENSORS_W83782D_ALARMS, - NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_BEEPS, "beeps", SENSORS_W83782D_ALARMS, - SENSORS_W83782D_ALARMS, RW }, - 0 }, - { { 0 }, 0 } - }; - -/* macro for LM93 voltage in/min/max entries */ -#define SENSORS_LM93_IN_MIN_MAX(nr) \ - { { SENSORS_LM93_IN##nr, "in" #nr, NOMAP, \ - NOMAP, R }, 2}, \ - { { SENSORS_LM93_IN##nr##_MIN, "in" #nr "_min", SENSORS_LM93_IN##nr, \ - SENSORS_LM93_IN##nr, RW }, 2 }, \ - { { SENSORS_LM93_IN##nr##_MAX, "in" #nr "_max", SENSORS_LM93_IN##nr, \ - SENSORS_LM93_IN##nr, RW }, 2 } - -/* macro for LM93 fan/min entries */ -#define SENSORS_LM93_FAN_MIN(nr) \ - { { SENSORS_LM93_FAN##nr, "fan" #nr, NOMAP, NOMAP, R }, 0 }, \ - { { SENSORS_LM93_FAN##nr##_MIN, "fan" #nr "_min", \ - SENSORS_LM93_FAN##nr, SENSORS_LM93_FAN##nr, RW }, 0 } - -/* macro for LM93 temp/min/max entries */ -#define SENSORS_LM93_TEMP_MIN_MAX(nr) \ - { { SENSORS_LM93_TEMP##nr, "temp" #nr, NOMAP, NOMAP, R }, 1 }, \ - { { SENSORS_LM93_TEMP##nr##_MAX, "temp" #nr "_max", \ - SENSORS_LM93_TEMP##nr, SENSORS_LM93_TEMP##nr, RW }, 1 }, \ - { { SENSORS_LM93_TEMP##nr##_MIN, "temp" #nr "_min", \ - SENSORS_LM93_TEMP##nr, SENSORS_LM93_TEMP##nr, RW }, 1 } - -/* macro for LM93 VID entries */ -#define SENSORS_LM93_VID(nr) \ - { { SENSORS_LM93_VID##nr, "vid" #nr, NOMAP, NOMAP, R }, 3 } - -static sensors_chip_feature lm93_features[] = { - SENSORS_LM93_IN_MIN_MAX(1), - SENSORS_LM93_IN_MIN_MAX(2), - SENSORS_LM93_IN_MIN_MAX(3), - SENSORS_LM93_IN_MIN_MAX(4), - SENSORS_LM93_IN_MIN_MAX(5), - SENSORS_LM93_IN_MIN_MAX(6), - SENSORS_LM93_IN_MIN_MAX(7), - SENSORS_LM93_IN_MIN_MAX(8), - SENSORS_LM93_IN_MIN_MAX(9), - SENSORS_LM93_IN_MIN_MAX(10), - SENSORS_LM93_IN_MIN_MAX(11), - SENSORS_LM93_IN_MIN_MAX(12), - SENSORS_LM93_IN_MIN_MAX(13), - SENSORS_LM93_IN_MIN_MAX(14), - SENSORS_LM93_IN_MIN_MAX(15), - SENSORS_LM93_IN_MIN_MAX(16), - SENSORS_LM93_FAN_MIN(1), - SENSORS_LM93_FAN_MIN(2), - SENSORS_LM93_FAN_MIN(3), - SENSORS_LM93_FAN_MIN(4), - SENSORS_LM93_TEMP_MIN_MAX(1), - SENSORS_LM93_TEMP_MIN_MAX(2), - SENSORS_LM93_TEMP_MIN_MAX(3), - SENSORS_LM93_VID(1), - SENSORS_LM93_VID(2), - { { SENSORS_LM93_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } -}; - -/* macro for ASB100 Bach voltage in/min/max entries */ -#define SENSORS_ASB100_IN_MIN_MAX(nr) \ - { { SENSORS_ASB100_IN##nr, "in" #nr, NOMAP, NOMAP, R }, 2 }, \ - { { SENSORS_ASB100_IN##nr##_MIN, "in" #nr "_min", SENSORS_ASB100_IN##nr, \ - SENSORS_ASB100_IN##nr, RW }, 2 }, \ - { { SENSORS_ASB100_IN##nr##_MAX, "in" #nr "_max", SENSORS_ASB100_IN##nr, \ - SENSORS_ASB100_IN##nr, RW }, 2 } - -/* macro for ASB100 Bach fan/min/div entries */ -#define SENSORS_ASB100_FAN_MIN_DIV(nr, divmode) \ - { { SENSORS_ASB100_FAN##nr, "fan" #nr, NOMAP, \ - NOMAP, R}, 0 }, \ - { { SENSORS_ASB100_FAN##nr##_MIN, "fan" #nr "_min", \ - SENSORS_ASB100_FAN##nr, SENSORS_ASB100_FAN##nr, RW }, 0 }, \ - { { SENSORS_ASB100_FAN##nr##_DIV, "fan" #nr "_div", \ - SENSORS_ASB100_FAN##nr, NOMAP, divmode }, 0 } - -/* macro for ASB100 Bach temperature/overtemp/hysteresis entries */ -#define SENSORS_ASB100_TEMP_OVER_HYST(nr) \ - { { SENSORS_ASB100_TEMP##nr, "temp" #nr, NOMAP, \ - NOMAP, R }, 1 }, \ - { { SENSORS_ASB100_TEMP##nr##_OVER, "temp" #nr "_over", \ - SENSORS_ASB100_TEMP##nr, SENSORS_ASB100_TEMP##nr, RW }, 1 }, \ - { { SENSORS_ASB100_TEMP##nr##_HYST, "temp" #nr "_hyst", \ - SENSORS_ASB100_TEMP##nr, SENSORS_ASB100_TEMP##nr, RW }, 1 } - -static sensors_chip_feature asb100_features[] = { - SENSORS_ASB100_IN_MIN_MAX(0), - SENSORS_ASB100_IN_MIN_MAX(1), - SENSORS_ASB100_IN_MIN_MAX(2), - SENSORS_ASB100_IN_MIN_MAX(3), - SENSORS_ASB100_IN_MIN_MAX(4), - SENSORS_ASB100_IN_MIN_MAX(5), - SENSORS_ASB100_IN_MIN_MAX(6), - SENSORS_ASB100_FAN_MIN_DIV(1, RW), - SENSORS_ASB100_FAN_MIN_DIV(2, RW), - SENSORS_ASB100_FAN_MIN_DIV(3, RW), - SENSORS_ASB100_TEMP_OVER_HYST(1), - SENSORS_ASB100_TEMP_OVER_HYST(2), - SENSORS_ASB100_TEMP_OVER_HYST(3), - SENSORS_ASB100_TEMP_OVER_HYST(4), - { { SENSORS_ASB100_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ASB100_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_ASB100_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } -}; - -static sensors_chip_feature w83782d_features[] = - { - { { SENSORS_W83782D_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN7, "in7", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN8, "in8", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83782D_IN0_MIN, "in0_min", SENSORS_W83782D_IN0, - SENSORS_W83782D_IN0, RW }, - 2 }, - { { SENSORS_W83782D_IN1_MIN, "in1_min", SENSORS_W83782D_IN1, - SENSORS_W83782D_IN1, RW }, - 2 }, - { { SENSORS_W83782D_IN2_MIN, "in2_min", SENSORS_W83782D_IN2, - SENSORS_W83782D_IN2, RW }, - 2 }, - { { SENSORS_W83782D_IN3_MIN, "in3_min", SENSORS_W83782D_IN3, - SENSORS_W83782D_IN3, RW }, - 2 }, - { { SENSORS_W83782D_IN4_MIN, "in4_min", SENSORS_W83782D_IN4, - SENSORS_W83782D_IN4, RW }, - 2 }, - { { SENSORS_W83782D_IN5_MIN, "in5_min", SENSORS_W83782D_IN5, - SENSORS_W83782D_IN5, RW }, - 2 }, - { { SENSORS_W83782D_IN6_MIN, "in6_min", SENSORS_W83782D_IN6, - SENSORS_W83782D_IN6, RW }, - 2 }, - { { SENSORS_W83782D_IN7_MIN, "in7_min", SENSORS_W83782D_IN7, - SENSORS_W83782D_IN7, RW }, - 2 }, - { { SENSORS_W83782D_IN8_MIN, "in8_min", SENSORS_W83782D_IN8, - SENSORS_W83782D_IN8, RW }, - 2 }, - { { SENSORS_W83782D_IN0_MAX, "in0_max", SENSORS_W83782D_IN0, - SENSORS_W83782D_IN0, RW }, - 2 }, - { { SENSORS_W83782D_IN1_MAX, "in1_max", SENSORS_W83782D_IN1, - SENSORS_W83782D_IN1, RW }, - 2 }, - { { SENSORS_W83782D_IN2_MAX, "in2_max", SENSORS_W83782D_IN2, - SENSORS_W83782D_IN2, RW }, - 2 }, - { { SENSORS_W83782D_IN3_MAX, "in3_max", SENSORS_W83782D_IN3, - SENSORS_W83782D_IN3, RW }, - 2 }, - { { SENSORS_W83782D_IN4_MAX, "in4_max", SENSORS_W83782D_IN4, - SENSORS_W83782D_IN4, RW }, - 2 }, - { { SENSORS_W83782D_IN5_MAX, "in5_max", SENSORS_W83782D_IN5, - SENSORS_W83782D_IN5, RW }, - 2 }, - { { SENSORS_W83782D_IN6_MAX, "in6_max", SENSORS_W83782D_IN6, - SENSORS_W83782D_IN6, RW }, - 2 }, - { { SENSORS_W83782D_IN7_MAX, "in7_max", SENSORS_W83782D_IN7, - SENSORS_W83782D_IN7, RW }, - 2 }, - { { SENSORS_W83782D_IN8_MAX, "in8_max", SENSORS_W83782D_IN8, - SENSORS_W83782D_IN8, RW }, - 2 }, - { { SENSORS_W83782D_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83782D_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83781D_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83782D_FAN1_MIN, "fan1_min", SENSORS_W83782D_FAN1, - SENSORS_W83782D_FAN1, RW }, - 0 }, - { { SENSORS_W83782D_FAN2_MIN, "fan2_min", SENSORS_W83782D_FAN2, - SENSORS_W83782D_FAN2, RW }, - 0 }, - { { SENSORS_W83781D_FAN3_MIN, "fan3_min", SENSORS_W83781D_FAN3, - SENSORS_W83782D_FAN3, RW }, - 0 }, - { { SENSORS_W83782D_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83782D_TEMP1_HYST, "temp1_hyst", SENSORS_W83782D_TEMP1, - SENSORS_W83782D_TEMP1, RW }, - 1 }, - { { SENSORS_W83782D_TEMP1_OVER, "temp1_over", SENSORS_W83782D_TEMP1, - SENSORS_W83782D_TEMP1, RW }, - 1 }, - { { SENSORS_W83782D_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83782D_TEMP2_HYST, "temp2_hyst", SENSORS_W83782D_TEMP2, - SENSORS_W83782D_TEMP2, RW }, - 1 }, - { { SENSORS_W83782D_TEMP2_OVER, "temp2_over", SENSORS_W83782D_TEMP2, - SENSORS_W83782D_TEMP2, RW }, - 1 }, - { { SENSORS_W83782D_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83782D_TEMP3_HYST, "temp3_hyst", SENSORS_W83782D_TEMP3, - SENSORS_W83782D_TEMP3, RW }, - 1 }, - { { SENSORS_W83782D_TEMP3_OVER, "temp3_over", SENSORS_W83782D_TEMP3, - SENSORS_W83782D_TEMP3, RW }, - 1 }, - { { SENSORS_W83782D_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83782D_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_W83782D_FAN1_DIV, "fan1_div", SENSORS_W83782D_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_FAN2_DIV, "fan2_div", SENSORS_W83782D_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_FAN3_DIV, "fan3_div", SENSORS_W83781D_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83782D_BEEP_ENABLE, "beep_enable", SENSORS_W83782D_ALARMS, - NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_BEEPS, "beeps", SENSORS_W83782D_ALARMS, - SENSORS_W83782D_ALARMS, RW }, - 0 }, - { { SENSORS_W83782D_SENS1, "sensor1", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_SENS2, "sensor2", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_W83782D_SENS3, "sensor3", NOMAP, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature w83783s_features[] = - { - { { SENSORS_W83783S_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83783S_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83783S_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83783S_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83783S_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83783S_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83783S_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83783S_IN0_MIN, "in0_min", SENSORS_W83783S_IN0, - SENSORS_W83783S_IN0, RW }, - 2 }, - { { SENSORS_W83783S_IN1_MIN, "in1_min", SENSORS_W83783S_IN1, - SENSORS_W83783S_IN1, RW }, - 2 }, - { { SENSORS_W83783S_IN2_MIN, "in2_min", SENSORS_W83783S_IN2, - SENSORS_W83783S_IN2, RW }, - 2 }, - { { SENSORS_W83783S_IN3_MIN, "in3_min", SENSORS_W83783S_IN3, - SENSORS_W83783S_IN3, RW }, - 2 }, - { { SENSORS_W83783S_IN4_MIN, "in4_min", SENSORS_W83783S_IN4, - SENSORS_W83783S_IN4, RW }, - 2 }, - { { SENSORS_W83783S_IN5_MIN, "in5_min", SENSORS_W83783S_IN5, - SENSORS_W83783S_IN5, RW }, - 2 }, - { { SENSORS_W83783S_IN6_MIN, "in6_min", SENSORS_W83783S_IN6, - SENSORS_W83783S_IN6, RW }, - 2 }, - { { SENSORS_W83783S_IN0_MAX, "in0_max", SENSORS_W83783S_IN0, - SENSORS_W83783S_IN0, RW }, - 2 }, - { { SENSORS_W83783S_IN1_MAX, "in1_max", SENSORS_W83783S_IN1, - SENSORS_W83783S_IN1, RW }, - 2 }, - { { SENSORS_W83783S_IN2_MAX, "in2_max", SENSORS_W83783S_IN2, - SENSORS_W83783S_IN2, RW }, - 2 }, - { { SENSORS_W83783S_IN3_MAX, "in3_max", SENSORS_W83783S_IN3, - SENSORS_W83783S_IN3, RW }, - 2 }, - { { SENSORS_W83783S_IN4_MAX, "in4_max", SENSORS_W83783S_IN4, - SENSORS_W83783S_IN4, RW }, - 2 }, - { { SENSORS_W83783S_IN5_MAX, "in5_max", SENSORS_W83783S_IN5, - SENSORS_W83783S_IN5, RW }, - 2 }, - { { SENSORS_W83783S_IN6_MAX, "in6_max", SENSORS_W83783S_IN6, - SENSORS_W83783S_IN6, RW }, - 2 }, - { { SENSORS_W83783S_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83783S_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83783S_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83783S_FAN1_MIN, "fan1_min", SENSORS_W83783S_FAN1, - SENSORS_W83783S_FAN1, RW }, - 0 }, - { { SENSORS_W83783S_FAN2_MIN, "fan2_min", SENSORS_W83783S_FAN2, - SENSORS_W83783S_FAN2, RW }, - 0 }, - { { SENSORS_W83783S_FAN3_MIN, "fan3_min", SENSORS_W83783S_FAN3, - SENSORS_W83783S_FAN3, RW }, - 0 }, - { { SENSORS_W83782D_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83782D_TEMP1_HYST, "temp1_hyst", SENSORS_W83782D_TEMP1, - SENSORS_W83782D_TEMP1, RW }, - 1 }, - { { SENSORS_W83782D_TEMP1_OVER, "temp1_over", SENSORS_W83782D_TEMP1, - SENSORS_W83782D_TEMP1, RW }, - 1 }, - { { SENSORS_W83782D_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83782D_TEMP2_HYST, "temp2_hyst", SENSORS_W83782D_TEMP2, - SENSORS_W83782D_TEMP2, RW }, - 1 }, - { { SENSORS_W83782D_TEMP2_OVER, "temp2_over", SENSORS_W83782D_TEMP2, - SENSORS_W83782D_TEMP2, RW }, - 1 }, - { { SENSORS_W83783S_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83783S_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_W83783S_FAN1_DIV, "fan1_div", SENSORS_W83783S_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_W83783S_FAN2_DIV, "fan2_div", SENSORS_W83783S_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_W83783S_FAN3_DIV, "fan3_div", SENSORS_W83783S_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_W83783S_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83783S_BEEP_ENABLE, "beep_enable", SENSORS_W83783S_ALARMS, - NOMAP, RW }, - 0 }, - { { SENSORS_W83783S_BEEPS, "beeps", SENSORS_W83783S_ALARMS, - SENSORS_W83783S_ALARMS, RW }, - 0 }, - { { SENSORS_W83783S_SENS1, "sensor1", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_W83783S_SENS2, "sensor2", NOMAP, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature w83791d_features[] = - { - { { SENSORS_W83791D_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN7, "in7", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN8, "in8", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN9, "in9", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_W83791D_IN0_MIN, "in0_min", SENSORS_W83791D_IN0, - SENSORS_W83791D_IN0, RW }, - 2 }, - { { SENSORS_W83791D_IN1_MIN, "in1_min", SENSORS_W83791D_IN1, - SENSORS_W83791D_IN1, RW }, - 2 }, - { { SENSORS_W83791D_IN2_MIN, "in2_min", SENSORS_W83791D_IN2, - SENSORS_W83791D_IN2, RW }, - 2 }, - { { SENSORS_W83791D_IN3_MIN, "in3_min", SENSORS_W83791D_IN3, - SENSORS_W83791D_IN3, RW }, - 2 }, - { { SENSORS_W83791D_IN4_MIN, "in4_min", SENSORS_W83791D_IN4, - SENSORS_W83791D_IN4, RW }, - 2 }, - { { SENSORS_W83791D_IN5_MIN, "in5_min", SENSORS_W83791D_IN5, - SENSORS_W83791D_IN5, RW }, - 2 }, - { { SENSORS_W83791D_IN6_MIN, "in6_min", SENSORS_W83791D_IN6, - SENSORS_W83791D_IN6, RW }, - 2 }, - { { SENSORS_W83791D_IN7_MIN, "in7_min", SENSORS_W83791D_IN7, - SENSORS_W83791D_IN7, RW }, - 2 }, - { { SENSORS_W83791D_IN8_MIN, "in8_min", SENSORS_W83791D_IN8, - SENSORS_W83791D_IN8, RW }, - 2 }, - { { SENSORS_W83791D_IN9_MIN, "in9_min", SENSORS_W83791D_IN9, - SENSORS_W83791D_IN9, RW }, - 2 }, - { { SENSORS_W83791D_IN0_MAX, "in0_max", SENSORS_W83791D_IN0, - SENSORS_W83791D_IN0, RW }, - 2 }, - { { SENSORS_W83791D_IN1_MAX, "in1_max", SENSORS_W83791D_IN1, - SENSORS_W83791D_IN1, RW }, - 2 }, - { { SENSORS_W83791D_IN2_MAX, "in2_max", SENSORS_W83791D_IN2, - SENSORS_W83791D_IN2, RW }, - 2 }, - { { SENSORS_W83791D_IN3_MAX, "in3_max", SENSORS_W83791D_IN3, - SENSORS_W83791D_IN3, RW }, - 2 }, - { { SENSORS_W83791D_IN4_MAX, "in4_max", SENSORS_W83791D_IN4, - SENSORS_W83791D_IN4, RW }, - 2 }, - { { SENSORS_W83791D_IN5_MAX, "in5_max", SENSORS_W83791D_IN5, - SENSORS_W83791D_IN5, RW }, - 2 }, - { { SENSORS_W83791D_IN6_MAX, "in6_max", SENSORS_W83791D_IN6, - SENSORS_W83791D_IN6, RW }, - 2 }, - { { SENSORS_W83791D_IN7_MAX, "in7_max", SENSORS_W83791D_IN7, - SENSORS_W83791D_IN7, RW }, - 2 }, - { { SENSORS_W83791D_IN8_MAX, "in8_max", SENSORS_W83791D_IN8, - SENSORS_W83791D_IN8, RW }, - 2 }, - { { SENSORS_W83791D_IN9_MAX, "in9_max", SENSORS_W83791D_IN9, - SENSORS_W83791D_IN9, RW }, - 2 }, - { { SENSORS_W83791D_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83791D_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83791D_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83791D_FAN4, "fan4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83791D_FAN5, "fan5", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83791D_FAN1_MIN, "fan1_min", SENSORS_W83791D_FAN1, - SENSORS_W83791D_FAN1, RW }, - 0 }, - { { SENSORS_W83791D_FAN2_MIN, "fan2_min", SENSORS_W83791D_FAN2, - SENSORS_W83791D_FAN2, RW }, - 0 }, - { { SENSORS_W83791D_FAN3_MIN, "fan3_min", SENSORS_W83791D_FAN3, - SENSORS_W83791D_FAN3, RW }, - 0 }, - { { SENSORS_W83791D_FAN4_MIN, "fan4_min", SENSORS_W83791D_FAN4, - SENSORS_W83791D_FAN4, RW }, - 0 }, - { { SENSORS_W83791D_FAN5_MIN, "fan5_min", SENSORS_W83791D_FAN5, - SENSORS_W83791D_FAN5, RW }, - 0 }, - { { SENSORS_W83791D_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83791D_TEMP1_HYST, "temp1_hyst", SENSORS_W83791D_TEMP1, - SENSORS_W83791D_TEMP1, RW }, - 1 }, - { { SENSORS_W83791D_TEMP1_OVER, "temp1_over", SENSORS_W83791D_TEMP1, - SENSORS_W83791D_TEMP1, RW }, - 1 }, - { { SENSORS_W83791D_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83791D_TEMP2_HYST, "temp2_hyst", SENSORS_W83791D_TEMP2, - SENSORS_W83791D_TEMP2, RW }, - 1 }, - { { SENSORS_W83791D_TEMP2_OVER, "temp2_over", SENSORS_W83791D_TEMP2, - SENSORS_W83791D_TEMP2, RW }, - 1 }, - { { SENSORS_W83791D_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83791D_TEMP3_HYST, "temp3_hyst", SENSORS_W83791D_TEMP3, - SENSORS_W83791D_TEMP3, RW }, - 1 }, - { { SENSORS_W83791D_TEMP3_OVER, "temp3_over", SENSORS_W83791D_TEMP3, - SENSORS_W83791D_TEMP3, RW }, - 1 }, - { { SENSORS_W83791D_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83791D_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_W83791D_FAN1_DIV, "fan1_div", SENSORS_W83791D_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_W83791D_FAN2_DIV, "fan2_div", SENSORS_W83791D_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_W83791D_FAN3_DIV, "fan3_div", SENSORS_W83781D_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_W83791D_FAN4_DIV, "fan4_div", SENSORS_W83791D_FAN4, NOMAP, RW }, - 0 }, - { { SENSORS_W83791D_FAN5_DIV, "fan5_div", SENSORS_W83791D_FAN5, NOMAP, RW }, - 0 }, - { { SENSORS_W83791D_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83791D_BEEP_ENABLE, "beep_enable", SENSORS_W83791D_ALARMS, - NOMAP, RW }, - 0 }, - { { SENSORS_W83791D_BEEPS, "beeps", SENSORS_W83791D_ALARMS, - SENSORS_W83791D_ALARMS, RW }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature w83792d_features[] = - { - { { SENSORS_W83792D_IN0, "in0", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_IN1, "in1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_IN2, "in2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_IN3, "in3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_IN4, "in4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_IN5, "in5", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_IN6, "in6", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_IN7, "in7", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_IN8, "in8", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_IN0_MIN, "in0_min", SENSORS_W83792D_IN0, - SENSORS_W83792D_IN0, RW }, - 3 }, - { { SENSORS_W83792D_IN1_MIN, "in1_min", SENSORS_W83792D_IN1, - SENSORS_W83792D_IN1, RW }, - 3 }, - { { SENSORS_W83792D_IN2_MIN, "in2_min", SENSORS_W83792D_IN2, - SENSORS_W83792D_IN2, RW }, - 3 }, - { { SENSORS_W83792D_IN3_MIN, "in3_min", SENSORS_W83792D_IN3, - SENSORS_W83792D_IN3, RW }, - 3 }, - { { SENSORS_W83792D_IN4_MIN, "in4_min", SENSORS_W83792D_IN4, - SENSORS_W83792D_IN4, RW }, - 3 }, - { { SENSORS_W83792D_IN5_MIN, "in5_min", SENSORS_W83792D_IN5, - SENSORS_W83792D_IN5, RW }, - 3 }, - { { SENSORS_W83792D_IN6_MIN, "in6_min", SENSORS_W83792D_IN6, - SENSORS_W83792D_IN6, RW }, - 3 }, - { { SENSORS_W83792D_IN7_MIN, "in7_min", SENSORS_W83792D_IN7, - SENSORS_W83792D_IN7, RW }, - 3 }, - { { SENSORS_W83792D_IN8_MIN, "in8_min", SENSORS_W83792D_IN8, - SENSORS_W83792D_IN8, RW }, - 3 }, - { { SENSORS_W83792D_IN0_MAX, "in0_max", SENSORS_W83792D_IN0, - SENSORS_W83792D_IN0, RW }, - 3 }, - { { SENSORS_W83792D_IN1_MAX, "in1_max", SENSORS_W83792D_IN1, - SENSORS_W83792D_IN1, RW }, - 3 }, - { { SENSORS_W83792D_IN2_MAX, "in2_max", SENSORS_W83792D_IN2, - SENSORS_W83792D_IN2, RW }, - 3 }, - { { SENSORS_W83792D_IN3_MAX, "in3_max", SENSORS_W83792D_IN3, - SENSORS_W83792D_IN3, RW }, - 3 }, - { { SENSORS_W83792D_IN4_MAX, "in4_max", SENSORS_W83792D_IN4, - SENSORS_W83792D_IN4, RW }, - 3 }, - { { SENSORS_W83792D_IN5_MAX, "in5_max", SENSORS_W83792D_IN5, - SENSORS_W83792D_IN5, RW }, - 3 }, - { { SENSORS_W83792D_IN6_MAX, "in6_max", SENSORS_W83792D_IN6, - SENSORS_W83792D_IN6, RW }, - 3 }, - { { SENSORS_W83792D_IN7_MAX, "in7_max", SENSORS_W83792D_IN7, - SENSORS_W83792D_IN7, RW }, - 3 }, - { { SENSORS_W83792D_IN8_MAX, "in8_max", SENSORS_W83792D_IN8, - SENSORS_W83792D_IN8, RW }, - 3 }, - { { SENSORS_W83792D_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83792D_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83792D_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83792D_FAN4, "fan4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83792D_FAN5, "fan5", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83792D_FAN6, "fan6", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83792D_FAN7, "fan7", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83792D_FAN1_MIN, "fan1_min", SENSORS_W83792D_FAN1, - SENSORS_W83792D_FAN1, RW }, - 0 }, - { { SENSORS_W83792D_FAN2_MIN, "fan2_min", SENSORS_W83792D_FAN2, - SENSORS_W83792D_FAN2, RW }, - 0 }, - { { SENSORS_W83792D_FAN3_MIN, "fan3_min", SENSORS_W83792D_FAN3, - SENSORS_W83792D_FAN3, RW }, - 0 }, - { { SENSORS_W83792D_FAN4_MIN, "fan4_min", SENSORS_W83792D_FAN4, - SENSORS_W83792D_FAN4, RW }, - 0 }, - { { SENSORS_W83792D_FAN5_MIN, "fan5_min", SENSORS_W83792D_FAN5, - SENSORS_W83792D_FAN5, RW }, - 0 }, - { { SENSORS_W83792D_FAN6_MIN, "fan6_min", SENSORS_W83792D_FAN6, - SENSORS_W83792D_FAN6, RW }, - 0 }, - { { SENSORS_W83792D_FAN7_MIN, "fan7_min", SENSORS_W83792D_FAN7, - SENSORS_W83792D_FAN7, RW }, - 0 }, - { { SENSORS_W83792D_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83792D_TEMP1_HYST, "temp1_hyst", SENSORS_W83792D_TEMP1, - SENSORS_W83792D_TEMP1, RW }, - 1 }, - { { SENSORS_W83792D_TEMP1_OVER, "temp1_over", SENSORS_W83792D_TEMP1, - SENSORS_W83792D_TEMP1, RW }, - 1 }, - { { SENSORS_W83792D_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83792D_TEMP2_HYST, "temp2_hyst", SENSORS_W83792D_TEMP2, - SENSORS_W83792D_TEMP2, RW }, - 1 }, - { { SENSORS_W83792D_TEMP2_OVER, "temp2_over", SENSORS_W83792D_TEMP2, - SENSORS_W83792D_TEMP2, RW }, - 1 }, - { { SENSORS_W83792D_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83792D_TEMP3_HYST, "temp3_hyst", SENSORS_W83792D_TEMP3, - SENSORS_W83792D_TEMP3, RW }, - 1 }, - { { SENSORS_W83792D_TEMP3_OVER, "temp3_over", SENSORS_W83792D_TEMP3, - SENSORS_W83792D_TEMP3, RW }, - 1 }, - /* { { SENSORS_W83792D_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83792D_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, */ - { { SENSORS_W83792D_CHASSIS, "chassis", SENSORS_W83792D_CHASSIS, NOMAP, RW }, - 0 }, - { { SENSORS_W83792D_FAN1_DIV, "fan1_div", SENSORS_W83792D_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_W83792D_FAN2_DIV, "fan2_div", SENSORS_W83792D_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_W83792D_FAN3_DIV, "fan3_div", SENSORS_W83792D_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_W83792D_FAN4_DIV, "fan4_div", SENSORS_W83792D_FAN4, NOMAP, RW }, - 0 }, - { { SENSORS_W83792D_FAN5_DIV, "fan5_div", SENSORS_W83792D_FAN5, NOMAP, RW }, - 0 }, - { { SENSORS_W83792D_FAN6_DIV, "fan6_div", SENSORS_W83792D_FAN6, NOMAP, RW }, - 0 }, - { { SENSORS_W83792D_FAN7_DIV, "fan7_div", SENSORS_W83792D_FAN7, NOMAP, RW }, - 0 }, - { { SENSORS_W83792D_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - - -/* w83793 */ -#define SENSORS_W83793_FEATURES_IN(nr) \ - { { SENSORS_W83793_IN(nr), "in" #nr, NOMAP, NOMAP, R }, \ - 3 }, \ - { { SENSORS_W83793_IN_MIN(nr), "in" #nr "_min", \ - SENSORS_W83793_IN(nr), SENSORS_W83793_IN(nr), RW }, \ - 3 }, \ - { { SENSORS_W83793_IN_MAX(nr), "in" #nr "_max", \ - SENSORS_W83793_IN(nr), SENSORS_W83793_IN(nr), RW }, \ - 3 }, \ - { { SENSORS_W83793_IN_ALARM(nr), "in" #nr "_alarm", \ - SENSORS_W83793_IN(nr), NOMAP, R}, \ - 0 } - -#define SENSORS_W83793_FEATURES_FAN(nr) \ - { { SENSORS_W83793_FAN(nr), "fan" #nr, NOMAP, NOMAP, R }, \ - 0 }, \ - { { SENSORS_W83793_FAN_MIN(nr), "fan" #nr "_min", \ - SENSORS_W83793_FAN(nr), SENSORS_W83793_FAN(nr), RW }, \ - 0 }, \ - { { SENSORS_W83793_FAN_ALARM(nr), "fan" #nr "_alarm", \ - SENSORS_W83793_FAN(nr), NOMAP, R }, \ - 0 } - -#define SENSORS_W83793_FEATURES_TEMP(nr) \ - { { SENSORS_W83793_TEMP(nr), "temp" #nr, NOMAP, NOMAP, R }, \ - 3 }, \ - { { SENSORS_W83793_TEMP_CRIT(nr), "temp" #nr "_max", \ - SENSORS_W83793_TEMP(nr), SENSORS_W83793_TEMP(nr), RW }, \ - 3 }, \ - { { SENSORS_W83793_TEMP_CRIT_HYST(nr), "temp" #nr "_max_hyst", \ - SENSORS_W83793_TEMP(nr), SENSORS_W83793_TEMP(nr), \ - RW }, \ - 3 }, \ - { { SENSORS_W83793_TEMP_ALARM(nr), "temp" #nr "_alarm", \ - SENSORS_W83793_TEMP(nr), NOMAP, R }, \ - 0 } - -static sensors_chip_feature w83793_features[] = -{ - SENSORS_W83793_FEATURES_IN(0), - SENSORS_W83793_FEATURES_IN(1), - SENSORS_W83793_FEATURES_IN(2), - SENSORS_W83793_FEATURES_IN(3), - SENSORS_W83793_FEATURES_IN(4), - SENSORS_W83793_FEATURES_IN(5), - SENSORS_W83793_FEATURES_IN(6), - SENSORS_W83793_FEATURES_IN(7), - SENSORS_W83793_FEATURES_IN(8), - SENSORS_W83793_FEATURES_IN(9), - SENSORS_W83793_FEATURES_FAN(1), - SENSORS_W83793_FEATURES_FAN(2), - SENSORS_W83793_FEATURES_FAN(3), - SENSORS_W83793_FEATURES_FAN(4), - SENSORS_W83793_FEATURES_FAN(5), - SENSORS_W83793_FEATURES_FAN(6), - SENSORS_W83793_FEATURES_FAN(7), - SENSORS_W83793_FEATURES_FAN(8), - SENSORS_W83793_FEATURES_FAN(9), - SENSORS_W83793_FEATURES_FAN(10), - SENSORS_W83793_FEATURES_FAN(11), - SENSORS_W83793_FEATURES_FAN(12), - SENSORS_W83793_FEATURES_TEMP(1), - SENSORS_W83793_FEATURES_TEMP(2), - SENSORS_W83793_FEATURES_TEMP(3), - SENSORS_W83793_FEATURES_TEMP(4), - SENSORS_W83793_FEATURES_TEMP(5), - SENSORS_W83793_FEATURES_TEMP(6), - { { SENSORS_W83793_VID0, "cpu0_vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83793_VID1, "cpu1_vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83793_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_W83793_CHASSIS, "chassis", NOMAP, NOMAP, RW }, - 0 }, - { { 0 }, 0 } -}; - - -static sensors_chip_feature w83l785ts_features[] = - { - { { SENSORS_W83L785TS_TEMP, "temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83L785TS_TEMP_OVER, "temp_over", SENSORS_W83L785TS_TEMP, - SENSORS_W83L785TS_TEMP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature w83627ehf_features[] = - { - { { SENSORS_W83627EHF_IN0, "in0", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN1, "in1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN2, "in2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN3, "in3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN4, "in4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN5, "in5", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN6, "in6", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN7, "in7", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN8, "in8", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN9, "in9", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_W83627EHF_IN0_ALARM, "in0_alarm", SENSORS_W83627EHF_IN0, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN1_ALARM, "in1_alarm", SENSORS_W83627EHF_IN1, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN2_ALARM, "in2_alarm", SENSORS_W83627EHF_IN2, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN3_ALARM, "in3_alarm", SENSORS_W83627EHF_IN3, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN4_ALARM, "in4_alarm", SENSORS_W83627EHF_IN4, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN5_ALARM, "in5_alarm", SENSORS_W83627EHF_IN5, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN6_ALARM, "in6_alarm", SENSORS_W83627EHF_IN6, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN7_ALARM, "in7_alarm", SENSORS_W83627EHF_IN7, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN8_ALARM, "in8_alarm", SENSORS_W83627EHF_IN8, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN9_ALARM, "in9_alarm", SENSORS_W83627EHF_IN9, NOMAP, - R }, - 0 }, - { { SENSORS_W83627EHF_IN0_MIN, "in0_min", SENSORS_W83627EHF_IN0, - SENSORS_W83627EHF_IN0, RW }, - 3 }, - { { SENSORS_W83627EHF_IN1_MIN, "in1_min", SENSORS_W83627EHF_IN1, - SENSORS_W83627EHF_IN1, RW }, - 3 }, - { { SENSORS_W83627EHF_IN2_MIN, "in2_min", SENSORS_W83627EHF_IN2, - SENSORS_W83627EHF_IN2, RW }, - 3 }, - { { SENSORS_W83627EHF_IN3_MIN, "in3_min", SENSORS_W83627EHF_IN3, - SENSORS_W83627EHF_IN3, RW }, - 3 }, - { { SENSORS_W83627EHF_IN4_MIN, "in4_min", SENSORS_W83627EHF_IN4, - SENSORS_W83627EHF_IN4, RW }, - 3 }, - { { SENSORS_W83627EHF_IN5_MIN, "in5_min", SENSORS_W83627EHF_IN5, - SENSORS_W83627EHF_IN5, RW }, - 3 }, - { { SENSORS_W83627EHF_IN6_MIN, "in6_min", SENSORS_W83627EHF_IN6, - SENSORS_W83627EHF_IN6, RW }, - 3 }, - { { SENSORS_W83627EHF_IN7_MIN, "in7_min", SENSORS_W83627EHF_IN7, - SENSORS_W83627EHF_IN7, RW }, - 3 }, - { { SENSORS_W83627EHF_IN8_MIN, "in8_min", SENSORS_W83627EHF_IN8, - SENSORS_W83627EHF_IN8, RW }, - 3 }, - { { SENSORS_W83627EHF_IN9_MIN, "in9_min", SENSORS_W83627EHF_IN9, - SENSORS_W83627EHF_IN9, RW }, - 3 }, - { { SENSORS_W83627EHF_IN0_MAX, "in0_max", SENSORS_W83627EHF_IN0, - SENSORS_W83627EHF_IN0, RW }, - 3 }, - { { SENSORS_W83627EHF_IN1_MAX, "in1_max", SENSORS_W83627EHF_IN1, - SENSORS_W83627EHF_IN1, RW }, - 3 }, - { { SENSORS_W83627EHF_IN2_MAX, "in2_max", SENSORS_W83627EHF_IN2, - SENSORS_W83627EHF_IN2, RW }, - 3 }, - { { SENSORS_W83627EHF_IN3_MAX, "in3_max", SENSORS_W83627EHF_IN3, - SENSORS_W83627EHF_IN3, RW }, - 3 }, - { { SENSORS_W83627EHF_IN4_MAX, "in4_max", SENSORS_W83627EHF_IN4, - SENSORS_W83627EHF_IN4, RW }, - 3 }, - { { SENSORS_W83627EHF_IN5_MAX, "in5_max", SENSORS_W83627EHF_IN5, - SENSORS_W83627EHF_IN5, RW }, - 3 }, - { { SENSORS_W83627EHF_IN6_MAX, "in6_max", SENSORS_W83627EHF_IN6, - SENSORS_W83627EHF_IN6, RW }, - 3 }, - { { SENSORS_W83627EHF_IN7_MAX, "in7_max", SENSORS_W83627EHF_IN7, - SENSORS_W83627EHF_IN7, RW }, - 3 }, - { { SENSORS_W83627EHF_IN8_MAX, "in8_max", SENSORS_W83627EHF_IN8, - SENSORS_W83627EHF_IN8, RW }, - 3 }, - { { SENSORS_W83627EHF_IN9_MAX, "in9_max", SENSORS_W83627EHF_IN9, - SENSORS_W83627EHF_IN9, RW }, - 3 }, - { { SENSORS_W83627EHF_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN4, "fan4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN5, "fan5", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN1_ALARM, "fan1_alarm", SENSORS_W83627EHF_FAN1, - NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN2_ALARM, "fan2_alarm", SENSORS_W83627EHF_FAN2, - NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN3_ALARM, "fan3_alarm", SENSORS_W83627EHF_FAN3, - NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN4_ALARM, "fan4_alarm", SENSORS_W83627EHF_FAN4, - NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN5_ALARM, "fan5_alarm", SENSORS_W83627EHF_FAN5, - NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN1_MIN, "fan1_min", SENSORS_W83627EHF_FAN1, - SENSORS_W83627EHF_FAN1, RW }, - 0 }, - { { SENSORS_W83627EHF_FAN2_MIN, "fan2_min", SENSORS_W83627EHF_FAN2, - SENSORS_W83627EHF_FAN2, RW }, - 0 }, - { { SENSORS_W83627EHF_FAN3_MIN, "fan3_min", SENSORS_W83627EHF_FAN3, - SENSORS_W83627EHF_FAN3, RW }, - 0 }, - { { SENSORS_W83627EHF_FAN4_MIN, "fan4_min", SENSORS_W83627EHF_FAN4, - SENSORS_W83627EHF_FAN4, RW }, - 0 }, - { { SENSORS_W83627EHF_FAN5_MIN, "fan5_min", SENSORS_W83627EHF_FAN5, - SENSORS_W83627EHF_FAN5, RW }, - 0 }, - { { SENSORS_W83627EHF_FAN1_DIV, "fan1_div", SENSORS_W83627EHF_FAN1, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN2_DIV, "fan2_div", SENSORS_W83627EHF_FAN2, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN3_DIV, "fan3_div", SENSORS_W83627EHF_FAN3, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN4_DIV, "fan4_div", SENSORS_W83627EHF_FAN4, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_FAN5_DIV, "fan5_div", SENSORS_W83627EHF_FAN5, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_TEMP1, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83627EHF_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_W83627EHF_TEMP1_ALARM, "temp1_alarm", SENSORS_W83627EHF_TEMP1, - NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_TEMP2_ALARM, "temp2_alarm", SENSORS_W83627EHF_TEMP2, - NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_TEMP3_ALARM, "temp3_alarm", SENSORS_W83627EHF_TEMP3, - NOMAP, R }, - 0 }, - { { SENSORS_W83627EHF_TEMP1_OVER, "temp1_over", SENSORS_W83627EHF_TEMP1, - SENSORS_W83627EHF_TEMP1, RW }, - 0 }, - { { SENSORS_W83627EHF_TEMP2_OVER, "temp2_over", SENSORS_W83627EHF_TEMP2, - SENSORS_W83627EHF_TEMP2, RW }, - 1 }, - { { SENSORS_W83627EHF_TEMP3_OVER, "temp3_over", SENSORS_W83627EHF_TEMP3, - SENSORS_W83627EHF_TEMP3, RW }, - 1 }, - { { SENSORS_W83627EHF_TEMP1_HYST, "temp1_hyst", SENSORS_W83627EHF_TEMP1, - SENSORS_W83627EHF_TEMP1, RW }, - 0 }, - { { SENSORS_W83627EHF_TEMP2_HYST, "temp2_hyst", SENSORS_W83627EHF_TEMP2, - SENSORS_W83627EHF_TEMP2, RW }, - 1 }, - { { SENSORS_W83627EHF_TEMP3_HYST, "temp3_hyst", SENSORS_W83627EHF_TEMP3, - SENSORS_W83627EHF_TEMP3, RW }, - 1 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature adm9240_features[] = - { - { { SENSORS_ADM9240_IN0, "2.5V", NOMAP, NOMAP, R }, - 2, "in0_input", 3 }, - { { SENSORS_ADM9240_IN1, "Vccp1", NOMAP, NOMAP, R }, - 2, "in1_input", 3 }, - { { SENSORS_ADM9240_IN2, "3.3V", NOMAP, NOMAP, R }, - 2, "in2_input", 3 }, - { { SENSORS_ADM9240_IN3, "5V", NOMAP, NOMAP, R }, - 2, "in3_input", 3 }, - { { SENSORS_ADM9240_IN4, "12V", NOMAP, NOMAP, R }, - 2, "in4_input", 3 }, - { { SENSORS_ADM9240_IN5, "Vccp2", NOMAP, NOMAP, R }, - 2, "in5_input", 3 }, - { { SENSORS_ADM9240_IN0_MIN, "2.5V_min", SENSORS_ADM9240_IN0, - SENSORS_ADM9240_IN0, RW }, - 2, "in0_min", 3 }, - { { SENSORS_ADM9240_IN1_MIN, "Vccp1_min", SENSORS_ADM9240_IN1, - SENSORS_ADM9240_IN1, RW }, - 2, "in1_min", 3 }, - { { SENSORS_ADM9240_IN2_MIN, "3.3V_min", SENSORS_ADM9240_IN2, - SENSORS_ADM9240_IN2, RW }, - 2, "in2_min", 3 }, - { { SENSORS_ADM9240_IN3_MIN, "5V_min", SENSORS_ADM9240_IN3, - SENSORS_ADM9240_IN3, RW }, - 2, "in3_min", 3 }, - { { SENSORS_ADM9240_IN4_MIN, "12V_min", SENSORS_ADM9240_IN4, - SENSORS_ADM9240_IN4, RW }, - 2, "in4_min", 3 }, - { { SENSORS_ADM9240_IN5_MIN, "Vccp2_min", SENSORS_ADM9240_IN5, - SENSORS_ADM9240_IN5, RW }, - 2, "in5_min", 3 }, - { { SENSORS_ADM9240_IN0_MAX, "2.5V_max", SENSORS_ADM9240_IN0, - SENSORS_ADM9240_IN0, RW }, - 2, "in0_max", 3 }, - { { SENSORS_ADM9240_IN1_MAX, "Vccp1_max", SENSORS_ADM9240_IN1, - SENSORS_ADM9240_IN1, RW }, - 2, "in1_max", 3 }, - { { SENSORS_ADM9240_IN2_MAX, "3.3V_max", SENSORS_ADM9240_IN2, - SENSORS_ADM9240_IN2, RW }, - 2, "in2_max", 3 }, - { { SENSORS_ADM9240_IN3_MAX, "5V_max", SENSORS_ADM9240_IN3, - SENSORS_ADM9240_IN3, RW }, - 2, "in3_max", 3 }, - { { SENSORS_ADM9240_IN4_MAX, "12V_max", SENSORS_ADM9240_IN4, - SENSORS_ADM9240_IN4, RW }, - 2, "in4_max", 3 }, - { { SENSORS_ADM9240_IN5_MAX, "Vccp2_max", SENSORS_ADM9240_IN5, - SENSORS_ADM9240_IN5, RW }, - 2, "in5_max", 3 }, - { { SENSORS_ADM9240_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM9240_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM9240_FAN1_MIN, "fan1_min", SENSORS_ADM9240_FAN1, - SENSORS_ADM9240_FAN1, RW }, - 0 }, - { { SENSORS_ADM9240_FAN2_MIN, "fan2_min", SENSORS_ADM9240_FAN2, - SENSORS_ADM9240_FAN2, RW }, - 0 }, - { { SENSORS_ADM9240_TEMP, "temp", NOMAP, NOMAP, R }, - 1, "temp1_input", - 3 }, - { { SENSORS_ADM9240_TEMP_HYST, "temp_hyst", SENSORS_ADM9240_TEMP, - SENSORS_ADM9240_TEMP, RW }, - 1, - "temp1_max_hyst", 3 }, - { { SENSORS_ADM9240_TEMP_OVER, "temp_over", SENSORS_ADM9240_TEMP, - SENSORS_ADM9240_TEMP, RW }, - 1, "temp1_max", - 3 }, - - { { SENSORS_ADM9240_VID, "vid", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM9240_FAN1_DIV, "fan1_div", SENSORS_ADM9240_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_ADM9240_FAN2_DIV, "fan2_div", SENSORS_ADM9240_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_ADM9240_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM9240_ANALOG_OUT, "analog_out", NOMAP, NOMAP, RW }, - 0, - "aout_output", 3 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature adm1024_features[] = - { - { { SENSORS_ADM1024_IN0, "2.5V", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1024_IN1, "Vccp1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1024_IN2, "3.3V", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1024_IN3, "5V", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1024_IN4, "12V", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1024_IN5, "Vccp2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1024_IN0_MIN, "2.5V_min", SENSORS_ADM1024_IN0, - SENSORS_ADM1024_IN0, RW }, - 2 }, - { { SENSORS_ADM1024_IN1_MIN, "Vccp1_min", SENSORS_ADM1024_IN1, - SENSORS_ADM1024_IN1, RW }, - 2 }, - { { SENSORS_ADM1024_IN2_MIN, "3.3V_min", SENSORS_ADM1024_IN2, - SENSORS_ADM1024_IN2, RW }, - 2 }, - { { SENSORS_ADM1024_IN3_MIN, "5V_min", SENSORS_ADM1024_IN3, - SENSORS_ADM1024_IN3, RW }, - 2 }, - { { SENSORS_ADM1024_IN4_MIN, "12V_min", SENSORS_ADM1024_IN4, - SENSORS_ADM1024_IN4, RW }, - 2 }, - { { SENSORS_ADM1024_IN5_MIN, "Vccp2_min", SENSORS_ADM1024_IN5, - SENSORS_ADM1024_IN5, RW }, - 2 }, - { { SENSORS_ADM1024_IN0_MAX, "2.5V_max", SENSORS_ADM1024_IN0, - SENSORS_ADM1024_IN0, RW }, - 2 }, - { { SENSORS_ADM1024_IN1_MAX, "Vccp1_max", SENSORS_ADM1024_IN1, - SENSORS_ADM1024_IN1, RW }, - 2 }, - { { SENSORS_ADM1024_IN2_MAX, "3.3V_max", SENSORS_ADM1024_IN2, - SENSORS_ADM1024_IN2, RW }, - 2 }, - { { SENSORS_ADM1024_IN3_MAX, "5V_max", SENSORS_ADM1024_IN3, - SENSORS_ADM1024_IN3, RW }, - 2 }, - { { SENSORS_ADM1024_IN4_MAX, "12V_max", SENSORS_ADM1024_IN4, - SENSORS_ADM1024_IN4, RW }, - 2 }, - { { SENSORS_ADM1024_IN5_MAX, "Vccp2_max", SENSORS_ADM1024_IN5, - SENSORS_ADM1024_IN5, RW }, - 2 }, - { { SENSORS_ADM1024_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1024_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1024_FAN1_MIN, "fan1_min", SENSORS_ADM1024_FAN1, - SENSORS_ADM1024_FAN1, RW }, - 0 }, - { { SENSORS_ADM1024_FAN2_MIN, "fan2_min", SENSORS_ADM1024_FAN2, - SENSORS_ADM1024_FAN2, RW }, - 0 }, - { { SENSORS_ADM1024_TEMP, "temp", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_ADM1024_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_ADM1024_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_ADM1024_TEMP_HYST, "temp_hyst", SENSORS_ADM1024_TEMP, - SENSORS_ADM1024_TEMP, RW }, - 1 }, - { { SENSORS_ADM1024_TEMP_OVER, "temp_over", SENSORS_ADM1024_TEMP, - SENSORS_ADM1024_TEMP, RW }, - 1 }, - { { SENSORS_ADM1024_TEMP1_HYST, "temp1_hyst", SENSORS_ADM1024_TEMP1, - SENSORS_ADM1024_TEMP1, RW }, - 1 }, - { { SENSORS_ADM1024_TEMP1_OVER, "temp1_over", SENSORS_ADM1024_TEMP1, - SENSORS_ADM1024_TEMP1, RW }, - 1 }, - { { SENSORS_ADM1024_TEMP2_HYST, "temp2_hyst", SENSORS_ADM1024_TEMP2, - SENSORS_ADM1024_TEMP2, RW }, - 1 }, - { { SENSORS_ADM1024_TEMP2_OVER, "temp2_over", SENSORS_ADM1024_TEMP2, - SENSORS_ADM1024_TEMP2, RW }, - 1 }, - - { { SENSORS_ADM1024_VID, "vid", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1024_FAN1_DIV, "fan1_div", SENSORS_ADM1024_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1024_FAN2_DIV, "fan2_div", SENSORS_ADM1024_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1024_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1024_ANALOG_OUT, "analog_out", NOMAP, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature sis5595_features[] = - { - { { SENSORS_SIS5595_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_SIS5595_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_SIS5595_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_SIS5595_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_SIS5595_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_SIS5595_IN0_MIN, "in0_min", SENSORS_SIS5595_IN0, - SENSORS_SIS5595_IN0, RW }, - 2 }, - { { SENSORS_SIS5595_IN1_MIN, "in1_min", SENSORS_SIS5595_IN1, - SENSORS_SIS5595_IN1, RW }, - 2 }, - { { SENSORS_SIS5595_IN2_MIN, "in2_min", SENSORS_SIS5595_IN2, - SENSORS_SIS5595_IN2, RW }, - 2 }, - { { SENSORS_SIS5595_IN3_MIN, "in3_min", SENSORS_SIS5595_IN3, - SENSORS_SIS5595_IN3, RW }, - 2 }, - { { SENSORS_SIS5595_IN4_MIN, "in4_min", SENSORS_SIS5595_IN4, - SENSORS_SIS5595_IN4, RW }, - 2 }, - { { SENSORS_SIS5595_IN0_MAX, "in0_max", SENSORS_SIS5595_IN0, - SENSORS_SIS5595_IN0, RW }, - 2 }, - { { SENSORS_SIS5595_IN1_MAX, "in1_max", SENSORS_SIS5595_IN1, - SENSORS_SIS5595_IN1, RW }, - 2 }, - { { SENSORS_SIS5595_IN2_MAX, "in2_max", SENSORS_SIS5595_IN2, - SENSORS_SIS5595_IN2, RW }, - 2 }, - { { SENSORS_SIS5595_IN3_MAX, "in3_max", SENSORS_SIS5595_IN3, - SENSORS_SIS5595_IN3, RW }, - 2 }, - { { SENSORS_SIS5595_IN4_MAX, "in4_max", SENSORS_SIS5595_IN4, - SENSORS_SIS5595_IN4, RW }, - 2 }, - { { SENSORS_SIS5595_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SIS5595_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SIS5595_FAN1_MIN, "fan1_min", SENSORS_SIS5595_FAN1, - SENSORS_SIS5595_FAN1, RW }, - 0 }, - { { SENSORS_SIS5595_FAN2_MIN, "fan2_min", SENSORS_SIS5595_FAN2, - SENSORS_SIS5595_FAN2, RW }, - 0 }, - { { SENSORS_SIS5595_TEMP, "temp", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_SIS5595_TEMP_HYST, "temp_hyst", SENSORS_SIS5595_TEMP, - SENSORS_SIS5595_TEMP, RW }, - 1 }, - { { SENSORS_SIS5595_TEMP_OVER, "temp_over", SENSORS_SIS5595_TEMP, - SENSORS_SIS5595_TEMP, RW }, - 1 }, - { { SENSORS_SIS5595_FAN1_DIV, "fan1_div", SENSORS_SIS5595_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_SIS5595_FAN2_DIV, "fan2_div", SENSORS_SIS5595_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_SIS5595_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature maxi_cg_features[] = - { - { { SENSORS_MAXI_CG_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CG_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CG_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CG_FAN1_MIN, "fan1_min", SENSORS_MAXI_CG_FAN1, - SENSORS_MAXI_CG_FAN1, RW }, - 0 }, - { { SENSORS_MAXI_CG_FAN2_MIN, "fan2_min", SENSORS_MAXI_CG_FAN2, - SENSORS_MAXI_CG_FAN2, RW }, - 0 }, - { { SENSORS_MAXI_CG_FAN3_MIN, "fan3_min", SENSORS_MAXI_CG_FAN3, - SENSORS_MAXI_CG_FAN3, RW }, - 0 }, - { { SENSORS_MAXI_CG_FAN1_DIV, "fan1_div", SENSORS_MAXI_CG_FAN1, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CG_FAN2_DIV, "fan2_div", SENSORS_MAXI_CG_FAN2, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CG_FAN3_DIV, "fan3_div", SENSORS_MAXI_CG_FAN3, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CG_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP4, "temp4", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP5, "temp5", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP1_MAX, "temp1_max", SENSORS_MAXI_CG_TEMP1, - SENSORS_MAXI_CG_TEMP1, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP2_MAX, "temp2_max", SENSORS_MAXI_CG_TEMP2, - SENSORS_MAXI_CG_TEMP2, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP3_MAX, "temp3_max", SENSORS_MAXI_CG_TEMP3, - SENSORS_MAXI_CG_TEMP3, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP4_MAX, "temp4_max", SENSORS_MAXI_CG_TEMP4, - SENSORS_MAXI_CG_TEMP4, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP5_MAX, "temp5_max", SENSORS_MAXI_CG_TEMP5, - SENSORS_MAXI_CG_TEMP5, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP1_HYST, "temp1_hyst", SENSORS_MAXI_CG_TEMP1, - SENSORS_MAXI_CG_TEMP1, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP2_HYST, "temp2_hyst", SENSORS_MAXI_CG_TEMP2, - SENSORS_MAXI_CG_TEMP2, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP3_HYST, "temp3_hyst", SENSORS_MAXI_CG_TEMP3, - SENSORS_MAXI_CG_TEMP3, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP4_HYST, "temp4_hyst", SENSORS_MAXI_CG_TEMP4, - SENSORS_MAXI_CG_TEMP4, R }, - 1 }, - { { SENSORS_MAXI_CG_TEMP5_HYST, "temp5_hyst", SENSORS_MAXI_CG_TEMP5, - SENSORS_MAXI_CG_TEMP5, R }, - 1 }, - { { SENSORS_MAXI_CG_PLL, "pll", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MAXI_CG_PLL_MIN, "pll_min", SENSORS_MAXI_CG_PLL, - SENSORS_MAXI_CG_PLL, RW }, - 2 }, - { { SENSORS_MAXI_CG_PLL_MAX, "pll_max", SENSORS_MAXI_CG_PLL, - SENSORS_MAXI_CG_PLL, RW }, - 2 }, - { { SENSORS_MAXI_CG_VID1, "vid1", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_CG_VID2, "vid2", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_CG_VID3, "vid3", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_CG_VID4, "vid4", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_CG_VID1_MIN, "vid1_min", SENSORS_MAXI_CG_VID1, - SENSORS_MAXI_CG_VID1, RW }, - 4 }, - { { SENSORS_MAXI_CG_VID2_MIN, "vid2_min", SENSORS_MAXI_CG_VID2, - SENSORS_MAXI_CG_VID2, RW }, - 4 }, - { { SENSORS_MAXI_CG_VID3_MIN, "vid3_min", SENSORS_MAXI_CG_VID3, - SENSORS_MAXI_CG_VID3, RW }, - 4 }, - { { SENSORS_MAXI_CG_VID4_MIN, "vid4_min", SENSORS_MAXI_CG_VID4, - SENSORS_MAXI_CG_VID4, RW }, - 4 }, - { { SENSORS_MAXI_CG_VID1_MAX, "vid1_max", SENSORS_MAXI_CG_VID1, - SENSORS_MAXI_CG_VID1, RW }, - 4 }, - { { SENSORS_MAXI_CG_VID2_MAX, "vid2_max", SENSORS_MAXI_CG_VID2, - SENSORS_MAXI_CG_VID2, RW }, - 4 }, - { { SENSORS_MAXI_CG_VID3_MAX, "vid3_max", SENSORS_MAXI_CG_VID3, - SENSORS_MAXI_CG_VID3, RW }, - 4 }, - { { SENSORS_MAXI_CG_VID4_MAX, "vid4_max", SENSORS_MAXI_CG_VID4, - SENSORS_MAXI_CG_VID4, RW }, - 4 }, - { { SENSORS_MAXI_CG_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature maxi_co_features[] = - { - { { SENSORS_MAXI_CO_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CO_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CO_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CO_FAN1_MIN, "fan1_min", SENSORS_MAXI_CO_FAN1, - SENSORS_MAXI_CO_FAN1, RW }, - 0 }, - { { SENSORS_MAXI_CO_FAN2_MIN, "fan2_min", SENSORS_MAXI_CO_FAN2, - SENSORS_MAXI_CO_FAN2, RW }, - 0 }, - { { SENSORS_MAXI_CO_FAN3_MIN, "fan3_min", SENSORS_MAXI_CO_FAN3, - SENSORS_MAXI_CO_FAN3, RW }, - 0 }, - { { SENSORS_MAXI_CO_FAN1_DIV, "fan1_div", SENSORS_MAXI_CO_FAN1, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CO_FAN2_DIV, "fan2_div", SENSORS_MAXI_CO_FAN2, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CO_FAN3_DIV, "fan3_div", SENSORS_MAXI_CO_FAN3, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_CO_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP4, "temp4", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP5, "temp5", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP1_MAX, "temp1_max", SENSORS_MAXI_CO_TEMP1, - SENSORS_MAXI_CO_TEMP1, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP2_MAX, "temp2_max", SENSORS_MAXI_CO_TEMP2, - SENSORS_MAXI_CO_TEMP2, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP3_MAX, "temp3_max", SENSORS_MAXI_CO_TEMP3, - SENSORS_MAXI_CO_TEMP3, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP4_MAX, "temp4_max", SENSORS_MAXI_CO_TEMP4, - SENSORS_MAXI_CO_TEMP4, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP5_MAX, "temp5_max", SENSORS_MAXI_CO_TEMP5, - SENSORS_MAXI_CO_TEMP5, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP1_HYST, "temp1_hyst", SENSORS_MAXI_CO_TEMP1, - SENSORS_MAXI_CO_TEMP1, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP2_HYST, "temp2_hyst", SENSORS_MAXI_CO_TEMP2, - SENSORS_MAXI_CO_TEMP2, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP3_HYST, "temp3_hyst", SENSORS_MAXI_CO_TEMP3, - SENSORS_MAXI_CO_TEMP3, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP4_HYST, "temp4_hyst", SENSORS_MAXI_CO_TEMP4, - SENSORS_MAXI_CO_TEMP4, R }, - 1 }, - { { SENSORS_MAXI_CO_TEMP5_HYST, "temp5_hyst", SENSORS_MAXI_CO_TEMP5, - SENSORS_MAXI_CO_TEMP5, R }, - 1 }, - { { SENSORS_MAXI_CO_PLL, "pll", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MAXI_CO_PLL_MIN, "pll_min", SENSORS_MAXI_CO_PLL, - SENSORS_MAXI_CO_PLL, RW }, - 2 }, - { { SENSORS_MAXI_CO_PLL_MAX, "pll_max", SENSORS_MAXI_CO_PLL, - SENSORS_MAXI_CO_PLL, RW }, - 2 }, - { { SENSORS_MAXI_CO_VID1, "vid1", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_CO_VID2, "vid2", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_CO_VID3, "vid3", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_CO_VID4, "vid4", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_CO_VID1_MIN, "vid1_min", SENSORS_MAXI_CO_VID1, - SENSORS_MAXI_CO_VID1, RW }, - 4 }, - { { SENSORS_MAXI_CO_VID2_MIN, "vid2_min", SENSORS_MAXI_CO_VID2, - SENSORS_MAXI_CO_VID2, RW }, - 4 }, - { { SENSORS_MAXI_CO_VID3_MIN, "vid3_min", SENSORS_MAXI_CO_VID3, - SENSORS_MAXI_CO_VID3, RW }, - 4 }, - { { SENSORS_MAXI_CO_VID4_MIN, "vid4_min", SENSORS_MAXI_CO_VID4, - SENSORS_MAXI_CO_VID4, RW }, - 4 }, - { { SENSORS_MAXI_CO_VID1_MAX, "vid1_max", SENSORS_MAXI_CO_VID1, - SENSORS_MAXI_CO_VID1, RW }, - 4 }, - { { SENSORS_MAXI_CO_VID2_MAX, "vid2_max", SENSORS_MAXI_CO_VID2, - SENSORS_MAXI_CO_VID2, RW }, - 4 }, - { { SENSORS_MAXI_CG_VID3_MAX, "vid3_max", SENSORS_MAXI_CO_VID3, - SENSORS_MAXI_CO_VID3, RW }, - 4 }, - { { SENSORS_MAXI_CO_VID4_MAX, "vid4_max", SENSORS_MAXI_CO_VID4, - SENSORS_MAXI_CG_VID4, RW }, - 4 }, - { { SENSORS_MAXI_CO_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature maxi_as_features[] = - { - { { SENSORS_MAXI_AS_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_AS_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_AS_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_AS_FAN1_MIN, "fan1_min", SENSORS_MAXI_AS_FAN1, - SENSORS_MAXI_AS_FAN1, RW }, - 0 }, - { { SENSORS_MAXI_AS_FAN2_MIN, "fan2_min", SENSORS_MAXI_AS_FAN2, - SENSORS_MAXI_AS_FAN2, RW }, - 0 }, - { { SENSORS_MAXI_AS_FAN3_MIN, "fan3_min", SENSORS_MAXI_AS_FAN3, - SENSORS_MAXI_AS_FAN3, RW }, - 0 }, - { { SENSORS_MAXI_AS_FAN1_DIV, "fan1_div", SENSORS_MAXI_AS_FAN1, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_AS_FAN2_DIV, "fan2_div", SENSORS_MAXI_AS_FAN2, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_AS_FAN3_DIV, "fan3_div", SENSORS_MAXI_AS_FAN3, NOMAP, R }, - 0 }, - { { SENSORS_MAXI_AS_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP4, "temp4", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP5, "temp5", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP1_MAX, "temp1_max", SENSORS_MAXI_AS_TEMP1, - SENSORS_MAXI_AS_TEMP1, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP2_MAX, "temp2_max", SENSORS_MAXI_AS_TEMP2, - SENSORS_MAXI_AS_TEMP2, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP3_MAX, "temp3_max", SENSORS_MAXI_AS_TEMP3, - SENSORS_MAXI_AS_TEMP3, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP4_MAX, "temp4_max", SENSORS_MAXI_AS_TEMP4, - SENSORS_MAXI_AS_TEMP4, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP5_MAX, "temp5_max", SENSORS_MAXI_AS_TEMP5, - SENSORS_MAXI_AS_TEMP5, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP1_HYST, "temp1_hyst", SENSORS_MAXI_AS_TEMP1, - SENSORS_MAXI_AS_TEMP1, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP2_HYST, "temp2_hyst", SENSORS_MAXI_AS_TEMP2, - SENSORS_MAXI_AS_TEMP2, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP3_HYST, "temp3_hyst", SENSORS_MAXI_AS_TEMP3, - SENSORS_MAXI_AS_TEMP3, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP4_HYST, "temp4_hyst", SENSORS_MAXI_AS_TEMP4, - SENSORS_MAXI_AS_TEMP4, R }, - 1 }, - { { SENSORS_MAXI_AS_TEMP5_HYST, "temp5_hyst", SENSORS_MAXI_AS_TEMP5, - SENSORS_MAXI_AS_TEMP5, R }, - 1 }, - { { SENSORS_MAXI_AS_PLL, "pll", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MAXI_AS_PLL_MIN, "pll_min", SENSORS_MAXI_AS_PLL, - SENSORS_MAXI_AS_PLL, RW }, - 2 }, - { { SENSORS_MAXI_AS_PLL_MAX, "pll_max", SENSORS_MAXI_AS_PLL, - SENSORS_MAXI_AS_PLL, RW }, - 2 }, - { { SENSORS_MAXI_AS_VID1, "vid1", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_AS_VID2, "vid2", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_AS_VID3, "vid3", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_AS_VID4, "vid4", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_MAXI_AS_VID1_MIN, "vid1_min", SENSORS_MAXI_AS_VID1, - SENSORS_MAXI_AS_VID1, RW }, - 4 }, - { { SENSORS_MAXI_AS_VID2_MIN, "vid2_min", SENSORS_MAXI_AS_VID2, - SENSORS_MAXI_AS_VID2, RW }, - 4 }, - { { SENSORS_MAXI_AS_VID3_MIN, "vid3_min", SENSORS_MAXI_AS_VID3, - SENSORS_MAXI_AS_VID3, RW }, - 4 }, - { { SENSORS_MAXI_AS_VID4_MIN, "vid4_min", SENSORS_MAXI_AS_VID4, - SENSORS_MAXI_AS_VID4, RW }, - 4 }, - { { SENSORS_MAXI_AS_VID1_MAX, "vid1_max", SENSORS_MAXI_AS_VID1, - SENSORS_MAXI_AS_VID1, RW }, - 4 }, - { { SENSORS_MAXI_AS_VID2_MAX, "vid2_max", SENSORS_MAXI_AS_VID2, - SENSORS_MAXI_AS_VID2, RW }, - 4 }, - { { SENSORS_MAXI_AS_VID3_MAX, "vid3_max", SENSORS_MAXI_AS_VID3, - SENSORS_MAXI_AS_VID3, RW }, - 4 }, - { { SENSORS_MAXI_AS_VID4_MAX, "vid4_max", SENSORS_MAXI_AS_VID4, - SENSORS_MAXI_CG_VID4, RW }, - 4 }, - { { SENSORS_MAXI_AS_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature thmc50_features[] = - { - { { SENSORS_THMC50_TEMP, "temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_THMC50_TEMP_HYST, "temp_hyst", SENSORS_THMC50_TEMP, - SENSORS_THMC50_TEMP, RW }, - 0 }, - { { SENSORS_THMC50_TEMP_OVER, "temp_over", SENSORS_THMC50_TEMP, - SENSORS_THMC50_TEMP, RW }, - 0 }, - { { SENSORS_THMC50_REMOTE_TEMP, "remote_temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_THMC50_REMOTE_TEMP_HYST, "remote_temp_hyst", - SENSORS_THMC50_REMOTE_TEMP, - SENSORS_THMC50_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_THMC50_REMOTE_TEMP_OVER, "remote_temp_over", - SENSORS_THMC50_REMOTE_TEMP, - SENSORS_THMC50_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_THMC50_INTER_MASK, "analog output", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_THMC50_INTER, "interrupts", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_THMC50_INTER_MASK, "interrupt mask", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_THMC50_DIE_CODE, "die_code", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature adm1025_features[] = - { - { { SENSORS_ADM1025_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1025_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1025_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1025_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1025_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1025_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_ADM1025_IN0_MIN, "in0_min", SENSORS_ADM1025_IN0, - SENSORS_ADM1025_IN0, RW }, - 2 }, - { { SENSORS_ADM1025_IN1_MIN, "in1_min", SENSORS_ADM1025_IN1, - SENSORS_ADM1025_IN1, RW }, - 2 }, - { { SENSORS_ADM1025_IN2_MIN, "in2_min", SENSORS_ADM1025_IN2, - SENSORS_ADM1025_IN2, RW }, - 2 }, - { { SENSORS_ADM1025_IN3_MIN, "in3_min", SENSORS_ADM1025_IN3, - SENSORS_ADM1025_IN3, RW }, - 2 }, - { { SENSORS_ADM1025_IN4_MIN, "in4_min", SENSORS_ADM1025_IN4, - SENSORS_ADM1025_IN4, RW }, - 2 }, - { { SENSORS_ADM1025_IN5_MIN, "in5_min", SENSORS_ADM1025_IN5, - SENSORS_ADM1025_IN5, RW }, - 2 }, - { { SENSORS_ADM1025_IN0_MAX, "in0_max", SENSORS_ADM1025_IN0, - SENSORS_ADM1025_IN0, RW }, - 2 }, - { { SENSORS_ADM1025_IN1_MAX, "in1_max", SENSORS_ADM1025_IN1, - SENSORS_ADM1025_IN1, RW }, - 2 }, - { { SENSORS_ADM1025_IN2_MAX, "in2_max", SENSORS_ADM1025_IN2, - SENSORS_ADM1025_IN2, RW }, - 2 }, - { { SENSORS_ADM1025_IN3_MAX, "in3_max", SENSORS_ADM1025_IN3, - SENSORS_ADM1025_IN3, RW }, - 2 }, - { { SENSORS_ADM1025_IN4_MAX, "in4_max", SENSORS_ADM1025_IN4, - SENSORS_ADM1025_IN4, RW }, - 2 }, - { { SENSORS_ADM1025_IN5_MAX, "in5_max", SENSORS_ADM1025_IN5, - SENSORS_ADM1025_IN5, RW }, - 2 }, - { { SENSORS_ADM1025_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_ADM1025_TEMP1_LOW, "temp1_low", SENSORS_ADM1025_TEMP1, - SENSORS_ADM1025_TEMP1, RW }, - 1 }, - { { SENSORS_ADM1025_TEMP1_HIGH, "temp1_high", SENSORS_ADM1025_TEMP1, - SENSORS_ADM1025_TEMP1, RW }, - 1 }, - { { SENSORS_ADM1025_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_ADM1025_TEMP2_LOW, "temp2_low", SENSORS_ADM1025_TEMP2, - SENSORS_ADM1025_TEMP2, RW }, - 1 }, - { { SENSORS_ADM1025_TEMP2_HIGH, "temp2_high", SENSORS_ADM1025_TEMP2, - SENSORS_ADM1025_TEMP2, RW }, - 1 }, - { { SENSORS_ADM1025_VID, "vid", NOMAP, NOMAP, R }, - 3, "cpu0_vid", 3, - "in1_ref" }, - { { SENSORS_ADM1025_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_ADM1025_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature adm1026_features[] = { - { { SENSORS_ADM1026_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_ALARM_MASK, "alarm_mask", SENSORS_ADM1026_ALARMS, NOMAP, - R }, - 0 }, - { { SENSORS_ADM1026_GPIO, "gpio", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_GPIO_MASK, "gpio_mask", SENSORS_ADM1026_GPIO, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_ADM1026_PWM, "pwm", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_AFC_PWM, "afc_pwm", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_DAC, "analog_out", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_AFC_DAC, "afc_analog_out", SENSORS_ADM1026_DAC, NOMAP, - RW }, - 0 }, - - { { SENSORS_ADM1026_IN0, "in0", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN0_MIN, "in0_min", SENSORS_ADM1026_IN0, - SENSORS_ADM1026_IN0, RW }, - 3 }, - { { SENSORS_ADM1026_IN0_MAX, "in0_max", SENSORS_ADM1026_IN0, - SENSORS_ADM1026_IN0, RW }, - 3 }, - { { SENSORS_ADM1026_IN1, "in1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN1_MIN, "in1_min", SENSORS_ADM1026_IN1, - SENSORS_ADM1026_IN1, RW }, - 3 }, - { { SENSORS_ADM1026_IN1_MAX, "in1_max", SENSORS_ADM1026_IN1, - SENSORS_ADM1026_IN1, RW }, - 3 }, - { { SENSORS_ADM1026_IN2, "in2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN2_MIN, "in2_min", SENSORS_ADM1026_IN2, - SENSORS_ADM1026_IN2, RW }, - 3 }, - { { SENSORS_ADM1026_IN2_MAX, "in2_max", SENSORS_ADM1026_IN2, - SENSORS_ADM1026_IN2, RW }, - 3 }, - { { SENSORS_ADM1026_IN3, "in3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN3_MIN, "in3_min", SENSORS_ADM1026_IN3, - SENSORS_ADM1026_IN3, RW }, - 3 }, - { { SENSORS_ADM1026_IN3_MAX, "in3_max", SENSORS_ADM1026_IN3, - SENSORS_ADM1026_IN3, RW }, - 3 }, - { { SENSORS_ADM1026_IN4, "in4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN4_MIN, "in4_min", SENSORS_ADM1026_IN4, - SENSORS_ADM1026_IN4, RW }, - 3 }, - { { SENSORS_ADM1026_IN4_MAX, "in4_max", SENSORS_ADM1026_IN4, - SENSORS_ADM1026_IN4, RW }, - 3 }, - { { SENSORS_ADM1026_IN5, "in5", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN5_MIN, "in5_min", SENSORS_ADM1026_IN5, - SENSORS_ADM1026_IN5, RW }, - 3 }, - { { SENSORS_ADM1026_IN5_MAX, "in5_max", SENSORS_ADM1026_IN5, - SENSORS_ADM1026_IN5, RW }, - 3 }, - { { SENSORS_ADM1026_IN6, "in6", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN6_MIN, "in6_min", SENSORS_ADM1026_IN6, - SENSORS_ADM1026_IN6, RW }, - 3 }, - { { SENSORS_ADM1026_IN6_MAX, "in6_max", SENSORS_ADM1026_IN6, - SENSORS_ADM1026_IN6, RW }, - 3 }, - { { SENSORS_ADM1026_IN7, "in7", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN7_MIN, "in7_min", SENSORS_ADM1026_IN7, - SENSORS_ADM1026_IN7, RW }, - 3 }, - { { SENSORS_ADM1026_IN7_MAX, "in7_max", SENSORS_ADM1026_IN7, - SENSORS_ADM1026_IN7, RW }, - 3 }, - { { SENSORS_ADM1026_IN8, "in8", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN8_MIN, "in8_min", SENSORS_ADM1026_IN8, - SENSORS_ADM1026_IN8, RW }, - 3 }, - { { SENSORS_ADM1026_IN8_MAX, "in8_max", SENSORS_ADM1026_IN8, - SENSORS_ADM1026_IN8, RW }, - 3 }, - { { SENSORS_ADM1026_IN9, "in9", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN9_MIN, "in9_min", SENSORS_ADM1026_IN9, - SENSORS_ADM1026_IN9, RW }, - 3 }, - { { SENSORS_ADM1026_IN9_MAX, "in9_max", SENSORS_ADM1026_IN9, - SENSORS_ADM1026_IN9, RW }, - 3 }, - { { SENSORS_ADM1026_IN10, "in10", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN10_MIN, "in10_min", SENSORS_ADM1026_IN10, - SENSORS_ADM1026_IN10, RW }, - 3 }, - { { SENSORS_ADM1026_IN10_MAX, "in10_max", SENSORS_ADM1026_IN10, - SENSORS_ADM1026_IN10, RW }, - 3 }, - { { SENSORS_ADM1026_IN11, "in11", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN11_MIN, "in11_min", SENSORS_ADM1026_IN11, - SENSORS_ADM1026_IN11, RW }, - 3 }, - { { SENSORS_ADM1026_IN11_MAX, "in11_max", SENSORS_ADM1026_IN11, - SENSORS_ADM1026_IN11, RW }, - 3 }, - { { SENSORS_ADM1026_IN12, "in12", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN12_MIN, "in12_min", SENSORS_ADM1026_IN12, - SENSORS_ADM1026_IN12, RW }, - 3 }, - { { SENSORS_ADM1026_IN12_MAX, "in12_max", SENSORS_ADM1026_IN12, - SENSORS_ADM1026_IN12, RW }, - 3 }, - { { SENSORS_ADM1026_IN13, "in13", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN13_MIN, "in13_min", SENSORS_ADM1026_IN13, - SENSORS_ADM1026_IN13, RW }, - 3 }, - { { SENSORS_ADM1026_IN13_MAX, "in13_max", SENSORS_ADM1026_IN13, - SENSORS_ADM1026_IN13, RW }, - 3 }, - { { SENSORS_ADM1026_IN14, "in14", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN14_MIN, "in14_min", SENSORS_ADM1026_IN14, - SENSORS_ADM1026_IN14, RW }, - 3 }, - { { SENSORS_ADM1026_IN14_MAX, "in14_max", SENSORS_ADM1026_IN14, - SENSORS_ADM1026_IN14, RW }, - 3 }, - { { SENSORS_ADM1026_IN15, "in15", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN15_MIN, "in15_min", SENSORS_ADM1026_IN15, - SENSORS_ADM1026_IN15, RW }, - 3 }, - { { SENSORS_ADM1026_IN15_MAX, "in15_max", SENSORS_ADM1026_IN15, - SENSORS_ADM1026_IN15, RW }, - 3 }, - { { SENSORS_ADM1026_IN16, "in16", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_ADM1026_IN16_MIN, "in16_min", SENSORS_ADM1026_IN16, - SENSORS_ADM1026_IN16, RW }, - 3 }, - { { SENSORS_ADM1026_IN16_MAX, "in16_max", SENSORS_ADM1026_IN16, - SENSORS_ADM1026_IN16, RW }, - 3 }, - { { SENSORS_ADM1026_FAN0, "fan0", NOMAP, NOMAP, R }, - 0, "fan8_input", - 0 }, - { { SENSORS_ADM1026_FAN0_MIN, "fan0_min", SENSORS_ADM1026_FAN0, - SENSORS_ADM1026_FAN0, RW }, - 0, "fan8_min", - 0 }, - { { SENSORS_ADM1026_FAN0_DIV, "fan0_div", SENSORS_ADM1026_FAN0, NOMAP, RW }, - 0, - "fan8_div", 0 }, - { { SENSORS_ADM1026_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_FAN1_MIN, "fan1_min", SENSORS_ADM1026_FAN1, - SENSORS_ADM1026_FAN1, RW }, - 0 }, - { { SENSORS_ADM1026_FAN1_DIV, "fan1_div", SENSORS_ADM1026_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_FAN2_MIN, "fan2_min", SENSORS_ADM1026_FAN2, - SENSORS_ADM1026_FAN2, RW }, - 0 }, - { { SENSORS_ADM1026_FAN2_DIV, "fan2_div", SENSORS_ADM1026_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_FAN3_MIN, "fan3_min", SENSORS_ADM1026_FAN3, - SENSORS_ADM1026_FAN3, RW }, - 0 }, - { { SENSORS_ADM1026_FAN3_DIV, "fan3_div", SENSORS_ADM1026_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_FAN4, "fan4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_FAN4_MIN, "fan4_min", SENSORS_ADM1026_FAN4, - SENSORS_ADM1026_FAN4, RW }, - 0 }, - { { SENSORS_ADM1026_FAN4_DIV, "fan4_div", SENSORS_ADM1026_FAN4, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_FAN5, "fan5", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_FAN5_MIN, "fan5_min", SENSORS_ADM1026_FAN5, - SENSORS_ADM1026_FAN5, RW }, - 0 }, - { { SENSORS_ADM1026_FAN5_DIV, "fan5_div", SENSORS_ADM1026_FAN5, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_FAN6, "fan6", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_FAN6_MIN, "fan6_min", SENSORS_ADM1026_FAN6, - SENSORS_ADM1026_FAN6, RW }, - 0 }, - { { SENSORS_ADM1026_FAN6_DIV, "fan6_div", SENSORS_ADM1026_FAN6, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_FAN7, "fan7", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_FAN7_MIN, "fan7_min", SENSORS_ADM1026_FAN7, - SENSORS_ADM1026_FAN7, RW }, - 0 }, - { { SENSORS_ADM1026_FAN7_DIV, "fan7_div", SENSORS_ADM1026_FAN7, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP1, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_TEMP1_MIN, "temp1_min", SENSORS_ADM1026_TEMP1, - SENSORS_ADM1026_TEMP1, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP1_MAX, "temp1_max", SENSORS_ADM1026_TEMP1, - SENSORS_ADM1026_TEMP1, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP1_OFFSET, "temp1_offset", SENSORS_ADM1026_TEMP1, - NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP1_TMIN, "temp1_tmin", SENSORS_ADM1026_TEMP1, - SENSORS_ADM1026_TEMP1, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP1_THERM, "temp1_therm", SENSORS_ADM1026_TEMP1, - SENSORS_ADM1026_TEMP1, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP2, "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_TEMP2_MIN, "temp2_min", SENSORS_ADM1026_TEMP2, - SENSORS_ADM1026_TEMP2, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP2_MAX, "temp2_max", SENSORS_ADM1026_TEMP2, - SENSORS_ADM1026_TEMP2, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP2_OFFSET, "temp2_offset", SENSORS_ADM1026_TEMP2, - NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP2_TMIN, "temp2_tmin", SENSORS_ADM1026_TEMP2, - SENSORS_ADM1026_TEMP2, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP2_THERM, "temp2_therm", SENSORS_ADM1026_TEMP2, - SENSORS_ADM1026_TEMP2, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP3, "temp3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_ADM1026_TEMP3_MIN, "temp3_min", SENSORS_ADM1026_TEMP3, - SENSORS_ADM1026_TEMP3, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP3_MAX, "temp3_max", SENSORS_ADM1026_TEMP3, - SENSORS_ADM1026_TEMP3, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP3_OFFSET, "temp3_offset", SENSORS_ADM1026_TEMP3, - NOMAP, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP3_TMIN, "temp3_tmin", SENSORS_ADM1026_TEMP3, - SENSORS_ADM1026_TEMP3, RW }, - 0 }, - { { SENSORS_ADM1026_TEMP3_THERM, "temp3_therm", SENSORS_ADM1026_TEMP3, - SENSORS_ADM1026_TEMP3, RW }, - 0 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature via686a_features[] = - { - { { SENSORS_VIA686A_IN0, "2.0V", NOMAP, NOMAP, R }, - 2, "in0_input", 3 }, - { { SENSORS_VIA686A_IN1, "2.5V", NOMAP, NOMAP, R }, - 2, "in1_input", 3 }, - { { SENSORS_VIA686A_IN2, "3.3V", NOMAP, NOMAP, R }, - 2, "in2_input", 3 }, - { { SENSORS_VIA686A_IN3, "5.0V", NOMAP, NOMAP, R }, - 2, "in3_input", 3 }, - { { SENSORS_VIA686A_IN4, "12V", NOMAP, NOMAP, R }, - 2, "in4_input", 3 }, - { { SENSORS_VIA686A_IN0_MIN, "in0_min", SENSORS_VIA686A_IN0, - SENSORS_VIA686A_IN0, RW }, - 2 }, - { { SENSORS_VIA686A_IN1_MIN, "in1_min", SENSORS_VIA686A_IN1, - SENSORS_VIA686A_IN1, RW }, - 2 }, - { { SENSORS_VIA686A_IN2_MIN, "in2_min", SENSORS_VIA686A_IN2, - SENSORS_VIA686A_IN2, RW }, - 2 }, - { { SENSORS_VIA686A_IN3_MIN, "in3_min", SENSORS_VIA686A_IN3, - SENSORS_VIA686A_IN3, RW }, - 2 }, - { { SENSORS_VIA686A_IN4_MIN, "in4_min", SENSORS_VIA686A_IN4, - SENSORS_VIA686A_IN4, RW }, - 2 }, - { { SENSORS_VIA686A_IN0_MAX, "in0_max", SENSORS_VIA686A_IN0, - SENSORS_VIA686A_IN0, RW }, - 2 }, - { { SENSORS_VIA686A_IN1_MAX, "in1_max", SENSORS_VIA686A_IN1, - SENSORS_VIA686A_IN1, RW }, - 2 }, - { { SENSORS_VIA686A_IN2_MAX, "in2_max", SENSORS_VIA686A_IN2, - SENSORS_VIA686A_IN2, RW }, - 2 }, - { { SENSORS_VIA686A_IN3_MAX, "in3_max", SENSORS_VIA686A_IN3, - SENSORS_VIA686A_IN3, RW }, - 2 }, - { { SENSORS_VIA686A_IN4_MAX, "in4_max", SENSORS_VIA686A_IN4, - SENSORS_VIA686A_IN4, RW }, - 2 }, - { { SENSORS_VIA686A_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_VIA686A_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_VIA686A_FAN1_MIN, "fan1_min", SENSORS_VIA686A_FAN1, - SENSORS_VIA686A_FAN1, RW }, - 0 }, - { { SENSORS_VIA686A_FAN2_MIN, "fan2_min", SENSORS_VIA686A_FAN2, - SENSORS_VIA686A_FAN2, RW }, - 0 }, - { { SENSORS_VIA686A_TEMP, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_VIA686A_TEMP_HYST, "temp1_hyst", SENSORS_VIA686A_TEMP, - SENSORS_VIA686A_TEMP, RW }, - 1 }, - { { SENSORS_VIA686A_TEMP_OVER, "temp1_over", SENSORS_VIA686A_TEMP, - SENSORS_VIA686A_TEMP, RW }, - 1 }, - { { SENSORS_VIA686A_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_VIA686A_TEMP2_HYST, "temp2_hyst", SENSORS_VIA686A_TEMP2, - SENSORS_VIA686A_TEMP2, RW }, - 1 }, - { { SENSORS_VIA686A_TEMP2_OVER, "temp2_over", SENSORS_VIA686A_TEMP2, - SENSORS_VIA686A_TEMP2, RW }, - 1 }, - { { SENSORS_VIA686A_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_VIA686A_TEMP3_HYST, "temp3_hyst", SENSORS_VIA686A_TEMP3, - SENSORS_VIA686A_TEMP3, RW }, - 1 }, - { { SENSORS_VIA686A_TEMP3_OVER, "temp3_over", SENSORS_VIA686A_TEMP3, - SENSORS_VIA686A_TEMP3, RW }, - 1 }, - { { SENSORS_VIA686A_FAN1_DIV, "fan1_div", SENSORS_VIA686A_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_VIA686A_FAN2_DIV, "fan2_div", SENSORS_VIA686A_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_VIA686A_ALARMS, "alarms", NOMAP, NOMAP, R }, 0 }, - { { 0 }, 0 } - }; - -/* NOTE: Many shared values with adm1027_features !!! */ -static sensors_chip_feature lm85_features[] = - { - { { SENSORS_LM85_IN0, "in0", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN1, "in1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN2, "in2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN3, "in3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN4, "in4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN5, "in5", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN6, "in6", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN7, "in7", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN0_MIN, "in0_min", SENSORS_LM85_IN0, SENSORS_LM85_IN0, RW }, - 3 }, - { { SENSORS_LM85_IN1_MIN, "in1_min", SENSORS_LM85_IN1, SENSORS_LM85_IN1, RW }, - 3 }, - { { SENSORS_LM85_IN2_MIN, "in2_min", SENSORS_LM85_IN2, SENSORS_LM85_IN2, RW }, - 3 }, - { { SENSORS_LM85_IN3_MIN, "in3_min", SENSORS_LM85_IN3, SENSORS_LM85_IN3, RW }, - 3 }, - { { SENSORS_LM85_IN4_MIN, "in4_min", SENSORS_LM85_IN4, SENSORS_LM85_IN4, RW }, - 3 }, - { { SENSORS_LM85_IN5_MIN, "in5_min", SENSORS_LM85_IN5, SENSORS_LM85_IN5, RW }, - 3 }, - { { SENSORS_LM85_IN6_MIN, "in6_min", SENSORS_LM85_IN6, SENSORS_LM85_IN6, RW }, - 3 }, - { { SENSORS_LM85_IN7_MIN, "in7_min", SENSORS_LM85_IN7, SENSORS_LM85_IN7, RW }, - 3 }, - { { SENSORS_LM85_IN0_MAX, "in0_max", SENSORS_LM85_IN0, SENSORS_LM85_IN0, RW }, - 3 }, - { { SENSORS_LM85_IN1_MAX, "in1_max", SENSORS_LM85_IN1, SENSORS_LM85_IN1, RW }, - 3 }, - { { SENSORS_LM85_IN2_MAX, "in2_max", SENSORS_LM85_IN2, SENSORS_LM85_IN2, RW }, - 3 }, - { { SENSORS_LM85_IN3_MAX, "in3_max", SENSORS_LM85_IN3, SENSORS_LM85_IN3, RW }, - 3 }, - { { SENSORS_LM85_IN4_MAX, "in4_max", SENSORS_LM85_IN4, SENSORS_LM85_IN4, RW }, - 3 }, - { { SENSORS_LM85_IN5_MAX, "in5_max", SENSORS_LM85_IN5, SENSORS_LM85_IN5, RW }, - 3 }, - { { SENSORS_LM85_IN6_MAX, "in6_max", SENSORS_LM85_IN6, SENSORS_LM85_IN6, RW }, - 3 }, - { { SENSORS_LM85_IN7_MAX, "in7_max", SENSORS_LM85_IN7, SENSORS_LM85_IN7, RW }, - 3 }, - { { SENSORS_LM85_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_FAN4, "fan4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_FAN1_MIN, "fan1_min", SENSORS_LM85_FAN1, SENSORS_LM85_FAN1, - RW }, - 0 }, - { { SENSORS_LM85_FAN2_MIN, "fan2_min", SENSORS_LM85_FAN2, SENSORS_LM85_FAN2, - RW }, - 0 }, - { { SENSORS_LM85_FAN3_MIN, "fan3_min", SENSORS_LM85_FAN3, SENSORS_LM85_FAN3, - RW }, - 0 }, - { { SENSORS_LM85_FAN4_MIN, "fan4_min", SENSORS_LM85_FAN4, SENSORS_LM85_FAN4, - RW }, - 0 }, - { { SENSORS_LM85_TEMP1, "temp1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM85_TEMP2, "temp2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM85_TEMP3, "temp3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM85_TEMP1_MIN, "temp1_min", SENSORS_LM85_TEMP1, - SENSORS_LM85_TEMP1, RW }, - 2 }, - { { SENSORS_LM85_TEMP2_MIN, "temp2_min", SENSORS_LM85_TEMP2, - SENSORS_LM85_TEMP2, RW }, - 2 }, - { { SENSORS_LM85_TEMP3_MIN, "temp3_min", SENSORS_LM85_TEMP3, - SENSORS_LM85_TEMP3, RW }, - 2 }, - { { SENSORS_LM85_TEMP1_MAX, "temp1_max", SENSORS_LM85_TEMP1, - SENSORS_LM85_TEMP1, RW }, - 2 }, - { { SENSORS_LM85_TEMP2_MAX, "temp2_max", SENSORS_LM85_TEMP2, - SENSORS_LM85_TEMP2, RW }, - 2 }, - { { SENSORS_LM85_TEMP3_MAX, "temp3_max", SENSORS_LM85_TEMP3, - SENSORS_LM85_TEMP3, RW }, - 2 }, - { { SENSORS_LM85_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_PWM1, "pwm1", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM2, "pwm2", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM3, "pwm3", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM1_SPINUP, "pwm1_spinup", SENSORS_LM85_PWM1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM2_SPINUP, "pwm2_spinup", SENSORS_LM85_PWM2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM3_SPINUP, "pwm3_spinup", SENSORS_LM85_PWM3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM1_MIN, "pwm1_min", SENSORS_LM85_PWM1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM2_MIN, "pwm2_min", SENSORS_LM85_PWM2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM3_MIN, "pwm3_min", SENSORS_LM85_PWM3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM1_FREQ, "pwm1_freq", SENSORS_LM85_PWM1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM2_FREQ, "pwm2_freq", SENSORS_LM85_PWM2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM3_FREQ, "pwm3_freq", SENSORS_LM85_PWM3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM1_MIN_CTL, "pwm1_min_ctl", SENSORS_LM85_PWM1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM2_MIN_CTL, "pwm2_min_ctl", SENSORS_LM85_PWM2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM3_MIN_CTL, "pwm3_min_ctl", SENSORS_LM85_PWM3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM1_INVERT, "pwm1_invert", SENSORS_LM85_PWM1, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM2_INVERT, "pwm2_invert", SENSORS_LM85_PWM2, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM3_INVERT, "pwm3_invert", SENSORS_LM85_PWM3, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM1_ZONE, "pwm1_zone", SENSORS_LM85_PWM1, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM2_ZONE, "pwm2_zone", SENSORS_LM85_PWM2, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM3_ZONE, "pwm3_zone", SENSORS_LM85_PWM3, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_ZONE1_LIMIT, "zone1_limit", SENSORS_LM85_TEMP1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE2_LIMIT, "zone2_limit", SENSORS_LM85_TEMP2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE3_LIMIT, "zone3_limit", SENSORS_LM85_TEMP3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE1_HYST, "zone1_hyst", SENSORS_LM85_TEMP1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE2_HYST, "zone2_hyst", SENSORS_LM85_TEMP2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE3_HYST, "zone3_hyst", SENSORS_LM85_TEMP3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE1_RANGE, "zone1_range", SENSORS_LM85_TEMP1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE2_RANGE, "zone2_range", SENSORS_LM85_TEMP2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE3_RANGE, "zone3_range", SENSORS_LM85_TEMP3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE1_CRITICAL, "zone1_critical", SENSORS_LM85_TEMP1, NOMAP, - RW }, - 1 }, - { { SENSORS_LM85_ZONE2_CRITICAL, "zone2_critical", SENSORS_LM85_TEMP2, NOMAP, - RW }, - 1 }, - { { SENSORS_LM85_ZONE3_CRITICAL, "zone3_critical", SENSORS_LM85_TEMP3, NOMAP, - RW }, - 1 }, - - { { SENSORS_LM85_PWM1_SPINUP_CTL, "pwm1_spinup_ctl", SENSORS_LM85_PWM1, - NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM2_SPINUP_CTL, "pwm2_spinup_ctl", SENSORS_LM85_PWM2, - NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM3_SPINUP_CTL, "pwm3_spinup_ctl", SENSORS_LM85_PWM3, - NOMAP, RW }, - 0 }, - { { SENSORS_LM85_FAN1_TACH_MODE, "fan1_tach_mode", SENSORS_LM85_FAN1, NOMAP, - RW }, - 0 }, - { { SENSORS_LM85_FAN2_TACH_MODE, "fan2_tach_mode", SENSORS_LM85_FAN2, NOMAP, - RW }, - 0 }, - { { SENSORS_LM85_FAN3_TACH_MODE, "fan3_tach_mode", SENSORS_LM85_FAN3, NOMAP, - RW }, - 0 }, - { { SENSORS_LM85_ZONE1_SMOOTH, "zone1_smooth", SENSORS_LM85_TEMP1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE2_SMOOTH, "zone2_smooth", SENSORS_LM85_TEMP2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE3_SMOOTH, "zone3_smooth", SENSORS_LM85_TEMP3, NOMAP, RW }, - 1 }, - { { 0 }, 0 } - }; - -/* NOTE: Many shared values with lm85_features !!! */ -static sensors_chip_feature adm1027_features[] = - { - { { SENSORS_LM85_IN0, "in0", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN1, "in1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN2, "in2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN3, "in3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN4, "in4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_IN0_MIN, "in0_min", SENSORS_LM85_IN0, SENSORS_LM85_IN0, RW }, - 3 }, - { { SENSORS_LM85_IN1_MIN, "in1_min", SENSORS_LM85_IN1, SENSORS_LM85_IN1, RW }, - 3 }, - { { SENSORS_LM85_IN2_MIN, "in2_min", SENSORS_LM85_IN2, SENSORS_LM85_IN2, RW }, - 3 }, - { { SENSORS_LM85_IN3_MIN, "in3_min", SENSORS_LM85_IN3, SENSORS_LM85_IN3, RW }, - 3 }, - { { SENSORS_LM85_IN4_MIN, "in4_min", SENSORS_LM85_IN4, SENSORS_LM85_IN4, RW }, - 3 }, - { { SENSORS_LM85_IN0_MAX, "in0_max", SENSORS_LM85_IN0, SENSORS_LM85_IN0, RW }, - 3 }, - { { SENSORS_LM85_IN1_MAX, "in1_max", SENSORS_LM85_IN1, SENSORS_LM85_IN1, RW }, - 3 }, - { { SENSORS_LM85_IN2_MAX, "in2_max", SENSORS_LM85_IN2, SENSORS_LM85_IN2, RW }, - 3 }, - { { SENSORS_LM85_IN3_MAX, "in3_max", SENSORS_LM85_IN3, SENSORS_LM85_IN3, RW }, - 3 }, - { { SENSORS_LM85_IN4_MAX, "in4_max", SENSORS_LM85_IN4, SENSORS_LM85_IN4, RW }, - 3 }, - { { SENSORS_LM85_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_FAN4, "fan4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_FAN1_MIN, "fan1_min", SENSORS_LM85_FAN1, SENSORS_LM85_FAN1, - RW }, - 0 }, - { { SENSORS_LM85_FAN2_MIN, "fan2_min", SENSORS_LM85_FAN2, SENSORS_LM85_FAN2, - RW }, - 0 }, - { { SENSORS_LM85_FAN3_MIN, "fan3_min", SENSORS_LM85_FAN3, SENSORS_LM85_FAN3, - RW }, - 0 }, - { { SENSORS_LM85_FAN4_MIN, "fan4_min", SENSORS_LM85_FAN4, SENSORS_LM85_FAN4, - RW }, - 0 }, - { { SENSORS_LM85_TEMP1, "temp1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM85_TEMP2, "temp2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM85_TEMP3, "temp3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_LM85_TEMP1_MIN, "temp1_min", SENSORS_LM85_TEMP1, - SENSORS_LM85_TEMP1, RW }, - 2 }, - { { SENSORS_LM85_TEMP2_MIN, "temp2_min", SENSORS_LM85_TEMP2, - SENSORS_LM85_TEMP2, RW }, - 2 }, - { { SENSORS_LM85_TEMP3_MIN, "temp3_min", SENSORS_LM85_TEMP3, - SENSORS_LM85_TEMP3, RW }, - 2 }, - { { SENSORS_LM85_TEMP1_MAX, "temp1_max", SENSORS_LM85_TEMP1, - SENSORS_LM85_TEMP1, RW }, - 2 }, - { { SENSORS_LM85_TEMP2_MAX, "temp2_max", SENSORS_LM85_TEMP2, - SENSORS_LM85_TEMP2, RW }, - 2 }, - { { SENSORS_LM85_TEMP3_MAX, "temp3_max", SENSORS_LM85_TEMP3, - SENSORS_LM85_TEMP3, RW }, - 2 }, - { { SENSORS_LM85_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM85_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM85_PWM1, "pwm1", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM2, "pwm2", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM3, "pwm3", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM1_SPINUP, "pwm1_spinup", SENSORS_LM85_PWM1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM2_SPINUP, "pwm2_spinup", SENSORS_LM85_PWM2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM3_SPINUP, "pwm3_spinup", SENSORS_LM85_PWM3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM1_MIN, "pwm1_min", SENSORS_LM85_PWM1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM2_MIN, "pwm2_min", SENSORS_LM85_PWM2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM3_MIN, "pwm3_min", SENSORS_LM85_PWM3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM1_FREQ, "pwm1_freq", SENSORS_LM85_PWM1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM2_FREQ, "pwm2_freq", SENSORS_LM85_PWM2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM3_FREQ, "pwm3_freq", SENSORS_LM85_PWM3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM1_MIN_CTL, "pwm1_min_ctl", SENSORS_LM85_PWM1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM2_MIN_CTL, "pwm2_min_ctl", SENSORS_LM85_PWM2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM3_MIN_CTL, "pwm3_min_ctl", SENSORS_LM85_PWM3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_PWM1_INVERT, "pwm1_invert", SENSORS_LM85_PWM1, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM2_INVERT, "pwm2_invert", SENSORS_LM85_PWM2, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM3_INVERT, "pwm3_invert", SENSORS_LM85_PWM3, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM1_ZONE, "pwm1_zone", SENSORS_LM85_PWM1, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM2_ZONE, "pwm2_zone", SENSORS_LM85_PWM2, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_PWM3_ZONE, "pwm3_zone", SENSORS_LM85_PWM3, NOMAP, RW }, - 0 }, - { { SENSORS_LM85_ZONE1_LIMIT, "zone1_limit", SENSORS_LM85_TEMP1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE2_LIMIT, "zone2_limit", SENSORS_LM85_TEMP2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE3_LIMIT, "zone3_limit", SENSORS_LM85_TEMP3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE1_HYST, "zone1_hyst", SENSORS_LM85_TEMP1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE2_HYST, "zone2_hyst", SENSORS_LM85_TEMP2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE3_HYST, "zone3_hyst", SENSORS_LM85_TEMP3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE1_RANGE, "zone1_range", SENSORS_LM85_TEMP1, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE2_RANGE, "zone2_range", SENSORS_LM85_TEMP2, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE3_RANGE, "zone3_range", SENSORS_LM85_TEMP3, NOMAP, RW }, - 1 }, - { { SENSORS_LM85_ZONE1_CRITICAL, "zone1_critical", SENSORS_LM85_TEMP1, NOMAP, - RW }, - 1 }, - { { SENSORS_LM85_ZONE2_CRITICAL, "zone2_critical", SENSORS_LM85_TEMP2, NOMAP, - RW }, - 1 }, - { { SENSORS_LM85_ZONE3_CRITICAL, "zone3_critical", SENSORS_LM85_TEMP3, NOMAP, - RW }, - 1 }, - - { { SENSORS_ADM1027_FAN1_TACH_MODE, "fan1_tach_mode", SENSORS_LM85_FAN1, - NOMAP, RW }, - 0 }, - { { SENSORS_ADM1027_FAN2_TACH_MODE, "fan2_tach_mode", SENSORS_LM85_FAN2, - NOMAP, RW }, - 0 }, - { { SENSORS_ADM1027_FAN3_TACH_MODE, "fan3_tach_mode", SENSORS_LM85_FAN3, - NOMAP, RW }, - 0 }, - { { SENSORS_ADM1027_FAN4_TACH_MODE, "fan4_tach_mode", SENSORS_LM85_FAN4, - NOMAP, RW }, - 0 }, - { { SENSORS_ADM1027_PWM1_SMOOTH, "pwm1_smooth", SENSORS_LM85_PWM1, NOMAP, RW }, - 1 }, - { { SENSORS_ADM1027_PWM2_SMOOTH, "pwm2_smooth", SENSORS_LM85_PWM2, NOMAP, RW }, - 1 }, - { { SENSORS_ADM1027_PWM3_SMOOTH, "pwm3_smooth", SENSORS_LM85_PWM3, NOMAP, RW }, - 1 }, - { { SENSORS_ADM1027_TEMP1_OFFSET, "temp1_offset", SENSORS_LM85_TEMP1, - SENSORS_LM85_TEMP1, RW }, - 2 }, - { { SENSORS_ADM1027_TEMP2_OFFSET, "temp2_offset", SENSORS_LM85_TEMP2, - SENSORS_LM85_TEMP2, RW }, - 2 }, - { { SENSORS_ADM1027_TEMP3_OFFSET, "temp3_offset", SENSORS_LM85_TEMP3, - SENSORS_LM85_TEMP3, RW }, - 2 }, - { { SENSORS_ADM1027_FAN1_PPR, "fan1_ppr", SENSORS_LM85_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1027_FAN2_PPR, "fan2_ppr", SENSORS_LM85_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1027_FAN3_PPR, "fan3_ppr", SENSORS_LM85_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1027_FAN4_PPR, "fan4_ppr", SENSORS_LM85_FAN4, NOMAP, RW }, - 0 }, - { { SENSORS_ADM1027_ALARM_MASK, "alarm_mask", NOMAP, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature lm87_features[] = - { - { { SENSORS_LM87_IN0, "2.5V", NOMAP, NOMAP, R }, - 2, "in0_input", 3 }, - { { SENSORS_LM87_IN1, "Vccp1", NOMAP, NOMAP, R }, - 2, "in1_input", 3 }, - { { SENSORS_LM87_IN2, "3.3V", NOMAP, NOMAP, R }, - 2, "in2_input", 3 }, - { { SENSORS_LM87_IN3, "5V", NOMAP, NOMAP, R }, - 2, "in3_input", 3 }, - { { SENSORS_LM87_IN4, "12V", NOMAP, NOMAP, R }, - 2, "in4_input", 3 }, - { { SENSORS_LM87_IN5, "Vccp2", NOMAP, NOMAP, R }, - 2, "in5_input", 3 }, - { { SENSORS_LM87_AIN1, "AIN1", NOMAP, NOMAP, R }, - 0, "in6_input", 3 }, - { { SENSORS_LM87_AIN2, "AIN2", NOMAP, NOMAP, R }, - 0, "in7_input", 3 }, - { { SENSORS_LM87_IN0_MIN, "2.5V_min", SENSORS_LM87_IN0, SENSORS_LM87_IN0, RW }, - 2, "in0_min", 3 }, - { { SENSORS_LM87_IN1_MIN, "Vccp1_min", SENSORS_LM87_IN1, SENSORS_LM87_IN1, - RW }, - 2, "in1_min", 3 }, - { { SENSORS_LM87_IN2_MIN, "3.3V_min", SENSORS_LM87_IN2, SENSORS_LM87_IN2, RW }, - 2, "in2_min", 3 }, - { { SENSORS_LM87_IN3_MIN, "5V_min", SENSORS_LM87_IN3, SENSORS_LM87_IN3, RW }, - 2, "in3_min", 3 }, - { { SENSORS_LM87_IN4_MIN, "12V_min", SENSORS_LM87_IN4, SENSORS_LM87_IN4, RW }, - 2, "in4_min", 3 }, - { { SENSORS_LM87_IN5_MIN, "Vccp2_min", SENSORS_LM87_IN5, SENSORS_LM87_IN5, - RW }, - 2, "in5_min", 3 }, - { { SENSORS_LM87_AIN1_MIN, "AIN1_min", SENSORS_LM87_AIN1, SENSORS_LM87_AIN1, - RW }, - 0, "in6_min", 3 }, - { { SENSORS_LM87_AIN2_MIN, "AIN2_min", SENSORS_LM87_AIN2, SENSORS_LM87_AIN2, - RW }, - 0, "in7_min", 3 }, - { { SENSORS_LM87_IN0_MAX, "2.5V_max", SENSORS_LM87_IN0, SENSORS_LM87_IN0, RW }, - 2, "in0_max", 3 }, - { { SENSORS_LM87_IN1_MAX, "Vccp1_max", SENSORS_LM87_IN1, SENSORS_LM87_IN1, - RW }, - 2, "in1_max", 3 }, - { { SENSORS_LM87_IN2_MAX, "3.3V_max", SENSORS_LM87_IN2, SENSORS_LM87_IN2, RW }, - 2, "in2_max", 3 }, - { { SENSORS_LM87_IN3_MAX, "5V_max", SENSORS_LM87_IN3, SENSORS_LM87_IN3, RW }, - 2, "in3_max", 3 }, - { { SENSORS_LM87_IN4_MAX, "12V_max", SENSORS_LM87_IN4, SENSORS_LM87_IN4, RW }, - 2, "in4_max", 3 }, - { { SENSORS_LM87_IN5_MAX, "Vccp2_max", SENSORS_LM87_IN5, SENSORS_LM87_IN5, - RW }, - 2, "in5_max", 3 }, - { { SENSORS_LM87_AIN1_MAX, "AIN1_max", SENSORS_LM87_AIN1, SENSORS_LM87_AIN1, - RW }, - 0, "in6_max", 3 }, - { { SENSORS_LM87_AIN2_MAX, "AIN2_max", SENSORS_LM87_AIN2, SENSORS_LM87_AIN2, - RW }, - 0, "in7_max", 3 }, - { { SENSORS_LM87_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM87_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM87_FAN1_MIN, "fan1_min", SENSORS_LM87_FAN1, SENSORS_LM87_FAN1, - RW }, - 0 }, - { { SENSORS_LM87_FAN2_MIN, "fan2_min", SENSORS_LM87_FAN2, SENSORS_LM87_FAN2, - RW }, - 0 }, - { { SENSORS_LM87_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_LM87_TEMP2, "CPU_Temp", NOMAP, NOMAP, R }, - 1, "temp2_input", 3 }, - { { SENSORS_LM87_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_LM87_TEMP1_HYST, "temp1_min", SENSORS_LM87_TEMP1, - SENSORS_LM87_TEMP1, RW }, - 1 }, - { { SENSORS_LM87_TEMP1_OVER, "temp1_max", SENSORS_LM87_TEMP1, - SENSORS_LM87_TEMP1, RW }, - 1 }, - { { SENSORS_LM87_TEMP2_HYST, "temp2_min", SENSORS_LM87_TEMP2, - SENSORS_LM87_TEMP2, RW }, - 1 }, - { { SENSORS_LM87_TEMP2_OVER, "temp2_max", SENSORS_LM87_TEMP2, - SENSORS_LM87_TEMP2, RW }, - 1 }, - { { SENSORS_LM87_TEMP3_HYST, "temp3_min", SENSORS_LM87_TEMP3, - SENSORS_LM87_TEMP3, RW }, - 1 }, - { { SENSORS_LM87_TEMP3_OVER, "temp3_max", SENSORS_LM87_TEMP3, - SENSORS_LM87_TEMP3, RW }, - 1 }, - { { SENSORS_LM87_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_LM87_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, -/* Ho hum, this will be wrong if fan1 is disabled, but fan2 isn't.. fix?? */ - { { SENSORS_LM87_FAN1_DIV, "fan1_div", SENSORS_LM87_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_LM87_FAN2_DIV, "fan2_div", SENSORS_LM87_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_LM87_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_LM87_ANALOG_OUT, "analog_out", NOMAP, NOMAP, RW }, - 0 , - "aout_output", 3 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature mtp008_features[] = - { - { { SENSORS_MTP008_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MTP008_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MTP008_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MTP008_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MTP008_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MTP008_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MTP008_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MTP008_IN0_MIN, "in0_min", SENSORS_MTP008_IN0, - SENSORS_MTP008_IN0, RW }, - 2 }, - { { SENSORS_MTP008_IN1_MIN, "in1_min", SENSORS_MTP008_IN1, - SENSORS_MTP008_IN1, RW }, - 2 }, - { { SENSORS_MTP008_IN2_MIN, "in2_min", SENSORS_MTP008_IN2, - SENSORS_MTP008_IN2, RW }, - 2 }, - { { SENSORS_MTP008_IN3_MIN, "in3_min", SENSORS_MTP008_IN3, - SENSORS_MTP008_IN3, RW }, - 2 }, - { { SENSORS_MTP008_IN4_MIN, "in4_min", SENSORS_MTP008_IN4, - SENSORS_MTP008_IN4, RW }, - 2 }, - { { SENSORS_MTP008_IN5_MIN, "in5_min", SENSORS_MTP008_IN5, - SENSORS_MTP008_IN5, RW }, - 2 }, - { { SENSORS_MTP008_IN6_MIN, "in6_min", SENSORS_MTP008_IN6, - SENSORS_MTP008_IN6, RW }, - 2 }, - { { SENSORS_MTP008_IN0_MAX, "in0_max", SENSORS_MTP008_IN0, - SENSORS_MTP008_IN0, RW }, - 2 }, - { { SENSORS_MTP008_IN1_MAX, "in1_max", SENSORS_MTP008_IN1, - SENSORS_MTP008_IN1, RW }, - 2 }, - { { SENSORS_MTP008_IN2_MAX, "in2_max", SENSORS_MTP008_IN2, - SENSORS_MTP008_IN2, RW }, - 2 }, - { { SENSORS_MTP008_IN3_MAX, "in3_max", SENSORS_MTP008_IN3, - SENSORS_MTP008_IN3, RW }, - 2 }, - { { SENSORS_MTP008_IN4_MAX, "in4_max", SENSORS_MTP008_IN4, - SENSORS_MTP008_IN4, RW }, - 2 }, - { { SENSORS_MTP008_IN5_MAX, "in5_max", SENSORS_MTP008_IN5, - SENSORS_MTP008_IN5, RW }, - 2 }, - { { SENSORS_MTP008_IN6_MAX, "in6_max", SENSORS_MTP008_IN6, - SENSORS_MTP008_IN6, RW }, - 2 }, - { { SENSORS_MTP008_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MTP008_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MTP008_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MTP008_FAN1_MIN, "fan1_min", SENSORS_MTP008_FAN1, - SENSORS_MTP008_FAN1, RW }, - 0 }, - { { SENSORS_MTP008_FAN2_MIN, "fan2_min", SENSORS_MTP008_FAN2, - SENSORS_MTP008_FAN2, RW }, - 0 }, - { { SENSORS_MTP008_FAN3_MIN, "fan3_min", SENSORS_MTP008_FAN3, - SENSORS_MTP008_FAN3, RW }, - 0 }, - { { SENSORS_MTP008_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MTP008_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MTP008_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_MTP008_TEMP1_OVER, "temp1_over", SENSORS_MTP008_TEMP1, - SENSORS_MTP008_TEMP1, RW }, - 1 }, - { { SENSORS_MTP008_TEMP2_OVER, "temp2_over", SENSORS_MTP008_TEMP2, - SENSORS_MTP008_TEMP2, RW }, - 1 }, - { { SENSORS_MTP008_TEMP3_OVER, "temp3_over", SENSORS_MTP008_TEMP3, - SENSORS_MTP008_TEMP3, RW }, - 1 }, - { { SENSORS_MTP008_TEMP1_HYST, "temp1_hyst", SENSORS_MTP008_TEMP1, - SENSORS_MTP008_TEMP1, RW }, - 1 }, - { { SENSORS_MTP008_TEMP2_HYST, "temp2_hyst", SENSORS_MTP008_TEMP2, - SENSORS_MTP008_TEMP2, RW }, - 1 }, - { { SENSORS_MTP008_TEMP3_HYST, "temp3_hyst", SENSORS_MTP008_TEMP3, - SENSORS_MTP008_TEMP3, RW }, - 1 }, - { { SENSORS_MTP008_VID, "vid", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_MTP008_FAN1_DIV, "fan1_div", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_MTP008_FAN2_DIV, "fan2_div", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_MTP008_FAN3_DIV, "fan3_div", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_MTP008_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MTP008_BEEP, "beeps", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature ds1621_features[] = - { - { { SENSORS_DS1621_TEMP, "temp", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_DS1621_TEMP_HYST, "temp_hyst", SENSORS_DS1621_TEMP, - SENSORS_DS1621_TEMP, RW }, - 1, "temp1_min", - 3 }, - { { SENSORS_DS1621_TEMP_OVER, "temp_over", SENSORS_DS1621_TEMP, - SENSORS_DS1621_TEMP, RW }, - 1 }, - { { SENSORS_DS1621_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature it87_features[] = - { - { { SENSORS_IT87_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_IN6, "in6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_IN7, "in7", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_IN8, "in8", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_IN0_MIN, "in0_min", SENSORS_IT87_IN0, SENSORS_IT87_IN0, RW }, - 2 }, - { { SENSORS_IT87_IN1_MIN, "in1_min", SENSORS_IT87_IN1, SENSORS_IT87_IN1, RW }, - 2 }, - { { SENSORS_IT87_IN2_MIN, "in2_min", SENSORS_IT87_IN2, SENSORS_IT87_IN2, RW }, - 2 }, - { { SENSORS_IT87_IN3_MIN, "in3_min", SENSORS_IT87_IN3, SENSORS_IT87_IN3, RW }, - 2 }, - { { SENSORS_IT87_IN4_MIN, "in4_min", SENSORS_IT87_IN4, SENSORS_IT87_IN4, RW }, - 2 }, - { { SENSORS_IT87_IN5_MIN, "in5_min", SENSORS_IT87_IN5, SENSORS_IT87_IN5, RW }, - 2 }, - { { SENSORS_IT87_IN6_MIN, "in6_min", SENSORS_IT87_IN6, SENSORS_IT87_IN6, RW }, - 2 }, - { { SENSORS_IT87_IN7_MIN, "in7_min", SENSORS_IT87_IN7, SENSORS_IT87_IN7, RW }, - 2 }, - { { SENSORS_IT87_IN0_MAX, "in0_max", SENSORS_IT87_IN0, SENSORS_IT87_IN0, RW }, - 2 }, - { { SENSORS_IT87_IN1_MAX, "in1_max", SENSORS_IT87_IN1, SENSORS_IT87_IN1, RW }, - 2 }, - { { SENSORS_IT87_IN2_MAX, "in2_max", SENSORS_IT87_IN2, SENSORS_IT87_IN2, RW }, - 2 }, - { { SENSORS_IT87_IN3_MAX, "in3_max", SENSORS_IT87_IN3, SENSORS_IT87_IN3, RW }, - 2 }, - { { SENSORS_IT87_IN4_MAX, "in4_max", SENSORS_IT87_IN4, SENSORS_IT87_IN4, RW }, - 2 }, - { { SENSORS_IT87_IN5_MAX, "in5_max", SENSORS_IT87_IN5, SENSORS_IT87_IN5, RW }, - 2 }, - { { SENSORS_IT87_IN6_MAX, "in6_max", SENSORS_IT87_IN6, SENSORS_IT87_IN6, RW }, - 2 }, - { { SENSORS_IT87_IN7_MAX, "in7_max", SENSORS_IT87_IN7, SENSORS_IT87_IN7, RW }, - 2 }, - { { SENSORS_IT87_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_IT87_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_IT87_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_IT87_FAN1_MIN, "fan1_min", SENSORS_IT87_FAN1, SENSORS_IT87_FAN1, - RW }, - 0 }, - { { SENSORS_IT87_FAN2_MIN, "fan2_min", SENSORS_IT87_FAN2, SENSORS_IT87_FAN2, - RW }, - 0 }, - { { SENSORS_IT87_FAN3_MIN, "fan3_min", SENSORS_IT87_FAN3, SENSORS_IT87_FAN3, - RW }, - 0 }, - { { SENSORS_IT87_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_IT87_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_IT87_TEMP3, "temp3", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_IT87_TEMP1_LOW, "temp1_low", SENSORS_IT87_TEMP1, - SENSORS_IT87_TEMP1, RW }, - 1 }, - { { SENSORS_IT87_TEMP2_LOW, "temp2_low", SENSORS_IT87_TEMP2, - SENSORS_IT87_TEMP2, RW }, - 1 }, - { { SENSORS_IT87_TEMP3_LOW, "temp3_low", SENSORS_IT87_TEMP3, - SENSORS_IT87_TEMP3, RW }, - 1 }, - { { SENSORS_IT87_TEMP1_HIGH, "temp1_over", SENSORS_IT87_TEMP1, - SENSORS_IT87_TEMP1, RW }, - 1 }, - { { SENSORS_IT87_TEMP2_HIGH, "temp2_over", SENSORS_IT87_TEMP2, - SENSORS_IT87_TEMP2, RW }, - 1 }, - { { SENSORS_IT87_TEMP3_HIGH, "temp3_over", SENSORS_IT87_TEMP3, - SENSORS_IT87_TEMP3, RW }, - 1 }, - { { SENSORS_IT87_VID, "vid", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_IT87_FAN1_DIV, "fan1_div", SENSORS_IT87_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_IT87_FAN2_DIV, "fan2_div", SENSORS_IT87_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_IT87_FAN3_DIV, "fan3_div", SENSORS_IT87_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_IT87_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_IT87_SENS1, "sensor1", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_IT87_SENS2, "sensor2", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_IT87_SENS3, "sensor3", NOMAP, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature fscpos_features[] = - { - { { SENSORS_FSCPOS_REV, "rev", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCPOS_EVENT, "event", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCPOS_CONTROL, "control", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_FSCPOS_VOLTAGE1, "volt12", NOMAP, NOMAP, R }, - 2, "in0_input", - 3 }, - { { SENSORS_FSCPOS_VOLTAGE2, "volt5", NOMAP, NOMAP, R }, - 2, "in1_input", - 3 }, - { { SENSORS_FSCPOS_VOLTAGE3, "voltbatt", NOMAP, NOMAP, R }, - 2, "in2_input", - 3 }, - { { SENSORS_FSCPOS_TEMP1, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCPOS_TEMP2, "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCPOS_TEMP3, "temp3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCPOS_TEMP1_STATE, "temp1_state", SENSORS_FSCPOS_TEMP1, - SENSORS_FSCPOS_TEMP1, RW }, - 0 }, - { { SENSORS_FSCPOS_TEMP2_STATE, "temp2_state", SENSORS_FSCPOS_TEMP2, - SENSORS_FSCPOS_TEMP2, RW }, - 0 }, - { { SENSORS_FSCPOS_TEMP3_STATE, "temp3_state", SENSORS_FSCPOS_TEMP3, - SENSORS_FSCPOS_TEMP3, RW }, - 0 }, - { { SENSORS_FSCPOS_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCPOS_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCPOS_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCPOS_FAN1_MIN, "fan1_min", SENSORS_FSCPOS_FAN1, - SENSORS_FSCPOS_FAN1, RW }, - 0, "pwm1", 0 }, - { { SENSORS_FSCPOS_FAN2_MIN, "fan2_min", SENSORS_FSCPOS_FAN2, - SENSORS_FSCPOS_FAN2, RW }, - 0, "pwm2", 0 }, - { { SENSORS_FSCPOS_FAN1_STATE, "fan1_state", SENSORS_FSCPOS_FAN1, - SENSORS_FSCPOS_FAN1, RW }, - 0 }, - { { SENSORS_FSCPOS_FAN2_STATE, "fan2_state", SENSORS_FSCPOS_FAN2, - SENSORS_FSCPOS_FAN2, RW }, - 0 }, - { { SENSORS_FSCPOS_FAN3_STATE, "fan3_state", SENSORS_FSCPOS_FAN3, - SENSORS_FSCPOS_FAN3, RW }, - 0 }, - { { SENSORS_FSCPOS_FAN1_RIPPLE, "fan1_ripple", SENSORS_FSCPOS_FAN1, - SENSORS_FSCPOS_FAN1, RW }, - 0 }, - { { SENSORS_FSCPOS_FAN2_RIPPLE, "fan2_ripple", SENSORS_FSCPOS_FAN2, - SENSORS_FSCPOS_FAN2, RW }, - 0 }, - { { SENSORS_FSCPOS_FAN3_RIPPLE, "fan3_ripple", SENSORS_FSCPOS_FAN3, - SENSORS_FSCPOS_FAN3, RW }, - 0 }, - { { SENSORS_FSCPOS_WDOG_PRESET, "wdog_preset", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_FSCPOS_WDOG_STATE, "wdog_state", SENSORS_FSCPOS_WDOG_PRESET, - SENSORS_FSCPOS_WDOG_PRESET, RW }, - 0 }, - { { SENSORS_FSCPOS_WDOG_CONTROL, "wdog_control", SENSORS_FSCPOS_WDOG_PRESET, - SENSORS_FSCPOS_WDOG_PRESET, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature fscscy_features[] = - { - { { SENSORS_FSCSCY_REV, "rev", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_EVENT, "event", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_CONTROL, "control", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_FSCSCY_VOLTAGE1, "volt12", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_FSCSCY_VOLTAGE2, "volt5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_FSCSCY_VOLTAGE3, "voltbatt", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_FSCSCY_TEMP1, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP2, "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP3, "temp3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP4, "temp4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP1_STATE, "temp1_state", SENSORS_FSCSCY_TEMP1, - SENSORS_FSCSCY_TEMP1, RW }, - 0 }, - { { SENSORS_FSCSCY_TEMP2_STATE, "temp2_state", SENSORS_FSCSCY_TEMP2, - SENSORS_FSCSCY_TEMP2, RW }, - 0 }, - { { SENSORS_FSCSCY_TEMP3_STATE, "temp3_state", SENSORS_FSCSCY_TEMP3, - SENSORS_FSCSCY_TEMP3, RW }, - 0 }, - { { SENSORS_FSCSCY_TEMP4_STATE, "temp4_state", SENSORS_FSCSCY_TEMP4, - SENSORS_FSCSCY_TEMP4, RW }, - 0 }, - { { SENSORS_FSCSCY_TEMP1_LIM, "temp1_lim", SENSORS_FSCSCY_TEMP1, - SENSORS_FSCSCY_TEMP1, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP2_LIM, "temp2_lim", SENSORS_FSCSCY_TEMP2, - SENSORS_FSCSCY_TEMP2, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP3_LIM, "temp3_lim", SENSORS_FSCSCY_TEMP3, - SENSORS_FSCSCY_TEMP3, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP4_LIM, "temp4_lim", SENSORS_FSCSCY_TEMP4, - SENSORS_FSCSCY_TEMP4, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP1_MIN, "temp1_min", SENSORS_FSCSCY_TEMP1, - SENSORS_FSCSCY_TEMP1, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP2_MIN, "temp2_min", SENSORS_FSCSCY_TEMP2, - SENSORS_FSCSCY_TEMP2, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP3_MIN, "temp3_min", SENSORS_FSCSCY_TEMP3, - SENSORS_FSCSCY_TEMP3, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP4_MIN, "temp4_min", SENSORS_FSCSCY_TEMP4, - SENSORS_FSCSCY_TEMP4, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP1_MAX, "temp1_max", SENSORS_FSCSCY_TEMP1, - SENSORS_FSCSCY_TEMP1, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP2_MAX, "temp2_max", SENSORS_FSCSCY_TEMP2, - SENSORS_FSCSCY_TEMP2, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP3_MAX, "temp3_max", SENSORS_FSCSCY_TEMP3, - SENSORS_FSCSCY_TEMP3, R }, - 0 }, - { { SENSORS_FSCSCY_TEMP4_MAX, "temp4_max", SENSORS_FSCSCY_TEMP4, - SENSORS_FSCSCY_TEMP4, R }, - 0 }, - { { SENSORS_FSCSCY_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_FAN4, "fan4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_FAN5, "fan5", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_FAN6, "fan6", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCSCY_FAN1_MIN, "fan1_min", SENSORS_FSCSCY_FAN1, - SENSORS_FSCSCY_FAN1, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN2_MIN, "fan2_min", SENSORS_FSCSCY_FAN2, - SENSORS_FSCSCY_FAN2, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN3_MIN, "fan3_min", SENSORS_FSCSCY_FAN3, - SENSORS_FSCSCY_FAN3, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN4_MIN, "fan4_min", SENSORS_FSCSCY_FAN4, - SENSORS_FSCSCY_FAN4, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN5_MIN, "fan5_min", SENSORS_FSCSCY_FAN5, - SENSORS_FSCSCY_FAN5, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN6_MIN, "fan6_min", SENSORS_FSCSCY_FAN6, - SENSORS_FSCSCY_FAN6, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN1_STATE, "fan1_state", SENSORS_FSCSCY_FAN1, - SENSORS_FSCSCY_FAN1, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN2_STATE, "fan2_state", SENSORS_FSCSCY_FAN2, - SENSORS_FSCSCY_FAN2, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN3_STATE, "fan3_state", SENSORS_FSCSCY_FAN3, - SENSORS_FSCSCY_FAN3, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN4_STATE, "fan4_state", SENSORS_FSCSCY_FAN4, - SENSORS_FSCSCY_FAN4, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN5_STATE, "fan5_state", SENSORS_FSCSCY_FAN5, - SENSORS_FSCSCY_FAN5, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN6_STATE, "fan6_state", SENSORS_FSCSCY_FAN6, - SENSORS_FSCSCY_FAN6, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN1_RIPPLE, "fan1_ripple", SENSORS_FSCSCY_FAN1, - SENSORS_FSCSCY_FAN1, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN2_RIPPLE, "fan2_ripple", SENSORS_FSCSCY_FAN2, - SENSORS_FSCSCY_FAN2, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN3_RIPPLE, "fan3_ripple", SENSORS_FSCSCY_FAN3, - SENSORS_FSCSCY_FAN3, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN4_RIPPLE, "fan4_ripple", SENSORS_FSCSCY_FAN4, - SENSORS_FSCSCY_FAN4, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN5_RIPPLE, "fan5_ripple", SENSORS_FSCSCY_FAN5, - SENSORS_FSCSCY_FAN5, RW }, - 0 }, - { { SENSORS_FSCSCY_FAN6_RIPPLE, "fan6_ripple", SENSORS_FSCSCY_FAN6, - SENSORS_FSCSCY_FAN6, RW }, - 0 }, - { { SENSORS_FSCSCY_WDOG_PRESET, "wdog_preset", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_FSCSCY_WDOG_STATE, "wdog_state", SENSORS_FSCSCY_WDOG_PRESET, - SENSORS_FSCSCY_WDOG_PRESET, RW }, - 0 }, - { { SENSORS_FSCSCY_WDOG_CONTROL, "wdog_control", SENSORS_FSCSCY_WDOG_PRESET, - SENSORS_FSCSCY_WDOG_PRESET, RW }, - 0 }, - { { 0 }, 0 } - }; - - static sensors_chip_feature fscher_features[] = - { - { { SENSORS_FSCHER_REV, "rev", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCHER_EVENT, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCHER_CONTROL, "control", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_FSCHER_VOLTAGE1, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_FSCHER_VOLTAGE2, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_FSCHER_VOLTAGE3, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_FSCHER_TEMP1, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCHER_TEMP2, "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCHER_TEMP3, "temp3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCHER_TEMP1_STATE, "temp1_state", SENSORS_FSCHER_TEMP1, - SENSORS_FSCHER_TEMP1, RW }, - 0 }, - { { SENSORS_FSCHER_TEMP2_STATE, "temp2_state", SENSORS_FSCHER_TEMP2, - SENSORS_FSCHER_TEMP2, RW }, - 0 }, - { { SENSORS_FSCHER_TEMP3_STATE, "temp3_state", SENSORS_FSCHER_TEMP3, - SENSORS_FSCHER_TEMP3, RW }, - 0 }, - { { SENSORS_FSCHER_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCHER_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCHER_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_FSCHER_PWM1, "pwm1", SENSORS_FSCHER_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_FSCHER_PWM2, "pwm2", SENSORS_FSCHER_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_FSCHER_PWM3, "pwm3", SENSORS_FSCHER_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_FSCHER_FAN1_STATE, "fan1_state", SENSORS_FSCHER_FAN1, - SENSORS_FSCHER_FAN1, RW }, - 0 }, - { { SENSORS_FSCHER_FAN2_STATE, "fan2_state", SENSORS_FSCHER_FAN2, - SENSORS_FSCHER_FAN2, RW }, - 0 }, - { { SENSORS_FSCHER_FAN3_STATE, "fan3_state", SENSORS_FSCHER_FAN3, - SENSORS_FSCHER_FAN3, RW }, - 0 }, - { { SENSORS_FSCHER_FAN1_RIPPLE, "fan1_ripple", SENSORS_FSCHER_FAN1, - SENSORS_FSCHER_FAN1, RW }, - 0 }, - { { SENSORS_FSCHER_FAN2_RIPPLE, "fan2_ripple", SENSORS_FSCHER_FAN2, - SENSORS_FSCHER_FAN2, RW }, - 0 }, - { { SENSORS_FSCHER_FAN3_RIPPLE, "fan3_ripple", SENSORS_FSCHER_FAN3, - SENSORS_FSCHER_FAN3, RW }, - 0 }, - { { SENSORS_FSCHER_WDOG_PRESET, "wdog_preset", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_FSCHER_WDOG_STATE, "wdog_state", SENSORS_FSCHER_WDOG_PRESET, - SENSORS_FSCHER_WDOG_PRESET, RW }, - 0 }, - { { SENSORS_FSCHER_WDOG_CONTROL, "wdog_control", SENSORS_FSCHER_WDOG_PRESET, - SENSORS_FSCHER_WDOG_PRESET, RW }, - 0 }, - { { 0 }, 0 } - }; - - static sensors_chip_feature pcf8591_features[] = - { - { { SENSORS_PCF8591_AIN_CONF, "ain_conf", NOMAP, NOMAP, RW }, - 0 }, - { { SENSORS_PCF8591_CH0, "ch0", NOMAP, NOMAP, R }, - 2, "in0_input", 3 }, - { { SENSORS_PCF8591_CH1, "ch1", NOMAP, NOMAP, R }, - 2, "in1_input", 3 }, - { { SENSORS_PCF8591_CH2, "ch2", NOMAP, NOMAP, R }, - 2, "in2_input", 3 }, - { { SENSORS_PCF8591_CH3, "ch3", NOMAP, NOMAP, R }, - 2, "in3_input", 3 }, - { { SENSORS_PCF8591_AOUT_ENABLE, "aout_enable", NOMAP, NOMAP, RW }, - 0, - "out0_enable", 0 }, - { { SENSORS_PCF8591_AOUT, "aout", NOMAP, NOMAP, RW }, - 2, "out0_output", - 3 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature vt1211_features[] = - { - { { SENSORS_VT1211_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT1211_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT1211_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT1211_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT1211_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT1211_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT1211_IN0_MIN, "in0_min", SENSORS_VT1211_IN0, - SENSORS_VT1211_IN0, RW }, - 2 }, - { { SENSORS_VT1211_IN1_MIN, "in1_min", SENSORS_VT1211_IN1, - SENSORS_VT1211_IN1, RW }, - 2 }, - { { SENSORS_VT1211_IN2_MIN, "in2_min", SENSORS_VT1211_IN2, - SENSORS_VT1211_IN2, RW }, - 2 }, - { { SENSORS_VT1211_IN3_MIN, "in3_min", SENSORS_VT1211_IN3, - SENSORS_VT1211_IN3, RW }, - 2 }, - { { SENSORS_VT1211_IN4_MIN, "in4_min", SENSORS_VT1211_IN4, - SENSORS_VT1211_IN4, RW }, - 2 }, - { { SENSORS_VT1211_IN5_MIN, "in5_min", SENSORS_VT1211_IN5, - SENSORS_VT1211_IN5, RW }, - 2 }, - { { SENSORS_VT1211_IN0_MAX, "in0_max", SENSORS_VT1211_IN0, - SENSORS_VT1211_IN0, RW }, - 2 }, - { { SENSORS_VT1211_IN1_MAX, "in1_max", SENSORS_VT1211_IN1, - SENSORS_VT1211_IN1, RW }, - 2 }, - { { SENSORS_VT1211_IN2_MAX, "in2_max", SENSORS_VT1211_IN2, - SENSORS_VT1211_IN2, RW }, - 2 }, - { { SENSORS_VT1211_IN3_MAX, "in3_max", SENSORS_VT1211_IN3, - SENSORS_VT1211_IN3, RW }, - 2 }, - { { SENSORS_VT1211_IN4_MAX, "in4_max", SENSORS_VT1211_IN4, - SENSORS_VT1211_IN4, RW }, - 2 }, - { { SENSORS_VT1211_IN5_MAX, "in5_max", SENSORS_VT1211_IN5, - SENSORS_VT1211_IN5, RW }, - 2 }, - { { SENSORS_VT1211_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_VT1211_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_VT1211_FAN1_MIN, "fan1_min", SENSORS_VT1211_FAN1, - SENSORS_VT1211_FAN1, RW }, - 0 }, - { { SENSORS_VT1211_FAN2_MIN, "fan2_min", SENSORS_VT1211_FAN2, - SENSORS_VT1211_FAN2, RW }, - 0 }, - { { SENSORS_VT1211_TEMP1, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_VT1211_TEMP1_HYST, "temp1_hyst", SENSORS_VT1211_TEMP1, - SENSORS_VT1211_TEMP1, RW }, - 1 }, - { { SENSORS_VT1211_TEMP1_OVER, "temp1_over", SENSORS_VT1211_TEMP1, - SENSORS_VT1211_TEMP1, RW }, - 1 }, - { { SENSORS_VT1211_TEMP2, "temp2", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_VT1211_TEMP2_HYST, "temp2_hyst", SENSORS_VT1211_TEMP2, - SENSORS_VT1211_TEMP2, RW }, - 1 }, - { { SENSORS_VT1211_TEMP2_OVER, "temp2_over", SENSORS_VT1211_TEMP2, - SENSORS_VT1211_TEMP2, RW }, - 1 }, - { { SENSORS_VT1211_TEMP3, "temp3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_VT1211_TEMP3_HYST, "temp3_hyst", SENSORS_VT1211_TEMP3, - SENSORS_VT1211_TEMP3, RW }, - 3 }, - { { SENSORS_VT1211_TEMP3_OVER, "temp3_over", SENSORS_VT1211_TEMP3, - SENSORS_VT1211_TEMP3, RW }, - 3 }, - { { SENSORS_VT1211_TEMP4, "temp4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_VT1211_TEMP4_HYST, "temp4_hyst", SENSORS_VT1211_TEMP4, - SENSORS_VT1211_TEMP4, RW }, - 3 }, - { { SENSORS_VT1211_TEMP4_OVER, "temp4_over", SENSORS_VT1211_TEMP4, - SENSORS_VT1211_TEMP4, RW }, - 3 }, - { { SENSORS_VT1211_TEMP5, "temp5", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_VT1211_TEMP5_HYST, "temp5_hyst", SENSORS_VT1211_TEMP5, - SENSORS_VT1211_TEMP5, RW }, - 3 }, - { { SENSORS_VT1211_TEMP5_OVER, "temp5_over", SENSORS_VT1211_TEMP5, - SENSORS_VT1211_TEMP5, RW }, - 3 }, - { { SENSORS_VT1211_TEMP6, "temp6", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_VT1211_TEMP6_HYST, "temp6_hyst", SENSORS_VT1211_TEMP6, - SENSORS_VT1211_TEMP6, RW }, - 3 }, - { { SENSORS_VT1211_TEMP6_OVER, "temp6_over", SENSORS_VT1211_TEMP6, - SENSORS_VT1211_TEMP6, RW }, - 3 }, - { { SENSORS_VT1211_TEMP7, "temp7", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_VT1211_TEMP7_HYST, "temp7_hyst", SENSORS_VT1211_TEMP7, - SENSORS_VT1211_TEMP7, RW }, - 3 }, - { { SENSORS_VT1211_TEMP7_OVER, "temp7_over", SENSORS_VT1211_TEMP7, - SENSORS_VT1211_TEMP7, RW }, - 3 }, - { { SENSORS_VT1211_FAN1_DIV, "fan1_div", SENSORS_VT1211_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_VT1211_FAN2_DIV, "fan2_div", SENSORS_VT1211_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_VT1211_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_VT1211_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_VT1211_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_VT1211_UCH, "config", NOMAP, NOMAP, RW }, - 0, "uch_config" }, - { { 0 }, 0 } - }; - -static sensors_chip_feature smsc47m1_features[] = - { - { { SENSORS_SMSC47M1_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M1_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M1_FAN1_MIN, "fan1_min", SENSORS_SMSC47M1_FAN1, - SENSORS_SMSC47M1_FAN1, RW }, - 0 }, - { { SENSORS_SMSC47M1_FAN2_MIN, "fan2_min", SENSORS_SMSC47M1_FAN2, - SENSORS_SMSC47M1_FAN2, RW }, - 0 }, - { { SENSORS_SMSC47M1_FAN1_DIV, "fan1_div", SENSORS_SMSC47M1_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_SMSC47M1_FAN2_DIV, "fan2_div", SENSORS_SMSC47M1_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_SMSC47M1_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature smsc47m2_features[] = - { - { { SENSORS_SMSC47M1_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M1_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M1_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M1_FAN1_MIN, "fan1_min", SENSORS_SMSC47M1_FAN1, - SENSORS_SMSC47M1_FAN1, RW }, - 0 }, - { { SENSORS_SMSC47M1_FAN2_MIN, "fan2_min", SENSORS_SMSC47M1_FAN2, - SENSORS_SMSC47M1_FAN2, RW }, - 0 }, - { { SENSORS_SMSC47M1_FAN3_MIN, "fan3_min", SENSORS_SMSC47M1_FAN3, - SENSORS_SMSC47M1_FAN3, RW }, - 0 }, - { { SENSORS_SMSC47M1_FAN1_DIV, "fan1_div", SENSORS_SMSC47M1_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_SMSC47M1_FAN2_DIV, "fan2_div", SENSORS_SMSC47M1_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_SMSC47M1_FAN3_DIV, "fan3_div", SENSORS_SMSC47M1_FAN3, NOMAP, RW }, - 0 }, - { { SENSORS_SMSC47M1_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature smsc47m192_features[] = - { - { { SENSORS_SMSC47M192_IN(0), "in0", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_SMSC47M192_IN(1), "in1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_SMSC47M192_IN(2), "in2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_SMSC47M192_IN(3), "in3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_SMSC47M192_IN(4), "in4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_SMSC47M192_IN(5), "in5", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_SMSC47M192_IN(6), "in6", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_SMSC47M192_IN(7), "in7", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_SMSC47M192_IN_MIN(0), "in0_min", SENSORS_SMSC47M192_IN(0), - SENSORS_SMSC47M192_IN(0), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MIN(1), "in1_min", SENSORS_SMSC47M192_IN(1), - SENSORS_SMSC47M192_IN(1), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MIN(2), "in2_min", SENSORS_SMSC47M192_IN(2), - SENSORS_SMSC47M192_IN(2), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MIN(3), "in3_min", SENSORS_SMSC47M192_IN(3), - SENSORS_SMSC47M192_IN(3), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MIN(4), "in4_min", SENSORS_SMSC47M192_IN(4), - SENSORS_SMSC47M192_IN(4), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MIN(5), "in5_min", SENSORS_SMSC47M192_IN(5), - SENSORS_SMSC47M192_IN(5), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MIN(6), "in6_min", SENSORS_SMSC47M192_IN(6), - SENSORS_SMSC47M192_IN(6), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MIN(7), "in7_min", SENSORS_SMSC47M192_IN(7), - SENSORS_SMSC47M192_IN(7), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MAX(0), "in0_max", SENSORS_SMSC47M192_IN(0), - SENSORS_SMSC47M192_IN(0), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MAX(1), "in1_max", SENSORS_SMSC47M192_IN(1), - SENSORS_SMSC47M192_IN(1), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MAX(2), "in2_max", SENSORS_SMSC47M192_IN(2), - SENSORS_SMSC47M192_IN(2), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MAX(3), "in3_max", SENSORS_SMSC47M192_IN(3), - SENSORS_SMSC47M192_IN(3), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MAX(4), "in4_max", SENSORS_SMSC47M192_IN(4), - SENSORS_SMSC47M192_IN(4), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MAX(5), "in5_max", SENSORS_SMSC47M192_IN(5), - SENSORS_SMSC47M192_IN(5), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MAX(6), "in6_max", SENSORS_SMSC47M192_IN(6), - SENSORS_SMSC47M192_IN(6), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_MAX(7), "in7_max", SENSORS_SMSC47M192_IN(7), - SENSORS_SMSC47M192_IN(7), RW }, - 3 }, - { { SENSORS_SMSC47M192_IN_ALARM(0), "in0_alarm", SENSORS_SMSC47M192_IN(0), - NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_IN_ALARM(1), "in1_alarm", SENSORS_SMSC47M192_IN(1), - NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_IN_ALARM(2), "in2_alarm", SENSORS_SMSC47M192_IN(2), - NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_IN_ALARM(3), "in3_alarm", SENSORS_SMSC47M192_IN(3), - NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_IN_ALARM(4), "in4_alarm", SENSORS_SMSC47M192_IN(4), - NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_IN_ALARM(5), "in5_alarm", SENSORS_SMSC47M192_IN(5), - NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_IN_ALARM(6), "in6_alarm", SENSORS_SMSC47M192_IN(6), - NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_IN_ALARM(7), "in7_alarm", SENSORS_SMSC47M192_IN(7), - NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_TEMP(1), "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_TEMP(2), "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_TEMP(3), "temp3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_MIN(1), "temp1_min", SENSORS_SMSC47M192_TEMP(1), - SENSORS_SMSC47M192_TEMP(1), RW }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_MIN(2), "temp2_min", SENSORS_SMSC47M192_TEMP(2), - SENSORS_SMSC47M192_TEMP(2), RW }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_MIN(3), "temp3_min", SENSORS_SMSC47M192_TEMP(3), - SENSORS_SMSC47M192_TEMP(3), RW }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_MAX(1), "temp1_max", SENSORS_SMSC47M192_TEMP(1), - SENSORS_SMSC47M192_TEMP(1), RW }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_MAX(2), "temp2_max", SENSORS_SMSC47M192_TEMP(2), - SENSORS_SMSC47M192_TEMP(2), RW }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_MAX(3), "temp3_max", SENSORS_SMSC47M192_TEMP(3), - SENSORS_SMSC47M192_TEMP(3), RW }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_ALARM(1), "temp1_alarm", - SENSORS_SMSC47M192_TEMP(1), NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_ALARM(2), "temp2_alarm", - SENSORS_SMSC47M192_TEMP(2), NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_ALARM(3), "temp3_alarm", - SENSORS_SMSC47M192_TEMP(3), NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_FAULT(2), "temp2_input_fault", - SENSORS_SMSC47M192_TEMP(2), NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_TEMP_FAULT(3), "temp3_input_fault", - SENSORS_SMSC47M192_TEMP(3), NOMAP, R }, - 0 }, - { { SENSORS_SMSC47M192_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_SMSC47M192_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { 0 }, 0 } - }; - - -static sensors_chip_feature pc87360_features[] = - { - { { SENSORS_PC87360_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN1_MIN, "fan1_min", SENSORS_PC87360_FAN1, - SENSORS_PC87360_FAN1, RW }, - 0 }, - { { SENSORS_PC87360_FAN2_MIN, "fan2_min", SENSORS_PC87360_FAN2, - SENSORS_PC87360_FAN2, RW }, - 0 }, - { { SENSORS_PC87360_FAN3_MIN, "fan3_min", SENSORS_PC87360_FAN3, - SENSORS_PC87360_FAN3, RW }, - 0 }, - { { SENSORS_PC87360_FAN1_DIV, "fan1_div", SENSORS_PC87360_FAN1, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN2_DIV, "fan2_div", SENSORS_PC87360_FAN2, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN3_DIV, "fan3_div", SENSORS_PC87360_FAN3, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN1_STATUS, "fan1_status", SENSORS_PC87360_FAN1, NOMAP, - R }, - 0 }, - { { SENSORS_PC87360_FAN2_STATUS, "fan2_status", SENSORS_PC87360_FAN2, NOMAP, - R }, - 0 }, - { { SENSORS_PC87360_FAN3_STATUS, "fan3_status", SENSORS_PC87360_FAN3, NOMAP, - R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature pc87365_features[] = - { - { { SENSORS_PC87360_ALARMS_IN, "alarms_in", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_ALARMS_TEMP, "alarms_temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN3, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN1_MIN, "fan1_min", SENSORS_PC87360_FAN1, - SENSORS_PC87360_FAN1, RW }, - 0 }, - { { SENSORS_PC87360_FAN2_MIN, "fan2_min", SENSORS_PC87360_FAN2, - SENSORS_PC87360_FAN2, RW }, - 0 }, - { { SENSORS_PC87360_FAN3_MIN, "fan3_min", SENSORS_PC87360_FAN3, - SENSORS_PC87360_FAN3, RW }, - 0 }, - { { SENSORS_PC87360_FAN1_DIV, "fan1_div", SENSORS_PC87360_FAN1, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN2_DIV, "fan2_div", SENSORS_PC87360_FAN2, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN3_DIV, "fan3_div", SENSORS_PC87360_FAN3, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_FAN1_STATUS, "fan1_status", SENSORS_PC87360_FAN1, NOMAP, - R }, - 0 }, - { { SENSORS_PC87360_FAN2_STATUS, "fan2_status", SENSORS_PC87360_FAN2, NOMAP, - R }, - 0 }, - { { SENSORS_PC87360_FAN3_STATUS, "fan3_status", SENSORS_PC87360_FAN3, NOMAP, - R }, - 0 }, - { { SENSORS_PC87360_IN0, "in0", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN1, "in1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN2, "in2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN3, "in3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN4, "in4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN5, "in5", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN6, "in6", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN7, "in7", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN8, "in8", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN9, "in9", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN10, "in10", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_IN0_MIN, "in0_min", SENSORS_PC87360_IN0, - SENSORS_PC87360_IN0, RW }, - 3 }, - { { SENSORS_PC87360_IN1_MIN, "in1_min", SENSORS_PC87360_IN1, - SENSORS_PC87360_IN1, RW }, - 3 }, - { { SENSORS_PC87360_IN2_MIN, "in2_min", SENSORS_PC87360_IN2, - SENSORS_PC87360_IN2, RW }, - 3 }, - { { SENSORS_PC87360_IN3_MIN, "in3_min", SENSORS_PC87360_IN3, - SENSORS_PC87360_IN3, RW }, - 3 }, - { { SENSORS_PC87360_IN4_MIN, "in4_min", SENSORS_PC87360_IN4, - SENSORS_PC87360_IN4, RW }, - 3 }, - { { SENSORS_PC87360_IN5_MIN, "in5_min", SENSORS_PC87360_IN5, - SENSORS_PC87360_IN5, RW }, - 3 }, - { { SENSORS_PC87360_IN6_MIN, "in6_min", SENSORS_PC87360_IN6, - SENSORS_PC87360_IN6, RW }, - 3 }, - { { SENSORS_PC87360_IN7_MIN, "in7_min", SENSORS_PC87360_IN7, - SENSORS_PC87360_IN7, RW }, - 3 }, - { { SENSORS_PC87360_IN8_MIN, "in8_min", SENSORS_PC87360_IN8, - SENSORS_PC87360_IN8, RW }, - 3 }, - { { SENSORS_PC87360_IN9_MIN, "in9_min", SENSORS_PC87360_IN9, - SENSORS_PC87360_IN9, RW }, - 3 }, - { { SENSORS_PC87360_IN10_MIN, "in10_min", SENSORS_PC87360_IN10, - SENSORS_PC87360_IN10, RW }, - 3 }, - { { SENSORS_PC87360_IN0_MAX, "in0_max", SENSORS_PC87360_IN0, - SENSORS_PC87360_IN0, RW }, - 3 }, - { { SENSORS_PC87360_IN1_MAX, "in1_max", SENSORS_PC87360_IN1, - SENSORS_PC87360_IN1, RW }, - 3 }, - { { SENSORS_PC87360_IN2_MAX, "in2_max", SENSORS_PC87360_IN2, - SENSORS_PC87360_IN2, RW }, - 3 }, - { { SENSORS_PC87360_IN3_MAX, "in3_max", SENSORS_PC87360_IN3, - SENSORS_PC87360_IN3, RW }, - 3 }, - { { SENSORS_PC87360_IN4_MAX, "in4_max", SENSORS_PC87360_IN4, - SENSORS_PC87360_IN4, RW }, - 3 }, - { { SENSORS_PC87360_IN5_MAX, "in5_max", SENSORS_PC87360_IN5, - SENSORS_PC87360_IN5, RW }, - 3 }, - { { SENSORS_PC87360_IN6_MAX, "in6_max", SENSORS_PC87360_IN6, - SENSORS_PC87360_IN6, RW }, - 3 }, - { { SENSORS_PC87360_IN7_MAX, "in7_max", SENSORS_PC87360_IN7, - SENSORS_PC87360_IN7, RW }, - 3 }, - { { SENSORS_PC87360_IN8_MAX, "in8_max", SENSORS_PC87360_IN8, - SENSORS_PC87360_IN8, RW }, - 3 }, - { { SENSORS_PC87360_IN9_MAX, "in9_max", SENSORS_PC87360_IN9, - SENSORS_PC87360_IN9, RW }, - 3 }, - { { SENSORS_PC87360_IN10_MAX, "in10_max", SENSORS_PC87360_IN10, - SENSORS_PC87360_IN10, RW }, - 3 }, - { { SENSORS_PC87360_IN0_STATUS, "in0_status", SENSORS_PC87360_IN0, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN1_STATUS, "in1_status", SENSORS_PC87360_IN1, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN2_STATUS, "in2_status", SENSORS_PC87360_IN2, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN3_STATUS, "in3_status", SENSORS_PC87360_IN3, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN4_STATUS, "in4_status", SENSORS_PC87360_IN4, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN5_STATUS, "in5_status", SENSORS_PC87360_IN5, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN6_STATUS, "in6_status", SENSORS_PC87360_IN6, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN7_STATUS, "in7_status", SENSORS_PC87360_IN7, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN8_STATUS, "in8_status", SENSORS_PC87360_IN8, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN9_STATUS, "in9_status", SENSORS_PC87360_IN9, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_IN10_STATUS, "in10_status", SENSORS_PC87360_IN10, NOMAP, - R }, - 0 }, - { { SENSORS_PC87360_TEMP1, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_TEMP2, "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_TEMP3, "temp3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87360_TEMP4, "temp4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_TEMP5, "temp5", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_TEMP6, "temp6", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_TEMP1_MIN, "temp1_min", SENSORS_PC87360_TEMP1, - SENSORS_PC87360_TEMP1, RW }, - 0 }, - { { SENSORS_PC87360_TEMP2_MIN, "temp2_min", SENSORS_PC87360_TEMP2, - SENSORS_PC87360_TEMP2, RW }, - 0 }, - { { SENSORS_PC87360_TEMP3_MIN, "temp3_min", SENSORS_PC87360_TEMP3, - SENSORS_PC87360_TEMP3, RW }, - 0 }, - { { SENSORS_PC87360_TEMP4_MIN, "temp4_min", SENSORS_PC87360_TEMP4, - SENSORS_PC87360_TEMP4, RW }, - 3 }, - { { SENSORS_PC87360_TEMP5_MIN, "temp5_min", SENSORS_PC87360_TEMP5, - SENSORS_PC87360_TEMP5, RW }, - 3 }, - { { SENSORS_PC87360_TEMP6_MIN, "temp6_min", SENSORS_PC87360_TEMP6, - SENSORS_PC87360_TEMP6, RW }, - 3 }, - { { SENSORS_PC87360_TEMP1_MAX, "temp1_max", SENSORS_PC87360_TEMP1, - SENSORS_PC87360_TEMP1, RW }, - 0 }, - { { SENSORS_PC87360_TEMP2_MAX, "temp2_max", SENSORS_PC87360_TEMP2, - SENSORS_PC87360_TEMP2, RW }, - 0 }, - { { SENSORS_PC87360_TEMP3_MAX, "temp3_max", SENSORS_PC87360_TEMP3, - SENSORS_PC87360_TEMP3, RW }, - 0 }, - { { SENSORS_PC87360_TEMP4_MAX, "temp4_max", SENSORS_PC87360_TEMP4, - SENSORS_PC87360_TEMP4, RW }, - 3 }, - { { SENSORS_PC87360_TEMP5_MAX, "temp5_max", SENSORS_PC87360_TEMP5, - SENSORS_PC87360_TEMP5, RW }, - 3 }, - { { SENSORS_PC87360_TEMP6_MAX, "temp6_max", SENSORS_PC87360_TEMP6, - SENSORS_PC87360_TEMP6, RW }, - 3 }, - { { SENSORS_PC87360_TEMP1_CRIT, "temp1_crit", SENSORS_PC87360_TEMP1, - SENSORS_PC87360_TEMP1, RW }, - 0 }, - { { SENSORS_PC87360_TEMP2_CRIT, "temp2_crit", SENSORS_PC87360_TEMP2, - SENSORS_PC87360_TEMP2, RW }, - 0 }, - { { SENSORS_PC87360_TEMP3_CRIT, "temp3_crit", SENSORS_PC87360_TEMP3, - SENSORS_PC87360_TEMP3, RW }, - 0 }, - { { SENSORS_PC87360_TEMP4_CRIT, "temp4_crit", SENSORS_PC87360_TEMP4, - SENSORS_PC87360_TEMP4, RW }, - 3 }, - { { SENSORS_PC87360_TEMP5_CRIT, "temp5_crit", SENSORS_PC87360_TEMP5, - SENSORS_PC87360_TEMP5, RW }, - 3 }, - { { SENSORS_PC87360_TEMP6_CRIT, "temp6_crit", SENSORS_PC87360_TEMP6, - SENSORS_PC87360_TEMP6, RW }, - 3 }, - { { SENSORS_PC87360_TEMP1_STATUS, "temp1_status", SENSORS_PC87360_TEMP1, - NOMAP, R }, - 0 }, - { { SENSORS_PC87360_TEMP2_STATUS, "temp2_status", SENSORS_PC87360_TEMP2, - NOMAP, R }, - 0 }, - { { SENSORS_PC87360_TEMP3_STATUS, "temp3_status", SENSORS_PC87360_TEMP3, - NOMAP, R }, - 0 }, - { { SENSORS_PC87360_TEMP4_STATUS, "temp4_status", SENSORS_PC87360_TEMP4, - NOMAP, R }, - 0 }, - { { SENSORS_PC87360_TEMP5_STATUS, "temp5_status", SENSORS_PC87360_TEMP5, - NOMAP, R }, - 0 }, - { { SENSORS_PC87360_TEMP6_STATUS, "temp6_status", SENSORS_PC87360_TEMP6, - NOMAP, R }, - 0 }, - { { SENSORS_PC87360_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_PC87360_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature pc87427_features[] = - { - { { SENSORS_PC87427_FAN(1), "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN(2), "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN(3), "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN(4), "fan4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN(5), "fan5", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN(6), "fan6", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN(7), "fan7", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN(8), "fan8", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_MIN(1), "fan1_min", SENSORS_PC87427_FAN(1), - SENSORS_PC87427_FAN(1), RW }, - 0 }, - { { SENSORS_PC87427_FAN_MIN(2), "fan2_min", SENSORS_PC87427_FAN(2), - SENSORS_PC87427_FAN(2), RW }, - 0 }, - { { SENSORS_PC87427_FAN_MIN(3), "fan3_min", SENSORS_PC87427_FAN(3), - SENSORS_PC87427_FAN(3), RW }, - 0 }, - { { SENSORS_PC87427_FAN_MIN(4), "fan4_min", SENSORS_PC87427_FAN(4), - SENSORS_PC87427_FAN(4), RW }, - 0 }, - { { SENSORS_PC87427_FAN_MIN(5), "fan5_min", SENSORS_PC87427_FAN(5), - SENSORS_PC87427_FAN(5), RW }, - 0 }, - { { SENSORS_PC87427_FAN_MIN(6), "fan6_min", SENSORS_PC87427_FAN(6), - SENSORS_PC87427_FAN(6), RW }, - 0 }, - { { SENSORS_PC87427_FAN_MIN(7), "fan7_min", SENSORS_PC87427_FAN(7), - SENSORS_PC87427_FAN(7), RW }, - 0 }, - { { SENSORS_PC87427_FAN_MIN(8), "fan8_min", SENSORS_PC87427_FAN(8), - SENSORS_PC87427_FAN(8), RW }, - 0 }, - { { SENSORS_PC87427_FAN_ALARM(1), "fan1_alarm", SENSORS_PC87427_FAN(1), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_ALARM(2), "fan2_alarm", SENSORS_PC87427_FAN(2), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_ALARM(3), "fan3_alarm", SENSORS_PC87427_FAN(3), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_ALARM(4), "fan4_alarm", SENSORS_PC87427_FAN(4), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_ALARM(5), "fan5_alarm", SENSORS_PC87427_FAN(5), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_ALARM(6), "fan6_alarm", SENSORS_PC87427_FAN(6), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_ALARM(7), "fan7_alarm", SENSORS_PC87427_FAN(7), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_ALARM(8), "fan8_alarm", SENSORS_PC87427_FAN(8), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_FAULT(1), "fan1_fault", SENSORS_PC87427_FAN(1), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_FAULT(2), "fan2_fault", SENSORS_PC87427_FAN(2), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_FAULT(3), "fan3_fault", SENSORS_PC87427_FAN(3), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_FAULT(4), "fan4_fault", SENSORS_PC87427_FAN(4), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_FAULT(5), "fan5_fault", SENSORS_PC87427_FAN(5), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_FAULT(6), "fan6_fault", SENSORS_PC87427_FAN(6), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_FAULT(7), "fan7_fault", SENSORS_PC87427_FAN(7), - NOMAP, R }, - 0 }, - { { SENSORS_PC87427_FAN_FAULT(8), "fan8_fault", SENSORS_PC87427_FAN(8), - NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature lm92_features[] = - { - { { SENSORS_LM92_TEMP, "temp", NOMAP, NOMAP, R }, - 4 }, - { { SENSORS_LM92_TEMP_HIGH, "temp_high", SENSORS_LM92_TEMP, - SENSORS_LM92_TEMP, RW }, - 4 }, - { { SENSORS_LM92_TEMP_LOW, "temp_low", SENSORS_LM92_TEMP, SENSORS_LM92_TEMP, - RW }, - 4 }, - { { SENSORS_LM92_TEMP_CRIT, "temp_crit", SENSORS_LM92_TEMP, - SENSORS_LM92_TEMP, RW }, - 4 }, - { { SENSORS_LM92_TEMP_HYST, "temp_hyst", SENSORS_LM92_TEMP, - SENSORS_LM92_TEMP, RW }, - 4 , - "temp1_crit_hyst", 3 }, - { { SENSORS_LM92_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature vt8231_features[] = - { - { { SENSORS_VT8231_IN0, "in0", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_IN1, "in1", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_IN2, "in2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_IN3, "in3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_IN4, "in4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_IN5, "in5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_IN0_MIN, "in0_min", SENSORS_VT8231_IN0, - SENSORS_VT8231_IN0, RW }, - 2 }, - { { SENSORS_VT8231_IN1_MIN, "in1_min", SENSORS_VT8231_IN1, - SENSORS_VT8231_IN1, RW }, - 2 }, - { { SENSORS_VT8231_IN2_MIN, "in2_min", SENSORS_VT8231_IN2, - SENSORS_VT8231_IN2, RW }, - 2 }, - { { SENSORS_VT8231_IN3_MIN, "in3_min", SENSORS_VT8231_IN3, - SENSORS_VT8231_IN3, RW }, - 2 }, - { { SENSORS_VT8231_IN4_MIN, "in4_min", SENSORS_VT8231_IN4, - SENSORS_VT8231_IN4, RW }, - 2 }, - { { SENSORS_VT8231_IN5_MIN, "in5_min", SENSORS_VT8231_IN5, - SENSORS_VT8231_IN5, RW }, - 2 }, - { { SENSORS_VT8231_IN0_MAX, "in0_max", SENSORS_VT8231_IN0, - SENSORS_VT8231_IN0, RW }, - 2 }, - { { SENSORS_VT8231_IN1_MAX, "in1_max", SENSORS_VT8231_IN1, - SENSORS_VT8231_IN1, RW }, - 2 }, - { { SENSORS_VT8231_IN2_MAX, "in2_max", SENSORS_VT8231_IN2, - SENSORS_VT8231_IN2, RW }, - 2 }, - { { SENSORS_VT8231_IN3_MAX, "in3_max", SENSORS_VT8231_IN3, - SENSORS_VT8231_IN3, RW }, - 2 }, - { { SENSORS_VT8231_IN4_MAX, "in4_max", SENSORS_VT8231_IN4, - SENSORS_VT8231_IN4, RW }, - 2 }, - { { SENSORS_VT8231_IN5_MAX, "in5_max", SENSORS_VT8231_IN5, - SENSORS_VT8231_IN5, RW }, - 2 }, - { { SENSORS_VT8231_FAN1, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_VT8231_FAN2, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_VT8231_FAN1_MIN, "fan1_min", SENSORS_VT8231_FAN1, - SENSORS_VT8231_FAN1, RW }, - 0 }, - { { SENSORS_VT8231_FAN2_MIN, "fan2_min", SENSORS_VT8231_FAN2, - SENSORS_VT8231_FAN2, RW }, - 0 }, - { { SENSORS_VT8231_TEMP, "temp1", NOMAP, NOMAP, R }, - 1 }, - { { SENSORS_VT8231_TEMP_HYST, "temp1_hyst", SENSORS_VT8231_TEMP, - SENSORS_VT8231_TEMP, RW }, - 1 }, - { { SENSORS_VT8231_TEMP_OVER, "temp1_over", SENSORS_VT8231_TEMP, - SENSORS_VT8231_TEMP, RW }, - 1 }, - { { SENSORS_VT8231_TEMP2, "temp2", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_TEMP2_HYST, "temp2_hyst", SENSORS_VT8231_TEMP2, - SENSORS_VT8231_TEMP2, RW }, - 2 }, - { { SENSORS_VT8231_TEMP2_OVER, "temp2_over", SENSORS_VT8231_TEMP2, - SENSORS_VT8231_TEMP2, RW }, - 2 }, - { { SENSORS_VT8231_TEMP3, "temp3", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_TEMP3_HYST, "temp3_hyst", SENSORS_VT8231_TEMP3, - SENSORS_VT8231_TEMP3, RW }, - 2 }, - { { SENSORS_VT8231_TEMP3_OVER, "temp3_over", SENSORS_VT8231_TEMP3, - SENSORS_VT8231_TEMP3, RW }, - 2 }, - { { SENSORS_VT8231_TEMP4, "temp4", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_TEMP4_HYST, "temp4_hyst", SENSORS_VT8231_TEMP4, - SENSORS_VT8231_TEMP4, RW }, - 2 }, - { { SENSORS_VT8231_TEMP4_OVER, "temp4_over", SENSORS_VT8231_TEMP4, - SENSORS_VT8231_TEMP4, RW }, - 2 }, - { { SENSORS_VT8231_TEMP5, "temp5", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_TEMP5_HYST, "temp5_hyst", SENSORS_VT8231_TEMP5, - SENSORS_VT8231_TEMP5, RW }, - 2 }, - { { SENSORS_VT8231_TEMP5_OVER, "temp5_over", SENSORS_VT8231_TEMP5, - SENSORS_VT8231_TEMP5, RW }, - 2 }, - { { SENSORS_VT8231_TEMP6, "temp6", NOMAP, NOMAP, R }, - 2 }, - { { SENSORS_VT8231_TEMP6_HYST, "temp6_hyst", SENSORS_VT8231_TEMP6, - SENSORS_VT8231_TEMP6, RW }, - 2 }, - { { SENSORS_VT8231_TEMP6_OVER, "temp6_over", SENSORS_VT8231_TEMP6, - SENSORS_VT8231_TEMP6, RW }, - 2 }, - { { SENSORS_VT8231_FAN1_DIV, "fan1_div", SENSORS_VT8231_FAN1, NOMAP, RW }, - 0 }, - { { SENSORS_VT8231_FAN2_DIV, "fan2_div", SENSORS_VT8231_FAN2, NOMAP, RW }, - 0 }, - { { SENSORS_VT8231_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_VT8231_VID, "vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_VT8231_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { SENSORS_VT8231_UCH, "config", NOMAP, NOMAP, RW }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature bmc_features[] = - { - { { SENSORS_BMC_IN1, "in1", NOMAP, NOMAP, R }, - 3 , "in1_input", 3}, - { { SENSORS_BMC_IN1_MIN, "in1_min", SENSORS_BMC_IN1, SENSORS_BMC_IN1, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX, "in1_max", SENSORS_BMC_IN1, SENSORS_BMC_IN1, RW }, - 3 }, - { { SENSORS_BMC_IN1+1, "in2", NOMAP, NOMAP, R }, - 3 , "in2_input", 3}, - { { SENSORS_BMC_IN1_MIN+1, "in2_min", SENSORS_BMC_IN1+1, SENSORS_BMC_IN1+1, - RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+1, "in2_max", SENSORS_BMC_IN1+1, SENSORS_BMC_IN1+1, - RW }, - 3 }, - { { SENSORS_BMC_IN1+2, "in3", NOMAP, NOMAP, R }, - 3 , "in2_input", 3}, - { { SENSORS_BMC_IN1_MIN+2, "in3_min", SENSORS_BMC_IN1+2, SENSORS_BMC_IN1+2, - RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+2, "in3_max", SENSORS_BMC_IN1+2, SENSORS_BMC_IN1+2, - RW }, - 3 }, - { { SENSORS_BMC_IN1+3, "in4", NOMAP, NOMAP, R }, - 3 , "in3_input", 3}, - { { SENSORS_BMC_IN1_MIN+3, "in4_min", SENSORS_BMC_IN1+3, SENSORS_BMC_IN1+3, - RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+3, "in4_max", SENSORS_BMC_IN1+3, SENSORS_BMC_IN1+3, - RW }, - 3 }, - { { SENSORS_BMC_IN1+4, "in5", NOMAP, NOMAP, R }, - 3 , "in4_input", 3}, - { { SENSORS_BMC_IN1_MIN+4, "in5_min", SENSORS_BMC_IN1+4, SENSORS_BMC_IN1+4, - RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+4, "in5_max", SENSORS_BMC_IN1+4, SENSORS_BMC_IN1+4, - RW }, - 3 }, - { { SENSORS_BMC_IN1+5, "in6", NOMAP, NOMAP, R }, - 3 , "in5_input", 3}, - { { SENSORS_BMC_IN1_MIN+5, "in6_min", SENSORS_BMC_IN1+5, SENSORS_BMC_IN1+5, - RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+5, "in6_max", SENSORS_BMC_IN1+5, SENSORS_BMC_IN1+5, - RW }, - 3 }, - { { SENSORS_BMC_IN1+6, "in7", NOMAP, NOMAP, R }, - 3 , "in6_input", 3}, - { { SENSORS_BMC_IN1_MIN+6, "in7_min", SENSORS_BMC_IN1+6, SENSORS_BMC_IN1+6, - RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+6, "in7_max", SENSORS_BMC_IN1+6, SENSORS_BMC_IN1+6, - RW }, - 3 }, - - { { SENSORS_BMC_IN1+7, "in8", NOMAP, NOMAP, R }, - 3 , "in7_input", 3}, - { { SENSORS_BMC_IN1_MIN+7, "in8_min", SENSORS_BMC_IN1+7, SENSORS_BMC_IN1+7, - RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+7, "in8_max", SENSORS_BMC_IN1+7, SENSORS_BMC_IN1+7, - RW }, - 3 }, - { { SENSORS_BMC_IN1+8, "in9", NOMAP, NOMAP, R }, - 3 , "in8_input", 3}, - { { SENSORS_BMC_IN1_MIN+8, "in9_min", SENSORS_BMC_IN1+8, SENSORS_BMC_IN1+8, - RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+8, "in9_max", SENSORS_BMC_IN1+8, SENSORS_BMC_IN1+8, - RW }, - 3 }, - { { SENSORS_BMC_IN1+9, "in10", NOMAP, NOMAP, R }, - 3 , "in9_input", 3}, - { { SENSORS_BMC_IN1_MIN+9, "in10_min", SENSORS_BMC_IN1+9, SENSORS_BMC_IN1+9, - RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+9, "in10_max", SENSORS_BMC_IN1+9, SENSORS_BMC_IN1+9, - RW }, - 3 }, - { { SENSORS_BMC_IN1+10, "in11", NOMAP, NOMAP, R }, - 3 , "in10_input", 3}, - { { SENSORS_BMC_IN1_MIN+10, "in11_min", SENSORS_BMC_IN1+10, - SENSORS_BMC_IN1+10, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+10, "in11_max", SENSORS_BMC_IN1+10, - SENSORS_BMC_IN1+10, RW }, - 3 }, - { { SENSORS_BMC_IN1+11, "in12", NOMAP, NOMAP, R }, - 3 , "in11_input", 3}, - { { SENSORS_BMC_IN1_MIN+11, "in12_min", SENSORS_BMC_IN1+11, - SENSORS_BMC_IN1+11, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+11, "in12_max", SENSORS_BMC_IN1+11, - SENSORS_BMC_IN1+11, RW }, - 3 }, - { { SENSORS_BMC_IN1+12, "in13", NOMAP, NOMAP, R }, - 3 , "in12_input", 3}, - { { SENSORS_BMC_IN1_MIN+12, "in13_min", SENSORS_BMC_IN1+12, - SENSORS_BMC_IN1+12, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+12, "in13_max", SENSORS_BMC_IN1+12, - SENSORS_BMC_IN1+12, RW }, - 3 }, - { { SENSORS_BMC_IN1+13, "in14", NOMAP, NOMAP, R }, - 3 , "in13_input", 3}, - { { SENSORS_BMC_IN1_MIN+13, "in14_min", SENSORS_BMC_IN1+13, - SENSORS_BMC_IN1+13, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+13, "in14_max", SENSORS_BMC_IN1+13, - SENSORS_BMC_IN1+13, RW }, - 3 }, - { { SENSORS_BMC_IN1+14, "in15", NOMAP, NOMAP, R }, - 3 , "in14_input", 3}, - { { SENSORS_BMC_IN1_MIN+14, "in15_min", SENSORS_BMC_IN1+14, - SENSORS_BMC_IN1+14, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+14, "in15_max", SENSORS_BMC_IN1+14, - SENSORS_BMC_IN1+14, RW }, - 3 }, - { { SENSORS_BMC_IN1+15, "in16", NOMAP, NOMAP, R }, - 3 , "in15_input", 3}, - { { SENSORS_BMC_IN1_MIN+15, "in16_min", SENSORS_BMC_IN1+15, - SENSORS_BMC_IN1+15, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+15, "in16_max", SENSORS_BMC_IN1+15, - SENSORS_BMC_IN1+15, RW }, - 3 }, - { { SENSORS_BMC_IN1+16, "in17", NOMAP, NOMAP, R }, - 3 , "in16_input", 3}, - { { SENSORS_BMC_IN1_MIN+16, "in17_min", SENSORS_BMC_IN1+16, - SENSORS_BMC_IN1+16, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+16, "in17_max", SENSORS_BMC_IN1+16, - SENSORS_BMC_IN1+16, RW }, - 3 }, - { { SENSORS_BMC_IN1+17, "in18", NOMAP, NOMAP, R }, - 3, "in17_input", 3 }, - { { SENSORS_BMC_IN1_MIN+17, "in18_min", SENSORS_BMC_IN1+17, - SENSORS_BMC_IN1+17, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+17, "in18_max", SENSORS_BMC_IN1+17, - SENSORS_BMC_IN1+17, RW }, - 3 }, - { { SENSORS_BMC_IN1+18, "in19", NOMAP, NOMAP, R }, - 3 , "in18_input", 3}, - { { SENSORS_BMC_IN1_MIN+18, "in19_min", SENSORS_BMC_IN1+18, - SENSORS_BMC_IN1+18, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+18, "in19_max", SENSORS_BMC_IN1+18, - SENSORS_BMC_IN1+18, RW }, - 3 }, - { { SENSORS_BMC_IN1+19, "in20", NOMAP, NOMAP, R }, - 3 , "in19_input", 3}, - { { SENSORS_BMC_IN1_MIN+19, "in20_min", SENSORS_BMC_IN1+19, - SENSORS_BMC_IN1+19, RW }, - 3 }, - { { SENSORS_BMC_IN1_MAX+19, "in20_max", SENSORS_BMC_IN1+19, - SENSORS_BMC_IN1+19, RW }, - 3 }, - { { SENSORS_BMC_FAN1, "fan1", NOMAP, NOMAP, R }, - 0, "fan1_input", 0}, - { { SENSORS_BMC_FAN1+1, "fan2", NOMAP, NOMAP, R }, - 0, "fan2_input", 0 }, - { { SENSORS_BMC_FAN1+2, "fan3", NOMAP, NOMAP, R }, - 0, "fan3_input", 0 }, - { { SENSORS_BMC_FAN1+3, "fan4", NOMAP, NOMAP, R }, - 0, "fan4_input", 0 }, - { { SENSORS_BMC_FAN1+4, "fan5", NOMAP, NOMAP, R }, - 0, "fan5_input", 0 }, - { { SENSORS_BMC_FAN1+5, "fan6", NOMAP, NOMAP, R }, - 0, "fan6_input", 0 }, - { { SENSORS_BMC_FAN1+6, "fan7", NOMAP, NOMAP, R }, - 0, "fan7_input", 0 }, - { { SENSORS_BMC_FAN1+7, "fan8", NOMAP, NOMAP, R }, - 0, "fan8_input", 0 }, - { { SENSORS_BMC_FAN1+8, "fan9", NOMAP, NOMAP, R }, - 0, "fan9_input", 0 }, - { { SENSORS_BMC_FAN1+9, "fan10", NOMAP, NOMAP, R }, - 0, "fan10_input", 0 }, - { { SENSORS_BMC_FAN1_MIN, "fan1_min", SENSORS_BMC_FAN1, SENSORS_BMC_FAN1, RW }, - 0 }, - { { SENSORS_BMC_FAN1_MIN+1, "fan2_min", SENSORS_BMC_FAN1+1, - SENSORS_BMC_FAN1+1, RW }, - 0 }, - { { SENSORS_BMC_FAN1_MIN+2, "fan3_min", SENSORS_BMC_FAN1+2, - SENSORS_BMC_FAN1+2, RW }, - 0 }, - { { SENSORS_BMC_FAN1_MIN+3, "fan4_min", SENSORS_BMC_FAN1+3, - SENSORS_BMC_FAN1+3, RW }, - 0 }, - { { SENSORS_BMC_FAN1_MIN+4, "fan5_min", SENSORS_BMC_FAN1+4, - SENSORS_BMC_FAN1+4, RW }, - 0 }, - { { SENSORS_BMC_FAN1_MIN+5, "fan6_min", SENSORS_BMC_FAN1+5, - SENSORS_BMC_FAN1+5, RW }, - 0 }, - { { SENSORS_BMC_FAN1_MIN+6, "fan7_min", SENSORS_BMC_FAN1+6, - SENSORS_BMC_FAN1+6, RW }, - 0 }, - { { SENSORS_BMC_FAN1_MIN+7, "fan8_min", SENSORS_BMC_FAN1+7, - SENSORS_BMC_FAN1+7, RW }, - 0 }, - { { SENSORS_BMC_FAN1_MIN+8, "fan9_min", SENSORS_BMC_FAN1+8, - SENSORS_BMC_FAN1+8, RW }, - 0 }, - { { SENSORS_BMC_FAN1_MIN+9, "fan10_min", SENSORS_BMC_FAN1+9, - SENSORS_BMC_FAN1+9, RW }, - 0 }, - { { SENSORS_BMC_TEMP1, "temp1", NOMAP, NOMAP, R }, - 2 , "temp1_input", 3 }, - { { SENSORS_BMC_TEMP1_MIN, "temp1_min", SENSORS_BMC_TEMP1, SENSORS_BMC_TEMP1, - RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX, "temp1_max", SENSORS_BMC_TEMP1, SENSORS_BMC_TEMP1, - RW }, - 2 }, - { { SENSORS_BMC_TEMP1+1, "temp2", NOMAP, NOMAP, R }, - 2 , "temp2_input", - 2 }, - { { SENSORS_BMC_TEMP1_MIN+1, "temp2_min", SENSORS_BMC_TEMP1+1, - SENSORS_BMC_TEMP1+1, RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX+1, "temp2_max", SENSORS_BMC_TEMP1+1, - SENSORS_BMC_TEMP1+1, RW }, - 2 }, - { { SENSORS_BMC_TEMP1+2, "temp3", NOMAP, NOMAP, R }, - 2 , "temp3_input", - 2 }, - { { SENSORS_BMC_TEMP1_MIN+2, "temp3_min", SENSORS_BMC_TEMP1+2, - SENSORS_BMC_TEMP1+2, RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX+2, "temp3_max", SENSORS_BMC_TEMP1+2, - SENSORS_BMC_TEMP1+2, RW }, - 2 }, - { { SENSORS_BMC_TEMP1+3, "temp4", NOMAP, NOMAP, R }, - 2, "temp4_input", 2 }, - { { SENSORS_BMC_TEMP1_MIN+3, "temp4_min", SENSORS_BMC_TEMP1+3, - SENSORS_BMC_TEMP1+3, RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX+3, "temp4_max", SENSORS_BMC_TEMP1+3, - SENSORS_BMC_TEMP1+3, RW }, - 2 }, - { { SENSORS_BMC_TEMP1+4, "temp5", NOMAP, NOMAP, R }, - 2, "temp5_input", 2 }, - { { SENSORS_BMC_TEMP1_MIN+4, "temp5_min", SENSORS_BMC_TEMP1+4, - SENSORS_BMC_TEMP1+4, RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX+4, "temp5_max", SENSORS_BMC_TEMP1+4, - SENSORS_BMC_TEMP1+4, RW }, - 2 }, - { { SENSORS_BMC_TEMP1+5, "temp6", NOMAP, NOMAP, R }, - 2, "temp6_input", 2 }, - { { SENSORS_BMC_TEMP1_MIN+5, "temp6_min", SENSORS_BMC_TEMP1+5, - SENSORS_BMC_TEMP1+5, RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX+5, "temp6_max", SENSORS_BMC_TEMP1+5, - SENSORS_BMC_TEMP1+5, RW }, - 2 }, - { { SENSORS_BMC_TEMP1+6, "temp7", NOMAP, NOMAP, R }, - 2, "temp7_input", - 2 }, - { { SENSORS_BMC_TEMP1_MIN+6, "temp7_min", SENSORS_BMC_TEMP1+6, - SENSORS_BMC_TEMP1+6, RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX+6, "temp7_max", SENSORS_BMC_TEMP1+6, - SENSORS_BMC_TEMP1+6, RW }, - 2 }, - { { SENSORS_BMC_TEMP1+7, "temp8", NOMAP, NOMAP, R }, - 2, "temp8_input", - 2 }, - { { SENSORS_BMC_TEMP1_MIN+7, "temp8_min", SENSORS_BMC_TEMP1+7, - SENSORS_BMC_TEMP1+7, RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX+7, "temp8_max", SENSORS_BMC_TEMP1+7, - SENSORS_BMC_TEMP1+7, RW }, - 2 }, - { { SENSORS_BMC_TEMP1+8, "temp9", NOMAP, NOMAP, R }, - 2, "temp9_input", - 2 }, - { { SENSORS_BMC_TEMP1_MIN+8, "temp9_min", SENSORS_BMC_TEMP1+8, - SENSORS_BMC_TEMP1+8, RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX+8, "temp9_max", SENSORS_BMC_TEMP1+8, - SENSORS_BMC_TEMP1+8, RW }, - 2 }, - { { SENSORS_BMC_TEMP1+9, "temp10", NOMAP, NOMAP, R }, - 2, "temp10_input", - 2 }, - { { SENSORS_BMC_TEMP1_MIN+9, "temp10_min", SENSORS_BMC_TEMP1+9, - SENSORS_BMC_TEMP1+9, RW }, - 2 }, - { { SENSORS_BMC_TEMP1_MAX+9, "temp10_max", SENSORS_BMC_TEMP1+9, - SENSORS_BMC_TEMP1+9, RW }, - 2 }, - { { SENSORS_BMC_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature xeontemp_features[] = - { - { { SENSORS_XEONTEMP_REMOTE_TEMP, "temp", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_XEONTEMP_REMOTE_TEMP_HYST, "temp_low", - SENSORS_XEONTEMP_REMOTE_TEMP, - SENSORS_XEONTEMP_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_XEONTEMP_REMOTE_TEMP_OVER, "temp_over", - SENSORS_XEONTEMP_REMOTE_TEMP, - SENSORS_XEONTEMP_REMOTE_TEMP, RW }, - - 0 }, - { { SENSORS_XEONTEMP_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature max1619_features[] = - { - { { SENSORS_MAX1619_LOCAL_TEMP, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX1619_REMOTE_TEMP, "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX1619_REMOTE_LOW, "temp2_min", SENSORS_MAX1619_REMOTE_TEMP, - SENSORS_MAX1619_REMOTE_TEMP, RW }, - 0 }, - { { SENSORS_MAX1619_REMOTE_HIGH, "temp2_max", SENSORS_MAX1619_REMOTE_TEMP, - SENSORS_MAX1619_REMOTE_TEMP, RW }, - 0 }, - { { SENSORS_MAX1619_REMOTE_MAX, "temp2_crit", SENSORS_MAX1619_REMOTE_TEMP, - SENSORS_MAX1619_REMOTE_TEMP, RW }, - 0 }, - { { SENSORS_MAX1619_REMOTE_HYST, "temp2_hyst", SENSORS_MAX1619_REMOTE_TEMP, - SENSORS_MAX1619_REMOTE_TEMP, RW }, - 0, - "temp2_crit_hyst", 3 }, - { { SENSORS_MAX1619_ALARMS, "alarms", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature max6650_features[] = - { - { { SENSORS_MAX6650_FAN1_TACH, "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX6650_FAN2_TACH, "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX6650_FAN3_TACH, "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX6650_FAN4_TACH, "fan4", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_MAX6650_SPEED, "speed", SENSORS_MAX6650_FAN1_TACH, - SENSORS_MAX6650_FAN1_TACH, RW }, - 0, - "fan1_target", 0 }, - { { 0 }, 0 } - }; - -#define SENSORS_SMSC47B397_TEMP(nr) \ - { { SENSORS_SMSC47B397_TEMP##nr, "temp" #nr, NOMAP, NOMAP, R }, 0 } - -#define SENSORS_SMSC47B397_FAN(nr) \ - { { SENSORS_SMSC47B397_FAN##nr, "fan" #nr, NOMAP, NOMAP, R }, 0 } - -static sensors_chip_feature smsc47b397_features[] = -{ - SENSORS_SMSC47B397_TEMP(1), - SENSORS_SMSC47B397_TEMP(2), - SENSORS_SMSC47B397_TEMP(3), - SENSORS_SMSC47B397_TEMP(4), - SENSORS_SMSC47B397_FAN(1), - SENSORS_SMSC47B397_FAN(2), - SENSORS_SMSC47B397_FAN(3), - SENSORS_SMSC47B397_FAN(4), - { { 0 }, 0 } -}; - -static sensors_chip_feature f71805f_features[] = -{ -/* 9 to 11 voltage inputs */ - { { SENSORS_F71805F_IN(0), "in0", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(1), "in1", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(2), "in2", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(3), "in3", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(4), "in4", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(5), "in5", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(6), "in6", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(7), "in7", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(8), "in8", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(9), "in9", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN(10), "in10", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_F71805F_IN_MIN(0), "in0_min", SENSORS_F71805F_IN(0), - SENSORS_F71805F_IN(0), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(1), "in1_min", SENSORS_F71805F_IN(1), - SENSORS_F71805F_IN(1), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(2), "in2_min", SENSORS_F71805F_IN(2), - SENSORS_F71805F_IN(2), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(3), "in3_min", SENSORS_F71805F_IN(3), - SENSORS_F71805F_IN(3), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(4), "in4_min", SENSORS_F71805F_IN(4), - SENSORS_F71805F_IN(4), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(5), "in5_min", SENSORS_F71805F_IN(5), - SENSORS_F71805F_IN(5), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(6), "in6_min", SENSORS_F71805F_IN(6), - SENSORS_F71805F_IN(6), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(7), "in7_min", SENSORS_F71805F_IN(7), - SENSORS_F71805F_IN(7), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(8), "in8_min", SENSORS_F71805F_IN(8), - SENSORS_F71805F_IN(8), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(9), "in9_min", SENSORS_F71805F_IN(9), - SENSORS_F71805F_IN(9), RW }, - 3 }, - { { SENSORS_F71805F_IN_MIN(10), "in10_min", SENSORS_F71805F_IN(10), - SENSORS_F71805F_IN(10), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(0), "in0_max", SENSORS_F71805F_IN(0), - SENSORS_F71805F_IN(0), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(1), "in1_max", SENSORS_F71805F_IN(1), - SENSORS_F71805F_IN(1), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(2), "in2_max", SENSORS_F71805F_IN(2), - SENSORS_F71805F_IN(2), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(3), "in3_max", SENSORS_F71805F_IN(3), - SENSORS_F71805F_IN(3), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(4), "in4_max", SENSORS_F71805F_IN(4), - SENSORS_F71805F_IN(4), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(5), "in5_max", SENSORS_F71805F_IN(5), - SENSORS_F71805F_IN(5), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(6), "in6_max", SENSORS_F71805F_IN(6), - SENSORS_F71805F_IN(6), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(7), "in7_max", SENSORS_F71805F_IN(7), - SENSORS_F71805F_IN(7), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(8), "in8_max", SENSORS_F71805F_IN(8), - SENSORS_F71805F_IN(8), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(9), "in9_max", SENSORS_F71805F_IN(9), - SENSORS_F71805F_IN(9), RW }, - 3 }, - { { SENSORS_F71805F_IN_MAX(10), "in10_max", SENSORS_F71805F_IN(10), - SENSORS_F71805F_IN(10), RW }, - 3 }, -/* 3 fan tachometers */ - { { SENSORS_F71805F_FAN(1), "fan1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_FAN(2), "fan2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_FAN(3), "fan3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_FAN_MIN(1), "fan1_min", SENSORS_F71805F_FAN(1), - SENSORS_F71805F_FAN(1), RW }, - 0 }, - { { SENSORS_F71805F_FAN_MIN(2), "fan2_min", SENSORS_F71805F_FAN(2), - SENSORS_F71805F_FAN(2), RW }, - 0 }, - { { SENSORS_F71805F_FAN_MIN(3), "fan3_min", SENSORS_F71805F_FAN(3), - SENSORS_F71805F_FAN(3), RW }, - 0 }, -/* 3 temperature inputs */ - { { SENSORS_F71805F_TEMP(1), "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_TEMP(2), "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_TEMP(3), "temp3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_TEMP_MAX(1), "temp1_max", SENSORS_F71805F_TEMP(1), - SENSORS_F71805F_TEMP(1), RW }, - 0 }, - { { SENSORS_F71805F_TEMP_MAX(2), "temp2_max", SENSORS_F71805F_TEMP(2), - SENSORS_F71805F_TEMP(2), RW }, - 0 }, - { { SENSORS_F71805F_TEMP_MAX(3), "temp3_max", SENSORS_F71805F_TEMP(3), - SENSORS_F71805F_TEMP(3), RW }, - 0 }, - { { SENSORS_F71805F_TEMP_HYST(1), "temp1_hyst", SENSORS_F71805F_TEMP(1), - SENSORS_F71805F_TEMP(1), RW }, - 0 }, - { { SENSORS_F71805F_TEMP_HYST(2), "temp2_hyst", SENSORS_F71805F_TEMP(2), - SENSORS_F71805F_TEMP(2), RW }, - 0 }, - { { SENSORS_F71805F_TEMP_HYST(3), "temp3_hyst", SENSORS_F71805F_TEMP(3), - SENSORS_F71805F_TEMP(3), RW }, - 0 }, - { { SENSORS_F71805F_TEMP_TYPE(1), "sensor1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_TEMP_TYPE(2), "sensor2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_TEMP_TYPE(3), "sensor3", NOMAP, NOMAP, R }, - 0 }, -/* 3 alarm bitvectors */ - { { SENSORS_F71805F_ALARMS_IN, "alarms_in", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_ALARMS_FAN, "alarms_fan", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_F71805F_ALARMS_TEMP, "alarms_temp", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } -}; - -#define SENSORS_ABITUGURU_IN_FEATURES(nr) \ - { { SENSORS_ABITUGURU_IN(nr), "in" #nr, NOMAP, NOMAP, R }, \ - 3 }, \ - { { SENSORS_ABITUGURU_IN_MIN(nr), "in" #nr "_min", \ - SENSORS_ABITUGURU_IN(nr), SENSORS_ABITUGURU_IN(nr), RW }, \ - 3 }, \ - { { SENSORS_ABITUGURU_IN_MIN_ALARM(nr), "in" #nr "_min_alarm", \ - SENSORS_ABITUGURU_IN(nr), NOMAP, R }, \ - 0 }, \ - { { SENSORS_ABITUGURU_IN_MAX(nr), "in" #nr "_max", \ - SENSORS_ABITUGURU_IN(nr), SENSORS_ABITUGURU_IN(nr), RW }, \ - 3 }, \ - { { SENSORS_ABITUGURU_IN_MAX_ALARM(nr), "in" #nr "_max_alarm", \ - SENSORS_ABITUGURU_IN(nr), NOMAP, R }, \ - 0 } - -#define SENSORS_ABITUGURU_TEMP_FEATURES(nr) \ - { { SENSORS_ABITUGURU_TEMP(nr), "temp" #nr, NOMAP, NOMAP, R }, \ - 3 }, \ - { { SENSORS_ABITUGURU_TEMP_ALARM(nr), "temp" #nr "_alarm", \ - SENSORS_ABITUGURU_TEMP(nr), NOMAP, R }, \ - 0 }, \ - { { SENSORS_ABITUGURU_TEMP_MAX(nr), "temp" #nr "_max", \ - SENSORS_ABITUGURU_TEMP(nr), SENSORS_ABITUGURU_TEMP(nr), RW }, \ - 3 }, \ - { { SENSORS_ABITUGURU_TEMP_CRIT(nr), "temp" #nr "_crit", \ - SENSORS_ABITUGURU_TEMP(nr), SENSORS_ABITUGURU_TEMP(nr), RW }, \ - 3 } - -#define SENSORS_ABITUGURU_FAN_FEATURES(nr) \ - { { SENSORS_ABITUGURU_FAN(nr), "fan" #nr, NOMAP, NOMAP, R }, \ - 0 }, \ - { { SENSORS_ABITUGURU_FAN_ALARM(nr), "fan" #nr "_alarm", \ - SENSORS_ABITUGURU_FAN(nr), NOMAP, R }, \ - 0 }, \ - { { SENSORS_ABITUGURU_FAN_MIN(nr), "fan" #nr "_min", \ - SENSORS_ABITUGURU_FAN(nr), SENSORS_ABITUGURU_FAN(nr), RW }, \ - 0 } - -static sensors_chip_feature abituguru_features[] = -{ - SENSORS_ABITUGURU_IN_FEATURES(0), - SENSORS_ABITUGURU_IN_FEATURES(1), - SENSORS_ABITUGURU_IN_FEATURES(2), - SENSORS_ABITUGURU_IN_FEATURES(3), - SENSORS_ABITUGURU_IN_FEATURES(4), - SENSORS_ABITUGURU_IN_FEATURES(5), - SENSORS_ABITUGURU_IN_FEATURES(6), - SENSORS_ABITUGURU_IN_FEATURES(7), - SENSORS_ABITUGURU_IN_FEATURES(8), - SENSORS_ABITUGURU_IN_FEATURES(9), - SENSORS_ABITUGURU_IN_FEATURES(10), - SENSORS_ABITUGURU_TEMP_FEATURES(1), - SENSORS_ABITUGURU_TEMP_FEATURES(2), - SENSORS_ABITUGURU_TEMP_FEATURES(3), - SENSORS_ABITUGURU_TEMP_FEATURES(4), - SENSORS_ABITUGURU_TEMP_FEATURES(5), - SENSORS_ABITUGURU_TEMP_FEATURES(6), - SENSORS_ABITUGURU_TEMP_FEATURES(7), - SENSORS_ABITUGURU_FAN_FEATURES(1), - SENSORS_ABITUGURU_FAN_FEATURES(2), - SENSORS_ABITUGURU_FAN_FEATURES(3), - SENSORS_ABITUGURU_FAN_FEATURES(4), - SENSORS_ABITUGURU_FAN_FEATURES(5), - SENSORS_ABITUGURU_FAN_FEATURES(6), - { { 0 }, 0 } -}; - - -static sensors_chip_feature k8temp_features[] = - { - { { SENSORS_K8TEMP_TEMP1, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_K8TEMP_TEMP2, "temp2", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_K8TEMP_TEMP3, "temp3", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_K8TEMP_TEMP4, "temp4", NOMAP, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -static sensors_chip_feature coretemp_features[] = - { - { { SENSORS_CORETEMP_TEMP1, "temp1", NOMAP, NOMAP, R }, - 0 }, - { { SENSORS_CORETEMP_TEMP1_CRIT, "temp1_crit", SENSORS_CORETEMP_TEMP1, - SENSORS_CORETEMP_TEMP1, R }, - 0 }, - { { SENSORS_CORETEMP_TEMP1_CRIT_ALARM, "temp1_crit_alarm", - SENSORS_CORETEMP_TEMP1, NOMAP, R }, - 0 }, - { { 0 }, 0 } - }; - -#define SENSORS_DME1737_IN_FEATURES(nr) \ - { { SENSORS_DME1737_IN(nr), "in" #nr, \ - NOMAP, NOMAP, R }, \ - 3 }, \ - { { SENSORS_DME1737_IN_MIN(nr), "in" #nr "_min", \ - SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \ - 3 }, \ - { { SENSORS_DME1737_IN_MAX(nr), "in" #nr "_max", \ - SENSORS_DME1737_IN(nr), SENSORS_DME1737_IN(nr), RW }, \ - 3 }, \ - { { SENSORS_DME1737_IN_ALARM(nr), "in" #nr "_alarm", \ - SENSORS_DME1737_IN(nr), NOMAP, R }, \ - 0 } - -#define SENSORS_DME1737_TEMP_FEATURES(nr) \ - { { SENSORS_DME1737_TEMP(nr), "temp" #nr, \ - NOMAP, NOMAP, R }, \ - 3 }, \ - { { SENSORS_DME1737_TEMP_MIN(nr), "temp" #nr "_min", \ - SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \ - 3 }, \ - { { SENSORS_DME1737_TEMP_MAX(nr), "temp" #nr "_max", \ - SENSORS_DME1737_TEMP(nr), SENSORS_DME1737_TEMP(nr), RW }, \ - 3 }, \ - { { SENSORS_DME1737_TEMP_ALARM(nr), "temp" #nr "_alarm", \ - SENSORS_DME1737_TEMP(nr), NOMAP, R }, \ - 0 }, \ - { { SENSORS_DME1737_TEMP_FAULT(nr), "temp" #nr "_fault", \ - SENSORS_DME1737_TEMP(nr), NOMAP, R }, \ - 0 } - -#define SENSORS_DME1737_FAN_FEATURES(nr) \ - { { SENSORS_DME1737_FAN(nr), "fan" #nr, \ - NOMAP, NOMAP, R }, \ - 0 }, \ - { { SENSORS_DME1737_FAN_MIN(nr), "fan" #nr "_min", \ - SENSORS_DME1737_FAN(nr), SENSORS_DME1737_FAN(nr), RW }, \ - 0 }, \ - { { SENSORS_DME1737_FAN_ALARM(nr), "fan" #nr "_alarm", \ - SENSORS_DME1737_FAN(nr), NOMAP, R }, \ - 0 } - -#define SENSORS_DME1737_PWM_FEATURES(nr) \ - { { SENSORS_DME1737_PWM(nr), "pwm" #nr, \ - NOMAP, NOMAP, RW }, \ - 0 }, \ - { { SENSORS_DME1737_PWM_ENABLE(nr), "pwm" #nr "_enable", \ - SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \ - 0 }, \ - { { SENSORS_DME1737_PWM_FREQ(nr), "pwm" #nr "_freq", \ - SENSORS_DME1737_PWM(nr), SENSORS_DME1737_PWM(nr), RW }, \ - 0 } - -static sensors_chip_feature dme1737_features[] = -{ - SENSORS_DME1737_IN_FEATURES(0), - SENSORS_DME1737_IN_FEATURES(1), - SENSORS_DME1737_IN_FEATURES(2), - SENSORS_DME1737_IN_FEATURES(3), - SENSORS_DME1737_IN_FEATURES(4), - SENSORS_DME1737_IN_FEATURES(5), - SENSORS_DME1737_IN_FEATURES(6), - SENSORS_DME1737_TEMP_FEATURES(1), - SENSORS_DME1737_TEMP_FEATURES(2), - SENSORS_DME1737_TEMP_FEATURES(3), - SENSORS_DME1737_FAN_FEATURES(1), - SENSORS_DME1737_FAN_FEATURES(2), - SENSORS_DME1737_FAN_FEATURES(3), - SENSORS_DME1737_FAN_FEATURES(4), - SENSORS_DME1737_FAN_FEATURES(5), - SENSORS_DME1737_FAN_FEATURES(6), - SENSORS_DME1737_PWM_FEATURES(1), - SENSORS_DME1737_PWM_FEATURES(2), - SENSORS_DME1737_PWM_FEATURES(3), - SENSORS_DME1737_PWM_FEATURES(5), - SENSORS_DME1737_PWM_FEATURES(6), - { { SENSORS_DME1737_VID, "cpu0_vid", NOMAP, NOMAP, R }, - 3 }, - { { SENSORS_DME1737_VRM, "vrm", NOMAP, NOMAP, RW }, - 1 }, - { { 0 }, 0 } -}; - sensors_chip_features sensors_chip_features_list[] = { - { SENSORS_LM78_PREFIX, lm78_features }, - { SENSORS_LM78J_PREFIX, lm78j_features }, - { SENSORS_LM79_PREFIX, lm79_features }, - { SENSORS_LM75_PREFIX, lm75_features }, - { SENSORS_GL518_PREFIX, gl518_features }, - { SENSORS_GL520_PREFIX, gl520_features }, - { SENSORS_LM80_PREFIX, lm80_features }, - { SENSORS_W83781D_PREFIX, w83781d_features }, - { SENSORS_W83782D_PREFIX, w83782d_features }, - { SENSORS_W83783S_PREFIX, w83783s_features }, - { SENSORS_W83697HF_PREFIX, w83782d_features }, /* same as 782d */ - /* Cheat on 83627HF for now - no separate #defines */ - { SENSORS_W83627HF_PREFIX, w83782d_features }, - /* Cheat on 83627THF for now - no separate #defines */ - { 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_W83793_PREFIX, w83793_features }, - { SENSORS_W83L785TS_PREFIX, w83l785ts_features }, - { SENSORS_W83627EHF_PREFIX, w83627ehf_features }, - { SENSORS_W83627DHG_PREFIX, w83627ehf_features }, /* Similar to W83627EHF but no in9 */ - { SENSORS_AS99127F_PREFIX, as99127f_features }, - { SENSORS_ASB100_PREFIX, asb100_features }, - { SENSORS_ADM9240_PREFIX, adm9240_features }, - /* Cheat on LM81 - same features */ - { SENSORS_LM81_PREFIX, adm9240_features }, - /* Cheat on DS1780 - same features */ - { SENSORS_DS1780_PREFIX, adm9240_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 }, - /* Cheat on GL523 for now - no separate #defines */ - { SENSORS_GL523_PREFIX, adm1021_features }, - { SENSORS_ADM1023_PREFIX, adm1023_features }, - /* Cheat on THMC10 for now - no separate #defines */ - { SENSORS_THMC10_PREFIX, adm1021_features }, - { SENSORS_SIS5595_PREFIX, sis5595_features }, - { SENSORS_MAXI_CG_PREFIX, maxi_cg_features }, - { SENSORS_MAXI_CO_PREFIX, maxi_co_features }, - { SENSORS_MAXI_AS_PREFIX, maxi_as_features }, - /* Cheat on NBA for now - no separate #defines */ - { SENSORS_MAXI_NBA_PREFIX, maxi_as_features }, - { SENSORS_THMC50_PREFIX, thmc50_features }, - /* Cheat on ADM1022 for now - no separate #defines */ - { SENSORS_ADM1022_PREFIX, thmc50_features }, - { SENSORS_ADM1025_PREFIX, adm1025_features }, - { SENSORS_NE1619_PREFIX, adm1025_features }, - { SENSORS_ADM1026_PREFIX, adm1026_features }, - { SENSORS_VIA686A_PREFIX, via686a_features }, - { SENSORS_LM87_PREFIX, lm87_features }, - { SENSORS_MTP008_PREFIX, mtp008_features }, -/* { SENSORS_DS1621_PREFIX, ds1621_features }, */ - { SENSORS_ADM1024_PREFIX, adm1024_features }, - { SENSORS_IT87_PREFIX, it87_features }, - { SENSORS_IT8712_PREFIX, it87_features }, - { SENSORS_IT8716_PREFIX, it87_features }, - { SENSORS_IT8718_PREFIX, it87_features }, - { SENSORS_FSCPOS_PREFIX, fscpos_features }, - { SENSORS_FSCSCY_PREFIX, fscscy_features }, - { SENSORS_FSCHER_PREFIX, fscher_features }, - { SENSORS_PCF8591_PREFIX, pcf8591_features }, - { SENSORS_VT1211_PREFIX, vt1211_features }, - { SENSORS_SMSC47M192_PREFIX, smsc47m192_features }, - { SENSORS_SMSC47M1_PREFIX, smsc47m1_features }, - { SENSORS_SMSC47M2_PREFIX, smsc47m2_features }, - { SENSORS_PC87360_PREFIX, pc87360_features }, - { SENSORS_PC87363_PREFIX, pc87360_features }, - { SENSORS_PC87364_PREFIX, pc87360_features }, - { SENSORS_PC87365_PREFIX, pc87365_features }, - { SENSORS_PC87366_PREFIX, pc87365_features }, - { SENSORS_PC87427_PREFIX, pc87427_features }, - { SENSORS_LM92_PREFIX, lm92_features }, - { SENSORS_VT8231_PREFIX, vt8231_features }, - { SENSORS_BMC_PREFIX, bmc_features }, - { SENSORS_LM85_PREFIX, lm85_features }, - { SENSORS_LM85B_PREFIX, lm85_features }, - { SENSORS_LM85C_PREFIX, lm85_features }, - { SENSORS_EMC6D100_PREFIX, lm85_features }, - { SENSORS_EMC6D102_PREFIX, lm85_features }, - { SENSORS_ADM1027_PREFIX, adm1027_features }, - { SENSORS_ADT7463_PREFIX, adm1027_features }, - { SENSORS_LM83_PREFIX, lm83_features }, -/* { SENSORS_LM90_PREFIX, lm90_features }, - { SENSORS_ADM1032_PREFIX, lm90_features }, - { SENSORS_LM99_PREFIX, lm90_features }, - { SENSORS_LM86_PREFIX, lm90_features }, - { SENSORS_MAX6657_PREFIX, lm90_features }, - { SENSORS_ADT7461_PREFIX, lm90_features }, */ - { SENSORS_LM63_PREFIX, lm63_features }, - { SENSORS_MAX1619_PREFIX, max1619_features }, - { SENSORS_XEONTEMP_PREFIX, xeontemp_features }, - { SENSORS_MAX6650_PREFIX, max6650_features }, - { SENSORS_ADM1029_PREFIX, adm1029_features }, - { SENSORS_ADM1030_PREFIX, adm1030_features }, - { SENSORS_ADM1031_PREFIX, adm1031_features }, - { SENSORS_LM93_PREFIX, lm93_features }, - { SENSORS_SMSC47B397_PREFIX, smsc47b397_features }, -/* { SENSORS_F71805F_PREFIX, f71805f_features }, - { SENSORS_F71872F_PREFIX, f71805f_features }, */ -// { SENSORS_ABITUGURU_PREFIX, abituguru_features }, -// { SENSORS_K8TEMP_PREFIX, k8temp_features }, - { SENSORS_CORETEMP_PREFIX, coretemp_features }, - { SENSORS_DME1737_PREFIX, dme1737_features }, PLACEHOLDER_ELEMENTS, { 0 } }; diff --git a/lib/chips.h b/lib/chips.h deleted file mode 100644 index b3980662..00000000 --- a/lib/chips.h +++ /dev/null @@ -1,2228 +0,0 @@ -/* - chips.h - Part of libsensors, a Linux library for reading sensor data. - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* This files contains, for each type of chip, the kind of values you can - read and write. The actual value of each define is completely arbitrary, - as long as, for one specific chip, each defined value is unique. I tried - to give similar features similar values, but you can't trust that. - Some entries are very alike (for example the LM78, LM78-J and LM79 - defines). Where documented, you can mix the defines. If chip prefixes - are different, they get their own entry. */ - -/* If you add a chip here, do not forget to add the entry in chips.c too. - Other than that (and a recompile, and a bump up of the library number - for shared libs) nothing should need to be done to support new chips. */ - - -/* LM78 chips */ - -#ifndef LIB_SENSORS_CHIPS_H -#define LIB_SENSORS_CHIPS_H - -#define SENSORS_LM78_PREFIX "lm78" - -#define SENSORS_LM78_IN0 1 /* R */ -#define SENSORS_LM78_IN1 2 /* R */ -#define SENSORS_LM78_IN2 3 /* R */ -#define SENSORS_LM78_IN3 4 /* R */ -#define SENSORS_LM78_IN4 5 /* R */ -#define SENSORS_LM78_IN5 6 /* R */ -#define SENSORS_LM78_IN6 7 /* R */ -#define SENSORS_LM78_IN0_MIN 11 /* RW */ -#define SENSORS_LM78_IN1_MIN 12 /* RW */ -#define SENSORS_LM78_IN2_MIN 13 /* RW */ -#define SENSORS_LM78_IN3_MIN 14 /* RW */ -#define SENSORS_LM78_IN4_MIN 15 /* RW */ -#define SENSORS_LM78_IN5_MIN 16 /* RW */ -#define SENSORS_LM78_IN6_MIN 17 /* RW */ -#define SENSORS_LM78_IN0_MAX 21 /* RW */ -#define SENSORS_LM78_IN1_MAX 22 /* RW */ -#define SENSORS_LM78_IN2_MAX 23 /* RW */ -#define SENSORS_LM78_IN3_MAX 24 /* RW */ -#define SENSORS_LM78_IN4_MAX 25 /* RW */ -#define SENSORS_LM78_IN5_MAX 26 /* RW */ -#define SENSORS_LM78_IN6_MAX 27 /* RW */ -#define SENSORS_LM78_FAN1 31 /* R */ -#define SENSORS_LM78_FAN2 32 /* R */ -#define SENSORS_LM78_FAN3 33 /* R */ -#define SENSORS_LM78_FAN1_MIN 41 /* RW */ -#define SENSORS_LM78_FAN2_MIN 42 /* RW */ -#define SENSORS_LM78_FAN3_MIN 43 /* RW */ -#define SENSORS_LM78_TEMP 51 /* R */ -#define SENSORS_LM78_TEMP_HYST 52 /* RW */ -#define SENSORS_LM78_TEMP_OVER 53 /* RW */ -#define SENSORS_LM78_VID 61 /* R */ -#define SENSORS_LM78_FAN1_DIV 71 /* RW */ -#define SENSORS_LM78_FAN2_DIV 72 /* RW */ -#define SENSORS_LM78_FAN3_DIV 73 /* R (yes, really! */ -#define SENSORS_LM78_ALARMS 81 /* R */ - - -/* LM78-J chips. It is actually safe to use the LM78 defines instead, but it - is better practice to use these. */ - -#define SENSORS_LM78J_PREFIX "lm78-j" - -#define SENSORS_LM78J_IN0 1 /* R */ -#define SENSORS_LM78J_IN1 2 /* R */ -#define SENSORS_LM78J_IN2 3 /* R */ -#define SENSORS_LM78J_IN3 4 /* R */ -#define SENSORS_LM78J_IN4 5 /* R */ -#define SENSORS_LM78J_IN5 6 /* R */ -#define SENSORS_LM78J_IN6 7 /* R */ -#define SENSORS_LM78J_IN0_MIN 11 /* RW */ -#define SENSORS_LM78J_IN1_MIN 12 /* RW */ -#define SENSORS_LM78J_IN2_MIN 13 /* RW */ -#define SENSORS_LM78J_IN3_MIN 14 /* RW */ -#define SENSORS_LM78J_IN4_MIN 15 /* RW */ -#define SENSORS_LM78J_IN5_MIN 16 /* RW */ -#define SENSORS_LM78J_IN6_MIN 17 /* RW */ -#define SENSORS_LM78J_IN0_MAX 21 /* RW */ -#define SENSORS_LM78J_IN1_MAX 22 /* RW */ -#define SENSORS_LM78J_IN2_MAX 23 /* RW */ -#define SENSORS_LM78J_IN3_MAX 24 /* RW */ -#define SENSORS_LM78J_IN4_MAX 25 /* RW */ -#define SENSORS_LM78J_IN5_MAX 26 /* RW */ -#define SENSORS_LM78J_IN6_MAX 27 /* RW */ -#define SENSORS_LM78J_FAN1 31 /* R */ -#define SENSORS_LM78J_FAN2 32 /* R */ -#define SENSORS_LM78J_FAN3 33 /* R */ -#define SENSORS_LM78J_FAN1_MIN 41 /* RW */ -#define SENSORS_LM78J_FAN2_MIN 42 /* RW */ -#define SENSORS_LM78J_FAN3_MIN 43 /* RW */ -#define SENSORS_LM78J_TEMP 51 /* R */ -#define SENSORS_LM78J_TEMP_HYST 52 /* RW */ -#define SENSORS_LM78J_TEMP_OVER 53 /* RW */ -#define SENSORS_LM78J_VID 61 /* R */ -#define SENSORS_LM78J_FAN1_DIV 71 /* RW */ -#define SENSORS_LM78J_FAN2_DIV 72 /* RW */ -#define SENSORS_LM78J_FAN3_DIV 73 /* R (yes, really!) */ -#define SENSORS_LM78J_ALARMS 81 /* R */ - - -/* LM79 chips. It is actually safe to use the LM78 defines instead, but it - is better practice to use these. */ - -#define SENSORS_LM79_PREFIX "lm79" - -#define SENSORS_LM79_IN0 1 /* R */ -#define SENSORS_LM79_IN1 2 /* R */ -#define SENSORS_LM79_IN2 3 /* R */ -#define SENSORS_LM79_IN3 4 /* R */ -#define SENSORS_LM79_IN4 5 /* R */ -#define SENSORS_LM79_IN5 6 /* R */ -#define SENSORS_LM79_IN6 7 /* R */ -#define SENSORS_LM79_IN0_MIN 11 /* RW */ -#define SENSORS_LM79_IN1_MIN 12 /* RW */ -#define SENSORS_LM79_IN2_MIN 13 /* RW */ -#define SENSORS_LM79_IN3_MIN 14 /* RW */ -#define SENSORS_LM79_IN4_MIN 15 /* RW */ -#define SENSORS_LM79_IN5_MIN 16 /* RW */ -#define SENSORS_LM79_IN6_MIN 17 /* RW */ -#define SENSORS_LM79_IN0_MAX 21 /* RW */ -#define SENSORS_LM79_IN1_MAX 22 /* RW */ -#define SENSORS_LM79_IN2_MAX 23 /* RW */ -#define SENSORS_LM79_IN3_MAX 24 /* RW */ -#define SENSORS_LM79_IN4_MAX 25 /* R */ -#define SENSORS_LM79_IN5_MAX 26 /* R */ -#define SENSORS_LM79_IN6_MAX 27 /* R */ -#define SENSORS_LM79_FAN1 31 /* R */ -#define SENSORS_LM79_FAN2 32 /* R */ -#define SENSORS_LM79_FAN3 33 /* R */ -#define SENSORS_LM79_FAN1_MIN 41 /* RW */ -#define SENSORS_LM79_FAN2_MIN 42 /* RW */ -#define SENSORS_LM79_FAN3_MIN 43 /* RW */ -#define SENSORS_LM79_TEMP 51 /* R */ -#define SENSORS_LM79_TEMP_HYST 52 /* RW */ -#define SENSORS_LM79_TEMP_OVER 53 /* RW */ -#define SENSORS_LM79_VID 61 /* R */ -#define SENSORS_LM79_FAN1_DIV 71 /* RW */ -#define SENSORS_LM79_FAN2_DIV 72 /* RW */ -#define SENSORS_LM79_FAN3_DIV 73 /* R (yes, really! */ -#define SENSORS_LM79_ALARMS 81 /* R */ - - -/* LM75 chips. */ - -#define SENSORS_LM75_PREFIX "lm75" - -#define SENSORS_LM75_TEMP 51 /* R */ -#define SENSORS_LM75_TEMP_HYST 52 /* RW */ -#define SENSORS_LM75_TEMP_OVER 53 /* RW */ - -/* ADM1021 chips. */ - -#define SENSORS_ADM1021_PREFIX "adm1021" -/* Cheat on LM84,GL523,THMC10,1023 for now - no separate #defines */ -#define SENSORS_ADM1023_PREFIX "adm1023" -#define SENSORS_LM84_PREFIX "lm84" -#define SENSORS_GL523_PREFIX "gl523" -#define SENSORS_THMC10_PREFIX "thmc10" - -#define SENSORS_ADM1021_TEMP 51 /* R */ -#define SENSORS_ADM1021_TEMP_HYST 52 /* RW */ -#define SENSORS_ADM1021_TEMP_OVER 53 /* RW */ -#define SENSORS_ADM1021_REMOTE_TEMP 54 /* R */ -#define SENSORS_ADM1021_REMOTE_TEMP_HYST 55 /* RW */ -#define SENSORS_ADM1021_REMOTE_TEMP_OVER 56 /* RW */ -#define SENSORS_ADM1021_ALARMS 81 /* R */ -#define SENSORS_ADM1021_DIE_CODE 90 /* R */ - -/* ADM1029 chips */ - -#define SENSORS_ADM1029_PREFIX "adm1029" - -#define SENSORS_ADM1029_TEMP1 51 -#define SENSORS_ADM1029_TEMP1_MAX 52 -#define SENSORS_ADM1029_TEMP1_MIN 53 - -#define SENSORS_ADM1029_TEMP2 61 -#define SENSORS_ADM1029_TEMP2_MAX 62 -#define SENSORS_ADM1029_TEMP2_MIN 63 - -#define SENSORS_ADM1029_TEMP3 71 -#define SENSORS_ADM1029_TEMP3_MAX 72 -#define SENSORS_ADM1029_TEMP3_MIN 73 - -#define SENSORS_ADM1029_FAN1 81 -#define SENSORS_ADM1029_FAN1_MIN 82 -#define SENSORS_ADM1029_FAN1_DIV 83 - -#define SENSORS_ADM1029_FAN2 91 -#define SENSORS_ADM1029_FAN2_MIN 92 -#define SENSORS_ADM1029_FAN2_DIV 93 - - -/* ADM1030 and ADM1031 chips */ - -#define SENSORS_ADM1030_PREFIX "adm1030" -#define SENSORS_ADM1031_PREFIX "adm1031" - -#define SENSORS_ADM1031_TEMP1 51 /* R */ -#define SENSORS_ADM1031_TEMP1_MIN 52 /* RW */ -#define SENSORS_ADM1031_TEMP1_MAX 53 /* RW */ -#define SENSORS_ADM1031_TEMP1_CRIT 54 /* RW */ - -#define SENSORS_ADM1031_TEMP2 61 /* R */ -#define SENSORS_ADM1031_TEMP2_MIN 62 /* RW */ -#define SENSORS_ADM1031_TEMP2_MAX 63 /* RW */ -#define SENSORS_ADM1031_TEMP2_CRIT 64 /* RW */ - -#define SENSORS_ADM1031_TEMP3 71 /* R */ -#define SENSORS_ADM1031_TEMP3_MIN 72 /* RW */ -#define SENSORS_ADM1031_TEMP3_MAX 73 /* RW */ -#define SENSORS_ADM1031_TEMP3_CRIT 74 /* RW */ - - -#define SENSORS_ADM1031_FAN1 80 /* R */ -#define SENSORS_ADM1031_FAN1_MIN 81 /* RW */ -#define SENSORS_ADM1031_FAN1_DIV 82 /* RW */ -#define SENSORS_ADM1031_FAN2 90 /* R */ -#define SENSORS_ADM1031_FAN2_MIN 91 /* RW */ -#define SENSORS_ADM1031_FAN2_DIV 92 /* RW */ - -#define SENSORS_ADM1031_ALARMS 100 /* R */ - - -/* 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 */ -#define SENSORS_MAX1617_TEMP_OVER 53 /* RW */ -#define SENSORS_MAX1617_REMOTE_TEMP 54 /* R */ -#define SENSORS_MAX1617_REMOTE_TEMP_HYST 55 /* RW */ -#define SENSORS_MAX1617_REMOTE_TEMP_OVER 56 /* RW */ -#define SENSORS_MAX1617_ALARMS 81 /* R */ - -/* MAX1617A chips. */ - -#define SENSORS_MAX1617A_PREFIX "max1617a" - -#define SENSORS_MAX1617A_TEMP 51 /* R */ -#define SENSORS_MAX1617A_TEMP_HYST 52 /* RW */ -#define SENSORS_MAX1617A_TEMP_OVER 53 /* RW */ -#define SENSORS_MAX1617A_REMOTE_TEMP 54 /* R */ -#define SENSORS_MAX1617A_REMOTE_TEMP_HYST 55 /* RW */ -#define SENSORS_MAX1617A_REMOTE_TEMP_OVER 56 /* RW */ -#define SENSORS_MAX1617A_ALARMS 81 /* R */ - -/* GL518SM chips */ - -#define SENSORS_GL518_PREFIX "gl518sm" - -#define SENSORS_GL518_VDD 1 /* R */ -#define SENSORS_GL518_VIN1 2 /* R */ -#define SENSORS_GL518_VIN2 3 /* R */ -#define SENSORS_GL518_VIN3 4 /* R */ -#define SENSORS_GL518_VDD_MIN 11 /* RW */ -#define SENSORS_GL518_VIN1_MIN 12 /* RW */ -#define SENSORS_GL518_VIN2_MIN 13 /* RW */ -#define SENSORS_GL518_VIN3_MIN 14 /* RW */ -#define SENSORS_GL518_VDD_MAX 21 /* RW */ -#define SENSORS_GL518_VIN1_MAX 22 /* RW */ -#define SENSORS_GL518_VIN2_MAX 23 /* RW */ -#define SENSORS_GL518_VIN3_MAX 24 /* RW */ -#define SENSORS_GL518_FAN1 31 /* R */ -#define SENSORS_GL518_FAN2 32 /* R */ -#define SENSORS_GL518_FAN1_MIN 41 /* RW */ -#define SENSORS_GL518_FAN2_MIN 42 /* RW */ -#define SENSORS_GL518_TEMP 51 /* R */ -#define SENSORS_GL518_TEMP_HYST 52 /* RW */ -#define SENSORS_GL518_TEMP_OVER 53 /* RW */ -#define SENSORS_GL518_FAN1_DIV 71 /* RW */ -#define SENSORS_GL518_FAN2_DIV 72 /* RW */ -#define SENSORS_GL518_ALARMS 81 /* R */ -#define SENSORS_GL518_BEEP_ENABLE 82 /* RW */ -#define SENSORS_GL518_BEEPS 83 /* RW */ -#define SENSORS_GL518_ITERATE 84 /* RW */ -#define SENSORS_GL518_FAN1OFF 85 /* RW */ -#define SENSORS_GL518_FAN1PIN 86 /* RW */ - -/* GL520SM chips */ - -#define SENSORS_GL520_PREFIX "gl520sm" - -#define SENSORS_GL520_VDD 1 /* R */ -#define SENSORS_GL520_VIN1 2 /* R */ -#define SENSORS_GL520_VIN2 3 /* R */ -#define SENSORS_GL520_VIN3 4 /* R */ -#define SENSORS_GL520_VIN4 5 /* R */ -#define SENSORS_GL520_VDD_MIN 11 /* RW */ -#define SENSORS_GL520_VIN1_MIN 12 /* RW */ -#define SENSORS_GL520_VIN2_MIN 13 /* RW */ -#define SENSORS_GL520_VIN3_MIN 14 /* RW */ -#define SENSORS_GL520_VIN4_MIN 15 /* RW */ -#define SENSORS_GL520_VDD_MAX 21 /* RW */ -#define SENSORS_GL520_VIN1_MAX 22 /* RW */ -#define SENSORS_GL520_VIN2_MAX 23 /* RW */ -#define SENSORS_GL520_VIN3_MAX 24 /* RW */ -#define SENSORS_GL520_VIN4_MAX 25 /* RW */ -#define SENSORS_GL520_FAN1 31 /* R */ -#define SENSORS_GL520_FAN2 32 /* R */ -#define SENSORS_GL520_FAN1_MIN 41 /* RW */ -#define SENSORS_GL520_FAN2_MIN 42 /* RW */ -#define SENSORS_GL520_TEMP1 51 /* R */ -#define SENSORS_GL520_TEMP1_HYST 52 /* RW */ -#define SENSORS_GL520_TEMP1_OVER 53 /* RW */ -#define SENSORS_GL520_TEMP2 54 /* R */ -#define SENSORS_GL520_TEMP2_HYST 55 /* RW */ -#define SENSORS_GL520_TEMP2_OVER 56 /* RW */ -#define SENSORS_GL520_VID 61 /* R */ -#define SENSORS_GL520_FAN1_DIV 71 /* RW */ -#define SENSORS_GL520_FAN2_DIV 72 /* RW */ -#define SENSORS_GL520_ALARMS 81 /* R */ -#define SENSORS_GL520_BEEP_ENABLE 82 /* RW */ -#define SENSORS_GL520_BEEPS 83 /* RW */ -#define SENSORS_GL520_TWOTEMPS 84 /* RW */ -#define SENSORS_GL520_FAN1OFF 85 /* RW */ - -/* LM80 chips */ - -#define SENSORS_LM80_PREFIX "lm80" - -#define SENSORS_LM80_IN0 1 /* R */ -#define SENSORS_LM80_IN1 2 /* R */ -#define SENSORS_LM80_IN2 3 /* R */ -#define SENSORS_LM80_IN3 4 /* R */ -#define SENSORS_LM80_IN4 5 /* R */ -#define SENSORS_LM80_IN5 6 /* R */ -#define SENSORS_LM80_IN6 7 /* R */ -#define SENSORS_LM80_IN0_MIN 11 /* RW */ -#define SENSORS_LM80_IN1_MIN 12 /* RW */ -#define SENSORS_LM80_IN2_MIN 13 /* RW */ -#define SENSORS_LM80_IN3_MIN 14 /* RW */ -#define SENSORS_LM80_IN4_MIN 15 /* RW */ -#define SENSORS_LM80_IN5_MIN 16 /* RW */ -#define SENSORS_LM80_IN6_MIN 17 /* RW */ -#define SENSORS_LM80_IN0_MAX 21 /* RW */ -#define SENSORS_LM80_IN1_MAX 22 /* RW */ -#define SENSORS_LM80_IN2_MAX 23 /* RW */ -#define SENSORS_LM80_IN3_MAX 24 /* RW */ -#define SENSORS_LM80_IN4_MAX 25 /* R */ -#define SENSORS_LM80_IN5_MAX 26 /* R */ -#define SENSORS_LM80_IN6_MAX 27 /* R */ -#define SENSORS_LM80_FAN1 31 /* R */ -#define SENSORS_LM80_FAN2 32 /* R */ -#define SENSORS_LM80_FAN1_MIN 41 /* RW */ -#define SENSORS_LM80_FAN2_MIN 42 /* RW */ -#define SENSORS_LM80_TEMP 51 /* R */ -#define SENSORS_LM80_TEMP_HOT_HYST 52 /* RW */ -#define SENSORS_LM80_TEMP_HOT_MAX 53 /* RW */ -#define SENSORS_LM80_TEMP_OS_HYST 54 /* RW */ -#define SENSORS_LM80_TEMP_OS_MAX 55 /* RW */ -#define SENSORS_LM80_FAN1_DIV 71 /* RW */ -#define SENSORS_LM80_FAN2_DIV 72 /* RW */ -#define SENSORS_LM80_ALARMS 81 /* R */ - -/* LM83 chips */ - -#define SENSORS_LM83_PREFIX "lm83" - -#define SENSORS_LM83_LOCAL_TEMP 51 /* R */ -#define SENSORS_LM83_LOCAL_HIGH 52 /* RW */ -#define SENSORS_LM83_REMOTE1_TEMP 54 /* R */ -#define SENSORS_LM83_REMOTE1_HIGH 55 /* RW */ -#define SENSORS_LM83_REMOTE2_TEMP 57 /* R */ -#define SENSORS_LM83_REMOTE2_HIGH 58 /* RW */ -#define SENSORS_LM83_REMOTE3_TEMP 60 /* R */ -#define SENSORS_LM83_REMOTE3_HIGH 61 /* RW */ -#define SENSORS_LM83_TCRIT 80 /* RW */ -#define SENSORS_LM83_ALARMS 81 /* R */ - -/* LM85 chips */ - -#define SENSORS_LM85_PREFIX "lm85" -#define SENSORS_LM85B_PREFIX "lm85b" -#define SENSORS_LM85C_PREFIX "lm85c" -#define SENSORS_ADM1027_PREFIX "adm1027" -#define SENSORS_ADT7463_PREFIX "adt7463" -#define SENSORS_EMC6D100_PREFIX "emc6d100" -#define SENSORS_EMC6D102_PREFIX "emc6d102" - -#define SENSORS_ADM1027_ALARM_MASK 1 /* RW -- alarm_mask */ -#define SENSORS_ADM1027_FAN1_PPR 2 /* RW -- fan1_ppr */ -#define SENSORS_ADM1027_FAN1_TACH_MODE 3 /* RW -- fan1_tach_mode */ -#define SENSORS_ADM1027_FAN2_PPR 4 /* RW -- fan2_ppr */ -#define SENSORS_ADM1027_FAN2_TACH_MODE 5 /* RW -- fan2_tach_mode */ -#define SENSORS_ADM1027_FAN3_PPR 6 /* RW -- fan3_ppr */ -#define SENSORS_ADM1027_FAN3_TACH_MODE 7 /* RW -- fan3_tach_mode */ -#define SENSORS_ADM1027_FAN4_PPR 8 /* RW -- fan4_ppr */ -#define SENSORS_ADM1027_FAN4_TACH_MODE 9 /* RW -- fan4_tach_mode */ -#define SENSORS_ADM1027_PWM1_SMOOTH 10 /* RW -- pwm1_smooth */ -#define SENSORS_ADM1027_PWM2_SMOOTH 11 /* RW -- pwm2_smooth */ -#define SENSORS_ADM1027_PWM3_SMOOTH 12 /* RW -- pwm3_smooth */ -#define SENSORS_ADM1027_TEMP1_OFFSET 13 /* RW -- temp1_offset */ -#define SENSORS_ADM1027_TEMP2_OFFSET 14 /* RW -- temp2_offset */ -#define SENSORS_ADM1027_TEMP3_OFFSET 15 /* RW -- temp3_offset */ -#define SENSORS_LM85_ALARMS 16 /* R -- alarms */ -#define SENSORS_LM85_VID 17 /* R -- vid */ -#define SENSORS_LM85_VRM 18 /* RW -- vrm */ -#define SENSORS_LM85_FAN1 19 /* R -- fan1 */ -#define SENSORS_LM85_FAN1_MIN 20 /* RW -- fan1_min */ -#define SENSORS_LM85_FAN1_TACH_MODE 21 /* RW -- fan1_tach_mode */ -#define SENSORS_LM85_FAN2 22 /* R -- fan2 */ -#define SENSORS_LM85_FAN2_MIN 23 /* RW -- fan2_min */ -#define SENSORS_LM85_FAN2_TACH_MODE 24 /* RW -- fan2_tach_mode */ -#define SENSORS_LM85_FAN3 25 /* R -- fan3 */ -#define SENSORS_LM85_FAN3_MIN 26 /* RW -- fan3_min */ -#define SENSORS_LM85_FAN3_TACH_MODE 27 /* RW -- fan3_tach_mode */ -#define SENSORS_LM85_FAN4 28 /* R -- fan4 */ -#define SENSORS_LM85_FAN4_MIN 29 /* RW -- fan4_min */ -#define SENSORS_LM85_IN0 30 /* R -- in0 */ -#define SENSORS_LM85_IN0_MAX 31 /* RW -- in0_max */ -#define SENSORS_LM85_IN0_MIN 32 /* RW -- in0_min */ -#define SENSORS_LM85_IN1 33 /* R -- in1 */ -#define SENSORS_LM85_IN1_MAX 34 /* RW -- in1_max */ -#define SENSORS_LM85_IN1_MIN 35 /* RW -- in1_min */ -#define SENSORS_LM85_IN2 36 /* R -- in2 */ -#define SENSORS_LM85_IN2_MAX 37 /* RW -- in2_max */ -#define SENSORS_LM85_IN2_MIN 38 /* RW -- in2_min */ -#define SENSORS_LM85_IN3 39 /* R -- in3 */ -#define SENSORS_LM85_IN3_MAX 40 /* RW -- in3_max */ -#define SENSORS_LM85_IN3_MIN 41 /* RW -- in3_min */ -#define SENSORS_LM85_IN4 42 /* R -- in4 */ -#define SENSORS_LM85_IN4_MAX 43 /* RW -- in4_max */ -#define SENSORS_LM85_IN4_MIN 44 /* RW -- in4_min */ -#define SENSORS_LM85_IN5 45 /* R -- in5 */ -#define SENSORS_LM85_IN5_MAX 46 /* RW -- in5_max */ -#define SENSORS_LM85_IN5_MIN 47 /* RW -- in5_min */ -#define SENSORS_LM85_IN6 48 /* R -- in6 */ -#define SENSORS_LM85_IN6_MAX 49 /* RW -- in6_max */ -#define SENSORS_LM85_IN6_MIN 50 /* RW -- in6_min */ -#define SENSORS_LM85_IN7 51 /* R -- in7 */ -#define SENSORS_LM85_IN7_MAX 52 /* RW -- in7_max */ -#define SENSORS_LM85_IN7_MIN 53 /* RW -- in7_min */ -#define SENSORS_LM85_PWM1 54 /* RW -- pwm1 */ -#define SENSORS_LM85_PWM1_FREQ 55 /* RW -- pwm1_freq */ -#define SENSORS_LM85_PWM1_INVERT 56 /* RW -- pwm1_invert */ -#define SENSORS_LM85_PWM1_MIN 57 /* RW -- pwm1_min */ -#define SENSORS_LM85_PWM1_MIN_CTL 58 /* RW -- pwm1_min_ctl */ -#define SENSORS_LM85_PWM1_SPINUP 59 /* RW -- pwm1_spinup */ -#define SENSORS_LM85_PWM1_SPINUP_CTL 60 /* RW -- pwm1_spinup_ctl */ -#define SENSORS_LM85_PWM1_ZONE 61 /* RW -- pwm1_zone */ -#define SENSORS_LM85_PWM2 62 /* RW -- pwm2 */ -#define SENSORS_LM85_PWM2_FREQ 63 /* RW -- pwm2_freq */ -#define SENSORS_LM85_PWM2_INVERT 64 /* RW -- pwm2_invert */ -#define SENSORS_LM85_PWM2_MIN 65 /* RW -- pwm2_min */ -#define SENSORS_LM85_PWM2_MIN_CTL 66 /* RW -- pwm2_min_ctl */ -#define SENSORS_LM85_PWM2_SPINUP 67 /* RW -- pwm2_spinup */ -#define SENSORS_LM85_PWM2_SPINUP_CTL 68 /* RW -- pwm2_spinup_ctl */ -#define SENSORS_LM85_PWM2_ZONE 69 /* RW -- pwm2_zone */ -#define SENSORS_LM85_PWM3 70 /* RW -- pwm3 */ -#define SENSORS_LM85_PWM3_FREQ 71 /* RW -- pwm3_freq */ -#define SENSORS_LM85_PWM3_INVERT 72 /* RW -- pwm3_invert */ -#define SENSORS_LM85_PWM3_MIN 73 /* RW -- pwm3_min */ -#define SENSORS_LM85_PWM3_MIN_CTL 74 /* RW -- pwm3_min_ctl */ -#define SENSORS_LM85_PWM3_SPINUP 75 /* RW -- pwm3_spinup */ -#define SENSORS_LM85_PWM3_SPINUP_CTL 76 /* RW -- pwm3_spinup_ctl */ -#define SENSORS_LM85_PWM3_ZONE 77 /* RW -- pwm3_zone */ -#define SENSORS_LM85_TEMP1 78 /* R -- temp1 */ -#define SENSORS_LM85_TEMP1_MAX 79 /* RW -- temp1_max */ -#define SENSORS_LM85_TEMP1_MIN 80 /* RW -- temp1_min */ -#define SENSORS_LM85_TEMP2 81 /* R -- temp2 */ -#define SENSORS_LM85_TEMP2_MAX 82 /* RW -- temp2_max */ -#define SENSORS_LM85_TEMP2_MIN 83 /* RW -- temp2_min */ -#define SENSORS_LM85_TEMP3 84 /* R -- temp3 */ -#define SENSORS_LM85_TEMP3_MAX 85 /* RW -- temp3_max */ -#define SENSORS_LM85_TEMP3_MIN 86 /* RW -- temp3_min */ -#define SENSORS_LM85_ZONE1_CRITICAL 87 /* RW -- zone1_critical */ -#define SENSORS_LM85_ZONE1_HYST 88 /* RW -- zone1_hyst */ -#define SENSORS_LM85_ZONE1_LIMIT 89 /* RW -- zone1_limit */ -#define SENSORS_LM85_ZONE1_RANGE 90 /* RW -- zone1_range */ -#define SENSORS_LM85_ZONE1_SMOOTH 91 /* RW -- zone1_smooth */ -#define SENSORS_LM85_ZONE2_CRITICAL 92 /* RW -- zone2_critical */ -#define SENSORS_LM85_ZONE2_HYST 93 /* RW -- zone2_hyst */ -#define SENSORS_LM85_ZONE2_LIMIT 94 /* RW -- zone2_limit */ -#define SENSORS_LM85_ZONE2_RANGE 95 /* RW -- zone2_range */ -#define SENSORS_LM85_ZONE2_SMOOTH 96 /* RW -- zone2_smooth */ -#define SENSORS_LM85_ZONE3_CRITICAL 97 /* RW -- zone3_critical */ -#define SENSORS_LM85_ZONE3_HYST 98 /* RW -- zone3_hyst */ -#define SENSORS_LM85_ZONE3_LIMIT 99 /* RW -- zone3_limit */ -#define SENSORS_LM85_ZONE3_RANGE 100 /* RW -- zone3_range */ -#define SENSORS_LM85_ZONE3_SMOOTH 101 /* RW -- zone3_smooth */ - -/* LM86/LM89/LM90/LM99/ADM1032/MAX6657/ADT7461 chips */ - -#define SENSORS_LM90_PREFIX "lm90" -#define SENSORS_ADM1032_PREFIX "adm1032" -#define SENSORS_LM99_PREFIX "lm99" -#define SENSORS_LM86_PREFIX "lm86" -#define SENSORS_MAX6657_PREFIX "max6657" -#define SENSORS_ADT7461_PREFIX "adt7461" - -#define SENSORS_LM90_LOCAL_TEMP 51 /* R */ -#define SENSORS_LM90_LOCAL_HIGH 52 /* RW */ -#define SENSORS_LM90_LOCAL_LOW 53 /* RW */ -#define SENSORS_LM90_LOCAL_TCRIT 54 /* RW */ -#define SENSORS_LM90_REMOTE_TEMP 57 /* R */ -#define SENSORS_LM90_REMOTE_HIGH 58 /* RW */ -#define SENSORS_LM90_REMOTE_LOW 59 /* RW */ -#define SENSORS_LM90_REMOTE_TCRIT 60 /* RW */ -#define SENSORS_LM90_LOCAL_TCRIT_HYST 79 /* RW */ -#define SENSORS_LM90_REMOTE_TCRIT_HYST 80 /* R, see driver source */ -#define SENSORS_LM90_ALARMS 81 /* R */ - -/* LM63 chips */ - -#define SENSORS_LM63_PREFIX "lm63" - -#define SENSORS_LM63_LOCAL_TEMP 51 /* R */ -#define SENSORS_LM63_LOCAL_HIGH 52 /* RW */ -#define SENSORS_LM63_REMOTE_TEMP 57 /* R */ -#define SENSORS_LM63_REMOTE_HIGH 58 /* RW */ -#define SENSORS_LM63_REMOTE_LOW 59 /* RW */ -#define SENSORS_LM63_REMOTE_TCRIT 60 /* R */ -#define SENSORS_LM63_REMOTE_TCRIT_HYST 80 /* RW */ -#define SENSORS_LM63_ALARMS 81 /* R */ -#define SENSORS_LM63_FAN 84 /* R */ -#define SENSORS_LM63_FAN_LOW 85 /* RW */ -#define SENSORS_LM63_PWM 87 /* RW */ -#define SENSORS_LM63_PWM_ENABLE 88 /* RW */ - -/* Winbond W83781D chips */ - -#define SENSORS_W83781D_PREFIX "w83781d" - -#define SENSORS_W83781D_IN0 1 /* R */ -#define SENSORS_W83781D_IN1 2 /* R */ -#define SENSORS_W83781D_IN2 3 /* R */ -#define SENSORS_W83781D_IN3 4 /* R */ -#define SENSORS_W83781D_IN4 5 /* R */ -#define SENSORS_W83781D_IN5 6 /* R */ -#define SENSORS_W83781D_IN6 7 /* R */ -#define SENSORS_W83781D_IN0_MIN 11 /* RW */ -#define SENSORS_W83781D_IN1_MIN 12 /* RW */ -#define SENSORS_W83781D_IN2_MIN 13 /* RW */ -#define SENSORS_W83781D_IN3_MIN 14 /* RW */ -#define SENSORS_W83781D_IN4_MIN 15 /* RW */ -#define SENSORS_W83781D_IN5_MIN 16 /* RW */ -#define SENSORS_W83781D_IN6_MIN 17 /* RW */ -#define SENSORS_W83781D_IN0_MAX 21 /* RW */ -#define SENSORS_W83781D_IN1_MAX 22 /* RW */ -#define SENSORS_W83781D_IN2_MAX 23 /* RW */ -#define SENSORS_W83781D_IN3_MAX 24 /* RW */ -#define SENSORS_W83781D_IN4_MAX 25 /* RW */ -#define SENSORS_W83781D_IN5_MAX 26 /* RW */ -#define SENSORS_W83781D_IN6_MAX 27 /* RW */ -#define SENSORS_W83781D_FAN1 31 /* R */ -#define SENSORS_W83781D_FAN2 32 /* R */ -#define SENSORS_W83781D_FAN3 33 /* R */ -#define SENSORS_W83781D_FAN1_MIN 41 /* RW */ -#define SENSORS_W83781D_FAN2_MIN 42 /* RW */ -#define SENSORS_W83781D_FAN3_MIN 43 /* RW */ -#define SENSORS_W83781D_TEMP1 51 /* R */ -#define SENSORS_W83781D_TEMP1_HYST 52 /* RW */ -#define SENSORS_W83781D_TEMP1_OVER 53 /* RW */ -#define SENSORS_W83781D_TEMP2 54 /* R */ -#define SENSORS_W83781D_TEMP2_HYST 55 /* RW */ -#define SENSORS_W83781D_TEMP2_OVER 56 /* RW */ -#define SENSORS_W83781D_TEMP3 57 /* R */ -#define SENSORS_W83781D_TEMP3_HYST 58 /* RW */ -#define SENSORS_W83781D_TEMP3_OVER 59 /* RW */ -#define SENSORS_W83781D_VID 61 /* R */ -#define SENSORS_W83781D_VRM 62 /* RW */ -#define SENSORS_W83781D_FAN1_DIV 71 /* RW */ -#define SENSORS_W83781D_FAN2_DIV 72 /* RW */ -#define SENSORS_W83781D_FAN3_DIV 73 /* R (yes, really! */ -#define SENSORS_W83781D_ALARMS 81 /* R */ -#define SENSORS_W83781D_BEEP_ENABLE 82 /* RW */ -#define SENSORS_W83781D_BEEPS 83 /* RW */ -#define SENSORS_W83781D_SENS1 91 /* RW */ -#define SENSORS_W83781D_SENS2 92 /* RW */ -#define SENSORS_W83781D_SENS3 93 /* RW */ - - -/* 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_W83627THF_PREFIX "w83627thf" -#define SENSORS_W83637HF_PREFIX "w83637hf" -#define SENSORS_W83687THF_PREFIX "w83687thf" - -#define SENSORS_W83791D_PREFIX "w83791d" - - -#define SENSORS_W83791D_IN0 1 /* R */ -#define SENSORS_W83791D_IN1 2 /* R */ -#define SENSORS_W83791D_IN2 3 /* R */ -#define SENSORS_W83791D_IN3 4 /* R */ -#define SENSORS_W83791D_IN4 5 /* R */ -#define SENSORS_W83791D_IN5 6 /* R */ -#define SENSORS_W83791D_IN6 7 /* R */ -#define SENSORS_W83791D_IN7 8 /* R */ -#define SENSORS_W83791D_IN8 9 /* R */ -#define SENSORS_W83791D_IN9 10 /* R */ - -#define SENSORS_W83791D_IN0_MIN 11 /* RW */ -#define SENSORS_W83791D_IN1_MIN 12 /* RW */ -#define SENSORS_W83791D_IN2_MIN 13 /* RW */ -#define SENSORS_W83791D_IN3_MIN 14 /* RW */ -#define SENSORS_W83791D_IN4_MIN 15 /* RW */ -#define SENSORS_W83791D_IN5_MIN 16 /* RW */ -#define SENSORS_W83791D_IN6_MIN 17 /* RW */ -#define SENSORS_W83791D_IN7_MIN 18 /* RW */ -#define SENSORS_W83791D_IN8_MIN 19 /* RW */ -#define SENSORS_W83791D_IN9_MIN 20 /* RW */ - -#define SENSORS_W83791D_IN0_MAX 21 /* RW */ -#define SENSORS_W83791D_IN1_MAX 22 /* RW */ -#define SENSORS_W83791D_IN2_MAX 23 /* RW */ -#define SENSORS_W83791D_IN3_MAX 24 /* RW */ -#define SENSORS_W83791D_IN4_MAX 25 /* RW */ -#define SENSORS_W83791D_IN5_MAX 26 /* RW */ -#define SENSORS_W83791D_IN6_MAX 27 /* RW */ -#define SENSORS_W83791D_IN7_MAX 28 /* RW */ -#define SENSORS_W83791D_IN8_MAX 29 /* RW */ -#define SENSORS_W83791D_IN9_MAX 30 /* RW */ - -#define SENSORS_W83791D_FAN1 31 /* R */ -#define SENSORS_W83791D_FAN2 32 /* R */ -#define SENSORS_W83791D_FAN3 33 /* R */ -#define SENSORS_W83791D_FAN4 34 /* R */ -#define SENSORS_W83791D_FAN5 35 /* R */ - -#define SENSORS_W83791D_FAN1_MIN 41 /* RW */ -#define SENSORS_W83791D_FAN2_MIN 42 /* RW */ -#define SENSORS_W83791D_FAN3_MIN 43 /* RW */ -#define SENSORS_W83791D_FAN4_MIN 44 /* RW */ -#define SENSORS_W83791D_FAN5_MIN 45 /* RW */ - -#define SENSORS_W83791D_TEMP1 51 /* R */ -#define SENSORS_W83791D_TEMP1_HYST 52 /* RW */ -#define SENSORS_W83791D_TEMP1_OVER 53 /* RW */ -#define SENSORS_W83791D_TEMP2 54 /* R */ -#define SENSORS_W83791D_TEMP2_HYST 55 /* RW */ -#define SENSORS_W83791D_TEMP2_OVER 56 /* RW */ -#define SENSORS_W83791D_TEMP3 57 /* R */ -#define SENSORS_W83791D_TEMP3_HYST 58 /* RW */ -#define SENSORS_W83791D_TEMP3_OVER 59 /* RW */ -#define SENSORS_W83791D_VID 61 /* R */ -#define SENSORS_W83791D_VRM 62 /* RW */ - -#define SENSORS_W83791D_FAN1_DIV 71 /* RW */ -#define SENSORS_W83791D_FAN2_DIV 72 /* RW */ -#define SENSORS_W83791D_FAN3_DIV 73 /* R (yes, really! */ -#define SENSORS_W83791D_FAN4_DIV 74 /* R (yes, really! */ -#define SENSORS_W83791D_FAN5_DIV 75 /* R (yes, really! */ - -#define SENSORS_W83791D_ALARMS 81 /* R */ -#define SENSORS_W83791D_BEEP_ENABLE 82 /* RW */ -#define SENSORS_W83791D_BEEPS 83 /* RW */ -#define SENSORS_W83791D_SENS1 91 /* RW */ -#define SENSORS_W83791D_SENS2 92 /* RW */ -#define SENSORS_W83791D_SENS3 93 /* RW */ - - - -/* Winbond W83792AD/D chip */ -#define SENSORS_W83792D_PREFIX "w83792d" - - -#define SENSORS_W83792D_IN0 1 /* R */ -#define SENSORS_W83792D_IN1 2 /* R */ -#define SENSORS_W83792D_IN2 3 /* R */ -#define SENSORS_W83792D_IN3 4 /* R */ -#define SENSORS_W83792D_IN4 5 /* R */ -#define SENSORS_W83792D_IN5 6 /* R */ -#define SENSORS_W83792D_IN6 7 /* R */ -#define SENSORS_W83792D_IN7 8 /* R */ -#define SENSORS_W83792D_IN8 9 /* R */ -#define SENSORS_W83792D_IN9 10 /* R */ - -#define SENSORS_W83792D_IN0_MIN 11 /* RW */ -#define SENSORS_W83792D_IN1_MIN 12 /* RW */ -#define SENSORS_W83792D_IN2_MIN 13 /* RW */ -#define SENSORS_W83792D_IN3_MIN 14 /* RW */ -#define SENSORS_W83792D_IN4_MIN 15 /* RW */ -#define SENSORS_W83792D_IN5_MIN 16 /* RW */ -#define SENSORS_W83792D_IN6_MIN 17 /* RW */ -#define SENSORS_W83792D_IN7_MIN 18 /* RW */ -#define SENSORS_W83792D_IN8_MIN 19 /* RW */ -#define SENSORS_W83792D_IN9_MIN 20 /* RW */ - -#define SENSORS_W83792D_IN0_MAX 21 /* RW */ -#define SENSORS_W83792D_IN1_MAX 22 /* RW */ -#define SENSORS_W83792D_IN2_MAX 23 /* RW */ -#define SENSORS_W83792D_IN3_MAX 24 /* RW */ -#define SENSORS_W83792D_IN4_MAX 25 /* RW */ -#define SENSORS_W83792D_IN5_MAX 26 /* RW */ -#define SENSORS_W83792D_IN6_MAX 27 /* RW */ -#define SENSORS_W83792D_IN7_MAX 28 /* RW */ -#define SENSORS_W83792D_IN8_MAX 29 /* RW */ -#define SENSORS_W83792D_IN9_MAX 30 /* RW */ - -#define SENSORS_W83792D_FAN1 31 /* R */ -#define SENSORS_W83792D_FAN2 32 /* R */ -#define SENSORS_W83792D_FAN3 33 /* R */ -#define SENSORS_W83792D_FAN4 34 /* R */ -#define SENSORS_W83792D_FAN5 35 /* R */ -#define SENSORS_W83792D_FAN6 36 /* R */ -#define SENSORS_W83792D_FAN7 37 /* R */ - -#define SENSORS_W83792D_FAN1_MIN 41 /* RW */ -#define SENSORS_W83792D_FAN2_MIN 42 /* RW */ -#define SENSORS_W83792D_FAN3_MIN 43 /* RW */ -#define SENSORS_W83792D_FAN4_MIN 44 /* RW */ -#define SENSORS_W83792D_FAN5_MIN 45 /* RW */ -#define SENSORS_W83792D_FAN6_MIN 46 /* RW */ -#define SENSORS_W83792D_FAN7_MIN 47 /* RW */ - -#define SENSORS_W83792D_TEMP1 51 /* R */ -#define SENSORS_W83792D_TEMP1_HYST 52 /* RW */ -#define SENSORS_W83792D_TEMP1_OVER 53 /* RW */ -#define SENSORS_W83792D_TEMP2 54 /* R */ -#define SENSORS_W83792D_TEMP2_HYST 55 /* RW */ -#define SENSORS_W83792D_TEMP2_OVER 56 /* RW */ -#define SENSORS_W83792D_TEMP3 57 /* R */ -#define SENSORS_W83792D_TEMP3_HYST 58 /* RW */ -#define SENSORS_W83792D_TEMP3_OVER 59 /* RW */ -/*#define SENSORS_W83792D_VID 61 */ /* R */ -/*#define SENSORS_W83792D_VRM 62 */ /* RW */ -#define SENSORS_W83792D_CHASSIS 63 /* R */ -#define SENSORS_W83792D_ALARMS 64 /* R */ - -#define SENSORS_W83792D_FAN1_DIV 71 /* RW */ -#define SENSORS_W83792D_FAN2_DIV 72 /* RW */ -#define SENSORS_W83792D_FAN3_DIV 73 /* RW */ -#define SENSORS_W83792D_FAN4_DIV 74 /* RW */ -#define SENSORS_W83792D_FAN5_DIV 75 /* RW */ -#define SENSORS_W83792D_FAN6_DIV 76 /* RW */ -#define SENSORS_W83792D_FAN7_DIV 77 /* RW */ - - -/* Winbond W83793R chip */ -#define SENSORS_W83793_PREFIX "w83793" - -#define SENSORS_W83793_IN(n) (0 + (n)) /* n(0-9) R */ -#define SENSORS_W83793_IN_MIN(n) (20 + (n)) /* n(0-9) RW */ -#define SENSORS_W83793_IN_MAX(n) (40 + (n)) /* n(0-9) RW */ -#define SENSORS_W83793_IN_ALARM(n) (60 + (n)) /* n(0-9) R */ - -#define SENSORS_W83793_FAN(n) (80 + (n)) /* n(1-12) R */ -#define SENSORS_W83793_FAN_MIN(n) (100 + (n)) /* n(1-12) RW */ -#define SENSORS_W83793_FAN_ALARM(n) (120 + (n)) /* n(1-12) R */ - - -#define SENSORS_W83793_TEMP(n) (140 + (n)) /* n(1-6) R */ -#define SENSORS_W83793_TEMP_CRIT(n) (160 + (n)) /* n(1-6) RW */ -#define SENSORS_W83793_TEMP_CRIT_HYST(n) (180 + (n)) /* n(1-6) RW */ -#define SENSORS_W83793_TEMP_ALARM(n) (200 + (n)) /* n(1-6) R */ - -#define SENSORS_W83793_VID0 221 /* R */ -#define SENSORS_W83793_VID1 222 /* R */ -#define SENSORS_W83793_VRM 230 /* RW */ -#define SENSORS_W83793_CHASSIS 240 /* RW */ - - -#define SENSORS_AS99127F_PREFIX "as99127f" - -#define SENSORS_W83782D_IN0 1 /* R */ -#define SENSORS_W83782D_IN1 2 /* R */ -#define SENSORS_W83782D_IN2 3 /* R */ -#define SENSORS_W83782D_IN3 4 /* R */ -#define SENSORS_W83782D_IN4 5 /* R */ -#define SENSORS_W83782D_IN5 6 /* R */ -#define SENSORS_W83782D_IN6 7 /* R */ -#define SENSORS_W83782D_IN7 8 /* R */ -#define SENSORS_W83782D_IN8 9 /* R */ -#define SENSORS_W83782D_IN0_MIN 11 /* RW */ -#define SENSORS_W83782D_IN1_MIN 12 /* RW */ -#define SENSORS_W83782D_IN2_MIN 13 /* RW */ -#define SENSORS_W83782D_IN3_MIN 14 /* RW */ -#define SENSORS_W83782D_IN4_MIN 15 /* RW */ -#define SENSORS_W83782D_IN5_MIN 16 /* RW */ -#define SENSORS_W83782D_IN6_MIN 17 /* RW */ -#define SENSORS_W83782D_IN7_MIN 18 /* RW */ -#define SENSORS_W83782D_IN8_MIN 19 /* RW */ -#define SENSORS_W83782D_IN0_MAX 21 /* RW */ -#define SENSORS_W83782D_IN1_MAX 22 /* RW */ -#define SENSORS_W83782D_IN2_MAX 23 /* RW */ -#define SENSORS_W83782D_IN3_MAX 24 /* RW */ -#define SENSORS_W83782D_IN4_MAX 25 /* RW */ -#define SENSORS_W83782D_IN5_MAX 26 /* RW */ -#define SENSORS_W83782D_IN6_MAX 27 /* RW */ -#define SENSORS_W83782D_IN7_MAX 28 /* RW */ -#define SENSORS_W83782D_IN8_MAX 29 /* RW */ -#define SENSORS_W83782D_FAN1 31 /* R */ -#define SENSORS_W83782D_FAN2 32 /* R */ -#define SENSORS_W83782D_FAN3 33 /* R */ -#define SENSORS_W83782D_FAN1_MIN 41 /* RW */ -#define SENSORS_W83782D_FAN2_MIN 42 /* RW */ -#define SENSORS_W83782D_FAN3_MIN 43 /* RW */ -#define SENSORS_W83782D_TEMP1 51 /* R */ -#define SENSORS_W83782D_TEMP1_HYST 52 /* RW */ -#define SENSORS_W83782D_TEMP1_OVER 53 /* RW */ -#define SENSORS_W83782D_TEMP2 54 /* R */ -#define SENSORS_W83782D_TEMP2_HYST 55 /* RW */ -#define SENSORS_W83782D_TEMP2_OVER 56 /* RW */ -#define SENSORS_W83782D_TEMP3 57 /* R */ -#define SENSORS_W83782D_TEMP3_HYST 58 /* RW */ -#define SENSORS_W83782D_TEMP3_OVER 59 /* RW */ -#define SENSORS_W83782D_VID 61 /* R */ -#define SENSORS_W83782D_VRM 62 /* RW */ -#define SENSORS_W83782D_FAN1_DIV 71 /* RW */ -#define SENSORS_W83782D_FAN2_DIV 72 /* RW */ -#define SENSORS_W83782D_FAN3_DIV 73 /* R (yes, really! */ -#define SENSORS_W83782D_ALARMS 81 /* R */ -#define SENSORS_W83782D_BEEP_ENABLE 82 /* RW */ -#define SENSORS_W83782D_BEEPS 83 /* RW */ -#define SENSORS_W83782D_SENS1 91 /* RW */ -#define SENSORS_W83782D_SENS2 92 /* RW */ -#define SENSORS_W83782D_SENS3 93 /* RW */ - - -/* Winbond W83783S chips */ -/* Cheat on 697HF for now - no separate #defines */ - -#define SENSORS_W83783S_PREFIX "w83783s" -#define SENSORS_W83697HF_PREFIX "w83697hf" - -#define SENSORS_W83783S_IN0 1 /* R */ -#define SENSORS_W83783S_IN1 2 /* R */ -#define SENSORS_W83783S_IN2 3 /* R */ -#define SENSORS_W83783S_IN3 4 /* R */ -#define SENSORS_W83783S_IN4 5 /* R */ -#define SENSORS_W83783S_IN5 6 /* R */ -#define SENSORS_W83783S_IN6 7 /* R */ -#define SENSORS_W83783S_IN0_MIN 11 /* RW */ -#define SENSORS_W83783S_IN1_MIN 12 /* RW */ -#define SENSORS_W83783S_IN2_MIN 13 /* RW */ -#define SENSORS_W83783S_IN3_MIN 14 /* RW */ -#define SENSORS_W83783S_IN4_MIN 15 /* RW */ -#define SENSORS_W83783S_IN5_MIN 16 /* RW */ -#define SENSORS_W83783S_IN6_MIN 17 /* RW */ -#define SENSORS_W83783S_IN0_MAX 21 /* RW */ -#define SENSORS_W83783S_IN1_MAX 22 /* RW */ -#define SENSORS_W83783S_IN2_MAX 23 /* RW */ -#define SENSORS_W83783S_IN3_MAX 24 /* RW */ -#define SENSORS_W83783S_IN4_MAX 25 /* RW */ -#define SENSORS_W83783S_IN5_MAX 26 /* RW */ -#define SENSORS_W83783S_IN6_MAX 27 /* RW */ -#define SENSORS_W83783S_FAN1 31 /* R */ -#define SENSORS_W83783S_FAN2 32 /* R */ -#define SENSORS_W83783S_FAN3 33 /* R */ -#define SENSORS_W83783S_FAN1_MIN 41 /* RW */ -#define SENSORS_W83783S_FAN2_MIN 42 /* RW */ -#define SENSORS_W83783S_FAN3_MIN 43 /* RW */ -#define SENSORS_W83783S_TEMP1 51 /* R */ -#define SENSORS_W83783S_TEMP1_HYST 52 /* RW */ -#define SENSORS_W83783S_TEMP1_OVER 53 /* RW */ -#define SENSORS_W83783S_TEMP2 54 /* R */ -#define SENSORS_W83783S_TEMP2_HYST 55 /* RW */ -#define SENSORS_W83783S_TEMP2_OVER 56 /* RW */ -#define SENSORS_W83783S_VID 61 /* R */ -#define SENSORS_W83783S_VRM 62 /* RW */ -#define SENSORS_W83783S_FAN1_DIV 71 /* RW */ -#define SENSORS_W83783S_FAN2_DIV 72 /* RW */ -#define SENSORS_W83783S_FAN3_DIV 73 /* R (yes, really! */ -#define SENSORS_W83783S_ALARMS 81 /* R */ -#define SENSORS_W83783S_BEEP_ENABLE 82 /* RW */ -#define SENSORS_W83783S_BEEPS 83 /* RW */ -#define SENSORS_W83783S_SENS1 91 /* RW */ -#define SENSORS_W83783S_SENS2 92 /* RW */ - - -/* W83L785TS-S chips */ - -#define SENSORS_W83L785TS_PREFIX "w83l785ts" - -#define SENSORS_W83L785TS_TEMP 51 /* R */ -#define SENSORS_W83L785TS_TEMP_OVER 52 /* R for now */ - - -/* Winbond W83627EHF & W83627DHG Super-I/O chips */ -/* (W83627DHG is similar to W83627EHF but no in9) */ - -#define SENSORS_W83627EHF_PREFIX "w83627ehf" -#define SENSORS_W83627DHG_PREFIX "w83627dhg" - -#define SENSORS_W83627EHF_IN0 1 /* R */ -#define SENSORS_W83627EHF_IN1 2 /* R */ -#define SENSORS_W83627EHF_IN2 3 /* R */ -#define SENSORS_W83627EHF_IN3 4 /* R */ -#define SENSORS_W83627EHF_IN4 5 /* R */ -#define SENSORS_W83627EHF_IN5 6 /* R */ -#define SENSORS_W83627EHF_IN6 7 /* R */ -#define SENSORS_W83627EHF_IN7 8 /* R */ -#define SENSORS_W83627EHF_IN8 9 /* R */ -#define SENSORS_W83627EHF_IN9 10 /* R */ -#define SENSORS_W83627EHF_IN0_ALARM 111 /* R */ -#define SENSORS_W83627EHF_IN1_ALARM 112 /* R */ -#define SENSORS_W83627EHF_IN2_ALARM 113 /* R */ -#define SENSORS_W83627EHF_IN3_ALARM 114 /* R */ -#define SENSORS_W83627EHF_IN4_ALARM 115 /* R */ -#define SENSORS_W83627EHF_IN5_ALARM 116 /* R */ -#define SENSORS_W83627EHF_IN6_ALARM 117 /* R */ -#define SENSORS_W83627EHF_IN7_ALARM 118 /* R */ -#define SENSORS_W83627EHF_IN8_ALARM 119 /* R */ -#define SENSORS_W83627EHF_IN9_ALARM 120 /* R */ -#define SENSORS_W83627EHF_IN0_MIN 11 /* RW */ -#define SENSORS_W83627EHF_IN1_MIN 12 /* RW */ -#define SENSORS_W83627EHF_IN2_MIN 13 /* RW */ -#define SENSORS_W83627EHF_IN3_MIN 14 /* RW */ -#define SENSORS_W83627EHF_IN4_MIN 15 /* RW */ -#define SENSORS_W83627EHF_IN5_MIN 16 /* RW */ -#define SENSORS_W83627EHF_IN6_MIN 17 /* RW */ -#define SENSORS_W83627EHF_IN7_MIN 18 /* RW */ -#define SENSORS_W83627EHF_IN8_MIN 19 /* RW */ -#define SENSORS_W83627EHF_IN9_MIN 20 /* RW */ -#define SENSORS_W83627EHF_IN0_MAX 21 /* RW */ -#define SENSORS_W83627EHF_IN1_MAX 22 /* RW */ -#define SENSORS_W83627EHF_IN2_MAX 23 /* RW */ -#define SENSORS_W83627EHF_IN3_MAX 24 /* RW */ -#define SENSORS_W83627EHF_IN4_MAX 25 /* RW */ -#define SENSORS_W83627EHF_IN5_MAX 26 /* RW */ -#define SENSORS_W83627EHF_IN6_MAX 27 /* RW */ -#define SENSORS_W83627EHF_IN7_MAX 28 /* RW */ -#define SENSORS_W83627EHF_IN8_MAX 29 /* RW */ -#define SENSORS_W83627EHF_IN9_MAX 30 /* RW */ -#define SENSORS_W83627EHF_FAN1 31 /* R */ -#define SENSORS_W83627EHF_FAN2 32 /* R */ -#define SENSORS_W83627EHF_FAN3 33 /* R */ -#define SENSORS_W83627EHF_FAN4 34 /* R */ -#define SENSORS_W83627EHF_FAN5 35 /* R */ -#define SENSORS_W83627EHF_FAN1_ALARM 131 /* R */ -#define SENSORS_W83627EHF_FAN2_ALARM 132 /* R */ -#define SENSORS_W83627EHF_FAN3_ALARM 133 /* R */ -#define SENSORS_W83627EHF_FAN4_ALARM 134 /* R */ -#define SENSORS_W83627EHF_FAN5_ALARM 135 /* R */ -#define SENSORS_W83627EHF_FAN1_MIN 41 /* RW */ -#define SENSORS_W83627EHF_FAN2_MIN 42 /* RW */ -#define SENSORS_W83627EHF_FAN3_MIN 43 /* RW */ -#define SENSORS_W83627EHF_FAN4_MIN 44 /* RW */ -#define SENSORS_W83627EHF_FAN5_MIN 45 /* RW */ -#define SENSORS_W83627EHF_FAN1_DIV 51 /* RW */ -#define SENSORS_W83627EHF_FAN2_DIV 52 /* RW */ -#define SENSORS_W83627EHF_FAN3_DIV 53 /* RW */ -#define SENSORS_W83627EHF_FAN4_DIV 54 /* RW */ -#define SENSORS_W83627EHF_FAN5_DIV 55 /* RW */ -#define SENSORS_W83627EHF_TEMP1 61 /* R */ -#define SENSORS_W83627EHF_TEMP2 62 /* R */ -#define SENSORS_W83627EHF_TEMP3 63 /* R */ -#define SENSORS_W83627EHF_TEMP1_ALARM 161 /* R */ -#define SENSORS_W83627EHF_TEMP2_ALARM 162 /* R */ -#define SENSORS_W83627EHF_TEMP3_ALARM 163 /* R */ -#define SENSORS_W83627EHF_TEMP1_OVER 71 /* RW */ -#define SENSORS_W83627EHF_TEMP2_OVER 72 /* RW */ -#define SENSORS_W83627EHF_TEMP3_OVER 73 /* RW */ -#define SENSORS_W83627EHF_TEMP1_HYST 81 /* RW */ -#define SENSORS_W83627EHF_TEMP2_HYST 82 /* RW */ -#define SENSORS_W83627EHF_TEMP3_HYST 83 /* RW */ - - -/* Analog Devices ADM9240 chips */ - -#define SENSORS_ADM9240_PREFIX "adm9240" -#define SENSORS_LM81_PREFIX "lm81" -#define SENSORS_DS1780_PREFIX "ds1780" - -/* All three chips have the same features */ -#define SENSORS_ADM9240_IN0 1 /* R */ -#define SENSORS_ADM9240_IN1 2 /* R */ -#define SENSORS_ADM9240_IN2 3 /* R */ -#define SENSORS_ADM9240_IN3 4 /* R */ -#define SENSORS_ADM9240_IN4 5 /* R */ -#define SENSORS_ADM9240_IN5 6 /* R */ -#define SENSORS_ADM9240_IN0_MIN 11 /* RW */ -#define SENSORS_ADM9240_IN1_MIN 12 /* RW */ -#define SENSORS_ADM9240_IN2_MIN 13 /* RW */ -#define SENSORS_ADM9240_IN3_MIN 14 /* RW */ -#define SENSORS_ADM9240_IN4_MIN 15 /* RW */ -#define SENSORS_ADM9240_IN5_MIN 16 /* RW */ -#define SENSORS_ADM9240_IN0_MAX 21 /* RW */ -#define SENSORS_ADM9240_IN1_MAX 22 /* RW */ -#define SENSORS_ADM9240_IN2_MAX 23 /* RW */ -#define SENSORS_ADM9240_IN3_MAX 24 /* RW */ -#define SENSORS_ADM9240_IN4_MAX 25 /* RW */ -#define SENSORS_ADM9240_IN5_MAX 26 /* RW */ -#define SENSORS_ADM9240_FAN1 31 /* R */ -#define SENSORS_ADM9240_FAN2 32 /* R */ -#define SENSORS_ADM9240_FAN1_MIN 41 /* RW */ -#define SENSORS_ADM9240_FAN2_MIN 42 /* RW */ -#define SENSORS_ADM9240_TEMP 51 /* R */ -#define SENSORS_ADM9240_TEMP_HYST 52 /* RW */ -#define SENSORS_ADM9240_TEMP_OVER 53 /* RW */ -#define SENSORS_ADM9240_VID 61 /* R */ -#define SENSORS_ADM9240_FAN1_DIV 71 /* RW */ -#define SENSORS_ADM9240_FAN2_DIV 72 /* RW */ -#define SENSORS_ADM9240_ALARMS 81 /* R */ -#define SENSORS_ADM9240_ANALOG_OUT 82 /* RW */ - - -/* SiS southbridge with integrated lm78 */ - -#define SENSORS_SIS5595_PREFIX "sis5595" - -#define SENSORS_SIS5595_IN0 1 /* R */ -#define SENSORS_SIS5595_IN1 2 /* R */ -#define SENSORS_SIS5595_IN2 3 /* R */ -#define SENSORS_SIS5595_IN3 4 /* R */ -#define SENSORS_SIS5595_IN4 5 /* R */ -#define SENSORS_SIS5595_IN0_MIN 11 /* RW */ -#define SENSORS_SIS5595_IN1_MIN 12 /* RW */ -#define SENSORS_SIS5595_IN2_MIN 13 /* RW */ -#define SENSORS_SIS5595_IN3_MIN 14 /* RW */ -#define SENSORS_SIS5595_IN4_MIN 15 /* RW */ -#define SENSORS_SIS5595_IN0_MAX 21 /* RW */ -#define SENSORS_SIS5595_IN1_MAX 22 /* RW */ -#define SENSORS_SIS5595_IN2_MAX 23 /* RW */ -#define SENSORS_SIS5595_IN3_MAX 24 /* RW */ -#define SENSORS_SIS5595_IN4_MAX 25 /* RW */ -#define SENSORS_SIS5595_FAN1 31 /* R */ -#define SENSORS_SIS5595_FAN2 32 /* R */ -#define SENSORS_SIS5595_FAN1_MIN 41 /* RW */ -#define SENSORS_SIS5595_FAN2_MIN 42 /* RW */ -#define SENSORS_SIS5595_TEMP 51 /* R */ -#define SENSORS_SIS5595_TEMP_HYST 52 /* RW */ -#define SENSORS_SIS5595_TEMP_OVER 53 /* RW */ -#define SENSORS_SIS5595_FAN1_DIV 71 /* RW */ -#define SENSORS_SIS5595_FAN2_DIV 72 /* RW */ -#define SENSORS_SIS5595_ALARMS 81 /* R */ - - -/* HP MaxiLife chips */ - -#define SENSORS_MAXI_CG_PREFIX "maxilife-cg" -#define SENSORS_MAXI_CO_PREFIX "maxilife-co" -#define SENSORS_MAXI_AS_PREFIX "maxilife-as" -#define SENSORS_MAXI_NBA_PREFIX "maxilife-nba" - -#define SENSORS_MAXI_CG_FAN1 1 /* R */ -#define SENSORS_MAXI_CG_FAN2 2 /* R */ -#define SENSORS_MAXI_CG_FAN3 3 /* R */ -#define SENSORS_MAXI_CG_FAN1_MIN 11 /* RW */ -#define SENSORS_MAXI_CG_FAN2_MIN 12 /* RW */ -#define SENSORS_MAXI_CG_FAN3_MIN 13 /* RW */ -#define SENSORS_MAXI_CG_FAN1_DIV 14 /* R */ -#define SENSORS_MAXI_CG_FAN2_DIV 15 /* R */ -#define SENSORS_MAXI_CG_FAN3_DIV 16 /* R */ -#define SENSORS_MAXI_CG_TEMP1 21 /* R */ -#define SENSORS_MAXI_CG_TEMP2 22 /* R */ -#define SENSORS_MAXI_CG_TEMP3 23 /* R */ -#define SENSORS_MAXI_CG_TEMP4 24 /* R */ -#define SENSORS_MAXI_CG_TEMP5 25 /* R */ -#define SENSORS_MAXI_CG_TEMP1_MAX 31 /* R */ -#define SENSORS_MAXI_CG_TEMP2_MAX 32 /* R */ -#define SENSORS_MAXI_CG_TEMP3_MAX 33 /* R */ -#define SENSORS_MAXI_CG_TEMP4_MAX 34 /* R */ -#define SENSORS_MAXI_CG_TEMP5_MAX 35 /* R */ -#define SENSORS_MAXI_CG_TEMP1_HYST 41 /* R */ -#define SENSORS_MAXI_CG_TEMP2_HYST 42 /* R */ -#define SENSORS_MAXI_CG_TEMP3_HYST 43 /* R */ -#define SENSORS_MAXI_CG_TEMP4_HYST 44 /* R */ -#define SENSORS_MAXI_CG_TEMP5_HYST 45 /* R */ -#define SENSORS_MAXI_CG_PLL 51 /* R */ -#define SENSORS_MAXI_CG_PLL_MIN 52 /* RW */ -#define SENSORS_MAXI_CG_PLL_MAX 53 /* RW */ -#define SENSORS_MAXI_CG_VID1 61 /* R */ -#define SENSORS_MAXI_CG_VID2 62 /* R */ -#define SENSORS_MAXI_CG_VID3 63 /* R */ -#define SENSORS_MAXI_CG_VID4 64 /* R */ -#define SENSORS_MAXI_CG_VID1_MIN 71 /* RW */ -#define SENSORS_MAXI_CG_VID2_MIN 72 /* RW */ -#define SENSORS_MAXI_CG_VID3_MIN 73 /* RW */ -#define SENSORS_MAXI_CG_VID4_MIN 74 /* RW */ -#define SENSORS_MAXI_CG_VID1_MAX 81 /* RW */ -#define SENSORS_MAXI_CG_VID2_MAX 82 /* RW */ -#define SENSORS_MAXI_CG_VID3_MAX 83 /* RW */ -#define SENSORS_MAXI_CG_VID4_MAX 84 /* RW */ -#define SENSORS_MAXI_CG_ALARMS 91 /* R */ - -#define SENSORS_MAXI_CO_FAN1 1 /* R */ -#define SENSORS_MAXI_CO_FAN2 2 /* R */ -#define SENSORS_MAXI_CO_FAN3 3 /* R */ -#define SENSORS_MAXI_CO_FAN1_MIN 11 /* RW */ -#define SENSORS_MAXI_CO_FAN2_MIN 12 /* RW */ -#define SENSORS_MAXI_CO_FAN3_MIN 13 /* RW */ -#define SENSORS_MAXI_CO_FAN1_DIV 14 /* R */ -#define SENSORS_MAXI_CO_FAN2_DIV 15 /* R */ -#define SENSORS_MAXI_CO_FAN3_DIV 16 /* R */ -#define SENSORS_MAXI_CO_TEMP1 21 /* R */ -#define SENSORS_MAXI_CO_TEMP2 22 /* R */ -#define SENSORS_MAXI_CO_TEMP3 23 /* R */ -#define SENSORS_MAXI_CO_TEMP4 24 /* R */ -#define SENSORS_MAXI_CO_TEMP5 25 /* R */ -#define SENSORS_MAXI_CO_TEMP1_MAX 31 /* R */ -#define SENSORS_MAXI_CO_TEMP2_MAX 32 /* R */ -#define SENSORS_MAXI_CO_TEMP3_MAX 33 /* R */ -#define SENSORS_MAXI_CO_TEMP4_MAX 34 /* R */ -#define SENSORS_MAXI_CO_TEMP5_MAX 35 /* R */ -#define SENSORS_MAXI_CO_TEMP1_HYST 41 /* R */ -#define SENSORS_MAXI_CO_TEMP2_HYST 42 /* R */ -#define SENSORS_MAXI_CO_TEMP3_HYST 43 /* R */ -#define SENSORS_MAXI_CO_TEMP4_HYST 44 /* R */ -#define SENSORS_MAXI_CO_TEMP5_HYST 45 /* R */ -#define SENSORS_MAXI_CO_PLL 51 /* R */ -#define SENSORS_MAXI_CO_PLL_MIN 52 /* RW */ -#define SENSORS_MAXI_CO_PLL_MAX 53 /* RW */ -#define SENSORS_MAXI_CO_VID1 61 /* R */ -#define SENSORS_MAXI_CO_VID2 62 /* R */ -#define SENSORS_MAXI_CO_VID3 63 /* R */ -#define SENSORS_MAXI_CO_VID4 64 /* R */ -#define SENSORS_MAXI_CO_VID1_MIN 71 /* RW */ -#define SENSORS_MAXI_CO_VID2_MIN 72 /* RW */ -#define SENSORS_MAXI_CO_VID3_MIN 73 /* RW */ -#define SENSORS_MAXI_CO_VID4_MIN 74 /* RW */ -#define SENSORS_MAXI_CO_VID1_MAX 81 /* RW */ -#define SENSORS_MAXI_CO_VID2_MAX 82 /* RW */ -#define SENSORS_MAXI_CO_VID3_MAX 83 /* RW */ -#define SENSORS_MAXI_CO_VID4_MAX 84 /* RW */ -#define SENSORS_MAXI_CO_ALARMS 91 /* R */ - -#define SENSORS_MAXI_AS_FAN1 1 /* R */ -#define SENSORS_MAXI_AS_FAN2 2 /* R */ -#define SENSORS_MAXI_AS_FAN3 3 /* R */ -#define SENSORS_MAXI_AS_FAN1_MIN 11 /* RW */ -#define SENSORS_MAXI_AS_FAN2_MIN 12 /* RW */ -#define SENSORS_MAXI_AS_FAN3_MIN 13 /* RW */ -#define SENSORS_MAXI_AS_FAN1_DIV 14 /* R */ -#define SENSORS_MAXI_AS_FAN2_DIV 15 /* R */ -#define SENSORS_MAXI_AS_FAN3_DIV 16 /* R */ -#define SENSORS_MAXI_AS_TEMP1 21 /* R */ -#define SENSORS_MAXI_AS_TEMP2 22 /* R */ -#define SENSORS_MAXI_AS_TEMP3 23 /* R */ -#define SENSORS_MAXI_AS_TEMP4 24 /* R */ -#define SENSORS_MAXI_AS_TEMP5 25 /* R */ -#define SENSORS_MAXI_AS_TEMP1_MAX 31 /* R */ -#define SENSORS_MAXI_AS_TEMP2_MAX 32 /* R */ -#define SENSORS_MAXI_AS_TEMP3_MAX 33 /* R */ -#define SENSORS_MAXI_AS_TEMP4_MAX 34 /* R */ -#define SENSORS_MAXI_AS_TEMP5_MAX 35 /* R */ -#define SENSORS_MAXI_AS_TEMP1_HYST 41 /* R */ -#define SENSORS_MAXI_AS_TEMP2_HYST 42 /* R */ -#define SENSORS_MAXI_AS_TEMP3_HYST 43 /* R */ -#define SENSORS_MAXI_AS_TEMP4_HYST 44 /* R */ -#define SENSORS_MAXI_AS_TEMP5_HYST 45 /* R */ -#define SENSORS_MAXI_AS_PLL 51 /* R */ -#define SENSORS_MAXI_AS_PLL_MIN 52 /* RW */ -#define SENSORS_MAXI_AS_PLL_MAX 53 /* RW */ -#define SENSORS_MAXI_AS_VID1 61 /* R */ -#define SENSORS_MAXI_AS_VID2 62 /* R */ -#define SENSORS_MAXI_AS_VID3 63 /* R */ -#define SENSORS_MAXI_AS_VID4 64 /* R */ -#define SENSORS_MAXI_AS_VID1_MIN 71 /* RW */ -#define SENSORS_MAXI_AS_VID2_MIN 72 /* RW */ -#define SENSORS_MAXI_AS_VID3_MIN 73 /* RW */ -#define SENSORS_MAXI_AS_VID4_MIN 74 /* RW */ -#define SENSORS_MAXI_AS_VID1_MAX 81 /* RW */ -#define SENSORS_MAXI_AS_VID2_MAX 82 /* RW */ -#define SENSORS_MAXI_AS_VID3_MAX 83 /* RW */ -#define SENSORS_MAXI_AS_VID4_MAX 84 /* RW */ -#define SENSORS_MAXI_AS_ALARMS 91 /* R */ - -/* THMC50/ADM1022 chips */ - -#define SENSORS_THMC50_PREFIX "thmc50" -/* Cheat on LM84,GL523,THMC10 for now - no separate #defines */ -#define SENSORS_ADM1022_PREFIX "adm1022" - -#define SENSORS_THMC50_TEMP 51 /* R */ -#define SENSORS_THMC50_TEMP_HYST 52 /* RW */ -#define SENSORS_THMC50_TEMP_OVER 53 /* RW */ -#define SENSORS_THMC50_REMOTE_TEMP 54 /* R */ -#define SENSORS_THMC50_REMOTE_TEMP_HYST 55 /* RW */ -#define SENSORS_THMC50_REMOTE_TEMP_OVER 56 /* RW */ -#define SENSORS_THMC50_ANALOG_OUT 71 /* RW */ -#define SENSORS_THMC50_INTER 81 /* R */ -#define SENSORS_THMC50_INTER_MASK 82 /* RW */ -#define SENSORS_THMC50_DIE_CODE 90 /* R */ - -/* ADM1025 chip */ - -#define SENSORS_ADM1025_PREFIX "adm1025" -#define SENSORS_NE1619_PREFIX "ne1619" - -#define SENSORS_ADM1025_IN0 1 /* R */ -#define SENSORS_ADM1025_IN1 2 /* R */ -#define SENSORS_ADM1025_IN2 3 /* R */ -#define SENSORS_ADM1025_IN3 4 /* R */ -#define SENSORS_ADM1025_IN4 5 /* R */ -#define SENSORS_ADM1025_IN5 6 /* R */ -#define SENSORS_ADM1025_IN0_MIN 11 /* RW */ -#define SENSORS_ADM1025_IN1_MIN 12 /* RW */ -#define SENSORS_ADM1025_IN2_MIN 13 /* RW */ -#define SENSORS_ADM1025_IN3_MIN 14 /* RW */ -#define SENSORS_ADM1025_IN4_MIN 15 /* RW */ -#define SENSORS_ADM1025_IN5_MIN 16 /* RW */ -#define SENSORS_ADM1025_IN0_MAX 21 /* RW */ -#define SENSORS_ADM1025_IN1_MAX 22 /* RW */ -#define SENSORS_ADM1025_IN2_MAX 23 /* RW */ -#define SENSORS_ADM1025_IN3_MAX 24 /* RW */ -#define SENSORS_ADM1025_IN4_MAX 25 /* RW */ -#define SENSORS_ADM1025_IN5_MAX 26 /* RW */ -#define SENSORS_ADM1025_TEMP1 51 /* R */ -#define SENSORS_ADM1025_TEMP1_LOW 52 /* RW */ -#define SENSORS_ADM1025_TEMP1_HIGH 53 /* RW */ -#define SENSORS_ADM1025_TEMP2 54 /* R */ -#define SENSORS_ADM1025_TEMP2_LOW 55 /* RW */ -#define SENSORS_ADM1025_TEMP2_HIGH 56 /* RW */ -#define SENSORS_ADM1025_VID 61 /* R */ -#define SENSORS_ADM1025_VRM 62 /* R */ -#define SENSORS_ADM1025_ALARMS 81 /* R */ - - -#define SENSORS_ADM1026_PREFIX "adm1026" -/* NOTE: print_adm1026 (sensors) depends on the ordering - * of these entries in each group. For example - * fan#, fan#_div, fan#_min - * temp#, temp#_max, temp#_min, temp#_offset - * and the ordering of the groups - * in0, in1, ... in9, in10, in11 - */ -#define SENSORS_ADM1026_AFC_DAC 1 /* RW -- afc_analog_out */ -#define SENSORS_ADM1026_AFC_PWM 2 /* RW -- afc_pwm */ -#define SENSORS_ADM1026_ALARMS 3 /* R -- alarms */ -#define SENSORS_ADM1026_ALARM_MASK 4 /* R -- alarm_mask */ -#define SENSORS_ADM1026_DAC 5 /* RW -- analog_out */ -#define SENSORS_ADM1026_GPIO 6 /* R -- gpio */ -#define SENSORS_ADM1026_GPIO_MASK 7 /* R -- gpio_mask */ -#define SENSORS_ADM1026_PWM 8 /* RW -- pwm */ -#define SENSORS_ADM1026_VID 9 /* RW -- vid */ -#define SENSORS_ADM1026_VRM 10 /* RW -- vrm */ -#define SENSORS_ADM1026_FAN0 11 /* R -- fan0 */ -#define SENSORS_ADM1026_FAN0_DIV 12 /* RW -- fan0_div */ -#define SENSORS_ADM1026_FAN0_MIN 13 /* RW -- fan0_min */ -#define SENSORS_ADM1026_FAN1 14 /* R -- fan1 */ -#define SENSORS_ADM1026_FAN1_DIV 15 /* RW -- fan1_div */ -#define SENSORS_ADM1026_FAN1_MIN 16 /* RW -- fan1_min */ -#define SENSORS_ADM1026_FAN2 17 /* R -- fan2 */ -#define SENSORS_ADM1026_FAN2_DIV 18 /* RW -- fan2_div */ -#define SENSORS_ADM1026_FAN2_MIN 19 /* RW -- fan2_min */ -#define SENSORS_ADM1026_FAN3 20 /* R -- fan3 */ -#define SENSORS_ADM1026_FAN3_DIV 21 /* RW -- fan3_div */ -#define SENSORS_ADM1026_FAN3_MIN 22 /* RW -- fan3_min */ -#define SENSORS_ADM1026_FAN4 23 /* R -- fan4 */ -#define SENSORS_ADM1026_FAN4_DIV 24 /* RW -- fan4_div */ -#define SENSORS_ADM1026_FAN4_MIN 25 /* RW -- fan4_min */ -#define SENSORS_ADM1026_FAN5 26 /* R -- fan5 */ -#define SENSORS_ADM1026_FAN5_DIV 27 /* RW -- fan5_div */ -#define SENSORS_ADM1026_FAN5_MIN 28 /* RW -- fan5_min */ -#define SENSORS_ADM1026_FAN6 29 /* R -- fan6 */ -#define SENSORS_ADM1026_FAN6_DIV 30 /* RW -- fan6_div */ -#define SENSORS_ADM1026_FAN6_MIN 31 /* RW -- fan6_min */ -#define SENSORS_ADM1026_FAN7 32 /* R -- fan7 */ -#define SENSORS_ADM1026_FAN7_DIV 33 /* RW -- fan7_div */ -#define SENSORS_ADM1026_FAN7_MIN 34 /* RW -- fan7_min */ -#define SENSORS_ADM1026_IN0 35 /* R -- in0 */ -#define SENSORS_ADM1026_IN0_MAX 36 /* RW -- in0_max */ -#define SENSORS_ADM1026_IN0_MIN 37 /* RW -- in0_min */ -#define SENSORS_ADM1026_IN1 38 /* R -- in1 */ -#define SENSORS_ADM1026_IN1_MAX 39 /* RW -- in1_max */ -#define SENSORS_ADM1026_IN1_MIN 40 /* RW -- in1_min */ -#define SENSORS_ADM1026_IN2 41 /* R -- in2 */ -#define SENSORS_ADM1026_IN2_MAX 42 /* RW -- in2_max */ -#define SENSORS_ADM1026_IN2_MIN 43 /* RW -- in2_min */ -#define SENSORS_ADM1026_IN3 44 /* R -- in3 */ -#define SENSORS_ADM1026_IN3_MAX 45 /* RW -- in3_max */ -#define SENSORS_ADM1026_IN3_MIN 46 /* RW -- in3_min */ -#define SENSORS_ADM1026_IN4 47 /* R -- in4 */ -#define SENSORS_ADM1026_IN4_MAX 48 /* RW -- in4_max */ -#define SENSORS_ADM1026_IN4_MIN 49 /* RW -- in4_min */ -#define SENSORS_ADM1026_IN5 50 /* R -- in5 */ -#define SENSORS_ADM1026_IN5_MAX 51 /* RW -- in5_max */ -#define SENSORS_ADM1026_IN5_MIN 52 /* RW -- in5_min */ -#define SENSORS_ADM1026_IN6 53 /* R -- in6 */ -#define SENSORS_ADM1026_IN6_MAX 54 /* RW -- in6_max */ -#define SENSORS_ADM1026_IN6_MIN 55 /* RW -- in6_min */ -#define SENSORS_ADM1026_IN7 56 /* R -- in7 */ -#define SENSORS_ADM1026_IN7_MAX 57 /* RW -- in7_max */ -#define SENSORS_ADM1026_IN7_MIN 58 /* RW -- in7_min */ -#define SENSORS_ADM1026_IN8 59 /* R -- in8 */ -#define SENSORS_ADM1026_IN8_MAX 60 /* RW -- in8_max */ -#define SENSORS_ADM1026_IN8_MIN 61 /* RW -- in8_min */ -#define SENSORS_ADM1026_IN9 62 /* R -- in9 */ -#define SENSORS_ADM1026_IN9_MAX 63 /* RW -- in9_max */ -#define SENSORS_ADM1026_IN9_MIN 64 /* RW -- in9_min */ -#define SENSORS_ADM1026_IN10 65 /* R -- in10 */ -#define SENSORS_ADM1026_IN10_MAX 66 /* RW -- in10_max */ -#define SENSORS_ADM1026_IN10_MIN 67 /* RW -- in10_min */ -#define SENSORS_ADM1026_IN11 68 /* R -- in11 */ -#define SENSORS_ADM1026_IN11_MAX 69 /* RW -- in11_max */ -#define SENSORS_ADM1026_IN11_MIN 70 /* RW -- in11_min */ -#define SENSORS_ADM1026_IN12 71 /* R -- in12 */ -#define SENSORS_ADM1026_IN12_MAX 72 /* RW -- in12_max */ -#define SENSORS_ADM1026_IN12_MIN 73 /* RW -- in12_min */ -#define SENSORS_ADM1026_IN13 74 /* R -- in13 */ -#define SENSORS_ADM1026_IN13_MAX 75 /* RW -- in13_max */ -#define SENSORS_ADM1026_IN13_MIN 76 /* RW -- in13_min */ -#define SENSORS_ADM1026_IN14 77 /* R -- in14 */ -#define SENSORS_ADM1026_IN14_MAX 78 /* RW -- in14_max */ -#define SENSORS_ADM1026_IN14_MIN 79 /* RW -- in14_min */ -#define SENSORS_ADM1026_IN15 80 /* R -- in15 */ -#define SENSORS_ADM1026_IN15_MAX 81 /* RW -- in15_max */ -#define SENSORS_ADM1026_IN15_MIN 82 /* RW -- in15_min */ -#define SENSORS_ADM1026_IN16 83 /* R -- in16 */ -#define SENSORS_ADM1026_IN16_MAX 84 /* RW -- in16_max */ -#define SENSORS_ADM1026_IN16_MIN 85 /* RW -- in16_min */ -#define SENSORS_ADM1026_TEMP1 86 /* R -- temp1 */ -#define SENSORS_ADM1026_TEMP1_MAX 87 /* RW -- temp1_max */ -#define SENSORS_ADM1026_TEMP1_MIN 88 /* RW -- temp1_min */ -#define SENSORS_ADM1026_TEMP1_OFFSET 89 /* RW -- temp1_offset */ -#define SENSORS_ADM1026_TEMP1_THERM 90 /* RW -- temp1_therm */ -#define SENSORS_ADM1026_TEMP1_TMIN 91 /* RW -- temp1_tmin */ -#define SENSORS_ADM1026_TEMP2 92 /* R -- temp2 */ -#define SENSORS_ADM1026_TEMP2_MAX 93 /* RW -- temp2_max */ -#define SENSORS_ADM1026_TEMP2_MIN 94 /* RW -- temp2_min */ -#define SENSORS_ADM1026_TEMP2_OFFSET 95 /* RW -- temp2_offset */ -#define SENSORS_ADM1026_TEMP2_THERM 96 /* RW -- temp2_therm */ -#define SENSORS_ADM1026_TEMP2_TMIN 97 /* RW -- temp2_tmin */ -#define SENSORS_ADM1026_TEMP3 98 /* R -- temp3 */ -#define SENSORS_ADM1026_TEMP3_MAX 99 /* RW -- temp3_max */ -#define SENSORS_ADM1026_TEMP3_MIN 100 /* RW -- temp3_min */ -#define SENSORS_ADM1026_TEMP3_OFFSET 101 /* RW -- temp3_offset */ -#define SENSORS_ADM1026_TEMP3_THERM 102 /* RW -- temp3_therm */ -#define SENSORS_ADM1026_TEMP3_TMIN 103 /* RW -- temp3_tmin */ - - -#define SENSORS_VIA686A_PREFIX "via686a" - -#define SENSORS_VIA686A_IN0 1 /* R */ -#define SENSORS_VIA686A_IN1 2 /* R */ -#define SENSORS_VIA686A_IN2 3 /* R */ -#define SENSORS_VIA686A_IN3 4 /* R */ -#define SENSORS_VIA686A_IN4 5 /* R */ -#define SENSORS_VIA686A_IN0_MIN 11 /* RW */ -#define SENSORS_VIA686A_IN1_MIN 12 /* RW */ -#define SENSORS_VIA686A_IN2_MIN 13 /* RW */ -#define SENSORS_VIA686A_IN3_MIN 14 /* RW */ -#define SENSORS_VIA686A_IN4_MIN 15 /* RW */ -#define SENSORS_VIA686A_IN0_MAX 21 /* RW */ -#define SENSORS_VIA686A_IN1_MAX 22 /* RW */ -#define SENSORS_VIA686A_IN2_MAX 23 /* RW */ -#define SENSORS_VIA686A_IN3_MAX 24 /* RW */ -#define SENSORS_VIA686A_IN4_MAX 25 /* RW */ -#define SENSORS_VIA686A_FAN1 31 /* R */ -#define SENSORS_VIA686A_FAN2 32 /* R */ -#define SENSORS_VIA686A_FAN1_MIN 41 /* RW */ -#define SENSORS_VIA686A_FAN2_MIN 42 /* RW */ -#define SENSORS_VIA686A_TEMP 51 /* R */ -#define SENSORS_VIA686A_TEMP_HYST 52 /* RW */ -#define SENSORS_VIA686A_TEMP_OVER 53 /* RW */ -#define SENSORS_VIA686A_TEMP2 54 /* R */ -#define SENSORS_VIA686A_TEMP2_HYST 55 /* RW */ -#define SENSORS_VIA686A_TEMP2_OVER 56 /* RW */ -#define SENSORS_VIA686A_TEMP3 57 /* R */ -#define SENSORS_VIA686A_TEMP3_HYST 58 /* RW */ -#define SENSORS_VIA686A_TEMP3_OVER 59 /* RW */ -#define SENSORS_VIA686A_FAN1_DIV 71 /* RW */ -#define SENSORS_VIA686A_FAN2_DIV 72 /* RW */ -#define SENSORS_VIA686A_ALARMS 81 /* R */ - - -/* Analog Devices LM87 chips */ - -#define SENSORS_LM87_PREFIX "lm87" - -#define SENSORS_LM87_IN0 1 /* R */ -#define SENSORS_LM87_IN1 2 /* R */ -#define SENSORS_LM87_IN2 3 /* R */ -#define SENSORS_LM87_IN3 4 /* R */ -#define SENSORS_LM87_IN4 5 /* R */ -#define SENSORS_LM87_IN5 6 /* R */ -#define SENSORS_LM87_AIN1 7 /* R */ -#define SENSORS_LM87_AIN2 8 /* R */ -#define SENSORS_LM87_IN0_MIN 11 /* RW */ -#define SENSORS_LM87_IN1_MIN 12 /* RW */ -#define SENSORS_LM87_IN2_MIN 13 /* RW */ -#define SENSORS_LM87_IN3_MIN 14 /* RW */ -#define SENSORS_LM87_IN4_MIN 15 /* RW */ -#define SENSORS_LM87_IN5_MIN 16 /* RW */ -#define SENSORS_LM87_AIN1_MIN 17 /* RW */ -#define SENSORS_LM87_AIN2_MIN 18 /* RW */ -#define SENSORS_LM87_IN0_MAX 21 /* RW */ -#define SENSORS_LM87_IN1_MAX 22 /* RW */ -#define SENSORS_LM87_IN2_MAX 23 /* RW */ -#define SENSORS_LM87_IN3_MAX 24 /* RW */ -#define SENSORS_LM87_IN4_MAX 25 /* RW */ -#define SENSORS_LM87_IN5_MAX 26 /* RW */ -#define SENSORS_LM87_AIN1_MAX 27 /* RW */ -#define SENSORS_LM87_AIN2_MAX 28 /* RW */ -#define SENSORS_LM87_FAN1 31 /* R */ -#define SENSORS_LM87_FAN2 32 /* R */ -#define SENSORS_LM87_FAN1_MIN 41 /* RW */ -#define SENSORS_LM87_FAN2_MIN 42 /* RW */ -#define SENSORS_LM87_TEMP1 51 /* R */ -#define SENSORS_LM87_TEMP2 52 /* R */ -#define SENSORS_LM87_TEMP3 53 /* R */ -#define SENSORS_LM87_TEMP1_HYST 54 /* RW */ -#define SENSORS_LM87_TEMP1_OVER 55 /* RW */ -#define SENSORS_LM87_TEMP2_HYST 56 /* RW */ -#define SENSORS_LM87_TEMP2_OVER 57 /* RW */ -#define SENSORS_LM87_TEMP3_HYST 58 /* RW */ -#define SENSORS_LM87_TEMP3_OVER 59 /* RW */ -#define SENSORS_LM87_VID 61 /* R */ -#define SENSORS_LM87_VRM 62 /* RW */ -#define SENSORS_LM87_FAN1_DIV 71 /* RW */ -#define SENSORS_LM87_FAN2_DIV 72 /* RW */ -#define SENSORS_LM87_ALARMS 81 /* R */ -#define SENSORS_LM87_ANALOG_OUT 82 /* RW */ - -/* Myson MTP008 chips */ - -#define SENSORS_MTP008_PREFIX "mtp008" - -#define SENSORS_MTP008_IN0 1 /* R */ -#define SENSORS_MTP008_IN1 2 /* R */ -#define SENSORS_MTP008_IN2 3 /* R */ -#define SENSORS_MTP008_IN3 4 /* R */ -#define SENSORS_MTP008_IN4 5 /* R */ -#define SENSORS_MTP008_IN5 6 /* R */ -#define SENSORS_MTP008_IN6 7 /* R */ -#define SENSORS_MTP008_IN0_MIN 11 /* RW */ -#define SENSORS_MTP008_IN1_MIN 12 /* RW */ -#define SENSORS_MTP008_IN2_MIN 13 /* RW */ -#define SENSORS_MTP008_IN3_MIN 14 /* RW */ -#define SENSORS_MTP008_IN4_MIN 15 /* RW */ -#define SENSORS_MTP008_IN5_MIN 16 /* RW */ -#define SENSORS_MTP008_IN6_MIN 17 /* RW */ -#define SENSORS_MTP008_IN0_MAX 21 /* RW */ -#define SENSORS_MTP008_IN1_MAX 22 /* RW */ -#define SENSORS_MTP008_IN2_MAX 23 /* RW */ -#define SENSORS_MTP008_IN3_MAX 24 /* RW */ -#define SENSORS_MTP008_IN4_MAX 25 /* RW */ -#define SENSORS_MTP008_IN5_MAX 26 /* RW */ -#define SENSORS_MTP008_IN6_MAX 27 /* RW */ -#define SENSORS_MTP008_FAN1 31 /* R */ -#define SENSORS_MTP008_FAN2 32 /* R */ -#define SENSORS_MTP008_FAN3 33 /* R */ -#define SENSORS_MTP008_FAN1_MIN 41 /* RW */ -#define SENSORS_MTP008_FAN2_MIN 42 /* RW */ -#define SENSORS_MTP008_FAN3_MIN 43 /* RW */ -#define SENSORS_MTP008_TEMP1 51 /* R */ -#define SENSORS_MTP008_TEMP2 52 /* R */ -#define SENSORS_MTP008_TEMP3 53 /* R */ -#define SENSORS_MTP008_TEMP1_OVER 54 /* RW */ -#define SENSORS_MTP008_TEMP1_HYST 55 /* RW */ -#define SENSORS_MTP008_TEMP2_OVER 56 /* RW */ -#define SENSORS_MTP008_TEMP2_HYST 57 /* RW */ -#define SENSORS_MTP008_TEMP3_OVER 58 /* RW */ -#define SENSORS_MTP008_TEMP3_HYST 59 /* RW */ -#define SENSORS_MTP008_VID 61 /* R */ -#define SENSORS_MTP008_FAN1_DIV 71 /* RW */ -#define SENSORS_MTP008_FAN2_DIV 72 /* RW */ -#define SENSORS_MTP008_FAN3_DIV 73 /* RW */ -#define SENSORS_MTP008_ALARMS 81 /* R */ -#define SENSORS_MTP008_BEEP 82 /* RW */ - -/* DS1621 chips. */ - -#define SENSORS_DS1621_PREFIX "ds1621" - -#define SENSORS_DS1621_TEMP 51 /* R */ -#define SENSORS_DS1621_TEMP_HYST 52 /* RW */ -#define SENSORS_DS1621_TEMP_OVER 53 /* RW */ -#define SENSORS_DS1621_ALARMS 81 /* R */ -#define SENSORS_DS1621_ENABLE 82 /* RW */ -#define SENSORS_DS1621_CONTINUOUS 83 /* RW */ -#define SENSORS_DS1621_POLARITY 84 /* RW */ - -/* ADM1024 chip */ - -#define SENSORS_ADM1024_PREFIX "adm1024" - -#define SENSORS_ADM1024_IN0 1 /* R */ -#define SENSORS_ADM1024_IN1 2 /* R */ -#define SENSORS_ADM1024_IN2 3 /* R */ -#define SENSORS_ADM1024_IN3 4 /* R */ -#define SENSORS_ADM1024_IN4 5 /* R */ -#define SENSORS_ADM1024_IN5 6 /* R */ -#define SENSORS_ADM1024_IN0_MIN 11 /* RW */ -#define SENSORS_ADM1024_IN1_MIN 12 /* RW */ -#define SENSORS_ADM1024_IN2_MIN 13 /* RW */ -#define SENSORS_ADM1024_IN3_MIN 14 /* RW */ -#define SENSORS_ADM1024_IN4_MIN 15 /* RW */ -#define SENSORS_ADM1024_IN5_MIN 16 /* RW */ -#define SENSORS_ADM1024_IN0_MAX 21 /* RW */ -#define SENSORS_ADM1024_IN1_MAX 22 /* RW */ -#define SENSORS_ADM1024_IN2_MAX 23 /* RW */ -#define SENSORS_ADM1024_IN3_MAX 24 /* RW */ -#define SENSORS_ADM1024_IN4_MAX 25 /* RW */ -#define SENSORS_ADM1024_IN5_MAX 26 /* RW */ -#define SENSORS_ADM1024_FAN1 31 /* R */ -#define SENSORS_ADM1024_FAN2 32 /* R */ -#define SENSORS_ADM1024_FAN1_MIN 41 /* RW */ -#define SENSORS_ADM1024_FAN2_MIN 42 /* RW */ -#define SENSORS_ADM1024_TEMP 51 /* R */ -#define SENSORS_ADM1024_TEMP1 52 /* R */ -#define SENSORS_ADM1024_TEMP2 53 /* R */ -#define SENSORS_ADM1024_TEMP_HYST 61 /* RW */ -#define SENSORS_ADM1024_TEMP_OVER 62 /* RW */ -#define SENSORS_ADM1024_TEMP1_HYST 63 /* RW */ -#define SENSORS_ADM1024_TEMP1_OVER 64 /* RW */ -#define SENSORS_ADM1024_TEMP2_HYST 65 /* RW */ -#define SENSORS_ADM1024_TEMP2_OVER 66 /* RW */ -#define SENSORS_ADM1024_VID 71 /* R */ -#define SENSORS_ADM1024_FAN1_DIV 81 /* RW */ -#define SENSORS_ADM1024_FAN2_DIV 82 /* RW */ -#define SENSORS_ADM1024_ALARMS 91 /* R */ -#define SENSORS_ADM1024_ANALOG_OUT 92 /* RW */ - -/* IT87xx chips */ - -#define SENSORS_IT87_PREFIX "it87" -#define SENSORS_IT8712_PREFIX "it8712" -#define SENSORS_IT8716_PREFIX "it8716" -#define SENSORS_IT8718_PREFIX "it8718" - -#define SENSORS_IT87_IN0 1 /* R */ -#define SENSORS_IT87_IN1 2 /* R */ -#define SENSORS_IT87_IN2 3 /* R */ -#define SENSORS_IT87_IN3 4 /* R */ -#define SENSORS_IT87_IN4 5 /* R */ -#define SENSORS_IT87_IN5 6 /* R */ -#define SENSORS_IT87_IN6 7 /* R */ -#define SENSORS_IT87_IN7 8 /* R */ -#define SENSORS_IT87_IN8 9 /* R */ -#define SENSORS_IT87_IN0_MIN 11 /* RW */ -#define SENSORS_IT87_IN1_MIN 12 /* RW */ -#define SENSORS_IT87_IN2_MIN 13 /* RW */ -#define SENSORS_IT87_IN3_MIN 14 /* RW */ -#define SENSORS_IT87_IN4_MIN 15 /* RW */ -#define SENSORS_IT87_IN5_MIN 16 /* RW */ -#define SENSORS_IT87_IN6_MIN 17 /* RW */ -#define SENSORS_IT87_IN7_MIN 18 /* RW */ -#define SENSORS_IT87_IN0_MAX 21 /* RW */ -#define SENSORS_IT87_IN1_MAX 22 /* RW */ -#define SENSORS_IT87_IN2_MAX 23 /* RW */ -#define SENSORS_IT87_IN3_MAX 24 /* RW */ -#define SENSORS_IT87_IN4_MAX 25 /* RW */ -#define SENSORS_IT87_IN5_MAX 26 /* RW */ -#define SENSORS_IT87_IN6_MAX 27 /* RW */ -#define SENSORS_IT87_IN7_MAX 28 /* RW */ -#define SENSORS_IT87_FAN1 31 /* R */ -#define SENSORS_IT87_FAN2 32 /* R */ -#define SENSORS_IT87_FAN3 33 /* R */ -#define SENSORS_IT87_FAN1_MIN 41 /* RW */ -#define SENSORS_IT87_FAN2_MIN 42 /* RW */ -#define SENSORS_IT87_FAN3_MIN 43 /* RW */ -#define SENSORS_IT87_TEMP1 51 /* R */ -#define SENSORS_IT87_TEMP2 52 /* R */ -#define SENSORS_IT87_TEMP3 53 /* R */ -#define SENSORS_IT87_TEMP1_LOW 54 /* RW */ -#define SENSORS_IT87_TEMP2_LOW 55 /* RW */ -#define SENSORS_IT87_TEMP3_LOW 56 /* RW */ -#define SENSORS_IT87_TEMP1_HIGH 57 /* RW */ -#define SENSORS_IT87_TEMP2_HIGH 58 /* RW */ -#define SENSORS_IT87_TEMP3_HIGH 59 /* RW */ -#define SENSORS_IT87_VID 61 /* R */ -#define SENSORS_IT87_FAN1_DIV 71 /* RW */ -#define SENSORS_IT87_FAN2_DIV 72 /* RW */ -#define SENSORS_IT87_FAN3_DIV 73 /* R (fan3 different) */ -#define SENSORS_IT87_ALARMS_FAN 81 /* R */ -#define SENSORS_IT87_ALARMS_VIN 82 /* R */ -#define SENSORS_IT87_ALARMS_TEMP 83 /* R */ -#define SENSORS_IT87_ALARMS 84 /* R */ -#define SENSORS_IT87_SENS1 91 /* RW */ -#define SENSORS_IT87_SENS2 92 /* RW */ -#define SENSORS_IT87_SENS3 93 /* RW */ - - -/* fsc poseidon chip */ - -#define SENSORS_FSCPOS_PREFIX "fscpos" - -#define SENSORS_FSCPOS_REV 1 /* R */ -#define SENSORS_FSCPOS_EVENT 2 /* R */ -#define SENSORS_FSCPOS_CONTROL 3 /* RW */ -#define SENSORS_FSCPOS_FAN1 4 /* R */ -#define SENSORS_FSCPOS_FAN2 5 /* R */ -#define SENSORS_FSCPOS_FAN3 6 /* R */ -#define SENSORS_FSCPOS_FAN1_MIN 7 /* RW */ -#define SENSORS_FSCPOS_FAN2_MIN 8 /* RW */ -#define SENSORS_FSCPOS_FAN3_MIN 9 /* RW */ -#define SENSORS_FSCPOS_FAN1_STATE 10 /* RW */ -#define SENSORS_FSCPOS_FAN2_STATE 11 /* RW */ -#define SENSORS_FSCPOS_FAN3_STATE 12 /* RW */ -#define SENSORS_FSCPOS_FAN1_RIPPLE 13 /* RW */ -#define SENSORS_FSCPOS_FAN2_RIPPLE 14 /* RW */ -#define SENSORS_FSCPOS_FAN3_RIPPLE 15 /* RW */ -#define SENSORS_FSCPOS_TEMP1 16 /* R */ -#define SENSORS_FSCPOS_TEMP2 17 /* R */ -#define SENSORS_FSCPOS_TEMP3 18 /* R */ -#define SENSORS_FSCPOS_TEMP1_STATE 19 /* RW */ -#define SENSORS_FSCPOS_TEMP2_STATE 20 /* RW */ -#define SENSORS_FSCPOS_TEMP3_STATE 21 /* RW */ -#define SENSORS_FSCPOS_VOLTAGE1 22 /* R */ -#define SENSORS_FSCPOS_VOLTAGE2 23 /* R */ -#define SENSORS_FSCPOS_VOLTAGE3 24 /* R */ -#define SENSORS_FSCPOS_WDOG_PRESET 25/* RW */ -#define SENSORS_FSCPOS_WDOG_STATE 26/* RW */ -#define SENSORS_FSCPOS_WDOG_CONTROL 27/* RW */ - -/* fsc scylla chip */ - -#define SENSORS_FSCSCY_PREFIX "fscscy" - -#define SENSORS_FSCSCY_REV 1 /* R */ -#define SENSORS_FSCSCY_EVENT 2 /* R */ -#define SENSORS_FSCSCY_CONTROL 3 /* RW */ -#define SENSORS_FSCSCY_FAN1 4 /* R */ -#define SENSORS_FSCSCY_FAN2 5 /* R */ -#define SENSORS_FSCSCY_FAN3 6 /* R */ -#define SENSORS_FSCSCY_FAN4 7 /* R */ -#define SENSORS_FSCSCY_FAN5 8 /* R */ -#define SENSORS_FSCSCY_FAN6 9 /* R */ -#define SENSORS_FSCSCY_FAN1_MIN 10 /* RW */ -#define SENSORS_FSCSCY_FAN2_MIN 11 /* RW */ -#define SENSORS_FSCSCY_FAN3_MIN 12 /* RW */ -#define SENSORS_FSCSCY_FAN4_MIN 13 /* RW */ -#define SENSORS_FSCSCY_FAN5_MIN 14 /* RW */ -#define SENSORS_FSCSCY_FAN6_MIN 15 /* RW */ -#define SENSORS_FSCSCY_FAN1_STATE 16 /* RW */ -#define SENSORS_FSCSCY_FAN2_STATE 17 /* RW */ -#define SENSORS_FSCSCY_FAN3_STATE 18 /* RW */ -#define SENSORS_FSCSCY_FAN4_STATE 19 /* RW */ -#define SENSORS_FSCSCY_FAN5_STATE 20 /* RW */ -#define SENSORS_FSCSCY_FAN6_STATE 21 /* RW */ -#define SENSORS_FSCSCY_FAN1_RIPPLE 22 /* RW */ -#define SENSORS_FSCSCY_FAN2_RIPPLE 23 /* RW */ -#define SENSORS_FSCSCY_FAN3_RIPPLE 24 /* RW */ -#define SENSORS_FSCSCY_FAN4_RIPPLE 25 /* RW */ -#define SENSORS_FSCSCY_FAN5_RIPPLE 26 /* RW */ -#define SENSORS_FSCSCY_FAN6_RIPPLE 27 /* RW */ -#define SENSORS_FSCSCY_TEMP1 28 /* R */ -#define SENSORS_FSCSCY_TEMP2 29 /* R */ -#define SENSORS_FSCSCY_TEMP3 30 /* R */ -#define SENSORS_FSCSCY_TEMP4 31 /* R */ -#define SENSORS_FSCSCY_TEMP1_STATE 32 /* RW */ -#define SENSORS_FSCSCY_TEMP2_STATE 33 /* RW */ -#define SENSORS_FSCSCY_TEMP3_STATE 34 /* RW */ -#define SENSORS_FSCSCY_TEMP4_STATE 35 /* RW */ -#define SENSORS_FSCSCY_TEMP1_LIM 36 /* R */ -#define SENSORS_FSCSCY_TEMP2_LIM 37 /* R */ -#define SENSORS_FSCSCY_TEMP3_LIM 38 /* R */ -#define SENSORS_FSCSCY_TEMP4_LIM 39 /* R */ -#define SENSORS_FSCSCY_TEMP1_MIN 40 /* R */ -#define SENSORS_FSCSCY_TEMP2_MIN 41 /* R */ -#define SENSORS_FSCSCY_TEMP3_MIN 42 /* R */ -#define SENSORS_FSCSCY_TEMP4_MIN 43 /* R */ -#define SENSORS_FSCSCY_TEMP1_MAX 44 /* R */ -#define SENSORS_FSCSCY_TEMP2_MAX 45 /* R */ -#define SENSORS_FSCSCY_TEMP3_MAX 46 /* R */ -#define SENSORS_FSCSCY_TEMP4_MAX 47 /* R */ -#define SENSORS_FSCSCY_VOLTAGE1 48/* R */ -#define SENSORS_FSCSCY_VOLTAGE2 49/* R */ -#define SENSORS_FSCSCY_VOLTAGE3 50/* R */ -#define SENSORS_FSCSCY_WDOG_PRESET 51 /* RW */ -#define SENSORS_FSCSCY_WDOG_STATE 52 /* RW */ -#define SENSORS_FSCSCY_WDOG_CONTROL 52 /* RW */ - -/* fsc hermes chip */ - -#define SENSORS_FSCHER_PREFIX "fscher" - -#define SENSORS_FSCHER_REV 1 /* R */ -#define SENSORS_FSCHER_EVENT 2 /* R */ -#define SENSORS_FSCHER_CONTROL 3 /* RW */ -#define SENSORS_FSCHER_FAN1 4 /* R */ -#define SENSORS_FSCHER_FAN2 5 /* R */ -#define SENSORS_FSCHER_FAN3 6 /* R */ -#define SENSORS_FSCHER_PWM1 7 /* RW */ -#define SENSORS_FSCHER_PWM2 8 /* RW */ -#define SENSORS_FSCHER_PWM3 9 /* RW */ -#define SENSORS_FSCHER_FAN1_STATE 10 /* RW */ -#define SENSORS_FSCHER_FAN2_STATE 11 /* RW */ -#define SENSORS_FSCHER_FAN3_STATE 12 /* RW */ -#define SENSORS_FSCHER_FAN1_RIPPLE 13 /* RW */ -#define SENSORS_FSCHER_FAN2_RIPPLE 14 /* RW */ -#define SENSORS_FSCHER_FAN3_RIPPLE 15 /* RW */ -#define SENSORS_FSCHER_TEMP1 16 /* R */ -#define SENSORS_FSCHER_TEMP2 17 /* R */ -#define SENSORS_FSCHER_TEMP3 18 /* R */ -#define SENSORS_FSCHER_TEMP1_STATE 19 /* RW */ -#define SENSORS_FSCHER_TEMP2_STATE 20 /* RW */ -#define SENSORS_FSCHER_TEMP3_STATE 21 /* RW */ -#define SENSORS_FSCHER_VOLTAGE1 22 /* R */ -#define SENSORS_FSCHER_VOLTAGE2 23 /* R */ -#define SENSORS_FSCHER_VOLTAGE3 24 /* R */ -#define SENSORS_FSCHER_WDOG_PRESET 25/* RW */ -#define SENSORS_FSCHER_WDOG_STATE 26/* RW */ -#define SENSORS_FSCHER_WDOG_CONTROL 27/* RW */ - -/* PCF8591 chip. */ - -#define SENSORS_PCF8591_PREFIX "pcf8591" - -#define SENSORS_PCF8591_AIN_CONF 1 /* RW */ -#define SENSORS_PCF8591_CH0 2 /* R */ -#define SENSORS_PCF8591_CH1 3 /* R */ -#define SENSORS_PCF8591_CH2 4 /* R */ -#define SENSORS_PCF8591_CH3 5 /* R */ -#define SENSORS_PCF8591_AOUT_ENABLE 6 /* RW */ -#define SENSORS_PCF8591_AOUT 7 /* RW */ - - -#define SENSORS_VT1211_PREFIX "vt1211" - -#define SENSORS_VT1211_IN0 1 /* R */ -#define SENSORS_VT1211_IN1 2 /* R */ -#define SENSORS_VT1211_IN2 3 /* R */ -#define SENSORS_VT1211_IN3 4 /* R */ -#define SENSORS_VT1211_IN4 5 /* R */ -#define SENSORS_VT1211_IN5 6 /* R */ -#define SENSORS_VT1211_IN0_MIN 11 /* RW */ -#define SENSORS_VT1211_IN1_MIN 12 /* RW */ -#define SENSORS_VT1211_IN2_MIN 13 /* RW */ -#define SENSORS_VT1211_IN3_MIN 14 /* RW */ -#define SENSORS_VT1211_IN4_MIN 15 /* RW */ -#define SENSORS_VT1211_IN5_MIN 16 /* RW */ -#define SENSORS_VT1211_IN0_MAX 21 /* RW */ -#define SENSORS_VT1211_IN1_MAX 22 /* RW */ -#define SENSORS_VT1211_IN2_MAX 23 /* RW */ -#define SENSORS_VT1211_IN3_MAX 24 /* RW */ -#define SENSORS_VT1211_IN4_MAX 25 /* RW */ -#define SENSORS_VT1211_IN5_MAX 26 /* RW */ -#define SENSORS_VT1211_FAN1 31 /* R */ -#define SENSORS_VT1211_FAN2 32 /* R */ -#define SENSORS_VT1211_FAN1_MIN 41 /* RW */ -#define SENSORS_VT1211_FAN2_MIN 42 /* RW */ -#define SENSORS_VT1211_TEMP1 51 /* R */ -#define SENSORS_VT1211_TEMP1_HYST 52 /* RW */ -#define SENSORS_VT1211_TEMP1_OVER 53 /* RW */ -#define SENSORS_VT1211_TEMP2 54 /* R */ -#define SENSORS_VT1211_TEMP2_HYST 55 /* RW */ -#define SENSORS_VT1211_TEMP2_OVER 56 /* RW */ -#define SENSORS_VT1211_TEMP3 57 /* R */ -#define SENSORS_VT1211_TEMP3_HYST 58 /* RW */ -#define SENSORS_VT1211_TEMP3_OVER 59 /* RW */ -#define SENSORS_VT1211_TEMP4 60 /* R */ -#define SENSORS_VT1211_TEMP4_HYST 61 /* RW */ -#define SENSORS_VT1211_TEMP4_OVER 62 /* RW */ -#define SENSORS_VT1211_TEMP5 63 /* R */ -#define SENSORS_VT1211_TEMP5_HYST 64 /* RW */ -#define SENSORS_VT1211_TEMP5_OVER 65 /* RW */ -#define SENSORS_VT1211_TEMP6 66 /* R */ -#define SENSORS_VT1211_TEMP6_HYST 67 /* RW */ -#define SENSORS_VT1211_TEMP6_OVER 68 /* RW */ -#define SENSORS_VT1211_TEMP7 69 /* R */ -#define SENSORS_VT1211_TEMP7_HYST 70 /* RW */ -#define SENSORS_VT1211_TEMP7_OVER 71 /* RW */ -#define SENSORS_VT1211_FAN1_DIV 75 /* RW */ -#define SENSORS_VT1211_FAN2_DIV 76 /* RW */ -#define SENSORS_VT1211_ALARMS 81 /* R */ -#define SENSORS_VT1211_VID 82 /* R */ -#define SENSORS_VT1211_VRM 83 /* RW */ -#define SENSORS_VT1211_UCH 84 /* RW */ - -#define SENSORS_SMSC47M1_PREFIX "smsc47m1" -#define SENSORS_SMSC47M2_PREFIX "smsc47m2" - -#define SENSORS_SMSC47M1_FAN1 31 /* R */ -#define SENSORS_SMSC47M1_FAN2 32 /* R */ -#define SENSORS_SMSC47M1_FAN3 33 /* R */ -#define SENSORS_SMSC47M1_FAN1_MIN 41 /* RW */ -#define SENSORS_SMSC47M1_FAN2_MIN 42 /* RW */ -#define SENSORS_SMSC47M1_FAN3_MIN 43 /* RW */ -#define SENSORS_SMSC47M1_FAN1_DIV 75 /* RW */ -#define SENSORS_SMSC47M1_FAN2_DIV 76 /* RW */ -#define SENSORS_SMSC47M1_FAN3_DIV 77 /* RW */ -#define SENSORS_SMSC47M1_ALARMS 81 /* R */ - -#define SENSORS_SMSC47M192_PREFIX "smsc47m192" - -#define SENSORS_SMSC47M192_IN(n) (1 + (n)) /* R */ -#define SENSORS_SMSC47M192_IN_MIN(n) (21 + (n)) /* RW */ -#define SENSORS_SMSC47M192_IN_MAX(n) (41 + (n)) /* RW */ -#define SENSORS_SMSC47M192_IN_ALARM(n) (61 + (n)) /* R */ -#define SENSORS_SMSC47M192_TEMP(n) (100 + (n)) /* R */ -#define SENSORS_SMSC47M192_TEMP_MAX(n) (120 + (n)) /* RW */ -#define SENSORS_SMSC47M192_TEMP_MIN(n) (140 + (n)) /* RW */ -#define SENSORS_SMSC47M192_TEMP_OFFSET(n) (160 + (n)) /* RW */ -#define SENSORS_SMSC47M192_TEMP_ALARM(n) (180 + (n)) /* R */ -#define SENSORS_SMSC47M192_TEMP_FAULT(n) (200 + (n)) /* R */ -#define SENSORS_SMSC47M192_VID 301 /* R */ -#define SENSORS_SMSC47M192_VRM 302 /* RW */ - -#define SENSORS_PC87360_PREFIX "pc87360" -#define SENSORS_PC87363_PREFIX "pc87363" -#define SENSORS_PC87364_PREFIX "pc87364" -#define SENSORS_PC87365_PREFIX "pc87365" -#define SENSORS_PC87366_PREFIX "pc87366" - -#define SENSORS_PC87360_ALARMS_IN 10 /* R */ -#define SENSORS_PC87360_ALARMS_TEMP 11 /* R */ - -#define SENSORS_PC87360_FAN1 31 /* R */ -#define SENSORS_PC87360_FAN2 32 /* R */ -#define SENSORS_PC87360_FAN3 33 /* R */ -#define SENSORS_PC87360_FAN1_MIN 41 /* RW */ -#define SENSORS_PC87360_FAN2_MIN 42 /* RW */ -#define SENSORS_PC87360_FAN3_MIN 43 /* RW */ -#define SENSORS_PC87360_FAN1_DIV 71 /* R */ -#define SENSORS_PC87360_FAN2_DIV 72 /* R */ -#define SENSORS_PC87360_FAN3_DIV 73 /* R */ -#define SENSORS_PC87360_FAN1_STATUS 81 /* R */ -#define SENSORS_PC87360_FAN2_STATUS 82 /* R */ -#define SENSORS_PC87360_FAN3_STATUS 83 /* R */ - -#define SENSORS_PC87360_IN0 90 /* R */ -#define SENSORS_PC87360_IN1 91 /* R */ -#define SENSORS_PC87360_IN2 92 /* R */ -#define SENSORS_PC87360_IN3 93 /* R */ -#define SENSORS_PC87360_IN4 94 /* R */ -#define SENSORS_PC87360_IN5 95 /* R */ -#define SENSORS_PC87360_IN6 96 /* R */ -#define SENSORS_PC87360_IN7 97 /* R */ -#define SENSORS_PC87360_IN8 98 /* R */ -#define SENSORS_PC87360_IN9 99 /* R */ -#define SENSORS_PC87360_IN10 100 /* R */ -#define SENSORS_PC87360_IN0_MIN 110 /* RW */ -#define SENSORS_PC87360_IN1_MIN 111 /* RW */ -#define SENSORS_PC87360_IN2_MIN 112 /* RW */ -#define SENSORS_PC87360_IN3_MIN 113 /* RW */ -#define SENSORS_PC87360_IN4_MIN 114 /* RW */ -#define SENSORS_PC87360_IN5_MIN 115 /* RW */ -#define SENSORS_PC87360_IN6_MIN 116 /* RW */ -#define SENSORS_PC87360_IN7_MIN 117 /* RW */ -#define SENSORS_PC87360_IN8_MIN 118 /* RW */ -#define SENSORS_PC87360_IN9_MIN 119 /* RW */ -#define SENSORS_PC87360_IN10_MIN 120 /* RW */ -#define SENSORS_PC87360_IN0_MAX 130 /* RW */ -#define SENSORS_PC87360_IN1_MAX 131 /* RW */ -#define SENSORS_PC87360_IN2_MAX 132 /* RW */ -#define SENSORS_PC87360_IN3_MAX 133 /* RW */ -#define SENSORS_PC87360_IN4_MAX 134 /* RW */ -#define SENSORS_PC87360_IN5_MAX 135 /* RW */ -#define SENSORS_PC87360_IN6_MAX 136 /* RW */ -#define SENSORS_PC87360_IN7_MAX 137 /* RW */ -#define SENSORS_PC87360_IN8_MAX 138 /* RW */ -#define SENSORS_PC87360_IN9_MAX 139 /* RW */ -#define SENSORS_PC87360_IN10_MAX 140 /* RW */ -#define SENSORS_PC87360_IN0_STATUS 150 /* R */ -#define SENSORS_PC87360_IN1_STATUS 151 /* R */ -#define SENSORS_PC87360_IN2_STATUS 152 /* R */ -#define SENSORS_PC87360_IN3_STATUS 153 /* R */ -#define SENSORS_PC87360_IN4_STATUS 154 /* R */ -#define SENSORS_PC87360_IN5_STATUS 155 /* R */ -#define SENSORS_PC87360_IN6_STATUS 156 /* R */ -#define SENSORS_PC87360_IN7_STATUS 157 /* R */ -#define SENSORS_PC87360_IN8_STATUS 158 /* R */ -#define SENSORS_PC87360_IN9_STATUS 159 /* R */ -#define SENSORS_PC87360_IN10_STATUS 160 /* R */ - -#define SENSORS_PC87360_TEMP1 171 /* R */ -#define SENSORS_PC87360_TEMP2 172 /* R */ -#define SENSORS_PC87360_TEMP3 173 /* R */ -#define SENSORS_PC87360_TEMP4 174 /* R */ -#define SENSORS_PC87360_TEMP5 175 /* R */ -#define SENSORS_PC87360_TEMP6 176 /* R */ -#define SENSORS_PC87360_TEMP1_MIN 181 /* RW */ -#define SENSORS_PC87360_TEMP2_MIN 182 /* RW */ -#define SENSORS_PC87360_TEMP3_MIN 183 /* RW */ -#define SENSORS_PC87360_TEMP4_MIN 184 /* RW */ -#define SENSORS_PC87360_TEMP5_MIN 185 /* RW */ -#define SENSORS_PC87360_TEMP6_MIN 186 /* RW */ -#define SENSORS_PC87360_TEMP1_MAX 191 /* RW */ -#define SENSORS_PC87360_TEMP2_MAX 192 /* RW */ -#define SENSORS_PC87360_TEMP3_MAX 193 /* RW */ -#define SENSORS_PC87360_TEMP4_MAX 194 /* RW */ -#define SENSORS_PC87360_TEMP5_MAX 195 /* RW */ -#define SENSORS_PC87360_TEMP6_MAX 196 /* RW */ -#define SENSORS_PC87360_TEMP1_CRIT 201 /* RW */ -#define SENSORS_PC87360_TEMP2_CRIT 202 /* RW */ -#define SENSORS_PC87360_TEMP3_CRIT 203 /* RW */ -#define SENSORS_PC87360_TEMP4_CRIT 204 /* RW */ -#define SENSORS_PC87360_TEMP5_CRIT 205 /* RW */ -#define SENSORS_PC87360_TEMP6_CRIT 206 /* RW */ -#define SENSORS_PC87360_TEMP1_STATUS 211 /* R */ -#define SENSORS_PC87360_TEMP2_STATUS 212 /* R */ -#define SENSORS_PC87360_TEMP3_STATUS 213 /* R */ -#define SENSORS_PC87360_TEMP4_STATUS 214 /* R */ -#define SENSORS_PC87360_TEMP5_STATUS 215 /* R */ -#define SENSORS_PC87360_TEMP6_STATUS 216 /* R */ - -#define SENSORS_PC87360_VID 240 /* R */ -#define SENSORS_PC87360_VRM 241 /* RW */ - -#define SENSORS_PC87427_PREFIX "pc87427" - -/* fan n from 1 to 8 */ -#define SENSORS_PC87427_FAN(n) (n) /* R */ -#define SENSORS_PC87427_FAN_MIN(n) (16 + (n)) /* RW */ -#define SENSORS_PC87427_FAN_ALARM(n) (32 + (n)) /* R */ -#define SENSORS_PC87427_FAN_FAULT(n) (48 + (n)) /* R */ - -#define SENSORS_LM92_PREFIX "lm92" - -#define SENSORS_LM92_TEMP_HIGH 1 /* RW */ -#define SENSORS_LM92_TEMP_LOW 2 /* RW */ -#define SENSORS_LM92_TEMP_CRIT 3 /* RW */ -#define SENSORS_LM92_TEMP_HYST 4 /* RW */ -#define SENSORS_LM92_TEMP 5 /* R */ -#define SENSORS_LM92_ALARMS 6 /* R */ - -#define SENSORS_VT8231_PREFIX "vt8231" - -#define SENSORS_VT8231_IN0 1 /* R */ -#define SENSORS_VT8231_IN1 2 /* R */ -#define SENSORS_VT8231_IN2 3 /* R */ -#define SENSORS_VT8231_IN3 4 /* R */ -#define SENSORS_VT8231_IN4 5 /* R */ -#define SENSORS_VT8231_IN5 6 /* R */ -#define SENSORS_VT8231_IN0_MIN 11 /* RW */ -#define SENSORS_VT8231_IN1_MIN 12 /* RW */ -#define SENSORS_VT8231_IN2_MIN 13 /* RW */ -#define SENSORS_VT8231_IN3_MIN 14 /* RW */ -#define SENSORS_VT8231_IN4_MIN 15 /* RW */ -#define SENSORS_VT8231_IN5_MIN 16 /* RW */ -#define SENSORS_VT8231_IN0_MAX 21 /* RW */ -#define SENSORS_VT8231_IN1_MAX 22 /* RW */ -#define SENSORS_VT8231_IN2_MAX 23 /* RW */ -#define SENSORS_VT8231_IN3_MAX 24 /* RW */ -#define SENSORS_VT8231_IN4_MAX 25 /* RW */ -#define SENSORS_VT8231_IN5_MAX 26 /* RW */ -#define SENSORS_VT8231_FAN1 31 /* R */ -#define SENSORS_VT8231_FAN2 32 /* R */ -#define SENSORS_VT8231_FAN1_MIN 41 /* RW */ -#define SENSORS_VT8231_FAN2_MIN 42 /* RW */ -#define SENSORS_VT8231_TEMP 51 /* R */ -#define SENSORS_VT8231_TEMP_HYST 52 /* RW */ -#define SENSORS_VT8231_TEMP_OVER 53 /* RW */ -#define SENSORS_VT8231_TEMP2 54 /* R */ -#define SENSORS_VT8231_TEMP2_HYST 55 /* RW */ -#define SENSORS_VT8231_TEMP2_OVER 56 /* RW */ -#define SENSORS_VT8231_TEMP3 57 /* R */ -#define SENSORS_VT8231_TEMP3_HYST 58 /* RW */ -#define SENSORS_VT8231_TEMP3_OVER 59 /* RW */ -#define SENSORS_VT8231_TEMP4 60 /* R */ -#define SENSORS_VT8231_TEMP4_HYST 61 /* RW */ -#define SENSORS_VT8231_TEMP4_OVER 62 /* RW */ -#define SENSORS_VT8231_TEMP5 63 /* R */ -#define SENSORS_VT8231_TEMP5_HYST 64 /* RW */ -#define SENSORS_VT8231_TEMP5_OVER 65 /* RW */ -#define SENSORS_VT8231_TEMP6 66 /* R */ -#define SENSORS_VT8231_TEMP6_HYST 67 /* RW */ -#define SENSORS_VT8231_TEMP6_OVER 68 /* RW */ -#define SENSORS_VT8231_FAN1_DIV 75 /* RW */ -#define SENSORS_VT8231_FAN2_DIV 76 /* RW */ -#define SENSORS_VT8231_ALARMS 81 /* R */ -#define SENSORS_VT8231_VID 82 /* R */ -#define SENSORS_VT8231_VRM 83 /* RW */ -#define SENSORS_VT8231_UCH 84 /* RW */ - -#define SENSORS_BMC_PREFIX "bmc" - -/* quantity of each sensor is unknown, so just define the - first one of each and keep them 100 apart. */ -#define SENSORS_BMC_ALARMS 1 /* R */ -#define SENSORS_BMC_IN1 101 /* R */ -#define SENSORS_BMC_IN1_MIN 201 /* RW */ -#define SENSORS_BMC_IN1_MAX 301 /* RW */ -#define SENSORS_BMC_FAN1 1001 /* R */ -#define SENSORS_BMC_FAN1_MIN 1101 /* RW */ -#define SENSORS_BMC_TEMP1 2001 /* R */ -#define SENSORS_BMC_TEMP1_MIN 2101 /* RW */ -#define SENSORS_BMC_TEMP1_MAX 2201 /* RW */ -#define SENSORS_BMC_CURR1 3001 /* R */ -#define SENSORS_BMC_CURR1_MIN 3101 /* RW */ -#define SENSORS_BMC_CURR1_MAX 3201 /* RW */ - -#define SENSORS_LM93_PREFIX "lm93" - -#define SENSORS_LM93_IN1 1011 -#define SENSORS_LM93_IN1_MIN 1012 -#define SENSORS_LM93_IN1_MAX 1013 -#define SENSORS_LM93_IN2 1021 -#define SENSORS_LM93_IN2_MIN 1022 -#define SENSORS_LM93_IN2_MAX 1023 -#define SENSORS_LM93_IN3 1031 -#define SENSORS_LM93_IN3_MIN 1032 -#define SENSORS_LM93_IN3_MAX 1033 -#define SENSORS_LM93_IN4 1041 -#define SENSORS_LM93_IN4_MIN 1042 -#define SENSORS_LM93_IN4_MAX 1043 -#define SENSORS_LM93_IN5 1051 -#define SENSORS_LM93_IN5_MIN 1052 -#define SENSORS_LM93_IN5_MAX 1053 -#define SENSORS_LM93_IN6 1061 -#define SENSORS_LM93_IN6_MIN 1062 -#define SENSORS_LM93_IN6_MAX 1063 -#define SENSORS_LM93_IN7 1071 -#define SENSORS_LM93_IN7_MIN 1072 -#define SENSORS_LM93_IN7_MAX 1073 -#define SENSORS_LM93_IN8 1081 -#define SENSORS_LM93_IN8_MIN 1082 -#define SENSORS_LM93_IN8_MAX 1083 -#define SENSORS_LM93_IN9 1091 -#define SENSORS_LM93_IN9_MIN 1092 -#define SENSORS_LM93_IN9_MAX 1093 -#define SENSORS_LM93_IN10 1101 -#define SENSORS_LM93_IN10_MIN 1102 -#define SENSORS_LM93_IN10_MAX 1103 -#define SENSORS_LM93_IN11 1111 -#define SENSORS_LM93_IN11_MIN 1112 -#define SENSORS_LM93_IN11_MAX 1113 -#define SENSORS_LM93_IN12 1121 -#define SENSORS_LM93_IN12_MIN 1122 -#define SENSORS_LM93_IN12_MAX 1123 -#define SENSORS_LM93_IN13 1131 -#define SENSORS_LM93_IN13_MIN 1132 -#define SENSORS_LM93_IN13_MAX 1133 -#define SENSORS_LM93_IN14 1141 -#define SENSORS_LM93_IN14_MIN 1142 -#define SENSORS_LM93_IN14_MAX 1143 -#define SENSORS_LM93_IN15 1151 -#define SENSORS_LM93_IN15_MIN 1152 -#define SENSORS_LM93_IN15_MAX 1153 -#define SENSORS_LM93_IN16 1161 -#define SENSORS_LM93_IN16_MIN 1162 -#define SENSORS_LM93_IN16_MAX 1163 -#define SENSORS_LM93_TEMP1 2011 -#define SENSORS_LM93_TEMP1_MIN 2012 -#define SENSORS_LM93_TEMP1_MAX 2013 -#define SENSORS_LM93_TEMP2 2021 -#define SENSORS_LM93_TEMP2_MIN 2022 -#define SENSORS_LM93_TEMP2_MAX 2023 -#define SENSORS_LM93_TEMP3 2031 -#define SENSORS_LM93_TEMP3_MIN 2032 -#define SENSORS_LM93_TEMP3_MAX 2033 -#define SENSORS_LM93_FAN1 3011 -#define SENSORS_LM93_FAN1_MIN 3012 -#define SENSORS_LM93_FAN2 3021 -#define SENSORS_LM93_FAN2_MIN 3022 -#define SENSORS_LM93_FAN3 3031 -#define SENSORS_LM93_FAN3_MIN 3032 -#define SENSORS_LM93_FAN4 3041 -#define SENSORS_LM93_FAN4_MIN 3042 -#define SENSORS_LM93_VID1 4001 -#define SENSORS_LM93_VID2 4002 -#define SENSORS_LM93_ALARMS 5001 - -#define SENSORS_ASB100_PREFIX "asb100" - -#define SENSORS_ASB100_IN0 0x01 /* R */ -#define SENSORS_ASB100_IN1 0x02 /* R */ -#define SENSORS_ASB100_IN2 0x03 /* R */ -#define SENSORS_ASB100_IN3 0x04 /* R */ -#define SENSORS_ASB100_IN4 0x05 /* R */ -#define SENSORS_ASB100_IN5 0x06 /* R */ -#define SENSORS_ASB100_IN6 0x07 /* R */ -#define SENSORS_ASB100_IN0_MIN 0x11 /* RW */ -#define SENSORS_ASB100_IN1_MIN 0x12 /* RW */ -#define SENSORS_ASB100_IN2_MIN 0x13 /* RW */ -#define SENSORS_ASB100_IN3_MIN 0x14 /* RW */ -#define SENSORS_ASB100_IN4_MIN 0x15 /* RW */ -#define SENSORS_ASB100_IN5_MIN 0x16 /* RW */ -#define SENSORS_ASB100_IN6_MIN 0x17 /* RW */ -#define SENSORS_ASB100_IN0_MAX 0x21 /* RW */ -#define SENSORS_ASB100_IN1_MAX 0x22 /* RW */ -#define SENSORS_ASB100_IN2_MAX 0x23 /* RW */ -#define SENSORS_ASB100_IN3_MAX 0x24 /* RW */ -#define SENSORS_ASB100_IN4_MAX 0x25 /* RW */ -#define SENSORS_ASB100_IN5_MAX 0x26 /* RW */ -#define SENSORS_ASB100_IN6_MAX 0x27 /* RW */ -#define SENSORS_ASB100_FAN1 0x31 /* R */ -#define SENSORS_ASB100_FAN2 0x32 /* R */ -#define SENSORS_ASB100_FAN3 0x33 /* R */ -#define SENSORS_ASB100_FAN1_MIN 0x41 /* RW */ -#define SENSORS_ASB100_FAN2_MIN 0x42 /* RW */ -#define SENSORS_ASB100_FAN3_MIN 0x43 /* RW */ -#define SENSORS_ASB100_TEMP1 0x51 /* R */ -#define SENSORS_ASB100_TEMP1_HYST 0x52 /* RW */ -#define SENSORS_ASB100_TEMP1_OVER 0x53 /* RW */ -#define SENSORS_ASB100_TEMP2 0x54 /* R */ -#define SENSORS_ASB100_TEMP2_HYST 0x55 /* RW */ -#define SENSORS_ASB100_TEMP2_OVER 0x56 /* RW */ -#define SENSORS_ASB100_TEMP3 0x57 /* R */ -#define SENSORS_ASB100_TEMP3_HYST 0x58 /* RW */ -#define SENSORS_ASB100_TEMP3_OVER 0x59 /* RW */ -#define SENSORS_ASB100_TEMP4 0x5a /* R */ -#define SENSORS_ASB100_TEMP4_HYST 0x5b /* RW */ -#define SENSORS_ASB100_TEMP4_OVER 0x5c /* RW */ -#define SENSORS_ASB100_VID 0x61 /* R */ -#define SENSORS_ASB100_VRM 0x62 /* RW */ -#define SENSORS_ASB100_FAN1_DIV 0x71 /* RW */ -#define SENSORS_ASB100_FAN2_DIV 0x72 /* RW */ -#define SENSORS_ASB100_FAN3_DIV 0x73 /* RW */ -#define SENSORS_ASB100_ALARMS 0x81 /* R */ -#define SENSORS_ASB100_BEEP_ENABLE 0x82 /* RW */ -#define SENSORS_ASB100_BEEPS 0x83 /* RW */ - -#define SENSORS_XEONTEMP_PREFIX "xeontemp" - -#define SENSORS_XEONTEMP_REMOTE_TEMP 54 /* R */ -#define SENSORS_XEONTEMP_REMOTE_TEMP_HYST 55 /* RW */ -#define SENSORS_XEONTEMP_REMOTE_TEMP_OVER 56 /* RW */ -#define SENSORS_XEONTEMP_ALARMS 81 /* R */ - -/* MAX1619 chip */ - -#define SENSORS_MAX1619_PREFIX "max1619" - -#define SENSORS_MAX1619_LOCAL_TEMP 51 /* R */ -#define SENSORS_MAX1619_REMOTE_TEMP 52 /* R */ -#define SENSORS_MAX1619_REMOTE_LOW 53 /* RW */ -#define SENSORS_MAX1619_REMOTE_HIGH 54 /* RW */ -#define SENSORS_MAX1619_REMOTE_MAX 55 /* RW */ -#define SENSORS_MAX1619_REMOTE_HYST 56 /* RW */ -#define SENSORS_MAX1619_ALARMS 81 /* R */ - -/* MAX6650 / 1 chips */ - -#define SENSORS_MAX6650_PREFIX "max6650" - -#define SENSORS_MAX6650_FAN1_TACH 1 /* R */ -#define SENSORS_MAX6650_FAN2_TACH 2 /* R */ -#define SENSORS_MAX6650_FAN3_TACH 3 /* R */ -#define SENSORS_MAX6650_FAN4_TACH 4 /* R */ -#define SENSORS_MAX6650_SPEED 5 /* RW */ - -/* SMSC47B397-NC chip */ -#define SENSORS_SMSC47B397_PREFIX "smsc47b397" - -#define SENSORS_SMSC47B397_TEMP1 0x01 /* R */ -#define SENSORS_SMSC47B397_TEMP2 0x02 /* R */ -#define SENSORS_SMSC47B397_TEMP3 0x03 /* R */ -#define SENSORS_SMSC47B397_TEMP4 0x04 /* R */ -#define SENSORS_SMSC47B397_FAN1 0x11 /* R */ -#define SENSORS_SMSC47B397_FAN2 0x12 /* R */ -#define SENSORS_SMSC47B397_FAN3 0x13 /* R */ -#define SENSORS_SMSC47B397_FAN4 0x14 /* R */ - -/* Fintek F71805F/FG and F71872F/FG chips */ -#define SENSORS_F71805F_PREFIX "f71805f" -#define SENSORS_F71872F_PREFIX "f71872f" - -/* in n from 0 to 10 */ -#define SENSORS_F71805F_IN(n) (1 + (n)) -#define SENSORS_F71805F_IN_MIN(n) (16 + (n)) -#define SENSORS_F71805F_IN_MAX(n) (31 + (n)) -/* fan n from 1 to 3 */ -#define SENSORS_F71805F_FAN(n) (50 + (n)) -#define SENSORS_F71805F_FAN_MIN(n) (60 + (n)) -/* temp n from 1 to 3 */ -#define SENSORS_F71805F_TEMP(n) (80 + (n)) -#define SENSORS_F71805F_TEMP_MAX(n) (90 + (n)) -#define SENSORS_F71805F_TEMP_HYST(n) (100 + (n)) -#define SENSORS_F71805F_TEMP_TYPE(n) (110 + (n)) -/* alarms */ -#define SENSORS_F71805F_ALARMS_IN 200 -#define SENSORS_F71805F_ALARMS_FAN 201 -#define SENSORS_F71805F_ALARMS_TEMP 202 - -/* Abit uGuru chip */ -#define SENSORS_ABITUGURU_PREFIX "abituguru" - -/* in n from 0 to 10 */ -#define SENSORS_ABITUGURU_IN(n) (0x01 + (n)) /* R */ -#define SENSORS_ABITUGURU_IN_MIN(n) (0x11 + (n)) /* RW */ -#define SENSORS_ABITUGURU_IN_MIN_ALARM(n) (0x21 + (n)) /* R */ -#define SENSORS_ABITUGURU_IN_MAX(n) (0x31 + (n)) /* RW */ -#define SENSORS_ABITUGURU_IN_MAX_ALARM(n) (0x41 + (n)) /* R */ -/* temp n from 1 to 7 */ -#define SENSORS_ABITUGURU_TEMP(n) (0x50 + (n)) /* R */ -#define SENSORS_ABITUGURU_TEMP_ALARM(n) (0x60 + (n)) /* R */ -#define SENSORS_ABITUGURU_TEMP_MAX(n) (0x70 + (n)) /* RW */ -#define SENSORS_ABITUGURU_TEMP_CRIT(n) (0x80 + (n)) /* RW */ -/* fan n from 1 to 6 */ -#define SENSORS_ABITUGURU_FAN(n) (0x90 + (n)) /* R */ -#define SENSORS_ABITUGURU_FAN_ALARM(n) (0xA0 + (n)) /* R */ -#define SENSORS_ABITUGURU_FAN_MIN(n) (0xB0 + (n)) /* RW */ - -/* K8TEMP */ -#define SENSORS_K8TEMP_PREFIX "k8temp" -#define SENSORS_K8TEMP_TEMP1 0x01 /* R */ -#define SENSORS_K8TEMP_TEMP2 0x02 /* R */ -#define SENSORS_K8TEMP_TEMP3 0x03 /* R */ -#define SENSORS_K8TEMP_TEMP4 0x04 /* R */ - -/* coretemp */ - -#define SENSORS_CORETEMP_PREFIX "coretemp" -#define SENSORS_CORETEMP_TEMP1 0x01 /* R */ -#define SENSORS_CORETEMP_TEMP1_CRIT 0x02 /* R */ -#define SENSORS_CORETEMP_TEMP1_CRIT_ALARM 0x03 /* R */ - -/* DME1737 */ - -#define SENSORS_DME1737_PREFIX "dme1737" - -/* in n from 0 to 6 */ -#define SENSORS_DME1737_IN(n) (0x01 + (n)) /* R */ -#define SENSORS_DME1737_IN_MIN(n) (0x11 + (n)) /* RW */ -#define SENSORS_DME1737_IN_MAX(n) (0x21 + (n)) /* RW */ -#define SENSORS_DME1737_IN_ALARM(n) (0x31 + (n)) /* R */ - -/* temp n from 1 to 3*/ -#define SENSORS_DME1737_TEMP(n) (0x41 + (n)) /* R */ -#define SENSORS_DME1737_TEMP_MIN(n) (0x51 + (n)) /* RW */ -#define SENSORS_DME1737_TEMP_MAX(n) (0x61 + (n)) /* RW */ -#define SENSORS_DME1737_TEMP_ALARM(n) (0x71 + (n)) /* R */ -#define SENSORS_DME1737_TEMP_FAULT(n) (0x81 + (n)) /* R */ - -/* fan n from 1 to 6 */ -#define SENSORS_DME1737_FAN(n) (0x91 + (n)) /* R */ -#define SENSORS_DME1737_FAN_MIN(n) (0xa1 + (n)) /* RW */ -#define SENSORS_DME1737_FAN_ALARM(n) (0xb1 + (n)) /* R */ - -/* pwm n from 1 to 3 and 5 to 6 */ -#define SENSORS_DME1737_PWM(n) (0xc1 + (n)) /* RW */ -#define SENSORS_DME1737_PWM_ENABLE(n) (0xd1 + (n)) /* RW */ -#define SENSORS_DME1737_PWM_FREQ(n) (0xe1 + (n)) /* RW */ - -#define SENSORS_DME1737_VID (0xf0) /* R */ -#define SENSORS_DME1737_VRM (0xf1) /* RW */ - -#endif /* def LIB_SENSORS_CHIPS_H */ From 8fdfa3f19d52329ab235145be664749728c29007 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 09:53:01 +0000 Subject: [PATCH 083/718] Move the few lines of code remaining in chips.c to data.c, and finally delete chips.c. RIP. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4507 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/Module.mk | 2 +- lib/chips.c | 28 ---------------------------- lib/data.c | 7 +++++++ 3 files changed, 8 insertions(+), 29 deletions(-) delete mode 100644 lib/chips.c diff --git a/lib/Module.mk b/lib/Module.mk index 61099e56..da38e47a 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -46,7 +46,7 @@ LIBTARGETS := $(MODULE_DIR)/$(LIBSTLIBNAME) $(MODULE_DIR)/$(LIBSHLIBNAME) \ $(MODULE_DIR)/$(LIBSHSONAME) $(MODULE_DIR)/$(LIBSHBASENAME) LIBCSOURCES := $(MODULE_DIR)/data.c $(MODULE_DIR)/general.c \ - $(MODULE_DIR)/error.c $(MODULE_DIR)/chips.c \ + $(MODULE_DIR)/error.c \ $(MODULE_DIR)/proc.c $(MODULE_DIR)/access.c \ $(MODULE_DIR)/init.c $(MODULE_DIR)/sysfs.c diff --git a/lib/chips.c b/lib/chips.c deleted file mode 100644 index 821466ba..00000000 --- a/lib/chips.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - chips.c - Part of libsensors, a Linux library for reading sensor data. - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "data.h" - -#define PLACEHOLDER_ELEMENTS {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} - -sensors_chip_features sensors_chip_features_list[] = -{ - PLACEHOLDER_ELEMENTS, - { 0 } -}; diff --git a/lib/data.c b/lib/data.c index 70a37cf9..d4e0396b 100644 --- a/lib/data.c +++ b/lib/data.c @@ -44,6 +44,13 @@ sensors_bus *sensors_proc_bus = NULL; int sensors_proc_bus_count = 0; int sensors_proc_bus_max = 0; +#define PLACEHOLDER_ELEMENTS {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} + +sensors_chip_features sensors_chip_features_list[] = { + PLACEHOLDER_ELEMENTS, + { 0 } +}; + static int sensors_substitute_chip(sensors_chip_name *name,int lineno); /* Wow, this must be one of the ugliest functions I have ever written. From 063f4b91d4b13bc44027e92c654bf58f135777f1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 12:09:00 +0000 Subject: [PATCH 084/718] Use complete chip names (prefix + bus + address) as the keys of sensors_chip_features_list[]. Using only the prefix (as was done before) makes it impossible to properly support multiple chips with the same prefix but a different feature set. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4508 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 34 +++++++++++++++++----------------- lib/access.h | 4 ++-- lib/data.c | 4 ++-- lib/data.h | 2 +- lib/proc.c | 4 ++-- lib/sysfs.c | 17 ++++++----------- 6 files changed, 30 insertions(+), 35 deletions(-) diff --git a/lib/access.c b/lib/access.c index 6d4b67ab..17ee7768 100644 --- a/lib/access.c +++ b/lib/access.c @@ -99,14 +99,14 @@ sensors_chip *sensors_for_all_config_chips(sensors_chip_name chip_name, /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ -const sensors_chip_feature *sensors_lookup_feature_nr(const char *prefix, +const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature) { int i, j; const sensors_chip_feature *features; - for (i = 0; sensors_chip_features_list[i].prefix; i++) - if (!strcasecmp(sensors_chip_features_list[i].prefix, prefix)) { + for (i = 0; sensors_chip_features_list[i].chip.prefix; i++) + if (sensors_match_chip(sensors_chip_features_list[i].chip, *chip)) { features = sensors_chip_features_list[i].feature; for (j = 0; features[j].data.name; j++) if (features[j].data.number == feature) @@ -118,14 +118,14 @@ const sensors_chip_feature *sensors_lookup_feature_nr(const char *prefix, /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ -const sensors_chip_feature *sensors_lookup_feature_name(const char *prefix, +const sensors_chip_feature *sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) { int i, j; const sensors_chip_feature *features; - for (i = 0; sensors_chip_features_list[i].prefix; i++) - if (!strcasecmp(sensors_chip_features_list[i].prefix, prefix)) { + for (i = 0; sensors_chip_features_list[i].chip.prefix; i++) + if (sensors_match_chip(sensors_chip_features_list[i].chip, *chip)) { features = sensors_chip_features_list[i].feature; for (j = 0; features[j].data.name; j++) if (!strcasecmp(features[j].data.name, feature)) @@ -161,7 +161,7 @@ int sensors_get_label(sensors_chip_name name, int feature, char **result) *result = NULL; if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; - if (!(featureptr = sensors_lookup_feature_nr(name.prefix, feature))) + if (!(featureptr = sensors_lookup_feature_nr(&name, feature))) return -SENSORS_ERR_NO_ENTRY; for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) @@ -193,12 +193,12 @@ int sensors_get_ignored(sensors_chip_name name, int feature) res = 1; if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; - if (!(featureptr = sensors_lookup_feature_nr(name.prefix, feature))) + if (!(featureptr = sensors_lookup_feature_nr(&name, feature))) return -SENSORS_ERR_NO_ENTRY; if (featureptr->data.mapping == SENSORS_NO_MAPPING) alt_featureptr = NULL; else if (!(alt_featureptr = - sensors_lookup_feature_nr(name.prefix, + sensors_lookup_feature_nr(&name, featureptr->data.mapping))) return -SENSORS_ERR_NO_ENTRY; for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) @@ -227,11 +227,11 @@ int sensors_get_feature(sensors_chip_name name, int feature, double *result) if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; - if (!(main_feature = sensors_lookup_feature_nr(name.prefix, feature))) + if (!(main_feature = sensors_lookup_feature_nr(&name, feature))) return -SENSORS_ERR_NO_ENTRY; if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) alt_feature = NULL; - else if (!(alt_feature = sensors_lookup_feature_nr(name.prefix, + else if (!(alt_feature = sensors_lookup_feature_nr(&name, main_feature->data.compute_mapping))) return -SENSORS_ERR_NO_ENTRY; if (!(main_feature->data.mode & SENSORS_MODE_R)) @@ -271,11 +271,11 @@ int sensors_set_feature(sensors_chip_name name, int feature, double value) if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; - if (!(main_feature = sensors_lookup_feature_nr(name.prefix, feature))) + if (!(main_feature = sensors_lookup_feature_nr(&name, feature))) return -SENSORS_ERR_NO_ENTRY; if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) alt_feature = NULL; - else if (!(alt_feature = sensors_lookup_feature_nr(name.prefix, + else if (!(alt_feature = sensors_lookup_feature_nr(&name, main_feature->data.compute_mapping))) return -SENSORS_ERR_NO_ENTRY; if (!(main_feature->data.mode & SENSORS_MODE_W)) @@ -332,8 +332,8 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, sensors_chip_feature *feature_list; int i; - for (i = 0; sensors_chip_features_list[i].prefix; i++) - if (!strcasecmp(sensors_chip_features_list[i].prefix, name.prefix)) { + for (i = 0; sensors_chip_features_list[i].chip.prefix; i++) + if (sensors_match_chip(sensors_chip_features_list[i].chip, name)) { feature_list = sensors_chip_features_list[i].feature; if (!*nr1 && !*nr2) { /* Return the first entry */ if (!feature_list[0].data.name) /* The list may be empty */ @@ -373,7 +373,7 @@ int sensors_eval_expr(sensors_chip_name chipname, const sensors_expr * expr, return 0; } if (expr->kind == sensors_kind_var) { - if (!(feature = sensors_lookup_feature_name(chipname.prefix, + if (!(feature = sensors_lookup_feature_name(&chipname, expr->data.var))) return SENSORS_ERR_NO_ENTRY; if (!(res = sensors_get_feature(chipname, feature->data.number, result))) @@ -432,7 +432,7 @@ int sensors_do_this_chip_sets(sensors_chip_name name) for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->sets_count; i++) { - feature = sensors_lookup_feature_name(name.prefix, + feature = sensors_lookup_feature_name(&name, chip->sets[i].name); if (!feature) { sensors_parse_error("Unknown feature name", diff --git a/lib/access.h b/lib/access.h index 3c92f636..0ed55e17 100644 --- a/lib/access.h +++ b/lib/access.h @@ -36,14 +36,14 @@ extern sensors_chip *sensors_for_all_config_chips(sensors_chip_name chip_name, /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found. */ -extern const sensors_chip_feature *sensors_lookup_feature_nr(const char *prefix, +extern const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature); /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ extern const sensors_chip_feature *sensors_lookup_feature_name - (const char *prefix, const char *feature); + (const sensors_chip_name *chip, const char *feature); /* Substitute configuration bus numbers with real-world /proc bus numbers in the chips lists */ diff --git a/lib/data.c b/lib/data.c index d4e0396b..b618f994 100644 --- a/lib/data.c +++ b/lib/data.c @@ -44,11 +44,11 @@ sensors_bus *sensors_proc_bus = NULL; int sensors_proc_bus_count = 0; int sensors_proc_bus_max = 0; -#define PLACEHOLDER_ELEMENTS {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0} +#define PLACEHOLDER_ELEMENTS {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}} sensors_chip_features sensors_chip_features_list[] = { PLACEHOLDER_ELEMENTS, - { 0 } + { { 0 } } }; static int sensors_substitute_chip(sensors_chip_name *name,int lineno); diff --git a/lib/data.h b/lib/data.h index 2fd0519a..b6ad36fe 100644 --- a/lib/data.h +++ b/lib/data.h @@ -147,7 +147,7 @@ typedef struct sensors_chip_feature { /* Internal data about all features of a type of chip */ typedef struct sensors_chip_features { - const char *prefix; + struct sensors_chip_name chip; struct sensors_chip_feature *feature; } sensors_chip_features; diff --git a/lib/proc.c b/lib/proc.c index 74a09483..08c52aee 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -39,7 +39,7 @@ int sensors_read_proc(sensors_chip_name name, int feature, double *value) char n[NAME_MAX], altn[NAME_MAX]; FILE *f; - if (! (the_feature = sensors_lookup_feature_nr(name.prefix,feature))) + if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) return -SENSORS_ERR_NO_ENTRY; strcpy(n, name.busname); @@ -68,7 +68,7 @@ int sensors_write_proc(sensors_chip_name name, int feature, double value) char n[NAME_MAX], altn[NAME_MAX]; FILE *f; - if (! (the_feature = sensors_lookup_feature_nr(name.prefix,feature))) + if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) return -SENSORS_ERR_NO_ENTRY; strcpy(n, name.busname); diff --git a/lib/sysfs.c b/lib/sysfs.c index f1fdbea5..e4d8fb67 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -67,7 +67,7 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) int i, type, fnum = 1; struct sysfs_attribute *attr; struct dlist *attrs; - sensors_chip_features ret = {0, 0}; + sensors_chip_features ret = {{0}, 0}; /* room for all 3 (in, fan, temp) types, with all their subfeatures + misc features. We use a large sparse table at first to store all found features, so that we can store them sorted at type and index @@ -90,7 +90,7 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) name = attr->name; if (!strcmp(name, "name")) { - ret.prefix = strndup(attr->value, strlen(attr->value) - 1); + ret.chip.prefix = strndup(attr->value, strlen(attr->value) - 1); continue; } @@ -269,18 +269,13 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) } else return -SENSORS_ERR_PARSE; - /* check whether this chip is known in the static list */ - for (i = 0; sensors_chip_features_list[i].prefix; i++) - if (!strcasecmp(sensors_chip_features_list[i].prefix, name.prefix)) - break; - - /* if no chip definition matches */ - if (!sensors_chip_features_list[i].prefix && - total_dynamic < N_PLACEHOLDER_ELEMENTS) { + if (total_dynamic < N_PLACEHOLDER_ELEMENTS) { sensors_chip_features n_entry = sensors_read_dynamic_chip(dev); + n_entry.chip.addr = name.addr; + n_entry.chip.bus = name.bus; /* skip to end of list */ - for(i = 0; sensors_chip_features_list[i].prefix; i++); + for(i = 0; sensors_chip_features_list[i].chip.prefix; i++); sensors_chip_features_list[i] = n_entry; From 32b1b71245b9e0b4d3fc674b07a40f1b26c8908e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 13:35:46 +0000 Subject: [PATCH 085/718] Feature names are now dynamically allocated -> no const. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4509 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 2 +- lib/sysfs.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sensors.h b/lib/sensors.h index 6b9d5e94..9fb6ad4f 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -127,7 +127,7 @@ extern const sensors_chip_name *sensors_get_detected_chips(int *nr); chip. */ typedef struct sensors_feature_data { int number; - const char *name; + char *name; int mapping; int compute_mapping; int mode; diff --git a/lib/sysfs.c b/lib/sysfs.c index e4d8fb67..1665ae4a 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -103,7 +103,7 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) type = sensors_feature_get_type(&feature.data); if (type == SENSORS_FEATURE_UNKNOWN) { - free((char *)feature.data.name); + free(feature.data.name); continue; } @@ -129,7 +129,7 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) fprintf(stderr, "libsensors error, more sensors of one" " type then MAX_SENSORS_PER_TYPE, ignoring " "feature: %s\n", name); - free((char *)feature.data.name); + free(feature.data.name); continue; } @@ -143,7 +143,7 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) fprintf(stderr, "libsensors error, trying to add dupli" "cate feature: %s to dynamic feature table\n", name); - free((char *)feature.data.name); + free(feature.data.name); continue; } From 92b5982180762edc5b9dacc333fb49a1422a5fbe Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 14:39:34 +0000 Subject: [PATCH 086/718] With the new dynamic chip features enumeration code, the sensors_proc_chips and sensors_chip_features_list arrays tend to track the same information. So it's much more simple, and more efficient, to have a single array. I decided to keep sensors_proc_chips, because it already has memory management helpers. One nice side effect is that the arbitrary limit to the number of supported chips is now gone. Another one is that some of the memory leaks were fixed. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4510 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 20 ++++++++--------- lib/data.c | 9 +------- lib/data.h | 9 ++------ lib/init.c | 16 ++++++++++++-- lib/sysfs.c | 61 +++++++++++++++++++++------------------------------- 5 files changed, 51 insertions(+), 64 deletions(-) diff --git a/lib/access.c b/lib/access.c index 17ee7768..946c6062 100644 --- a/lib/access.c +++ b/lib/access.c @@ -105,9 +105,9 @@ const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *c int i, j; const sensors_chip_feature *features; - for (i = 0; sensors_chip_features_list[i].chip.prefix; i++) - if (sensors_match_chip(sensors_chip_features_list[i].chip, *chip)) { - features = sensors_chip_features_list[i].feature; + for (i = 0; i < sensors_proc_chips_count; i++) + if (sensors_match_chip(sensors_proc_chips[i].chip, *chip)) { + features = sensors_proc_chips[i].feature; for (j = 0; features[j].data.name; j++) if (features[j].data.number == feature) return features + j; @@ -124,9 +124,9 @@ const sensors_chip_feature *sensors_lookup_feature_name(const sensors_chip_name int i, j; const sensors_chip_feature *features; - for (i = 0; sensors_chip_features_list[i].chip.prefix; i++) - if (sensors_match_chip(sensors_chip_features_list[i].chip, *chip)) { - features = sensors_chip_features_list[i].feature; + for (i = 0; i < sensors_proc_chips_count; i++) + if (sensors_match_chip(sensors_proc_chips[i].chip, *chip)) { + features = sensors_proc_chips[i].feature; for (j = 0; features[j].data.name; j++) if (!strcasecmp(features[j].data.name, feature)) return features + j; @@ -304,7 +304,7 @@ const sensors_chip_name *sensors_get_detected_chips(int *nr) { const sensors_chip_name *res; res = (*nr >= sensors_proc_chips_count ? - NULL : &sensors_proc_chips[*nr]); + NULL : &sensors_proc_chips[*nr].chip); (*nr)++; return res; } @@ -332,9 +332,9 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, sensors_chip_feature *feature_list; int i; - for (i = 0; sensors_chip_features_list[i].chip.prefix; i++) - if (sensors_match_chip(sensors_chip_features_list[i].chip, name)) { - feature_list = sensors_chip_features_list[i].feature; + for (i = 0; i < sensors_proc_chips_count; i++) + if (sensors_match_chip(sensors_proc_chips[i].chip, name)) { + feature_list = sensors_proc_chips[i].feature; if (!*nr1 && !*nr2) { /* Return the first entry */ if (!feature_list[0].data.name) /* The list may be empty */ return NULL; diff --git a/lib/data.c b/lib/data.c index b618f994..3f9b7013 100644 --- a/lib/data.c +++ b/lib/data.c @@ -36,7 +36,7 @@ sensors_bus *sensors_config_busses = NULL; int sensors_config_busses_count = 0; int sensors_config_busses_max = 0; -sensors_chip_name *sensors_proc_chips = NULL; +sensors_chip_features *sensors_proc_chips = NULL; int sensors_proc_chips_count = 0; int sensors_proc_chips_max = 0; @@ -44,13 +44,6 @@ sensors_bus *sensors_proc_bus = NULL; int sensors_proc_bus_count = 0; int sensors_proc_bus_max = 0; -#define PLACEHOLDER_ELEMENTS {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}}, {{0}} - -sensors_chip_features sensors_chip_features_list[] = { - PLACEHOLDER_ELEMENTS, - { { 0 } } -}; - static int sensors_substitute_chip(sensors_chip_name *name,int lineno); /* Wow, this must be one of the ugliest functions I have ever written. diff --git a/lib/data.h b/lib/data.h index b6ad36fe..799feddc 100644 --- a/lib/data.h +++ b/lib/data.h @@ -159,13 +159,13 @@ extern sensors_bus *sensors_config_busses; extern int sensors_config_busses_count; extern int sensors_config_busses_max; -extern sensors_chip_name *sensors_proc_chips; +extern sensors_chip_features *sensors_proc_chips; extern int sensors_proc_chips_count; extern int sensors_proc_chips_max; #define sensors_add_proc_chips(el) sensors_add_array_el( \ (el), &sensors_proc_chips, &sensors_proc_chips_count,\ - &sensors_proc_chips_max, sizeof(struct sensors_chip_name)) + &sensors_proc_chips_max, sizeof(struct sensors_chip_features)) extern sensors_bus *sensors_proc_bus; extern int sensors_proc_bus_count; @@ -175,9 +175,4 @@ extern int sensors_proc_bus_max; (el), &sensors_proc_bus, &sensors_proc_bus_count,\ &sensors_proc_bus_max, sizeof(struct sensors_bus)) -extern sensors_chip_features sensors_chip_features_list[]; - -/* this should match the total number of elements in PLACEHOLDER_ELEMENTS */ -#define N_PLACEHOLDER_ELEMENTS 10 - #endif /* def LIB_SENSORS_DATA_H */ diff --git a/lib/init.c b/lib/init.c index dfc4cdf8..865232c4 100644 --- a/lib/init.c +++ b/lib/init.c @@ -28,6 +28,7 @@ #include "scanner.h" static void free_chip_name(sensors_chip_name name); +static void free_chip_features(sensors_chip_feature *features); static void free_bus(sensors_bus bus); static void free_chip(sensors_chip chip); static void free_label(sensors_label label); @@ -59,8 +60,10 @@ void sensors_cleanup(void) sensors_scanner_exit(); - for (i = 0; i < sensors_proc_chips_count; i++) - free_chip_name(sensors_proc_chips[i]); + for (i = 0; i < sensors_proc_chips_count; i++) { + free_chip_name(sensors_proc_chips[i].chip); + free_chip_features(sensors_proc_chips[i].feature); + } free(sensors_proc_chips); sensors_proc_chips = NULL; sensors_proc_chips_count = sensors_proc_chips_max = 0; @@ -90,6 +93,15 @@ void free_chip_name(sensors_chip_name name) free(name.busname); } +void free_chip_features(sensors_chip_feature *features) +{ + int i; + + for (i = 0; features[i].data.name; i++) + free(features[i].data.name); + free(features); +} + void free_bus(sensors_bus bus) { free(bus.adapter); diff --git a/lib/sysfs.c b/lib/sysfs.c index 1665ae4a..3ebe22b5 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -61,13 +61,12 @@ int get_type_scaling(int type) return 0; } -static -sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) +static int sensors_read_dynamic_chip(sensors_chip_features *chip, + struct sysfs_device *sysdir) { int i, type, fnum = 1; struct sysfs_attribute *attr; struct dlist *attrs; - sensors_chip_features ret = {{0}, 0}; /* room for all 3 (in, fan, temp) types, with all their subfeatures + misc features. We use a large sparse table at first to store all found features, so that we can store them sorted at type and index @@ -81,7 +80,7 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) attrs = sysfs_get_device_attributes(sysdir); if (attrs == NULL) - return ret; + return -ENOENT; memset(features, 0, sizeof(features)); @@ -90,7 +89,7 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) name = attr->name; if (!strcmp(name, "name")) { - ret.chip.prefix = strndup(attr->value, strlen(attr->value) - 1); + /* Already done */ continue; } @@ -192,9 +191,9 @@ sensors_chip_features sensors_read_dynamic_chip(struct sysfs_device *sysdir) } } - ret.feature = dyn_features; + chip->feature = dyn_features; - return ret; + return 0; } /* returns !0 if sysfs filesystem was found, 0 otherwise */ @@ -215,11 +214,10 @@ int sensors_init_sysfs(void) /* returns: 0 if successful, !0 otherwise */ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) { - static int total_dynamic = 0; - int domain, bus, slot, fn, i; + int domain, bus, slot, fn; struct sysfs_attribute *attr, *bus_attr; char bus_path[SYSFS_PATH_MAX]; - sensors_chip_name name; + sensors_chip_features entry; /* ignore any device without name attribute */ if (!(attr = sysfs_get_device_attr(dev, "name"))) @@ -231,22 +229,22 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) return 0; /* NB: attr->value[attr->len-1] == '\n'; chop that off */ - name.prefix = strndup(attr->value, attr->len - 1); - if (!name.prefix) + entry.chip.prefix = strndup(attr->value, attr->len - 1); + if (!entry.chip.prefix) sensors_fatal_error(__FUNCTION__, "out of memory"); - name.busname = strdup(dev->path); - if (!name.busname) + entry.chip.busname = strdup(dev->path); + if (!entry.chip.busname) sensors_fatal_error(__FUNCTION__, "out of memory"); - if (sscanf(dev->name, "%d-%x", &name.bus, &name.addr) == 2) { + if (sscanf(dev->name, "%d-%x", &entry.chip.bus, &entry.chip.addr) == 2) { /* find out if legacy ISA or not */ - if (name.bus == 9191) - name.bus = SENSORS_CHIP_NAME_BUS_ISA; + if (entry.chip.bus == 9191) + entry.chip.bus = SENSORS_CHIP_NAME_BUS_ISA; else { snprintf(bus_path, sizeof(bus_path), "%s/class/i2c-adapter/i2c-%d/device/name", - sensors_sysfs_mount, name.bus); + sensors_sysfs_mount, entry.chip.bus); if ((bus_attr = sysfs_open_attribute(bus_path))) { if (sysfs_read_attribute(bus_attr)) @@ -254,35 +252,24 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) if (bus_attr->value && !strncmp(bus_attr->value, "ISA ", 4)) - name.bus = SENSORS_CHIP_NAME_BUS_ISA; + entry.chip.bus = SENSORS_CHIP_NAME_BUS_ISA; sysfs_close_attribute(bus_attr); } } - } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &name.addr) == 1) { + } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &entry.chip.addr) == 1) { /* must be new ISA (platform driver) */ - name.bus = SENSORS_CHIP_NAME_BUS_ISA; + entry.chip.bus = SENSORS_CHIP_NAME_BUS_ISA; } else if (sscanf(dev->name, "%x:%x:%x.%x", &domain, &bus, &slot, &fn) == 4) { /* PCI */ - name.addr = (domain << 16) + (bus << 8) + (slot << 3) + fn; - name.bus = SENSORS_CHIP_NAME_BUS_PCI; + entry.chip.addr = (domain << 16) + (bus << 8) + (slot << 3) + fn; + entry.chip.bus = SENSORS_CHIP_NAME_BUS_PCI; } else return -SENSORS_ERR_PARSE; - if (total_dynamic < N_PLACEHOLDER_ELEMENTS) { - sensors_chip_features n_entry = sensors_read_dynamic_chip(dev); - n_entry.chip.addr = name.addr; - n_entry.chip.bus = name.bus; - - /* skip to end of list */ - for(i = 0; sensors_chip_features_list[i].chip.prefix; i++); - - sensors_chip_features_list[i] = n_entry; - - total_dynamic++; - } - - sensors_add_proc_chips(&name); + if (sensors_read_dynamic_chip(&entry, dev) < 0) + return -SENSORS_ERR_PARSE; + sensors_add_proc_chips(&entry); return 0; } From a6c3c36f00c7118345034f54e7aa153ca5ceee1a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 14:46:08 +0000 Subject: [PATCH 087/718] Warning fix ("index" is a standard libc function.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4511 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 957c5100..af81426a 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -64,23 +64,23 @@ static void sensors_get_available_features(const sensors_chip_name *name, iter->mapping != SENSORS_NO_MAPPING && iter->mapping == feature->number) { sensors_feature_type type = sensors_feature_get_type(iter); - unsigned int index; + unsigned int indx; if (type == SENSORS_FEATURE_UNKNOWN) continue; - index = type - first_val - 1; - if (index >= size) { + indx = type - first_val - 1; + if (indx >= size) { printf("ERROR: Bug in sensors: index out of bound"); return; } - if (get_feature_value(name, iter, &feature_vals[index])) + if (get_feature_value(name, iter, &feature_vals[indx])) printf("ERROR: Can't get %s data!\n", iter->name); /* some chips don't have all the features they claim to have */ - /* has_features[index] = (feature_vals[index] != 127); */ - has_features[index] = 1; + /* has_features[indx] = (feature_vals[indx] != 127); */ + has_features[indx] = 1; } } From 4c905e16326b3f37d5cc11dc7b7e65908a857c8b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 17:47:18 +0000 Subject: [PATCH 088/718] Drop the --generic option. This is the default now, so the option has no effect. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4512 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/main.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 5b4346d3..48aa9d08 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -55,7 +55,7 @@ static const char *sprintf_chip_name(sensors_chip_name name); #define CHIPS_MAX 20 sensors_chip_name chips[CHIPS_MAX]; int chips_count=0; -int do_sets, do_unknown, fahrenheit, hide_adapter, hide_unknown, do_generic; +int do_sets, do_unknown, fahrenheit, hide_adapter, hide_unknown; char degstr[5]; /* store the correct string to print degrees */ @@ -75,7 +75,6 @@ void print_long_help(void) printf(" -U, --no-unknown Do not show unknown chips\n"); printf(" -u, --unknown Treat chips as unknown ones (testing only)\n"); printf(" -v, --version Display the program version\n"); - printf(" -g, --generic Use generic printing routine for all chips (testing only)\n"); printf("\n"); printf("Use `-' after `-c' to read the config file from stdin.\n"); printf("If no chips are specified, all chip info will be printed.\n"); @@ -161,7 +160,6 @@ int main (int argc, char *argv[]) { "no-unknown", no_argument, NULL, 'U' }, { "config-file", required_argument, NULL, 'c' }, { "unknown", no_argument, NULL, 'u' }, - { "generic", no_argument, NULL, 'g'}, { 0,0,0,0 } }; @@ -171,9 +169,8 @@ int main (int argc, char *argv[]) do_sets = 0; hide_adapter = 0; hide_unknown = 0; - do_generic = 0; while (1) { - c = getopt_long(argc, argv, "hsvfAUc:ug", long_opts, NULL); + c = getopt_long(argc, argv, "hsvfAUc:u", long_opts, NULL); if (c == EOF) break; switch(c) { @@ -205,9 +202,6 @@ int main (int argc, char *argv[]) case 'u': do_unknown = 1; break; - case 'g': - do_generic = 1; - break; default: fprintf(stderr,"Internal error while parsing options!\n"); exit(1); From e08eabe33ca727aa85748e3fb468f6dbc43da4dc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 28 Jun 2007 18:19:58 +0000 Subject: [PATCH 089/718] We no longer need alternative sysfs file names and magnitudes, as they are the real name and magnitude now. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4513 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 13 +-- lib/data.h | 3 - lib/proc.c | 263 ++++++--------------------------------------------- 3 files changed, 31 insertions(+), 248 deletions(-) diff --git a/lib/access.c b/lib/access.c index 946c6062..c3f81da1 100644 --- a/lib/access.c +++ b/lib/access.c @@ -554,25 +554,18 @@ static struct feature_type_match matches[] = { sensors_feature_type sensors_feature_get_type( const sensors_feature_data *feature) { - const char *name; regmatch_t pmatch[4]; int size_first, size_second, retval, i; struct feature_type_match *submatches; static regex_t reg; static regex_t *preg = NULL; - /* use sysname if exists */ - if (container_of(feature, const struct sensors_chip_feature, data)->sysname) - name = container_of(feature, const struct sensors_chip_feature, data)->sysname; - else - name = feature->name; - if (!preg) { regcomp(®, GET_TYPE_REGEX, 0); preg = ® } - retval = regexec(preg, name, 4, pmatch, 0); + retval = regexec(preg, feature->name, 4, pmatch, 0); if (retval == -1) return SENSORS_FEATURE_UNKNOWN; @@ -581,7 +574,7 @@ sensors_feature_type sensors_feature_get_type( size_second = pmatch[3].rm_eo - pmatch[3].rm_so; for(i = 0; matches[i].name != 0; i++) - if (!strncmp(name, matches[i].name, size_first)) + if (!strncmp(feature->name, matches[i].name, size_first)) break; if (matches[i].name == NULL) /* no match */ @@ -593,7 +586,7 @@ sensors_feature_type sensors_feature_get_type( submatches = matches[i].submatches; for(i = 0; submatches[i].name != 0; i++) - if (!strcmp(name + pmatch[3].rm_so, submatches[i].name)) + if (!strcmp(feature->name + pmatch[3].rm_so, submatches[i].name)) return submatches[i].type; return SENSORS_FEATURE_UNKNOWN; diff --git a/lib/data.h b/lib/data.h index 799feddc..8bf40499 100644 --- a/lib/data.h +++ b/lib/data.h @@ -140,9 +140,6 @@ typedef struct sensors_bus { typedef struct sensors_chip_feature { sensors_feature_data data; int scaling; - const char *sysname; - int sysscaling; - const char *altsysname; } sensors_chip_feature; /* Internal data about all features of a type of chip */ diff --git a/lib/proc.c b/lib/proc.c index 08c52aee..acbea114 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -26,9 +26,6 @@ #include "error.h" #include "access.h" -static int getsysname(const sensors_chip_feature *feature, char *sysname, - int *sysmag, char *altsysname); - /* This reads a feature from a sysfs file. Sysfs uses a one-value-per file system... */ @@ -36,24 +33,29 @@ int sensors_read_proc(sensors_chip_name name, int feature, double *value) { const sensors_chip_feature *the_feature; int mag; - char n[NAME_MAX], altn[NAME_MAX]; + char n[NAME_MAX]; FILE *f; + int dummy; + char check; + const char *suffix = ""; if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) return -SENSORS_ERR_NO_ENTRY; - strcpy(n, name.busname); - strcat(n, "/"); - strcpy(altn, n); - /* use rindex to append sysname to n */ - getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); - if ((f = fopen(n, "r")) != NULL - || (f = fopen(altn, "r")) != NULL) { + /* REVISIT: this is a ugly hack */ + if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 + || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 + || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) + suffix = "_input"; + + snprintf(n, NAME_MAX, "%s/%s%s", name.busname, the_feature->data.name, + suffix); + if ((f = fopen(n, "r"))) { int res = fscanf(f, "%lf", value); fclose(f); if (res != 1) return -SENSORS_ERR_PROC; - for (; mag > 0; mag --) + for (mag = the_feature->scaling; mag > 0; mag --) *value /= 10.0; } else return -SENSORS_ERR_PROC; @@ -65,20 +67,25 @@ int sensors_write_proc(sensors_chip_name name, int feature, double value) { const sensors_chip_feature *the_feature; int mag; - char n[NAME_MAX], altn[NAME_MAX]; + char n[NAME_MAX]; FILE *f; + int dummy; + char check; + const char *suffix = ""; if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) return -SENSORS_ERR_NO_ENTRY; - strcpy(n, name.busname); - strcat(n, "/"); - strcpy(altn, n); - /* use rindex to append sysname to n */ - getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); - if ((f = fopen(n, "w")) != NULL - || (f = fopen(altn, "w")) != NULL) { - for (; mag > 0; mag --) + /* REVISIT: this is a ugly hack */ + if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 + || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 + || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) + suffix = "_input"; + + snprintf(n, NAME_MAX, "%s/%s%s", name.busname, the_feature->data.name, + suffix); + if ((f = fopen(n, "w"))) { + for (mag = the_feature->scaling; mag > 0; mag --) value *= 10.0; fprintf(f, "%d", (int) value); fclose(f); @@ -87,217 +94,3 @@ int sensors_write_proc(sensors_chip_name name, int feature, double value) return 0; } - -#define CURRMAG 3 -#define FANMAG 0 -#define INMAG 3 -#define TEMPMAG 3 - -/* The following are used in getsysname() below */ -struct match { - const char * name, * sysname; - const int sysmag; - const char * altsysname; -}; - -static const struct match matches[] = { - { "beeps", "beep_mask", 0 }, - { "pwm", "pwm1", 0, "fan1_pwm" }, - { "vid", "cpu0_vid", INMAG, "in0_ref" }, - { "remote_temp", "temp2_input", TEMPMAG }, - { "remote_temp_hyst", "temp2_max_hyst", TEMPMAG }, - { "remote_temp_low", "temp2_min", TEMPMAG }, - { "remote_temp_over", "temp2_max", TEMPMAG }, - { "temp", "temp1_input", TEMPMAG }, - { "temp_hyst", "temp1_max_hyst", TEMPMAG }, - { "temp_low", "temp1_min", TEMPMAG }, - { "temp_over", "temp1_max", TEMPMAG }, - { "temp_high", "temp1_max", TEMPMAG }, - { "temp_crit", "temp1_crit", TEMPMAG }, - { NULL, NULL } -}; - -/* - Returns the sysfs name and magnitude for a given feature. - First looks for a sysfs name and magnitude in the feature structure. - These should be added in chips.c for all non-standard feature names. - If that fails, converts common /proc feature names - to their sysfs equivalent, and uses common sysfs magnitude. - Common magnitudes are #defined above. - Common conversions are as follows: - fan%d_min -> fan%d_min (for magnitude) - fan%d_state -> fan%d_status - fan%d -> fan_input%d - pwm%d -> fan%d_pwm - pwm%d_enable -> fan%d_pwm_enable - in%d_max -> in%d_max (for magnitude) - in%d_min -> in%d_min (for magnitude) - in%d -> in%d_input - vin%d_max -> in%d_max - vin%d_min -> in%d_min - vin%d -> in_input%d - temp%d_over -> temp%d_max - temp%d_hyst -> temp%d_max_hyst - temp%d_max -> temp%d_max (for magnitude) - temp%d_high -> temp%d_max - temp%d_min -> temp%d_min (for magnitude) - temp%d_low -> temp%d_min - temp%d_state -> temp%d_status - temp%d -> temp%d_input - sensor%d -> temp%d_type - AND all conversions listed in the matches[] structure above. - - If that fails, returns old /proc feature name and magnitude. - - References: doc/developers/proc in the lm_sensors package; - Documentation/i2c/sysfs_interface in the kernel -*/ -static int getsysname(const sensors_chip_feature *feature, char *sysname, - int *sysmag, char *altsysname) -{ - const char * name = feature->data.name; - char last; - char check; /* used to verify end of string */ - int num; - const struct match *m; - -/* default to a non-existent alternate name (should rarely be tried) */ - strcpy(altsysname, "_"); - -/* use override in feature structure if present */ - if(feature->sysname != NULL) { - strcpy(sysname, feature->sysname); - if(feature->sysscaling) - *sysmag = feature->sysscaling; - else - *sysmag = feature->scaling; - if(feature->altsysname != NULL) - strcpy(altsysname, feature->altsysname); - return 0; - } - -/* check for constant mappings */ - for(m = matches; m->name != NULL; m++) { - if(!strcmp(m->name, name)) { - strcpy(sysname, m->sysname); - if (m->altsysname != NULL) - strcpy(altsysname, m->altsysname); - *sysmag = m->sysmag; - return 0; - } - } - -/* convert common /proc names to common sysfs names */ - if(sscanf(name, "fan%d_mi%c%c", &num, &last, &check) == 2 && last == 'n') { - strcpy(sysname, name); - *sysmag = FANMAG; - return 0; - } - if(sscanf(name, "fan%d_stat%c%c", &num, &last, &check) == 2 && last == 'e') { - sprintf(sysname, "fan%d_status", num); - *sysmag = 0; - return 0; - } - if(sscanf(name, "fan%d%c", &num, &check) == 1) { - sprintf(sysname, "fan%d_input", num); - *sysmag = FANMAG; - return 0; - } - if(sscanf(name, "pwm%d%c", &num, &check) == 1) { - strcpy(sysname, name); - *sysmag = 0; - sprintf(altsysname, "fan%d_pwm", num); - return 0; - } - if(sscanf(name, "pwm%d_enabl%c%c", &num, &last, &check) == 2 && last == 'e') { - strcpy(sysname, name); - *sysmag = 0; - sprintf(altsysname, "fan%d_pwm_enable", num); - return 0; - } - - if((sscanf(name, "in%d_mi%c%c", &num, &last, &check) == 2 && last == 'n') - || (sscanf(name, "in%d_ma%c%c", &num, &last, &check) == 2 && last == 'x')) { - strcpy(sysname, name); - *sysmag = INMAG; - return 0; - } - if((sscanf(name, "in%d%c", &num, &check) == 1) - || (sscanf(name, "vin%d%c", &num, &check) == 1)) { - sprintf(sysname, "in%d_input", num); - *sysmag = INMAG; - return 0; - } - if(sscanf(name, "vin%d_mi%c%c", &num, &last, &check) == 2 && last == 'n') { - sprintf(sysname, "in%d_min", num); - *sysmag = INMAG; - return 0; - } - if(sscanf(name, "vin%d_ma%c%c", &num, &last, &check) == 2 && last == 'x') { - sprintf(sysname, "in%d_max", num); - *sysmag = INMAG; - return 0; - } - - if(sscanf(name, "temp%d_hys%c%c", &num, &last, &check) == 2 && last == 't') { - sprintf(sysname, "temp%d_max_hyst", num); - *sysmag = TEMPMAG; - return 0; - } - if((sscanf(name, "temp%d_ove%c%c", &num, &last, &check) == 2 && last == 'r') - || (sscanf(name, "temp%d_ma%c%c", &num, &last, &check) == 2 && last == 'x') - || (sscanf(name, "temp%d_hig%c%c", &num, &last, &check) == 2 && last == 'h')) { - sprintf(sysname, "temp%d_max", num); - *sysmag = TEMPMAG; - return 0; - } - if((sscanf(name, "temp%d_mi%c%c", &num, &last, &check) == 2 && last == 'n') - || (sscanf(name, "temp%d_lo%c%c", &num, &last, &check) == 2 && last == 'w')) { - sprintf(sysname, "temp%d_min", num); - *sysmag = TEMPMAG; - return 0; - } - if(sscanf(name, "temp%d_cri%c%c", &num, &last, &check) == 2 && last == 't') { - sprintf(sysname, "temp%d_crit", num); - *sysmag = TEMPMAG; - return 0; - } - if(sscanf(name, "temp%d_stat%c%c", &num, &last, &check) == 2 && last == 'e') { - sprintf(sysname, "temp%d_status", num); - *sysmag = 0; - return 0; - } - if(sscanf(name, "temp%d%c", &num, &check) == 1) { - sprintf(sysname, "temp%d_input", num); - *sysmag = TEMPMAG; - return 0; - } - if(sscanf(name, "sensor%d%c", &num, &check) == 1) { - sprintf(sysname, "temp%d_type", num); - *sysmag = 0; - return 0; - } - -/* bmcsensors only, not yet in kernel */ -/* - if((sscanf(name, "curr%d_mi%c%c", &num, &last, &check) == 2 && last == 'n') - || (sscanf(name, "curr%d_ma%c%c", &num, &last, &check) == 2 && last == 'x')) { - strcpy(sysname, name); - *sysmag = CURRMAG; - return 0; - } - if(sscanf(name, "curr%d%c", &num, &check) == 1) { - sprintf(sysname, "curr%d_input", num); - *sysmag = CURRMAG; - return 0; - } -*/ - -/* give up, use old name (probably won't work though...) */ -/* known to be the same: - "alarms", "beep_enable", "vrm", "fan%d_div" -*/ - strcpy(sysname, name); - *sysmag = feature->scaling; - return 0; -} From 184ad7e23e554922884460c57ae18d333ea7439a Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 28 Jun 2007 21:00:08 +0000 Subject: [PATCH 090/718] long promised print_generic_chip_in() fixes git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4514 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 45 ++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index af81426a..abda4041 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -251,30 +251,35 @@ static void print_generic_chip_in(const sensors_chip_name *name, free(label); printf("%+6.2f V", val); + if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) + printf(" (min = %+6.2f V", IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN)); + if (IN_FEATURE(SENSORS_FEATURE_IN_MAX)) { - printf(" (min = %+6.2f V, max = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN), - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); + if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) + printf(", "); + else + printf(" ("); + printf("max = %+6.2f V)", IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); + } + + if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM) || + IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { + alarm_max = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX_ALARM); + alarm_min = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN_ALARM); - if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM) && - IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { - alarm_max = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX_ALARM); - alarm_min = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN_ALARM); + if (alarm_min || alarm_max) { + printf(" ALARM ("); - if (alarm_min || alarm_max) { - printf(" ALARM ("); - - if (alarm_min) - printf("MIN"); - if (alarm_max) - printf("%sMAX", (alarm_min) ? "," : ""); - - printf(")"); - } - } else if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { - printf(" %s", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_ALARM) > 0.5 ? "ALARM" : ""); + if (alarm_min) + printf("MIN"); + if (alarm_max) + printf("%sMAX", (alarm_min) ? ", " : ""); + + printf(")"); } + } else if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { + printf(" %s", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_ALARM) ? "ALARM" : ""); } printf("\n"); From c084fe78f4b0aa8b3721f4e6cef27a368bf24fe5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 29 Jun 2007 07:57:33 +0000 Subject: [PATCH 091/718] kernel/include/sensors.h is no longer used; delete it. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4515 7894878c-1315-0410-8ee3-d5d059ff63e0 --- INSTALL | 2 - Makefile | 9 +- kernel/include/Module.mk | 39 --- kernel/include/sensors.h | 551 --------------------------------------- 4 files changed, 2 insertions(+), 599 deletions(-) delete mode 100644 kernel/include/Module.mk delete mode 100644 kernel/include/sensors.h diff --git a/INSTALL b/INSTALL index db1199f4..65e36bc6 100644 --- a/INSTALL +++ b/INSTALL @@ -174,8 +174,6 @@ SBINDIR (default: $(PREFIX)/sbin) Installation directory of system administrator-only programs. INCLUDEDIR (default: $(PREFIX)/include) Base installation directory for include files (see next two vars). -SYSINCLUDEDIR (default: $(INCLUDEDIR)/linux) - Installation directory for system include files. LIBINCLUDEDIR (default: $(INCLUDEDIR)/sensors) Installation directory for libsensors include files. MANDIR (default: $(PREFIX)/man) diff --git a/Makefile b/Makefile index 69f33530..d4a3cbf8 100644 --- a/Makefile +++ b/Makefile @@ -70,12 +70,8 @@ SBINDIR := $(PREFIX)/sbin # You should not need to change this. It is the basic directory into which # include files will be installed. The actual directory will be -# $(INCLUDEDIR)/linux for system include files, and $(INCLUDEDIR)/sensors -# for library include files. If PREFIX equals the default /usr/local/bin, -# you will be able to use '#include ' regardless of the -# current kernel selected. +# $(INCLUDEDIR)/sensors for library include files. INCLUDEDIR := $(PREFIX)/include -SYSINCLUDEDIR := $(INCLUDEDIR)/linux LIBINCLUDEDIR := $(INCLUDEDIR)/sensors # You should not need to change this. It is the base directory under which the @@ -109,7 +105,6 @@ MACHINE := $(shell uname -m) # The subdirectories we need to build things in SRCDIRS := -SRCDIRS += kernel/include SRCDIRS += lib prog/detect prog/dump prog/pwm \ prog/sensors ${PROG_EXTRA:%=prog/%} etc SRCDIRS += lib/test @@ -133,7 +128,7 @@ SED := sed # PROGCPPFLAGS/PROGCFLAGS is to create regular object files (which are linked into executables). # ARCPPFLAGS/ARCFLAGS are used to create archive object files (static libraries). # LIBCPPFLAGS/LIBCFLAGS are for shared library objects. -ALL_CPPFLAGS := -I. -Ikernel/include +ALL_CPPFLAGS := -I. ALL_CFLAGS := -Wall ifeq ($(DEBUG),1) diff --git a/kernel/include/Module.mk b/kernel/include/Module.mk deleted file mode 100644 index 0b41678f..00000000 --- a/kernel/include/Module.mk +++ /dev/null @@ -1,39 +0,0 @@ -# Module.mk - Makefile for a Linux module for reading sensor data. -# Copyright (c) 1998, 1999 Frodo Looijaard -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -# Note that MODULE_DIR (the directory in which this file resides) is a -# 'simply expanded variable'. That means that its value is substituted -# verbatim in the rules, until it is redefined. -MODULE_DIR := kernel/include -KERNELINCLUDEDIR := $(MODULE_DIR) - -KERNELINCLUDEFILES := $(MODULE_DIR)/sensors.h - -REMOVEKERNELINC := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SYSINCLUDEDIR)/%,$(KERNELINCLUDEFILES)) - -install-all-kernel-include: - if [ -n "$(KERNELINCLUDEFILES)" ] ; then \ - $(MKDIR) $(DESTDIR)$(SYSINCLUDEDIR) ; \ - $(INSTALL) -m 644 $(KERNELINCLUDEFILES) $(DESTDIR)$(SYSINCLUDEDIR) ; \ - fi - -user_install :: install-all-kernel-include - -user_uninstall:: - $(RM) $(REMOVEKERNELINC) -# Remove directory if empty, ignore failure - $(RMDIR) $(DESTDIR)$(SYSINCLUDEDIR) 2> /dev/null || true diff --git a/kernel/include/sensors.h b/kernel/include/sensors.h deleted file mode 100644 index ad1ba586..00000000 --- a/kernel/include/sensors.h +++ /dev/null @@ -1,551 +0,0 @@ -/* - sensors.h - Part of lm_sensors, Linux kernel modules for hardware - monitoring - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef LIB_SENSORS_H -#define LIB_SENSORS_H - -/* This file is intended to be included from userland utilities only. - * It used to be generated from kernel driver code, but the new sysfs - * standard interface makes these definitions obsolete. For now, we will be - * keeping the old defintions in this file, until all applications have - * been upgraded to the new model (dynamic discovery of chip features.) - */ - - -#define ADM1021_ALARM_TEMP_HIGH 0x40 -#define ADM1021_ALARM_TEMP_LOW 0x20 -#define ADM1021_ALARM_RTEMP_HIGH 0x10 -#define ADM1021_ALARM_RTEMP_LOW 0x08 -#define ADM1021_ALARM_RTEMP_NA 0x04 - - -#define ADM1024_ALARM_IN0 0x0001 -#define ADM1024_ALARM_IN1 0x0002 -#define ADM1024_ALARM_IN2 0x0004 -#define ADM1024_ALARM_IN3 0x0008 -#define ADM1024_ALARM_IN4 0x0100 -#define ADM1024_ALARM_IN5 0x0200 -#define ADM1024_ALARM_FAN1 0x0040 -#define ADM1024_ALARM_FAN2 0x0080 -#define ADM1024_ALARM_TEMP 0x0010 -#define ADM1024_ALARM_TEMP1 0x0020 -#define ADM1024_ALARM_TEMP2 0x0001 -#define ADM1024_ALARM_CHAS 0x1000 - - -#define ADM1025_ALARM_IN0 0x0001 -#define ADM1025_ALARM_IN1 0x0002 -#define ADM1025_ALARM_IN2 0x0004 -#define ADM1025_ALARM_IN3 0x0008 -#define ADM1025_ALARM_IN4 0x0100 -#define ADM1025_ALARM_IN5 0x0200 -#define ADM1025_ALARM_RTEMP 0x0020 -#define ADM1025_ALARM_TEMP 0x0010 -#define ADM1025_ALARM_RFAULT 0x4000 - - -#define ADM1026_ALARM_TEMP2 (1L << 0) -#define ADM1026_ALARM_TEMP3 (1L << 1) -#define ADM1026_ALARM_IN9 (1L << 1) -#define ADM1026_ALARM_IN11 (1L << 2) -#define ADM1026_ALARM_IN12 (1L << 3) -#define ADM1026_ALARM_IN13 (1L << 4) -#define ADM1026_ALARM_IN14 (1L << 5) -#define ADM1026_ALARM_IN15 (1L << 6) -#define ADM1026_ALARM_IN16 (1L << 7) -#define ADM1026_ALARM_IN0 (1L << 8) -#define ADM1026_ALARM_IN1 (1L << 9) -#define ADM1026_ALARM_IN2 (1L << 10) -#define ADM1026_ALARM_IN3 (1L << 11) -#define ADM1026_ALARM_IN4 (1L << 12) -#define ADM1026_ALARM_IN5 (1L << 13) -#define ADM1026_ALARM_IN6 (1L << 14) -#define ADM1026_ALARM_IN7 (1L << 15) -#define ADM1026_ALARM_FAN0 (1L << 16) -#define ADM1026_ALARM_FAN1 (1L << 17) -#define ADM1026_ALARM_FAN2 (1L << 18) -#define ADM1026_ALARM_FAN3 (1L << 19) -#define ADM1026_ALARM_FAN4 (1L << 20) -#define ADM1026_ALARM_FAN5 (1L << 21) -#define ADM1026_ALARM_FAN6 (1L << 22) -#define ADM1026_ALARM_FAN7 (1L << 23) -#define ADM1026_ALARM_TEMP1 (1L << 24) -#define ADM1026_ALARM_IN10 (1L << 25) -#define ADM1026_ALARM_IN8 (1L << 26) -#define ADM1026_ALARM_THERM (1L << 27) -#define ADM1026_ALARM_AFC_FAN (1L << 28) -#define ADM1026_ALARM_UNUSED (1L << 29) -#define ADM1026_ALARM_CI (1L << 30) - - -#define ADM1031_ALARM_FAN1_MIN 0x0001 -#define ADM1031_ALARM_FAN1_FLT 0x0002 -#define ADM1031_ALARM_TEMP2_HIGH 0x0004 -#define ADM1031_ALARM_TEMP2_LOW 0x0008 -#define ADM1031_ALARM_TEMP2_CRIT 0x0010 -#define ADM1031_ALARM_TEMP2_DIODE 0x0020 -#define ADM1031_ALARM_TEMP1_HIGH 0x0040 -#define ADM1031_ALARM_TEMP1_LOW 0x0080 -#define ADM1031_ALARM_FAN2_MIN 0x0100 -#define ADM1031_ALARM_FAN2_FLT 0x0200 -#define ADM1031_ALARM_TEMP3_HIGH 0x0400 -#define ADM1031_ALARM_TEMP3_LOW 0x0800 -#define ADM1031_ALARM_TEMP3_CRIT 0x1000 -#define ADM1031_ALARM_TEMP3_DIODE 0x2000 -#define ADM1031_ALARM_TEMP1_CRIT 0x4000 -#define ADM1031_ALARM_THERMAL 0x8000 - - -#define ADM9240_ALARM_IN0 0x0001 -#define ADM9240_ALARM_IN1 0x0002 -#define ADM9240_ALARM_IN2 0x0004 -#define ADM9240_ALARM_IN3 0x0008 -#define ADM9240_ALARM_IN4 0x0100 -#define ADM9240_ALARM_IN5 0x0200 -#define ADM9240_ALARM_FAN1 0x0040 -#define ADM9240_ALARM_FAN2 0x0080 -#define ADM9240_ALARM_TEMP 0x0010 -#define ADM9240_ALARM_CHAS 0x1000 - - -#define ASB100_ALARM_IN0 0x0001 /* ? */ -#define ASB100_ALARM_IN1 0x0002 /* ? */ -#define ASB100_ALARM_IN2 0x0004 -#define ASB100_ALARM_IN3 0x0008 -#define ASB100_ALARM_TEMP1 0x0010 -#define ASB100_ALARM_TEMP2 0x0020 -#define ASB100_ALARM_FAN1 0x0040 -#define ASB100_ALARM_FAN2 0x0080 -#define ASB100_ALARM_IN4 0x0100 -#define ASB100_ALARM_IN5 0x0200 /* ? */ -#define ASB100_ALARM_IN6 0x0400 /* ? */ -#define ASB100_ALARM_FAN3 0x0800 -#define ASB100_ALARM_CHAS 0x1000 -#define ASB100_ALARM_TEMP3 0x2000 - -#define ASB100_ALARM_IN7 0x10000 /* ? */ -#define ASB100_ALARM_IN8 0x20000 /* ? */ - - -#define DS1621_ALARM_TEMP_HIGH 0x40 -#define DS1621_ALARM_TEMP_LOW 0x20 - - -#define GL518_ALARM_VDD 0x01 -#define GL518_ALARM_VIN1 0x02 -#define GL518_ALARM_VIN2 0x04 -#define GL518_ALARM_VIN3 0x08 -#define GL518_ALARM_TEMP 0x10 -#define GL518_ALARM_FAN1 0x20 -#define GL518_ALARM_FAN2 0x40 - - -#define GL520_ALARM_VDD 0x01 -#define GL520_ALARM_VIN1 0x02 -#define GL520_ALARM_VIN2 0x04 -#define GL520_ALARM_VIN3 0x08 -#define GL520_ALARM_TEMP1 0x10 -#define GL520_ALARM_FAN1 0x20 -#define GL520_ALARM_FAN2 0x40 -#define GL520_ALARM_TEMP2 0x80 -#define GL520_ALARM_VIN4 0x80 - - -#define IT87_ALARM_IN0 0x000100 -#define IT87_ALARM_IN1 0x000200 -#define IT87_ALARM_IN2 0x000400 -#define IT87_ALARM_IN3 0x000800 -#define IT87_ALARM_IN4 0x001000 -#define IT87_ALARM_IN5 0x002000 -#define IT87_ALARM_IN6 0x004000 -#define IT87_ALARM_IN7 0x008000 -#define IT87_ALARM_FAN1 0x0001 -#define IT87_ALARM_FAN2 0x0002 -#define IT87_ALARM_FAN3 0x0004 -#define IT87_ALARM_TEMP1 0x00010000 -#define IT87_ALARM_TEMP2 0x00020000 -#define IT87_ALARM_TEMP3 0x00040000 - - -#define LM63_ALARM_LOCAL_HIGH 0x40 -#define LM63_ALARM_REMOTE_HIGH 0x10 -#define LM63_ALARM_REMOTE_LOW 0x08 -#define LM63_ALARM_REMOTE_CRIT 0x02 -#define LM63_ALARM_REMOTE_OPEN 0x04 -#define LM63_ALARM_FAN_LOW 0x01 - - -#define LM78_ALARM_IN0 0x0001 -#define LM78_ALARM_IN1 0x0002 -#define LM78_ALARM_IN2 0x0004 -#define LM78_ALARM_IN3 0x0008 -#define LM78_ALARM_IN4 0x0100 -#define LM78_ALARM_IN5 0x0200 -#define LM78_ALARM_IN6 0x0400 -#define LM78_ALARM_FAN1 0x0040 -#define LM78_ALARM_FAN2 0x0080 -#define LM78_ALARM_FAN3 0x0800 -#define LM78_ALARM_TEMP 0x0010 -#define LM78_ALARM_BTI 0x0020 -#define LM78_ALARM_CHAS 0x1000 -#define LM78_ALARM_FIFO 0x2000 -#define LM78_ALARM_SMI_IN 0x4000 - - -#define LM80_ALARM_IN0 0x0001 -#define LM80_ALARM_IN1 0x0002 -#define LM80_ALARM_IN2 0x0004 -#define LM80_ALARM_IN3 0x0008 -#define LM80_ALARM_IN4 0x0010 -#define LM80_ALARM_IN5 0x0020 -#define LM80_ALARM_IN6 0x0040 -#define LM80_ALARM_FAN1 0x0400 -#define LM80_ALARM_FAN2 0x0800 -#define LM80_ALARM_TEMP_HOT 0x0100 -#define LM80_ALARM_TEMP_OS 0x2000 -#define LM80_ALARM_CHAS 0x1000 -#define LM80_ALARM_BTI 0x0200 -#define LM80_ALARM_INT_IN 0x0080 - - -#define LM83_ALARM_LOCAL_HIGH 0x0040 -#define LM83_ALARM_LOCAL_CRIT 0x0001 -#define LM83_ALARM_REMOTE1_HIGH 0x8000 -#define LM83_ALARM_REMOTE1_CRIT 0x0100 -#define LM83_ALARM_REMOTE1_OPEN 0x2000 -#define LM83_ALARM_REMOTE2_HIGH 0x0010 -#define LM83_ALARM_REMOTE2_CRIT 0x0002 -#define LM83_ALARM_REMOTE2_OPEN 0x0004 -#define LM83_ALARM_REMOTE3_HIGH 0x1000 -#define LM83_ALARM_REMOTE3_CRIT 0x0200 -#define LM83_ALARM_REMOTE3_OPEN 0x0400 - - -#define LM85_ALARM_IN0 0x0001 -#define LM85_ALARM_IN1 0x0002 -#define LM85_ALARM_IN2 0x0004 -#define LM85_ALARM_IN3 0x0008 -#define LM85_ALARM_TEMP1 0x0010 -#define LM85_ALARM_TEMP2 0x0020 -#define LM85_ALARM_TEMP3 0x0040 -#define LM85_ALARM_ALARM2 0x0080 -#define LM85_ALARM_IN4 0x0100 -#define LM85_ALARM_RESERVED 0x0200 -#define LM85_ALARM_FAN1 0x0400 -#define LM85_ALARM_FAN2 0x0800 -#define LM85_ALARM_FAN3 0x1000 -#define LM85_ALARM_FAN4 0x2000 -#define LM85_ALARM_TEMP1_FAULT 0x4000 -#define LM85_ALARM_TEMP3_FAULT 0x08000 -#define LM85_ALARM_IN6 0x10000 -#define LM85_ALARM_IN7 0x20000 -#define LM85_ALARM_IN5 0x40000 - - -#define LM87_ALARM_IN0 0x0001 -#define LM87_ALARM_IN1 0x0002 -#define LM87_ALARM_IN2 0x0004 -#define LM87_ALARM_IN3 0x0008 -#define LM87_ALARM_TEMP1 0x0010 -#define LM87_ALARM_TEMP2 0x0020 -#define LM87_ALARM_TEMP3 0x0020 /* same?? */ -#define LM87_ALARM_FAN1 0x0040 -#define LM87_ALARM_FAN2 0x0080 -#define LM87_ALARM_IN4 0x0100 -#define LM87_ALARM_IN5 0x0200 -#define LM87_ALARM_RESERVED1 0x0400 -#define LM87_ALARM_RESERVED2 0x0800 -#define LM87_ALARM_CHAS 0x1000 -#define LM87_ALARM_THERM_SIG 0x2000 -#define LM87_ALARM_TEMP2_FAULT 0x4000 -#define LM87_ALARM_TEMP3_FAULT 0x08000 - - -#define LM90_ALARM_LOCAL_HIGH 0x40 -#define LM90_ALARM_LOCAL_LOW 0x20 -#define LM90_ALARM_LOCAL_CRIT 0x01 -#define LM90_ALARM_REMOTE_HIGH 0x10 -#define LM90_ALARM_REMOTE_LOW 0x08 -#define LM90_ALARM_REMOTE_CRIT 0x02 -#define LM90_ALARM_REMOTE_OPEN 0x04 - - -#define LM92_ALARM_TEMP_HIGH 0x01 -#define LM92_ALARM_TEMP_LOW 0x02 -#define LM92_ALARM_TEMP_CRIT 0x04 -#define LM92_TEMP_HIGH 0x08 -#define LM92_TEMP_LOW 0x10 -#define LM92_TEMP_CRIT 0x20 -#define LM92_TEMP_HYST 0x40 -#define LM92_TEMP_INPUT 0x80 - - -/* alarm bitmask definitions - The LM93 has nearly 64 bits of error status... I've pared that down to - what I think is a useful subset in order to fit it into 32 bits. - - Especially note that the #VRD_HOT alarms are missing because we provide - that information as values in another /proc file. - - If libsensors is extended to support 64 bit values, this could be revisited. -*/ -#define LM93_ALARM_IN1 0x00000001 -#define LM93_ALARM_IN2 0x00000002 -#define LM93_ALARM_IN3 0x00000004 -#define LM93_ALARM_IN4 0x00000008 -#define LM93_ALARM_IN5 0x00000010 -#define LM93_ALARM_IN6 0x00000020 -#define LM93_ALARM_IN7 0x00000040 -#define LM93_ALARM_IN8 0x00000080 -#define LM93_ALARM_IN9 0x00000100 -#define LM93_ALARM_IN10 0x00000200 -#define LM93_ALARM_IN11 0x00000400 -#define LM93_ALARM_IN12 0x00000800 -#define LM93_ALARM_IN13 0x00001000 -#define LM93_ALARM_IN14 0x00002000 -#define LM93_ALARM_IN15 0x00004000 -#define LM93_ALARM_IN16 0x00008000 -#define LM93_ALARM_FAN1 0x00010000 -#define LM93_ALARM_FAN2 0x00020000 -#define LM93_ALARM_FAN3 0x00040000 -#define LM93_ALARM_FAN4 0x00080000 -#define LM93_ALARM_PH1_ERR 0x00100000 -#define LM93_ALARM_PH2_ERR 0x00200000 -#define LM93_ALARM_SCSI1_ERR 0x00400000 -#define LM93_ALARM_SCSI2_ERR 0x00800000 -#define LM93_ALARM_DVDDP1_ERR 0x01000000 -#define LM93_ALARM_DVDDP2_ERR 0x02000000 -#define LM93_ALARM_D1_ERR 0x04000000 -#define LM93_ALARM_D2_ERR 0x08000000 -#define LM93_ALARM_TEMP1 0x10000000 -#define LM93_ALARM_TEMP2 0x20000000 -#define LM93_ALARM_TEMP3 0x40000000 - - -#define MAX1619_ALARM_REMOTE_THIGH 0x10 -#define MAX1619_ALARM_REMOTE_TLOW 0x08 -#define MAX1619_ALARM_REMOTE_OPEN 0x04 -#define MAX1619_ALARM_REMOTE_OVERT 0x02 - - -#define MAXI_ALARM_VID4 0x0001 -#define MAXI_ALARM_TEMP2 0x0002 -#define MAXI_ALARM_VID1 0x0004 -#define MAXI_ALARM_VID2 0x0008 -#define MAXI_ALARM_VID3 0x0010 -#define MAXI_ALARM_PLL 0x0080 -#define MAXI_ALARM_TEMP4 0x0100 -#define MAXI_ALARM_TEMP5 0x0200 -#define MAXI_ALARM_FAN1 0x1000 -#define MAXI_ALARM_FAN2 0x2000 -#define MAXI_ALARM_FAN3 0x4000 - -#define MAXI_ALARM_FAN 0x0100 /* To be used with MaxiLife'99 */ -#define MAXI_ALARM_VID 0x0200 /* The MSB specifies which sensor */ -#define MAXI_ALARM_TEMP 0x0400 /* in the alarm group failed, i.e.: */ -#define MAXI_ALARM_VADD 0x0800 /* 0x0402 = TEMP2 failed = CPU2 temp */ - - -#define MTP008_ALARM_IN0 0x0001 -#define MTP008_ALARM_IN1 0x0002 -#define MTP008_ALARM_IN2 0x0004 -#define MTP008_ALARM_IN3 0x0008 -#define MTP008_ALARM_IN4 0x0100 -#define MTP008_ALARM_IN5 0x0200 -#define MTP008_ALARM_IN6 0x0400 -#define MTP008_ALARM_FAN1 0x0040 -#define MTP008_ALARM_FAN2 0x0080 -#define MTP008_ALARM_FAN3 0x0800 -#define MTP008_ALARM_TEMP1 0x0010 -#define MTP008_ALARM_TEMP2 0x0100 -#define MTP008_ALARM_TEMP3 0x0200 - - -#define PC87360_STATUS_FAN_READY 0x01 -#define PC87360_STATUS_FAN_LOW 0x02 -#define PC87360_STATUS_FAN_OVERFLOW 0x04 - -#define PC87365_STATUS_IN_MIN 0x02 -#define PC87365_STATUS_IN_MAX 0x04 - -#define PC87365_STATUS_TEMP_MIN 0x02 -#define PC87365_STATUS_TEMP_MAX 0x04 -#define PC87365_STATUS_TEMP_CRIT 0x08 -#define PC87365_STATUS_TEMP_OPEN 0x40 - - -#define SIS5595_ALARM_IN0 0x01 -#define SIS5595_ALARM_IN1 0x02 -#define SIS5595_ALARM_IN2 0x04 -#define SIS5595_ALARM_IN3 0x08 -#define SIS5595_ALARM_BTI 0x20 -#define SIS5595_ALARM_FAN1 0x40 -#define SIS5595_ALARM_FAN2 0x80 -#define SIS5595_ALARM_IN4 0x8000 -#define SIS5595_ALARM_TEMP 0x8000 - - -/* * * * * * Alarm Bits * * * * */ -#define SMARTBATT_OVER_CHARGED_ALARM 0x8000 -#define SMARTBATT_TERMINATE_CHARGE_ALARM 0x4000 -#define SMARTBATT_OVER_TEMP_ALARM 0x1000 -#define SMARTBATT_TERMINATE_DISCHARGE_ALARM 0x0800 -#define SMARTBATT_REMAINING_CAPACITY_ALARM 0x0200 -#define SMARTBATT_REMAINING_TIME_ALARM 0x0100 -/* * * * * * Status Bits * * * * */ -#define SMARTBATT_INITIALIZED 0x0080 -#define SMARTBATT_DISCHARGING 0x0040 -#define SMARTBATT_FULLY_CHARGED 0x0020 -#define SMARTBATT_FULLY_DISCHARGED 0x0010 -/* * * * * * Error Bits * * * * */ -#define SMARTBATT_OK 0x0000 -#define SMARTBATT_BUSY 0x0001 -#define SMARTBATT_RESERVED_COMMAND 0x0002 -#define SMARTBATT_UNSUPPORTED_COMMAND 0x0003 -#define SMARTBATT_ACCESS_DENIED 0x0004 -#define SMARTBATT_OVER_UNDERFLOW 0x0005 -#define SMARTBATT_BAD_SIZE 0x0006 -#define SMARTBATT_UNKNOWN_ERROR 0x0007 - -#define SMARTBATT_ALARM (SMARTBATT_OVER_CHARGED_ALARM \ - | SMARTBATT_TERMINATE_CHARGE_ALARM | SMARTBATT_OVER_TEMP_ALARM \ - | SMARTBATT_TERMINATE_DISCHARGE_ALARM \ - | SMARTBATT_REMAINING_CAPACITY_ALARM \ - | SMARTBATT_REMAINING_TIME_ALARM) - -#define SMARTBATT_STATUS (SMARTBATT_INITIALIZED | SMARTBATT_DISCHARGING \ - | SMARTBATT_FULLY_CHARGED | SMARTBATT_FULLY_DISCHARGED ) - -#define SMARTBATT_ERROR (SMARTBATT_BUSY | SMARTBATT_RESERVED_COMMAND \ - | SMARTBATT_UNSUPPORTED_COMMAND | SMARTBATT_ACCESS_DENIED \ - | SMARTBATT_OVER_UNDERFLOW | SMARTBATT_BAD_SIZE\ - | SMARTBATT_UNKNOWN_ERROR) - - -#define SMSC47M1_ALARM_FAN1 0x0001 -#define SMSC47M1_ALARM_FAN2 0x0002 -#define SMSC47M1_ALARM_FAN3 0x0004 - - -#define VIA686A_ALARM_IN0 0x01 -#define VIA686A_ALARM_IN1 0x02 -#define VIA686A_ALARM_IN2 0x04 -#define VIA686A_ALARM_IN3 0x08 -#define VIA686A_ALARM_TEMP 0x10 -#define VIA686A_ALARM_FAN1 0x40 -#define VIA686A_ALARM_FAN2 0x80 -#define VIA686A_ALARM_IN4 0x100 -#define VIA686A_ALARM_TEMP2 0x800 -#define VIA686A_ALARM_CHAS 0x1000 -#define VIA686A_ALARM_TEMP3 0x8000 - - -#define VT1211_ALARM_IN1 0x01 -#define VT1211_ALARM_IN2 0x02 -#define VT1211_ALARM_IN5 0x04 -#define VT1211_ALARM_IN3 0x08 -#define VT1211_ALARM_TEMP1 0x10 -#define VT1211_ALARM_FAN1 0x40 -#define VT1211_ALARM_FAN2 0x80 -#define VT1211_ALARM_IN4 0x100 -#define VT1211_ALARM_TEMP3 0x800 -#define VT1211_ALARM_CHAS 0x1000 -#define VT1211_ALARM_TEMP2 0x8000 -/* duplicates */ -#define VT1211_ALARM_IN0 VT1211_ALARM_TEMP3 -#define VT1211_ALARM_TEMP4 VT1211_ALARM_IN1 -#define VT1211_ALARM_TEMP5 VT1211_ALARM_IN2 -#define VT1211_ALARM_TEMP6 VT1211_ALARM_IN3 -#define VT1211_ALARM_TEMP7 VT1211_ALARM_IN4 - - -#define VT8231_ALARM_IN1 0x01 -#define VT8231_ALARM_IN2 0x02 -#define VT8231_ALARM_IN5 0x04 -#define VT8231_ALARM_IN3 0x08 -#define VT8231_ALARM_TEMP 0x10 -#define VT8231_ALARM_FAN1 0x40 -#define VT8231_ALARM_FAN2 0x80 -#define VT8231_ALARM_IN4 0x100 -#define VT8231_ALARM_TEMP2 0x800 -#define VT8231_ALARM_CHAS 0x1000 -/* duplicates */ -#define VT8231_ALARM_IN0 VT8231_ALARM_TEMP2 -#define VT8231_ALARM_TEMP3 VT8231_ALARM_IN1 -#define VT8231_ALARM_TEMP4 VT8231_ALARM_IN2 -#define VT8231_ALARM_TEMP5 VT8231_ALARM_IN3 -#define VT8231_ALARM_TEMP6 VT8231_ALARM_IN4 - - -#define W83781D_ALARM_IN0 0x0001 -#define W83781D_ALARM_IN1 0x0002 -#define W83781D_ALARM_IN2 0x0004 -#define W83781D_ALARM_IN3 0x0008 -#define W83781D_ALARM_IN4 0x0100 -#define W83781D_ALARM_IN5 0x0200 -#define W83781D_ALARM_IN6 0x0400 -#define W83782D_ALARM_IN7 0x10000 -#define W83782D_ALARM_IN8 0x20000 -#define W83791D_ALARM_IN7 0x080000 /* 791D only */ -#define W83791D_ALARM_IN8 0x100000 /* 791D only */ -#define W83791D_ALARM_IN9 0x004000 /* 791D only */ -#define W83781D_ALARM_FAN1 0x0040 -#define W83781D_ALARM_FAN2 0x0080 -#define W83781D_ALARM_FAN3 0x0800 -#define W83791D_ALARM_FAN4 0x200000 /* 791D only */ -#define W83791D_ALARM_FAN5 0x400000 /* 791D only */ -#define W83781D_ALARM_TEMP1 0x0010 -#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */ -#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S/791D */ -#define W83781D_ALARM_TEMP3 0x2000 /* 782D/791D */ -#define W83781D_ALARM_CHAS 0x1000 /* 782D/791D */ - -#define W83791D_BEEP_IN1 0x002000 /* 791D only */ -#define W83791D_BEEP_IN7 0x010000 /* 791D only */ -#define W83791D_BEEP_IN8 0x020000 /* 791D only */ -#define W83791D_BEEP_TEMP3 0x000002 /* 791D only */ - - -#define W83792D_ALARM_IN0 0x0001 -#define W83792D_ALARM_IN1 0x0002 -#define W83792D_ALARM_IN2 0x0100 -#define W83792D_ALARM_IN3 0x0200 -#define W83792D_ALARM_IN4 0x0400 -#define W83792D_ALARM_IN5 0x0800 -#define W83792D_ALARM_IN6 0x1000 -#define W83792D_ALARM_IN7 0x80000 -#define W83792D_ALARM_IN8 0x100000 -#define W83792D_ALARM_TEMP1 0x0004 -#define W83792D_ALARM_TEMP2 0x0008 -#define W83792D_ALARM_TEMP3 0x0010 -#define W83792D_ALARM_FAN1 0x0020 -#define W83792D_ALARM_FAN2 0x0040 -#define W83792D_ALARM_FAN3 0x0080 -#define W83792D_ALARM_FAN4 0x200000 -#define W83792D_ALARM_FAN5 0x400000 -#define W83792D_ALARM_FAN6 0x800000 -#define W83792D_ALARM_FAN7 0x8000 - - -#define XEONTEMP_ALARM_RTEMP_HIGH 0x10 -#define XEONTEMP_ALARM_RTEMP_LOW 0x08 -#define XEONTEMP_ALARM_RTEMP_NA 0x04 - -#endif From 0bca3703a14e3b83298508e1df50baad46dbc0b2 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 29 Jun 2007 07:59:17 +0000 Subject: [PATCH 092/718] Update ignore lists. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4516 7894878c-1315-0410-8ee3-d5d059ff63e0 From c1319becae5860a4498bf90ca3a8fa8e828b1f14 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 29 Jun 2007 08:13:18 +0000 Subject: [PATCH 093/718] Drop references to nonexistent Makefile variables. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4517 7894878c-1315-0410-8ee3-d5d059ff63e0 --- INSTALL | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/INSTALL b/INSTALL index 65e36bc6..8020648e 100644 --- a/INSTALL +++ b/INSTALL @@ -103,21 +103,9 @@ patched by your distribution. Compilation =========== -This will compile and install the complete lm_sensors package. Though -nothing is written to your kernel tree, a proper tree is still needed -for this. See earlier for what a proper kernel tree is. - -At the top of the Makefile are a couple of configuration variables that -you may want to change. As far as possible, the Makefile tries to figure -out by itself their settings, but it is possible to overrule them. A list -is found below. Most important are the variables that determine where -your kernel is located (LINUX=/lib/modules/KERNELVERSION/build, usually -links to /usr/src/linux or something similar), where the i2c header files -are (I2C_HEADERS=/usr/local/include) and where you want to install -your modules (MODDIR=/lib/modules/KERNELVERSION) and header files -(LINUX_INCLUDE_DIR=/usr/local/include/linux). You can see that the -installation locations are choosen in such a way that they are separate -from the true kernel. +This will compile and install the complete lm_sensors package. At the +top of the Makefile are a couple of configuration variables that you may +want to change. A list is found below. Compilation is done by `make all'; `make install' installs the package. You will get a lot of warnings about files which are not found, all @@ -134,25 +122,6 @@ SHELL (default: /bin/sh) You may have to specify the full path to Bash here, if /bin/sh is some other shell. There have been conflicting reports on whether this is needed. -KERNELVERSION - The version of the currently running kernel. -LINUX (default: /lib/modules/$(KERNELVERSION)/build) - The location of your kernel tree. -I2C_HEADERS (default: /usr/local/include) - This lists where the i2c headers are found. If you used compilation - option 1 for the i2c package, the default will be right. If you used - compilation options 2 or 3, it will not, and may actually cause - problems if you have the left-overs of a previous installation. - If you have weird compilation problems, try to change this to - $(LINUX_HEADERS). -SMP - This must be set to 1 for a SMP kernel. The magic invocation should - determine this automatically, so you should not have to bother with - this. -MODVER - This must be set to 1 if CONFIG_MODVERSIONS is defined. The magic - invocation should determine this automatically, so you should not - have to bother with this. WARN (default: 0) Generate additional compilation warnings; mainly interesting for developers. @@ -162,8 +131,6 @@ DEBUG (default: 0) so by the lm_sensors team. PREFIX (default: /usr/local) Prefix for almost all installation directories. -MODPREF (default: /lib/modules/$(KERNELVERSION)) - The location where the kernel modules will be installed. ETCDIR (default: /etc) Installation location of the sensors.conf configuration file. LIBDIR (default: $(PREFIX)/lib) @@ -178,10 +145,6 @@ LIBINCLUDEDIR (default: $(INCLUDEDIR)/sensors) Installation directory for libsensors include files. MANDIR (default: $(PREFIX)/man) Base installation directory for manual pages. -MANOWN (default: root) - Owner of manual pages. -MANGRP (default: root) - Group of manual pages. Using the sensors package From 1de056f9bf4088a50cb7a971f081cbb0aa7b31e6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 29 Jun 2007 08:16:24 +0000 Subject: [PATCH 094/718] Negative magnitudes are no longer supported. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4518 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/data.h b/lib/data.h index 8bf40499..3be0a485 100644 --- a/lib/data.h +++ b/lib/data.h @@ -134,9 +134,7 @@ typedef struct sensors_bus { SENSORS_MODE_RW, for unaccessible, readable, writable, and both readable and writable. scaling is the number of decimal points to scale by. - Divide the read value by 10**scaling to get the real value. - Scaling can be positive or negative but negative values aren't - very useful because the driver can scale that direction itself. */ + Divide the read value by 10**scaling to get the real value. */ typedef struct sensors_chip_feature { sensors_feature_data data; int scaling; From 0c46611b209eaf146e5594a4d94b48b1f7a593f9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 29 Jun 2007 08:21:38 +0000 Subject: [PATCH 095/718] Drop two unused macros. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4519 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/access.c b/lib/access.c index c3f81da1..a00347f5 100644 --- a/lib/access.c +++ b/lib/access.c @@ -30,11 +30,6 @@ #define GET_TYPE_REGEX "\\([[:alpha:]]\\{1,\\}\\)[[:digit:]]\\{0,\\}\\(_\\([[:alpha:]]\\{1,\\}\\)\\)\\{0,1\\}" -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (const char *)__mptr - offsetof(type,member) );}) - static int sensors_do_this_chip_sets(sensors_chip_name name); /* Compare two chips name descriptions, to see whether they could match. From 78d905354778746f221be6b8063b485974f7684f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 29 Jun 2007 11:46:20 +0000 Subject: [PATCH 096/718] There are no sensor* sysfs files. The VID value is in cpu*_vid, not vid. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4520 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/access.c b/lib/access.c index a00347f5..1403c3e2 100644 --- a/lib/access.c +++ b/lib/access.c @@ -535,13 +535,17 @@ static struct feature_type_match fan_matches[] = { { 0 } }; +static struct feature_type_match cpu_matches[] = { + { "vid", SENSORS_FEATURE_VID }, + { 0 } +}; + static struct feature_type_match matches[] = { { "temp", SENSORS_FEATURE_TEMP, temp_matches }, { "in", SENSORS_FEATURE_IN, in_matches }, { "fan", SENSORS_FEATURE_FAN, fan_matches }, + { "cpu", SENSORS_FEATURE_UNKNOWN, cpu_matches }, { "vrm", SENSORS_FEATURE_VRM, 0 }, - { "vid", SENSORS_FEATURE_VID, 0 }, - { "sensor", SENSORS_FEATURE_TEMP_SENS, 0 }, { 0 } }; From e780d22d03889b3a7b2aa9a1987c14e6f1bb62a0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 29 Jun 2007 12:11:43 +0000 Subject: [PATCH 097/718] Simplify the code setting the feature mode. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4521 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 3ebe22b5..1f39d88e 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -165,12 +165,10 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, feature.data.compute_mapping = feature.data.mapping; } - feature.data.mode = - (attr->method & (SYSFS_METHOD_SHOW|SYSFS_METHOD_STORE)) - == (SYSFS_METHOD_SHOW|SYSFS_METHOD_STORE) ? - SENSORS_MODE_RW : (attr->method & SYSFS_METHOD_SHOW) ? - SENSORS_MODE_R : (attr->method & SYSFS_METHOD_STORE) ? - SENSORS_MODE_W : SENSORS_MODE_NO_RW; + if (attr->method & SYSFS_METHOD_SHOW) + feature.data.mode |= SENSORS_MODE_R; + if (attr->method & SYSFS_METHOD_STORE) + feature.data.mode |= SENSORS_MODE_W; feature.scaling = get_type_scaling(type); From cc1700958bf846e2c722a6f486e20bdf128b7432 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 29 Jun 2007 12:30:58 +0000 Subject: [PATCH 098/718] Fix the description of the mode field. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4525 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/libsensors.3 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/libsensors.3 b/lib/libsensors.3 index c5c22991..b0295b9a 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -125,11 +125,9 @@ This structure is used when you want to get all features of a specific chip. .br } sensors_feature_data;\fP .br -The field sensors_feature_data can be one of: +The mode field can be one of: .br -SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W, -.br -SENSORS_MODE_RW or SENSORS_NO_MAPPING. +SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W or SENSORS_MODE_RW. \fBconst sensors_feature_data *sensors_get_all_features (sensors_chip_name name, int *nr1,int *nr2);\fP From 1ba9c1837dbd0683bcb8ad4e482d1bb605189cf4 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 30 Jun 2007 13:40:40 +0000 Subject: [PATCH 099/718] Delete the matorb support script. The matorb driver was never ported to Linux 2.6, and has nothing to do with sensors anyway. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4526 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + doc/chips/SUMMARY | 3 --- doc/progs | 3 --- prog/matorb/displayit.pl | 32 -------------------------------- 4 files changed, 1 insertion(+), 38 deletions(-) delete mode 100755 prog/matorb/displayit.pl diff --git a/CHANGES b/CHANGES index c69e30a6..e54c9796 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,7 @@ SVN HEAD Program i2cdump: Use the new I2C block read function Program isadump: Detect when address bit 7 is a busy flag Fix Super-I/O exit sequence for Winbond/Fintek chips + Program matorb/displayit: Delete, obsolete Program mkpatch: Delete Program fancontrol: Use let for arithmetic evaluation No longer need awk and grep diff --git a/doc/chips/SUMMARY b/doc/chips/SUMMARY index ca5afe4e..dabf5380 100644 --- a/doc/chips/SUMMARY +++ b/doc/chips/SUMMARY @@ -288,9 +288,6 @@ eeprom ltc1710 ltc1710 two switches only -matorb - Matrix Orbital LCD displays - pca9540 2-channel I2C multiplexer diff --git a/doc/progs b/doc/progs index a583dca9..70969930 100644 --- a/doc/progs +++ b/doc/progs @@ -40,9 +40,6 @@ see useful_addresses.html. A SysV init script to be installed in /etc/rc.d/init.d/ It inserts the bus and chip modules and starts the sensord daemon. -* prog/matorb/displayit.pl (written in Perl, not installed) - A simple Perl script to display a 'screen' on a Matrix Orbital Display. - * prog/maxilife/sysinfo.sh (written in shell, not installed) Write system information to the HP Maxilife LCD display using writelcd.sh. diff --git a/prog/matorb/displayit.pl b/prog/matorb/displayit.pl deleted file mode 100755 index 0af5ce48..00000000 --- a/prog/matorb/displayit.pl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/perl - -# This is a simple perl script to display a 'screen' -# on a Matrix Orbital Display. In this case, this -# script will read the first four lines (up to 20 -# chars a line) and display them on the display. - -# Written and copywritten (C) by Philip Edelbrock, 1999. - - -# Turn off the blinking cursor -$temp=`echo "254 84" > /proc/sys/dev/sensors/matorb*/disp`; - -$linenum=1; - -while () { - # Reset the position of the cursor to the next line - $temp=`echo "254 71 1 $linenum" > /proc/sys/dev/sensors/matorb*/disp`; - chop; - $_="$_ "; - if (/^(.{1,20})/) { - $_=$1; - $line=""; - while (/(.)/gc) { - $temp=ord($1); - $line="$line $temp"; - } - $temp=`echo "$line" > /proc/sys/dev/sensors/matorb*/disp`; - } - $linenum+=1; - if ($linenum > 4) { exit; } -} From f19c717fa4a791fecc9bdb8aca4f390a0e16de7f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 30 Jun 2007 14:44:37 +0000 Subject: [PATCH 100/718] The EEPROM decoding scripts have moved to the i2c-tools package. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4527 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/FAQ | 2 +- doc/lm_sensors-FAQ.html | 2 +- doc/lm_sensors-FAQ.texi | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/FAQ b/doc/FAQ index e2e359b8..a4bf497a 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -1248,7 +1248,7 @@ eeprom support for all Linux 2.6 kernels, as it didn't fit well in the library code in the first place. Note that you can still obtain information about your EEPROMs by -using the dedicated perl scripts in `prog/eeprom': `ddcmon', +using the dedicated perl scripts in the i2c-tools package: `ddcmon', `decode-dimms.pl', `decode-edid.pl' and `decode-vaio.pl'. 5 How to Ask for Help diff --git a/doc/lm_sensors-FAQ.html b/doc/lm_sensors-FAQ.html index 6ba58d4c..4e75fe2a 100644 --- a/doc/lm_sensors-FAQ.html +++ b/doc/lm_sensors-FAQ.html @@ -1872,7 +1872,7 @@ eeprom support for all Linux 2.6 kernels, as it didn't fit well in the library code in the first place.

    Note that you can still obtain information about your EEPROMs by using -the dedicated perl scripts in prog/eeprom: ddcmon, +the dedicated perl scripts in the i2c-tools package: ddcmon, decode-dimms.pl, decode-edid.pl and decode-vaio.pl. diff --git a/doc/lm_sensors-FAQ.texi b/doc/lm_sensors-FAQ.texi index ada3d3e3..202c060a 100644 --- a/doc/lm_sensors-FAQ.texi +++ b/doc/lm_sensors-FAQ.texi @@ -1281,7 +1281,7 @@ eeprom support for all Linux 2.6 kernels, as it didn't fit well in the library code in the first place. Note that you can still obtain information about your EEPROMs by using -the dedicated perl scripts in @file{prog/eeprom}: @command{ddcmon}, +the dedicated perl scripts in the i2c-tools package: @command{ddcmon}, @command{decode-dimms.pl}, @command{decode-edid.pl} and @command{decode-vaio.pl}. From efcbddfb6b480838d868cd627177794d870ed080 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 30 Jun 2007 14:51:51 +0000 Subject: [PATCH 101/718] The EEPROM decoding scripts have moved to the i2c-tools package (part 2). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4528 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/FAQ | 7 +++---- doc/lm_sensors-FAQ.html | 6 +++--- doc/lm_sensors-FAQ.texi | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/FAQ b/doc/FAQ index a4bf497a..64d088bc 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -1035,10 +1035,9 @@ chips, and you should do too. You have been warned. 4.23.2 What is at I2C addresses 0x50 - 0x57? -------------------------------------------- -EEPROMs on your SDRAM DIMMs. Load the eeprom module to look at some -basic data in `sensors' or use the program -`prog/eeprom/decode-dimms.pl' to get more information than you ever -wanted. +EEPROMs on your SDRAM DIMMs. Load the eeprom module and use the script +`decode-dimms.pl' (in the i2c-tools package) to get more information +than you ever wanted. 4.23.3 What is at I2C addresses 0x30 - 0x37? -------------------------------------------- diff --git a/doc/lm_sensors-FAQ.html b/doc/lm_sensors-FAQ.html index 4e75fe2a..dcc3c65d 100644 --- a/doc/lm_sensors-FAQ.html +++ b/doc/lm_sensors-FAQ.html @@ -1582,9 +1582,9 @@ avoids these chips, and you should do too. You have been warned.

    4.23.2 What is at I2C addresses 0x50 - 0x57?

    -

    EEPROMs on your SDRAM DIMMs. Load the eeprom module to -look at some basic data in sensors or use the program -prog/eeprom/decode-dimms.pl to get more information than you ever wanted. +

    EEPROMs on your SDRAM DIMMs. Load the eeprom module and use the script +decode-dimms.pl (in the i2c-tools package) +to get more information than you ever wanted.

    diff --git a/doc/lm_sensors-FAQ.texi b/doc/lm_sensors-FAQ.texi index 202c060a..1f1a2fff 100644 --- a/doc/lm_sensors-FAQ.texi +++ b/doc/lm_sensors-FAQ.texi @@ -1069,9 +1069,9 @@ avoids these chips, and you should do too. You have been warned. @anchor{What is at I2C addresses 0x50 - 0x57} @subsection What is at I2C addresses 0x50 - 0x57? -EEPROMs on your SDRAM DIMMs. Load the eeprom module to -look at some basic data in @command{sensors} or use the program -@command{prog/eeprom/decode-dimms.pl} to get more information than you ever wanted. +EEPROMs on your SDRAM DIMMs. Load the eeprom module and use the script +@command{decode-dimms.pl} (in the i2c-tools package) +to get more information than you ever wanted. @anchor{What is at I2C addresses 0x30 - 0x37} From 8c92ac10961d5a0f5c0e4755b28400c74f040830 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 30 Jun 2007 15:21:46 +0000 Subject: [PATCH 102/718] Drop all references to non-sensor chips. We will still detect some of these (in particular SPD and EDID EEPROMS) at addresses where hardware monitoring chips are known to live, to prevent misdetections, but we no longer point the user to drivers for these chips. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4529 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CONTRIBUTORS | 9 +- README | 12 +- doc/chips/SUMMARY | 45 +------ doc/useful_addresses.html | 7 - prog/detect/sensors-detect | 263 +++---------------------------------- 5 files changed, 25 insertions(+), 311 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 7a802016..08076c35 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -32,8 +32,7 @@ suggestions or problems. Added lm81 support to the adm9240 driver. Added DDC support and i2c-algo-bit layer to the i2c-voodoo3 bus driver. Added the RRD interface. - Author of the ddcmon, icspll, smbus-arp, smsc47m1, - vt1211, and vt8231 chip drivers. + Author of the smsc47m1, vt1211, and vt8231 chip drivers. * Bob Dougherty Author (with MDS) of the via686a driver. * Jonathan Teh Soon Yew and Alex van Kaam @@ -70,7 +69,7 @@ suggestions or problems. * Aurelien Jarno Author of the pcf8591 driver. * Abraham vd Merwe - Author of the LM92 and DS1307 drivers. + Author of the LM92 driver. * Mark M. Hoffman Author of the i2c-sis645 bus driver. Added Asus ASB100 Bach support to the w83781d driver. @@ -80,7 +79,7 @@ suggestions or problems. * Jean Delvare Author of the lm63, lm83, lm90 and w83l785ts SMBus chip drivers. Author of the f71805f and pc87360 Super-I/O chip drivers. - Author of the i2c-amd756-s4882 and pca9540 SMBus multiplexing drivers. + Author of the i2c-amd756-s4882 SMBus multiplexing driver. Perl scripts maintainer, tester, bug fixer, general support. * Vojtech Pavlik Author of the i2c-amd8111 bus driver. @@ -88,8 +87,6 @@ suggestions or problems. * Philip Pokorny Author of the LM85 chip driver. Author of the ADM1026 chip driver. -* Sascha Volkenandt - Author of the SAA1064 chip driver. * John Morris Author of the MAX6650 chip driver. * Reinhard Nissl diff --git a/README b/README index 8ba5687d..a8f04411 100644 --- a/README +++ b/README @@ -62,25 +62,15 @@ At least the following hardware sensor chips are supported: LM80, LM81, LM82, LM83, LM84, LM85, LM86, LM87, LM89, LM90, LM92, LM93, LM99, PC87360, PC87363, PC87364, PC87365, PC87366 - Philips NE1617, NE1617A, NE1619 + Philips NE1617, NE1617A, NE1619, PCF8591 SiS 5595, 950 embedded sensors SMSC 47M1xx embedded sensors, EMC6D100, EMC6D101, EMC6D102 TI THMC10 and THMC50 VIA Technologies VT1211, VT8231 and VT82C686A/B embedded sensors Winbond W83781D, W83782D, W83783S, W83791D, W83792D, W83627HF, W83627THF, W83637HF, W83687THF and W83697HF - - -We also support some miscellaneous chips: - Dallas DS1307 real time clock - Intel Xeon processor embedded EEPROMs - Linear Technologies LTC1710 - Philips Semiconductors PCF8574, PCF8591 - DDC Monitor embedded EEPROMs - SDRAM Dimms with Serial Presence Detect EEPROMs Smart Battery sensors IPMI-BMC sensors - Philips Semiconductors SAA1064 The list above may be out of date; diff --git a/doc/chips/SUMMARY b/doc/chips/SUMMARY index dabf5380..c3900b00 100644 --- a/doc/chips/SUMMARY +++ b/doc/chips/SUMMARY @@ -204,6 +204,9 @@ pc87360 pc87365 2 11 3 3 pwm no yes (LPC) pc87366 3-4 11 3 3 pwm no yes (LPC) +pcf8591 + pcf8591 - 2-4 - 1 dac yes no + sis5595 sis5595 0-1 4-5 2 - no yes @@ -262,48 +265,6 @@ xeontemp xeontemp 1 - - - yes no - -SUPPORTED NON-SENSOR CHIPS --------------------------- - -Driver Chips ------- ----- - -bmcsensors - An interface to an IPMI BMC (Baseboard management controller) - -bt869 - bt869 video modulator chip - -ddcmon - DDC-compliant monitor integrated eeproms - reads locations only - -ds1307 - real-time clock - -eeprom - Memory SPD (serial presence detect) eeproms - reads locations only - Xeon scratch eeproms - reads locations only - -ltc1710 - ltc1710 two switches only - -pca9540 - 2-channel I2C multiplexer - -pcf8574 & pcf8574a - Simple eight-bit parallel I/O - -pcf8591 - Quad A/D + one D/A - -saa1064 - 4-digit LED-driver - -smbus-arp - An SMBus 2.0 ARP client - - ----------------------------------------------------------------------------- COMPANY ID LIST diff --git a/doc/useful_addresses.html b/doc/useful_addresses.html index 073ea0a1..f829c3ba 100644 --- a/doc/useful_addresses.html +++ b/doc/useful_addresses.html @@ -86,10 +86,6 @@ implementations. Please report any other references you have found!


    No datasheet available.
  • Hewlett Packard (Maxilife)
    Datasheets only under NDA.
  • -
  • Linear Technologies - (LTC1710) -
    Datasheets available for - download (choose "Special Functions").
  • Maxim IC (includes Dallas Semiconductor) (DS75, DS1621, DS1625, @@ -305,9 +301,6 @@ implementations. Please report any other references you have found!


    A paper on which the version 2 Makefile is based.
  • NTC thermistors
    A comprehensive description of the physics and mathematics of NTC thermistors.
  • -
  • Standard manufacturer's - identification code -
    The official list of Manufacturer IDs for EEPROMs.
  • About temperature sensors
    A web guide to devices that measure temperature. General information.
  • Measuring diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 51e42fac..8ab2bd9d 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1388,20 +1388,17 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); }, { name => "SPD EEPROM", - driver => "eeprom", - i2c_addrs => [0x50..0x57], - i2c_detect => sub { eeprom_detect(0, @_); }, - }, - { - name => "Sony Vaio EEPROM", - driver => "eeprom", - i2c_addrs => [0x57], - i2c_detect => sub { eeprom_detect(1, @_); }, + driver => "not-a-sensor", + # Can also live at 0x54-0x57, but we don't care: we only check + # for SPD and EDID EEPROMs because some hardware monitoring chips + # can live at 0x50-0x53. + i2c_addrs => [0x50..0x53], + i2c_detect => sub { eeprom_detect(@_); }, }, { name => "EDID EEPROM", - driver => "eeprom", - i2c_addrs => [0x50], + driver => "not-a-sensor", + i2c_addrs => [0x50..0x53], i2c_detect => sub { ddcmonitor_detect(@_); }, }, { @@ -1442,7 +1439,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); }, { name => "Fintek F75111R/RG/N (GPIO)", - driver => "to-be-written", + driver => "not-a-sensor", i2c_addrs => [0x4e], # 0x37 not probed i2c_detect => sub { fintek_detect(1, @_); }, }, @@ -1488,42 +1485,12 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x2f], i2c_detect => sub { fintek_detect(7, @_); }, }, - { - name => "Philips Semiconductors SAA1064", - driver => "saa1064", - i2c_addrs => [0x38..0x3b], - i2c_detect => sub { saa1064_detect(@_); }, - }, { name => "Philips Semiconductors PCA9540", driver => "pca9540", i2c_addrs => [0x70], i2c_detect => sub { pca9540_detect(@_); }, }, - { - name => "Philips Semiconductors PCA9556", - driver => "to-be-written", - i2c_addrs => [0x18..0x1f], - i2c_detect => sub { pca9556_detect(@_); }, - }, - { - name => "Maxim MAX6900", - driver => "not-a-sensor", - i2c_addrs => [0x50], - i2c_detect => sub { max6900_detect(@_); }, - }, - { - name => "Smart Battery Charger", - driver => "to-be-written", - i2c_addrs => [0x09], - i2c_detect => sub { smartbatt_chgr_detect(@_); }, - }, - { - name => "Smart Battery Manager/Selector", - driver => "to-be-written", - i2c_addrs => [0x0a], - i2c_detect => sub { smartbatt_mgr_detect(@_); }, - }, { name => "Smart Battery", driver => "smartbatt", @@ -4806,58 +4773,25 @@ sub ite_alias_detect return 1; } -# $_[0]: Chip to detect (0 = SPD EEPROM, 1 = Sony Vaio EEPROM) -# $_[1]: A reference to the file descriptor to access this chip -# $_[2]: Address +# $_[0]: A reference to the file descriptor to access this chip +# $_[1]: Address # Returns: 8 for a memory eeprom -# 4 to 9 for a Sony Vaio eeprom # Registers used: # 0-63: SPD Data and Checksum -# 0x80-0x83: Sony Vaio Data ("PCG-") -# 0xe2, 0xe5, 0xe8, 0xeb, Oxee: Sony Vaio Timestamp constant bytes. -# 0x1a-0x1c: Sony Vaio MAC address -# This detection function is a bit tricky; this is to workaround -# wrong misdetection messages that would else arise. sub eeprom_detect { - my ($chip,$file,$addr) = @_; + my ($file, $addr) = @_; my $checksum = 0; # Check the checksum for validity (works for most DIMMs and RIMMs) - if ($chip == 0) { - for (my $i = 0; $i <= 62; $i++) { - $checksum += i2c_smbus_read_byte_data($file, $i); - } - $checksum &= 255; - - return 8 - if $checksum == i2c_smbus_read_byte_data($file, 63); - return; + for (my $i = 0; $i <= 62; $i++) { + $checksum += i2c_smbus_read_byte_data($file, $i); } + $checksum &= 255; - # Look for a Sony Vaio EEPROM ($chip == 1) - my $vaioconf = 1; - $vaioconf += 4 - if i2c_smbus_read_byte_data($file,0x80) == 0x50 - && i2c_smbus_read_byte_data($file,0x81) == 0x43 - && i2c_smbus_read_byte_data($file,0x82) == 0x47 - && i2c_smbus_read_byte_data($file,0x83) == 0x2d; - $vaioconf += 5 - if i2c_smbus_read_byte_data($file,0xe2) == 0x2f - && i2c_smbus_read_byte_data($file,0xe5) == 0x2f - && i2c_smbus_read_byte_data($file,0xe8) == 0x20 - && i2c_smbus_read_byte_data($file,0xeb) == 0x3a - && i2c_smbus_read_byte_data($file,0xee) == 0x3a; - $vaioconf += 3 - if i2c_smbus_read_byte_data($file,0x1a) == 0x08 - && i2c_smbus_read_byte_data($file,0x1b) == 0x00 - && i2c_smbus_read_byte_data($file,0x1c) == 0x46; - $vaioconf = 9 - if $vaioconf > 9; + return 8 + if $checksum == i2c_smbus_read_byte_data($file, 63); - if ($vaioconf > 1) { - return $vaioconf; - } return; } @@ -4880,7 +4814,7 @@ sub ddcmonitor_detect i2c_smbus_read_byte_data($file,0x06) == 0xFF and i2c_smbus_read_byte_data($file,0x07) == 0x00; - return (8,$addr+1,$addr+2,$addr+3,$addr+4,$addr+5,$addr+6,$addr+7); + return 8; } # $_[0]: A reference to the file descriptor to access this chip. @@ -5065,28 +4999,6 @@ sub fintek_detect return 7; } -# $_[0]: A reference to the file descriptor to access this chip. -# $_[1]: Address -# Returns: undef if not detected, 4 or 7 if detected -# Detection is based on the fact that the SAA1064 has only one readable -# register, and thus ignores the read address. This register can have value -# 0x80 (first read since power-up) or 0x00. -sub saa1064_detect -{ - my ($file,$addr) = @_; - my $status = i2c_smbus_read_byte_data ($file, 0x00); - - return if ($status & 0x7f) != 0x00; - - for (my $i=0 ; $i<256; $i++) { - return if i2c_smbus_read_byte_data ($file, $i) != 0x00; - } - - return 7 - if $status == 0x80; - return 4; -} - # $_[0]: A reference to the file descriptor to access this chip. # $_[1]: Address # Returns: undef if not detected, 1 if detected @@ -5105,138 +5017,6 @@ sub pca9540_detect return 1; } -# $_[0]: A reference to the file descriptor to access this chip. -# $_[1]: Address (unused) -# Returns: undef if not detected, 1 if detected -# Detection is rather difficult, since the PCA9556 only has 4 registers -# and no unused bit. We use the fact that the registers cycle over -# 4 addresses boundaries, and the logic rules between registers. -sub pca9556_detect -{ - my ($file, $addr) = @_; - my $input = i2c_smbus_read_byte_data($file, 0x00); - my $output = i2c_smbus_read_byte_data($file, 0x01); - my $invert = i2c_smbus_read_byte_data($file, 0x02); - my $config = i2c_smbus_read_byte_data($file, 0x03); - - # Pins configured for output (config = 0) must obey the following - # rule: input = output ^ invert - - return unless ($input & ~$config) == (($output ^ $invert) & ~$config); - - for (my $i = 5; $i < 254 ; $i+=4) { - return unless i2c_smbus_read_byte_data($file, $i) == $output; - return unless i2c_smbus_read_byte_data($file, $i+1) == $invert; - return unless i2c_smbus_read_byte_data($file, $i+2) == $config; - } - - return 1; -} - -# $_[0]: A reference to the file descriptor to access this chip. -# $_[1]: Address -# Returns: undef if not detected, 3 if detected -sub max6900_detect -{ - my ($file,$addr) = @_; - my $reg; - - # SEC - $reg = i2c_smbus_read_byte_data ($file, 0x81); - return if - ($reg & 0xF0) > 0x50 or - ($reg & 0x0F) > 9; - - # MIN - $reg = i2c_smbus_read_byte_data ($file, 0x83); - return if - ($reg & 0xF0) > 0x50 or - ($reg & 0x0F) > 9; - - # HR - $reg = i2c_smbus_read_byte_data ($file, 0x85); - return if - ($reg & 0x40) != 0x00 or - ($reg & 0x0F) > 9; - - # DATE - $reg = i2c_smbus_read_byte_data ($file, 0x87); - return if - $reg == 0x00 or - ($reg & 0xF0) > 0x30 or - ($reg & 0x0F) > 9; - - # MONTH - $reg = i2c_smbus_read_byte_data ($file, 0x89); - return if - $reg == 0x00 or - ($reg & 0xF0) > 0x10 or - ($reg & 0x0F) > 9; - - # DAY - $reg = i2c_smbus_read_byte_data ($file, 0x8B); - return if - $reg == 0 or - $reg > 7; - - # YEAR - $reg = i2c_smbus_read_byte_data ($file, 0x8D); - return if - ($reg & 0xF0) > 0x90 or - ($reg & 0x0F) > 9; - - # CONTROL - $reg = i2c_smbus_read_byte_data ($file, 0x8F); - return if - ($reg & 0x7F) != 0x00; - - # CENTURY - $reg = i2c_smbus_read_byte_data ($file, 0x93); - return if - ($reg & 0xF0) > 0x90 or - ($reg & 0x0F) > 9; - - return 3; -} - -# This checks for non-FFFF values for SpecInfo and Status. -# The address (0x09) is specified by the SMBus standard so it's likely -# that this really is a smart battery charger. -# $_[0]: A reference to the file descriptor to access this chip. -# $_[1]: Address -# Returns: 5 -sub smartbatt_chgr_detect -{ - my ($file,$addr) = @_; - # check some registers - if (i2c_smbus_read_word_data($file,0x11) == 0xffff) { - return; - } - if (i2c_smbus_read_word_data($file,0x13) == 0xffff) { - return; - } - return (5); -} - -# This checks for non-FFFF values for State and Info. -# The address (0x0a) is specified by the SMBus standard so it's likely -# that this really is a smart battery manager/selector. -# $_[0]: A reference to the file descriptor to access this chip. -# $_[1]: Address -# Returns: 5 -sub smartbatt_mgr_detect -{ - my ($file,$addr) = @_; - # check some registers - if (i2c_smbus_read_word_data($file,0x01) == 0xffff) { - return; - } - if (i2c_smbus_read_word_data($file,0x04) == 0xffff) { - return; - } - return (5); -} - # This checks for non-FFFF values for temperature, voltage, and current. # The address (0x0b) is specified by the SMBus standard so it's likely # that this really is a smart battery. @@ -5863,13 +5643,6 @@ sub main print " Misdetects:\n"; print_chips_report $chip->{misdetected}; } - - # People are easily confused - if ($chip->{driver} eq "eeprom") { - print "\n EEPROMs are *NOT* sensors! They are data storage chips commonly\n", - " found on memory modules (SPD), in monitors (EDID), or in some\n", - " laptops, for example.\n"; - } } print "\n"; From 0c96adf025ef1343352708ba64988f5a7af1bb68 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 30 Jun 2007 17:04:32 +0000 Subject: [PATCH 103/718] Clean up Savage bus driver entries: remove the unsuppored devices from the list, and mention the i2c-prosavage driver. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4533 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 46 +++++--------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 8ab2bd9d..a9c14783 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -587,18 +587,6 @@ $revision =~ s/ \([^()]*\)//; driver => "i2c-adap-ite", match => qr/^ITE IIC adapter/, } , - { - vendid => 0x5333, - devid => 0x8A20, - procid => "S3 Savage 3D", - driver => "to-be-written", - } , - { - vendid => 0x5333, - devid => 0x8A21, - procid => "S3 Savage 3D MV", - driver => "to-be-written", - } , { vendid => 0x5333, devid => 0x8A22, @@ -617,37 +605,15 @@ $revision =~ s/ \([^()]*\)//; vendid => 0x5333, devid => 0x8A25, procid => "S3 ProSavage PM", - driver => "to-be-written", + driver => "i2c-prosavage", + match => qr/^ProSavage I2C bus at /, } , { vendid => 0x5333, - devid => 0x8A26, - procid => "S3 ProSavage KM", - driver => "to-be-written", - } , - { - vendid => 0x5333, - devid => 0x8C10, - procid => "S3 Savage MX MV", - driver => "to-be-written", - } , - { - vendid => 0x5333, - devid => 0x8C11, - procid => "S3 Savage MX", - driver => "to-be-written", - } , - { - vendid => 0x5333, - devid => 0x8C12, - procid => "S3 Savage IX MV", - driver => "to-be-written", - } , - { - vendid => 0x5333, - devid => 0x8C13, - procid => "S3 Savage IX", - driver => "to-be-written", + devid => 0x8D04, + procid => "S3 ProSavage8", + driver => "i2c-prosavage", + match => qr/^ProSavage I2C bus at /, } , { vendid => 0x1002, From 5b8b0a0ede9dc3171c573c34c7ab6799f1580b6e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 2 Jul 2007 15:16:02 +0000 Subject: [PATCH 104/718] Drop a bogus comment. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4534 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index abda4041..6e99c4f2 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -78,8 +78,6 @@ static void sensors_get_available_features(const sensors_chip_name *name, if (get_feature_value(name, iter, &feature_vals[indx])) printf("ERROR: Can't get %s data!\n", iter->name); - /* some chips don't have all the features they claim to have */ - /* has_features[indx] = (feature_vals[indx] != 127); */ has_features[indx] = 1; } } From dced776a122f6e4188385a37e9a23f8ff83291dc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 3 Jul 2007 08:18:21 +0000 Subject: [PATCH 105/718] Use sscanf instead of regex to match the feature names. This is much faster. As a side effect, this fixes a memory leak (the regex engine data was never freed.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4538 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/lib/access.c b/lib/access.c index 1403c3e2..f0b9dfb6 100644 --- a/lib/access.c +++ b/lib/access.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "access.h" #include "sensors.h" #include "data.h" @@ -28,8 +27,6 @@ #include "proc.h" #include "general.h" -#define GET_TYPE_REGEX "\\([[:alpha:]]\\{1,\\}\\)[[:digit:]]\\{0,\\}\\(_\\([[:alpha:]]\\{1,\\}\\)\\)\\{0,1\\}" - static int sensors_do_this_chip_sets(sensors_chip_name name); /* Compare two chips name descriptions, to see whether they could match. @@ -541,11 +538,10 @@ static struct feature_type_match cpu_matches[] = { }; static struct feature_type_match matches[] = { - { "temp", SENSORS_FEATURE_TEMP, temp_matches }, - { "in", SENSORS_FEATURE_IN, in_matches }, - { "fan", SENSORS_FEATURE_FAN, fan_matches }, - { "cpu", SENSORS_FEATURE_UNKNOWN, cpu_matches }, - { "vrm", SENSORS_FEATURE_VRM, 0 }, + { "temp%d%c", SENSORS_FEATURE_TEMP, temp_matches }, + { "in%d%c", SENSORS_FEATURE_IN, in_matches }, + { "fan%d%c", SENSORS_FEATURE_FAN, fan_matches }, + { "cpu%d%c", SENSORS_FEATURE_UNKNOWN, cpu_matches }, { 0 } }; @@ -553,39 +549,30 @@ static struct feature_type_match matches[] = { sensors_feature_type sensors_feature_get_type( const sensors_feature_data *feature) { - regmatch_t pmatch[4]; - int size_first, size_second, retval, i; + char c; + int i, nr, count; struct feature_type_match *submatches; - static regex_t reg; - static regex_t *preg = NULL; - if (!preg) { - regcomp(®, GET_TYPE_REGEX, 0); - preg = ® - } - - retval = regexec(preg, feature->name, 4, pmatch, 0); - - if (retval == -1) - return SENSORS_FEATURE_UNKNOWN; - - size_first = pmatch[1].rm_eo - pmatch[1].rm_so; - size_second = pmatch[3].rm_eo - pmatch[3].rm_so; + /* vrm is special */ + if (!strcmp(feature->name, "vrm")) + return SENSORS_FEATURE_VRM; for(i = 0; matches[i].name != 0; i++) - if (!strncmp(feature->name, matches[i].name, size_first)) + if ((count = sscanf(feature->name, matches[i].name, &nr, &c))) break; if (matches[i].name == NULL) /* no match */ return SENSORS_FEATURE_UNKNOWN; - else if (size_second == 0) /* single type */ + else if (count == 1) /* single type */ return matches[i].type; - else if (matches[i].submatches == NULL) /* not single type, but no submatches */ + + /* assert: count == 2 */ + if (c != '_') return SENSORS_FEATURE_UNKNOWN; submatches = matches[i].submatches; for(i = 0; submatches[i].name != 0; i++) - if (!strcmp(feature->name + pmatch[3].rm_so, submatches[i].name)) + if (!strcmp(strchr(feature->name, '_') + 1, submatches[i].name)) return submatches[i].type; return SENSORS_FEATURE_UNKNOWN; From b525cfe011b381212cfd53e16fd43a5b5ed5da5a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 3 Jul 2007 09:35:47 +0000 Subject: [PATCH 106/718] Add missing changelog entry. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4539 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index e54c9796..8a1149fd 100644 --- a/CHANGES +++ b/CHANGES @@ -47,6 +47,7 @@ SVN HEAD Add detection for non-standard SMSC Super-I/Os No longer depend on i2cdetect Add SMSC SCH5317 detection + Drop detection of most non-sensors I2C chips 2.10.3 (20070319) From e10dec5e8678664fc4efabb30669cae7a71ad7f4 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 3 Jul 2007 11:55:12 +0000 Subject: [PATCH 107/718] Change version to 3.0.0-pre. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4540 7894878c-1315-0410-8ee3-d5d059ff63e0 --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 13bc5cd7..5f0daf87 100644 --- a/version.h +++ b/version.h @@ -1,2 +1,2 @@ -#define LM_DATE "20070319" -#define LM_VERSION "2.10.3" +#define LM_DATE "2007xxxx" +#define LM_VERSION "3.0.0-pre" From 7cc03f5029126c416029dcb69e0c6e91b9954ce2 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 3 Jul 2007 13:22:28 +0000 Subject: [PATCH 108/718] Drop VRM reporting and selection support from libsensors. Since kernel 2.6.9, the right VID conversion formula is selected automatically depending on the CPU model, so the user shouldn't have to care. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4543 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/FAQ | 6 +-- doc/lm_sensors-FAQ.html | 5 +-- doc/lm_sensors-FAQ.texi | 5 +-- doc/vid | 74 +++--------------------------------- etc/sensors.conf.eg | 28 -------------- lib/access.c | 4 -- lib/sensors.h | 1 - lib/sysfs.c | 2 - prog/sensors/chips.c | 9 ++--- prog/sensors/chips.h | 2 +- prog/sensors/chips_generic.c | 19 +-------- 11 files changed, 17 insertions(+), 138 deletions(-) diff --git a/doc/FAQ b/doc/FAQ index 64d088bc..0af9111c 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -691,10 +691,8 @@ settings for the Processor Core voltage (often in0_min and in0_max) in that file so that they don't depend on vid. The CPU nominal voltage is computed from VID lines according to a -formula that depends on the CPU type. Most chips that report a VID -value can be configured to use either VRM 8.2 (for Pentium III) or VRM -9.0 (for Pentium 4 and Athlon). You chose which one you want through -`/etc/sensors.conf'. See `doc/vid' for more information. +formula that depends on the CPU type. Since Linux 2.6.14, the right +formula is selected automatically. See `doc/vid' for more information. 4.8 I read sensor values several times a second, but they are only updated only each second or so. Why? ======================================================================================================= diff --git a/doc/lm_sensors-FAQ.html b/doc/lm_sensors-FAQ.html index dcc3c65d..4ddf2902 100644 --- a/doc/lm_sensors-FAQ.html +++ b/doc/lm_sensors-FAQ.html @@ -1106,9 +1106,8 @@ and change the min and max settings for the Processor Core voltage (often in0_min and in0_max) in that file so that they don't depend on vid.

    The CPU nominal voltage is computed from VID lines according to a formula -that depends on the CPU type. Most chips that report a VID value can be -configured to use either VRM 8.2 (for Pentium III) or VRM 9.0 (for Pentium 4 -and Athlon). You chose which one you want through /etc/sensors.conf. +that depends on the CPU type. Since Linux 2.6.14, the right formula is +selected automatically. See doc/vid for more information.

    diff --git a/doc/lm_sensors-FAQ.texi b/doc/lm_sensors-FAQ.texi index 1f1a2fff..b480091f 100644 --- a/doc/lm_sensors-FAQ.texi +++ b/doc/lm_sensors-FAQ.texi @@ -716,9 +716,8 @@ and change the min and max settings for the Processor Core voltage (often in0_min and in0_max) in that file so that they don't depend on vid. The CPU nominal voltage is computed from VID lines according to a formula -that depends on the CPU type. Most chips that report a VID value can be -configured to use either VRM 8.2 (for Pentium III) or VRM 9.0 (for Pentium 4 -and Athlon). You chose which one you want through @file{/etc/sensors.conf}. +that depends on the CPU type. Since Linux 2.6.9, the right formula is +selected automatically. See @file{doc/vid} for more information. diff --git a/doc/vid b/doc/vid index 8995dee0..565774d3 100644 --- a/doc/vid +++ b/doc/vid @@ -43,76 +43,14 @@ Document Version Voltage Range Increment Processors AMD Opteron 24x processors. Note that versions 8.1 - 8.4 are compatible. -lm_sensors versions through 2.6.3 support only the VRM 8.2 standard. - -Starting in lm_sensors 2.6.4 the VRM version is configurable. -To configure the sensor chip for the correct voltage range, -you must set the "vrm" correctly either via /proc, /sys, or sensors.conf. - -To be compatible with previous lm_sensors versions, the vrm defaults -to version 8.2. Generally, for recent motherboards, this will not -be correct. Try 9.0 first. - -To change the vrm version to 9.0, for example, do the following -after the chip module (in this example, w83781d) is loaded: - - (kernel 2.4) - echo 9.0 > /proc/sys/dev/sensors/w83781d-isa-0290/vrm - (kernel 2.6) - echo 90 > /sys/bus/i2c/devices/0-0290/vrm - -Alternatively, add a line in /etc/sensors.conf in the w83781d section -(you should put this line BEFORE any line that uses vid in a calculation): - - set vrm 9.0 - -and then, after the chip module is loaded, do: - - sensors -s - -After this, reading the vid either by - - (kernel 2.4) - cat /proc/sys/dev/sensors/w83781d-isa-0290/vid - (kernel 2.6 - divide the output by 1000) - cat /sys/bus/i2c/devices/0-0290/in0_ref - -or by - - sensors - -should show the new vid value. - - -The following values are legal vrm values. Other values will be -allowed but will result in using the 8.2 standard. - - 2.4, 8.1-8.5, 9.0, 9.1, 10.0 - +Since Linux 2.6.9, the correct VRM version is selected automatically +based on the CPU brand and model. Thus you shouldn't have to care about +it. If you are using a brand new CPU and even the latest kernel complains +("Unknown VRM version of your CPU"), this means that the kernel must be +taught about this new CPU model. Please report to us in this case. Remember, the VID pins on the sensor chips are inputs only. -That means they can't be changed and there shouldn't be -any problems if you experiment with the vrm values until you -get it right. You cannot manipulate the actual processor core -voltage through lm_sensors drivers. - -Not all sensor chips have VID inputs. -For those that do, the VRM support status is listed below. - -The following chip drivers support all the VRM versions via -/etc/sensors.conf and the vrm entry in /proc or /sys: - - adm1025, adm1026, asb100, lm85, lm87, - vt1211, vt8231, w83627hf, w83781d - - -The following chip drivers support only VRM 8.2 and cannot be changed: - - adm1024, it87, mtp008 - adm9240, gl520sm, lm78, maxilife - -If you have a board with one of these chips which needs advanced -VRM support please email us. +You cannot use them to manipulate the actual processor core voltage. ------------------ Copyright (c) 2002-2004 Mark D. Studebaker diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 1f616ee7..06dd49c6 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -234,7 +234,6 @@ # This is a library dependency. # A 'set fan1_div' statement must go before a 'set fan1_min' statement, # because the driver uses the divisor in calculating the minimum. -# Also, one should set vrm prior to using vid in any formula. # # # BUS LINES @@ -475,9 +474,6 @@ chip "w83782d-*" "w83627hf-*" compute in6 (3.14 * @) - 7.71 , (@ + 7.71) / 3.14 compute in7 ((6.8/10)+1)*@ , @/((6.8/10)+1) -# adjust this if your vid is wrong; see doc/vid -# set vrm 9.0 - # set limits to 5% for the critical voltages # set limits to 10% for the non-critical voltages # set limits to 20% for the battery voltage @@ -538,9 +534,6 @@ chip "w83783s-*" compute in5 (5.14 * @) - 14.91 , (@ + 14.91) / 5.14 compute in6 (3.14 * @) - 7.71 , (@ + 7.71) / 3.14 -# adjust this if your vid is wrong; see doc/vid -# set vrm 9.0 - # set limits to 5% for the critical voltages # set limits to 10% for the non-critical voltages # set limits to 20% for the battery voltage @@ -688,9 +681,6 @@ chip "w83627thf-*" "w83637hf-*" compute in4 (5.14*@)-14.91, (@+14.91)/5.14 compute in7 ((6.8/10)+1)*@ , @/((6.8/10)+1) -# adjust this if your vid is wrong; see doc/vid -# set vrm 9.0 - # set limits to 5% for the critical voltages # set limits to 10% for the non-critical voltages # set limits to 20% for the battery voltage @@ -886,9 +876,6 @@ chip "as99127f-*" # label temp3 "CPU 2 Temp" # ignore temp3 -# adjust this if your vid is wrong; see doc/vid -# set vrm 9.0 - # set limits to 5% for the critical voltages # set limits to 10% for the non-critical voltages # set limits to 20% for the battery voltage @@ -1336,9 +1323,6 @@ chip "adm1025-*" "ne1619-*" label in4 "+12V" label in5 "VCC" -# Adjust this if your vid is wrong; see doc/vid -# set vrm 9.0 - # Tolerate a 5% deviance for CPU power-supply # set in1_min vid * 0.95 # set in1_max vid * 1.05 @@ -2095,9 +2079,6 @@ chip "vt1211-*" compute in3 @ * (1 + 14 / 10), @ / (1 + 14 / 10) compute in4 @ * (1 + 47 / 10), @ / (1 + 47 / 10) -# Adjust this if your vid is wrong (for 2.4 only); see doc/vid -# set vrm 9.1 - # set in0_min 3.3 * 0.95 # set in0_max 3.3 * 1.05 # set in1_min 2.5 * 0.95 @@ -2330,8 +2311,6 @@ chip "smsc47m192-*" # This example was tested vs. Asus P4S333 # chip "asb100-*" -# adjust this if your vid is wrong; see doc/vid - #set vrm 9.0 label in0 "VCore 1" #set in0_min vid * 0.95 @@ -2449,10 +2428,6 @@ chip "lm85c-*" "adm1027-*" "adt7463-*" "lm85-*" "lm85b-*" # ignore fan3 # ignore fan4 -# Set VRM version -# adjust this if your vid is wrong; see doc/vid -# set vrm 9.1 # Pentium 4 - # Set voltage limits # set in0_min 1.5 * 0.95 # set in0_max 1.5 * 1.05 @@ -2480,9 +2455,6 @@ chip "pc87366-*" # Voltage inputs -# Set VRM version (default 9.0) -# set vrm 9.0 - label in7 "Vsb" label in8 "Vdd" label in9 "Vbat" diff --git a/lib/access.c b/lib/access.c index f0b9dfb6..f7bac9cb 100644 --- a/lib/access.c +++ b/lib/access.c @@ -553,10 +553,6 @@ sensors_feature_type sensors_feature_get_type( int i, nr, count; struct feature_type_match *submatches; - /* vrm is special */ - if (!strcmp(feature->name, "vrm")) - return SENSORS_FEATURE_VRM; - for(i = 0; matches[i].name != 0; i++) if ((count = sscanf(feature->name, matches[i].name, &nr, &c))) break; diff --git a/lib/sensors.h b/lib/sensors.h index 9fb6ad4f..8f804dd4 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -176,7 +176,6 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_TEMP_SENS, SENSORS_FEATURE_VID = 0x300, - SENSORS_FEATURE_VRM, SENSORS_FEATURE_UNKNOWN = INT_MAX, diff --git a/lib/sysfs.c b/lib/sysfs.c index 1f39d88e..3cb63b1d 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -52,8 +52,6 @@ int get_type_scaling(int type) switch (type) { case SENSORS_FEATURE_VID: return 3; - case SENSORS_FEATURE_VRM: - return 1; default: return 0; } diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 6e25116e..c949456d 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -101,20 +101,17 @@ int sensors_get_label_and_valid(sensors_chip_name name, int feature, char **labe return err; } -void print_vid_info_real(const sensors_chip_name *name, int f_vid, int f_vrm, int label_size) +void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size) { char *label; int valid; - double vid, vrm; + double vid; if (!sensors_get_label_and_valid(*name,f_vid,&label,&valid) && !sensors_get_feature(*name,f_vid,&vid) ) { if (valid) { print_label(label, label_size); - if(!sensors_get_feature(*name,f_vrm,&vrm)) - printf("%+6.3f V (VRM Version %.1f)\n",vid,vrm); - else - printf("%+6.3f V\n",vid); + printf("%+6.3f V\n", vid); } } free(label); diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index 26fa2e0a..de854021 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -34,7 +34,7 @@ extern void print_unknown_chip(const sensors_chip_name *name); void print_temp_info(float n_cur, float n_over, float n_hyst, int minmax, int curprec, int limitprec); -void print_vid_info_real(const sensors_chip_name *name, int f_vid, int f_vrm, int label_size); +void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size); void print_label(const char *label, int space); diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 6e99c4f2..dc2b7583 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -337,23 +337,6 @@ static void print_generic_chip_fan(const sensors_chip_name *name, printf("\n"); } -static void print_generic_chip_vid(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int j, int label_size) -{ - const sensors_feature_data *vrm_feature; - - while((vrm_feature = sensors_get_all_features(*name, &i, &j))) { - if (sensors_feature_get_type(vrm_feature) == SENSORS_FEATURE_VRM) - break; - } - - if (vrm_feature != NULL) - print_vid_info_real(name, feature->number, vrm_feature->number, label_size); - else - print_vid_info_real(name, feature->number, -1, label_size); -} - void print_generic_chip(const sensors_chip_name *name) { const sensors_feature_data *feature; @@ -374,7 +357,7 @@ void print_generic_chip(const sensors_chip_name *name) case SENSORS_FEATURE_FAN: print_generic_chip_fan(name, feature, i, j, label_size); break; case SENSORS_FEATURE_VID: - print_generic_chip_vid(name, feature, i, j, label_size); break; + print_vid_info(name, feature->number, label_size); break; default: continue; } } From c7c77845d2ba7d1fc1e44c0f663ac54c5e186705 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 3 Jul 2007 14:26:26 +0000 Subject: [PATCH 109/718] Make a few libsensors functions static. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4544 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 16 ++++++++++------ lib/access.h | 22 ---------------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/lib/access.c b/lib/access.c index f7bac9cb..b6c5eb7b 100644 --- a/lib/access.c +++ b/lib/access.c @@ -27,7 +27,9 @@ #include "proc.h" #include "general.h" -static int sensors_do_this_chip_sets(sensors_chip_name name); +static int sensors_eval_expr(sensors_chip_name chipname, + const sensors_expr *expr, + double val, double *result); /* Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. */ @@ -70,8 +72,9 @@ int sensors_match_chip(sensors_chip_name chip1, sensors_chip_name chip2) the struct the return value points to! Note that this visits the list of chips from last to first. Usually, you want the match that was latest in the config file. */ -sensors_chip *sensors_for_all_config_chips(sensors_chip_name chip_name, - const sensors_chip * last) +static sensors_chip * +sensors_for_all_config_chips(sensors_chip_name chip_name, + const sensors_chip *last) { int nr, i; sensors_chip_name_list chips; @@ -110,8 +113,8 @@ const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *c /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ -const sensors_chip_feature *sensors_lookup_feature_name(const sensors_chip_name *chip, - const char *feature) +static const sensors_chip_feature * +sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) { int i, j; const sensors_chip_feature *features; @@ -349,6 +352,7 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, return NULL; } +/* Evaluate an expression */ int sensors_eval_expr(sensors_chip_name chipname, const sensors_expr * expr, double val, double *result) { @@ -410,7 +414,7 @@ int sensors_eval_expr(sensors_chip_name chipname, const sensors_expr * expr, /* Execute all set statements for this particular chip. The chip may not contain wildcards! This function will return 0 on success, and <0 on failure. */ -int sensors_do_this_chip_sets(sensors_chip_name name) +static int sensors_do_this_chip_sets(sensors_chip_name name) { sensors_chip *chip; double value; diff --git a/lib/access.h b/lib/access.h index 0ed55e17..32c274ec 100644 --- a/lib/access.h +++ b/lib/access.h @@ -23,28 +23,12 @@ #include "sensors.h" #include "data.h" -/* Returns, one by one, a pointer to all sensor_chip structs of the - config file which match with the given chip name. Last should be - the value returned by the last call, or NULL if this is the first - call. Returns NULL if no more matches are found. Do not modify - the struct the return value points to! - Note that this visits the list of chips from last to first. Usually, - you want the match that was latest in the config file. */ -extern sensors_chip *sensors_for_all_config_chips(sensors_chip_name chip_name, - const sensors_chip *last); - /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found. */ extern const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature); -/* Look up a resource in the intern chip list, and return a pointer to it. - Do not modify the struct the return value points to! Returns NULL if - not found.*/ -extern const sensors_chip_feature *sensors_lookup_feature_name - (const sensors_chip_name *chip, const char *feature); - /* Substitute configuration bus numbers with real-world /proc bus numbers in the chips lists */ extern int sensors_substitute_busses(void); @@ -54,10 +38,4 @@ extern int sensors_substitute_busses(void); error.h on failure. */ extern int sensors_parse_i2cbus_name(const char *name, int *res); -/* Evaluate an expression */ -extern int sensors_eval_expr(sensors_chip_name chipname, - const sensors_expr *expr, - double val, double *result); - - #endif /* def LIB_SENSORS_ACCESS_H */ From b79274babd1087ba03ccad06367dd6fbf50c79fd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 3 Jul 2007 16:03:22 +0000 Subject: [PATCH 110/718] Add some more warning flags, and fix these warnings. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4545 7894878c-1315-0410-8ee3-d5d059ff63e0 --- Makefile | 3 ++- lib/Module.mk | 4 ++-- lib/access.c | 40 +++++++++++++++++++++--------------- lib/access.h | 9 -------- lib/data.h | 9 ++++++++ lib/error.c | 5 ++--- lib/general.h | 2 ++ lib/init.c | 2 +- lib/proc.c | 1 + lib/sysfs.c | 5 +++-- prog/dump/isadump.c | 6 +++--- prog/sensors/chips_generic.c | 4 ++-- prog/sensors/main.c | 4 ++-- 13 files changed, 52 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index d4a3cbf8..15ebaf06 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,8 @@ endif ifeq ($(WARN),1) ALL_CFLAGS += -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ - -Wcast-align -Wwrite-strings -Wnested-externs -Winline + -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W \ + -Wmissing-prototypes -Wundef endif ALL_CPPFLAGS += $(CPPFLAGS) diff --git a/lib/Module.mk b/lib/Module.mk index da38e47a..14b220c9 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -87,9 +87,9 @@ INCLUDEFILES += $(LIBCSOURCES:.c=.ld) $(LIBCSOURCES:.c=.ad) # Special warning prevention for flex-generated files $(MODULE_DIR)/conf-lex.ao: $(MODULE_DIR)/conf-lex.c - $(CC) $(ARCPPFLAGS) $(ARCFLAGS) -Wno-unused -c $< -o $@ + $(CC) $(ARCPPFLAGS) $(ARCFLAGS) -Wno-unused -Wno-missing-prototypes -c $< -o $@ $(MODULE_DIR)/conf-lex.lo: $(MODULE_DIR)/conf-lex.c - $(CC) $(LIBCPPFLAGS) $(LIBCFLAGS) -Wno-unused -c $< -o $@ + $(CC) $(LIBCPPFLAGS) $(LIBCFLAGS) -Wno-unused -Wno-missing-prototypes -c $< -o $@ REMOVELIBST := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(LIBDIR)/%,$(LIB_DIR)/$(LIBSTLIBNAME)) REMOVELIBSH := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(LIBDIR)/%,$(LIB_DIR)/$(LIBSHLIBNAME)) diff --git a/lib/access.c b/lib/access.c index b6c5eb7b..620e5d87 100644 --- a/lib/access.c +++ b/lib/access.c @@ -488,23 +488,30 @@ int sensors_do_chip_sets(sensors_chip_name name) calling sensors_do_chip_sets with an all wildcards chip name */ int sensors_do_all_sets(void) { - sensors_chip_name name = { SENSORS_CHIP_NAME_PREFIX_ANY, - SENSORS_CHIP_NAME_BUS_ANY, - SENSORS_CHIP_NAME_ADDR_ANY + static const sensors_chip_name name = { + .prefix = SENSORS_CHIP_NAME_PREFIX_ANY, + .bus = SENSORS_CHIP_NAME_BUS_ANY, + .addr = SENSORS_CHIP_NAME_ADDR_ANY, }; return sensors_do_chip_sets(name); } /* Static mappings for use by sensors_feature_get_type() */ +struct feature_subtype_match +{ + const char *name; + sensors_feature_type type; +}; + struct feature_type_match { const char *name; sensors_feature_type type; - struct feature_type_match *submatches; + const struct feature_subtype_match *submatches; }; -static struct feature_type_match temp_matches[] = { +static const struct feature_subtype_match temp_matches[] = { { "max", SENSORS_FEATURE_TEMP_MAX }, { "max_hyst", SENSORS_FEATURE_TEMP_MAX_HYST }, { "min", SENSORS_FEATURE_TEMP_MIN }, @@ -516,29 +523,29 @@ static struct feature_type_match temp_matches[] = { { "crit_alarm", SENSORS_FEATURE_TEMP_CRIT_ALARM }, { "fault", SENSORS_FEATURE_TEMP_FAULT }, { "type", SENSORS_FEATURE_TEMP_SENS }, - { 0 } + { NULL, 0 } }; -static struct feature_type_match in_matches[] = { +static const struct feature_subtype_match in_matches[] = { { "min", SENSORS_FEATURE_IN_MIN }, { "max", SENSORS_FEATURE_IN_MAX }, { "alarm", SENSORS_FEATURE_IN_ALARM }, { "min_alarm", SENSORS_FEATURE_IN_MIN_ALARM }, { "max_alarm", SENSORS_FEATURE_IN_MAX_ALARM }, - { 0 } + { NULL, 0 } }; -static struct feature_type_match fan_matches[] = { +static const struct feature_subtype_match fan_matches[] = { { "min", SENSORS_FEATURE_FAN_MIN }, { "div", SENSORS_FEATURE_FAN_DIV }, { "alarm", SENSORS_FEATURE_FAN_ALARM }, { "fault", SENSORS_FEATURE_FAN_FAULT }, - { 0 } + { NULL, 0 } }; -static struct feature_type_match cpu_matches[] = { +static const struct feature_subtype_match cpu_matches[] = { { "vid", SENSORS_FEATURE_VID }, - { 0 } + { NULL, 0 } }; static struct feature_type_match matches[] = { @@ -546,7 +553,6 @@ static struct feature_type_match matches[] = { { "in%d%c", SENSORS_FEATURE_IN, in_matches }, { "fan%d%c", SENSORS_FEATURE_FAN, fan_matches }, { "cpu%d%c", SENSORS_FEATURE_UNKNOWN, cpu_matches }, - { 0 } }; /* Return the feature type based on the feature name */ @@ -555,13 +561,13 @@ sensors_feature_type sensors_feature_get_type( { char c; int i, nr, count; - struct feature_type_match *submatches; + const struct feature_subtype_match *submatches; - for(i = 0; matches[i].name != 0; i++) + for (i = 0; i < ARRAY_SIZE(matches); i++) if ((count = sscanf(feature->name, matches[i].name, &nr, &c))) break; - if (matches[i].name == NULL) /* no match */ + if (i == ARRAY_SIZE(matches)) /* no match */ return SENSORS_FEATURE_UNKNOWN; else if (count == 1) /* single type */ return matches[i].type; @@ -571,7 +577,7 @@ sensors_feature_type sensors_feature_get_type( return SENSORS_FEATURE_UNKNOWN; submatches = matches[i].submatches; - for(i = 0; submatches[i].name != 0; i++) + for (i = 0; submatches[i].name != NULL; i++) if (!strcmp(strchr(feature->name, '_') + 1, submatches[i].name)) return submatches[i].type; diff --git a/lib/access.h b/lib/access.h index 32c274ec..60068b7c 100644 --- a/lib/access.h +++ b/lib/access.h @@ -29,13 +29,4 @@ extern const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature); -/* Substitute configuration bus numbers with real-world /proc bus numbers - in the chips lists */ -extern int sensors_substitute_busses(void); - - -/* Parse an i2c bus name into its components. Returns 0 on succes, a value from - error.h on failure. */ -extern int sensors_parse_i2cbus_name(const char *name, int *res); - #endif /* def LIB_SENSORS_ACCESS_H */ diff --git a/lib/data.h b/lib/data.h index 3be0a485..5bf2b0c9 100644 --- a/lib/data.h +++ b/lib/data.h @@ -170,4 +170,13 @@ extern int sensors_proc_bus_max; (el), &sensors_proc_bus, &sensors_proc_bus_count,\ &sensors_proc_bus_max, sizeof(struct sensors_bus)) +/* Substitute configuration bus numbers with real-world /proc bus numbers + in the chips lists */ +int sensors_substitute_busses(void); + + +/* Parse an i2c bus name into its components. Returns 0 on succes, a value from + error.h on failure. */ +int sensors_parse_i2cbus_name(const char *name, int *res); + #endif /* def LIB_SENSORS_DATA_H */ diff --git a/lib/error.c b/lib/error.c index 62addd89..1a869f6c 100644 --- a/lib/error.c +++ b/lib/error.c @@ -20,6 +20,7 @@ #include #include #include "error.h" +#include "general.h" static void sensors_default_parse_error(const char *err, int lineno); static void sensors_default_fatal_error(const char *proc,const char *err); @@ -43,13 +44,11 @@ static const char *errorlist[] = /* SENSORS_ERR_ACCESS_R */ "Can't read" }; -#define ERROR_LIST_LEN (sizeof(errorlist) / sizeof(char *)) - const char *sensors_strerror(int errnum) { if (errnum < 0) errnum = -errnum; - if (errnum >= ERROR_LIST_LEN) + if (errnum >= ARRAY_SIZE(errorlist)) errnum = 0; return errorlist[errnum]; } diff --git a/lib/general.h b/lib/general.h index 1bb308ac..5a5dee1a 100644 --- a/lib/general.h +++ b/lib/general.h @@ -36,4 +36,6 @@ extern void sensors_add_array_els(const void *els, int nr_els, void *list, /* Strip a string of all terminating spaces */ extern void sensors_strip_of_spaces(char *name); +#define ARRAY_SIZE(arr) (int)(sizeof(arr) / sizeof((arr)[0])) + #endif /* LIB_SENSORS_GENERAL */ diff --git a/lib/init.c b/lib/init.c index 865232c4..856ba232 100644 --- a/lib/init.c +++ b/lib/init.c @@ -49,7 +49,7 @@ int sensors_init(FILE *input) return -SENSORS_ERR_PARSE; if ((res = sensors_yyparse())) return -SENSORS_ERR_PARSE; - if ((res = sensors_substitute_busses())); + if ((res = sensors_substitute_busses())) return res; return 0; } diff --git a/lib/proc.c b/lib/proc.c index acbea114..6edcb00f 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -25,6 +25,7 @@ #include "data.h" #include "error.h" #include "access.h" +#include "proc.h" /* This reads a feature from a sysfs file. Sysfs uses a one-value-per file system... diff --git a/lib/sysfs.c b/lib/sysfs.c index 3cb63b1d..c63cb75d 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -83,7 +83,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, memset(features, 0, sizeof(features)); dlist_for_each_data(attrs, attr, struct sysfs_attribute) { - sensors_chip_feature feature = { { 0, }, 0, }; + sensors_chip_feature feature; name = attr->name; if (!strcmp(name, "name")) { @@ -91,6 +91,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, continue; } + memset(&feature, 0, sizeof(sensors_chip_feature)); /* check for _input extension and remove */ i = strlen(name); if (i > 6 && !strcmp(name + i - 6, "_input")) @@ -180,7 +181,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } fnum = 0; - for(i = 0; i < sizeof(features)/sizeof(sensors_chip_feature); i++) { + for(i = 0; i < ARRAY_SIZE(features); i++) { if (features[i].data.name) { dyn_features[fnum] = features[i]; fnum++; diff --git a/prog/dump/isadump.c b/prog/dump/isadump.c index 04eee8d3..55fd9005 100644 --- a/prog/dump/isadump.c +++ b/prog/dump/isadump.c @@ -47,7 +47,7 @@ unsigned long isa_io_base = 0; /* XXX for now */ #endif /* __powerpc__ */ -void help(void) +static void help(void) { fprintf(stderr, "Syntax for I2C-like access:\n" @@ -56,7 +56,7 @@ void help(void) " isadump [-y] -f ADDRESS [RANGE [BANK [BANKREG]]]\n"); } -int default_bankreg(int flat, int addrreg, int datareg) +static int default_bankreg(int flat, int addrreg, int datareg) { if (flat) { return 0x09; /* Works for National Semiconductor @@ -71,7 +71,7 @@ int default_bankreg(int flat, int addrreg, int datareg) return 0x4e; /* Works for Winbond ISA chips, default */ } -int set_bank(int flat, int addrreg, int datareg, int bank, int bankreg) +static int set_bank(int flat, int addrreg, int datareg, int bank, int bankreg) { int oldbank; diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index dc2b7583..6984f881 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -64,7 +64,7 @@ static void sensors_get_available_features(const sensors_chip_name *name, iter->mapping != SENSORS_NO_MAPPING && iter->mapping == feature->number) { sensors_feature_type type = sensors_feature_get_type(iter); - unsigned int indx; + int indx; if (type == SENSORS_FEATURE_UNKNOWN) continue; @@ -87,7 +87,7 @@ static int sensors_get_label_size(const sensors_chip_name *name) int i, j, valid; const sensors_feature_data *iter; char *label; - int max_size = 11; /* Initialised to 11 as minumum label-width */ + unsigned int max_size = 11; /* Initialised to 11 as minumum label-width */ i = j = 0; while((iter = sensors_get_all_features(*name, &i, &j))) { diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 48aa9d08..03c6670e 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -95,7 +95,7 @@ void print_version(void) /* This examines global var config_file, and leaves the name there too. It also opens config_file. */ -void open_config_file(const char* config_file_name) +static void open_config_file(const char* config_file_name) { if (!strcmp(config_file_name,"-")) { config_file = stdin; @@ -110,7 +110,7 @@ void open_config_file(const char* config_file_name) } } -void close_config_file(const char* config_file_name) +static void close_config_file(const char* config_file_name) { if (fclose(config_file) == EOF) { fprintf(stderr,"Could not close config file\n"); From 3e37149f041779cdf1181a0e303e469269845af0 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 3 Jul 2007 19:38:37 +0000 Subject: [PATCH 111/718] generic in and fan print routine fixes git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4549 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 41 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 6984f881..b19a9657 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -249,16 +249,14 @@ static void print_generic_chip_in(const sensors_chip_name *name, free(label); printf("%+6.2f V", val); - if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) - printf(" (min = %+6.2f V", IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN)); - - if (IN_FEATURE(SENSORS_FEATURE_IN_MAX)) { - if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) - printf(", "); - else - printf(" ("); - printf("max = %+6.2f V)", IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); - } + if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && IN_FEATURE(SENSORS_FEATURE_IN_MAX)) + printf(" (min = %+6.2f V, max = %+6.2f V)", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN), + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); + else if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) + printf(" (min = %+6.2f V)", IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN)); + else if (IN_FEATURE(SENSORS_FEATURE_IN_MAX)) + printf(" (max = %+6.2f V)", IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM) || IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { @@ -319,16 +317,21 @@ static void print_generic_chip_fan(const sensors_chip_name *name, sensors_get_available_features(name, feature, i, j, has_features, feature_vals, size, SENSORS_FEATURE_FAN); - if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) { - printf(" (min = %4.0f RPM", FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN)); - - if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) { - printf(", div = %1.0f", FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); - } - - printf(")"); - } + if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN) && + FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) + printf(" (min = %4.0f RPM, div = %1.0f)", + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN), + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); + else if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) + printf(" (min = %4.0f RPM)", FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN)); + else if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) + printf(" (div = %1.0f)", FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); + /* ALARM and FAULT features */ + if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) { + printf(" FAULT"); + } else if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM) && FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_ALARM)) { printf(" ALARM"); From eeee6f9bb7d70719aeeb373d58741294ae3494ad Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 4 Jul 2007 07:54:37 +0000 Subject: [PATCH 112/718] Add support for foo#_label sysfs files git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4550 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/access.c b/lib/access.c index 620e5d87..f9a8eb9e 100644 --- a/lib/access.c +++ b/lib/access.c @@ -151,6 +151,8 @@ int sensors_get_label(sensors_chip_name name, int feature, char **result) { const sensors_chip *chip; const sensors_chip_feature *featureptr; + char buf[128], path[PATH_MAX]; + FILE *f; int i; *result = NULL; @@ -162,16 +164,30 @@ int sensors_get_label(sensors_chip_name name, int feature, char **result) for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->labels_count; i++) if (!strcasecmp(featureptr->data.name,chip->labels[i].name)){ - if (*result) - free(*result); - if (!(*result = strdup(chip->labels[i].value))) - sensors_fatal_error("sensors_get_label", - "Allocating label text"); - return 0; + *result = strdup(chip->labels[i].value); + goto sensors_get_label_exit; } + /* No user specified label, check for a _label sysfs file */ + snprintf(path, PATH_MAX, "%s/%s_label", name.busname, + featureptr->data.name); + + if ((f = fopen(path, "r"))) { + i = fread(buf, 1, sizeof(buf) - 1, f); + fclose(f); + if (i > 0) { + /* i - 1 to strip the '\n' at the end */ + buf[i - 1] = 0; + *result = strdup(buf); + goto sensors_get_label_exit; + } + } + /* No label, return the feature name instead */ - if (!(*result = strdup(featureptr->data.name))) + *result = strdup(featureptr->data.name); + +sensors_get_label_exit: + if (*result == NULL) sensors_fatal_error("sensors_get_label", "Allocating label text"); return 0; From 7cb36ef6d25e20943ad86dd0709356257b209304 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 5 Jul 2007 11:22:57 +0000 Subject: [PATCH 113/718] add AMDSI PECI sensortype support to generic_temp_print() git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4552 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index b19a9657..8e43ecb5 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -159,12 +159,14 @@ static void print_generic_chip_temp(const sensors_chip_name *name, /* print out temperature sensor info */ if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_SENS); - printf("sensor = %s ", sens == 0 ? "disabled" : - sens == 1 ? "diode" : - sens == 2 ? "transistor" : - sens == 3 ? "thermal diode" : - sens == 4 ? "thermistor" : - "unkown"); + printf("sensor = %s", sens == 0 ? "disabled" : + sens == 1 ? "diode" : + sens == 2 ? "transistor" : + sens == 3 ? "thermal diode" : + sens == 4 ? "thermistor" : + sens == 5 ? "AMD AMDSI" : + sens == 6 ? "Intel PECI" : + "unknown"); } /* ALARM and FAULT features */ From 7a2ab38ecff2cbd908112de549eb5a5102f7ebdc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 5 Jul 2007 15:03:22 +0000 Subject: [PATCH 114/718] Move sensors_proc_read and sensors_proc_write to sysfs.c, and rename them to something more in line with what they do. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4553 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/Module.mk | 3 +- lib/access.c | 6 ++-- lib/proc.c | 97 --------------------------------------------------- lib/proc.h | 31 ---------------- lib/sysfs.c | 65 ++++++++++++++++++++++++++++++++++ lib/sysfs.h | 6 ++++ 6 files changed, 75 insertions(+), 133 deletions(-) delete mode 100644 lib/proc.c delete mode 100644 lib/proc.h diff --git a/lib/Module.mk b/lib/Module.mk index 14b220c9..abfd3d69 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -46,8 +46,7 @@ LIBTARGETS := $(MODULE_DIR)/$(LIBSTLIBNAME) $(MODULE_DIR)/$(LIBSHLIBNAME) \ $(MODULE_DIR)/$(LIBSHSONAME) $(MODULE_DIR)/$(LIBSHBASENAME) LIBCSOURCES := $(MODULE_DIR)/data.c $(MODULE_DIR)/general.c \ - $(MODULE_DIR)/error.c \ - $(MODULE_DIR)/proc.c $(MODULE_DIR)/access.c \ + $(MODULE_DIR)/error.c $(MODULE_DIR)/access.c \ $(MODULE_DIR)/init.c $(MODULE_DIR)/sysfs.c LIBOTHEROBJECTS := $(MODULE_DIR)/conf-parse.o $(MODULE_DIR)/conf-lex.o diff --git a/lib/access.c b/lib/access.c index f9a8eb9e..32a820b2 100644 --- a/lib/access.c +++ b/lib/access.c @@ -24,7 +24,7 @@ #include "sensors.h" #include "data.h" #include "error.h" -#include "proc.h" +#include "sysfs.h" #include "general.h" static int sensors_eval_expr(sensors_chip_name chipname, @@ -258,7 +258,7 @@ int sensors_get_feature(sensors_chip_name name, int feature, double *result) expr = chip->computes[i].from_proc; } } - if (sensors_read_proc(name, feature, &val)) + if (sensors_read_sysfs_attr(name, feature, &val)) return -SENSORS_ERR_PROC; if (!expr) *result = val; @@ -306,7 +306,7 @@ int sensors_set_feature(sensors_chip_name name, int feature, double value) if (expr) if ((res = sensors_eval_expr(name, expr, value, &to_write))) return res; - if (sensors_write_proc(name, feature, to_write)) + if (sensors_write_sysfs_attr(name, feature, to_write)) return -SENSORS_ERR_PROC; return 0; } diff --git a/lib/proc.c b/lib/proc.c deleted file mode 100644 index 6edcb00f..00000000 --- a/lib/proc.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - proc.c - Part of libsensors, a Linux library for reading sensor data. - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include -#include - -#include "data.h" -#include "error.h" -#include "access.h" -#include "proc.h" - -/* This reads a feature from a sysfs file. - Sysfs uses a one-value-per file system... -*/ -int sensors_read_proc(sensors_chip_name name, int feature, double *value) -{ - const sensors_chip_feature *the_feature; - int mag; - char n[NAME_MAX]; - FILE *f; - int dummy; - char check; - const char *suffix = ""; - - if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) - return -SENSORS_ERR_NO_ENTRY; - - /* REVISIT: this is a ugly hack */ - if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 - || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 - || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) - suffix = "_input"; - - snprintf(n, NAME_MAX, "%s/%s%s", name.busname, the_feature->data.name, - suffix); - if ((f = fopen(n, "r"))) { - int res = fscanf(f, "%lf", value); - fclose(f); - if (res != 1) - return -SENSORS_ERR_PROC; - for (mag = the_feature->scaling; mag > 0; mag --) - *value /= 10.0; - } else - return -SENSORS_ERR_PROC; - - return 0; -} - -int sensors_write_proc(sensors_chip_name name, int feature, double value) -{ - const sensors_chip_feature *the_feature; - int mag; - char n[NAME_MAX]; - FILE *f; - int dummy; - char check; - const char *suffix = ""; - - if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) - return -SENSORS_ERR_NO_ENTRY; - - /* REVISIT: this is a ugly hack */ - if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 - || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 - || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) - suffix = "_input"; - - snprintf(n, NAME_MAX, "%s/%s%s", name.busname, the_feature->data.name, - suffix); - if ((f = fopen(n, "w"))) { - for (mag = the_feature->scaling; mag > 0; mag --) - value *= 10.0; - fprintf(f, "%d", (int) value); - fclose(f); - } else - return -SENSORS_ERR_PROC; - - return 0; -} diff --git a/lib/proc.h b/lib/proc.h deleted file mode 100644 index d4283ad5..00000000 --- a/lib/proc.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - proc.h - Part of libsensors, a Linux library for reading sensor data. - Copyright (c) 1998, 1999 Frodo Looijaard - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef SENSORS_LIB_PROC_H -#define SENSORS_LIB_PROC_H - -/* Read a value out of a /proc file */ -extern int sensors_read_proc(sensors_chip_name name, int feature, - double *value); - -/* Write a value to a /proc file */ -extern int sensors_write_proc(sensors_chip_name name, int feature, - double value); - -#endif diff --git a/lib/sysfs.c b/lib/sysfs.c index c63cb75d..afcdc5e9 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -393,3 +393,68 @@ exit0: return ret; } +int sensors_read_sysfs_attr(sensors_chip_name name, int feature, double *value) +{ + const sensors_chip_feature *the_feature; + int mag; + char n[NAME_MAX]; + FILE *f; + int dummy; + char check; + const char *suffix = ""; + + if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) + return -SENSORS_ERR_NO_ENTRY; + + /* REVISIT: this is a ugly hack */ + if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 + || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 + || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) + suffix = "_input"; + + snprintf(n, NAME_MAX, "%s/%s%s", name.busname, the_feature->data.name, + suffix); + if ((f = fopen(n, "r"))) { + int res = fscanf(f, "%lf", value); + fclose(f); + if (res != 1) + return -SENSORS_ERR_PROC; + for (mag = the_feature->scaling; mag > 0; mag --) + *value /= 10.0; + } else + return -SENSORS_ERR_PROC; + + return 0; +} + +int sensors_write_sysfs_attr(sensors_chip_name name, int feature, double value) +{ + const sensors_chip_feature *the_feature; + int mag; + char n[NAME_MAX]; + FILE *f; + int dummy; + char check; + const char *suffix = ""; + + if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) + return -SENSORS_ERR_NO_ENTRY; + + /* REVISIT: this is a ugly hack */ + if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 + || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 + || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) + suffix = "_input"; + + snprintf(n, NAME_MAX, "%s/%s%s", name.busname, the_feature->data.name, + suffix); + if ((f = fopen(n, "w"))) { + for (mag = the_feature->scaling; mag > 0; mag --) + value *= 10.0; + fprintf(f, "%d", (int) value); + fclose(f); + } else + return -SENSORS_ERR_PROC; + + return 0; +} diff --git a/lib/sysfs.h b/lib/sysfs.h index 77df571a..d9660dc3 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -28,4 +28,10 @@ extern int sensors_read_sysfs_chips(void); extern int sensors_read_sysfs_bus(void); +/* Read a value out of a sysfs attribute file */ +int sensors_read_sysfs_attr(sensors_chip_name name, int feature, double *value); + +/* Write a value to a sysfs attribute file */ +int sensors_write_sysfs_attr(sensors_chip_name name, int feature, double value); + #endif /* !SENSORS_LIB_SYSFS_H */ From 9cd9debba9199fbaf26a345f47035f0a65ed5d5d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 5 Jul 2007 16:09:40 +0000 Subject: [PATCH 115/718] Add support for multiple VID values. Untested as I don't have a chip with multiple VIDs, but these exist. This closes ticket #2223. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4554 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 2 +- lib/sysfs.c | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/sensors.h b/lib/sensors.h index 8f804dd4..987742a3 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -145,7 +145,7 @@ extern const sensors_feature_data *sensors_get_all_features (sensors_chip_name name, int *nr1,int *nr2); /* This enum contains some "magic" used by sensors_read_dynamic_chip() from - lib/sysfs.c . All the sensor-types (in, fan, temp, misc) are a multiple of + lib/sysfs.c. All the sensor types (in, fan, temp, vid) are a multiple of 0x100 apart, and sensor features which should not have a compute_mapping to the _input feature start at 0x?10. */ typedef enum sensors_feature_type { diff --git a/lib/sysfs.c b/lib/sysfs.c index afcdc5e9..6111ff98 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -66,12 +66,12 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, struct sysfs_attribute *attr; struct dlist *attrs; /* room for all 3 (in, fan, temp) types, with all their subfeatures - + misc features. We use a large sparse table at first to store all + + VID. We use a large sparse table at first to store all found features, so that we can store them sorted at type and index and then later create a dense sorted table */ sensors_chip_feature features[MAX_SENSORS_PER_TYPE * SENSORS_FEATURE_MAX_SUB_FEATURES * 3 + - SENSORS_FEATURE_MAX_SUB_FEATURES]; + MAX_SENSORS_PER_TYPE]; sensors_chip_feature *dyn_features; char *name; @@ -105,7 +105,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, continue; } - /* Get N as in this is the N-th in / fan / temp sensor */ + /* Get N as in this is the N-th in / fan / temp / vid */ switch (type & 0xFF00) { case SENSORS_FEATURE_IN: i = strtol(name + 2, NULL, 10); @@ -118,8 +118,8 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, i = strtol(name + 4, NULL, 10); if (i) i--; break; - case SENSORS_FEATURE_VID: /* first misc feature */ - i = 0; + case SENSORS_FEATURE_VID: + i = strtol(name + 3, NULL, 10); break; } @@ -133,9 +133,15 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* "calculate" a place to store the feature in our sparse, sorted table */ - i = (type >> 8) * MAX_SENSORS_PER_TYPE * - SENSORS_FEATURE_MAX_SUB_FEATURES + - i * SENSORS_FEATURE_MAX_SUB_FEATURES + (type & 0xFF); + if (type == SENSORS_FEATURE_VID) { + i += MAX_SENSORS_PER_TYPE * + SENSORS_FEATURE_MAX_SUB_FEATURES * 3; + } else { + i = (type >> 8) * MAX_SENSORS_PER_TYPE * + SENSORS_FEATURE_MAX_SUB_FEATURES + + i * SENSORS_FEATURE_MAX_SUB_FEATURES + + (type & 0xFF); + } if (features[i].data.name) { fprintf(stderr, "libsensors error, trying to add dupli" @@ -148,9 +154,8 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* fill in the other feature members */ feature.data.number = i + 1; - if ( (type & 0xFF00) == SENSORS_FEATURE_VID || - (type & 0x00FF) == 0) { - /* misc sensor or main feature */ + if ((type & 0x00FF) == 0) { + /* main feature */ feature.data.mapping = SENSORS_NO_MAPPING; feature.data.compute_mapping = SENSORS_NO_MAPPING; } else if (type & 0x10) { From b998b35ecc74e2a227af42722ac36600cea19ee6 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 5 Jul 2007 16:15:27 +0000 Subject: [PATCH 116/718] update fintek f71882fg sensors-detect entry git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4555 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index a9c14783..37d2b63a 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1894,8 +1894,8 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); logdev => 0x04, }, { - name => "Fintek F71882FG Super IO Sensors", - driver => "to-be-written", + name => "Fintek F71882FG/F71883FG Super IO Sensors", + driver => "f71882fg", devid => 0x0541, logdev => 0x04, }, From 83fe82736d7c06183a9d2effd19342a36ac5aae9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 5 Jul 2007 16:19:51 +0000 Subject: [PATCH 117/718] Prevent a potential array overrun. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4556 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 8e43ecb5..3bc9f8e9 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -70,7 +70,7 @@ static void sensors_get_available_features(const sensors_chip_name *name, continue; indx = type - first_val - 1; - if (indx >= size) { + if (indx < 0 || indx >= size) { printf("ERROR: Bug in sensors: index out of bound"); return; } From 4d2fa4eaddff25e1cb84dacd136386f76d68c006 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 5 Jul 2007 21:03:06 +0000 Subject: [PATCH 118/718] Better generic print fault handling git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4559 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 29 ++++++++++++++--------------- prog/sensors/chips_generic.c | 23 ++++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index c949456d..7ec0f448 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "chips.h" #include "lib/sensors.h" @@ -41,40 +42,38 @@ static inline float deg_ctof(float cel) void print_temp_info(float n_cur, float n_over, float n_hyst, int minmax, int curprec, int limitprec) { + /* note: deg_ctof() will preserve HUGEVAL */ if (fahrenheit) { n_cur = deg_ctof(n_cur); n_over = deg_ctof(n_over); n_hyst = deg_ctof(n_hyst); } -/* use %* to pass precision as an argument */ + /* use %* to pass precision as an argument */ + if (n_cur != HUGE_VAL) + printf("%+6.*f%s ", curprec, n_cur, degstr); + else + printf("FAULT "); + if(minmax == MINMAX) - printf("%+6.*f%s (low = %+5.*f%s, high = %+5.*f%s) ", - curprec, n_cur, degstr, + printf("(low = %+5.*f%s, high = %+5.*f%s) ", limitprec, n_hyst, degstr, limitprec, n_over, degstr); else if(minmax == MAXONLY) - printf("%+6.*f%s (high = %+5.*f%s) ", - curprec, n_cur, degstr, + printf("(high = %+5.*f%s) ", limitprec, n_over, degstr); else if(minmax == CRIT) - printf("%+6.*f%s (high = %+5.*f%s, crit = %+5.*f%s) ", - curprec, n_cur, degstr, + printf("(high = %+5.*f%s, crit = %+5.*f%s) ", limitprec, n_over, degstr, limitprec, n_hyst, degstr); else if(minmax == HYST) - printf("%+6.*f%s (high = %+5.*f%s, hyst = %+5.*f%s) ", - curprec, n_cur, degstr, + printf("(high = %+5.*f%s, hyst = %+5.*f%s) ", limitprec, n_over, degstr, limitprec, n_hyst, degstr); - else if(minmax == SINGLE) - printf("%+6.*f%s", - curprec, n_cur, degstr); else if(minmax == HYSTONLY) - printf("%+6.*f%s (hyst = %+5.*f%s) ", - curprec, n_cur, degstr, + printf("(hyst = %+5.*f%s) ", limitprec, n_over, degstr); - else + else if(minmax != SINGLE) printf("Unknown temperature mode!"); } diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 3bc9f8e9..28bd2a56 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -21,6 +21,7 @@ #include #include +#include #include "chips_generic.h" #include "chips.h" @@ -151,6 +152,10 @@ static void print_generic_chip_temp(const sensors_chip_name *name, type = SINGLE; } + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT)) + val = HUGE_VAL; + print_label(label, label_size); free(label); @@ -169,11 +174,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, "unknown"); } - /* ALARM and FAULT features */ - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT) > 0.5) { - printf(" FAULT"); - } else + /* ALARM features */ if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) || (type == MINMAX && @@ -314,7 +315,12 @@ static void print_generic_chip_fan(const sensors_chip_name *name, print_label(label, label_size); free(label); - printf("%4.0f RPM", val); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) + printf("FAULT "); + else + printf("%4.0f RPM", val); sensors_get_available_features(name, feature, i, j, has_features, feature_vals, size, SENSORS_FEATURE_FAN); @@ -329,11 +335,6 @@ static void print_generic_chip_fan(const sensors_chip_name *name, else if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) printf(" (div = %1.0f)", FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); - /* ALARM and FAULT features */ - if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) { - printf(" FAULT"); - } else if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM) && FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_ALARM)) { printf(" ALARM"); From e17f73da249d45763a7a8995b636b0f2012f8930 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 6 Jul 2007 09:54:10 +0000 Subject: [PATCH 119/718] Fix ADM1022 detection. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4562 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 8a1149fd..dd57a07c 100644 --- a/CHANGES +++ b/CHANGES @@ -48,6 +48,7 @@ SVN HEAD No longer depend on i2cdetect Add SMSC SCH5317 detection Drop detection of most non-sensors I2C chips + Fix ADM1022 detection 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 37d2b63a..467e89be 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -4469,7 +4469,9 @@ sub adm1022_detect return unless ($chip == 0 and $reg == 0x41) or ($chip == 1 and $reg == 0x49) or ($chip == 2 and $reg == 0x41); - return unless (i2c_smbus_read_byte_data($file,0x40) & 0x80) == 0x00; + $reg = i2c_smbus_read_byte_data($file,0x40); + return if ($reg & 0x10); # Soft Reset always reads 0 + return if ($chip != 0 and ($reg & 0x80)); # Reserved on THMC50 and ADM1028 $reg = i2c_smbus_read_byte_data($file, 0x3f) & 0xf0; return unless ($chip == 0 and $reg == 0xc0) or ($chip == 1 and $reg == 0xc0) or From b1281bf6698ec3ce37fdefc090d24757ba11dde7 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 6 Jul 2007 13:19:00 +0000 Subject: [PATCH 120/718] improve generic print of temp inputs with so many limits they span 2 lines git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4564 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 89 +++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 28bd2a56..cf447df1 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -100,6 +100,14 @@ static int sensors_get_label_size(const sensors_chip_name *name) return max_size + 1; } +extern int fahrenheit; +extern char degstr[5]; + +static inline float deg_ctof(float cel) +{ + return ( cel * ( 9.0F / 5.0F ) + 32.0F ); +} + #define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] #define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] static void print_generic_chip_temp(const sensors_chip_name *name, @@ -161,6 +169,43 @@ static void print_generic_chip_temp(const sensors_chip_name *name, print_temp_info(val, max, min, type, 1, 1); + /* ALARM features */ + if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) + || (type == MINMAX && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM) > 0.5) + || (type == MINMAX && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM) > 0.5) + || (type == CRIT && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5)) { + printf("ALARM "); + } + + if (type != CRIT && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { + if (fahrenheit) { + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT) = deg_ctof( + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT)); + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST) = deg_ctof( + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST)); + } + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) + printf("\n%*s(crit = %+5.1f%s, hyst = %+5.1f%s) ", label_size + 10, "", + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), degstr, + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST), degstr); + else + printf("\n%*s(crit = %+5.1f%s) ", label_size + 10, "", + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), degstr); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) { + printf("ALARM "); + } + } + /* print out temperature sensor info */ if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_SENS); @@ -173,49 +218,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, sens == 6 ? "Intel PECI" : "unknown"); } - - /* ALARM features */ - if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) - || (type == MINMAX && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM) > 0.5) - || (type == MINMAX && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM) > 0.5)) { - printf(" ALARM"); - } printf("\n"); - - if (type != CRIT && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - const sensors_feature_data *subfeature; - max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST); - type = HYSTONLY; - } else { - type = SINGLE; - min = 0.0; - } - - subfeature = sensors_get_sub_feature_by_type(name, feature, i, j, - SENSORS_FEATURE_TEMP_CRIT); - if (subfeature) { - sensors_get_label_and_valid(*name, subfeature->number, &label, &valid); - - if (valid) { - print_label(label, label_size); - free(label); - print_temp_info(max, min, 0, type, 1, 1); - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5) { - printf(" ALARM"); - } - printf("\n"); - } - } - } } #define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] @@ -337,7 +340,7 @@ static void print_generic_chip_fan(const sensors_chip_name *name, if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM) && FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_ALARM)) { - printf(" ALARM"); + printf(" ALARM"); } printf("\n"); From 1864d90513333c0123a63019732a05259693d63b Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 6 Jul 2007 19:14:18 +0000 Subject: [PATCH 121/718] also recognise /etc/modprobe.conf (Fedora patch) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4567 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 467e89be..f4769b09 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2168,6 +2168,8 @@ sub initialize_conf $modules_conf = '/etc/modules.conf'; } elsif (-f '/etc/conf.modules') { $modules_conf = '/etc/conf.modules'; + } elsif (-f '/etc/modprobe.conf') { + $modules_conf = '/etc/modprobe.conf'; } else { # default $modules_conf = '/etc/modules.conf'; } From 9fb93e1ff9b6e6435c4ac1fa1b21e917bac8343d Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 6 Jul 2007 19:24:57 +0000 Subject: [PATCH 122/718] handle /usr/bin location of sensors command in example scripts printed by sensors-detect git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4569 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index f4769b09..669f33e5 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -5632,7 +5632,9 @@ sub main print "#----cut here----\n". $modprobes. "# sleep 2 # optional\n". - "/usr/local/bin/sensors -s # recommended\n". + (-e '/usr/bin/sensors' ? + "/usr/bin/sensors -s # recommended\n" : + "/usr/local/bin/sensors -s # recommended\n") . "#----cut here----\n\n"; print "If you have some drivers built into your kernel, the list above will\n". From d2c3d2d14f3f1850c9c07bbc9d25c1067ab8c1d2 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 6 Jul 2007 19:40:44 +0000 Subject: [PATCH 123/718] try to run MAKEDEV if i2c-dev device files are missing before aborting (adapted fedora patch) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4572 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 669f33e5..dbf60131 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2175,6 +2175,9 @@ sub initialize_conf } if (!($use_devfs || $use_udev)) { + if (! -c '/dev/i2c-0' && -x '/sbin/MAKEDEV') { + system("/sbin/MAKEDEV i2c"); + } if (-c '/dev/i2c-0') { $dev_i2c = '/dev/i2c-'; } else { # default From 2296f9b738fd5b0a2f5892c02dbb00db679f0f27 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 7 Jul 2007 08:29:48 +0000 Subject: [PATCH 124/718] Add the recent donations from Observit. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4577 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/donations | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/donations b/doc/donations index 25406753..5242fd49 100644 --- a/doc/donations +++ b/doc/donations @@ -99,3 +99,11 @@ Winbond Asus P4P800-X, Pentium 4 2.8 GHz, 512 MB RAM 2006-08 This board has an (hidden) Intel 82801EB Jean Delvare (ICH5) SMBus with SPD EEPROMs connected, and a Winbond W83627THF hardware monitoring chip. + +Observit Intel D865GSA, Celeron D-352, 128 MB RAM 2007-06 + Resulted in: backport of the w83627ehf driver Jean Delvare + to Linux 2.4, improvements to the Linux 2.6 + w83627ehf driver. + +Observit Intel D865GBF, Celeron 2.4 GHz, 512 MB RAM 2007-06 + Resulted in: improvements to the lm85 driver. Jean Delvare From 3549a9423225d16db2ebd132ed4503e6e1ea8c5e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 7 Jul 2007 15:26:12 +0000 Subject: [PATCH 125/718] Right-align FAULT flags. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4578 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 2 +- prog/sensors/chips_generic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 7ec0f448..7a159077 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -53,7 +53,7 @@ void print_temp_info(float n_cur, float n_over, float n_hyst, if (n_cur != HUGE_VAL) printf("%+6.*f%s ", curprec, n_cur, degstr); else - printf("FAULT "); + printf(" FAULT "); if(minmax == MINMAX) printf("(low = %+5.*f%s, high = %+5.*f%s) ", diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index cf447df1..4a4b1ac5 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -321,7 +321,7 @@ static void print_generic_chip_fan(const sensors_chip_name *name, if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) - printf("FAULT "); + printf(" FAULT"); else printf("%4.0f RPM", val); From 15f1274aef7dccadf4c1bcea5db19663ad48aa4b Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 7 Jul 2007 16:57:07 +0000 Subject: [PATCH 126/718] add f71882fg sensors.conf.eg entry git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4580 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 06dd49c6..77ba9449 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -2848,3 +2848,50 @@ chip "dme1737-*" # set fan4_min 1000 # set fan5_min 1000 # set fan6_min 1000 + + +# +# sample configuration for the Fintek f71882fg and f71883fg +# +# The configuration below is for the Epox EP-9U1697 GLI board, which has a +# Fintek f71883fg relabeled as Epox ep1308, this is the default config as this +# driver is developed and tested on an Epox EP-9U1697 GLI board. +# +# Premade configurations for other boards can be found at: +# http://www.lm-sensors.org/trac/wiki/Configurations/ +# If your motherboard isn't listed there and you create a configuration for it +# please add it there. +# +chip "f71882fg-*" + +# Temperature + label temp1 "CPU" + label temp2 "System" + ignore temp3 + +# Fans + label fan1 "CPU" + ignore fan2 + ignore fan3 + ignore fan4 + +# Voltage + label in0 "3.3V" + label in1 "Vcore" + label in2 "Vdimm" + label in3 "Vchip" + label in4 "+5V" + label in5 "12V" + label in6 "5VSB" + label in7 "3VSB" + label in8 "Batery" + +# never change the in0, in7 and in8 compute, these are hardwired in the chip! + compute in0 (@ * 2), (@ / 2) + compute in2 (@ * 2), (@ / 2) + compute in3 (@ * 2), (@ / 2) + compute in4 (@ * 5.25), (@ / 5.25) + compute in5 (@ * 12.83), (@ / 12.83) + compute in6 (@ * 5.25), (@ / 5.25) + compute in7 (@ * 2), (@ / 2) + compute in8 (@ * 2), (@ / 2) From d33285b3b0fc2a3a7b2e52ed8fb2a4c4c6f4a0a4 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 7 Jul 2007 20:04:59 +0000 Subject: [PATCH 127/718] Cleanup the module.conf / modprobe.conf selection code. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4585 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index dbf60131..4996bf6b 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2164,13 +2164,9 @@ sub initialize_conf } } - if (-f '/etc/modules.conf') { - $modules_conf = '/etc/modules.conf'; - } elsif (-f '/etc/conf.modules') { - $modules_conf = '/etc/conf.modules'; - } elsif (-f '/etc/modprobe.conf') { + if (kernel_version_at_least(2, 6, 0)) { $modules_conf = '/etc/modprobe.conf'; - } else { # default + } else { $modules_conf = '/etc/modules.conf'; } @@ -5439,11 +5435,11 @@ sub main exit -1; } + initialize_kernel_version(); initialize_conf; initialize_proc_pci; initialize_modules_list; initialize_modules_supported; - initialize_kernel_version; initialize_cpu_list(); print "# sensors-detect revision $revision\n\n"; From caa92d7b1e6fed24a1316a7f0579d62d930fdd1a Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 8 Jul 2007 05:56:43 +0000 Subject: [PATCH 128/718] add check for /dev/MAKEDEV git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4587 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 4996bf6b..73b8e715 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2174,10 +2174,13 @@ sub initialize_conf if (! -c '/dev/i2c-0' && -x '/sbin/MAKEDEV') { system("/sbin/MAKEDEV i2c"); } + if (! -c '/dev/i2c-0' && -x '/dev/MAKEDEV') { + system("/dev/MAKEDEV i2c"); + } if (-c '/dev/i2c-0') { $dev_i2c = '/dev/i2c-'; } else { # default - print "No i2c device files found. Use prog/mkdev/mkdev.sh to create them.\n"; + print "No i2c device files found.\n"; exit -1; } } From 759098c8f8e30aafbea10a8636d26df002f4fede Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 8 Jul 2007 10:04:48 +0000 Subject: [PATCH 129/718] Use linear interpolation instead of quadratic to choose PWM values. This is simpler and will work better in most cases. For example this should address at least part of ticket #2224. It seems that quadratic was used to lower the average noise level, but I don't think this is a valid reason. The new MINPWM and MAXPWM parameters will also let the user control the noise level if really needed. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4589 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + doc/fancontrol.txt | 6 ++---- prog/pwm/fancontrol | 2 +- prog/pwm/fancontrol.pl | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index dd57a07c..2cf39801 100644 --- a/CHANGES +++ b/CHANGES @@ -29,6 +29,7 @@ SVN HEAD Check for configuration file validity Support optional min and max PWM values Better integration with init scripts + Use linear control instead of quadratic Program pwmconfig: Use smaller steps for low PWM values Support optional min and max PWM values Program rrd: Support only hwmon class devices diff --git a/doc/fancontrol.txt b/doc/fancontrol.txt index 25f8afb1..eee5bf49 100644 --- a/doc/fancontrol.txt +++ b/doc/fancontrol.txt @@ -120,16 +120,14 @@ fancontrol first reads its configuration, writes it to arrays and loops its main function. This function gets the temperatures and fanspeeds from kernel driver files and calculates new speeds depending on temperature changes, but only if the temp is between MINTEMP and MAXTEMP. After that, the -new values are written to the pwm outputs. Currently the speed increases -quadratically with rising temperature. This way you won't hear your fans most -of the time at best. +new values are written to the pwm outputs. The pwm value increases +linearly with rising temperature. Planned features rc-scripts for some gnu/linux-distributions smoother regulation (temp interpolation) -other curve styles (linear, exponential) gui for configuration If you have other wishes or want to contribute something, please let me know: diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index 107da10a..448b3d47 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -324,7 +324,7 @@ function UpdateFanSpeeds { then pwmval=$maxpwm # over max temp, use defined max pwm else # calculate the new value from temperature and settings - let pwmval="((${tval}-${mint})**2)*(${maxpwm}-${minso})/((${maxt}-${mint})**2)+${minso}" + let pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}" if [ $pwmpval -eq 0 -o $fanval -eq 0 ] then # if fan was stopped start it using a safe value echo $minsa > $pwmo diff --git a/prog/pwm/fancontrol.pl b/prog/pwm/fancontrol.pl index cb7327bc..fe7f68b4 100755 --- a/prog/pwm/fancontrol.pl +++ b/prog/pwm/fancontrol.pl @@ -390,7 +390,7 @@ sub UpdateFanSpeeds() { $pwmval = MAX; } else { - $pwmval = eval ( ($tval - $mint) / ($maxt - $mint) )**2 ; + $pwmval = eval ( ($tval - $mint) / ($maxt - $mint) ); $pwmval *= (255 - $minso); $pwmval += $minso; $pwmval = int($pwmval); From cd0b8c3489b309b4e2d62a5de166123e2582b61b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 8 Jul 2007 10:13:11 +0000 Subject: [PATCH 130/718] Delete fancontrol.pl. The reason given when it was added was that the bash implementation was spawning too many child processes, and that was true, but this has been addressed since. And I don't particularly enjoy maintaining two scripts doing exactly the same thing. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4590 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + doc/progs | 3 - prog/pwm/Module.mk | 1 - prog/pwm/fancontrol.pl | 428 ----------------------------------------- 4 files changed, 1 insertion(+), 432 deletions(-) delete mode 100755 prog/pwm/fancontrol.pl diff --git a/CHANGES b/CHANGES index 2cf39801..97f43f9e 100644 --- a/CHANGES +++ b/CHANGES @@ -30,6 +30,7 @@ SVN HEAD Support optional min and max PWM values Better integration with init scripts Use linear control instead of quadratic + Program fancontrol.pl: Delete, redundant Program pwmconfig: Use smaller steps for low PWM values Support optional min and max PWM values Program rrd: Support only hwmon class devices diff --git a/doc/progs b/doc/progs index 70969930..5567b8e2 100644 --- a/doc/progs +++ b/doc/progs @@ -58,9 +58,6 @@ see useful_addresses.html. Controls fanspeeds responding to changes on temperature sensors. Configuration through pwmconfig. -* prog/pwm/fancontrol.pl (perl script, installed by 'make install') - Reimplementation of fancontrol in perl, with self-daemonizing. - * prog/rrd/sens_update_rrd (written in bash, not installed) This script gathers sensors data and adds it to a round robin database (RRD). RRD is then used to display the graphed data in web pages. diff --git a/prog/pwm/Module.mk b/prog/pwm/Module.mk index 034dfe76..cc1f12b2 100644 --- a/prog/pwm/Module.mk +++ b/prog/pwm/Module.mk @@ -22,7 +22,6 @@ PROGPWMMAN8DIR := $(MANDIR)/man8 PROGPWMMAN8FILES := $(MODULE_DIR)/fancontrol.8 $(MODULE_DIR)/pwmconfig.8 PROGPWMTARGETS := $(MODULE_DIR)/fancontrol \ - $(MODULE_DIR)/fancontrol.pl \ $(MODULE_DIR)/pwmconfig REMOVEPWMBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SBINDIR)/%,$(PROGPWMTARGETS)) diff --git a/prog/pwm/fancontrol.pl b/prog/pwm/fancontrol.pl deleted file mode 100755 index fe7f68b4..00000000 --- a/prog/pwm/fancontrol.pl +++ /dev/null @@ -1,428 +0,0 @@ -#!/usr/bin/perl -wT -# $Id$ -# -# Perl script for temperature dependent fan speed control. -# -# Copyright 2004 dean takemori -# -# This is a reimplementation in perl of Marius Reiner's bash script for -# fan speed control. It has advantages in that it can daemonize itself -# and needn't spawn subprocesses for grep, sleep etc. Much of the structure -# of the bash script is preserved to make mirroring changes easier, so -# this is seriously non-idiomatic perl but at the same time it should not -# be considered a a direct bash to perl translation. -# -# Usage: fancontrol [CONFIGFILE] -# -# For configuration instructions and warnings please see fancontrol.txt, -# which can be found in the doc/ directory or at the website mentioned -# elsewhere. -# -# This script is derived from Marius Reiner's bash version, so it is -# hereby placed under the GPL. -# -# Copyright 2003 Marius Reiner -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - -use warnings; -use strict; -use IO::Handle; -use Getopt::Std; -use POSIX; - -$ENV{PATH} = "/bin:/usr/bin"; - -##### Configuration ##### -use constant DEBUG => 0; -use constant MAX => 255; - -use constant PIDFILE => '/var/run/fancontrol.pid'; -use constant CONFFILE => '/etc/fancontrol'; -use constant LOGFILE => '/var/log/fancontrol/fancontrol.log'; -use constant ERRFILE => '/var/log/fancontrol/fancontrol.err'; -### End Configuration ### - -our $interval; -our $pwmo; -our @afcpwm; -our @afctemp; -our @afcfan; -our @afcmaxtemp; -our @afcmintemp; -our @afcminstart; -our @afcminstop; - -sub loadconfig($); -sub pwmdisable($); -sub pwmenable($); -sub restorefans(); -sub calc(@); -sub UpdateFanSpeeds(); -END { restorefans(); } - -our $opt_d; -getopts('d'); - -my $config = shift; -if (defined($config)) - { loadconfig($config); } -else - { loadconfig(CONFFILE); } - -### Daemonize -if ( defined($opt_d) && ($opt_d == 1) ) - { - my $pid = fork; - POSIX::_exit(0) if $pid; - - unless (defined($pid)) - { die("Couldn't fork: $!"); } - - open(*STDERR, '>', ERRFILE); - IO::Handle::autoflush(*STDERR); - open(*STDOUT, '>>', LOGFILE); - IO::Handle::autoflush(*STDOUT); - - unless (POSIX::setsid()) - { die("Couldn't open new session: $!"); } - - } - -### Pidfile -if (open(FILE, ">" . PIDFILE)) - { - print(FILE "$$\n"); - close(FILE); - } -else - { print(PIDFILE . ": $!\n"); } - - -### What kind of interface? -our $sysfs = 0; -our $dir = '/proc/sys/dev/sensors'; -if (!(-d $dir)) - { - if ($afcpwm[0] =~ m/^hwmon\d/) - { - $dir = '/sys/class/hwmon'; - } - else - { - $dir = '/sys/bus/i2c/devices'; - } - - if (!(-d $dir)) - { die("No sensors found! (are the necessary modules loaded?) : -$!\n"); } - else - { - $sysfs = 1; - } - } - -### Trap signals -$SIG{TERM} = \&restorefans; -$SIG{HUP} = \&restorefans; -$SIG{INT} = \&restorefans; -$SIG{QUIT} = \&restorefans; - -### Enable PWM -print("Enabling PWM on fans...\n"); -my $fcvcount = 0; -while ($fcvcount < $#afcpwm+1) - { - $pwmo = $afcpwm[$fcvcount]; - unless (pwmenable($pwmo)) - { die("Error enabling PWM on $dir/$pwmo : $!\n"); } - $fcvcount++; - } - -print("Starting automatic fan control...\n"); - -while(1) - { - UpdateFanSpeeds(); - sleep($interval); - } - -1; - -################################################################ -sub loadconfig($) -{ - my $file = shift; - - print("Loading configuration from $file ...\n"); - - unless ( (-e $file) && (-r $file) ) - { die("Unable to read config file $file: $!"); } - - open(F, $file); - - our ($interval, $fctemps, $fcfans, $mintemp, $maxtemp, $minstart, -$minstop); - while($_ = ) - { - if ($_ =~ /^\s+$/) { next; } - elsif ($_ =~ /^INTERVAL=\s*(.*)$/) { $interval = $1; next; } - elsif ($_ =~ /^FCTEMPS=\s*(.*)$/) { $fctemps = $1; next; } - elsif ($_ =~ /^FCFANS=\s*(.*)$/) { $fcfans = $1; next; } - elsif ($_ =~ /^MINTEMP=\s*(.*)$/) { $mintemp = $1; next; } - elsif ($_ =~ /^MAXTEMP=\s*(.*)$/) { $maxtemp = $1; next; } - elsif ($_ =~ /^MINSTART=\s*(.*)$/) { $minstart = $1; next; } - elsif ($_ =~ /^MINSTOP=\s*(.*)$/) { $minstop = $1; next; } - } - close(F); - - unless (defined($interval)) - { die("Some settings missing ..."); } - - print("\nCommon settings:\n"); - print(" INTERVAL=$interval\n"); - - my $fcvcount = 0; - foreach my $fcv (split(/\s+/, $fctemps)) - { - ($afcpwm[$fcvcount], $afctemp[$fcvcount]) = split(/=/, $fcv); - - $fcfans =~ s/^\S*=(\S+)\s*//; $afcfan[$fcvcount] = $1; - $mintemp =~ s/^\S*=(\S+)\s*//; $afcmintemp[$fcvcount] = $1; - $maxtemp =~ s/^\S*=(\S+)\s*//; $afcmaxtemp[$fcvcount] = $1; - $minstart =~ s/^\S*=(\S+)\s*//; $afcminstart[$fcvcount] = $1; - $minstop =~ s/^\S*=(\S+)\s*//; $afcminstop[$fcvcount] = $1; - - print("\nSettings for $afcpwm[$fcvcount]:\n"); - print(" Depends on $afctemp[$fcvcount]\n"); - print(" Controls $afcfan[$fcvcount]\n"); - print(" MINTEMP = $afcmintemp[$fcvcount]\n"); - print(" MAXTEMP = $afcmaxtemp[$fcvcount]\n"); - print(" MINSTART = $afcminstart[$fcvcount]\n"); - print(" MINSTOP = $afcminstop[$fcvcount]\n"); - - $fcvcount++; - } -} - - -################################################################ -sub pwmdisable($) -{ - my $p = shift; - - if ($sysfs == 1) - { - if (open(F, ">$dir/$p")) - { - print(F MAX . '\n'); - close(F); - } - else - { die("$dir/$p : $!"); } - - my $enable = "$dir/${p}_enable"; - if (-f $enable) - { - if (open(F, ">$enable")) - { - print(F '0'); - close(F); - } - else - { die("$enable : $!"); } - } - } - else - { - if (open(F, ">$dir/$p")) - { - print(F MAX . ' 0'); - close(F); - } - else - { die("$dir/$p : $!"); } - } - return(1); -} - - -################################################################# -sub pwmenable($) -{ - my $p = shift; - - if ($sysfs == 1) - { - my $enable = "$dir/${p}_enable"; - if (-f $enable) - { - if (open(F, ">$enable")) - { - print(F "1\n"); - close(F); - } - else - { die("$enable : $!\n"); } - } - } - else - { - if (open(F, ">$dir/$p")) - { - print(F MAX . " 1\n"); - close(F); - } - else - { die("$dir/$p : $!\n"); } - } - return(1); -} - - -################################################################ -sub restorefans() -{ - $SIG{TERM} = 'IGNORE'; - $SIG{HUP} = 'IGNORE'; - $SIG{INT} = 'IGNORE'; - $SIG{QUIT} = 'IGNORE'; - - print("Aborting, restoring fans...\n"); - my $fcvcount = 0; - - while ( $fcvcount < $#afcpwm+1) - { - my $pwmo = $afcpwm[$fcvcount]; - &pwmdisable($afcpwm[$fcvcount]); - $fcvcount++; - } - print("Verify fans have returned to full speed\n"); - POSIX:_exit(-1); -} - - -############################################################ -sub UpdateFanSpeeds() -{ - my $fcvcount = 0; - - while ($fcvcount < $#afcpwm+1) - { - my $pwmo = $afcpwm[$fcvcount]; - my $tsens = $afctemp[$fcvcount]; - my $fan = $afcfan[$fcvcount]; - my $mint = $afcmintemp[$fcvcount]; - my $maxt = $afcmaxtemp[$fcvcount]; - my $minsa = $afcminstart[$fcvcount]; - my $minso = $afcminstop[$fcvcount]; - - ### tval - my $tval = 0; - if (open(F, "$dir/$tsens")) - { - $tval = ; - close(F); - } - else - { die("Error reading temperature from $dir/$tsens"); } - $tval =~ /([.\d]+)\s*$/; - $tval = int($1); - if ($sysfs == 1) - { $tval /= 1000; } - - ### pwmpval - my $pwmpval = 0; - if (open(F, "$dir/$pwmo")) - { - $pwmpval = ; - close(F); - } - else - { die("Error reading PWM value from $dir/$pwmo"); } - ($pwmpval) = split(/\s/, $pwmpval); - - ### fanval - my $fanval = 0; - if (open(F, "$dir/$fan")) - { - $fanval = ; - close(F); - } - else - { die("Error reading Fan value from $dir/$fan"); } - $fanval =~ /(\d+)\s$/; - $fanval = $1; - - ### DEBUG - if (DEBUG == 1) - { - print("pwmo=$pwmo\n"); - print("tsens=$tsens\n"); - print("fan=$fan\n"); - print("mint=$mint\n"); - print("maxt=$maxt\n"); - print("minsa=$minsa\n"); - print("minso=$minso\n"); - print("tval=$tval\n"); - print("pwmpval=$pwmpval\n"); - print("fanval=$fanval\n"); - print("\n"); - } - - my $pwmval; - if ($tval <= $mint) - { $pwmval = 0; } - elsif ($tval >= $maxt) - { $pwmval = MAX; } - else - { - $pwmval = eval ( ($tval - $mint) / ($maxt - $mint) ); - $pwmval *= (255 - $minso); - $pwmval += $minso; - $pwmval = int($pwmval); - if ( ($pwmval == 0) || ($fanval == 0) ) - { - if (open(F, ">$dir/$pwmo")) - { - print(F "$minsa\n"); - close(F); - } - else - { die("Error writing PWM value to $dir/$pwmo : $!\n"); } - sleep 1; - } - } - - if (open(F, ">$dir/$pwmo")) - { - print(F "$pwmval\n"); - close(F); - } - else - { die("Error writing PWM value to $dir/$pwmo : $!\n"); } - - if (DEBUG == 1) - { print("new pwmval = $pwmval\n"); } - - $fcvcount++; - } - -} - -1; - - From 982afbce24e46091bbd3ed91e40dd721fca7e068 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 8 Jul 2007 11:17:26 +0000 Subject: [PATCH 131/718] Only write integer values to pwm files. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4591 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/pwm/fancontrol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index 448b3d47..b6391f40 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -45,6 +45,8 @@ MAX=255 echo $$ > /var/run/fancontrol.pid +declare -i pwmval + function LoadConfig { echo "Loading configuration from $1 ..." # grep configuration from file @@ -324,7 +326,7 @@ function UpdateFanSpeeds { then pwmval=$maxpwm # over max temp, use defined max pwm else # calculate the new value from temperature and settings - let pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}" + pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}" if [ $pwmpval -eq 0 -o $fanval -eq 0 ] then # if fan was stopped start it using a safe value echo $minsa > $pwmo From a83ef92c9a3b6e7ab76b7e8a268d29829c54a271 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 8 Jul 2007 12:00:55 +0000 Subject: [PATCH 132/718] Delete mkdev.sh. i2c device nodes are created by devfs or udev on most 2.6 kernel-based systems, for others they should have been created at system installation time. If they are missing, sensors-detect will run MAKEDEV to create them. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4593 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + INSTALL | 5 ----- doc/FAQ | 8 ++++---- doc/lm_sensors-FAQ.html | 4 ++-- doc/lm_sensors-FAQ.texi | 2 +- prog/mkdev/mkdev.sh | 32 -------------------------------- 6 files changed, 8 insertions(+), 44 deletions(-) delete mode 100755 prog/mkdev/mkdev.sh diff --git a/CHANGES b/CHANGES index 97f43f9e..093920e1 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,7 @@ SVN HEAD Program isadump: Detect when address bit 7 is a busy flag Fix Super-I/O exit sequence for Winbond/Fintek chips Program matorb/displayit: Delete, obsolete + Program mkdev.sh: Delete, obsolete Program mkpatch: Delete Program fancontrol: Use let for arithmetic evaluation No longer need awk and grep diff --git a/INSTALL b/INSTALL index 8020648e..ab11952f 100644 --- a/INSTALL +++ b/INSTALL @@ -157,11 +157,6 @@ on which it depends. You can not use demand-loading; you will have to issue explicit modprobe instructions. -If you have an older installation, you will probably have to create the -i2c device files in the /dev directory. They are called /dev/i2c-%d, -and are character devices with major device number 89 and minor device -number %d. The script prog/mkdev/mkdev.sh will create the files for you. - There is a scanning program installed called sensors-detect. It will scan all available I2C and SMBus adapters for all known devices, and will also look for ISA, PCI and Super-I/O chips with sensors, diff --git a/doc/FAQ b/doc/FAQ index 0af9111c..cc4b2c56 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -691,7 +691,7 @@ settings for the Processor Core voltage (often in0_min and in0_max) in that file so that they don't depend on vid. The CPU nominal voltage is computed from VID lines according to a -formula that depends on the CPU type. Since Linux 2.6.14, the right +formula that depends on the CPU type. Since Linux 2.6.9, the right formula is selected automatically. See `doc/vid' for more information. 4.8 I read sensor values several times a second, but they are only updated only each second or so. Why? @@ -1063,9 +1063,9 @@ not loaded and you did not run sensors-detect as root. ----------------------------------------------------- Your `/dev/i2c-0,' `/dev/i2c0', or `/dev/i2c/0' files do not exist or -you did not run `sensors-detect' as root. Run the script -`prog/mkdev/mkdev.sh' to create the `/dev/i2c-x' files. Run `devfs' in -the kernel to get the `/dev/i2c/x' files. +you did not run `sensors-detect' as root. Use `MAKEDEV' or `mknod' to +create the `/dev/i2c-x' files. Run `devfs' in the kernel to get the +`/dev/i2c/x' files. 4.24.3 Sensors-detect doesn't find any sensors! ----------------------------------------------- diff --git a/doc/lm_sensors-FAQ.html b/doc/lm_sensors-FAQ.html index 4ddf2902..d004d244 100644 --- a/doc/lm_sensors-FAQ.html +++ b/doc/lm_sensors-FAQ.html @@ -1106,7 +1106,7 @@ and change the min and max settings for the Processor Core voltage (often in0_min and in0_max) in that file so that they don't depend on vid.

    The CPU nominal voltage is computed from VID lines according to a formula -that depends on the CPU type. Since Linux 2.6.14, the right formula is +that depends on the CPU type. Since Linux 2.6.9, the right formula is selected automatically. See doc/vid for more information. @@ -1625,7 +1625,7 @@ was not loaded and you did not run sensors-detect as root.

    Your /dev/i2c-0, /dev/i2c0, or /dev/i2c/0 files do not exist or you did not run sensors-detect as root. -Run the script prog/mkdev/mkdev.sh to create the /dev/i2c-x files. +Use MAKEDEV or mknod to create the /dev/i2c-x files. Run devfs in the kernel to get the /dev/i2c/x files.

    diff --git a/doc/lm_sensors-FAQ.texi b/doc/lm_sensors-FAQ.texi index b480091f..de5a6f26 100644 --- a/doc/lm_sensors-FAQ.texi +++ b/doc/lm_sensors-FAQ.texi @@ -1104,7 +1104,7 @@ was not loaded and you did not run sensors-detect as root. Your @file{/dev/i2c-0,} @file{/dev/i2c0}, or @file{/dev/i2c/0} files do not exist or you did not run @command{sensors-detect} as root. -Run the script @command{prog/mkdev/mkdev.sh} to create the @file{/dev/i2c-x} files. +Use @command{MAKEDEV} or @command{mknod} to create the @file{/dev/i2c-x} files. Run @command{devfs} in the kernel to get the @file{/dev/i2c/x} files. diff --git a/prog/mkdev/mkdev.sh b/prog/mkdev/mkdev.sh deleted file mode 100755 index 8b29a37c..00000000 --- a/prog/mkdev/mkdev.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Here you can set several defaults. - -# The number of devices to create (max: 256) -# If not provided on the command line, default to 32 -NUMBER=${1:-32} - -# The owner and group of the devices -OUSER=root -OGROUP=root -# The mode of the devices -MODE=600 - -# This script doesn't need to be run if devfs is used -if [ -r /proc/mounts ] ; then - if grep -q "/dev devfs" /proc/mounts ; then - echo "You do not need to run this script as your system uses devfs." - exit; - fi -fi - -i=0; - -while [ $i -lt $NUMBER ] ; do - if [ ! -c /dev/i2c-$i ] ; then - echo /dev/i2c-$i - mknod -m $MODE /dev/i2c-$i c 89 $i || exit - chown "$OUSER:$OGROUP" /dev/i2c-$i || exit - fi - i=$[$i + 1] -done From a2b7c5b0b19f327e61bd7db1a0459002cfe35015 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 8 Jul 2007 12:01:23 +0000 Subject: [PATCH 133/718] Drop reference to mkdev.sh. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4594 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/progs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/progs b/doc/progs index 5567b8e2..2dbb87ae 100644 --- a/doc/progs +++ b/doc/progs @@ -46,10 +46,6 @@ see useful_addresses.html. * prog/maxilife/writelcd.sh (written in shell, not installed) Write a string to the HP Maxilife LCD display. -* prog/mkdev/mkdev.sh (written in bash, not installed) - This script creates the /dev/i2c-* files. Please check the source before - you run it, as you may need to set some variables first. - * prog/pwm/pwmconfig (shell script, installed by 'make install') Formerly pwmtest, tests the pwm (pulse width modulation) outputs of sensors for their effect on the fans and helps to setup the configfile for fancontrol. From 712748f659574e3be669aa6f52a3e52ac1e8e0da Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 8 Jul 2007 18:59:16 +0000 Subject: [PATCH 134/718] Handle chips who return the beta value as temp sensor type git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4595 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 4a4b1ac5..5e8b8b2b 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -209,6 +209,11 @@ static void print_generic_chip_temp(const sensors_chip_name *name, /* print out temperature sensor info */ if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_SENS); + + /* older kernels / drivers sometimes report a beta value for thermistors */ + if (sens > 1000) + sens = 4; + printf("sensor = %s", sens == 0 ? "disabled" : sens == 1 ? "diode" : sens == 2 ? "transistor" : From 867b8453f23606816ff278372fa5bdb379f1a5cd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 8 Jul 2007 20:54:33 +0000 Subject: [PATCH 135/718] Add more known SMSC Super IO chips to sensors-detect. Also sort the list of SMSC chips by chip name. Patch from Juerg Haefliger. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4597 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 158 +++++++++++++++++++++++++++---------- 2 files changed, 117 insertions(+), 42 deletions(-) diff --git a/CHANGES b/CHANGES index 093920e1..1f27af00 100644 --- a/CHANGES +++ b/CHANGES @@ -52,6 +52,7 @@ SVN HEAD Add SMSC SCH5317 detection Drop detection of most non-sensors I2C chips Fix ADM1022 detection + Add detection of many SMSC Super-I/O chips 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 73b8e715..ab873f4b 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1673,12 +1673,73 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); }, chips => [ + { + name => "SMSC DME1737 Super IO", + # Hardware monitoring features are accessed on the SMBus + driver => "via-smbus-only", + devid => 0x78, + }, + { + name => "SMSC DME1737 Super IO", + # The DME1737 shows up twice in this list because it can return either + # 0x78 or 0x77 as its device ID. + # Hardware monitoring features are accessed on the SMBus + driver => "via-smbus-only", + devid => 0x77, + }, + { + name => "SMSC FDC37B72x Super IO", + driver => "not-a-sensor", + devid => 0x4c, + }, + { + name => "SMSC FDC37B78x Super IO", + driver => "not-a-sensor", + devid => 0x44, + }, + { + name => "SMSC FDC37C672 Super IO", + driver => "not-a-sensor", + devid => 0x40, + }, + { + name => "SMSC FDC37M707 Super IO", + driver => "not-a-sensor", + devid => 0x42, + }, + { + name => "SMSC FDC37M81x Super IO", + driver => "not-a-sensor", + devid => 0x4d, + }, { name => "SMSC LPC47B27x Super IO Fan Sensors", driver => "smsc47m1", devid => 0x51, logdev => 0x0a, }, + { + name => "SMSC LPC47B34x Super IO", + driver => "not-a-sensor", + devid => 0x56, + }, + { + name => "SMSC LPC47B357 Super IO", + # no datasheet + devid => 0x5d, + }, + { + name => "SMSC LPC47B37x Super IO Fan Sensors", + driver => "to-be-written", + devid => 0x52, + logdev => 0x0a, + }, + { + name => "SMSC LPC47B397-NC Super IO", + driver => "smsc47b397", + devid => 0x6f, + logdev => 0x08, + }, { name => "SMSC LPC47M10x/112/13x Super IO Fan Sensors", driver => "smsc47m1", @@ -1697,12 +1758,35 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); devid => 0x60, logdev => 0x0a, }, + { + name => "SMSC LPC47M172 Super IO Fan Sensors", + driver => "to-be-written", + devid => 0x14, + logdev => 0x0a, + }, + { + name => "SMSC LPC47M182 Super IO Fan Sensors", + driver => "to-be-written", + devid => 0x74, + logdev => 0x0a, + }, { name => "SMSC LPC47M292 Super IO Fan Sensors", driver => "smsc47m1", devid => 0x6b, logdev => 0x0a, }, + { + name => "SMSC LPC47M584-NC Super IO", + # No datasheet + devid => 0x76, + }, + { + name => "SMSC LPC47N252 Super IO Fan Sensors", + driver => "to-be-written", + devid => 0x0e, + logdev => 0x09, + }, { name => "SMSC LPC47S42x Super IO Fan Sensors", driver => "to-be-written", @@ -1716,59 +1800,49 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); logdev => 0x0a, }, { - name => "SMSC LPC47M172 Super IO Fan Sensors", + name => "SMSC LPC47U33x Super IO Fan Sensors", driver => "to-be-written", - devid => 0x14, + devid => 0x54, logdev => 0x0a, }, { - name => "SMSC LPC47M182 Super IO Fan Sensors", + name => "SMSC SCH3112 Super IO", + driver => "dme1737", + devid => 0x7c, + }, + { + name => "SMSC SCH3114 Super IO", + driver => "dme1737", + devid => 0x7d, + }, + { + name => "SMSC SCH3116 Super IO", + driver => "dme1737", + devid => 0x7f, + }, + { + name => "SMSC SCH4307 Super IO Fan Sensors", driver => "to-be-written", - devid => 0x74, - logdev => 0x0a, + devid => 0x90, + logdev => 0x08, }, { - name => "SMSC LPC47B397-NC Super IO", - driver => "smsc47b397", - devid => 0x6f, - logdev => 0x08, + name => "SMSC SCH5307-NS Super IO", + driver => "smsc47b397", + devid => 0x81, + logdev => 0x08, }, { - name => "SMSC SCH5307-NS Super IO", - driver => "smsc47b397", - devid => 0x81, - logdev => 0x08, + name => "SMSC SCH5317 Super IO", + driver => "smsc47b397", + devid => 0x85, + logdev => 0x08, }, { - name => "SMSC SCH5317 Super IO", - driver => "smsc47b397", - devid => 0x85, - logdev => 0x08, - }, - { - name => "SMSC SCH5504-NS Super IO", - # No datasheet - driver => "not-a-sensor", - devid => 0x79, - }, - { - name => "SMSC LPC47M584-NC Super IO", - # No datasheet - devid => 0x76, - }, - { - name => "SMSC DME1737 Super IO", - # Hardware monitoring features are accessed on the SMBus - driver => "via-smbus-only", - devid => 0x78, - }, - { - name => "SMSC DME1737 Super IO", - # The DME1737 shows up twice in this list because it can return either - # 0x78 or 0x77 as its device ID. - # Hardware monitoring features are accessed on the SMBus - driver => "via-smbus-only", - devid => 0x77, + name => "SMSC SCH5504-NS Super IO", + # No datasheet + driver => "not-a-sensor", + devid => 0x79, }, ], # Non-standard SMSC detection callback and chip list. These chips differ From e45b87398184238157d9edba278235daa4d756e6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 9 Jul 2007 11:20:47 +0000 Subject: [PATCH 136/718] Delete unused function sensors_get_sub_feature_by_type(). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4598 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 5e8b8b2b..b20d3a10 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -33,24 +33,6 @@ static int get_feature_value(const sensors_chip_name *name, return sensors_get_feature(*name, feature->number, val); } -static const sensors_feature_data* -sensors_get_sub_feature_by_type(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int j, - enum sensors_feature_type type) -{ - const sensors_feature_data *iter; - - while((iter = sensors_get_all_features(*name, &i, &j)) && - iter->mapping != SENSORS_NO_MAPPING && - iter->mapping == feature->number) { - if (sensors_feature_get_type(iter) == type) - return iter; - } - - return NULL; -} - static void sensors_get_available_features(const sensors_chip_name *name, const sensors_feature_data *feature, int i, int j, From d5d047627369b507e900d45b61d1021c0f7a5abe Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 9 Jul 2007 12:54:54 +0000 Subject: [PATCH 137/718] remove f71882fg example config fan2-4 ignore lines and add labels, fix typo in Battery label git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4600 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 77ba9449..434b747c 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -2871,9 +2871,9 @@ chip "f71882fg-*" # Fans label fan1 "CPU" - ignore fan2 - ignore fan3 - ignore fan4 + label fan2 "System" + label fan3 "Power" + label fan4 "Aux" # Voltage label in0 "3.3V" @@ -2884,7 +2884,7 @@ chip "f71882fg-*" label in5 "12V" label in6 "5VSB" label in7 "3VSB" - label in8 "Batery" + label in8 "Battery" # never change the in0, in7 and in8 compute, these are hardwired in the chip! compute in0 (@ * 2), (@ / 2) From f905e5f242b58503953a9685138bc806806ddb4f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 10 Jul 2007 19:38:14 +0000 Subject: [PATCH 138/718] Delete LM_DATE and libsensors_date. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4601 7894878c-1315-0410-8ee3-d5d059ff63e0 --- Makefile | 10 ++-------- lib/data.c | 1 - version.h | 1 - 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 15ebaf06..6f2b3978 100644 --- a/Makefile +++ b/Makefile @@ -154,7 +154,7 @@ ARCFLAGS := $(ALL_CFLAGS) LIBCPPFLAGS := $(ALL_CPPFLAGS) LIBCFLAGS := -fpic -D_REENTRANT $(ALL_CFLAGS) -.PHONY: all user clean install user_install uninstall user_uninstall version package +.PHONY: all user clean install user_install uninstall user_uninstall package # Make all the default rule all:: @@ -201,7 +201,7 @@ uninstall :: user_uninstall # This is tricky, but it works like a charm. It needs lots of utilities # though: cut, find, gzip, ln, tail and tar. -package: version clean +package: version.h clean lmversion=`tail -1 version.h|cut -f 2 -d \"`; \ lmpackage=lm_sensors-$$lmversion; \ ln -s . $$lmpackage; \ @@ -215,12 +215,6 @@ package: version clean $(RM) $$lmpackage.tar $$lmpackage cat doc/developers/checklist -version: - $(RM) version.h - echo '#define LM_DATE "'`date +'%Y%m%d'`\" > version.h - echo -n 'Version: '; \ - echo '#define LM_VERSION "'`read VER; echo $$VER`\" >> version.h - help: @echo 'Make targets are:' @echo ' all (default): build library and userspace programs' diff --git a/lib/data.c b/lib/data.c index 3f9b7013..d5e23523 100644 --- a/lib/data.c +++ b/lib/data.c @@ -26,7 +26,6 @@ #include "../version.h" const char *libsensors_version = LM_VERSION; -const char *libsensors_date = LM_DATE; sensors_chip *sensors_config_chips = NULL; int sensors_config_chips_count = 0; diff --git a/version.h b/version.h index 5f0daf87..8310b132 100644 --- a/version.h +++ b/version.h @@ -1,2 +1 @@ -#define LM_DATE "2007xxxx" #define LM_VERSION "3.0.0-pre" From 7b8fdf018895e384e852a314bc03337a6a3c557d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 10 Jul 2007 19:55:06 +0000 Subject: [PATCH 139/718] Advertise and document libsensors_version. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4602 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/libsensors.3 | 5 +++++ lib/sensors.h | 2 ++ prog/sensors/main.c | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libsensors.3 b/lib/libsensors.3 index b0295b9a..046a9dfe 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -50,6 +50,7 @@ libsensors \- publicly accessible functions provided by the sensors library .B const sensors_chip_name *sensors_get_detected_chips(int *nr); .B const sensors_feature_data *sensors_get_all_features \fB(sensors_chip_name name, int *nr1,int *nr2);\fP +.B const char *libsensors_version; .fi .SH DESCRIPTION .B int sensors_init(FILE *input); @@ -134,6 +135,10 @@ SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W or SENSORS_MODE_RW. .br This returns all features of a specific chip. They are returned in bunches: everything with the same mapping is returned just after each other, with the master feature in front (that feature does not map to itself, but has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are two internally used variables. Set both to zero to start again at the begin of the list. If no more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. +\fBconst char *libsensors_version;\fP +.br +A string representing the version of libsensors. + .SH "CONFORMING TO" lm_sensors-2.x diff --git a/lib/sensors.h b/lib/sensors.h index 987742a3..75fe5208 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -37,6 +37,8 @@ extern "C" { #endif /* __cplusplus */ +extern const char *libsensors_version; + /* A chip name is encoded is in this structure */ typedef struct sensors_chip_name { char *prefix; diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 03c6670e..ef52a140 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -41,7 +41,6 @@ #define DEFAULT_CONFIG_FILE_NAME "sensors.conf" FILE *config_file; -extern const char *libsensors_version; extern int main(int argc, char *arv[]); static void print_short_help(void); From 02b58be2e80ad3a244a0aacb19dec5a072f679c7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 10 Jul 2007 21:09:32 +0000 Subject: [PATCH 140/718] Add Fintek F71806FG and F71862FG detection. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4604 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 1f27af00..7520f05f 100644 --- a/CHANGES +++ b/CHANGES @@ -53,6 +53,7 @@ SVN HEAD Drop detection of most non-sensors I2C chips Fix ADM1022 detection Add detection of many SMSC Super-I/O chips + Add Fintek F71806FG and F71862FG detection 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index ab873f4b..2b7f05ac 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1962,7 +1962,13 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); logdev => 0x04, }, { - name => "Fintek F71872F/FG Super IO Sensors", + name => "Fintek F71862FG Super IO Sensors", + driver => "to-be-written", + devid => 0x0601, + logdev => 0x04, + }, + { + name => "Fintek F71806FG/F71872FG Super IO Sensors", driver => "f71805f", devid => 0x0341, logdev => 0x04, From 356e03f000c0c43e2ecec7b45a3b896d20ce0f5b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 13 Jul 2007 11:05:43 +0000 Subject: [PATCH 141/718] Add missing static marker. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4605 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/dump/isaset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/dump/isaset.c b/prog/dump/isaset.c index cb157e28..c8b9ecfa 100644 --- a/prog/dump/isaset.c +++ b/prog/dump/isaset.c @@ -43,7 +43,7 @@ unsigned long isa_io_base = 0; /* XXX for now */ #endif /* __powerpc__ */ -void help(void) +static void help(void) { fprintf(stderr, "Syntax for I2C-like access:\n" From 91d6d664ed8efad07ec2c80b96fb26e55cd94269 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 13 Jul 2007 14:53:31 +0000 Subject: [PATCH 142/718] Fix broken links to Analog Devices website. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4607 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/useful_addresses.html | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/useful_addresses.html b/doc/useful_addresses.html index f829c3ba..108fe5e1 100644 --- a/doc/useful_addresses.html +++ b/doc/useful_addresses.html @@ -73,14 +73,20 @@ implementations. Please report any other references you have found!

  • Hardware monitoring chips
    • Analog Devices - (ADM1021, - ADM1021A, - ADM1022, - ADM1023, - ADM1024, - ADM1025, - ADM1025A, - ADM9240) + (ADM1021A, + ADM1022, + ADM1023, + ADM1024, + ADM1025, + ADM1025A, + ADM1026, + ADM1027, + ADM1028, + ADM1029, + ADM1030, + ADM1031, + ADM1032, + ADM9240)
      Datasheets available for download.
    • Genesys Logic (GL518, GL520, GL523)
      No datasheet available.
    • From c100b4f38bee786402556b727f9992c0636e0331 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 14 Jul 2007 16:29:52 +0000 Subject: [PATCH 143/718] Don't add non-sensor I2C chips to the list of detected I2C chips. Even if we discard them later, their presence in the list can prevent the "no sensors found" event from triggering. It also causes the script to suggest loading i2c bus drivers which are not needed for hardware monitoring. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4610 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 2b7f05ac..4199fb19 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -735,8 +735,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); # name: The full chip name # driver: The driver name (without .o extension). Put in exactly # "to-be-written" if it is not yet available. Put in exactly -# "not-a-sensor" if it is not a hardware monitoring chip and -# there is no known driver for it. +# "not-a-sensor" if it is not a hardware monitoring chip. # Put in exactly "use-isa-instead" if no i2c driver will be written. # i2c_addrs (optional): For I2C chips, the range of valid I2C addresses to # probe. Recommend avoiding 0x69 because of clock chips. @@ -3112,8 +3111,13 @@ sub scan_adapter if (exists $chip->{i2c_addrs} and contains $addr, @{$chip->{i2c_addrs}}) { printf("\%-60s", sprintf("Probing for `\%s'... ", $chip->{name})); if (($conf,@chips) = &{$chip->{i2c_detect}} (\*FILE ,$addr)) { - print "Success!\n", - " (confidence $conf, driver `$chip->{driver}')"; + if ($chip->{driver} eq "not-a-sensor") { + print "Yes\n", + " (confidence $conf, not a hardware monitoring chip"; + } else { + print "Success!\n", + " (confidence $conf, driver `$chip->{driver}'"; + } if (@chips) { print ", other addresses:"; @chips = sort @chips; @@ -3121,7 +3125,11 @@ sub scan_adapter printf(" 0x%02x",$other_addr); } } - printf "\n"; + printf ")\n"; + + next if ($chip->{driver} eq "not-a-sensor" + || $chip->{driver} eq "use-isa-instead"); + $new_hash = { conf => $conf, i2c_addr => $addr, chipname => $chip->{name}, @@ -5438,8 +5446,6 @@ sub generate_modprobes $modprobes .= "# Chip drivers\n"; foreach $chip (@chips_detected) { next if not @{$chip->{detected}}; - next if $chip->{driver} eq "not-a-sensor"; - next if $chip->{driver} eq "use-isa-instead"; if ($chip->{driver} eq "to-be-written") { $modprobes .= "# no driver for $chip->{detected}[0]{chipname} yet\n"; } else { @@ -5671,8 +5677,6 @@ sub main my ($chip,$data); foreach $chip (@chips_detected) { - next if $chip->{driver} eq "not-a-sensor"; - next if $chip->{driver} eq "use-isa-instead"; print "\nDriver `$chip->{driver}' "; if (@{$chip->{detected}}) { if (@{$chip->{misdetected}}) { From d73a25b16624e114b769a759d047958bd9f81aa9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 14 Jul 2007 16:32:56 +0000 Subject: [PATCH 144/718] Don't sort the same list twice. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4611 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 4199fb19..0a0c15a7 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -3121,7 +3121,7 @@ sub scan_adapter if (@chips) { print ", other addresses:"; @chips = sort @chips; - foreach $other_addr (sort @chips) { + foreach $other_addr (@chips) { printf(" 0x%02x",$other_addr); } } From fd6fc535ab22fff0251fa92d183cc7415e51bd7f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 16 Jul 2007 12:08:00 +0000 Subject: [PATCH 145/718] No special treatment is needed for the name attribute. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4616 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 6111ff98..0b7c52da 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -86,11 +86,6 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, sensors_chip_feature feature; name = attr->name; - if (!strcmp(name, "name")) { - /* Already done */ - continue; - } - memset(&feature, 0, sizeof(sensors_chip_feature)); /* check for _input extension and remove */ i = strlen(name); From ac5ae18fe739638be6cd550a0ddb295da5ffcaad Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 19 Jul 2007 16:59:16 +0000 Subject: [PATCH 146/718] Drop the package target. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4628 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + Makefile | 27 +++------------------------ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/CHANGES b/CHANGES index 7520f05f..112a298c 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ SVN HEAD Delete procfs and sysctl support (Linux 2.4) Delete all remnants of algorithm names Drop all the chip-specific support + Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete Programs i2cdump, i2cget, i2cset: Do not force the slave address by default diff --git a/Makefile b/Makefile index 6f2b3978..95d9038a 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,8 @@ # Uncomment the second line if you are a developer. This will enable many # additional warnings at compile-time -WARN := 0 -#WARN := 1 +#WARN := 0 +WARN := 1 # Uncomment the second line if you want to get (loads of) debug information # at run-time. @@ -154,7 +154,7 @@ ARCFLAGS := $(ALL_CFLAGS) LIBCPPFLAGS := $(ALL_CPPFLAGS) LIBCFLAGS := -fpic -D_REENTRANT $(ALL_CFLAGS) -.PHONY: all user clean install user_install uninstall user_uninstall package +.PHONY: all user clean install user_install uninstall user_uninstall # Make all the default rule all:: @@ -166,15 +166,11 @@ ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),uninstall) ifneq ($(MAKECMDGOALS),user_uninstall) ifneq ($(MAKECMDGOALS),help) -ifneq ($(MAKECMDGOALS),package) -ifneq ($(MAKECMDGOALS),userpackage) include $(INCLUDEFILES) endif endif endif endif -endif -endif # Man pages MANPAGES := $(LIBMAN3FILES) $(LIBMAN5FILES) $(PROGDETECTMAN8FILES) $(PROGDUMPMAN8FILES) \ @@ -199,29 +195,12 @@ user_uninstall:: uninstall :: user_uninstall -# This is tricky, but it works like a charm. It needs lots of utilities -# though: cut, find, gzip, ln, tail and tar. -package: version.h clean - lmversion=`tail -1 version.h|cut -f 2 -d \"`; \ - lmpackage=lm_sensors-$$lmversion; \ - ln -s . $$lmpackage; \ - find $$lmpackage/ -type f | grep -v ^$$lmpackage/$$lmpackage$$ | \ - grep -v ^$$lmpackage/$$lmpackage.tar$$ | \ - grep -v ^$$lmpackage/$$ | \ - grep -v /CVS | \ - grep -v /\\.# | \ - tar rvf $$lmpackage.tar -T -; \ - gzip -9 $$lmpackage.tar ;\ - $(RM) $$lmpackage.tar $$lmpackage - cat doc/developers/checklist - help: @echo 'Make targets are:' @echo ' all (default): build library and userspace programs' @echo ' install: install library and userspace programs' @echo ' uninstall: uninstall library and userspace programs' @echo ' clean: cleanup' - @echo ' package: create a distribution package' # Generate html man pages to be copied to the lm_sensors website. # This uses the man2html from here From 70317e1a0e0df66194a0162a16833675eccc9d4c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 19 Jul 2007 20:46:09 +0000 Subject: [PATCH 147/718] The way we use sensors_feature_get_type() is rather suboptimal. It is first called during the library initialization to generate the feature tables. Then it is called again by sensors itself. This is because we do not store the result the first time. I propose that we add a type field to struct sensors_feature_data, where libsensors would store the result of sensors_feature_get_type(). That way, the application can get the information without calling sensors_feature_get_type() again. This change has the following benefits: * Obviously, a small speed-up. * sensors_feature_get_type() can be removed from the public interface. This means that we can turn it into something that fits the libsensors needs better, allowing for more optimizations (see next patches.) Note: the patch looks bigger that it really is, because I had to move definitions around in sensors.h. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4629 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.h | 2 ++ lib/libsensors.3 | 4 +++- lib/sensors.h | 44 +++++++++++++++++------------------- lib/sysfs.c | 1 + prog/sensors/chips_generic.c | 8 ++----- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/lib/access.h b/lib/access.h index 60068b7c..d416ad3a 100644 --- a/lib/access.h +++ b/lib/access.h @@ -29,4 +29,6 @@ extern const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature); +sensors_feature_type sensors_feature_get_type(const sensors_feature_data *feature); + #endif /* def LIB_SENSORS_ACCESS_H */ diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 046a9dfe..b5708b28 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -117,10 +117,12 @@ This structure is used when you want to get all features of a specific chip. int number; .br const char *name; +.br + sensors_feature_type type; .br int mapping; .br - int unused; + int compute_mapping; .br int mode; .br diff --git a/lib/sensors.h b/lib/sensors.h index 75fe5208..a3ddaa39 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -125,27 +125,6 @@ extern const sensors_chip_name *sensors_get_detected_chips(int *nr); mapping is available */ #define SENSORS_NO_MAPPING -1 -/* This structure is used when you want to get all features of a specific - chip. */ -typedef struct sensors_feature_data { - int number; - char *name; - int mapping; - int compute_mapping; - int mode; -} sensors_feature_data; - -/* This returns all features of a specific chip. They are returned in - bunches: everything with the same mapping is returned just after each - other, with the master feature in front (that feature does not map to - itself, but has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are - two internally used variables. Set both to zero to start again at the - begin of the list. If no more features are found NULL is returned. - Do not try to change the returned structure; you will corrupt internal - data structures. */ -extern const sensors_feature_data *sensors_get_all_features - (sensors_chip_name name, int *nr1,int *nr2); - /* This enum contains some "magic" used by sensors_read_dynamic_chip() from lib/sysfs.c. All the sensor types (in, fan, temp, vid) are a multiple of 0x100 apart, and sensor features which should not have a compute_mapping to @@ -186,8 +165,27 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_MAX_SUB_FEATURES = 22 } sensors_feature_type; -sensors_feature_type sensors_feature_get_type - (const sensors_feature_data *feature); +/* This structure is used when you want to get all features of a specific + chip. */ +typedef struct sensors_feature_data { + int number; + char *name; + sensors_feature_type type; + int mapping; + int compute_mapping; + int mode; +} sensors_feature_data; + +/* This returns all features of a specific chip. They are returned in + bunches: everything with the same mapping is returned just after each + other, with the master feature in front (that feature does not map to + itself, but has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are + two internally used variables. Set both to zero to start again at the + begin of the list. If no more features are found NULL is returned. + Do not try to change the returned structure; you will corrupt internal + data structures. */ +extern const sensors_feature_data *sensors_get_all_features + (sensors_chip_name name, int *nr1,int *nr2); #ifdef __cplusplus } diff --git a/lib/sysfs.c b/lib/sysfs.c index 0b7c52da..30356fee 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -148,6 +148,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* fill in the other feature members */ feature.data.number = i + 1; + feature.data.type = type; if ((type & 0x00FF) == 0) { /* main feature */ diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index b20d3a10..fb9f712f 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -46,13 +46,9 @@ static void sensors_get_available_features(const sensors_chip_name *name, while((iter = sensors_get_all_features(*name, &i, &j)) && iter->mapping != SENSORS_NO_MAPPING && iter->mapping == feature->number) { - sensors_feature_type type = sensors_feature_get_type(iter); int indx; - if (type == SENSORS_FEATURE_UNKNOWN) - continue; - - indx = type - first_val - 1; + indx = iter->type - first_val - 1; if (indx < 0 || indx >= size) { printf("ERROR: Bug in sensors: index out of bound"); return; @@ -345,7 +341,7 @@ void print_generic_chip(const sensors_chip_name *name) if (feature->mapping != SENSORS_NO_MAPPING) continue; - switch(sensors_feature_get_type(feature)) { + switch (feature->type) { case SENSORS_FEATURE_TEMP: print_generic_chip_temp(name, feature, i, j, label_size); break; case SENSORS_FEATURE_IN: From c5b2eabf087d61d51eacd958b521571eb44455a9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 19 Jul 2007 20:49:29 +0000 Subject: [PATCH 148/718] Now that sensors_feature_get_type() is an internal function, we can adjust it to fit our needs better: * Call sensors_feature_get_type() before allocating memory for the feature name. The allocation will be reverted for all sysfs files which are not valid libsensors attributes, and there can be a lot of these. So this saves a few memory allocations. But this means that we want to pass a simple string to sensors_feature_get_type() rather than a struct sensors_feature_data. This also means that sensors_feature_get_type() gets the raw attribute name ("_input" not stripped.) * Get the channel number from sensors_feature_get_type() too. We get it for free from sscanf(), so it's more efficient to return it than to parse it again in sensors_read_dynamic_chip(). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4630 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 20 +++++++++++--------- lib/access.h | 2 +- lib/sysfs.c | 32 +++++++++++--------------------- 3 files changed, 23 insertions(+), 31 deletions(-) diff --git a/lib/access.c b/lib/access.c index 32a820b2..cc03a280 100644 --- a/lib/access.c +++ b/lib/access.c @@ -528,6 +528,7 @@ struct feature_type_match }; static const struct feature_subtype_match temp_matches[] = { + { "input", SENSORS_FEATURE_TEMP }, { "max", SENSORS_FEATURE_TEMP_MAX }, { "max_hyst", SENSORS_FEATURE_TEMP_MAX_HYST }, { "min", SENSORS_FEATURE_TEMP_MIN }, @@ -543,6 +544,7 @@ static const struct feature_subtype_match temp_matches[] = { }; static const struct feature_subtype_match in_matches[] = { + { "input", SENSORS_FEATURE_IN }, { "min", SENSORS_FEATURE_IN_MIN }, { "max", SENSORS_FEATURE_IN_MAX }, { "alarm", SENSORS_FEATURE_IN_ALARM }, @@ -552,6 +554,7 @@ static const struct feature_subtype_match in_matches[] = { }; static const struct feature_subtype_match fan_matches[] = { + { "input", SENSORS_FEATURE_FAN }, { "min", SENSORS_FEATURE_FAN_MIN }, { "div", SENSORS_FEATURE_FAN_DIV }, { "alarm", SENSORS_FEATURE_FAN_ALARM }, @@ -565,22 +568,21 @@ static const struct feature_subtype_match cpu_matches[] = { }; static struct feature_type_match matches[] = { - { "temp%d%c", SENSORS_FEATURE_TEMP, temp_matches }, - { "in%d%c", SENSORS_FEATURE_IN, in_matches }, - { "fan%d%c", SENSORS_FEATURE_FAN, fan_matches }, + { "temp%d%c", SENSORS_FEATURE_UNKNOWN, temp_matches }, + { "in%d%c", SENSORS_FEATURE_UNKNOWN, in_matches }, + { "fan%d%c", SENSORS_FEATURE_UNKNOWN, fan_matches }, { "cpu%d%c", SENSORS_FEATURE_UNKNOWN, cpu_matches }, }; -/* Return the feature type based on the feature name */ -sensors_feature_type sensors_feature_get_type( - const sensors_feature_data *feature) +/* Return the feature type and channel number based on the feature name */ +sensors_feature_type sensors_feature_get_type(const char *name, int *nr) { char c; - int i, nr, count; + int i, count; const struct feature_subtype_match *submatches; for (i = 0; i < ARRAY_SIZE(matches); i++) - if ((count = sscanf(feature->name, matches[i].name, &nr, &c))) + if ((count = sscanf(name, matches[i].name, nr, &c))) break; if (i == ARRAY_SIZE(matches)) /* no match */ @@ -594,7 +596,7 @@ sensors_feature_type sensors_feature_get_type( submatches = matches[i].submatches; for (i = 0; submatches[i].name != NULL; i++) - if (!strcmp(strchr(feature->name, '_') + 1, submatches[i].name)) + if (!strcmp(strchr(name, '_') + 1, submatches[i].name)) return submatches[i].type; return SENSORS_FEATURE_UNKNOWN; diff --git a/lib/access.h b/lib/access.h index d416ad3a..0298ae54 100644 --- a/lib/access.h +++ b/lib/access.h @@ -29,6 +29,6 @@ extern const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature); -sensors_feature_type sensors_feature_get_type(const sensors_feature_data *feature); +sensors_feature_type sensors_feature_get_type(const char *name, int *nr); #endif /* def LIB_SENSORS_ACCESS_H */ diff --git a/lib/sysfs.c b/lib/sysfs.c index 30356fee..c97e249e 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -85,7 +85,12 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, dlist_for_each_data(attrs, attr, struct sysfs_attribute) { sensors_chip_feature feature; name = attr->name; + int nr; + type = sensors_feature_get_type(name, &nr); + if (type == SENSORS_FEATURE_UNKNOWN) + continue; + memset(&feature, 0, sizeof(sensors_chip_feature)); /* check for _input extension and remove */ i = strlen(name); @@ -94,31 +99,16 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, else feature.data.name = strdup(name); - type = sensors_feature_get_type(&feature.data); - if (type == SENSORS_FEATURE_UNKNOWN) { - free(feature.data.name); - continue; - } - - /* Get N as in this is the N-th in / fan / temp / vid */ + /* Adjust the channel number */ switch (type & 0xFF00) { - case SENSORS_FEATURE_IN: - i = strtol(name + 2, NULL, 10); - break; case SENSORS_FEATURE_FAN: - i = strtol(name + 3, NULL, 10); - if (i) i--; - break; case SENSORS_FEATURE_TEMP: - i = strtol(name + 4, NULL, 10); - if (i) i--; - break; - case SENSORS_FEATURE_VID: - i = strtol(name + 3, NULL, 10); + if (nr) + nr--; break; } - if (i >= MAX_SENSORS_PER_TYPE) { + if (nr >= MAX_SENSORS_PER_TYPE) { fprintf(stderr, "libsensors error, more sensors of one" " type then MAX_SENSORS_PER_TYPE, ignoring " "feature: %s\n", name); @@ -129,12 +119,12 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* "calculate" a place to store the feature in our sparse, sorted table */ if (type == SENSORS_FEATURE_VID) { - i += MAX_SENSORS_PER_TYPE * + i = nr + MAX_SENSORS_PER_TYPE * SENSORS_FEATURE_MAX_SUB_FEATURES * 3; } else { i = (type >> 8) * MAX_SENSORS_PER_TYPE * SENSORS_FEATURE_MAX_SUB_FEATURES + - i * SENSORS_FEATURE_MAX_SUB_FEATURES + + nr * SENSORS_FEATURE_MAX_SUB_FEATURES + (type & 0xFF); } From 5d33dd3e68d7cdce00bfe72325dc2e9c083804bf Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 19 Jul 2007 20:50:17 +0000 Subject: [PATCH 149/718] Minor optimizations to sensors_feature_get_type(): * We no longer support any single type, so no need to handle this case. * We can start looking for "_" at offset 3 rather than the beginning of the string (the shortest valid prefix is "in0", 3 characters.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4631 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/access.c b/lib/access.c index cc03a280..d34c1500 100644 --- a/lib/access.c +++ b/lib/access.c @@ -522,8 +522,6 @@ struct feature_subtype_match struct feature_type_match { const char *name; - sensors_feature_type type; - const struct feature_subtype_match *submatches; }; @@ -568,10 +566,10 @@ static const struct feature_subtype_match cpu_matches[] = { }; static struct feature_type_match matches[] = { - { "temp%d%c", SENSORS_FEATURE_UNKNOWN, temp_matches }, - { "in%d%c", SENSORS_FEATURE_UNKNOWN, in_matches }, - { "fan%d%c", SENSORS_FEATURE_UNKNOWN, fan_matches }, - { "cpu%d%c", SENSORS_FEATURE_UNKNOWN, cpu_matches }, + { "temp%d%c", temp_matches }, + { "in%d%c", in_matches }, + { "fan%d%c", fan_matches }, + { "cpu%d%c", cpu_matches }, }; /* Return the feature type and channel number based on the feature name */ @@ -585,18 +583,13 @@ sensors_feature_type sensors_feature_get_type(const char *name, int *nr) if ((count = sscanf(name, matches[i].name, nr, &c))) break; - if (i == ARRAY_SIZE(matches)) /* no match */ - return SENSORS_FEATURE_UNKNOWN; - else if (count == 1) /* single type */ - return matches[i].type; - - /* assert: count == 2 */ - if (c != '_') - return SENSORS_FEATURE_UNKNOWN; + if (i == ARRAY_SIZE(matches) || count != 2 || c != '_') + return SENSORS_FEATURE_UNKNOWN; /* no match */ submatches = matches[i].submatches; + name = strchr(name + 3, '_') + 1; for (i = 0; submatches[i].name != NULL; i++) - if (!strcmp(strchr(name, '_') + 1, submatches[i].name)) + if (!strcmp(name, submatches[i].name)) return submatches[i].type; return SENSORS_FEATURE_UNKNOWN; From 834cd70e1417ff7db1b67cb9d43c310905ea5535 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 20 Jul 2007 19:09:00 +0000 Subject: [PATCH 150/718] Drop redundant test. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4632 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 1 - 1 file changed, 1 deletion(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index fb9f712f..26964795 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -44,7 +44,6 @@ static void sensors_get_available_features(const sensors_chip_name *name, const sensors_feature_data *iter; while((iter = sensors_get_all_features(*name, &i, &j)) && - iter->mapping != SENSORS_NO_MAPPING && iter->mapping == feature->number) { int indx; From f302998cd2590bc20dc8d733757e7e91a2ec07fc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 21 Jul 2007 08:44:31 +0000 Subject: [PATCH 151/718] Fix a memory leak in sensors_read_one_sysfs_chip() when an error occurs. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4636 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/sysfs.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 112a298c..fd221732 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,7 @@ SVN HEAD Delete procfs and sysctl support (Linux 2.4) Delete all remnants of algorithm names Drop all the chip-specific support + Fix a memory leak on error Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/sysfs.c b/lib/sysfs.c index c97e249e..f507deb8 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -235,8 +235,10 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) sensors_sysfs_mount, entry.chip.bus); if ((bus_attr = sysfs_open_attribute(bus_path))) { - if (sysfs_read_attribute(bus_attr)) - return -SENSORS_ERR_PARSE; + if (sysfs_read_attribute(bus_attr)) { + sysfs_close_attribute(bus_attr); + goto exit_free; + } if (bus_attr->value && !strncmp(bus_attr->value, "ISA ", 4)) @@ -253,13 +255,18 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) entry.chip.addr = (domain << 16) + (bus << 8) + (slot << 3) + fn; entry.chip.bus = SENSORS_CHIP_NAME_BUS_PCI; } else - return -SENSORS_ERR_PARSE; + goto exit_free; if (sensors_read_dynamic_chip(&entry, dev) < 0) - return -SENSORS_ERR_PARSE; + goto exit_free; sensors_add_proc_chips(&entry); return 0; + +exit_free: + free(entry.chip.prefix); + free(entry.chip.busname); + return -SENSORS_ERR_PARSE; } /* returns 0 if successful, !0 otherwise */ From 98110858fe3f68d784129e6ef30770c676ccfd89 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 21 Jul 2007 09:28:12 +0000 Subject: [PATCH 152/718] Discard devices with zero feature. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4637 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 2 -- lib/sysfs.c | 12 +++++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/access.c b/lib/access.c index d34c1500..4312add2 100644 --- a/lib/access.c +++ b/lib/access.c @@ -347,8 +347,6 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, if (sensors_match_chip(sensors_proc_chips[i].chip, name)) { feature_list = sensors_proc_chips[i].feature; if (!*nr1 && !*nr2) { /* Return the first entry */ - if (!feature_list[0].data.name) /* The list may be empty */ - return NULL; *nr1 = *nr2 = 1; return &feature_list->data; } diff --git a/lib/sysfs.c b/lib/sysfs.c index f507deb8..bb91a425 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -166,6 +166,11 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, fnum++; } + if (fnum == 1) { /* No feature */ + chip->feature = NULL; + return 0; + } + dyn_features = calloc(fnum, sizeof(sensors_chip_feature)); if (dyn_features == NULL) { sensors_fatal_error(__FUNCTION__,"Out of memory"); @@ -203,6 +208,7 @@ int sensors_init_sysfs(void) static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) { int domain, bus, slot, fn; + int err = -SENSORS_ERR_PARSE; struct sysfs_attribute *attr, *bus_attr; char bus_path[SYSFS_PATH_MAX]; sensors_chip_features entry; @@ -259,6 +265,10 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) if (sensors_read_dynamic_chip(&entry, dev) < 0) goto exit_free; + if (!entry.feature) { /* No feature, discard chip */ + err = 0; + goto exit_free; + } sensors_add_proc_chips(&entry); return 0; @@ -266,7 +276,7 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) exit_free: free(entry.chip.prefix); free(entry.chip.busname); - return -SENSORS_ERR_PARSE; + return err; } /* returns 0 if successful, !0 otherwise */ From 4c88142226724e5b60a6367f7d5a7458faab6770 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 22 Jul 2007 10:13:19 +0000 Subject: [PATCH 153/718] No need to explicitly discard subclients. With the hwmon class, they won't even be found. For earlier kernels, they will be discarded anyway because they expose zero feature. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4638 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index bb91a425..cf805bf8 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -217,11 +217,6 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) if (!(attr = sysfs_get_device_attr(dev, "name"))) return 0; - /* ignore subclients */ - if (attr->len >= 11 && !strcmp(attr->value + attr->len - 11, - " subclient\n")) - return 0; - /* NB: attr->value[attr->len-1] == '\n'; chop that off */ entry.chip.prefix = strndup(attr->value, attr->len - 1); if (!entry.chip.prefix) From 462e7d81dfb9555d0a0422a3494ae3bed5a915fc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 22 Jul 2007 12:25:15 +0000 Subject: [PATCH 154/718] Unify error reporting messages. Fix a memory leak in error path. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4639 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 26964795..33f84340 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -108,8 +108,8 @@ static void print_generic_chip_temp(const sensors_chip_name *name, } if (get_feature_value(name, feature, &val)) { + printf("ERROR: Can't get %s data!\n", label); free(label); - printf("ERROR: Can't get temperature data!\n"); return; } @@ -227,6 +227,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, if (get_feature_value(name, feature, &val)) { printf("ERROR: Can't get %s data!\n", label); + free(label); return; } From a62ee5bac22e4d6c0050d4d8872e26fc63e83b04 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 22 Jul 2007 12:51:57 +0000 Subject: [PATCH 155/718] Speed up sensors_get_ignored() a bit. We can return as soon as an ignore statement is found to match, even if it isn't an exact match. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4642 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/access.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index fd221732..899237c8 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,7 @@ SVN HEAD Delete all remnants of algorithm names Drop all the chip-specific support Fix a memory leak on error + Speed up sensors_get_ignored() a bit Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/access.c b/lib/access.c index 4312add2..8b4006f8 100644 --- a/lib/access.c +++ b/lib/access.c @@ -198,10 +198,8 @@ int sensors_get_ignored(sensors_chip_name name, int feature) const sensors_chip *chip; const sensors_chip_feature *featureptr; const sensors_chip_feature *alt_featureptr; - int i, res; + int i; - /* Default: valid */ - res = 1; if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; if (!(featureptr = sensors_lookup_feature_nr(&name, feature))) @@ -214,13 +212,12 @@ int sensors_get_ignored(sensors_chip_name name, int feature) return -SENSORS_ERR_NO_ENTRY; for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->ignores_count; i++) - if (!strcasecmp(featureptr->data.name, chip->ignores[i].name)) - return 0; /* Exact match always overrules! */ - else if (alt_featureptr && - !strcasecmp(alt_featureptr->data.name, - chip->ignores[i].name)) - res = 0; - return res; + if (!strcasecmp(featureptr->data.name, chip->ignores[i].name) || + (alt_featureptr && + !strcasecmp(alt_featureptr->data.name, chip->ignores[i].name))) + return 0; + /* valid */ + return 1; } /* Read the value of a feature of a certain chip. Note that chip should not From 6505fef0fd44d9447d0ffe93e87dd0fd08d3debf Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 24 Jul 2007 08:19:59 +0000 Subject: [PATCH 156/718] The way we build the feature lists guarantees that subfeatures always immediately follow their main feature. This makes it possible to simplify sensors_get_all_features() quite a bit. We no longer need to maintain separate pointers for the last main feature and the last subfeature, we can simply walk the list linearly. Note that I am still not entirely happy with this API. It was obviously designed for debugging purposes (sensors -u) and without performance concernes nor interface cleanliness in mind. I believe that we want to tag main features and subfeatures as such, and let the application ask specifically for the list of main features, and for each feature, for its list of subfeatures (i.e. two functions instead of one.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4643 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 21 ++++----------------- lib/libsensors.3 | 12 +++++++++--- lib/sensors.h | 6 +++--- prog/sensors/chips.c | 6 +++--- prog/sensors/chips_generic.c | 34 +++++++++++++++++----------------- 5 files changed, 36 insertions(+), 43 deletions(-) diff --git a/lib/access.c b/lib/access.c index 8b4006f8..6469da6d 100644 --- a/lib/access.c +++ b/lib/access.c @@ -333,9 +333,9 @@ const char *sensors_get_adapter_name(int bus_nr) return NULL; } -/* nr1-1 is the last main feature found; nr2-1 is the last subfeature found */ +/* nr-1 is the last feature returned */ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, - int *nr1, int *nr2) + int *nr) { sensors_chip_feature *feature_list; int i; @@ -343,22 +343,9 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(sensors_proc_chips[i].chip, name)) { feature_list = sensors_proc_chips[i].feature; - if (!*nr1 && !*nr2) { /* Return the first entry */ - *nr1 = *nr2 = 1; - return &feature_list->data; - } - for ((*nr2)++; feature_list[*nr2 - 1].data.name; (*nr2)++) - if (feature_list[*nr2 - 1].data.mapping == - feature_list[*nr1 - 1].data.number) - return &((feature_list + *nr2 - 1)->data); - for ((*nr1)++; - feature_list[*nr1 - 1].data.name - && (feature_list[*nr1 - 1].data.mapping != - SENSORS_NO_MAPPING); (*nr1)++) ; - *nr2 = *nr1; - if (!feature_list[*nr1 - 1].data.name) + if (!feature_list[*nr].data.name) return NULL; - return &((feature_list + *nr1 - 1)->data); + return &feature_list[(*nr)++].data; } return NULL; } diff --git a/lib/libsensors.3 b/lib/libsensors.3 index b5708b28..6b29e064 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -49,7 +49,7 @@ libsensors \- publicly accessible functions provided by the sensors library .B extern int sensors_do_all_sets(void); .B const sensors_chip_name *sensors_get_detected_chips(int *nr); .B const sensors_feature_data *sensors_get_all_features - \fB(sensors_chip_name name, int *nr1,int *nr2);\fP + \fB(sensors_chip_name name, int *nr);\fP .B const char *libsensors_version; .fi .SH DESCRIPTION @@ -133,9 +133,15 @@ The mode field can be one of: SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W or SENSORS_MODE_RW. \fBconst sensors_feature_data *sensors_get_all_features - (sensors_chip_name name, int *nr1,int *nr2);\fP + (sensors_chip_name name, int *nr);\fP .br -This returns all features of a specific chip. They are returned in bunches: everything with the same mapping is returned just after each other, with the master feature in front (that feature does not map to itself, but has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are two internally used variables. Set both to zero to start again at the begin of the list. If no more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. +This returns all features of a specific chip. They are returned in bunches: +everything with the same mapping is returned just after each other, with +the master feature in front (that feature does not map to itself, but +has SENSORS_NO_MAPPING as mapping field). nr is an internally used variable. +Set it to zero to start again at the begin of the list. If no more features +are found NULL is returned. Do not try to change the returned structure; you +will corrupt internal data structures. \fBconst char *libsensors_version;\fP .br diff --git a/lib/sensors.h b/lib/sensors.h index a3ddaa39..7ae4cb80 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -179,13 +179,13 @@ typedef struct sensors_feature_data { /* This returns all features of a specific chip. They are returned in bunches: everything with the same mapping is returned just after each other, with the master feature in front (that feature does not map to - itself, but has SENSORS_NO_MAPPING as mapping field). nr1 and nr2 are - two internally used variables. Set both to zero to start again at the + itself, but has SENSORS_NO_MAPPING as mapping field). nr is + an internally used variable. Set it to zero to start again at the begin of the list. If no more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. */ extern const sensors_feature_data *sensors_get_all_features - (sensors_chip_name name, int *nr1,int *nr2); + (sensors_chip_name name, int *nr); #ifdef __cplusplus } diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 7a159077..71f9300a 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -118,13 +118,13 @@ void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size) void print_unknown_chip(const sensors_chip_name *name) { - int a,b,valid; + int a, valid; const sensors_feature_data *data; char *label; double val; - a=b=0; - while((data=sensors_get_all_features(*name,&a,&b))) { + a = 0; + while((data=sensors_get_all_features(*name, &a))) { if (sensors_get_label_and_valid(*name,data->number,&label,&valid)) { printf("ERROR: Can't get feature `%s' data!\n",data->name); continue; diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 33f84340..7622e858 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -35,7 +35,7 @@ static int get_feature_value(const sensors_chip_name *name, static void sensors_get_available_features(const sensors_chip_name *name, const sensors_feature_data *feature, - int i, int j, + int i, short *has_features, double *feature_vals, int size, @@ -43,7 +43,7 @@ static void sensors_get_available_features(const sensors_chip_name *name, { const sensors_feature_data *iter; - while((iter = sensors_get_all_features(*name, &i, &j)) && + while((iter = sensors_get_all_features(*name, &i)) && iter->mapping == feature->number) { int indx; @@ -62,13 +62,13 @@ static void sensors_get_available_features(const sensors_chip_name *name, static int sensors_get_label_size(const sensors_chip_name *name) { - int i, j, valid; + int i, valid; const sensors_feature_data *iter; char *label; unsigned int max_size = 11; /* Initialised to 11 as minumum label-width */ - i = j = 0; - while((iter = sensors_get_all_features(*name, &i, &j))) { + i = 0; + while((iter = sensors_get_all_features(*name, &i))) { if (!sensors_get_label_and_valid(*name, iter->number, &label, &valid) && valid && strlen(label) > max_size) max_size = strlen(label); @@ -89,7 +89,7 @@ static inline float deg_ctof(float cel) #define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] static void print_generic_chip_temp(const sensors_chip_name *name, const sensors_feature_data *feature, - int i, int j, int label_size) + int i, int label_size) { double val, max, min; char *label; @@ -113,7 +113,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, return; } - sensors_get_available_features(name, feature, i, j, has_features, + sensors_get_available_features(name, feature, i, has_features, feature_vals, size, SENSORS_FEATURE_TEMP); if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { @@ -207,7 +207,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, #define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] static void print_generic_chip_in(const sensors_chip_name *name, const sensors_feature_data *feature, - int i, int j, int label_size) + int i, int label_size) { const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; int valid; @@ -231,7 +231,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, return; } - sensors_get_available_features(name, feature, i, j, has_features, feature_vals, + sensors_get_available_features(name, feature, i, has_features, feature_vals, size, SENSORS_FEATURE_IN); print_label(label, label_size); @@ -274,7 +274,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, #define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] static void print_generic_chip_fan(const sensors_chip_name *name, const sensors_feature_data *feature, - int i, int j, int label_size) + int i, int label_size) { char *label; int valid; @@ -308,7 +308,7 @@ static void print_generic_chip_fan(const sensors_chip_name *name, else printf("%4.0f RPM", val); - sensors_get_available_features(name, feature, i, j, has_features, feature_vals, + sensors_get_available_features(name, feature, i, has_features, feature_vals, size, SENSORS_FEATURE_FAN); if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN) && @@ -332,22 +332,22 @@ static void print_generic_chip_fan(const sensors_chip_name *name, void print_generic_chip(const sensors_chip_name *name) { const sensors_feature_data *feature; - int i,j, label_size; + int i, label_size; label_size = sensors_get_label_size(name); - i = j = 0; - while((feature = sensors_get_all_features(*name, &i, &j))) { + i = 0; + while((feature = sensors_get_all_features(*name, &i))) { if (feature->mapping != SENSORS_NO_MAPPING) continue; switch (feature->type) { case SENSORS_FEATURE_TEMP: - print_generic_chip_temp(name, feature, i, j, label_size); break; + print_generic_chip_temp(name, feature, i, label_size); break; case SENSORS_FEATURE_IN: - print_generic_chip_in(name, feature, i, j, label_size); break; + print_generic_chip_in(name, feature, i, label_size); break; case SENSORS_FEATURE_FAN: - print_generic_chip_fan(name, feature, i, j, label_size); break; + print_generic_chip_fan(name, feature, i, label_size); break; case SENSORS_FEATURE_VID: print_vid_info(name, feature->number, label_size); break; default: continue; From e9c8c5fb06302ed00cd9e1d2cc715c88509555c3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 24 Jul 2007 08:20:53 +0000 Subject: [PATCH 157/718] Let libsensors handle ignore statements by itself, rather than delegating the task to the user applications. For now, I am calling sensors_get_ignored() in sensors_get_all_features(), because this is the least intrusive way. This is in no way optimal though, it would be better to not add ignored features to the feature list in the first place. However, doing so would require that the configuration file is read before sysfs is scanned for features, which isn't currently the case. So this improvement is left for later. Note that this patch adds a small cost in terms of performance. This is because we now honor ignore statements on all features (main ones and subfeatures) while in practice "sensors" was only checking for main features. It would be trivial to stop checking for subfeatures, but it seems to me that supporting ignore on subfeatures is a good move, as the user may actually want to ignore a specific subfeature. Individual alarms come to mind. This will also be handy to debug the generic print code in "sensors". git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4644 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 8 +++++++- lib/sensors.h | 5 ----- prog/sensors/chips.c | 7 +------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/access.c b/lib/access.c index 6469da6d..6e39f989 100644 --- a/lib/access.c +++ b/lib/access.c @@ -193,7 +193,10 @@ sensors_get_label_exit: return 0; } -int sensors_get_ignored(sensors_chip_name name, int feature) +/* Looks up whether a feature should be ignored. Returns <0 on failure, + 0 if it should be ignored, 1 if it is valid. This function takes + logical mappings into account. */ +static int sensors_get_ignored(sensors_chip_name name, int feature) { const sensors_chip *chip; const sensors_chip_feature *featureptr; @@ -343,6 +346,9 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(sensors_proc_chips[i].chip, name)) { feature_list = sensors_proc_chips[i].feature; + while (feature_list[*nr].data.name + && sensors_get_ignored(name, feature_list[*nr].data.number) != 1) + (*nr)++; if (!feature_list[*nr].data.name) return NULL; return &feature_list[(*nr)++].data; diff --git a/lib/sensors.h b/lib/sensors.h index 7ae4cb80..01e86909 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -83,11 +83,6 @@ extern const char *sensors_get_adapter_name(int bus_nr); extern int sensors_get_label(sensors_chip_name name, int feature, char **result); -/* Looks up whether a feature should be ignored. Returns <0 on failure, - 0 if it should be ignored, 1 if it is valid. This function takes - logical mappings into account. */ -extern int sensors_get_ignored(sensors_chip_name name, int fature); - /* Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 71f9300a..96bb801e 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -91,12 +91,7 @@ int sensors_get_label_and_valid(sensors_chip_name name, int feature, char **labe { int err; err = sensors_get_label(name,feature,label); - if (!err) - err = sensors_get_ignored(name,feature); - if (err >= 0) { - *valid = err; - err = 0; - } + *valid = !err; return err; } From 9896986247ac85efbcfacd5d534a7fe6a428397f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 24 Jul 2007 08:21:23 +0000 Subject: [PATCH 158/718] We no longer need sensors_get_label_and_valid(), as it does hardly more than sensors_get_label(). This allows for some cleanups. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4645 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 24 +++++------------------- prog/sensors/chips.h | 2 -- prog/sensors/chips_generic.c | 31 ++++++++++--------------------- 3 files changed, 15 insertions(+), 42 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 96bb801e..b37870f8 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -86,46 +86,32 @@ void print_label(const char *label, int space) printf("%s:%*s", label, space - len, ""); } -int sensors_get_label_and_valid(sensors_chip_name name, int feature, char **label, - int *valid) -{ - int err; - err = sensors_get_label(name,feature,label); - *valid = !err; - return err; -} - void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size) { char *label; - int valid; double vid; - if (!sensors_get_label_and_valid(*name,f_vid,&label,&valid) + if (!sensors_get_label(*name, f_vid, &label) && !sensors_get_feature(*name,f_vid,&vid) ) { - if (valid) { - print_label(label, label_size); - printf("%+6.3f V\n", vid); - } + print_label(label, label_size); + printf("%+6.3f V\n", vid); } free(label); } void print_unknown_chip(const sensors_chip_name *name) { - int a, valid; + int a; const sensors_feature_data *data; char *label; double val; a = 0; while((data=sensors_get_all_features(*name, &a))) { - if (sensors_get_label_and_valid(*name,data->number,&label,&valid)) { + if (sensors_get_label(*name, data->number, &label)) { printf("ERROR: Can't get feature `%s' data!\n",data->name); continue; } - if (! valid) - continue; if (data->mode & SENSORS_MODE_R) { if(sensors_get_feature(*name,data->number,&val)) { printf("ERROR: Can't get feature `%s' data!\n",data->name); diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index de854021..45c58f8b 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -38,6 +38,4 @@ void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size); void print_label(const char *label, int space); -int sensors_get_label_and_valid(sensors_chip_name name, int feature, char **label, - int *valid); #endif /* def PROG_SENSORS_CHIPS_H */ diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 7622e858..5e026b97 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -62,15 +62,15 @@ static void sensors_get_available_features(const sensors_chip_name *name, static int sensors_get_label_size(const sensors_chip_name *name) { - int i, valid; + int i; const sensors_feature_data *iter; char *label; unsigned int max_size = 11; /* Initialised to 11 as minumum label-width */ i = 0; while((iter = sensors_get_all_features(*name, &i))) { - if (!sensors_get_label_and_valid(*name, iter->number, &label, &valid) && - valid && strlen(label) > max_size) + if (!sensors_get_label(*name, iter->number, &label) && + strlen(label) > max_size) max_size = strlen(label); free(label); } @@ -93,18 +93,15 @@ static void print_generic_chip_temp(const sensors_chip_name *name, { double val, max, min; char *label; - int valid, type; + int type; const int size = SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP; short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0, }; double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0.0, }; - if (sensors_get_label_and_valid(*name, feature->number, &label, &valid)) { + if (sensors_get_label(*name, feature->number, &label)) { free(label); - printf("ERROR: Can't get temperature data!\n"); + printf("ERROR: Can't get temperature label!\n"); return; - } else if (!valid) { - free(label); - return; /* ignored */ } if (get_feature_value(name, feature, &val)) { @@ -210,19 +207,15 @@ static void print_generic_chip_in(const sensors_chip_name *name, int i, int label_size) { const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; - int valid; short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0, }; double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0.0, }; double val, alarm_max, alarm_min; char *label; - if (sensors_get_label_and_valid(*name, feature->number, &label, &valid)) { + if (sensors_get_label(*name, feature->number, &label)) { free(label); - printf("ERROR: Can't get in data!\n"); + printf("ERROR: Can't get in label!\n"); return; - } else if (!valid) { - free(label); - return; /* ignored */ } if (get_feature_value(name, feature, &val)) { @@ -277,19 +270,15 @@ static void print_generic_chip_fan(const sensors_chip_name *name, int i, int label_size) { char *label; - int valid; const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = {0, }; double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = {0.0, }; double val; - if (sensors_get_label_and_valid(*name, feature->number, &label, &valid)) { - printf("ERROR: Can't get fan data!\n"); + if (sensors_get_label(*name, feature->number, &label)) { + printf("ERROR: Can't get fan label!\n"); free(label); return; - } else if (!valid) { - free(label); - return; /* ignored */ } if (get_feature_value(name, feature, &val)) From eaec35491efaa5e04cd846e48371c12d00c2e331 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 24 Jul 2007 08:22:03 +0000 Subject: [PATCH 159/718] Now that sensors_get_ignored() is an internal function, we can change its prototype to suit our needs better. * Pass the chip name by address. * Pass the feature directly rather than its number. * Switch to a sane convention for the returned value. * Don't check for errors that can't happen. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4646 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/lib/access.c b/lib/access.c index 6e39f989..d9f7360b 100644 --- a/lib/access.c +++ b/lib/access.c @@ -193,34 +193,29 @@ sensors_get_label_exit: return 0; } -/* Looks up whether a feature should be ignored. Returns <0 on failure, - 0 if it should be ignored, 1 if it is valid. This function takes +/* Looks up whether a feature should be ignored. Returns + 1 if it should be ignored, 0 if not. This function takes logical mappings into account. */ -static int sensors_get_ignored(sensors_chip_name name, int feature) +static int sensors_get_ignored(const sensors_chip_name *name, + const sensors_chip_feature *feature) { const sensors_chip *chip; - const sensors_chip_feature *featureptr; - const sensors_chip_feature *alt_featureptr; + const char *main_feature_name; int i; - if (sensors_chip_name_has_wildcards(name)) - return -SENSORS_ERR_WILDCARDS; - if (!(featureptr = sensors_lookup_feature_nr(&name, feature))) - return -SENSORS_ERR_NO_ENTRY; - if (featureptr->data.mapping == SENSORS_NO_MAPPING) - alt_featureptr = NULL; - else if (!(alt_featureptr = - sensors_lookup_feature_nr(&name, - featureptr->data.mapping))) - return -SENSORS_ERR_NO_ENTRY; - for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) + if (feature->data.mapping == SENSORS_NO_MAPPING) + main_feature_name = NULL; + else + main_feature_name = sensors_lookup_feature_nr(name, + feature->data.mapping)->data.name; + + for (chip = NULL; (chip = sensors_for_all_config_chips(*name, chip));) for (i = 0; i < chip->ignores_count; i++) - if (!strcasecmp(featureptr->data.name, chip->ignores[i].name) || - (alt_featureptr && - !strcasecmp(alt_featureptr->data.name, chip->ignores[i].name))) - return 0; - /* valid */ - return 1; + if (!strcasecmp(feature->data.name, chip->ignores[i].name) || + (main_feature_name && + !strcasecmp(main_feature_name, chip->ignores[i].name))) + return 1; + return 0; } /* Read the value of a feature of a certain chip. Note that chip should not @@ -347,7 +342,7 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, if (sensors_match_chip(sensors_proc_chips[i].chip, name)) { feature_list = sensors_proc_chips[i].feature; while (feature_list[*nr].data.name - && sensors_get_ignored(name, feature_list[*nr].data.number) != 1) + && sensors_get_ignored(&name, &feature_list[*nr])) (*nr)++; if (!feature_list[*nr].data.name) return NULL; From 5fb9a1689fe1ed957fb0aae9fe8ed874db20bd11 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 9 Aug 2007 08:39:41 +0000 Subject: [PATCH 160/718] Don't export sensors_chip_name_has_wildcards(). I don't know of any application using it, and I can't think of any use case for it outside of libsensors. I'm not even sure if the inside calls are all legitimate. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4647 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/access.c | 2 +- lib/libsensors.3 | 6 ------ lib/sensors.h | 5 ----- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 899237c8..3d9cdc3c 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,7 @@ SVN HEAD Drop all the chip-specific support Fix a memory leak on error Speed up sensors_get_ignored() a bit + No longer export sensors_chip_name_has_wildcards() Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/access.c b/lib/access.c index d9f7360b..0c3c0cdb 100644 --- a/lib/access.c +++ b/lib/access.c @@ -132,7 +132,7 @@ sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) /* Check whether the chip name is an 'absolute' name, which can only match one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 if there are wildcards. */ -int sensors_chip_name_has_wildcards(sensors_chip_name chip) +static int sensors_chip_name_has_wildcards(sensors_chip_name chip) { if ((chip.prefix == SENSORS_CHIP_NAME_PREFIX_ANY) || (chip.bus == SENSORS_CHIP_NAME_BUS_ANY) || diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 6b29e064..26a12545 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -37,7 +37,6 @@ libsensors \- publicly accessible functions provided by the sensors library \fBsensors_chip_name *res);\fP .B int sensors_match_chip(sensors_chip_name chip1, \fBsensors_chip_name chip2);\fP -.B int sensors_chip_name_has_wildcards(sensors_chip_name chip); .B const char *sensors_get_adapter_name(int bus_nr); .B int sensors_get_label(sensors_chip_name name, int feature, \fBchar **result);\fP @@ -72,11 +71,6 @@ Parse a chip name to the internal representation. Return 0 on succes, <0 on erro .br Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. -\fBint sensors_chip_name_has_wildcards - (sensors_chip_name chip);\fP -.br -Check whether the chip name is an 'absolute' name, which can only match one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 if there are wildcards. - .B const char *sensors_get_adapter_name(int bus_nr); .br This function returns the adapter name of a bus number, as used within the diff --git a/lib/sensors.h b/lib/sensors.h index 01e86909..10b893c2 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -66,11 +66,6 @@ extern int sensors_parse_chip_name(const char *orig_name, extern int sensors_match_chip(sensors_chip_name chip1, sensors_chip_name chip2); -/* Check whether the chip name is an 'absolute' name, which can only match - one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 - if there are wildcards. */ -extern int sensors_chip_name_has_wildcards(sensors_chip_name chip); - /* This function returns the adapter name of a bus number, as used within the sensors_chip_name structure. If it could not be found, it returns NULL */ From 1b51800541ba627d121f1b946c21cca5758b4e39 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 9 Aug 2007 08:43:40 +0000 Subject: [PATCH 161/718] Delete sensors_do_all_sets(). I couldn't find any application using it, and sensors_do_chip_sets() can be used instead if really needed. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4648 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/access.c | 12 ------------ lib/libsensors.3 | 5 ----- lib/sensors.h | 4 ---- 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/CHANGES b/CHANGES index 3d9cdc3c..93ce2409 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ SVN HEAD Fix a memory leak on error Speed up sensors_get_ignored() a bit No longer export sensors_chip_name_has_wildcards() + Delete sensors_do_all_sets(), unused Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/access.c b/lib/access.c index 0c3c0cdb..99c323f4 100644 --- a/lib/access.c +++ b/lib/access.c @@ -483,18 +483,6 @@ int sensors_do_chip_sets(sensors_chip_name name) return res; } -/* Execute all set statements for all detected chips. This is the same as - calling sensors_do_chip_sets with an all wildcards chip name */ -int sensors_do_all_sets(void) -{ - static const sensors_chip_name name = { - .prefix = SENSORS_CHIP_NAME_PREFIX_ANY, - .bus = SENSORS_CHIP_NAME_BUS_ANY, - .addr = SENSORS_CHIP_NAME_ADDR_ANY, - }; - return sensors_do_chip_sets(name); -} - /* Static mappings for use by sensors_feature_get_type() */ struct feature_subtype_match { diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 26a12545..13b14d8c 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -45,7 +45,6 @@ libsensors \- publicly accessible functions provided by the sensors library .B int sensors_set_feature(sensors_chip_name name, int feature, \fBdouble value);\fP .B int sensors_do_chip_sets(sensors_chip_name name); -.B extern int sensors_do_all_sets(void); .B const sensors_chip_name *sensors_get_detected_chips(int *nr); .B const sensors_feature_data *sensors_get_all_features \fB(sensors_chip_name name, int *nr);\fP @@ -95,10 +94,6 @@ Set the value of a feature of a certain chip. Note that chip should not contain .br Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. -.B int sensors_do_all_sets(void); -.br -Execute all set statements for all detected chips. This is the same as calling sensors_do_chip_sets with an all wildcards chip name - \fBconst sensors_chip_name *sensors_get_detected_chips (int *nr);\fP .br diff --git a/lib/sensors.h b/lib/sensors.h index 10b893c2..53b2d5af 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -94,10 +94,6 @@ extern int sensors_set_feature(sensors_chip_name name, int feature, wildcards! This function will return 0 on success, and <0 on failure. */ extern int sensors_do_chip_sets(sensors_chip_name name); -/* Execute all set statements for all detected chips. This is the same as - calling sensors_do_chip_sets with an all wildcards chip name */ -extern int sensors_do_all_sets(void); - /* This function returns all detected chips, one by one. To start at the beginning of the list, use 0 for nr; NULL is returned if we are at the end of the list. Do not try to change these chip names, as From e68975222892fb43c57a8fed4168df63c67d4c01 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 10 Aug 2007 17:33:43 +0000 Subject: [PATCH 162/718] Don't probe i2c-isa as if it were a regular i2c bus. This bug was introduced when getting rid of the i2cdetect dependency. I had forgotten that i2c-isa was not listed in class i2c-dev but was still listed in class i2c-adapter. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4650 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 1 + 1 file changed, 1 insertion(+) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 0a0c15a7..eb992244 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2339,6 +2339,7 @@ sub initialize_i2c_adapters_list $entry = {}; # New entry $entry->{'name'} = sysfs_device_attribute("${class_dir}/i2c-$1", "name") || sysfs_device_attribute("${class_dir}/i2c-$1/device", "name"); + next if $entry->{'name'} eq "ISA main adapter"; $entry->{'driver'} = find_adapter_driver($entry->{'name'}); $i2c_adapters[$1] = $entry; } From fbdb5dba874ca174994a56b45deff4209ce4775e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 12 Aug 2007 15:44:35 +0000 Subject: [PATCH 163/718] The libsensors test suite doesn't use iconv. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4655 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/test/Module.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/test/Module.mk b/lib/test/Module.mk index b9991def..2a9f6edc 100644 --- a/lib/test/Module.mk +++ b/lib/test/Module.mk @@ -4,8 +4,6 @@ LIB_TEST_DIR := lib/test LIB_TEST_TARGETS := $(LIB_TEST_DIR)/test-scanner LIB_TEST_SOURCES := $(LIB_TEST_DIR)/test-scanner.c -LIBICONV := $(shell if /sbin/ldconfig -p | grep -q libiconv\\.so ; then echo \-liconv; else echo; fi) - LIB_TEST_SCANNER_OBJS := \ $(LIB_TEST_DIR)/test-scanner.ro \ $(LIB_DIR)/conf-lex.ao \ @@ -13,7 +11,7 @@ LIB_TEST_SCANNER_OBJS := \ $(LIB_DIR)/general.ao $(LIB_TEST_DIR)/test-scanner: $(LIB_TEST_SCANNER_OBJS) - $(CC) $(EXLDFLAGS) -o $@ $(LIB_TEST_SCANNER_OBJS) $(LIBICONV) -Llib + $(CC) $(EXLDFLAGS) -o $@ $(LIB_TEST_SCANNER_OBJS) -Llib all-lib-test: $(LIB_TEST_TARGETS) user :: all-lib-test From a98987dcc6cef6f01a32bee517df915d13e95c37 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 12 Aug 2007 16:31:43 +0000 Subject: [PATCH 164/718] List the upcoming adt7470 driver. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4656 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index eb992244..a08ede51 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -849,7 +849,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); }, { name => "Analog Devices ADT7470", - driver => "to-be-written", + driver => "adt7470", i2c_addrs => [0x2c, 0x2e, 0x2f], i2c_detect => sub { adt7467_detect(4, @_); }, }, From 625e4944c5c247d5db3546e8c80663c525b4348e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 12 Aug 2007 19:41:33 +0000 Subject: [PATCH 165/718] Add detection of the Winbond W83L786NR/NG/R/G and W83L771W/G chips. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4661 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 ++ prog/detect/sensors-detect | 47 ++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index 93ce2409..7f7715ff 100644 --- a/CHANGES +++ b/CHANGES @@ -59,6 +59,8 @@ SVN HEAD Fix ADM1022 detection Add detection of many SMSC Super-I/O chips Add Fintek F71806FG and F71862FG detection + Add Winbond W83L786NR/NG/R/G detection + Add Winbond W83L771W/G detection 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index a08ede51..e072a564 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1004,17 +1004,23 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_detect => sub { mozart_detect(2, @_); }, } , { - name => "Winbond W83L784R/AR", + name => "Winbond W83L784R/AR/G", driver => "to-be-written", i2c_addrs => [0x2d], i2c_detect => sub { w83l784r_detect(0, @_); }, } , { - name => "Winbond W83L785R", + name => "Winbond W83L785R/G", driver => "to-be-written", i2c_addrs => [0x2d], i2c_detect => sub { w83l784r_detect(1, @_); }, } , + { + name => "Winbond W83L786NR/NG/R/G", + driver => "to-be-written", + i2c_addrs => [0x2e, 0x2f], + i2c_detect => sub { w83l784r_detect(2, @_); }, + }, { name => "Winbond W83L785TS-S", driver => "w83l785ts", @@ -1231,6 +1237,12 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], i2c_detect => sub { lm90_detect(7, @_); }, }, + { + name => "Winbond W83L771W/G", + driver => "lm90", + i2c_addrs => [0x4c], + i2c_detect => sub { lm90_detect(8, @_); }, + }, { name => "National Semiconductor LM63", driver => "lm63", @@ -3838,7 +3850,8 @@ sub lm83_detect # $_[0]: Chip to detect # (0 = LM90, 1=LM89/LM99, 2=LM86, 3=ADM1032, 4=MAX6657/MAX6658/MAX6659, -# 5 = ADT7461, 6 = MAX6648/MAX6692, 7 = MAX6680/MAX6681) +# 5 = ADT7461, 6 = MAX6648/MAX6692, 7 = MAX6680/MAX6681, +# 8 = W83L771W/G) # $_[1]: A reference to the file descriptor to access this chip. # $_[2]: Address # Returns: undef if not detected, 4, 6 or 8 if detected. @@ -3913,6 +3926,13 @@ sub lm90_detect return if $cid != 0x01; # MAX6680/MAX6681 return 6; } + if ($chip == 8) { + return if ($conf & 0x2a) != 0; + return if $rate > 0x09; + return if $mid != 0x5c; # Winbond + return if $cid != 0x00; # W83L771W/G + return 6; + } return; } @@ -5116,19 +5136,18 @@ sub ipmi_smic_detect return (4); } -# $_[0]: Chip to detect (0 = W83L784R/AR, 1 = W83L785R) +# $_[0]: Chip to detect (0 = W83L784R/AR/G, 1 = W83L785R/G, +# 2 = W83L786NR/NG/R/G) # $_[1]: A reference to the file descriptor to access this chip. # $_[2]: Address # Returns: undef if not detected, 6 or 8 if detected # Registers used: # 0x40: Configuration -# 0x4a: Full I2C Address (not W83L785R) -# 0x4b: I2C addresses of emulated LM75 chips (not W83L785R) +# 0x4a: Full I2C Address (W83L784R only) +# 0x4b: I2C addresses of emulated LM75 chips (W83L784R only) # 0x4c: Winbond Vendor ID (Low Byte) # 0x4d: Winbond Vendor ID (High Byte) # 0x4e: Chip ID -# Note that this function is always called through a closure, so the -# arguments are shifted by one place. sub w83l784r_detect { my ($reg,@res); @@ -5139,16 +5158,16 @@ sub w83l784r_detect and i2c_smbus_read_byte_data($file,0x4a) != $addr; return unless i2c_smbus_read_byte_data($file,0x4c) == 0xa3; return unless i2c_smbus_read_byte_data($file,0x4d) == 0x5c; - return if $chip == 0 - and i2c_smbus_read_byte_data($file,0x4e) != 0x50; - return if $chip == 1 - and i2c_smbus_read_byte_data($file,0x4e) != 0x60; - $reg = i2c_smbus_read_byte_data($file,0x4b); + $reg = i2c_smbus_read_byte_data($file, 0x4e); + return if $chip == 0 and $reg != 0x50; + return if $chip == 1 and $reg != 0x60; + return if $chip == 2 and $reg != 0x80; - return 6 if $chip == 1; # W83L785R doesn't have subclients + return 6 if $chip != 0; # No subclients @res = (8); + $reg = i2c_smbus_read_byte_data($file, 0x4b); push @res, ($reg & 0x07) + 0x48 unless $reg & 0x08 ; push @res, (($reg & 0x70) >> 4) + 0x48 unless $reg & 0x80; return @res; From 6a49d8c88a5dec84989bf62763d899b8a1216e52 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 12 Aug 2007 19:54:40 +0000 Subject: [PATCH 166/718] Discard legacy comment. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4663 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 6 ------ 1 file changed, 6 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index e072a564..9018044a 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -3465,8 +3465,6 @@ sub mtp008_detect # 0x40: Configuration # 0x48: Full I2C Address # 0x49: Device ID -# Note that this function is always called through a closure, so the -# arguments are shifted by one place. sub lm78_detect { my $reg; @@ -4824,8 +4822,6 @@ sub ite_overclock_detect # 0x48: Full I2C Address # 0x58: Mfr ID # 0x5b: Device ID (not on IT8705) -# Note that this function is always called through a closure, so the -# arguments are shifted by one place. sub ite_detect { my $reg; @@ -5179,8 +5175,6 @@ sub w83l784r_detect # Returns: undef if not detected, 8 if detected # Registers used: # 0x4C-4E: Mfr and Chip ID -# Note that this function is always called through a closure, so the -# arguments are shifted by one place. sub w83l785ts_detect { my ($chip,$file,$addr) = @_; From 69757bcc20dcb812dda8f6e8932e886f6bb27438 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 13 Aug 2007 20:11:02 +0000 Subject: [PATCH 167/718] Add FSC Heimdall, Poseidon II detection, change Poseidon I label from just plain Poseidon to Poseidon I git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4665 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 60 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 9018044a..b85e0284 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1379,9 +1379,15 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_detect => sub { ddcmonitor_detect(@_); }, }, { - name => "FSC Poseidon", + name => "FSC Poseidon I", driver => "fscpos", i2c_addrs => [0x73], + i2c_detect => sub { fscpeg_detect(@_); }, + }, + { + name => "FSC Poseidon II", + driver => "to-be-written", + i2c_addrs => [0x73], i2c_detect => sub { fscpos_detect(@_); }, }, { @@ -1396,6 +1402,12 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x73], i2c_detect => sub { fscher_detect(@_); }, }, + { + name => "FSC Heimdal", + driver => "to-be-written", + i2c_addrs => [0x73], + i2c_detect => sub { fschmd_detect(@_); }, + }, { name => "ALi M5879", driver => "to-be-written", @@ -4898,8 +4910,8 @@ sub ddcmonitor_detect # $_[1]: Address # Returns: undef if not detected, (8) if detected. # Registers used: -# 0x00-0x02: Identification ('P','E','G' -> Pegasus ? :-) -sub fscpos_detect +# 0x00-0x02: Identification ('P','E','G' -> Pegasus ? :-) aka Poseidon I +sub fscpeg_detect { my ($file,$addr) = @_; # check the first 3 registers @@ -4915,6 +4927,27 @@ sub fscpos_detect return (8); } +# $_[0]: A reference to the file descriptor to access this chip. +# $_[1]: Address +# Returns: undef if not detected, (8) if detected. +# Registers used: +# 0x00-0x02: Identification 'P','O','S' -> Poseideon II +sub fscpos_detect +{ + my ($file,$addr) = @_; + # check the first 3 registers + if (i2c_smbus_read_byte_data($file,0x00) != 0x50) { + return; + } + if (i2c_smbus_read_byte_data($file,0x01) != 0x4F) { + return; + } + if (i2c_smbus_read_byte_data($file,0x02) != 0x53) { + return; + } + return (8); +} + # $_[0]: A reference to the file descriptor to access this chip. # $_[1]: Address # Returns: undef if not detected, (8) if detected. @@ -4957,6 +4990,27 @@ sub fscher_detect return (8); } +# $_[0]: A reference to the file descriptor to access this chip. +# $_[1]: Address +# Returns: undef if not detected, (8) if detected. +# Registers used: +# 0x00-0x02: Identification ('H','M','D') +sub fschmd_detect +{ + my ($file,$addr) = @_; + # check the first 3 registers + if (i2c_smbus_read_byte_data($file,0x00) != 0x48) { + return; + } + if (i2c_smbus_read_byte_data($file,0x01) != 0x4D) { + return; + } + if (i2c_smbus_read_byte_data($file,0x02) != 0x44) { + return; + } + return (8); +} + # $_[0]: A reference to the file descriptor to access this chip. # $_[1]: Address (unused) # Returns: undef if not detected, 5 if detected. From 3bab00fff9310f97cdd8307c1a71002aa692586e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 13 Aug 2007 20:16:03 +0000 Subject: [PATCH 168/718] Change the libsensors API so that all structures are passed by reference. This is more efficient that way. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4666 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/access.c | 93 +++++++++++++++++++----------------- lib/libsensors.3 | 28 +++++------ lib/sensors.h | 14 +++--- prog/sensord/rrd.c | 2 +- prog/sensord/sense.c | 18 +++---- prog/sensors/chips.c | 10 ++-- prog/sensors/chips_generic.c | 16 +++---- prog/sensors/main.c | 4 +- 9 files changed, 95 insertions(+), 91 deletions(-) diff --git a/CHANGES b/CHANGES index 7f7715ff..1f96ce99 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,7 @@ SVN HEAD Speed up sensors_get_ignored() a bit No longer export sensors_chip_name_has_wildcards() Delete sensors_do_all_sets(), unused + Pass structures by reference Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/access.c b/lib/access.c index 99c323f4..59603af9 100644 --- a/lib/access.c +++ b/lib/access.c @@ -33,33 +33,34 @@ static int sensors_eval_expr(sensors_chip_name chipname, /* Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. */ -int sensors_match_chip(sensors_chip_name chip1, sensors_chip_name chip2) +int sensors_match_chip(const sensors_chip_name *chip1, + const sensors_chip_name *chip2) { - if ((chip1.prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && - (chip2.prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && - strcasecmp(chip1.prefix, chip2.prefix)) + if ((chip1->prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && + (chip2->prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && + strcasecmp(chip1->prefix, chip2->prefix)) return 0; - if ((chip1.bus != SENSORS_CHIP_NAME_BUS_ANY) && - (chip2.bus != SENSORS_CHIP_NAME_BUS_ANY) && - (chip1.bus != chip2.bus)) { + if ((chip1->bus != SENSORS_CHIP_NAME_BUS_ANY) && + (chip2->bus != SENSORS_CHIP_NAME_BUS_ANY) && + (chip1->bus != chip2->bus)) { - if ((chip1.bus == SENSORS_CHIP_NAME_BUS_ISA) || - (chip2.bus == SENSORS_CHIP_NAME_BUS_ISA)) + if ((chip1->bus == SENSORS_CHIP_NAME_BUS_ISA) || + (chip2->bus == SENSORS_CHIP_NAME_BUS_ISA)) return 0; - if ((chip1.bus == SENSORS_CHIP_NAME_BUS_PCI) || - (chip2.bus == SENSORS_CHIP_NAME_BUS_PCI)) + if ((chip1->bus == SENSORS_CHIP_NAME_BUS_PCI) || + (chip2->bus == SENSORS_CHIP_NAME_BUS_PCI)) return 0; - if ((chip1.bus != SENSORS_CHIP_NAME_BUS_ANY_I2C) && - (chip2.bus != SENSORS_CHIP_NAME_BUS_ANY_I2C)) + if ((chip1->bus != SENSORS_CHIP_NAME_BUS_ANY_I2C) && + (chip2->bus != SENSORS_CHIP_NAME_BUS_ANY_I2C)) return 0; } - if ((chip1.addr != chip2.addr) && - (chip1.addr != SENSORS_CHIP_NAME_ADDR_ANY) && - (chip2.addr != SENSORS_CHIP_NAME_ADDR_ANY)) + if ((chip1->addr != chip2->addr) && + (chip1->addr != SENSORS_CHIP_NAME_ADDR_ANY) && + (chip2->addr != SENSORS_CHIP_NAME_ADDR_ANY)) return 0; return 1; @@ -84,7 +85,7 @@ sensors_for_all_config_chips(sensors_chip_name chip_name, chips = sensors_config_chips[nr].chips; for (i = 0; i < chips.fits_count; i++) { - if (sensors_match_chip(chips.fits[i], chip_name)) + if (sensors_match_chip(&chips.fits[i], &chip_name)) return sensors_config_chips + nr; } } @@ -101,7 +102,7 @@ const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *c const sensors_chip_feature *features; for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(sensors_proc_chips[i].chip, *chip)) { + if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { features = sensors_proc_chips[i].feature; for (j = 0; features[j].data.name; j++) if (features[j].data.number == feature) @@ -120,7 +121,7 @@ sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) const sensors_chip_feature *features; for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(sensors_proc_chips[i].chip, *chip)) { + if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { features = sensors_proc_chips[i].feature; for (j = 0; features[j].data.name; j++) if (!strcasecmp(features[j].data.name, feature)) @@ -147,7 +148,7 @@ static int sensors_chip_name_has_wildcards(sensors_chip_name chip) contain wildcard values! *result is newly allocated (free it yourself). This function will return 0 on success, and <0 on failure. If no label exists for this feature, its name is returned itself. */ -int sensors_get_label(sensors_chip_name name, int feature, char **result) +int sensors_get_label(const sensors_chip_name *name, int feature, char **result) { const sensors_chip *chip; const sensors_chip_feature *featureptr; @@ -156,12 +157,12 @@ int sensors_get_label(sensors_chip_name name, int feature, char **result) int i; *result = NULL; - if (sensors_chip_name_has_wildcards(name)) + if (sensors_chip_name_has_wildcards(*name)) return -SENSORS_ERR_WILDCARDS; - if (!(featureptr = sensors_lookup_feature_nr(&name, feature))) + if (!(featureptr = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; - for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) + for (chip = NULL; (chip = sensors_for_all_config_chips(*name, chip));) for (i = 0; i < chip->labels_count; i++) if (!strcasecmp(featureptr->data.name,chip->labels[i].name)){ *result = strdup(chip->labels[i].value); @@ -169,7 +170,7 @@ int sensors_get_label(sensors_chip_name name, int feature, char **result) } /* No user specified label, check for a _label sysfs file */ - snprintf(path, PATH_MAX, "%s/%s_label", name.busname, + snprintf(path, PATH_MAX, "%s/%s_label", name->busname, featureptr->data.name); if ((f = fopen(path, "r"))) { @@ -221,7 +222,8 @@ static int sensors_get_ignored(const sensors_chip_name *name, /* Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_get_feature(sensors_chip_name name, int feature, double *result) +int sensors_get_feature(const sensors_chip_name *name, int feature, + double *result) { const sensors_chip_feature *main_feature; const sensors_chip_feature *alt_feature; @@ -231,19 +233,19 @@ int sensors_get_feature(sensors_chip_name name, int feature, double *result) int res, i; int final_expr = 0; - if (sensors_chip_name_has_wildcards(name)) + if (sensors_chip_name_has_wildcards(*name)) return -SENSORS_ERR_WILDCARDS; - if (!(main_feature = sensors_lookup_feature_nr(&name, feature))) + if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) alt_feature = NULL; - else if (!(alt_feature = sensors_lookup_feature_nr(&name, + else if (!(alt_feature = sensors_lookup_feature_nr(name, main_feature->data.compute_mapping))) return -SENSORS_ERR_NO_ENTRY; if (!(main_feature->data.mode & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; for (chip = NULL; - !expr && (chip = sensors_for_all_config_chips(name, chip));) + !expr && (chip = sensors_for_all_config_chips(*name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) { if (!strcasecmp(main_feature->data.name, chip->computes[i].name)) { expr = chip->computes[i].from_proc; @@ -253,11 +255,11 @@ int sensors_get_feature(sensors_chip_name name, int feature, double *result) expr = chip->computes[i].from_proc; } } - if (sensors_read_sysfs_attr(name, feature, &val)) + if (sensors_read_sysfs_attr(*name, feature, &val)) return -SENSORS_ERR_PROC; if (!expr) *result = val; - else if ((res = sensors_eval_expr(name, expr, val, result))) + else if ((res = sensors_eval_expr(*name, expr, val, result))) return res; return 0; } @@ -265,7 +267,8 @@ int sensors_get_feature(sensors_chip_name name, int feature, double *result) /* Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_set_feature(sensors_chip_name name, int feature, double value) +int sensors_set_feature(const sensors_chip_name *name, int feature, + double value) { const sensors_chip_feature *main_feature; const sensors_chip_feature *alt_feature; @@ -275,19 +278,19 @@ int sensors_set_feature(sensors_chip_name name, int feature, double value) int final_expr = 0; double to_write; - if (sensors_chip_name_has_wildcards(name)) + if (sensors_chip_name_has_wildcards(*name)) return -SENSORS_ERR_WILDCARDS; - if (!(main_feature = sensors_lookup_feature_nr(&name, feature))) + if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) alt_feature = NULL; - else if (!(alt_feature = sensors_lookup_feature_nr(&name, + else if (!(alt_feature = sensors_lookup_feature_nr(name, main_feature->data.compute_mapping))) return -SENSORS_ERR_NO_ENTRY; if (!(main_feature->data.mode & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; for (chip = NULL; - !expr && (chip = sensors_for_all_config_chips(name, chip));) + !expr && (chip = sensors_for_all_config_chips(*name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) if (!strcasecmp(main_feature->data.name, chip->computes[i].name)) { expr = chip->computes->to_proc; @@ -299,9 +302,9 @@ int sensors_set_feature(sensors_chip_name name, int feature, double value) to_write = value; if (expr) - if ((res = sensors_eval_expr(name, expr, value, &to_write))) + if ((res = sensors_eval_expr(*name, expr, value, &to_write))) return res; - if (sensors_write_sysfs_attr(name, feature, to_write)) + if (sensors_write_sysfs_attr(*name, feature, to_write)) return -SENSORS_ERR_PROC; return 0; } @@ -332,17 +335,17 @@ const char *sensors_get_adapter_name(int bus_nr) } /* nr-1 is the last feature returned */ -const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, +const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *name, int *nr) { sensors_chip_feature *feature_list; int i; for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(sensors_proc_chips[i].chip, name)) { + if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { feature_list = sensors_proc_chips[i].feature; while (feature_list[*nr].data.name - && sensors_get_ignored(&name, &feature_list[*nr])) + && sensors_get_ignored(name, &feature_list[*nr])) (*nr)++; if (!feature_list[*nr].data.name) return NULL; @@ -371,7 +374,7 @@ int sensors_eval_expr(sensors_chip_name chipname, const sensors_expr * expr, if (!(feature = sensors_lookup_feature_name(&chipname, expr->data.var))) return SENSORS_ERR_NO_ENTRY; - if (!(res = sensors_get_feature(chipname, feature->data.number, result))) + if (!(res = sensors_get_feature(&chipname, feature->data.number, result))) return res; return 0; } @@ -455,7 +458,7 @@ static int sensors_do_this_chip_sets(sensors_chip_name name) err = res; continue; } - if ((res = sensors_set_feature(name, feature_nr, value))) { + if ((res = sensors_set_feature(&name, feature_nr, value))) { sensors_parse_error("Failed to set feature", chip->sets[i].lineno); err = res; @@ -468,14 +471,14 @@ static int sensors_do_this_chip_sets(sensors_chip_name name) /* Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. */ -int sensors_do_chip_sets(sensors_chip_name name) +int sensors_do_chip_sets(const sensors_chip_name *name) { int nr, this_res; const sensors_chip_name *found_name; int res = 0; for (nr = 0; (found_name = sensors_get_detected_chips(&nr));) - if (sensors_match_chip(name, *found_name)) { + if (sensors_match_chip(name, found_name)) { this_res = sensors_do_this_chip_sets(*found_name); if (!res) res = this_res; diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 13b14d8c..db176fc5 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -35,19 +35,19 @@ libsensors \- publicly accessible functions provided by the sensors library .B void sensors_cleanup(void); .B int sensors_parse_chip_name(const char *orig_name, \fBsensors_chip_name *res);\fP -.B int sensors_match_chip(sensors_chip_name chip1, - \fBsensors_chip_name chip2);\fP +.B int sensors_match_chip(const sensors_chip_name *chip1, + \fBconst sensors_chip_name *chip2);\fP .B const char *sensors_get_adapter_name(int bus_nr); -.B int sensors_get_label(sensors_chip_name name, int feature, +.B int sensors_get_label(const sensors_chip_name *name, int feature, \fBchar **result);\fP -.B int sensors_get_feature(sensors_chip_name name, int feature, +.B int sensors_get_feature(const sensors_chip_name *name, int feature, \fBdouble *result);\fP -.B int sensors_set_feature(sensors_chip_name name, int feature, +.B int sensors_set_feature(const sensors_chip_name *name, int feature, \fBdouble value);\fP -.B int sensors_do_chip_sets(sensors_chip_name name); +.B int sensors_do_chip_sets(const sensors_chip_name *name); .B const sensors_chip_name *sensors_get_detected_chips(int *nr); .B const sensors_feature_data *sensors_get_all_features - \fB(sensors_chip_name name, int *nr);\fP + \fB(const sensors_chip_name *name, int *nr);\fP .B const char *libsensors_version; .fi .SH DESCRIPTION @@ -65,8 +65,8 @@ Clean-up function: You can't access anything after this, until the next sensors_ .br Parse a chip name to the internal representation. Return 0 on succes, <0 on error. -\fBint sensors_match_chip(sensors_chip_name chip1, - sensors_chip_name chip2);\fP +\fBint sensors_match_chip(const sensors_chip_name *chip1, + const sensors_chip_name *chip2);\fP .br Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. @@ -75,22 +75,22 @@ Compare two chips name descriptions, to see whether they could match. Return 0 i This function returns the adapter name of a bus number, as used within the sensors_chip_name structure. If it could not be found, it returns NULL. -\fBint sensors_get_label(sensors_chip_name name, int feature, +\fBint sensors_get_label(const sensors_chip_name *name, int feature, char **result);\fP .br Look up the label which belongs to this chip. Note that chip should not contain wildcard values! *result is newly allocated (free it yourself). This function will return 0 on success, and <0 on failure. -\fBint sensors_get_feature(sensors_chip_name name, +\fBint sensors_get_feature(const sensors_chip_name *name, int feature, double *result);\fP .br Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. -\fBint sensors_set_feature(sensors_chip_name name, +\fBint sensors_set_feature(const sensors_chip_name *name, int feature, double value);\fP .br Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. -.B int sensors_do_chip_sets(sensors_chip_name name); +.B int sensors_do_chip_sets(const sensors_chip_name *name); .br Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. @@ -122,7 +122,7 @@ The mode field can be one of: SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W or SENSORS_MODE_RW. \fBconst sensors_feature_data *sensors_get_all_features - (sensors_chip_name name, int *nr);\fP + (const sensors_chip_name *name, int *nr);\fP .br This returns all features of a specific chip. They are returned in bunches: everything with the same mapping is returned just after each other, with diff --git a/lib/sensors.h b/lib/sensors.h index 53b2d5af..966b9d62 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -63,8 +63,8 @@ extern int sensors_parse_chip_name(const char *orig_name, /* Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. */ -extern int sensors_match_chip(sensors_chip_name chip1, - sensors_chip_name chip2); +extern int sensors_match_chip(const sensors_chip_name *chip1, + const sensors_chip_name *chip2); /* This function returns the adapter name of a bus number, as used within the sensors_chip_name structure. If it could not be found, @@ -75,24 +75,24 @@ extern const char *sensors_get_adapter_name(int bus_nr); contain wildcard values! *result is newly allocated (free it yourself). This function will return 0 on success, and <0 on failure. This function takes logical mappings into account. */ -extern int sensors_get_label(sensors_chip_name name, int feature, +extern int sensors_get_label(const sensors_chip_name *name, int feature, char **result); /* Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -extern int sensors_get_feature(sensors_chip_name name, int feature, +extern int sensors_get_feature(const sensors_chip_name *name, int feature, double *result); /* Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -extern int sensors_set_feature(sensors_chip_name name, int feature, +extern int sensors_set_feature(const sensors_chip_name *name, int feature, double value); /* Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. */ -extern int sensors_do_chip_sets(sensors_chip_name name); +extern int sensors_do_chip_sets(const sensors_chip_name *name); /* This function returns all detected chips, one by one. To start at the beginning of the list, use 0 for nr; NULL is returned if we are @@ -171,7 +171,7 @@ typedef struct sensors_feature_data { Do not try to change the returned structure; you will corrupt internal data structures. */ extern const sensors_feature_data *sensors_get_all_features - (sensors_chip_name name, int *nr); + (const sensors_chip_name *name, int *nr); #ifdef __cplusplus } diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index bfbf4fa2..e44d52b2 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -141,7 +141,7 @@ applyToFeatures while ((ret == 0) && ((chip = sensors_get_detected_chips (&i)) != NULL)) { for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { - if (sensors_match_chip (*chip, chipNames[j])) { + if (sensors_match_chip (chip, &chipNames[j])) { int index0, subindex, chipindex = -1; for (index0 = 0; knownChips[index0]; ++ index0) for (subindex = 0; knownChips[index0]->names[subindex]; ++ subindex) diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index 49058e39..67867a59 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -49,7 +49,7 @@ int getLabel (sensors_chip_name name, int feature, char **label) { int err; - err = sensors_get_label (name, feature, label); + err = sensors_get_label (&name, feature, label); return err; } @@ -59,7 +59,7 @@ getRawLabel const sensors_feature_data *rawFeature; int nr1 = 0, nr2 = 0, err = 0; do { - rawFeature = sensors_get_all_features (name, &nr1, &nr2); + rawFeature = sensors_get_all_features (&name, &nr1, &nr2); } while (rawFeature && (rawFeature->number != feature)); /* TODO: Ensure labels match RRD construct and are not repeated! */ if (!rawFeature) { @@ -105,7 +105,7 @@ readUnknownChip ret = idChip (chip); - while ((ret == 0) && ((sensor = sensors_get_all_features (*chip, &index0, &index1)) != NULL)) { + while ((ret == 0) && ((sensor = sensors_get_all_features (chip, &index0, &index1)) != NULL)) { char *label = NULL; int valid = 0; double value; @@ -120,7 +120,7 @@ readUnknownChip /* skip invalid */ } else if (!(sensor->mode & SENSORS_MODE_R)) { sensorLog (LOG_INFO, "%s: %s", sensor->name, label); - } else if ((ret = sensors_get_feature (*chip, sensor->number, &value))) { + } else if ((ret = sensors_get_feature (chip, sensor->number, &value))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/%s: %s", chip->prefix, sensor->name, sensors_strerror (ret)); ret = 22; } else { @@ -145,7 +145,7 @@ doKnownChip if (action == DO_READ) ret = idChip (chip); if (!ret && descriptor->alarmNumber) { - if ((ret = sensors_get_feature (*chip, descriptor->alarmNumber, &tmp))) { + if ((ret = sensors_get_feature (chip, descriptor->alarmNumber, &tmp))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, descriptor->alarmNumber, sensors_strerror (ret)); ret = 20; } else { @@ -153,7 +153,7 @@ doKnownChip } } if (!ret && descriptor->beepNumber) { - if ((ret = sensors_get_feature (*chip, descriptor->beepNumber, &tmp))) { + if ((ret = sensors_get_feature (chip, descriptor->beepNumber, &tmp))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, descriptor->beepNumber, sensors_strerror (ret)); ret = 21; } else { @@ -180,7 +180,7 @@ doKnownChip double values[MAX_DATA]; for (subindex = 0; !ret && (feature->dataNumbers[subindex] >= 0); ++ subindex) { - if ((ret = sensors_get_feature (*chip, feature->dataNumbers[subindex], values + subindex))) { + if ((ret = sensors_get_feature (chip, feature->dataNumbers[subindex], values + subindex))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, feature->dataNumbers[subindex], sensors_strerror (ret)); ret = 23; } @@ -215,7 +215,7 @@ setChip int ret = 0; if ((ret = idChip (chip))) { sensorLog (LOG_ERR, "Error identifying chip: %s", chip->prefix); - } else if ((ret = sensors_do_chip_sets (*chip))) { + } else if ((ret = sensors_do_chip_sets (chip))) { sensorLog (LOG_ERR, "Error performing chip sets: %s: %s", chip->prefix, sensors_strerror (ret)); ret = 50; } else { @@ -252,7 +252,7 @@ doChips while ((ret == 0) && ((chip = sensors_get_detected_chips (&i)) != NULL)) { for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { - if (sensors_match_chip (*chip, chipNames[j])) { + if (sensors_match_chip (chip, &chipNames[j])) { ret = doChip (chip, action); } } diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index b37870f8..cce2c1b1 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -91,8 +91,8 @@ void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size) char *label; double vid; - if (!sensors_get_label(*name, f_vid, &label) - && !sensors_get_feature(*name,f_vid,&vid) ) { + if (!sensors_get_label(name, f_vid, &label) + && !sensors_get_feature(name, f_vid, &vid)) { print_label(label, label_size); printf("%+6.3f V\n", vid); } @@ -107,13 +107,13 @@ void print_unknown_chip(const sensors_chip_name *name) double val; a = 0; - while((data=sensors_get_all_features(*name, &a))) { - if (sensors_get_label(*name, data->number, &label)) { + while((data=sensors_get_all_features(name, &a))) { + if (sensors_get_label(name, data->number, &label)) { printf("ERROR: Can't get feature `%s' data!\n",data->name); continue; } if (data->mode & SENSORS_MODE_R) { - if(sensors_get_feature(*name,data->number,&val)) { + if(sensors_get_feature(name, data->number, &val)) { printf("ERROR: Can't get feature `%s' data!\n",data->name); continue; } diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 5e026b97..2d2058f8 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -30,7 +30,7 @@ static int get_feature_value(const sensors_chip_name *name, const sensors_feature_data *feature, double *val) { - return sensors_get_feature(*name, feature->number, val); + return sensors_get_feature(name, feature->number, val); } static void sensors_get_available_features(const sensors_chip_name *name, @@ -43,7 +43,7 @@ static void sensors_get_available_features(const sensors_chip_name *name, { const sensors_feature_data *iter; - while((iter = sensors_get_all_features(*name, &i)) && + while((iter = sensors_get_all_features(name, &i)) && iter->mapping == feature->number) { int indx; @@ -68,8 +68,8 @@ static int sensors_get_label_size(const sensors_chip_name *name) unsigned int max_size = 11; /* Initialised to 11 as minumum label-width */ i = 0; - while((iter = sensors_get_all_features(*name, &i))) { - if (!sensors_get_label(*name, iter->number, &label) && + while((iter = sensors_get_all_features(name, &i))) { + if (!sensors_get_label(name, iter->number, &label) && strlen(label) > max_size) max_size = strlen(label); free(label); @@ -98,7 +98,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0, }; double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0.0, }; - if (sensors_get_label(*name, feature->number, &label)) { + if (sensors_get_label(name, feature->number, &label)) { free(label); printf("ERROR: Can't get temperature label!\n"); return; @@ -212,7 +212,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, double val, alarm_max, alarm_min; char *label; - if (sensors_get_label(*name, feature->number, &label)) { + if (sensors_get_label(name, feature->number, &label)) { free(label); printf("ERROR: Can't get in label!\n"); return; @@ -275,7 +275,7 @@ static void print_generic_chip_fan(const sensors_chip_name *name, double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = {0.0, }; double val; - if (sensors_get_label(*name, feature->number, &label)) { + if (sensors_get_label(name, feature->number, &label)) { printf("ERROR: Can't get fan label!\n"); free(label); return; @@ -326,7 +326,7 @@ void print_generic_chip(const sensors_chip_name *name) label_size = sensors_get_label_size(name); i = 0; - while((feature = sensors_get_all_features(*name, &i))) { + while((feature = sensors_get_all_features(name, &i))) { if (feature->mapping != SENSORS_NO_MAPPING) continue; diff --git a/prog/sensors/main.c b/prog/sensors/main.c index ef52a140..91b03a5e 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -259,7 +259,7 @@ int do_the_real_work(int *error) *error = 0; for (chip_nr = 0; (chip = sensors_get_detected_chips(&chip_nr));) for(i = 0; i < chips_count; i++) - if (sensors_match_chip(*chip,chips[i])) { + if (sensors_match_chip(chip, &chips[i])) { if(do_sets) { if (do_a_set(*chip)) *error = 1; @@ -276,7 +276,7 @@ int do_a_set(sensors_chip_name name) { int res; - if ((res = sensors_do_chip_sets(name))) { + if ((res = sensors_do_chip_sets(&name))) { if (res == -SENSORS_ERR_PROC) { fprintf(stderr,"%s: %s for writing;\n",sprintf_chip_name(name), sensors_strerror(res)); From d9ec11a6c7656d2930d9b961bc951a7c6cd34b31 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 13 Aug 2007 20:16:42 +0000 Subject: [PATCH 169/718] Pass the structures by reference inside libsensors. Again a small performance gain, and this makes the internal code consistent with the public functions. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4667 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 57 +++++++++++++++--------------- lib/init.c | 98 ++++++++++++++++++++++++++-------------------------- lib/sysfs.c | 14 ++++---- lib/sysfs.h | 6 ++-- 4 files changed, 90 insertions(+), 85 deletions(-) diff --git a/lib/access.c b/lib/access.c index 59603af9..fa5544a3 100644 --- a/lib/access.c +++ b/lib/access.c @@ -27,7 +27,7 @@ #include "sysfs.h" #include "general.h" -static int sensors_eval_expr(sensors_chip_name chipname, +static int sensors_eval_expr(const sensors_chip_name *name, const sensors_expr *expr, double val, double *result); @@ -74,7 +74,7 @@ int sensors_match_chip(const sensors_chip_name *chip1, Note that this visits the list of chips from last to first. Usually, you want the match that was latest in the config file. */ static sensors_chip * -sensors_for_all_config_chips(sensors_chip_name chip_name, +sensors_for_all_config_chips(const sensors_chip_name *name, const sensors_chip *last) { int nr, i; @@ -85,7 +85,7 @@ sensors_for_all_config_chips(sensors_chip_name chip_name, chips = sensors_config_chips[nr].chips; for (i = 0; i < chips.fits_count; i++) { - if (sensors_match_chip(&chips.fits[i], &chip_name)) + if (sensors_match_chip(&chips.fits[i], name)) return sensors_config_chips + nr; } } @@ -133,12 +133,12 @@ sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) /* Check whether the chip name is an 'absolute' name, which can only match one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 if there are wildcards. */ -static int sensors_chip_name_has_wildcards(sensors_chip_name chip) +static int sensors_chip_name_has_wildcards(const sensors_chip_name *chip) { - if ((chip.prefix == SENSORS_CHIP_NAME_PREFIX_ANY) || - (chip.bus == SENSORS_CHIP_NAME_BUS_ANY) || - (chip.bus == SENSORS_CHIP_NAME_BUS_ANY_I2C) || - (chip.addr == SENSORS_CHIP_NAME_ADDR_ANY)) + if ((chip->prefix == SENSORS_CHIP_NAME_PREFIX_ANY) || + (chip->bus == SENSORS_CHIP_NAME_BUS_ANY) || + (chip->bus == SENSORS_CHIP_NAME_BUS_ANY_I2C) || + (chip->addr == SENSORS_CHIP_NAME_ADDR_ANY)) return 1; else return 0; @@ -157,12 +157,12 @@ int sensors_get_label(const sensors_chip_name *name, int feature, char **result) int i; *result = NULL; - if (sensors_chip_name_has_wildcards(*name)) + if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; if (!(featureptr = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; - for (chip = NULL; (chip = sensors_for_all_config_chips(*name, chip));) + for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->labels_count; i++) if (!strcasecmp(featureptr->data.name,chip->labels[i].name)){ *result = strdup(chip->labels[i].value); @@ -210,7 +210,7 @@ static int sensors_get_ignored(const sensors_chip_name *name, main_feature_name = sensors_lookup_feature_nr(name, feature->data.mapping)->data.name; - for (chip = NULL; (chip = sensors_for_all_config_chips(*name, chip));) + for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->ignores_count; i++) if (!strcasecmp(feature->data.name, chip->ignores[i].name) || (main_feature_name && @@ -233,7 +233,7 @@ int sensors_get_feature(const sensors_chip_name *name, int feature, int res, i; int final_expr = 0; - if (sensors_chip_name_has_wildcards(*name)) + if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; @@ -245,7 +245,7 @@ int sensors_get_feature(const sensors_chip_name *name, int feature, if (!(main_feature->data.mode & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; for (chip = NULL; - !expr && (chip = sensors_for_all_config_chips(*name, chip));) + !expr && (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) { if (!strcasecmp(main_feature->data.name, chip->computes[i].name)) { expr = chip->computes[i].from_proc; @@ -255,11 +255,11 @@ int sensors_get_feature(const sensors_chip_name *name, int feature, expr = chip->computes[i].from_proc; } } - if (sensors_read_sysfs_attr(*name, feature, &val)) + if (sensors_read_sysfs_attr(name, feature, &val)) return -SENSORS_ERR_PROC; if (!expr) *result = val; - else if ((res = sensors_eval_expr(*name, expr, val, result))) + else if ((res = sensors_eval_expr(name, expr, val, result))) return res; return 0; } @@ -278,7 +278,7 @@ int sensors_set_feature(const sensors_chip_name *name, int feature, int final_expr = 0; double to_write; - if (sensors_chip_name_has_wildcards(*name)) + if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; @@ -290,7 +290,7 @@ int sensors_set_feature(const sensors_chip_name *name, int feature, if (!(main_feature->data.mode & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; for (chip = NULL; - !expr && (chip = sensors_for_all_config_chips(*name, chip));) + !expr && (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) if (!strcasecmp(main_feature->data.name, chip->computes[i].name)) { expr = chip->computes->to_proc; @@ -302,9 +302,9 @@ int sensors_set_feature(const sensors_chip_name *name, int feature, to_write = value; if (expr) - if ((res = sensors_eval_expr(*name, expr, value, &to_write))) + if ((res = sensors_eval_expr(name, expr, value, &to_write))) return res; - if (sensors_write_sysfs_attr(*name, feature, to_write)) + if (sensors_write_sysfs_attr(name, feature, to_write)) return -SENSORS_ERR_PROC; return 0; } @@ -355,7 +355,8 @@ const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *na } /* Evaluate an expression */ -int sensors_eval_expr(sensors_chip_name chipname, const sensors_expr * expr, +int sensors_eval_expr(const sensors_chip_name *name, + const sensors_expr *expr, double val, double *result) { double res1, res2; @@ -371,17 +372,17 @@ int sensors_eval_expr(sensors_chip_name chipname, const sensors_expr * expr, return 0; } if (expr->kind == sensors_kind_var) { - if (!(feature = sensors_lookup_feature_name(&chipname, + if (!(feature = sensors_lookup_feature_name(name, expr->data.var))) return SENSORS_ERR_NO_ENTRY; - if (!(res = sensors_get_feature(&chipname, feature->data.number, result))) + if (!(res = sensors_get_feature(name, feature->data.number, result))) return res; return 0; } - if ((res = sensors_eval_expr(chipname, expr->data.subexpr.sub1, val, &res1))) + if ((res = sensors_eval_expr(name, expr->data.subexpr.sub1, val, &res1))) return res; if (expr->data.subexpr.sub2 && - (res = sensors_eval_expr(chipname, expr->data.subexpr.sub2, val, &res2))) + (res = sensors_eval_expr(name, expr->data.subexpr.sub2, val, &res2))) return res; switch (expr->data.subexpr.op) { case sensors_add: @@ -416,7 +417,7 @@ int sensors_eval_expr(sensors_chip_name chipname, const sensors_expr * expr, /* Execute all set statements for this particular chip. The chip may not contain wildcards! This function will return 0 on success, and <0 on failure. */ -static int sensors_do_this_chip_sets(sensors_chip_name name) +static int sensors_do_this_chip_sets(const sensors_chip_name *name) { sensors_chip *chip; double value; @@ -430,7 +431,7 @@ static int sensors_do_this_chip_sets(sensors_chip_name name) for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->sets_count; i++) { - feature = sensors_lookup_feature_name(&name, + feature = sensors_lookup_feature_name(name, chip->sets[i].name); if (!feature) { sensors_parse_error("Unknown feature name", @@ -458,7 +459,7 @@ static int sensors_do_this_chip_sets(sensors_chip_name name) err = res; continue; } - if ((res = sensors_set_feature(&name, feature_nr, value))) { + if ((res = sensors_set_feature(name, feature_nr, value))) { sensors_parse_error("Failed to set feature", chip->sets[i].lineno); err = res; @@ -479,7 +480,7 @@ int sensors_do_chip_sets(const sensors_chip_name *name) for (nr = 0; (found_name = sensors_get_detected_chips(&nr));) if (sensors_match_chip(name, found_name)) { - this_res = sensors_do_this_chip_sets(*found_name); + this_res = sensors_do_this_chip_sets(found_name); if (!res) res = this_res; } diff --git a/lib/init.c b/lib/init.c index 856ba232..ba0b46d5 100644 --- a/lib/init.c +++ b/lib/init.c @@ -27,14 +27,14 @@ #include "sysfs.h" #include "scanner.h" -static void free_chip_name(sensors_chip_name name); +static void free_chip_name(sensors_chip_name *name); static void free_chip_features(sensors_chip_feature *features); -static void free_bus(sensors_bus bus); -static void free_chip(sensors_chip chip); -static void free_label(sensors_label label); -static void free_set(sensors_set set); -static void free_compute(sensors_compute compute); -static void free_ignore(sensors_ignore ignore); +static void free_bus(sensors_bus *bus); +static void free_chip(sensors_chip *chip); +static void free_label(sensors_label *label); +static void free_set(sensors_set *set); +static void free_compute(sensors_compute *compute); +static void free_ignore(sensors_ignore *ignore); static void free_expr(sensors_expr *expr); int sensors_init(FILE *input) @@ -61,7 +61,7 @@ void sensors_cleanup(void) sensors_scanner_exit(); for (i = 0; i < sensors_proc_chips_count; i++) { - free_chip_name(sensors_proc_chips[i].chip); + free_chip_name(&sensors_proc_chips[i].chip); free_chip_features(sensors_proc_chips[i].feature); } free(sensors_proc_chips); @@ -69,28 +69,28 @@ void sensors_cleanup(void) sensors_proc_chips_count = sensors_proc_chips_max = 0; for (i = 0; i < sensors_config_busses_count; i++) - free_bus(sensors_config_busses[i]); + free_bus(&sensors_config_busses[i]); free(sensors_config_busses); sensors_config_busses = NULL; sensors_config_busses_count = sensors_config_busses_max = 0; for (i = 0; i < sensors_config_chips_count; i++) - free_chip(sensors_config_chips[i]); + free_chip(&sensors_config_chips[i]); free(sensors_config_chips); sensors_config_chips = NULL; sensors_config_chips_count = sensors_config_chips_max = 0; for (i = 0; i < sensors_proc_bus_count; i++) - free_bus(sensors_proc_bus[i]); + free_bus(&sensors_proc_bus[i]); free(sensors_proc_bus); sensors_proc_bus = NULL; sensors_proc_bus_count = sensors_proc_bus_max = 0; } -void free_chip_name(sensors_chip_name name) +void free_chip_name(sensors_chip_name *name) { - free(name.prefix); - free(name.busname); + free(name->prefix); + free(name->busname); } void free_chip_features(sensors_chip_feature *features) @@ -102,63 +102,63 @@ void free_chip_features(sensors_chip_feature *features) free(features); } -void free_bus(sensors_bus bus) +void free_bus(sensors_bus *bus) { - free(bus.adapter); + free(bus->adapter); } -void free_chip(sensors_chip chip) +void free_chip(sensors_chip *chip) { int i; - for (i = 0; i < chip.chips.fits_count; i++) - free_chip_name(chip.chips.fits[i]); - free(chip.chips.fits); - chip.chips.fits_count = chip.chips.fits_max = 0; + for (i = 0; i < chip->chips.fits_count; i++) + free_chip_name(&chip->chips.fits[i]); + free(chip->chips.fits); + chip->chips.fits_count = chip->chips.fits_max = 0; - for (i = 0; i < chip.labels_count; i++) - free_label(chip.labels[i]); - free(chip.labels); - chip.labels_count = chip.labels_max = 0; + for (i = 0; i < chip->labels_count; i++) + free_label(&chip->labels[i]); + free(chip->labels); + chip->labels_count = chip->labels_max = 0; - for (i = 0; i < chip.sets_count; i++) - free_set(chip.sets[i]); - free(chip.sets); - chip.sets_count = chip.sets_max = 0; + for (i = 0; i < chip->sets_count; i++) + free_set(&chip->sets[i]); + free(chip->sets); + chip->sets_count = chip->sets_max = 0; - for (i = 0; i < chip.computes_count; i++) - free_compute(chip.computes[i]); - free(chip.computes); - chip.computes_count = chip.computes_max = 0; + for (i = 0; i < chip->computes_count; i++) + free_compute(&chip->computes[i]); + free(chip->computes); + chip->computes_count = chip->computes_max = 0; - for (i = 0; i < chip.ignores_count; i++) - free_ignore(chip.ignores[i]); - free(chip.ignores); - chip.ignores_count = chip.ignores_max = 0; + for (i = 0; i < chip->ignores_count; i++) + free_ignore(&chip->ignores[i]); + free(chip->ignores); + chip->ignores_count = chip->ignores_max = 0; } -void free_label(sensors_label label) +void free_label(sensors_label *label) { - free(label.name); - free(label.value); + free(label->name); + free(label->value); } -void free_set(sensors_set set) +void free_set(sensors_set *set) { - free(set.name); - free_expr(set.value); + free(set->name); + free_expr(set->value); } -void free_compute(sensors_compute compute) +void free_compute(sensors_compute *compute) { - free(compute.name); - free_expr(compute.from_proc); - free_expr(compute.to_proc); + free(compute->name); + free_expr(compute->from_proc); + free_expr(compute->to_proc); } -void free_ignore(sensors_ignore ignore) +void free_ignore(sensors_ignore *ignore) { - free(ignore.name); + free(ignore->name); } void free_expr(sensors_expr *expr) diff --git a/lib/sysfs.c b/lib/sysfs.c index cf805bf8..285b671c 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -396,7 +396,8 @@ exit0: return ret; } -int sensors_read_sysfs_attr(sensors_chip_name name, int feature, double *value) +int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, + double *value) { const sensors_chip_feature *the_feature; int mag; @@ -406,7 +407,7 @@ int sensors_read_sysfs_attr(sensors_chip_name name, int feature, double *value) char check; const char *suffix = ""; - if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) + if (!(the_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ @@ -415,7 +416,7 @@ int sensors_read_sysfs_attr(sensors_chip_name name, int feature, double *value) || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) suffix = "_input"; - snprintf(n, NAME_MAX, "%s/%s%s", name.busname, the_feature->data.name, + snprintf(n, NAME_MAX, "%s/%s%s", name->busname, the_feature->data.name, suffix); if ((f = fopen(n, "r"))) { int res = fscanf(f, "%lf", value); @@ -430,7 +431,8 @@ int sensors_read_sysfs_attr(sensors_chip_name name, int feature, double *value) return 0; } -int sensors_write_sysfs_attr(sensors_chip_name name, int feature, double value) +int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, + double value) { const sensors_chip_feature *the_feature; int mag; @@ -440,7 +442,7 @@ int sensors_write_sysfs_attr(sensors_chip_name name, int feature, double value) char check; const char *suffix = ""; - if (!(the_feature = sensors_lookup_feature_nr(&name, feature))) + if (!(the_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ @@ -449,7 +451,7 @@ int sensors_write_sysfs_attr(sensors_chip_name name, int feature, double value) || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) suffix = "_input"; - snprintf(n, NAME_MAX, "%s/%s%s", name.busname, the_feature->data.name, + snprintf(n, NAME_MAX, "%s/%s%s", name->busname, the_feature->data.name, suffix); if ((f = fopen(n, "w"))) { for (mag = the_feature->scaling; mag > 0; mag --) diff --git a/lib/sysfs.h b/lib/sysfs.h index d9660dc3..6aaa3508 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -29,9 +29,11 @@ extern int sensors_read_sysfs_chips(void); extern int sensors_read_sysfs_bus(void); /* Read a value out of a sysfs attribute file */ -int sensors_read_sysfs_attr(sensors_chip_name name, int feature, double *value); +int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, + double *value); /* Write a value to a sysfs attribute file */ -int sensors_write_sysfs_attr(sensors_chip_name name, int feature, double value); +int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, + double value); #endif /* !SENSORS_LIB_SYSFS_H */ From 3b25c8dc22e280bb0b5e2fcc6ec3754a2ff36236 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 13 Aug 2007 20:19:44 +0000 Subject: [PATCH 170/718] Pass structures by reference in sensors and sensord, again for a small performance gain and better consistency with the new libsensors API. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4668 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/rrd.c | 6 +++--- prog/sensord/sense.c | 18 +++++++++--------- prog/sensord/sensord.h | 6 +++--- prog/sensors/main.c | 42 ++++++++++++++++++++++-------------------- 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index e44d52b2..d7a7bc56 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -157,13 +157,13 @@ applyToFeatures const char *rawLabel = NULL; char *label = NULL; int valid = 0; - if (getValid (*chip, labelNumber, &valid)) { + if (getValid (chip, labelNumber, &valid)) { sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber); ret = -1; - } else if (getRawLabel (*chip, labelNumber, &rawLabel)) { + } else if (getRawLabel (chip, labelNumber, &rawLabel)) { sensorLog (LOG_ERR, "Error getting raw sensor label: %s/#%d", chip->prefix, labelNumber); ret = -1; - } else if (getLabel (*chip, labelNumber, &label)) { + } else if (getLabel (chip, labelNumber, &label)) { sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); ret = -1; } else if (valid) { diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index 67867a59..701dd03b 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -35,7 +35,7 @@ int getValid -(sensors_chip_name name, int feature, int *valid) { +(const sensors_chip_name *name, int feature, int *valid) { int err; err = sensors_get_ignored (name, feature); if (err >= 0) { @@ -47,19 +47,19 @@ getValid int getLabel -(sensors_chip_name name, int feature, char **label) { +(const sensors_chip_name *name, int feature, char **label) { int err; - err = sensors_get_label (&name, feature, label); + err = sensors_get_label (name, feature, label); return err; } int getRawLabel -(sensors_chip_name name, int feature, const char **label) { +(const sensors_chip_name *name, int feature, const char **label) { const sensors_feature_data *rawFeature; int nr1 = 0, nr2 = 0, err = 0; do { - rawFeature = sensors_get_all_features (&name, &nr1, &nr2); + rawFeature = sensors_get_all_features (name, &nr1, &nr2); } while (rawFeature && (rawFeature->number != feature)); /* TODO: Ensure labels match RRD construct and are not repeated! */ if (!rawFeature) { @@ -110,10 +110,10 @@ readUnknownChip int valid = 0; double value; - if (getValid (*chip, sensor->number, &valid)) { + if (getValid (chip, sensor->number, &valid)) { sensorLog (LOG_ERR, "Error getting sensor validity: %s/%s", chip->prefix, sensor->name); ret = 20; - } else if (getLabel (*chip, sensor->number, &label)) { + } else if (getLabel (chip, sensor->number, &label)) { sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, sensor->name); ret = 21; } else if (!valid) { @@ -170,10 +170,10 @@ doKnownChip if ((action == DO_SCAN) && !alarm) { continue; - } else if (getValid (*chip, labelNumber, &valid)) { + } else if (getValid (chip, labelNumber, &valid)) { sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber); ret = 22; - } else if (getLabel (*chip, labelNumber, &label)) { + } else if (getLabel (chip, labelNumber, &label)) { sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); ret = 22; } else if (valid) { diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index 943aa0a0..94e53313 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -58,9 +58,9 @@ extern int unloadLib (void); /* from sense.c */ -extern int getValid (sensors_chip_name name, int feature, int *valid); -extern int getLabel (sensors_chip_name name, int feature, char **label); -extern int getRawLabel (sensors_chip_name name, int feature, const char **label); +extern int getValid (const sensors_chip_name *name, int feature, int *valid); +extern int getLabel (const sensors_chip_name *name, int feature, char **label); +extern int getRawLabel (const sensors_chip_name *name, int feature, const char **label); extern int readChips (void); extern int scanChips (void); diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 91b03a5e..9171a056 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -46,10 +46,10 @@ extern int main(int argc, char *arv[]); static void print_short_help(void); static void print_long_help(void); static void print_version(void); -static void do_a_print(sensors_chip_name name); -static int do_a_set(sensors_chip_name name); +static void do_a_print(const sensors_chip_name *name); +static int do_a_set(const sensors_chip_name *name); static int do_the_real_work(int *error); -static const char *sprintf_chip_name(sensors_chip_name name); +static const char *sprintf_chip_name(const sensors_chip_name *name); #define CHIPS_MAX 20 sensors_chip_name chips[CHIPS_MAX]; @@ -261,10 +261,10 @@ int do_the_real_work(int *error) for(i = 0; i < chips_count; i++) if (sensors_match_chip(chip, &chips[i])) { if(do_sets) { - if (do_a_set(*chip)) + if (do_a_set(chip)) *error = 1; } else - do_a_print(*chip); + do_a_print(chip); i = chips_count; cnt++; } @@ -272,11 +272,11 @@ int do_the_real_work(int *error) } /* returns 1 on error */ -int do_a_set(sensors_chip_name name) +int do_a_set(const sensors_chip_name *name) { int res; - if ((res = sensors_do_chip_sets(&name))) { + if ((res = sensors_do_chip_sets(name))) { if (res == -SENSORS_ERR_PROC) { fprintf(stderr,"%s: %s for writing;\n",sprintf_chip_name(name), sensors_strerror(res)); @@ -293,38 +293,40 @@ int do_a_set(sensors_chip_name name) return 0; } -const char *sprintf_chip_name(sensors_chip_name name) +const char *sprintf_chip_name(const sensors_chip_name *name) { #define BUF_SIZE 200 static char buf[BUF_SIZE]; - if (name.bus == SENSORS_CHIP_NAME_BUS_ISA) - snprintf(buf,BUF_SIZE,"%s-isa-%04x",name.prefix,name.addr); - else if (name.bus == SENSORS_CHIP_NAME_BUS_PCI) - snprintf(buf,BUF_SIZE,"%s-pci-%04x",name.prefix,name.addr); - else if (name.bus == SENSORS_CHIP_NAME_BUS_DUMMY) - snprintf(buf,BUF_SIZE,"%s-%s-%04x",name.prefix,name.busname,name.addr); + if (name->bus == SENSORS_CHIP_NAME_BUS_ISA) + snprintf(buf, BUF_SIZE, "%s-isa-%04x", name->prefix, name->addr); + else if (name->bus == SENSORS_CHIP_NAME_BUS_PCI) + snprintf(buf, BUF_SIZE, "%s-pci-%04x", name->prefix, name->addr); + else if (name->bus == SENSORS_CHIP_NAME_BUS_DUMMY) + snprintf(buf, BUF_SIZE, "%s-%s-%04x", name->prefix, name->busname, + name->addr); else - snprintf(buf,BUF_SIZE,"%s-i2c-%d-%02x",name.prefix,name.bus,name.addr); + snprintf(buf, BUF_SIZE, "%s-i2c-%d-%02x", name->prefix, name->bus, + name->addr); return buf; } -void do_a_print(sensors_chip_name name) +void do_a_print(const sensors_chip_name *name) { if (hide_unknown) return; printf("%s\n",sprintf_chip_name(name)); if (!hide_adapter) { - const char *adap = sensors_get_adapter_name(name.bus); + const char *adap = sensors_get_adapter_name(name->bus); if (adap) printf("Adapter: %s\n", adap); else - fprintf(stderr, "Can't get adapter name for bus %d\n", name.bus); + fprintf(stderr, "Can't get adapter name for bus %d\n", name->bus); } if (do_unknown) - print_unknown_chip(&name); + print_unknown_chip(name); else - print_generic_chip(&name); + print_generic_chip(name); printf("\n"); } From 6bf63e0f7a97ebb928f42796407771b7f982c8e8 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 15 Aug 2007 08:23:38 +0000 Subject: [PATCH 171/718] License fix. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4670 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/dump/util.c | 3 ++- prog/dump/util.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/prog/dump/util.c b/prog/dump/util.c index 9a851616..029719e7 100644 --- a/prog/dump/util.c +++ b/prog/dump/util.c @@ -4,7 +4,8 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2. + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. */ #include diff --git a/prog/dump/util.h b/prog/dump/util.h index 608adb62..a179b196 100644 --- a/prog/dump/util.h +++ b/prog/dump/util.h @@ -4,7 +4,8 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2. + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. */ #ifndef _UTIL_H From b52225ffc06fc3d04a8ef2bf03b0d5b4a3750683 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 16 Aug 2007 09:54:53 +0000 Subject: [PATCH 172/718] Drop support for "dummy" bus type. The kernel no longer supports such fake i2c buses, so neither should we. Instead, non-i2c buses are handled explicitly. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4672 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/access.c | 2 -- lib/data.c | 8 +------- lib/sensors.h | 3 +-- lib/sysfs.c | 2 +- prog/sensors/main.c | 3 --- 6 files changed, 4 insertions(+), 15 deletions(-) diff --git a/CHANGES b/CHANGES index 1f96ce99..50c5006b 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ SVN HEAD No longer export sensors_chip_name_has_wildcards() Delete sensors_do_all_sets(), unused Pass structures by reference + Drop support for dummy type Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/access.c b/lib/access.c index fa5544a3..66b6e986 100644 --- a/lib/access.c +++ b/lib/access.c @@ -326,8 +326,6 @@ const char *sensors_get_adapter_name(int bus_nr) return "ISA adapter"; if (bus_nr == SENSORS_CHIP_NAME_BUS_PCI) return "PCI adapter"; - if (bus_nr == SENSORS_CHIP_NAME_BUS_DUMMY) - return "Dummy adapter"; for (i = 0; i < sensors_proc_bus_count; i++) if (sensors_proc_bus[i].number == bus_nr) return sensors_proc_bus[i].adapter; diff --git a/lib/data.c b/lib/data.c index d5e23523..a62ffaa7 100644 --- a/lib/data.c +++ b/lib/data.c @@ -171,10 +171,6 @@ DONE2:; if (part2) *(part2-1) = '-'; *(part3-1) = '-'; - } else if(part3 && part4) { - res->bus = SENSORS_CHIP_NAME_BUS_DUMMY; - if (! (res->busname = strdup(part3))) - sensors_fatal_error("sensors_parse_chip_name","Allocating new busname"); } else goto ERROR; @@ -202,8 +198,7 @@ int sensors_parse_i2cbus_name(const char *name, int *res) return 0; } if (strncmp(name,"i2c-",4)) { - *res = SENSORS_CHIP_NAME_BUS_DUMMY; - return 0; + return -SENSORS_ERR_BUS_NAME; } name += 4; if ((strlen(name) > 3) || (strlen(name) == 0)) @@ -265,7 +260,6 @@ int sensors_substitute_busses(void) for(j = 0; j < chips->fits_count; j++) if ((chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ISA) && (chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_PCI) && - (chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_DUMMY) && (chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ANY) && (chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ANY_I2C)) if ((err = sensors_substitute_chip(chips->fits+j, lineno))) diff --git a/lib/sensors.h b/lib/sensors.h index 966b9d62..5f0e0e87 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -29,7 +29,6 @@ #define SENSORS_CHIP_NAME_BUS_ISA -1 #define SENSORS_CHIP_NAME_BUS_ANY -2 #define SENSORS_CHIP_NAME_BUS_ANY_I2C -3 -#define SENSORS_CHIP_NAME_BUS_DUMMY -4 #define SENSORS_CHIP_NAME_BUS_PCI -5 #define SENSORS_CHIP_NAME_ADDR_ANY -1 @@ -44,7 +43,7 @@ typedef struct sensors_chip_name { char *prefix; int bus; int addr; - char *busname; /* if dummy */ + char *busname; } sensors_chip_name; /* (Re)load the configuration file and the detected chips list. If this diff --git a/lib/sysfs.c b/lib/sysfs.c index 285b671c..dc3ef2bb 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -382,7 +382,7 @@ int sensors_read_sysfs_bus(void) if (!strncmp(entry.adapter, "ISA ", 4)) { entry.number = SENSORS_CHIP_NAME_BUS_ISA; } else if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1) { - entry.number = SENSORS_CHIP_NAME_BUS_DUMMY; + continue; } sensors_add_proc_bus(&entry); diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 9171a056..929db027 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -302,9 +302,6 @@ const char *sprintf_chip_name(const sensors_chip_name *name) snprintf(buf, BUF_SIZE, "%s-isa-%04x", name->prefix, name->addr); else if (name->bus == SENSORS_CHIP_NAME_BUS_PCI) snprintf(buf, BUF_SIZE, "%s-pci-%04x", name->prefix, name->addr); - else if (name->bus == SENSORS_CHIP_NAME_BUS_DUMMY) - snprintf(buf, BUF_SIZE, "%s-%s-%04x", name->prefix, name->busname, - name->addr); else snprintf(buf, BUF_SIZE, "%s-i2c-%d-%02x", name->prefix, name->bus, name->addr); From 8896ba3b1f3ca6c0cd59c34abfe9f8fa67f93956 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 16 Aug 2007 09:56:07 +0000 Subject: [PATCH 173/718] Rename sensors_chip_name.busname to path, as this is what we are using it for by now. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4673 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 2 +- lib/data.c | 3 --- lib/init.c | 2 +- lib/sensors.h | 2 +- lib/sysfs.c | 10 +++++----- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/access.c b/lib/access.c index 66b6e986..5bd6efa6 100644 --- a/lib/access.c +++ b/lib/access.c @@ -170,7 +170,7 @@ int sensors_get_label(const sensors_chip_name *name, int feature, char **result) } /* No user specified label, check for a _label sysfs file */ - snprintf(path, PATH_MAX, "%s/%s_label", name->busname, + snprintf(path, PATH_MAX, "%s/%s_label", name->path, featureptr->data.name); if ((f = fopen(path, "r"))) { diff --git a/lib/data.c b/lib/data.c index a62ffaa7..5bc248b8 100644 --- a/lib/data.c +++ b/lib/data.c @@ -78,9 +78,6 @@ int sensors_parse_chip_name(const char *orig_name, sensors_chip_name *res) char *name = strdup(orig_name); int i; - /* Play it safe */ - res->busname = NULL; - if (! name) sensors_fatal_error("sensors_parse_chip_name","Allocating new name"); /* First split name in upto four pieces. */ diff --git a/lib/init.c b/lib/init.c index ba0b46d5..a9203558 100644 --- a/lib/init.c +++ b/lib/init.c @@ -90,7 +90,7 @@ void sensors_cleanup(void) void free_chip_name(sensors_chip_name *name) { free(name->prefix); - free(name->busname); + free(name->path); } void free_chip_features(sensors_chip_feature *features) diff --git a/lib/sensors.h b/lib/sensors.h index 5f0e0e87..b2a31838 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -43,7 +43,7 @@ typedef struct sensors_chip_name { char *prefix; int bus; int addr; - char *busname; + char *path; } sensors_chip_name; /* (Re)load the configuration file and the detected chips list. If this diff --git a/lib/sysfs.c b/lib/sysfs.c index dc3ef2bb..da5a55a4 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -222,8 +222,8 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) if (!entry.chip.prefix) sensors_fatal_error(__FUNCTION__, "out of memory"); - entry.chip.busname = strdup(dev->path); - if (!entry.chip.busname) + entry.chip.path = strdup(dev->path); + if (!entry.chip.path) sensors_fatal_error(__FUNCTION__, "out of memory"); if (sscanf(dev->name, "%d-%x", &entry.chip.bus, &entry.chip.addr) == 2) { @@ -270,7 +270,7 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) exit_free: free(entry.chip.prefix); - free(entry.chip.busname); + free(entry.chip.path); return err; } @@ -416,7 +416,7 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) suffix = "_input"; - snprintf(n, NAME_MAX, "%s/%s%s", name->busname, the_feature->data.name, + snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->data.name, suffix); if ((f = fopen(n, "r"))) { int res = fscanf(f, "%lf", value); @@ -451,7 +451,7 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) suffix = "_input"; - snprintf(n, NAME_MAX, "%s/%s%s", name->busname, the_feature->data.name, + snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->data.name, suffix); if ((f = fopen(n, "w"))) { for (mag = the_feature->scaling; mag > 0; mag --) From e9fccf7d01dd94a13560f31cac06ef070cf5e11c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 16 Aug 2007 09:57:56 +0000 Subject: [PATCH 174/718] Don't handle the isa bus in sensors_parse_i2cbus_name(). We really don't need to, as there is a single ISA bus, there's no need for substituting anything. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4674 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.c | 4 ---- lib/sysfs.c | 10 ++++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/data.c b/lib/data.c index 5bc248b8..157a3b6b 100644 --- a/lib/data.c +++ b/lib/data.c @@ -190,10 +190,6 @@ int sensors_parse_i2cbus_name(const char *name, int *res) { int i; - if (! strcmp(name,"isa")) { - *res = SENSORS_CHIP_NAME_BUS_ISA; - return 0; - } if (strncmp(name,"i2c-",4)) { return -SENSORS_ERR_BUS_NAME; } diff --git a/lib/sysfs.c b/lib/sysfs.c index da5a55a4..09042b17 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -374,17 +374,15 @@ int sensors_read_sysfs_bus(void) (attr = sysfs_get_device_attr(dev, "name")))) continue; + if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1 || + entry.number == 9191) /* legacy ISA */ + continue; + /* NB: attr->value[attr->len-1] == '\n'; chop that off */ entry.adapter = strndup(attr->value, attr->len - 1); if (!entry.adapter) sensors_fatal_error(__FUNCTION__, "out of memory"); - if (!strncmp(entry.adapter, "ISA ", 4)) { - entry.number = SENSORS_CHIP_NAME_BUS_ISA; - } else if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1) { - continue; - } - sensors_add_proc_bus(&entry); } From 493d9b27f55286a0bbed4c814f87bfa763a4cb34 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 16 Aug 2007 09:58:44 +0000 Subject: [PATCH 175/718] Use strtoul() instead of parsing integers on our own. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4675 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.c | 61 ++++++++---------------------------------------------- 1 file changed, 9 insertions(+), 52 deletions(-) diff --git a/lib/data.c b/lib/data.c index 157a3b6b..8d43e605 100644 --- a/lib/data.c +++ b/lib/data.c @@ -76,7 +76,7 @@ int sensors_parse_chip_name(const char *orig_name, sensors_chip_name *res) { char *part2, *part3, *part4; char *name = strdup(orig_name); - int i; + char *endptr; if (! name) sensors_fatal_error("sensors_parse_chip_name","Allocating new name"); @@ -103,28 +103,9 @@ int sensors_parse_chip_name(const char *orig_name, sensors_chip_name *res) if (!strcmp(part4,"*")) res->addr = SENSORS_CHIP_NAME_ADDR_ANY; else { - if ((strlen(part4) > 4) || (strlen(part4) == 0)) + res->addr = strtoul(part4, &endptr, 16); + if (*part4 == '\0' || *endptr != '\0' || res->addr < 0) goto ERROR; - res->addr = 0; - for (i = 0; ; i++) { - switch (part4[i]) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - res->addr = res->addr * 16 + part4[i] - '0'; - break; - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - res->addr = res->addr * 16 + part4[i] - 'a' + 10; - break; - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - res->addr = res->addr * 16 + part4[i] - 'A' + 10; - break; - case 0: - goto DONE; - default: - goto ERROR; - } - } -DONE:; } /* OK. So let's look at part3. It must either be the number of the @@ -147,22 +128,9 @@ DONE:; } else if (part2 && !strcmp(part2,"i2c") && !strcmp(part3,"*")) res->bus = SENSORS_CHIP_NAME_BUS_ANY_I2C; else if (part2 && !strcmp(part2,"i2c")) { - if ((strlen(part3) > 3) || (strlen(part3) == 0)) + res->bus = strtoul(part3, &endptr, 10); + if (*part3 == '\0' || *endptr != '\0' || res->bus < 0) goto ERROR; - res->bus = 0; - for (i = 0; ; i++) { - switch (part3[i]) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - res->bus = res->bus * 10 + part3[i] - '0'; - break; - case 0: - goto DONE2; - default: - goto ERROR; - } - } -DONE2:; } else if (res->addr == SENSORS_CHIP_NAME_ADDR_ANY) { res->bus = SENSORS_CHIP_NAME_BUS_ANY; if (part2) @@ -188,27 +156,16 @@ ERROR: int sensors_parse_i2cbus_name(const char *name, int *res) { - int i; + char *endptr; if (strncmp(name,"i2c-",4)) { return -SENSORS_ERR_BUS_NAME; } name += 4; - if ((strlen(name) > 3) || (strlen(name) == 0)) + *res = strtoul(name, &endptr, 10); + if (*name == '\0' || *endptr != '\0' || *res < 0) return -SENSORS_ERR_BUS_NAME; - *res = 0; - for (i = 0; ; i++) { - switch (name[i]) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - *res = *res * 10 + name[i] - '0'; - break; - case 0: - return 0; - default: - return -SENSORS_ERR_BUS_NAME; - } - } + return 0; } From edb42b3c1648eac51ed269b1ddcab5436897d526 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 16 Aug 2007 10:04:57 +0000 Subject: [PATCH 176/718] Add a new function to libsensors doing the opposite of sensors_parse_chip_name(). sensors_snprintf_chip_name() converts a chip name from its internal representation to a human readable string. So far, each user program had to reimplement this function. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4676 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/access.c | 2 +- lib/access.h | 5 +++++ lib/data.c | 20 ++++++++++++++++++++ lib/sensors.h | 6 ++++++ prog/sensord/sense.c | 8 ++------ prog/sensors/main.c | 9 ++------- 7 files changed, 37 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index 50c5006b..a2835946 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,7 @@ SVN HEAD Delete sensors_do_all_sets(), unused Pass structures by reference Drop support for dummy type + New function sensors_snprintf_chip_name() Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/access.c b/lib/access.c index 5bd6efa6..d90ef428 100644 --- a/lib/access.c +++ b/lib/access.c @@ -133,7 +133,7 @@ sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) /* Check whether the chip name is an 'absolute' name, which can only match one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 if there are wildcards. */ -static int sensors_chip_name_has_wildcards(const sensors_chip_name *chip) +int sensors_chip_name_has_wildcards(const sensors_chip_name *chip) { if ((chip->prefix == SENSORS_CHIP_NAME_PREFIX_ANY) || (chip->bus == SENSORS_CHIP_NAME_BUS_ANY) || diff --git a/lib/access.h b/lib/access.h index 0298ae54..b5639246 100644 --- a/lib/access.h +++ b/lib/access.h @@ -29,6 +29,11 @@ extern const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature); +/* Check whether the chip name is an 'absolute' name, which can only match + one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 + if there are wildcards. */ +int sensors_chip_name_has_wildcards(const sensors_chip_name *chip); + sensors_feature_type sensors_feature_get_type(const char *name, int *nr); #endif /* def LIB_SENSORS_ACCESS_H */ diff --git a/lib/data.c b/lib/data.c index 8d43e605..1a3c2dff 100644 --- a/lib/data.c +++ b/lib/data.c @@ -20,6 +20,7 @@ #include #include +#include "access.h" #include "error.h" #include "data.h" #include "sensors.h" @@ -154,6 +155,25 @@ ERROR: return -SENSORS_ERR_CHIP_NAME; } +int sensors_snprintf_chip_name(char *str, size_t size, + const sensors_chip_name *chip) +{ + if (sensors_chip_name_has_wildcards(chip)) + return -SENSORS_ERR_WILDCARDS; + + switch (chip->bus) { + case SENSORS_CHIP_NAME_BUS_ISA: + return snprintf(str, size, "%s-isa-%04x", chip->prefix, + chip->addr); + case SENSORS_CHIP_NAME_BUS_PCI: + return snprintf(str, size, "%s-pci-%04x", chip->prefix, + chip->addr); + default: + return snprintf(str, size, "%s-i2c-%d-%02x", chip->prefix, + chip->bus, chip->addr); + } +} + int sensors_parse_i2cbus_name(const char *name, int *res) { char *endptr; diff --git a/lib/sensors.h b/lib/sensors.h index b2a31838..2a691892 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -60,6 +60,12 @@ extern void sensors_cleanup(void); extern int sensors_parse_chip_name(const char *orig_name, sensors_chip_name *res); +/* Print a chip name from its internal representation. Note that chip should + not contain wildcard values! Return the number of characters printed on + success (same as snprintf), <0 on error. */ +int sensors_snprintf_chip_name(char *str, size_t size, + const sensors_chip_name *chip); + /* Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. */ extern int sensors_match_chip(const sensors_chip_name *chip1, diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index 701dd03b..bf7f5695 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -74,12 +74,8 @@ static const char * chipName (const sensors_chip_name *chip) { static char buffer[256]; - if (chip->bus == SENSORS_CHIP_NAME_BUS_ISA) - sprintf (buffer, "%s-isa-%04x", chip->prefix, chip->addr); - else if (chip->bus == SENSORS_CHIP_NAME_BUS_PCI) - sprintf (buffer, "%s-pci-%04x", chip->prefix, chip->addr); - else - sprintf (buffer, "%s-i2c-%d-%02x", chip->prefix, chip->bus, chip->addr); + if (sensors_snprintf_chip_name(buffer, 256, chip) < 0) + return NULL; return buffer; } diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 929db027..6da5e391 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -298,13 +298,8 @@ const char *sprintf_chip_name(const sensors_chip_name *name) #define BUF_SIZE 200 static char buf[BUF_SIZE]; - if (name->bus == SENSORS_CHIP_NAME_BUS_ISA) - snprintf(buf, BUF_SIZE, "%s-isa-%04x", name->prefix, name->addr); - else if (name->bus == SENSORS_CHIP_NAME_BUS_PCI) - snprintf(buf, BUF_SIZE, "%s-pci-%04x", name->prefix, name->addr); - else - snprintf(buf, BUF_SIZE, "%s-i2c-%d-%02x", name->prefix, name->bus, - name->addr); + if (sensors_snprintf_chip_name(buf, BUF_SIZE, name) < 0) + return NULL; return buf; } From f430b0991a8c776673707ad4ce3ee8c74eed5880 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 16 Aug 2007 10:06:35 +0000 Subject: [PATCH 177/718] Chip types can no longer contain dashes. This makes it possible to rewrite sensors_parse_chip_name() with a simpler algorithm. The new code is smaller by about one third, and twice as fast on average (5 times as fast in the most frequent case "foo-*".) This closes ticket #2221. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4677 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/data.c | 150 ++++++++++++++++++++------------------------- lib/sensors.conf.5 | 16 ++--- 3 files changed, 74 insertions(+), 93 deletions(-) diff --git a/CHANGES b/CHANGES index a2835946..b2e4c197 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,7 @@ SVN HEAD Pass structures by reference Drop support for dummy type New function sensors_snprintf_chip_name() + Drop support for dashes in chip names Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/data.c b/lib/data.c index 1a3c2dff..8c545634 100644 --- a/lib/data.c +++ b/lib/data.c @@ -1,6 +1,7 @@ /* data.c - Part of libsensors, a Linux library for reading sensor data. Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +18,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* this define needed for strndup() */ +#define _GNU_SOURCE + #include #include @@ -46,8 +50,8 @@ int sensors_proc_bus_max = 0; static int sensors_substitute_chip(sensors_chip_name *name,int lineno); -/* Wow, this must be one of the ugliest functions I have ever written. - The idea is that it parses a chip name. These are valid names: +/* + Parse a chip name to the internal representation. These are valid names: lm78-i2c-10-5e *-i2c-10-5e lm78-i2c-10-* *-i2c-10-* @@ -56,103 +60,85 @@ static int sensors_substitute_chip(sensors_chip_name *name,int lineno); lm78-isa-10dd *-isa-10dd lm78-isa-* *-isa-* lm78-* *-* - * - Here 'lm78' can be any prefix. To complicate matters, such a prefix - can also contain dashes (like lm78-j, for example!). 'i2c' and 'isa' are + + Here 'lm78' can be any prefix. 'i2c' and 'isa' are literal strings, just like all dashes '-' and wildcards '*'. '10' can be any decimal i2c bus number. '5e' can be any hexadecimal i2c device address, and '10dd' any hexadecimal isa address. - If '*' is used in prefixes, together with dashes, ambigious parses are - introduced. In that case, the prefix is kept as small as possible. - The 'prefix' part in the result is freshly allocated. All old contents of res is overwritten. res itself is not allocated. In case of an error return (ie. != 0), res is undefined, but all allocations are undone. - - Don't tell me there are bugs in here, because I'll start screaming :-) */ -int sensors_parse_chip_name(const char *orig_name, sensors_chip_name *res) +int sensors_parse_chip_name(const char *name, sensors_chip_name *res) { - char *part2, *part3, *part4; - char *name = strdup(orig_name); - char *endptr; + char *dash; - if (! name) - sensors_fatal_error("sensors_parse_chip_name","Allocating new name"); - /* First split name in upto four pieces. */ - if ((part4 = strrchr(name,'-'))) - *part4++ = '\0'; - if ((part3 = strrchr(name,'-'))) - *part3++ = '\0'; - if ((part2 = strrchr(name,'-'))) - *part2++ = '\0'; + /* First, the prefix. It's either "*" or a real chip name. */ + if (!strncmp(name, "*-", 2)) { + res->prefix = SENSORS_CHIP_NAME_PREFIX_ANY; + name += 2; + } else { + if (!(dash = strchr(name, '-'))) + return -SENSORS_ERR_CHIP_NAME; + res->prefix = strndup(name, dash - name); + if (!res->prefix) + sensors_fatal_error("sensors_parse_chip_name", + "Allocating name prefix"); + name = dash + 1; + } - /* No dashes found? */ - if (! part4) { - if (!strcmp(name,"*")) { - res->prefix = SENSORS_CHIP_NAME_PREFIX_ANY; - res->bus = SENSORS_CHIP_NAME_BUS_ANY; - res->addr = SENSORS_CHIP_NAME_ADDR_ANY; - goto SUCCES; - } else - goto ERROR; - } + /* Then we have either a sole "*" (all chips with this name) or a bus + type and an address. */ + if (!strcmp(name, "*")) { + res->bus = SENSORS_CHIP_NAME_BUS_ANY; + res->addr = SENSORS_CHIP_NAME_ADDR_ANY; + return 0; + } - /* At least one dash found. Now part4 is either '*', or an address */ - if (!strcmp(part4,"*")) - res->addr = SENSORS_CHIP_NAME_ADDR_ANY; - else { - res->addr = strtoul(part4, &endptr, 16); - if (*part4 == '\0' || *endptr != '\0' || res->addr < 0) - goto ERROR; - } + if (!(dash = strchr(name, '-'))) + goto ERROR; + if (!strncmp(name, "i2c", dash - name)) + res->bus = SENSORS_CHIP_NAME_BUS_ANY_I2C; + else if (!strncmp(name, "isa", dash - name)) + res->bus = SENSORS_CHIP_NAME_BUS_ISA; + else if (!strncmp(name, "pci", dash - name)) + res->bus = SENSORS_CHIP_NAME_BUS_PCI; + else + goto ERROR; + name = dash + 1; - /* OK. So let's look at part3. It must either be the number of the - i2c bus (and then part2 *must* be "i2c"), or it must be "isa", - or, if part4 was "*", it belongs to 'prefix'. Or no second dash - was found at all, of course. */ - if (! part3) { - if (res->addr == SENSORS_CHIP_NAME_ADDR_ANY) { - res->bus = SENSORS_CHIP_NAME_BUS_ANY; - } else - goto ERROR; - } else if (!strcmp(part3,"isa")) { - res->bus = SENSORS_CHIP_NAME_BUS_ISA; - if (part2) - *(part2-1) = '-'; - } else if (!strcmp(part3,"pci")) { - res->bus = SENSORS_CHIP_NAME_BUS_PCI; - if (part2) - *(part2-1) = '-'; - } else if (part2 && !strcmp(part2,"i2c") && !strcmp(part3,"*")) - res->bus = SENSORS_CHIP_NAME_BUS_ANY_I2C; - else if (part2 && !strcmp(part2,"i2c")) { - res->bus = strtoul(part3, &endptr, 10); - if (*part3 == '\0' || *endptr != '\0' || res->bus < 0) - goto ERROR; - } else if (res->addr == SENSORS_CHIP_NAME_ADDR_ANY) { - res->bus = SENSORS_CHIP_NAME_BUS_ANY; - if (part2) - *(part2-1) = '-'; - *(part3-1) = '-'; - } else - goto ERROR; - - if (!strcmp(name,"*")) - res->prefix = SENSORS_CHIP_NAME_PREFIX_ANY; - else if (! (res->prefix = strdup(name))) - sensors_fatal_error("sensors_parse_chip_name","Allocating new name"); - goto SUCCES; + /* Some bus types (i2c) have an additional bus number. For these, the + next part is either a "*" (any bus of that type) or a decimal + number. */ + switch (res->bus) { + case SENSORS_CHIP_NAME_BUS_ANY_I2C: + if (!strncmp(name, "*-", 2)) { + name += 2; + break; + } -SUCCES: - free(name); - return 0; + res->bus = strtoul(name, &dash, 10); + if (*name == '\0' || *dash != '-' || res->bus < 0) + goto ERROR; + name = dash + 1; + } + + /* Last part is the chip address, or "*" for any address. */ + if (!strcmp(name, "*")) { + res->addr = SENSORS_CHIP_NAME_ADDR_ANY; + } else { + res->addr = strtoul(name, &dash, 16); + if (*name == '\0' || *dash != '\0' || res->addr < 0) + goto ERROR; + } + + return 0; ERROR: - free(name); - return -SENSORS_ERR_CHIP_NAME; + free(res->prefix); + return -SENSORS_ERR_CHIP_NAME; } int sensors_snprintf_chip_name(char *str, size_t size, diff --git a/lib/sensors.conf.5 b/lib/sensors.conf.5 index 776b4067..f1a14a0a 100644 --- a/lib/sensors.conf.5 +++ b/lib/sensors.conf.5 @@ -186,9 +186,7 @@ statement is ignored upto the next statement. A chip description is built from a couple of elements, separated by -dashes. To complicate matters, sometimes an element can also contain -dashes. This complicates the parsing algorithm, but is not too confusing -for humans (we hope!). +dashes. The first element is the name of the chip type. Sometimes a single driver implements several chip types, with several names. The driver documentation @@ -216,10 +214,10 @@ the wildcard operator .I * for this element. -There are some folding rules for wildcards to make things easier for humans -to read. Also, you can't specify the address if you wildcard the complete -second element. The following are all valid chip type specification based -on +Note that it wouldn't make any sense to specify the address without the +bus type. For this reason, the address part is plain omitted when the bus +type isn't specified. +The following are all valid chip type specification based on .I lm78\-i2c\-1\-2d or .IR lm78\-isa\-0290 : @@ -250,10 +248,6 @@ lm78\-* *\-isa\-0290 .sp 0 *\-isa\-* -.sp 0 -*\-* -.sp 0 -* .RE .SS COMPUTE STATEMENT From da7fbf5b70f66bb6a72ad373a6623736889d6666 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 16 Aug 2007 16:18:18 +0000 Subject: [PATCH 178/718] Reindent and cleanup. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4678 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.c | 97 +++++++++++++++++++------------------- lib/sensors.h | 128 +++++++++++++++++++++++++------------------------- 2 files changed, 111 insertions(+), 114 deletions(-) diff --git a/lib/data.c b/lib/data.c index 8c545634..925a2416 100644 --- a/lib/data.c +++ b/lib/data.c @@ -162,64 +162,63 @@ int sensors_snprintf_chip_name(char *str, size_t size, int sensors_parse_i2cbus_name(const char *name, int *res) { - char *endptr; + char *endptr; - if (strncmp(name,"i2c-",4)) { - return -SENSORS_ERR_BUS_NAME; - } - name += 4; - *res = strtoul(name, &endptr, 10); - if (*name == '\0' || *endptr != '\0' || *res < 0) - return -SENSORS_ERR_BUS_NAME; - return 0; + if (strncmp(name, "i2c-", 4)) { + return -SENSORS_ERR_BUS_NAME; + } + name += 4; + *res = strtoul(name, &endptr, 10); + if (*name == '\0' || *endptr != '\0' || *res < 0) + return -SENSORS_ERR_BUS_NAME; + return 0; } - -int sensors_substitute_chip(sensors_chip_name *name,int lineno) +int sensors_substitute_chip(sensors_chip_name *name, int lineno) { - int i,j; - for (i = 0; i < sensors_config_busses_count; i++) - if (sensors_config_busses[i].number == name->bus) - break; + int i, j; + for (i = 0; i < sensors_config_busses_count; i++) + if (sensors_config_busses[i].number == name->bus) + break; - if (i == sensors_config_busses_count) { - sensors_parse_error("Undeclared i2c bus referenced",lineno); - name->bus = sensors_proc_bus_count; - return -SENSORS_ERR_BUS_NAME; - } + if (i == sensors_config_busses_count) { + sensors_parse_error("Undeclared i2c bus referenced", lineno); + name->bus = sensors_proc_bus_count; + return -SENSORS_ERR_BUS_NAME; + } - /* Compare the adapter names */ - for (j = 0; j < sensors_proc_bus_count; j++) { - if (!strcmp(sensors_config_busses[i].adapter, - sensors_proc_bus[j].adapter)) { - name->bus = sensors_proc_bus[j].number; - return 0; - } - } + /* Compare the adapter names */ + for (j = 0; j < sensors_proc_bus_count; j++) { + if (!strcmp(sensors_config_busses[i].adapter, + sensors_proc_bus[j].adapter)) { + name->bus = sensors_proc_bus[j].number; + return 0; + } + } - /* We did not find anything. sensors_proc_bus_count is not a valid - bus number, so it will never be matched. Good. */ - name->bus = sensors_proc_bus_count; - return 0; + /* We did not find anything. sensors_proc_bus_count is not + a valid bus number, so it will never be matched. Good. */ + name->bus = sensors_proc_bus_count; + return 0; } - int sensors_substitute_busses(void) { - int err,i,j,lineno; - sensors_chip_name_list *chips; - int res=0; - - for(i = 0; i < sensors_config_chips_count; i++) { - lineno = sensors_config_chips[i].lineno; - chips = &sensors_config_chips[i].chips; - for(j = 0; j < chips->fits_count; j++) - if ((chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ISA) && - (chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_PCI) && - (chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ANY) && - (chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ANY_I2C)) - if ((err = sensors_substitute_chip(chips->fits+j, lineno))) - res = err; - } - return res; + int err, i, j, lineno; + sensors_chip_name_list *chips; + int res = 0; + + for (i = 0; i < sensors_config_chips_count; i++) { + lineno = sensors_config_chips[i].lineno; + chips = &sensors_config_chips[i].chips; + for (j = 0; j < chips->fits_count; j++) + if (chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ISA && + chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_PCI && + chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ANY && + chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ANY_I2C) + if ((err = sensors_substitute_chip(chips->fits+j, + lineno))) + res = err; + } + return res; } diff --git a/lib/sensors.h b/lib/sensors.h index 2a691892..a0850f4a 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -38,27 +38,26 @@ extern "C" { extern const char *libsensors_version; -/* A chip name is encoded is in this structure */ +/* A chip name is encoded in this structure */ typedef struct sensors_chip_name { - char *prefix; - int bus; - int addr; - char *path; + char *prefix; + int bus; + int addr; + char *path; } sensors_chip_name; -/* (Re)load the configuration file and the detected chips list. If this +/* (Re)load the configuration file and the detected chips list. If this returns a value unequal to zero, you are in trouble; you can not assume anything will be initialized properly. */ -extern int sensors_init(FILE *input); +int sensors_init(FILE *input); /* Clean-up function: You can't access anything after this, until the next sensors_init() call! */ -extern void sensors_cleanup(void); +void sensors_cleanup(void); -/* Parse a chip name to the internal representation. Return 0 on succes, <0 +/* Parse a chip name to the internal representation. Return 0 on success, <0 on error. */ -extern int sensors_parse_chip_name(const char *orig_name, - sensors_chip_name *res); +int sensors_parse_chip_name(const char *orig_name, sensors_chip_name *res); /* Print a chip name from its internal representation. Note that chip should not contain wildcard values! Return the number of characters printed on @@ -68,43 +67,42 @@ int sensors_snprintf_chip_name(char *str, size_t size, /* Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. */ -extern int sensors_match_chip(const sensors_chip_name *chip1, - const sensors_chip_name *chip2); +int sensors_match_chip(const sensors_chip_name *chip1, + const sensors_chip_name *chip2); /* This function returns the adapter name of a bus number, - as used within the sensors_chip_name structure. If it could not be found, + as used within the sensors_chip_name structure. If it could not be found, it returns NULL */ -extern const char *sensors_get_adapter_name(int bus_nr); +const char *sensors_get_adapter_name(int bus_nr); /* Look up the label which belongs to this chip. Note that chip should not contain wildcard values! *result is newly allocated (free it yourself). This function will return 0 on success, and <0 on failure. This function takes logical mappings into account. */ -extern int sensors_get_label(const sensors_chip_name *name, int feature, - char **result); +int sensors_get_label(const sensors_chip_name *name, int feature, + char **result); /* Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -extern int sensors_get_feature(const sensors_chip_name *name, int feature, - double *result); +int sensors_get_feature(const sensors_chip_name *name, int feature, + double *result); /* Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -extern int sensors_set_feature(const sensors_chip_name *name, int feature, - double value); +int sensors_set_feature(const sensors_chip_name *name, int feature, + double value); /* Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. */ -extern int sensors_do_chip_sets(const sensors_chip_name *name); +int sensors_do_chip_sets(const sensors_chip_name *name); /* This function returns all detected chips, one by one. To start at the beginning of the list, use 0 for nr; NULL is returned if we are - at the end of the list. Do not try to change these chip names, as + at the end of the list. Do not try to change these chip names, as they point to internal structures! Do not use nr for anything else. */ -extern const sensors_chip_name *sensors_get_detected_chips(int *nr); - +const sensors_chip_name *sensors_get_detected_chips(int *nr); /* These defines are used in the mode field of sensors_feature_data */ #define SENSORS_MODE_NO_RW 0 @@ -121,50 +119,50 @@ extern const sensors_chip_name *sensors_get_detected_chips(int *nr); 0x100 apart, and sensor features which should not have a compute_mapping to the _input feature start at 0x?10. */ typedef enum sensors_feature_type { - SENSORS_FEATURE_IN = 0x000, - SENSORS_FEATURE_IN_MIN, - SENSORS_FEATURE_IN_MAX, - SENSORS_FEATURE_IN_ALARM = 0x010, - SENSORS_FEATURE_IN_MIN_ALARM, - SENSORS_FEATURE_IN_MAX_ALARM, - - SENSORS_FEATURE_FAN = 0x100, - SENSORS_FEATURE_FAN_MIN, - SENSORS_FEATURE_FAN_ALARM = 0x110, - SENSORS_FEATURE_FAN_FAULT, - SENSORS_FEATURE_FAN_DIV, - - SENSORS_FEATURE_TEMP = 0x200, - SENSORS_FEATURE_TEMP_MAX, - SENSORS_FEATURE_TEMP_MAX_HYST, - SENSORS_FEATURE_TEMP_MIN, - SENSORS_FEATURE_TEMP_CRIT, - SENSORS_FEATURE_TEMP_CRIT_HYST, - SENSORS_FEATURE_TEMP_ALARM = 0x210, - SENSORS_FEATURE_TEMP_MAX_ALARM, - SENSORS_FEATURE_TEMP_MIN_ALARM, - SENSORS_FEATURE_TEMP_CRIT_ALARM, - SENSORS_FEATURE_TEMP_FAULT, - SENSORS_FEATURE_TEMP_SENS, - - SENSORS_FEATURE_VID = 0x300, - - SENSORS_FEATURE_UNKNOWN = INT_MAX, - - /* special the largest number of subfeatures used, iow the - highest ## from all the 0x?## above + 1*/ - SENSORS_FEATURE_MAX_SUB_FEATURES = 22 + SENSORS_FEATURE_IN = 0x000, + SENSORS_FEATURE_IN_MIN, + SENSORS_FEATURE_IN_MAX, + SENSORS_FEATURE_IN_ALARM = 0x010, + SENSORS_FEATURE_IN_MIN_ALARM, + SENSORS_FEATURE_IN_MAX_ALARM, + + SENSORS_FEATURE_FAN = 0x100, + SENSORS_FEATURE_FAN_MIN, + SENSORS_FEATURE_FAN_ALARM = 0x110, + SENSORS_FEATURE_FAN_FAULT, + SENSORS_FEATURE_FAN_DIV, + + SENSORS_FEATURE_TEMP = 0x200, + SENSORS_FEATURE_TEMP_MAX, + SENSORS_FEATURE_TEMP_MAX_HYST, + SENSORS_FEATURE_TEMP_MIN, + SENSORS_FEATURE_TEMP_CRIT, + SENSORS_FEATURE_TEMP_CRIT_HYST, + SENSORS_FEATURE_TEMP_ALARM = 0x210, + SENSORS_FEATURE_TEMP_MAX_ALARM, + SENSORS_FEATURE_TEMP_MIN_ALARM, + SENSORS_FEATURE_TEMP_CRIT_ALARM, + SENSORS_FEATURE_TEMP_FAULT, + SENSORS_FEATURE_TEMP_SENS, + + SENSORS_FEATURE_VID = 0x300, + + SENSORS_FEATURE_UNKNOWN = INT_MAX, + + /* special the largest number of subfeatures used, iow the + highest ## from all the 0x?## above + 1*/ + SENSORS_FEATURE_MAX_SUB_FEATURES = 22 } sensors_feature_type; /* This structure is used when you want to get all features of a specific chip. */ typedef struct sensors_feature_data { - int number; - char *name; - sensors_feature_type type; - int mapping; - int compute_mapping; - int mode; + int number; + char *name; + sensors_feature_type type; + int mapping; + int compute_mapping; + int mode; } sensors_feature_data; /* This returns all features of a specific chip. They are returned in @@ -175,7 +173,7 @@ typedef struct sensors_feature_data { begin of the list. If no more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. */ -extern const sensors_feature_data *sensors_get_all_features +const sensors_feature_data *sensors_get_all_features (const sensors_chip_name *name, int *nr); #ifdef __cplusplus From 557feb269601a9328426c8c91148c41623c059c2 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 17 Aug 2007 11:36:01 +0000 Subject: [PATCH 179/718] Fix error message when a chip is specified on the command line with no prefix and that chip isn't found. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4681 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 6da5e391..6cba537f 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -237,7 +237,7 @@ int main (int argc, char *argv[]) sensors_cleanup(); exit(error); } else { - if(chips[0].prefix == SENSORS_CHIP_NAME_PREFIX_ANY) + if (optind == argc) /* No chip name on command line */ fprintf(stderr, "No sensors found!\n" "Make sure you loaded all the kernel drivers you need.\n" From 4695755d89dc1167abaad7af219b05bf27202b47 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 17 Aug 2007 21:11:57 +0000 Subject: [PATCH 180/718] Drop unneeded frees. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4682 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips_generic.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 2d2058f8..137850fc 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -99,7 +99,6 @@ static void print_generic_chip_temp(const sensors_chip_name *name, double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0.0, }; if (sensors_get_label(name, feature->number, &label)) { - free(label); printf("ERROR: Can't get temperature label!\n"); return; } @@ -213,7 +212,6 @@ static void print_generic_chip_in(const sensors_chip_name *name, char *label; if (sensors_get_label(name, feature->number, &label)) { - free(label); printf("ERROR: Can't get in label!\n"); return; } @@ -277,7 +275,6 @@ static void print_generic_chip_fan(const sensors_chip_name *name, if (sensors_get_label(name, feature->number, &label)) { printf("ERROR: Can't get fan label!\n"); - free(label); return; } From de4eca1ff707697f9b9e1a7da78f9ec873e58be6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 18 Aug 2007 06:58:33 +0000 Subject: [PATCH 181/718] Fix a broken comment. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4684 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sensors.h b/lib/sensors.h index a0850f4a..a692d5da 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -77,8 +77,8 @@ const char *sensors_get_adapter_name(int bus_nr); /* Look up the label which belongs to this chip. Note that chip should not contain wildcard values! *result is newly allocated (free it yourself). - This function will return 0 on success, and <0 on failure. This - function takes logical mappings into account. */ + This function will return 0 on success, and <0 on failure. + If no label exists for this feature, its name is returned itself. */ int sensors_get_label(const sensors_chip_name *name, int feature, char **result); From af2880326faf80d71fb303ed4124b7f3c4c2e389 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 19 Aug 2007 14:18:52 +0000 Subject: [PATCH 182/718] Drop chip names including dashes, as these are no longer supported. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4685 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 80 +++------------------------------------------ 1 file changed, 4 insertions(+), 76 deletions(-) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 434b747c..6994cc14 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -33,9 +33,9 @@ # ---------- # A 'chip' line specifies what the following 'label', 'compute', 'set' and # 'ignore' lines refer to. In this case, until the -# next 'chip' line, everything refers to all lm78, lm78-j and lm79 +# next 'chip' line, everything refers to all lm78 and lm79 # chips. Other examples are *-isa-* for everything on the ISA bus, and -# lm78-j-i2c-*-4e for all lm78-j chips on address 0x4e of any I2C bus. +# lm78-i2c-*-4e for all lm78 chips on address 0x4e of any I2C bus. # # If more chip statements match a specific chip, they are all considered. # Later lines overrule earlier lines, so if you set the in0 label for @@ -43,7 +43,7 @@ # "That" is used for LM78 chips on the ISA bus, and "This" for LM78 # chips on a non-ISA bus. # -# chip "lm78-*" "lm78-j-*" "lm79-*" +# chip "lm78-*" "lm79-*" # # # FEATURE NAMES @@ -274,7 +274,7 @@ #### Here begins the real configuration file -chip "lm78-*" "lm78-j-*" "lm79-*" "w83781d-*" +chip "lm78-*" "lm79-*" "w83781d-*" # These are as advised in the LM78 and LM79 data sheets, and used on almost # any mainboard we have seen. @@ -1053,78 +1053,6 @@ chip "lm80-*" # set temp_os_max 62 -chip "maxilife-cg-*" "maxilife-co-*" "maxilife-as-*" - - label fan1 "HDD Fan" - label fan2 "PCI Fan" - label fan3 "CPU Fan" - ignore fan4 - - label temp2 "PCI Temp" - label temp4 "HDD Temp" - label temp5 "CPU Temp" - ignore temp6 - - label vid1 "V+12" - ignore vid5 - -# vid1 need to be scaled by 6.337 other voltages -# require no scaling - - compute vid1 6.337*@ , @/6.337 - - -chip "maxilife-cg-*" - - ignore temp1 - label temp3 "BX Temp" - - label vid2 "Vcpu1" - label vid3 "Vcpu2" - ignore vid4 - - -chip "maxilife-co-*" - - label temp1 "CPU 1 Temp" - label temp3 "CPU 2 Temp" - - label vid2 "Vcpu1" - label vid3 "Vcpu2" - label vid4 "VcacheL2" - - -chip "maxilife-as-*" - - ignore temp1 - ignore temp3 - - label vid2 "Vcpu" - ignore vid3 - ignore vid4 - - -chip "maxilife-nba-*" - - label fan1 "CPU Fan" - label fan2 "PCI Fan" - label fan3 "HDD Fan" - label fan4 "Heat Sink Fan" - - label temp1 "CPU 1 Temp" - label temp2 "CPU 2 Temp" - label temp3 "PCI/Ambient Temp" - label temp4 "HDD Temp" - label temp5 "Motherboard Temp" - label temp6 "CPU Reference Temp" - - label vid1 "V+12" - label vid2 "Vcpu1" - label vid3 "Vcpu2" - label vid4 "VcacheL2" - label vid5 "V-12" - - chip "via686a-*" # VIA is very specific about the voltage sensor inputs, and our labels From 7ee15371dfd3354b296e9636614d9d0c014a964c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 19 Aug 2007 15:03:50 +0000 Subject: [PATCH 183/718] Support more bus types (part 1 of 2). Originally libsensors was very i2c-centric. Make it more neutral so that we can cleanly support additional bus types such as SPI or One-Wire. This first part introduces sensors_bus_id, and updates sensors_chip_name to use it. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4686 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 41 +++++++++++++++--------------- lib/data.c | 62 ++++++++++++++++++++++++++------------------- lib/sensors.h | 22 +++++++++++----- lib/sysfs.c | 24 +++++++++++------- prog/sensord/args.c | 3 ++- prog/sensors/main.c | 7 ++--- 6 files changed, 92 insertions(+), 67 deletions(-) diff --git a/lib/access.c b/lib/access.c index d90ef428..7b0a4b10 100644 --- a/lib/access.c +++ b/lib/access.c @@ -1,6 +1,7 @@ /* access.c - Part of libsensors, a Linux library for reading sensor data. Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,22 +42,15 @@ int sensors_match_chip(const sensors_chip_name *chip1, strcasecmp(chip1->prefix, chip2->prefix)) return 0; - if ((chip1->bus != SENSORS_CHIP_NAME_BUS_ANY) && - (chip2->bus != SENSORS_CHIP_NAME_BUS_ANY) && - (chip1->bus != chip2->bus)) { + if ((chip1->bus.type != SENSORS_BUS_TYPE_ANY) && + (chip2->bus.type != SENSORS_BUS_TYPE_ANY) && + (chip1->bus.type != chip2->bus.type)) + return 0; - if ((chip1->bus == SENSORS_CHIP_NAME_BUS_ISA) || - (chip2->bus == SENSORS_CHIP_NAME_BUS_ISA)) - return 0; - - if ((chip1->bus == SENSORS_CHIP_NAME_BUS_PCI) || - (chip2->bus == SENSORS_CHIP_NAME_BUS_PCI)) - return 0; - - if ((chip1->bus != SENSORS_CHIP_NAME_BUS_ANY_I2C) && - (chip2->bus != SENSORS_CHIP_NAME_BUS_ANY_I2C)) - return 0; - } + if ((chip1->bus.nr != SENSORS_BUS_NR_ANY) && + (chip2->bus.nr != SENSORS_BUS_NR_ANY) && + (chip1->bus.nr != chip2->bus.nr)) + return 0; if ((chip1->addr != chip2->addr) && (chip1->addr != SENSORS_CHIP_NAME_ADDR_ANY) && @@ -136,8 +130,8 @@ sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) int sensors_chip_name_has_wildcards(const sensors_chip_name *chip) { if ((chip->prefix == SENSORS_CHIP_NAME_PREFIX_ANY) || - (chip->bus == SENSORS_CHIP_NAME_BUS_ANY) || - (chip->bus == SENSORS_CHIP_NAME_BUS_ANY_I2C) || + (chip->bus.type == SENSORS_BUS_TYPE_ANY) || + (chip->bus.nr == SENSORS_BUS_NR_ANY) || (chip->addr == SENSORS_CHIP_NAME_ADDR_ANY)) return 1; else @@ -318,16 +312,21 @@ const sensors_chip_name *sensors_get_detected_chips(int *nr) return res; } -const char *sensors_get_adapter_name(int bus_nr) +const char *sensors_get_adapter_name(const sensors_bus_id *bus) { int i; - if (bus_nr == SENSORS_CHIP_NAME_BUS_ISA) + /* bus types with a single instance */ + switch (bus->type) { + case SENSORS_BUS_TYPE_ISA: return "ISA adapter"; - if (bus_nr == SENSORS_CHIP_NAME_BUS_PCI) + case SENSORS_BUS_TYPE_PCI: return "PCI adapter"; + } + + /* bus types with several instances */ for (i = 0; i < sensors_proc_bus_count; i++) - if (sensors_proc_bus[i].number == bus_nr) + if (sensors_proc_bus[i].number == bus->nr) return sensors_proc_bus[i].adapter; return NULL; } diff --git a/lib/data.c b/lib/data.c index 925a2416..9a2230eb 100644 --- a/lib/data.c +++ b/lib/data.c @@ -92,7 +92,8 @@ int sensors_parse_chip_name(const char *name, sensors_chip_name *res) /* Then we have either a sole "*" (all chips with this name) or a bus type and an address. */ if (!strcmp(name, "*")) { - res->bus = SENSORS_CHIP_NAME_BUS_ANY; + res->bus.type = SENSORS_BUS_TYPE_ANY; + res->bus.nr = SENSORS_BUS_NR_ANY; res->addr = SENSORS_CHIP_NAME_ADDR_ANY; return 0; } @@ -100,11 +101,11 @@ int sensors_parse_chip_name(const char *name, sensors_chip_name *res) if (!(dash = strchr(name, '-'))) goto ERROR; if (!strncmp(name, "i2c", dash - name)) - res->bus = SENSORS_CHIP_NAME_BUS_ANY_I2C; + res->bus.type = SENSORS_BUS_TYPE_I2C; else if (!strncmp(name, "isa", dash - name)) - res->bus = SENSORS_CHIP_NAME_BUS_ISA; + res->bus.type = SENSORS_BUS_TYPE_ISA; else if (!strncmp(name, "pci", dash - name)) - res->bus = SENSORS_CHIP_NAME_BUS_PCI; + res->bus.type = SENSORS_BUS_TYPE_PCI; else goto ERROR; name = dash + 1; @@ -112,17 +113,21 @@ int sensors_parse_chip_name(const char *name, sensors_chip_name *res) /* Some bus types (i2c) have an additional bus number. For these, the next part is either a "*" (any bus of that type) or a decimal number. */ - switch (res->bus) { - case SENSORS_CHIP_NAME_BUS_ANY_I2C: + switch (res->bus.type) { + case SENSORS_BUS_TYPE_I2C: if (!strncmp(name, "*-", 2)) { + res->bus.nr = SENSORS_BUS_NR_ANY; name += 2; break; } - res->bus = strtoul(name, &dash, 10); - if (*name == '\0' || *dash != '-' || res->bus < 0) + res->bus.nr = strtoul(name, &dash, 10); + if (*name == '\0' || *dash != '-' || res->bus.nr < 0) goto ERROR; name = dash + 1; + break; + default: + res->bus.nr = SENSORS_BUS_NR_ANY; } /* Last part is the chip address, or "*" for any address. */ @@ -147,17 +152,19 @@ int sensors_snprintf_chip_name(char *str, size_t size, if (sensors_chip_name_has_wildcards(chip)) return -SENSORS_ERR_WILDCARDS; - switch (chip->bus) { - case SENSORS_CHIP_NAME_BUS_ISA: + switch (chip->bus.type) { + case SENSORS_BUS_TYPE_ISA: return snprintf(str, size, "%s-isa-%04x", chip->prefix, chip->addr); - case SENSORS_CHIP_NAME_BUS_PCI: + case SENSORS_BUS_TYPE_PCI: return snprintf(str, size, "%s-pci-%04x", chip->prefix, chip->addr); - default: - return snprintf(str, size, "%s-i2c-%d-%02x", chip->prefix, - chip->bus, chip->addr); + case SENSORS_BUS_TYPE_I2C: + return snprintf(str, size, "%s-i2c-%hd-%02x", chip->prefix, + chip->bus.nr, chip->addr); } + + return -SENSORS_ERR_CHIP_NAME; } int sensors_parse_i2cbus_name(const char *name, int *res) @@ -178,12 +185,13 @@ int sensors_substitute_chip(sensors_chip_name *name, int lineno) { int i, j; for (i = 0; i < sensors_config_busses_count; i++) - if (sensors_config_busses[i].number == name->bus) + if (name->bus.type == SENSORS_BUS_TYPE_I2C && + sensors_config_busses[i].number == name->bus.nr) break; if (i == sensors_config_busses_count) { sensors_parse_error("Undeclared i2c bus referenced", lineno); - name->bus = sensors_proc_bus_count; + name->bus.nr = sensors_proc_bus_count; return -SENSORS_ERR_BUS_NAME; } @@ -191,14 +199,14 @@ int sensors_substitute_chip(sensors_chip_name *name, int lineno) for (j = 0; j < sensors_proc_bus_count; j++) { if (!strcmp(sensors_config_busses[i].adapter, sensors_proc_bus[j].adapter)) { - name->bus = sensors_proc_bus[j].number; + name->bus.nr = sensors_proc_bus[j].number; return 0; } } /* We did not find anything. sensors_proc_bus_count is not a valid bus number, so it will never be matched. Good. */ - name->bus = sensors_proc_bus_count; + name->bus.nr = sensors_proc_bus_count; return 0; } @@ -211,14 +219,16 @@ int sensors_substitute_busses(void) for (i = 0; i < sensors_config_chips_count; i++) { lineno = sensors_config_chips[i].lineno; chips = &sensors_config_chips[i].chips; - for (j = 0; j < chips->fits_count; j++) - if (chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ISA && - chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_PCI && - chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ANY && - chips->fits[j].bus != SENSORS_CHIP_NAME_BUS_ANY_I2C) - if ((err = sensors_substitute_chip(chips->fits+j, - lineno))) - res = err; + for (j = 0; j < chips->fits_count; j++) { + /* We can only substitute if a specific bus number + is given. */ + if (chips->fits[j].bus.nr == SENSORS_BUS_NR_ANY) + continue; + + err = sensors_substitute_chip(&chips->fits[j], lineno); + if (err) + res = err; + } } return res; } diff --git a/lib/sensors.h b/lib/sensors.h index a692d5da..dac78fd3 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -1,6 +1,7 @@ /* sensors.h - Part of libsensors, a Linux library for reading sensor data. Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,22 +27,29 @@ /* Publicly accessible library functions */ #define SENSORS_CHIP_NAME_PREFIX_ANY NULL -#define SENSORS_CHIP_NAME_BUS_ISA -1 -#define SENSORS_CHIP_NAME_BUS_ANY -2 -#define SENSORS_CHIP_NAME_BUS_ANY_I2C -3 -#define SENSORS_CHIP_NAME_BUS_PCI -5 #define SENSORS_CHIP_NAME_ADDR_ANY -1 +#define SENSORS_BUS_TYPE_ANY (-1) +#define SENSORS_BUS_TYPE_I2C 0 +#define SENSORS_BUS_TYPE_ISA 1 +#define SENSORS_BUS_TYPE_PCI 2 +#define SENSORS_BUS_NR_ANY (-1) + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ extern const char *libsensors_version; +typedef struct sensors_bus_id { + short type; + short nr; +} sensors_bus_id; + /* A chip name is encoded in this structure */ typedef struct sensors_chip_name { char *prefix; - int bus; + sensors_bus_id bus; int addr; char *path; } sensors_chip_name; @@ -70,10 +78,10 @@ int sensors_snprintf_chip_name(char *str, size_t size, int sensors_match_chip(const sensors_chip_name *chip1, const sensors_chip_name *chip2); -/* This function returns the adapter name of a bus number, +/* This function returns the adapter name of a bus, as used within the sensors_chip_name structure. If it could not be found, it returns NULL */ -const char *sensors_get_adapter_name(int bus_nr); +const char *sensors_get_adapter_name(const sensors_bus_id *bus); /* Look up the label which belongs to this chip. Note that chip should not contain wildcard values! *result is newly allocated (free it yourself). diff --git a/lib/sysfs.c b/lib/sysfs.c index 09042b17..ae67e9b6 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -226,14 +226,16 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) if (!entry.chip.path) sensors_fatal_error(__FUNCTION__, "out of memory"); - if (sscanf(dev->name, "%d-%x", &entry.chip.bus, &entry.chip.addr) == 2) { + if (sscanf(dev->name, "%hd-%x", &entry.chip.bus.nr, &entry.chip.addr) == 2) { /* find out if legacy ISA or not */ - if (entry.chip.bus == 9191) - entry.chip.bus = SENSORS_CHIP_NAME_BUS_ISA; - else { + if (entry.chip.bus.nr == 9191) { + entry.chip.bus.type = SENSORS_BUS_TYPE_ISA; + entry.chip.bus.nr = 0; + } else { + entry.chip.bus.type = SENSORS_BUS_TYPE_I2C; snprintf(bus_path, sizeof(bus_path), "%s/class/i2c-adapter/i2c-%d/device/name", - sensors_sysfs_mount, entry.chip.bus); + sensors_sysfs_mount, entry.chip.bus.nr); if ((bus_attr = sysfs_open_attribute(bus_path))) { if (sysfs_read_attribute(bus_attr)) { @@ -242,19 +244,23 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) } if (bus_attr->value - && !strncmp(bus_attr->value, "ISA ", 4)) - entry.chip.bus = SENSORS_CHIP_NAME_BUS_ISA; + && !strncmp(bus_attr->value, "ISA ", 4)) { + entry.chip.bus.type = SENSORS_BUS_TYPE_ISA; + entry.chip.bus.nr = 0; + } sysfs_close_attribute(bus_attr); } } } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &entry.chip.addr) == 1) { /* must be new ISA (platform driver) */ - entry.chip.bus = SENSORS_CHIP_NAME_BUS_ISA; + entry.chip.bus.type = SENSORS_BUS_TYPE_ISA; + entry.chip.bus.nr = 0; } else if (sscanf(dev->name, "%x:%x:%x.%x", &domain, &bus, &slot, &fn) == 4) { /* PCI */ entry.chip.addr = (domain << 16) + (bus << 8) + (slot << 3) + fn; - entry.chip.bus = SENSORS_CHIP_NAME_BUS_PCI; + entry.chip.bus.type = SENSORS_BUS_TYPE_PCI; + entry.chip.bus.nr = 0; } else goto exit_free; diff --git a/prog/sensord/args.c b/prog/sensord/args.c index e4bd01cb..923186b2 100644 --- a/prog/sensord/args.c +++ b/prog/sensord/args.c @@ -288,7 +288,8 @@ parseChips (int argc, char **argv) { if (optind == argc) { chipNames[0].prefix = SENSORS_CHIP_NAME_PREFIX_ANY; - chipNames[0].bus = SENSORS_CHIP_NAME_BUS_ANY; + chipNames[0].bus.type = SENSORS_BUS_TYPE_ANY; + chipNames[0].bus.nr = SENSORS_BUS_NR_ANY; chipNames[0].addr = SENSORS_CHIP_NAME_ADDR_ANY; numChipNames = 1; } else { diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 6cba537f..f151acd8 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -209,7 +209,8 @@ int main (int argc, char *argv[]) if (optind == argc) { chips[0].prefix = SENSORS_CHIP_NAME_PREFIX_ANY; - chips[0].bus = SENSORS_CHIP_NAME_BUS_ANY; + chips[0].bus.type = SENSORS_BUS_TYPE_ANY; + chips[0].bus.nr = SENSORS_BUS_NR_ANY; chips[0].addr = SENSORS_CHIP_NAME_ADDR_ANY; chips_count = 1; } else @@ -310,11 +311,11 @@ void do_a_print(const sensors_chip_name *name) printf("%s\n",sprintf_chip_name(name)); if (!hide_adapter) { - const char *adap = sensors_get_adapter_name(name->bus); + const char *adap = sensors_get_adapter_name(&name->bus); if (adap) printf("Adapter: %s\n", adap); else - fprintf(stderr, "Can't get adapter name for bus %d\n", name->bus); + fprintf(stderr, "Can't get adapter name\n"); } if (do_unknown) print_unknown_chip(name); From a74addb5d48a367362fdcb9e8c3fad87f7f86b72 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 19 Aug 2007 15:04:29 +0000 Subject: [PATCH 184/718] Support more bus types (part 2 of 2). Originally libsensors was very i2c-centric. Make it more neutral so that we can cleanly support additional bus types such as SPI or One-Wire. This second part updates sensors_bus to use sensors_bus_id. Thanks to Mark M. Hoffman for showing me how the configuration file parser could be modified to support that change. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4687 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 3 ++- lib/conf-parse.y | 14 +++++++------- lib/data.c | 15 ++++++++------- lib/data.h | 8 ++++---- lib/sysfs.c | 5 +++-- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/lib/access.c b/lib/access.c index 7b0a4b10..0e7ba06c 100644 --- a/lib/access.c +++ b/lib/access.c @@ -326,7 +326,8 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus) /* bus types with several instances */ for (i = 0; i < sensors_proc_bus_count; i++) - if (sensors_proc_bus[i].number == bus->nr) + if (sensors_proc_bus[i].bus.type == bus->type && + sensors_proc_bus[i].bus.nr == bus->nr) return sensors_proc_bus[i].adapter; return NULL; } diff --git a/lib/conf-parse.y b/lib/conf-parse.y index 88a1cf49..3df1f808 100644 --- a/lib/conf-parse.y +++ b/lib/conf-parse.y @@ -94,7 +94,7 @@ static sensors_chip *current_chip = NULL; void *nothing; sensors_chip_name_list chips; sensors_expr *expr; - int bus; + sensors_bus_id bus; sensors_chip_name chip; int line; } @@ -118,7 +118,7 @@ static sensors_chip *current_chip = NULL; %type chip_name_list %type expression -%type i2cbus_name +%type bus_id %type adapter_name %type function_name %type string @@ -141,10 +141,10 @@ line: bus_statement EOL | error EOL ; -bus_statement: BUS i2cbus_name adapter_name +bus_statement: BUS bus_id adapter_name { sensors_bus new_el; new_el.lineno = $1; - new_el.number = $2; + new_el.bus = $2; new_el.adapter = $3; bus_add_el(&new_el); } @@ -287,11 +287,11 @@ expression: FLOAT } ; -i2cbus_name: NAME - { int res = sensors_parse_i2cbus_name($1,&$$); +bus_id: NAME + { int res = sensors_parse_bus_id($1,&$$); free($1); if (res) { - sensors_yyerror("Parse error in i2c bus name"); + sensors_yyerror("Parse error in bus id"); YYERROR; } } diff --git a/lib/data.c b/lib/data.c index 9a2230eb..53996b2e 100644 --- a/lib/data.c +++ b/lib/data.c @@ -167,7 +167,7 @@ int sensors_snprintf_chip_name(char *str, size_t size, return -SENSORS_ERR_CHIP_NAME; } -int sensors_parse_i2cbus_name(const char *name, int *res) +int sensors_parse_bus_id(const char *name, sensors_bus_id *bus) { char *endptr; @@ -175,8 +175,9 @@ int sensors_parse_i2cbus_name(const char *name, int *res) return -SENSORS_ERR_BUS_NAME; } name += 4; - *res = strtoul(name, &endptr, 10); - if (*name == '\0' || *endptr != '\0' || *res < 0) + bus->type = SENSORS_BUS_TYPE_I2C; + bus->nr = strtoul(name, &endptr, 10); + if (*name == '\0' || *endptr != '\0' || bus->nr < 0) return -SENSORS_ERR_BUS_NAME; return 0; } @@ -185,12 +186,12 @@ int sensors_substitute_chip(sensors_chip_name *name, int lineno) { int i, j; for (i = 0; i < sensors_config_busses_count; i++) - if (name->bus.type == SENSORS_BUS_TYPE_I2C && - sensors_config_busses[i].number == name->bus.nr) + if (sensors_config_busses[i].bus.type == name->bus.type && + sensors_config_busses[i].bus.nr == name->bus.nr) break; if (i == sensors_config_busses_count) { - sensors_parse_error("Undeclared i2c bus referenced", lineno); + sensors_parse_error("Undeclared bus id referenced", lineno); name->bus.nr = sensors_proc_bus_count; return -SENSORS_ERR_BUS_NAME; } @@ -199,7 +200,7 @@ int sensors_substitute_chip(sensors_chip_name *name, int lineno) for (j = 0; j < sensors_proc_bus_count; j++) { if (!strcmp(sensors_config_busses[i].adapter, sensors_proc_bus[j].adapter)) { - name->bus.nr = sensors_proc_bus[j].number; + name->bus.nr = sensors_proc_bus[j].bus.nr; return 0; } } diff --git a/lib/data.h b/lib/data.h index 5bf2b0c9..1af232ac 100644 --- a/lib/data.h +++ b/lib/data.h @@ -110,10 +110,10 @@ typedef struct sensors_chip { int lineno; } sensors_chip; -/* Config file bus declaration: the i2c bus number, combined with adapter +/* Config file bus declaration: the bus type and number, combined with adapter name */ typedef struct sensors_bus { - int number; + sensors_bus_id bus; char *adapter; int lineno; } sensors_bus; @@ -175,8 +175,8 @@ extern int sensors_proc_bus_max; int sensors_substitute_busses(void); -/* Parse an i2c bus name into its components. Returns 0 on succes, a value from +/* Parse a bus id into its components. Returns 0 on succes, a value from error.h on failure. */ -int sensors_parse_i2cbus_name(const char *name, int *res); +int sensors_parse_bus_id(const char *name, sensors_bus_id *bus); #endif /* def LIB_SENSORS_DATA_H */ diff --git a/lib/sysfs.c b/lib/sysfs.c index ae67e9b6..e6544b73 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -380,9 +380,10 @@ int sensors_read_sysfs_bus(void) (attr = sysfs_get_device_attr(dev, "name")))) continue; - if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1 || - entry.number == 9191) /* legacy ISA */ + if (sscanf(clsdev->name, "i2c-%hd", &entry.bus.nr) != 1 || + entry.bus.nr == 9191) /* legacy ISA */ continue; + entry.bus.type = SENSORS_BUS_TYPE_I2C; /* NB: attr->value[attr->len-1] == '\n'; chop that off */ entry.adapter = strndup(attr->value, attr->len - 1); From f1cc941e29cd4566be47d6b2eac080bc29c2cc92 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 19 Aug 2007 15:05:52 +0000 Subject: [PATCH 185/718] Contrary to what the comment says, sensors_proc_bus_count may be a perfectly valid bus number. We need to use a different value for chip configuration entries we want to ignore. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4688 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.c | 8 ++++---- lib/sensors.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/data.c b/lib/data.c index 53996b2e..2bae021f 100644 --- a/lib/data.c +++ b/lib/data.c @@ -192,7 +192,7 @@ int sensors_substitute_chip(sensors_chip_name *name, int lineno) if (i == sensors_config_busses_count) { sensors_parse_error("Undeclared bus id referenced", lineno); - name->bus.nr = sensors_proc_bus_count; + name->bus.nr = SENSORS_BUS_NR_IGNORE; return -SENSORS_ERR_BUS_NAME; } @@ -205,9 +205,9 @@ int sensors_substitute_chip(sensors_chip_name *name, int lineno) } } - /* We did not find anything. sensors_proc_bus_count is not - a valid bus number, so it will never be matched. Good. */ - name->bus.nr = sensors_proc_bus_count; + /* We did not find a matching bus name, simply ignore this chip + config entry. */ + name->bus.nr = SENSORS_BUS_NR_IGNORE; return 0; } diff --git a/lib/sensors.h b/lib/sensors.h index dac78fd3..a2350cac 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -34,6 +34,7 @@ #define SENSORS_BUS_TYPE_ISA 1 #define SENSORS_BUS_TYPE_PCI 2 #define SENSORS_BUS_NR_ANY (-1) +#define SENSORS_BUS_NR_IGNORE (-2) #ifdef __cplusplus extern "C" { From 5524486161de68e48508331590ec9cf3c7f22434 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 19 Aug 2007 15:07:05 +0000 Subject: [PATCH 186/718] Add support for hardware monitoring chips on SPI buses. SPI bus statements in the configuration file are not yet supported, as SPI buses don't have a name attribute yet, it's not possible to identify them and thus no substitution is possible. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4689 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/access.c | 4 ++++ lib/data.c | 12 +++++++++--- lib/sensors.h | 1 + lib/sysfs.c | 4 ++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index b2e4c197..8b67a2a0 100644 --- a/CHANGES +++ b/CHANGES @@ -23,6 +23,7 @@ SVN HEAD Drop support for dummy type New function sensors_snprintf_chip_name() Drop support for dashes in chip names + Add support for devices on SPI adapters Makefile: Drop the package and version targets Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete diff --git a/lib/access.c b/lib/access.c index 0e7ba06c..245177cc 100644 --- a/lib/access.c +++ b/lib/access.c @@ -322,6 +322,10 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus) return "ISA adapter"; case SENSORS_BUS_TYPE_PCI: return "PCI adapter"; + /* SPI should not be here, but for now SPI adapters have no name + so we don't have any custom string to return. */ + case SENSORS_BUS_TYPE_SPI: + return "SPI adapter"; } /* bus types with several instances */ diff --git a/lib/data.c b/lib/data.c index 2bae021f..6e0dbc9d 100644 --- a/lib/data.c +++ b/lib/data.c @@ -106,15 +106,18 @@ int sensors_parse_chip_name(const char *name, sensors_chip_name *res) res->bus.type = SENSORS_BUS_TYPE_ISA; else if (!strncmp(name, "pci", dash - name)) res->bus.type = SENSORS_BUS_TYPE_PCI; + else if (!strncmp(name, "spi", dash - name)) + res->bus.type = SENSORS_BUS_TYPE_SPI; else goto ERROR; name = dash + 1; - /* Some bus types (i2c) have an additional bus number. For these, the - next part is either a "*" (any bus of that type) or a decimal - number. */ + /* Some bus types (i2c, spi) have an additional bus number. + For these, the next part is either a "*" (any bus of that type) + or a decimal number. */ switch (res->bus.type) { case SENSORS_BUS_TYPE_I2C: + case SENSORS_BUS_TYPE_SPI: if (!strncmp(name, "*-", 2)) { res->bus.nr = SENSORS_BUS_NR_ANY; name += 2; @@ -162,6 +165,9 @@ int sensors_snprintf_chip_name(char *str, size_t size, case SENSORS_BUS_TYPE_I2C: return snprintf(str, size, "%s-i2c-%hd-%02x", chip->prefix, chip->bus.nr, chip->addr); + case SENSORS_BUS_TYPE_SPI: + return snprintf(str, size, "%s-spi-%hd-%x", chip->prefix, + chip->bus.nr, chip->addr); } return -SENSORS_ERR_CHIP_NAME; diff --git a/lib/sensors.h b/lib/sensors.h index a2350cac..f44c9430 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -33,6 +33,7 @@ #define SENSORS_BUS_TYPE_I2C 0 #define SENSORS_BUS_TYPE_ISA 1 #define SENSORS_BUS_TYPE_PCI 2 +#define SENSORS_BUS_TYPE_SPI 3 #define SENSORS_BUS_NR_ANY (-1) #define SENSORS_BUS_NR_IGNORE (-2) diff --git a/lib/sysfs.c b/lib/sysfs.c index e6544b73..9ee2dfd8 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -252,6 +252,10 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) sysfs_close_attribute(bus_attr); } } + } else if (sscanf(dev->name, "spi%hd.%d", &entry.chip.bus.nr, + &entry.chip.addr) == 2) { + /* SPI */ + entry.chip.bus.type = SENSORS_BUS_TYPE_SPI; } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &entry.chip.addr) == 1) { /* must be new ISA (platform driver) */ entry.chip.bus.type = SENSORS_BUS_TYPE_ISA; From fe165fea49702c45966d420c2335385f02a5344a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 21 Aug 2007 09:08:52 +0000 Subject: [PATCH 187/718] Fix error message. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4692 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/pwm/pwmconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/pwm/pwmconfig b/prog/pwm/pwmconfig index 7657d946..1a900677 100755 --- a/prog/pwm/pwmconfig +++ b/prog/pwm/pwmconfig @@ -190,7 +190,7 @@ do pwmdisable $i if [ $? -ne 0 ] then - echo "Failed to set pwm$i to full speed" >&2 + echo "Failed to set $i to full speed" >&2 echo "Something's wrong, check your fans!" >&2 exit 1 fi From 12655c1d85ea77bd2b453a71706df7fe9eed4475 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 22 Aug 2007 17:04:12 +0000 Subject: [PATCH 188/718] Drop support for reloading the configuration with sensors_init(). Instead, the application will have to call sensors_exit() explicitly before calling sensors_init() again. Most applications don't offer any way to reload the configuration file, so better optimize for the initial load. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4693 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/init.c | 2 +- lib/libsensors.3 | 5 ++++- lib/sensors.h | 8 +++++--- prog/sensord/lib.c | 4 +++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/init.c b/lib/init.c index a9203558..13c26f8e 100644 --- a/lib/init.c +++ b/lib/init.c @@ -40,7 +40,7 @@ static void free_expr(sensors_expr *expr); int sensors_init(FILE *input) { int res; - sensors_cleanup(); + if (!sensors_init_sysfs()) return -SENSORS_ERR_PROC; if ((res = sensors_read_sysfs_bus()) || (res = sensors_read_sysfs_chips())) diff --git a/lib/libsensors.3 b/lib/libsensors.3 index db176fc5..67099e5d 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -53,7 +53,10 @@ libsensors \- publicly accessible functions provided by the sensors library .SH DESCRIPTION .B int sensors_init(FILE *input); .br -(Re)load the configuration file and the detected chips list. If this returns a value unequal to zero, you are in trouble; you can not assume anything will be initialized properly. +Load the configuration file and the detected chips list. If this returns a +value unequal to zero, you are in trouble; you can not assume anything will +be initialized properly. If you want to reload the configuration file, call +sensors_cleanup() below before calling sensors_init() again. .B void sensors_cleanup(void); .br diff --git a/lib/sensors.h b/lib/sensors.h index f44c9430..b8336fe9 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -56,9 +56,11 @@ typedef struct sensors_chip_name { char *path; } sensors_chip_name; -/* (Re)load the configuration file and the detected chips list. If this - returns a value unequal to zero, you are in trouble; you can not - assume anything will be initialized properly. */ +/* Load the configuration file and the detected chips list. If this + returns a value unequal to zero, you are in trouble; you can not + assume anything will be initialized properly. If you want to + reload the configuration file, call sensors_cleanup() below before + calling sensors_init() again. */ int sensors_init(FILE *input); /* Clean-up function: You can't access anything after diff --git a/prog/sensord/lib.c b/prog/sensord/lib.c index 15ad4c54..a3b2b0ac 100644 --- a/prog/sensord/lib.c +++ b/prog/sensord/lib.c @@ -90,8 +90,10 @@ loadConfig sensorLog (LOG_ERR, "Error stating sensors configuration file: %s", cfgPath); ret = 10; } else if (!reload || (difftime (stats.st_mtime, cfgLastModified) > 0.0)) { - if (reload) + if (reload) { sensorLog (LOG_INFO, "configuration reloading"); + sensors_cleanup (); + } if (!(cfg = fopen (cfgPath, "r"))) { sensorLog (LOG_ERR, "Error opening sensors configuration file: %s", cfgPath); ret = 11; From 8bcdc331a0d011ab8a0590a1887c87a733f5cf73 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 22 Aug 2007 17:05:01 +0000 Subject: [PATCH 189/718] Change the prototype of sensors_get_label(). Errors can be reported with a NULL pointer. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4694 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 22 +++++++++++----------- lib/libsensors.3 | 11 ++++++----- lib/sensors.h | 7 +++---- prog/sensord/rrd.c | 2 +- prog/sensord/sense.c | 12 ++---------- prog/sensord/sensord.h | 1 - prog/sensors/chips.c | 4 ++-- prog/sensors/chips_generic.c | 8 ++++---- 8 files changed, 29 insertions(+), 38 deletions(-) diff --git a/lib/access.c b/lib/access.c index 245177cc..bbd8a987 100644 --- a/lib/access.c +++ b/lib/access.c @@ -139,27 +139,27 @@ int sensors_chip_name_has_wildcards(const sensors_chip_name *chip) } /* Look up the label which belongs to this chip. Note that chip should not - contain wildcard values! *result is newly allocated (free it yourself). - This function will return 0 on success, and <0 on failure. + contain wildcard values! The returned string is newly allocated (free it + yourself). On failure, NULL is returned. If no label exists for this feature, its name is returned itself. */ -int sensors_get_label(const sensors_chip_name *name, int feature, char **result) +char *sensors_get_label(const sensors_chip_name *name, int feature) { + char *label; const sensors_chip *chip; const sensors_chip_feature *featureptr; char buf[128], path[PATH_MAX]; FILE *f; int i; - *result = NULL; if (sensors_chip_name_has_wildcards(name)) - return -SENSORS_ERR_WILDCARDS; + return NULL; if (!(featureptr = sensors_lookup_feature_nr(name, feature))) - return -SENSORS_ERR_NO_ENTRY; + return NULL; for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->labels_count; i++) if (!strcasecmp(featureptr->data.name,chip->labels[i].name)){ - *result = strdup(chip->labels[i].value); + label = strdup(chip->labels[i].value); goto sensors_get_label_exit; } @@ -173,19 +173,19 @@ int sensors_get_label(const sensors_chip_name *name, int feature, char **result) if (i > 0) { /* i - 1 to strip the '\n' at the end */ buf[i - 1] = 0; - *result = strdup(buf); + label = strdup(buf); goto sensors_get_label_exit; } } /* No label, return the feature name instead */ - *result = strdup(featureptr->data.name); + label = strdup(featureptr->data.name); sensors_get_label_exit: - if (*result == NULL) + if (!label) sensors_fatal_error("sensors_get_label", "Allocating label text"); - return 0; + return label; } /* Looks up whether a feature should be ignored. Returns diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 67099e5d..f0e50c8b 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -38,8 +38,7 @@ libsensors \- publicly accessible functions provided by the sensors library .B int sensors_match_chip(const sensors_chip_name *chip1, \fBconst sensors_chip_name *chip2);\fP .B const char *sensors_get_adapter_name(int bus_nr); -.B int sensors_get_label(const sensors_chip_name *name, int feature, - \fBchar **result);\fP +.B char *sensors_get_label(const sensors_chip_name *name, int feature);\fP .B int sensors_get_feature(const sensors_chip_name *name, int feature, \fBdouble *result);\fP .B int sensors_set_feature(const sensors_chip_name *name, int feature, @@ -78,10 +77,12 @@ Compare two chips name descriptions, to see whether they could match. Return 0 i This function returns the adapter name of a bus number, as used within the sensors_chip_name structure. If it could not be found, it returns NULL. -\fBint sensors_get_label(const sensors_chip_name *name, int feature, - char **result);\fP +\fBchar *sensors_get_label(const sensors_chip_name *name, int feature);\fP .br -Look up the label which belongs to this chip. Note that chip should not contain wildcard values! *result is newly allocated (free it yourself). This function will return 0 on success, and <0 on failure. +Look up the label which belongs to this chip. Note that chip should not +contain wildcard values! The returned string is newly allocated (free it +yourself). On failure, NULL is returned. +If no label exists for this feature, its name is returned itself. \fBint sensors_get_feature(const sensors_chip_name *name, int feature, double *result);\fP diff --git a/lib/sensors.h b/lib/sensors.h index b8336fe9..009a5d60 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -88,11 +88,10 @@ int sensors_match_chip(const sensors_chip_name *chip1, const char *sensors_get_adapter_name(const sensors_bus_id *bus); /* Look up the label which belongs to this chip. Note that chip should not - contain wildcard values! *result is newly allocated (free it yourself). - This function will return 0 on success, and <0 on failure. + contain wildcard values! The returned string is newly allocated (free it + yourself). On failure, NULL is returned. If no label exists for this feature, its name is returned itself. */ -int sensors_get_label(const sensors_chip_name *name, int feature, - char **result); +char *sensors_get_label(const sensors_chip_name *name, int feature); /* Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index d7a7bc56..2299aad4 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -163,7 +163,7 @@ applyToFeatures } else if (getRawLabel (chip, labelNumber, &rawLabel)) { sensorLog (LOG_ERR, "Error getting raw sensor label: %s/#%d", chip->prefix, labelNumber); ret = -1; - } else if (getLabel (chip, labelNumber, &label)) { + } else if (!(label = sensors_get_label (chip, labelNumber))) { sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); ret = -1; } else if (valid) { diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index bf7f5695..bcef780d 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -45,14 +45,6 @@ getValid return err; } -int -getLabel -(const sensors_chip_name *name, int feature, char **label) { - int err; - err = sensors_get_label (name, feature, label); - return err; -} - int getRawLabel (const sensors_chip_name *name, int feature, const char **label) { @@ -109,7 +101,7 @@ readUnknownChip if (getValid (chip, sensor->number, &valid)) { sensorLog (LOG_ERR, "Error getting sensor validity: %s/%s", chip->prefix, sensor->name); ret = 20; - } else if (getLabel (chip, sensor->number, &label)) { + } else if (!(label = sensors_get_label (chip, sensor->number))) { sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, sensor->name); ret = 21; } else if (!valid) { @@ -169,7 +161,7 @@ doKnownChip } else if (getValid (chip, labelNumber, &valid)) { sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber); ret = 22; - } else if (getLabel (chip, labelNumber, &label)) { + } else if (!(label = sensors_get_label (chip, labelNumber))) { sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); ret = 22; } else if (valid) { diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index 94e53313..46a001e8 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -59,7 +59,6 @@ extern int unloadLib (void); /* from sense.c */ extern int getValid (const sensors_chip_name *name, int feature, int *valid); -extern int getLabel (const sensors_chip_name *name, int feature, char **label); extern int getRawLabel (const sensors_chip_name *name, int feature, const char **label); extern int readChips (void); diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index cce2c1b1..cfd08e01 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -91,7 +91,7 @@ void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size) char *label; double vid; - if (!sensors_get_label(name, f_vid, &label) + if ((label = sensors_get_label(name, f_vid)) && !sensors_get_feature(name, f_vid, &vid)) { print_label(label, label_size); printf("%+6.3f V\n", vid); @@ -108,7 +108,7 @@ void print_unknown_chip(const sensors_chip_name *name) a = 0; while((data=sensors_get_all_features(name, &a))) { - if (sensors_get_label(name, data->number, &label)) { + if (!(label = sensors_get_label(name, data->number))) { printf("ERROR: Can't get feature `%s' data!\n",data->name); continue; } diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 137850fc..ed870bf3 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -69,7 +69,7 @@ static int sensors_get_label_size(const sensors_chip_name *name) i = 0; while((iter = sensors_get_all_features(name, &i))) { - if (!sensors_get_label(name, iter->number, &label) && + if ((label = sensors_get_label(name, iter->number)) && strlen(label) > max_size) max_size = strlen(label); free(label); @@ -98,7 +98,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0, }; double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0.0, }; - if (sensors_get_label(name, feature->number, &label)) { + if (!(label = sensors_get_label(name, feature->number))) { printf("ERROR: Can't get temperature label!\n"); return; } @@ -211,7 +211,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, double val, alarm_max, alarm_min; char *label; - if (sensors_get_label(name, feature->number, &label)) { + if (!(label = sensors_get_label(name, feature->number))) { printf("ERROR: Can't get in label!\n"); return; } @@ -273,7 +273,7 @@ static void print_generic_chip_fan(const sensors_chip_name *name, double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = {0.0, }; double val; - if (sensors_get_label(name, feature->number, &label)) { + if (!(label = sensors_get_label(name, feature->number))) { printf("ERROR: Can't get fan label!\n"); return; } From b0fb4179965c49613cc08bc28799ebc0630fca36 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 22 Aug 2007 17:06:13 +0000 Subject: [PATCH 190/718] sensors_get_value() and sensors_set_value(), respectively. The new names better reflect what the functions do. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4695 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 12 ++++++------ lib/libsensors.3 | 16 ++++++++-------- lib/sensors.h | 8 ++++---- prog/sensord/sense.c | 8 ++++---- prog/sensors/chips.c | 4 ++-- prog/sensors/chips_generic.c | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/access.c b/lib/access.c index bbd8a987..5048fe16 100644 --- a/lib/access.c +++ b/lib/access.c @@ -216,8 +216,8 @@ static int sensors_get_ignored(const sensors_chip_name *name, /* Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_get_feature(const sensors_chip_name *name, int feature, - double *result) +int sensors_get_value(const sensors_chip_name *name, int feature, + double *result) { const sensors_chip_feature *main_feature; const sensors_chip_feature *alt_feature; @@ -261,8 +261,8 @@ int sensors_get_feature(const sensors_chip_name *name, int feature, /* Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_set_feature(const sensors_chip_name *name, int feature, - double value) +int sensors_set_value(const sensors_chip_name *name, int feature, + double value) { const sensors_chip_feature *main_feature; const sensors_chip_feature *alt_feature; @@ -377,7 +377,7 @@ int sensors_eval_expr(const sensors_chip_name *name, if (!(feature = sensors_lookup_feature_name(name, expr->data.var))) return SENSORS_ERR_NO_ENTRY; - if (!(res = sensors_get_feature(name, feature->data.number, result))) + if (!(res = sensors_get_value(name, feature->data.number, result))) return res; return 0; } @@ -461,7 +461,7 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) err = res; continue; } - if ((res = sensors_set_feature(name, feature_nr, value))) { + if ((res = sensors_set_value(name, feature_nr, value))) { sensors_parse_error("Failed to set feature", chip->sets[i].lineno); err = res; diff --git a/lib/libsensors.3 b/lib/libsensors.3 index f0e50c8b..e15bfbd3 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -39,10 +39,10 @@ libsensors \- publicly accessible functions provided by the sensors library \fBconst sensors_chip_name *chip2);\fP .B const char *sensors_get_adapter_name(int bus_nr); .B char *sensors_get_label(const sensors_chip_name *name, int feature);\fP -.B int sensors_get_feature(const sensors_chip_name *name, int feature, - \fBdouble *result);\fP -.B int sensors_set_feature(const sensors_chip_name *name, int feature, - \fBdouble value);\fP +.B int sensors_get_value(const sensors_chip_name *name, int feature, + \fBdouble *value);\fP +.B int sensors_set_value(const sensors_chip_name *name, int feature, + \fBdouble value);\fP .B int sensors_do_chip_sets(const sensors_chip_name *name); .B const sensors_chip_name *sensors_get_detected_chips(int *nr); .B const sensors_feature_data *sensors_get_all_features @@ -84,13 +84,13 @@ contain wildcard values! The returned string is newly allocated (free it yourself). On failure, NULL is returned. If no label exists for this feature, its name is returned itself. -\fBint sensors_get_feature(const sensors_chip_name *name, - int feature, double *result);\fP +\fBint sensors_get_value(const sensors_chip_name *name, + int feature, double *value);\fP .br Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. -\fBint sensors_set_feature(const sensors_chip_name *name, - int feature, double value);\fP +\fBint sensors_set_value(const sensors_chip_name *name, + int feature, double value);\fP .br Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. diff --git a/lib/sensors.h b/lib/sensors.h index 009a5d60..d1832b46 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -96,14 +96,14 @@ char *sensors_get_label(const sensors_chip_name *name, int feature); /* Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_get_feature(const sensors_chip_name *name, int feature, - double *result); +int sensors_get_value(const sensors_chip_name *name, int feature, + double *value); /* Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_set_feature(const sensors_chip_name *name, int feature, - double value); +int sensors_set_value(const sensors_chip_name *name, int feature, + double value); /* Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. */ diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index bcef780d..ded10d26 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -108,7 +108,7 @@ readUnknownChip /* skip invalid */ } else if (!(sensor->mode & SENSORS_MODE_R)) { sensorLog (LOG_INFO, "%s: %s", sensor->name, label); - } else if ((ret = sensors_get_feature (chip, sensor->number, &value))) { + } else if ((ret = sensors_get_value (chip, sensor->number, &value))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/%s: %s", chip->prefix, sensor->name, sensors_strerror (ret)); ret = 22; } else { @@ -133,7 +133,7 @@ doKnownChip if (action == DO_READ) ret = idChip (chip); if (!ret && descriptor->alarmNumber) { - if ((ret = sensors_get_feature (chip, descriptor->alarmNumber, &tmp))) { + if ((ret = sensors_get_value (chip, descriptor->alarmNumber, &tmp))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, descriptor->alarmNumber, sensors_strerror (ret)); ret = 20; } else { @@ -141,7 +141,7 @@ doKnownChip } } if (!ret && descriptor->beepNumber) { - if ((ret = sensors_get_feature (chip, descriptor->beepNumber, &tmp))) { + if ((ret = sensors_get_value (chip, descriptor->beepNumber, &tmp))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, descriptor->beepNumber, sensors_strerror (ret)); ret = 21; } else { @@ -168,7 +168,7 @@ doKnownChip double values[MAX_DATA]; for (subindex = 0; !ret && (feature->dataNumbers[subindex] >= 0); ++ subindex) { - if ((ret = sensors_get_feature (chip, feature->dataNumbers[subindex], values + subindex))) { + if ((ret = sensors_get_value (chip, feature->dataNumbers[subindex], values + subindex))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, feature->dataNumbers[subindex], sensors_strerror (ret)); ret = 23; } diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index cfd08e01..b3819ba5 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -92,7 +92,7 @@ void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size) double vid; if ((label = sensors_get_label(name, f_vid)) - && !sensors_get_feature(name, f_vid, &vid)) { + && !sensors_get_value(name, f_vid, &vid)) { print_label(label, label_size); printf("%+6.3f V\n", vid); } @@ -113,7 +113,7 @@ void print_unknown_chip(const sensors_chip_name *name) continue; } if (data->mode & SENSORS_MODE_R) { - if(sensors_get_feature(name, data->number, &val)) { + if (sensors_get_value(name, data->number, &val)) { printf("ERROR: Can't get feature `%s' data!\n",data->name); continue; } diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index ed870bf3..1cd13e6d 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -30,7 +30,7 @@ static int get_feature_value(const sensors_chip_name *name, const sensors_feature_data *feature, double *val) { - return sensors_get_feature(name, feature->number, val); + return sensors_get_value(name, feature->number, val); } static void sensors_get_available_features(const sensors_chip_name *name, From a30d37899f4b5d6621090e8c0faffb63a91fb6bb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 22 Aug 2007 17:07:11 +0000 Subject: [PATCH 191/718] Drop SENSORS_MODE_NO_RW and SENSORS_MODE_RW. The mode is a bitfield, we typically set, or test for, a specific bit. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4696 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.h | 5 ++--- lib/libsensors.3 | 5 ++--- lib/sensors.h | 2 -- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/data.h b/lib/data.h index 1af232ac..e1708c93 100644 --- a/lib/data.h +++ b/lib/data.h @@ -130,9 +130,8 @@ typedef struct sensors_bus { compute_mapping is like logical_mapping, only it refers to another feature whose compute line will be inherited (a group could be fan and fan_max, but not fan_div) - mode is SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W or - SENSORS_MODE_RW, for unaccessible, readable, writable, and both readable - and writable. + mode is a bitfield, its value is a combination of SENSORS_MODE_R (readable) + and SENSORS_MODE_W (writable). scaling is the number of decimal points to scale by. Divide the read value by 10**scaling to get the real value. */ typedef struct sensors_chip_feature { diff --git a/lib/libsensors.3 b/lib/libsensors.3 index e15bfbd3..4840bfa4 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -121,9 +121,8 @@ This structure is used when you want to get all features of a specific chip. .br } sensors_feature_data;\fP .br -The mode field can be one of: -.br -SENSORS_MODE_NO_RW, SENSORS_MODE_R, SENSORS_MODE_W or SENSORS_MODE_RW. +The mode field is a bitfield, its value is a combination of +SENSORS_MODE_R (readable) and SENSORS_MODE_W (writable). \fBconst sensors_feature_data *sensors_get_all_features (const sensors_chip_name *name, int *nr);\fP diff --git a/lib/sensors.h b/lib/sensors.h index d1832b46..d707aaac 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -116,10 +116,8 @@ int sensors_do_chip_sets(const sensors_chip_name *name); const sensors_chip_name *sensors_get_detected_chips(int *nr); /* These defines are used in the mode field of sensors_feature_data */ -#define SENSORS_MODE_NO_RW 0 #define SENSORS_MODE_R 1 #define SENSORS_MODE_W 2 -#define SENSORS_MODE_RW 3 /* This define is used in the mapping field of sensors_feature_data if no mapping is available */ From 90c2942bef2e81e1a95e5b546a59c1123596cf0f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 22 Aug 2007 18:43:48 +0000 Subject: [PATCH 192/718] Drop sensors option -U, --hide-unknown. libsensors no longer exposes chips with no features, and it builds the features list dynamically, so applications no longer get to see unknown chips. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4697 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/main.c | 13 ++----------- prog/sensors/sensors.1 | 11 ++--------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/CHANGES b/CHANGES index 8b67a2a0..b0f59981 100644 --- a/CHANGES +++ b/CHANGES @@ -50,6 +50,7 @@ SVN HEAD Update URI Program sensors: Drop all the chip-specific support Fix alignment of alarm for one-limit temperatures + Drop option -U Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection Add /usr/sbin to the PATH (#2199) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index f151acd8..fec6aa65 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -54,7 +54,7 @@ static const char *sprintf_chip_name(const sensors_chip_name *name); #define CHIPS_MAX 20 sensors_chip_name chips[CHIPS_MAX]; int chips_count=0; -int do_sets, do_unknown, fahrenheit, hide_adapter, hide_unknown; +int do_sets, do_unknown, fahrenheit, hide_adapter; char degstr[5]; /* store the correct string to print degrees */ @@ -71,7 +71,6 @@ void print_long_help(void) printf(" -s, --set Execute `set' statements too (root only)\n"); printf(" -f, --fahrenheit Show temperatures in degrees fahrenheit\n"); printf(" -A, --no-adapter Do not show adapter for each chip\n"); - printf(" -U, --no-unknown Do not show unknown chips\n"); printf(" -u, --unknown Treat chips as unknown ones (testing only)\n"); printf(" -v, --version Display the program version\n"); printf("\n"); @@ -156,7 +155,6 @@ int main (int argc, char *argv[]) { "version", no_argument, NULL, 'v'}, { "fahrenheit", no_argument, NULL, 'f' }, { "no-adapter", no_argument, NULL, 'A' }, - { "no-unknown", no_argument, NULL, 'U' }, { "config-file", required_argument, NULL, 'c' }, { "unknown", no_argument, NULL, 'u' }, { 0,0,0,0 } @@ -167,9 +165,8 @@ int main (int argc, char *argv[]) do_unknown = 0; do_sets = 0; hide_adapter = 0; - hide_unknown = 0; while (1) { - c = getopt_long(argc, argv, "hsvfAUc:u", long_opts, NULL); + c = getopt_long(argc, argv, "hsvfAc:u", long_opts, NULL); if (c == EOF) break; switch(c) { @@ -195,9 +192,6 @@ int main (int argc, char *argv[]) case 'A': hide_adapter = 1; break; - case 'U': - hide_unknown = 1; - break; case 'u': do_unknown = 1; break; @@ -306,9 +300,6 @@ const char *sprintf_chip_name(const sensors_chip_name *name) void do_a_print(const sensors_chip_name *name) { - if (hide_unknown) - return; - printf("%s\n",sprintf_chip_name(name)); if (!hide_adapter) { const char *adap = sensors_get_adapter_name(&name->bus); diff --git a/prog/sensors/sensors.1 b/prog/sensors/sensors.1 index 88b76f32..fd0b60d8 100644 --- a/prog/sensors/sensors.1 +++ b/prog/sensors/sensors.1 @@ -1,4 +1,5 @@ .\" Copyright 1999 Frodo Looijaard +.\" Copyright (C) 2007 Jean Delvare .\" sensors is distributed under the GPL .\" .\" Permission is granted to make and distribute verbatim copies of this @@ -21,7 +22,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH sensors 1 "October 2006" "" "Linux User's Manual" +.TH sensors 1 "August 2007" "" "Linux User's Manual" .SH NAME sensors \- print sensors information .SH SYNOPSIS @@ -44,12 +45,6 @@ is used to show the current readings of all sensor chips. .B sensors -s is used to set all limits as specified in the configuration file. -.B sensors -knows about certain chips, and outputs nicely formatted readings for them; but -it can also display the information of unknown chips, as long as -.I libsensors -knows about them. - .SH OPTIONS .IP "-c config-file" Specify a configuration file. If no file is specified, `/etc/sensors.conf' @@ -63,8 +58,6 @@ be `root' to do this. If this parameter is not specified, no `set' statement is evaluated. .IP -A Do not show the adapter for each chip. -.IP -U -Hide unknown chips. .IP -u Treat all chips as unknown ones. Output will be of much lower quality; this option is only added for testing purposes. From bf1ff10ab4a12f6b7e9117f9721376ac3a23c6f1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 23 Aug 2007 07:45:58 +0000 Subject: [PATCH 193/718] Relabel "sensors -u" from "unknown chip" to "raw chip". sensors uses generic code to display all the chips now so the notion of "unknown chip" no longer exists, however this raw output format can still be useful for debugging. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4698 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 2 +- prog/sensors/chips.h | 2 +- prog/sensors/main.c | 13 ++++++------- prog/sensors/sensors.1 | 3 +-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index b3819ba5..ffaf4b08 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -99,7 +99,7 @@ void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size) free(label); } -void print_unknown_chip(const sensors_chip_name *name) +void print_chip_raw(const sensors_chip_name *name) { int a; const sensors_feature_data *data; diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index 45c58f8b..7b46e23d 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -22,7 +22,7 @@ #include "lib/sensors.h" -extern void print_unknown_chip(const sensors_chip_name *name); +extern void print_chip_raw(const sensors_chip_name *name); /* some functions used by chips_generic.c */ #define HYST 0 diff --git a/prog/sensors/main.c b/prog/sensors/main.c index fec6aa65..8b91a645 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -54,7 +54,7 @@ static const char *sprintf_chip_name(const sensors_chip_name *name); #define CHIPS_MAX 20 sensors_chip_name chips[CHIPS_MAX]; int chips_count=0; -int do_sets, do_unknown, fahrenheit, hide_adapter; +int do_sets, do_raw, fahrenheit, hide_adapter; char degstr[5]; /* store the correct string to print degrees */ @@ -71,7 +71,7 @@ void print_long_help(void) printf(" -s, --set Execute `set' statements too (root only)\n"); printf(" -f, --fahrenheit Show temperatures in degrees fahrenheit\n"); printf(" -A, --no-adapter Do not show adapter for each chip\n"); - printf(" -u, --unknown Treat chips as unknown ones (testing only)\n"); + printf(" -u Raw output (debugging only)\n"); printf(" -v, --version Display the program version\n"); printf("\n"); printf("Use `-' after `-c' to read the config file from stdin.\n"); @@ -156,13 +156,12 @@ int main (int argc, char *argv[]) { "fahrenheit", no_argument, NULL, 'f' }, { "no-adapter", no_argument, NULL, 'A' }, { "config-file", required_argument, NULL, 'c' }, - { "unknown", no_argument, NULL, 'u' }, { 0,0,0,0 } }; setlocale(LC_CTYPE, ""); - do_unknown = 0; + do_raw = 0; do_sets = 0; hide_adapter = 0; while (1) { @@ -193,7 +192,7 @@ int main (int argc, char *argv[]) hide_adapter = 1; break; case 'u': - do_unknown = 1; + do_raw = 1; break; default: fprintf(stderr,"Internal error while parsing options!\n"); @@ -308,8 +307,8 @@ void do_a_print(const sensors_chip_name *name) else fprintf(stderr, "Can't get adapter name\n"); } - if (do_unknown) - print_unknown_chip(name); + if (do_raw) + print_chip_raw(name); else print_generic_chip(name); printf("\n"); diff --git a/prog/sensors/sensors.1 b/prog/sensors/sensors.1 index fd0b60d8..b0c73722 100644 --- a/prog/sensors/sensors.1 +++ b/prog/sensors/sensors.1 @@ -59,8 +59,7 @@ is evaluated. .IP -A Do not show the adapter for each chip. .IP -u -Treat all chips as unknown ones. Output will be of much lower quality; -this option is only added for testing purposes. +Raw output. This mode is only meant for debugging. .IP -v Print the program version and exit. .IP -f From 0c24a60643b7014b081cebde117ea3255fdd27e6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 23 Aug 2007 08:14:48 +0000 Subject: [PATCH 194/718] Drop the CONFORMING TO sections from the man pages. lm-sensors is in no way an official standard so it doesn't make much sense. Instead, use the 4th field of .TH to mention that these tools are part of lm-sensors. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4699 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/libsensors.3 | 5 +---- lib/sensors.conf.5 | 4 +--- prog/detect/sensors-detect.8 | 5 +---- prog/pwm/fancontrol.8 | 5 +---- prog/pwm/pwmconfig.8 | 5 +---- prog/sensord/sensord.8 | 5 ++--- prog/sensors/sensors.1 | 5 ++--- 8 files changed, 10 insertions(+), 25 deletions(-) diff --git a/CHANGES b/CHANGES index b0f59981..8e7dcb58 100644 --- a/CHANGES +++ b/CHANGES @@ -25,6 +25,7 @@ SVN HEAD Drop support for dashes in chip names Add support for devices on SPI adapters Makefile: Drop the package and version targets + Man pages: Drop "conforming to" sections Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete Programs i2cdump, i2cget, i2cset: Do not force the slave address by default diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 4840bfa4..0932d9f2 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -24,7 +24,7 @@ .\" .\" References consulted: .\" libsensors source code -.TH libsensors 3 "June 2007" "" "Linux Programmer's Manual" +.TH libsensors 3 "June 2007" "lm-sensors 3" "Linux Programmer's Manual" .SH NAME libsensors \- publicly accessible functions provided by the sensors library .SH SYNOPSIS @@ -139,9 +139,6 @@ will corrupt internal data structures. .br A string representing the version of libsensors. - -.SH "CONFORMING TO" -lm_sensors-2.x .SH SEE ALSO sensors.conf(5) diff --git a/lib/sensors.conf.5 b/lib/sensors.conf.5 index f1a14a0a..8bd5b737 100644 --- a/lib/sensors.conf.5 +++ b/lib/sensors.conf.5 @@ -23,7 +23,7 @@ .\" .\" References consulted: .\" sensors.conf.eg by Frodo Looijaard -.TH sensors.conf 5 "June 2007" "" "Linux Programmer's Manual" +.TH sensors.conf 5 "June 2007" "lm-sensors 3" "Linux Programmer's Manual" .SH NAME sensors.conf \- libsensors configuration file @@ -398,8 +398,6 @@ the feature is in the same class as the feature the statement contains, and there is anywhere else a statement for this specific class member, that one takes always precedence. -.SH "CONFORMING TO" -lm_sensors-2.x .SH SEE ALSO libsensors(3) diff --git a/prog/detect/sensors-detect.8 b/prog/detect/sensors-detect.8 index f210ee07..30d34a61 100644 --- a/prog/detect/sensors-detect.8 +++ b/prog/detect/sensors-detect.8 @@ -1,4 +1,4 @@ -.TH SENSORS-DETECT 8 "March 2004" +.TH SENSORS-DETECT 8 "March 2004" "lm-sensors 3" .SH NAME sensors-detect \- detect hardware monitoring chips @@ -11,9 +11,6 @@ process of scanning your system for various hardware monitoring chips, or sensors, supported by libsensors(3), or more generally by the lm_sensors tool suite. -.SH CONFORMING TO -lm_sensors-2.x - .SH SEE ALSO sensors(1), libsensors(3), i2cdetect(8) diff --git a/prog/pwm/fancontrol.8 b/prog/pwm/fancontrol.8 index 1a50743d..e7a5385f 100644 --- a/prog/pwm/fancontrol.8 +++ b/prog/pwm/fancontrol.8 @@ -1,4 +1,4 @@ -.TH FANCONTROL 8 "June 2007" +.TH FANCONTROL 8 "June 2007" "lm-sensors 3" .SH NAME fancontrol \- automated software based fan speed regulation @@ -102,9 +102,6 @@ new values are written to the PWM outputs. Currently the speed increases quadratically with rising temperature. This way you won't hear your fans most of the time at best. -.SH CONFORMING TO -lm_sensors-2.x - .SH SEE ALSO pwmconfig(8), sensors(1). diff --git a/prog/pwm/pwmconfig.8 b/prog/pwm/pwmconfig.8 index 6d50f729..a535d309 100644 --- a/prog/pwm/pwmconfig.8 +++ b/prog/pwm/pwmconfig.8 @@ -1,4 +1,4 @@ -.TH PWMCONFIG 8 "January 27, 2005" +.TH PWMCONFIG 8 "January 27, 2005" "lm-sensors 3" .SH NAME pwmconfig \- tests the PWM outputs of sensors and configures fancontrol @@ -22,9 +22,6 @@ This program will stop your fans, one at a time, for approximately 5 seconds eac This may cause your processor temperature to rise. Verify that all fans are running at normal speed after this program has exited. -.SH CONFORMING TO -lm_sensors-2.x - .SH SEE ALSO fancontrol(8), sensors(1). diff --git a/prog/sensord/sensord.8 b/prog/sensord/sensord.8 index 96641fa3..b3f99074 100644 --- a/prog/sensord/sensord.8 +++ b/prog/sensord/sensord.8 @@ -21,7 +21,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH sensord 8 "October 23, 2002" "Version 0.6.3" "Linux System Administration" +.TH sensord 8 "October 23, 2002" "lm-sensors 3" "Linux System Administration" .SH NAME sensord \- Sensor information logging daemon. .SH SYNOPSIS @@ -407,8 +407,7 @@ configuration file. See .BR syslog.conf (5) for further details. .RE -.SH "CONFORMING TO" -lm_sensors-2.x + .SH SEE ALSO sensors.conf(5) .SH AUTHORS diff --git a/prog/sensors/sensors.1 b/prog/sensors/sensors.1 index b0c73722..a4d2b558 100644 --- a/prog/sensors/sensors.1 +++ b/prog/sensors/sensors.1 @@ -22,7 +22,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH sensors 1 "August 2007" "" "Linux User's Manual" +.TH sensors 1 "August 2007" "lm-sensors 3" "Linux User's Manual" .SH NAME sensors \- print sensors information .SH SYNOPSIS @@ -71,8 +71,7 @@ The system wide configuration file. See .BR sensors.conf (5) for further details. .RE -.SH "CONFORMING TO" -lm_sensors-2.x + .SH SEE ALSO sensors.conf(5) From ff4cfd53d5444164e76ddbed1a0623ebcf4fc218 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 25 Aug 2007 11:49:07 +0000 Subject: [PATCH 195/718] Delete file BUGS. All documented bugs are in kernel drivers so the information no longer belongs to this package. Most of it seems to be outdated anyway. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4700 7894878c-1315-0410-8ee3-d5d059ff63e0 --- BUGS | 79 --------------------------------------------------------- CHANGES | 1 + 2 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 BUGS diff --git a/BUGS b/BUGS deleted file mode 100644 index 9126dd8c..00000000 --- a/BUGS +++ /dev/null @@ -1,79 +0,0 @@ -Except for many unimplemented things (listed in the TODO file), there may be -true bugs too. If you experience any problems not listed here, do not hesitate -to mail us (see http://www.lm-sensors.org/wiki/FeedbackAndSupport). -But read this file and doc/FAQ first, please! - -============================================================================ -These are current problems with specific programs and drivers. -In general, please don't send us mail telling us you have the -same problem!! Do send us mail if you have a fix!! - - -================================ -Asus boards - as99127f support (w83781d driver) - -Several problems. Asus will not release a datasheet. -Support was developed - and tweaked - with experimentation and user feedback. -These will not be fixed unless we get a datasheet. -If you have problems, please lobby Asus to release a datasheet. -Unfortunately, several others have done so, without success. -Please do not send mail to us asking for better as99127f support. -We have done the best we can without a datasheet. -The changes we do make to please some people generally makes -things worse for people with other types of motherboard. -Please do not send mail to the author or the sensors group asking for -a datasheet or ideas on how to convince Asus. -See doc/chips/w83781d for more information. - -================================ -i2c/smbus lockup (i2c-piix4 and i2c-ali15x3 drivers) - -Sometimes the i2c bus will get hung and the driver can't un-hang it. -If this is caused by a hung sensor chip (mtp008 and w83781d chips may -be culprits), only a reboot or even power cycle will clear it -(if the SDRAM eeproms are on the hung i2c bus, the machine probably won't -boot until the power is cycled). -If there are bugs in the i2c bus drivers, or improvements we can make to -error recovery, we don't know what they are. - -On the ASUS P5A motherboard, there are several reports that -the SMBus will hang and this can only be resolved by -powering off the computer. It appears to be worse when the board -gets hot, for example under heavy CPU load, or in the summer. -There may be electrical problems on this board. -On the P5A, the W83781D sensor chip is on both the ISA and -SMBus. Therefore the SMBus hangs can generally be avoided -by accessing the W83781D on the ISA bus only. - -================================ -IBM Thinkpad laptops and sensors-detect -See the file README.thinkpad - - -================================ -mtp008 support - -This chip does not always respond, as evidenced by 'XX' fields -in i2cdump. Results in non-detection by sensors-detect and/or -the mtp008 driver, or periodic bad readings. -Cause unknown - perhaps a bug in the chip, or the chip -not meeting the i2c specifications. - - -================================ -sis5595 (sis5595 and i2c-sis5595 drivers) - -These drivers latch on to many non-sis5595 chips which -do not support sensors, i2c bus, or both. -This is because SiS uses the same PCI ID for several different chips. -This will have to be fixed by us to recognize these other chips. - -Right now, the driver tries -writing the base addresses (using the force_addr=0x.... parameter to modprobe), -it does not work for some machines (dmesg message is "force address failed"). -Either some chips do not support sensors, or there is some undocumented -lock bit for the base address registers. - -Also, the temperature reading in sis5595 is usually wrong. -Different formulas are required for different versions of -the chip and different motherboards. diff --git a/CHANGES b/CHANGES index 8e7dcb58..8f900bcd 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ lm_sensors CHANGES file ----------------------- SVN HEAD + File BUGS: Delete File i2c-dev.h: Support I2C block reads with specified length All bus modules and documentation: Delete All chip modules and documentation: Delete From 4d6bec8bb2a8076c3d256b1e46b49014eba530ab Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 08:26:20 +0000 Subject: [PATCH 196/718] Add a parameter to sensors_get_detected_chips(), to optionally let the caller select which subset of chips it wants. This is slightly better size-wise than letting all applications do the filtering by themselves. This will change the way the command line parameters of "sensors" are interpreted. Beforehand, the chips were always returned in the order in which they were listed by the library. Also, each chip could be listed only once. From now on, the chips will be listed in the order in which they are passed on the command line, which I think makes more sense. A side effect is that chips can be listed more than once, if that's what the user asks for. Not very useful though. This change makes it possible to make sensors_match_chip() internal to the library. Filtering the list of chips returned by sensors_get_detected_chips() was the last known external use for this function. This patch looks much bigger than it really is, but the largest part is really only code reindentation. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4701 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 25 +++++++++-------- lib/libsensors.3 | 13 ++++++--- lib/sensors.h | 12 +++++---- prog/sensord/rrd.c | 64 +++++++++++++++++++++----------------------- prog/sensord/sense.c | 8 +++--- prog/sensors/main.c | 24 ++++++++--------- 6 files changed, 76 insertions(+), 70 deletions(-) diff --git a/lib/access.c b/lib/access.c index 5048fe16..8327aa3e 100644 --- a/lib/access.c +++ b/lib/access.c @@ -303,13 +303,17 @@ int sensors_set_value(const sensors_chip_name *name, int feature, return 0; } -const sensors_chip_name *sensors_get_detected_chips(int *nr) +const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name + *match, int *nr) { const sensors_chip_name *res; - res = (*nr >= sensors_proc_chips_count ? - NULL : &sensors_proc_chips[*nr].chip); - (*nr)++; - return res; + + while (*nr < sensors_proc_chips_count) { + res = &sensors_proc_chips[(*nr)++].chip; + if (!match || sensors_match_chip(res, match)) + return res; + } + return NULL; } const char *sensors_get_adapter_name(const sensors_bus_id *bus) @@ -480,12 +484,11 @@ int sensors_do_chip_sets(const sensors_chip_name *name) const sensors_chip_name *found_name; int res = 0; - for (nr = 0; (found_name = sensors_get_detected_chips(&nr));) - if (sensors_match_chip(name, found_name)) { - this_res = sensors_do_this_chip_sets(found_name); - if (!res) - res = this_res; - } + for (nr = 0; (found_name = sensors_get_detected_chips(name, &nr));) { + this_res = sensors_do_this_chip_sets(found_name); + if (this_res) + res = this_res; + } return res; } diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 0932d9f2..ca2e4d73 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -44,7 +44,8 @@ libsensors \- publicly accessible functions provided by the sensors library .B int sensors_set_value(const sensors_chip_name *name, int feature, \fBdouble value);\fP .B int sensors_do_chip_sets(const sensors_chip_name *name); -.B const sensors_chip_name *sensors_get_detected_chips(int *nr); +.B const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name + \fB*match, int *nr);\fP .B const sensors_feature_data *sensors_get_all_features \fB(const sensors_chip_name *name, int *nr);\fP .B const char *libsensors_version; @@ -98,10 +99,14 @@ Set the value of a feature of a certain chip. Note that chip should not contain .br Execute all set statements for this particular chip. The chip may contain wildcards! This function will return 0 on success, and <0 on failure. -\fBconst sensors_chip_name *sensors_get_detected_chips - (int *nr);\fP +\fBconst sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name + *match, int *nr);\fP .br -This function returns all detected chips, one by one. To start at the beginning of the list, use 0 for nr; NULL is returned if we are at the end of the list. Do not try to change these chip names, as they point to internal structures! Do not use nr for anything else. +This function returns all detected chips that match a given chip name, +one by one. If no chip name is provided, all detected chips are returned. +To start at the beginning of the list, use 0 for nr; NULL is returned if +we are at the end of the list. Do not try to change these chip names, as +they point to internal structures! This structure is used when you want to get all features of a specific chip. .br diff --git a/lib/sensors.h b/lib/sensors.h index d707aaac..f98bdd50 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -109,11 +109,13 @@ int sensors_set_value(const sensors_chip_name *name, int feature, wildcards! This function will return 0 on success, and <0 on failure. */ int sensors_do_chip_sets(const sensors_chip_name *name); -/* This function returns all detected chips, one by one. To start at the - beginning of the list, use 0 for nr; NULL is returned if we are - at the end of the list. Do not try to change these chip names, as - they point to internal structures! Do not use nr for anything else. */ -const sensors_chip_name *sensors_get_detected_chips(int *nr); +/* This function returns all detected chips that match a given chip name, + one by one. If no chip name is provided, all detected chips are returned. + To start at the beginning of the list, use 0 for nr; NULL is returned if + we are at the end of the list. Do not try to change these chip names, as + they point to internal structures! */ +const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name + *match, int *nr); /* These defines are used in the mode field of sensors_feature_data */ #define SENSORS_MODE_R 1 diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index 2299aad4..1e5e9452 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -139,41 +139,39 @@ applyToFeatures const sensors_chip_name *chip; int i = 0, j, ret = 0, num = 0; - while ((ret == 0) && ((chip = sensors_get_detected_chips (&i)) != NULL)) { - for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { - if (sensors_match_chip (chip, &chipNames[j])) { - int index0, subindex, chipindex = -1; - for (index0 = 0; knownChips[index0]; ++ index0) - for (subindex = 0; knownChips[index0]->names[subindex]; ++ subindex) - if (!strcmp (chip->prefix, knownChips[index0]->names[subindex])) - chipindex = index0; - if (chipindex >= 0) { - const ChipDescriptor *descriptor = knownChips[chipindex]; - const FeatureDescriptor *features = descriptor->features; + for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { + while ((ret == 0) && ((chip = sensors_get_detected_chips (&chipNames[j], &i)) != NULL)) { + int index0, subindex, chipindex = -1; + for (index0 = 0; knownChips[index0]; ++ index0) + for (subindex = 0; knownChips[index0]->names[subindex]; ++ subindex) + if (!strcmp (chip->prefix, knownChips[index0]->names[subindex])) + chipindex = index0; + if (chipindex >= 0) { + const ChipDescriptor *descriptor = knownChips[chipindex]; + const FeatureDescriptor *features = descriptor->features; - for (index0 = 0; (ret == 0) && (num < MAX_RRD_SENSORS) && features[index0].format; ++ index0) { - const FeatureDescriptor *feature = features + index0; - int labelNumber = feature->dataNumbers[0]; - const char *rawLabel = NULL; - char *label = NULL; - int valid = 0; - if (getValid (chip, labelNumber, &valid)) { - sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber); - ret = -1; - } else if (getRawLabel (chip, labelNumber, &rawLabel)) { - sensorLog (LOG_ERR, "Error getting raw sensor label: %s/#%d", chip->prefix, labelNumber); - ret = -1; - } else if (!(label = sensors_get_label (chip, labelNumber))) { - sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); - ret = -1; - } else if (valid) { - rrdCheckLabel (rawLabel, num); - ret = fn (data, rrdLabels[num], label, feature); - ++ num; - } - if (label) - free (label); + for (index0 = 0; (ret == 0) && (num < MAX_RRD_SENSORS) && features[index0].format; ++ index0) { + const FeatureDescriptor *feature = features + index0; + int labelNumber = feature->dataNumbers[0]; + const char *rawLabel = NULL; + char *label = NULL; + int valid = 0; + if (getValid (chip, labelNumber, &valid)) { + sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber); + ret = -1; + } else if (getRawLabel (chip, labelNumber, &rawLabel)) { + sensorLog (LOG_ERR, "Error getting raw sensor label: %s/#%d", chip->prefix, labelNumber); + ret = -1; + } else if (!(label = sensors_get_label (chip, labelNumber))) { + sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); + ret = -1; + } else if (valid) { + rrdCheckLabel (rawLabel, num); + ret = fn (data, rrdLabels[num], label, feature); + ++ num; } + if (label) + free (label); } } } diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index ded10d26..d6fd8faa 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -238,11 +238,9 @@ doChips const sensors_chip_name *chip; int i = 0, j, ret = 0; - while ((ret == 0) && ((chip = sensors_get_detected_chips (&i)) != NULL)) { - for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { - if (sensors_match_chip (chip, &chipNames[j])) { - ret = doChip (chip, action); - } + for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { + while ((ret == 0) && ((chip = sensors_get_detected_chips (&chipNames[j], &i)) != NULL)) { + ret = doChip (chip, action); } } diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 8b91a645..73416f0b 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -251,18 +251,18 @@ int do_the_real_work(int *error) int cnt = 0; *error = 0; - for (chip_nr = 0; (chip = sensors_get_detected_chips(&chip_nr));) - for(i = 0; i < chips_count; i++) - if (sensors_match_chip(chip, &chips[i])) { - if(do_sets) { - if (do_a_set(chip)) - *error = 1; - } else - do_a_print(chip); - i = chips_count; - cnt++; - } - return(cnt); + for (i = 0; i < chips_count; i++) { + chip_nr = 0; + while ((chip = sensors_get_detected_chips(&chips[i], &chip_nr))) { + if (do_sets) { + if (do_a_set(chip)) + *error = 1; + } else + do_a_print(chip); + cnt++; + } + } + return cnt; } /* returns 1 on error */ From a9a48ea2a9e80a77931646dc129759bf171199fb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 08:26:51 +0000 Subject: [PATCH 197/718] Make sensors_match_chip internal to libsensors. It is no longer used by applications in practice. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4702 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 2 +- lib/libsensors.3 | 7 ------- lib/sensors.h | 5 ----- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/access.c b/lib/access.c index 8327aa3e..64b75c53 100644 --- a/lib/access.c +++ b/lib/access.c @@ -34,7 +34,7 @@ static int sensors_eval_expr(const sensors_chip_name *name, /* Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. */ -int sensors_match_chip(const sensors_chip_name *chip1, +static int sensors_match_chip(const sensors_chip_name *chip1, const sensors_chip_name *chip2) { if ((chip1->prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && diff --git a/lib/libsensors.3 b/lib/libsensors.3 index ca2e4d73..ddd0881c 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -35,8 +35,6 @@ libsensors \- publicly accessible functions provided by the sensors library .B void sensors_cleanup(void); .B int sensors_parse_chip_name(const char *orig_name, \fBsensors_chip_name *res);\fP -.B int sensors_match_chip(const sensors_chip_name *chip1, - \fBconst sensors_chip_name *chip2);\fP .B const char *sensors_get_adapter_name(int bus_nr); .B char *sensors_get_label(const sensors_chip_name *name, int feature);\fP .B int sensors_get_value(const sensors_chip_name *name, int feature, @@ -68,11 +66,6 @@ Clean-up function: You can't access anything after this, until the next sensors_ .br Parse a chip name to the internal representation. Return 0 on succes, <0 on error. -\fBint sensors_match_chip(const sensors_chip_name *chip1, - const sensors_chip_name *chip2);\fP -.br -Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. - .B const char *sensors_get_adapter_name(int bus_nr); .br This function returns the adapter name of a bus number, as used within the diff --git a/lib/sensors.h b/lib/sensors.h index f98bdd50..d1269e19 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -77,11 +77,6 @@ int sensors_parse_chip_name(const char *orig_name, sensors_chip_name *res); int sensors_snprintf_chip_name(char *str, size_t size, const sensors_chip_name *chip); -/* Compare two chips name descriptions, to see whether they could match. - Return 0 if it does not match, return 1 if it does match. */ -int sensors_match_chip(const sensors_chip_name *chip1, - const sensors_chip_name *chip2); - /* This function returns the adapter name of a bus, as used within the sensors_chip_name structure. If it could not be found, it returns NULL */ From b8b417c51edb3f7fca2d06eb4af5f1bdafbc8249 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 08:28:10 +0000 Subject: [PATCH 198/718] Thanks to the new prototype of sensors_get_detected_chips, we no longer need to build an array from the chip names passed on the command line. Instead, we can process them one after the other directly. This saves some memory and allows for minor code cleanups. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4703 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/main.c | 86 +++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 46 deletions(-) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 73416f0b..732db0da 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -48,12 +48,9 @@ static void print_long_help(void); static void print_version(void); static void do_a_print(const sensors_chip_name *name); static int do_a_set(const sensors_chip_name *name); -static int do_the_real_work(int *error); +static int do_the_real_work(const sensors_chip_name *chip, int *error); static const char *sprintf_chip_name(const sensors_chip_name *name); -#define CHIPS_MAX 20 -sensors_chip_name chips[CHIPS_MAX]; -int chips_count=0; int do_sets, do_raw, fahrenheit, hide_adapter; char degstr[5]; /* store the correct string to print degrees */ @@ -200,23 +197,6 @@ int main (int argc, char *argv[]) } } - if (optind == argc) { - chips[0].prefix = SENSORS_CHIP_NAME_PREFIX_ANY; - chips[0].bus.type = SENSORS_BUS_TYPE_ANY; - chips[0].bus.nr = SENSORS_BUS_NR_ANY; - chips[0].addr = SENSORS_CHIP_NAME_ADDR_ANY; - chips_count = 1; - } else - for(i = optind; i < argc; i++) - if ((res = sensors_parse_chip_name(argv[i],chips+chips_count))) { - fprintf(stderr,"Parse error in chip name `%s'\n",argv[i]); - print_short_help(); - exit(1); - } else if (++chips_count == CHIPS_MAX) { - fprintf(stderr,"Too many chips on command line!\n"); - exit(1); - } - open_config_file(config_file_name); if ((res = sensors_init(config_file))) { fprintf(stderr, "sensors_init: %s\n", sensors_strerror(res)); @@ -227,40 +207,54 @@ int main (int argc, char *argv[]) /* build the degrees string */ set_degstr(); - if(do_the_real_work(&error)) { - sensors_cleanup(); - exit(error); + if (optind == argc) { /* No chip name on command line */ + if (!do_the_real_work(NULL, &error)) { + fprintf(stderr, + "No sensors found!\n" + "Make sure you loaded all the kernel drivers you need.\n" + "Try sensors-detect to find out which these are.\n"); + error = 1; + } } else { - if (optind == argc) /* No chip name on command line */ - fprintf(stderr, - "No sensors found!\n" - "Make sure you loaded all the kernel drivers you need.\n" - "Try sensors-detect to find out which these are.\n"); - else - fprintf(stderr,"Specified sensor(s) not found!\n"); - sensors_cleanup(); - exit(1); + int cnt = 0; + sensors_chip_name chip; + + for (i = optind; i < argc; i++) { + if (sensors_parse_chip_name(argv[i], &chip)) { + fprintf(stderr, "Parse error in chip name `%s'\n", argv[i]); + print_short_help(); + error = 1; + goto exit; + } + cnt += do_the_real_work(&chip, &error); + } + + if (!cnt) { + fprintf(stderr, "Specified sensor(s) not found!\n"); + error = 1; + } } + +exit: + sensors_cleanup(); + exit(res); } /* returns number of chips found */ -int do_the_real_work(int *error) +int do_the_real_work(const sensors_chip_name *match, int *error) { const sensors_chip_name *chip; - int chip_nr,i; + int chip_nr; int cnt = 0; - *error = 0; - for (i = 0; i < chips_count; i++) { - chip_nr = 0; - while ((chip = sensors_get_detected_chips(&chips[i], &chip_nr))) { - if (do_sets) { - if (do_a_set(chip)) - *error = 1; - } else - do_a_print(chip); - cnt++; - } + chip_nr = 0; + while ((chip = sensors_get_detected_chips(match, &chip_nr))) { + if (do_sets) { + if (do_a_set(chip)) + *error = 1; + } else + do_a_print(chip); + cnt++; } return cnt; } From ec8ba95b536367ef9e647c0fb2c7b7d78b8c9f9b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 08:42:20 +0000 Subject: [PATCH 199/718] Refactor the configuration file path. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4704 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 732db0da..8e09cb80 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -38,7 +38,7 @@ #define PROGRAM "sensors" #define VERSION LM_VERSION -#define DEFAULT_CONFIG_FILE_NAME "sensors.conf" +#define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" FILE *config_file; @@ -63,7 +63,8 @@ void print_short_help(void) void print_long_help(void) { printf("Usage: %s [OPTION]... [CHIP]...\n",PROGRAM); - printf(" -c, --config-file Specify a config file (default: " ETCDIR "/" DEFAULT_CONFIG_FILE_NAME ")\n"); + printf(" -c, --config-file Specify a config file (default: %s)\n", + DEFAULT_CONFIG_FILE); printf(" -h, --help Display this help text\n"); printf(" -s, --set Execute `set' statements too (root only)\n"); printf(" -f, --fahrenheit Show temperatures in degrees fahrenheit\n"); @@ -144,7 +145,7 @@ static void set_degstr(void) int main (int argc, char *argv[]) { int c,res,i,error; - const char *config_file_name = ETCDIR "/" DEFAULT_CONFIG_FILE_NAME; + const char *config_file_name = DEFAULT_CONFIG_FILE; struct option long_opts[] = { { "help", no_argument, NULL, 'h' }, From 5ba408a37ff0b55ddfca4ead1c6719a8da162aa2 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 08:43:30 +0000 Subject: [PATCH 200/718] Merge most of the usage help text into a single string. This is way more efficient. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4705 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/main.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 8e09cb80..6bcb4f62 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -65,23 +65,23 @@ void print_long_help(void) printf("Usage: %s [OPTION]... [CHIP]...\n",PROGRAM); printf(" -c, --config-file Specify a config file (default: %s)\n", DEFAULT_CONFIG_FILE); - printf(" -h, --help Display this help text\n"); - printf(" -s, --set Execute `set' statements too (root only)\n"); - printf(" -f, --fahrenheit Show temperatures in degrees fahrenheit\n"); - printf(" -A, --no-adapter Do not show adapter for each chip\n"); - printf(" -u Raw output (debugging only)\n"); - printf(" -v, --version Display the program version\n"); - printf("\n"); - printf("Use `-' after `-c' to read the config file from stdin.\n"); - printf("If no chips are specified, all chip info will be printed.\n"); - printf("Example chip names:\n"); - printf("\tlm78-i2c-0-2d\t*-i2c-0-2d\n"); - printf("\tlm78-i2c-0-*\t*-i2c-0-*\n"); - printf("\tlm78-i2c-*-2d\t*-i2c-*-2d\n"); - printf("\tlm78-i2c-*-*\t*-i2c-*-*\n"); - printf("\tlm78-isa-0290\t*-isa-0290\n"); - printf("\tlm78-isa-*\t*-isa-*\n"); - printf("\tlm78-*\n"); + puts(" -h, --help Display this help text\n" + " -s, --set Execute `set' statements too (root only)\n" + " -f, --fahrenheit Show temperatures in degrees fahrenheit\n" + " -A, --no-adapter Do not show adapter for each chip\n" + " -u Raw output (debugging only)\n" + " -v, --version Display the program version\n" + "\n" + "Use `-' after `-c' to read the config file from stdin.\n" + "If no chips are specified, all chip info will be printed.\n" + "Example chip names:\n" + "\tlm78-i2c-0-2d\t*-i2c-0-2d\n" + "\tlm78-i2c-0-*\t*-i2c-0-*\n" + "\tlm78-i2c-*-2d\t*-i2c-*-2d\n" + "\tlm78-i2c-*-*\t*-i2c-*-*\n" + "\tlm78-isa-0290\t*-isa-0290\n" + "\tlm78-isa-*\t*-isa-*\n" + "\tlm78-*"); } void print_version(void) From c91457b7de239a2d07a1c79f157d5d3e734d560a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 08:57:48 +0000 Subject: [PATCH 201/718] Executing the set statements is an exclusive action. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4706 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/args.c | 2 +- prog/sensors/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/prog/sensord/args.c b/prog/sensord/args.c index 923186b2..9113f122 100644 --- a/prog/sensord/args.c +++ b/prog/sensord/args.c @@ -125,7 +125,7 @@ static const char *daemonSyntax = static const char *appSyntax = " -a, --alarm-scan -- only scan for alarms\n" - " -s, --set -- execute set statements too (root only)\n" + " -s, --set -- execute set statements (root only)\n" " -r, --rrd-file -- only update RRD file\n" " -c, --config-file -- configuration file (default sensors.conf)\n" " -d, --debug -- display some debug information\n" diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 6bcb4f62..d6f387d6 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -66,7 +66,7 @@ void print_long_help(void) printf(" -c, --config-file Specify a config file (default: %s)\n", DEFAULT_CONFIG_FILE); puts(" -h, --help Display this help text\n" - " -s, --set Execute `set' statements too (root only)\n" + " -s, --set Execute `set' statements (root only)\n" " -f, --fahrenheit Show temperatures in degrees fahrenheit\n" " -A, --no-adapter Do not show adapter for each chip\n" " -u Raw output (debugging only)\n" From 252c5faf86fa7e5ff6b57689290844ec30a6c1ee Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 10:57:16 +0000 Subject: [PATCH 202/718] Mass reindent and coding style cleanups. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4708 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 145 ++++----- prog/sensors/chips.h | 4 +- prog/sensors/chips_generic.c | 575 ++++++++++++++++++----------------- prog/sensors/main.c | 390 ++++++++++++------------ 4 files changed, 568 insertions(+), 546 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index ffaf4b08..2bcf0b54 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -32,7 +32,7 @@ extern char degstr[5]; static inline float deg_ctof(float cel) { - return ( cel * ( 9.0F / 5.0F ) + 32.0F ); + return cel * (9.0F / 5.0F) + 32.0F; } /* minmax = 0 for limit/hysteresis, 1 for max/min, 2 for max only; @@ -40,90 +40,93 @@ static inline float deg_ctof(float cel) for the current temp and the limits note: symbolic constants defined in chips.h */ void print_temp_info(float n_cur, float n_over, float n_hyst, - int minmax, int curprec, int limitprec) + int minmax, int curprec, int limitprec) { - /* note: deg_ctof() will preserve HUGEVAL */ - if (fahrenheit) { - n_cur = deg_ctof(n_cur); - n_over = deg_ctof(n_over); - n_hyst = deg_ctof(n_hyst); - } + /* note: deg_ctof() will preserve HUGEVAL */ + if (fahrenheit) { + n_cur = deg_ctof(n_cur); + n_over = deg_ctof(n_over); + n_hyst = deg_ctof(n_hyst); + } - /* use %* to pass precision as an argument */ - if (n_cur != HUGE_VAL) - printf("%+6.*f%s ", curprec, n_cur, degstr); - else - printf(" FAULT "); + /* use %* to pass precision as an argument */ + if (n_cur != HUGE_VAL) + printf("%+6.*f%s ", curprec, n_cur, degstr); + else + printf(" FAULT "); - if(minmax == MINMAX) - printf("(low = %+5.*f%s, high = %+5.*f%s) ", - limitprec, n_hyst, degstr, - limitprec, n_over, degstr); - else if(minmax == MAXONLY) - printf("(high = %+5.*f%s) ", - limitprec, n_over, degstr); - else if(minmax == CRIT) - printf("(high = %+5.*f%s, crit = %+5.*f%s) ", - limitprec, n_over, degstr, - limitprec, n_hyst, degstr); - else if(minmax == HYST) - printf("(high = %+5.*f%s, hyst = %+5.*f%s) ", - limitprec, n_over, degstr, - limitprec, n_hyst, degstr); - else if(minmax == HYSTONLY) - printf("(hyst = %+5.*f%s) ", - limitprec, n_over, degstr); - else if(minmax != SINGLE) - printf("Unknown temperature mode!"); + if (minmax == MINMAX) + printf("(low = %+5.*f%s, high = %+5.*f%s) ", + limitprec, n_hyst, degstr, + limitprec, n_over, degstr); + else if (minmax == MAXONLY) + printf("(high = %+5.*f%s) ", + limitprec, n_over, degstr); + else if (minmax == CRIT) + printf("(high = %+5.*f%s, crit = %+5.*f%s) ", + limitprec, n_over, degstr, + limitprec, n_hyst, degstr); + else if (minmax == HYST) + printf("(high = %+5.*f%s, hyst = %+5.*f%s) ", + limitprec, n_over, degstr, + limitprec, n_hyst, degstr); + else if (minmax == HYSTONLY) + printf("(hyst = %+5.*f%s) ", + limitprec, n_over, degstr); + else if (minmax != SINGLE) + printf("Unknown temperature mode!"); } void print_label(const char *label, int space) { - int len=strlen(label)+1; - if (len > space) - printf("%s:\n%*s", label, space, ""); - else - printf("%s:%*s", label, space - len, ""); + int len = strlen(label)+1; + if (len > space) + printf("%s:\n%*s", label, space, ""); + else + printf("%s:%*s", label, space - len, ""); } void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size) { - char *label; - double vid; + char *label; + double vid; - if ((label = sensors_get_label(name, f_vid)) - && !sensors_get_value(name, f_vid, &vid)) { - print_label(label, label_size); - printf("%+6.3f V\n", vid); - } - free(label); + if ((label = sensors_get_label(name, f_vid)) + && !sensors_get_value(name, f_vid, &vid)) { + print_label(label, label_size); + printf("%+6.3f V\n", vid); + } + free(label); } void print_chip_raw(const sensors_chip_name *name) { - int a; - const sensors_feature_data *data; - char *label; - double val; - - a = 0; - while((data=sensors_get_all_features(name, &a))) { - if (!(label = sensors_get_label(name, data->number))) { - printf("ERROR: Can't get feature `%s' data!\n",data->name); - continue; - } - if (data->mode & SENSORS_MODE_R) { - if (sensors_get_value(name, data->number, &val)) { - printf("ERROR: Can't get feature `%s' data!\n",data->name); - continue; - } - if (data->mapping != SENSORS_NO_MAPPING) - printf(" %s: %.2f (%s)\n",label,val,data->name); - else - printf("%s: %.2f (%s)\n",label,val,data->name); - } else - printf("(%s)\n",label); - free(label); - } -} + int a; + const sensors_feature_data *data; + char *label; + double val; + a = 0; + while ((data = sensors_get_all_features(name, &a))) { + if (!(label = sensors_get_label(name, data->number))) { + printf("ERROR: Can't get feature `%s' data!\n", + data->name); + continue; + } + if (data->mode & SENSORS_MODE_R) { + if (sensors_get_value(name, data->number, &val)) { + printf("ERROR: Can't get feature `%s' data!\n", + data->name); + continue; + } + if (data->mapping != SENSORS_NO_MAPPING) + printf(" %s: %.2f (%s)\n", label, val, + data->name); + else + printf("%s: %.2f (%s)\n", label, val, + data->name); + } else + printf("(%s)\n", label); + free(label); + } +} diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index 7b46e23d..1ce18286 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -32,8 +32,8 @@ extern void print_chip_raw(const sensors_chip_name *name); #define SINGLE 4 #define HYSTONLY 5 void print_temp_info(float n_cur, float n_over, float n_hyst, - int minmax, int curprec, int limitprec); - + int minmax, int curprec, int limitprec); + void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size); void print_label(const char *label, int space); diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c index 1cd13e6d..71460b8f 100644 --- a/prog/sensors/chips_generic.c +++ b/prog/sensors/chips_generic.c @@ -26,55 +26,53 @@ #include "chips_generic.h" #include "chips.h" -static int get_feature_value(const sensors_chip_name *name, - const sensors_feature_data *feature, - double *val) +static int get_feature_value(const sensors_chip_name *name, + const sensors_feature_data *feature, + double *val) { - return sensors_get_value(name, feature->number, val); + return sensors_get_value(name, feature->number, val); } -static void sensors_get_available_features(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, - short *has_features, - double *feature_vals, - int size, - int first_val) +static void sensors_get_available_features(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, short *has_features, + double *feature_vals, int size, + int first_val) { - const sensors_feature_data *iter; - - while((iter = sensors_get_all_features(name, &i)) && - iter->mapping == feature->number) { - int indx; - - indx = iter->type - first_val - 1; - if (indx < 0 || indx >= size) { - printf("ERROR: Bug in sensors: index out of bound"); - return; - } - - if (get_feature_value(name, iter, &feature_vals[indx])) - printf("ERROR: Can't get %s data!\n", iter->name); - - has_features[indx] = 1; - } + const sensors_feature_data *iter; + + while ((iter = sensors_get_all_features(name, &i)) && + iter->mapping == feature->number) { + int indx; + + indx = iter->type - first_val - 1; + if (indx < 0 || indx >= size) { + printf("ERROR: Bug in sensors: index out of bound"); + return; + } + + if (get_feature_value(name, iter, &feature_vals[indx])) + printf("ERROR: Can't get %s data!\n", iter->name); + + has_features[indx] = 1; + } } static int sensors_get_label_size(const sensors_chip_name *name) { - int i; - const sensors_feature_data *iter; - char *label; - unsigned int max_size = 11; /* Initialised to 11 as minumum label-width */ + int i; + const sensors_feature_data *iter; + char *label; + unsigned int max_size = 11; /* 11 as minumum label width */ - i = 0; - while((iter = sensors_get_all_features(name, &i))) { - if ((label = sensors_get_label(name, iter->number)) && - strlen(label) > max_size) - max_size = strlen(label); - free(label); - } - return max_size + 1; + i = 0; + while ((iter = sensors_get_all_features(name, &i))) { + if ((label = sensors_get_label(name, iter->number)) && + strlen(label) > max_size) + max_size = strlen(label); + free(label); + } + return max_size + 1; } extern int fahrenheit; @@ -82,261 +80,276 @@ extern char degstr[5]; static inline float deg_ctof(float cel) { - return ( cel * ( 9.0F / 5.0F ) + 32.0F ); + return cel * (9.0F / 5.0F) + 32.0F; } -#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] -#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] -static void print_generic_chip_temp(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int label_size) +#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] +#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] +static void print_generic_chip_temp(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int label_size) { - double val, max, min; - char *label; - int type; - const int size = SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP; - short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0, }; - double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = {0.0, }; - - if (!(label = sensors_get_label(name, feature->number))) { - printf("ERROR: Can't get temperature label!\n"); - return; - } - - if (get_feature_value(name, feature, &val)) { - printf("ERROR: Can't get %s data!\n", label); - free(label); - return; - } - - sensors_get_available_features(name, feature, i, has_features, - feature_vals, size, SENSORS_FEATURE_TEMP); - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { - max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN); - type = MINMAX; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST); - type = HYST; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); - type = CRIT; - } else { - min = 0; - type = MAXONLY; - } - } else { - min = max = 0; - type = SINGLE; - } - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT)) - val = HUGE_VAL; - - print_label(label, label_size); - free(label); - - print_temp_info(val, max, min, type, 1, 1); - - /* ALARM features */ - if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) - || (type == MINMAX && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM) > 0.5) - || (type == MINMAX && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM) > 0.5) - || (type == CRIT && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5)) { - printf("ALARM "); - } - - if (type != CRIT && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - if (fahrenheit) { - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT) = deg_ctof( - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT)); - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST) = deg_ctof( - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST)); - } - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) - printf("\n%*s(crit = %+5.1f%s, hyst = %+5.1f%s) ", label_size + 10, "", - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), degstr, - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST), degstr); - else - printf("\n%*s(crit = %+5.1f%s) ", label_size + 10, "", - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), degstr); + double val, max, min; + char *label; + int type; + const int size = SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP; + short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0, }; + double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0.0, }; - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) { - printf("ALARM "); - } - } + if (!(label = sensors_get_label(name, feature->number))) { + printf("ERROR: Can't get temperature label!\n"); + return; + } - /* print out temperature sensor info */ - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { - int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_SENS); - - /* older kernels / drivers sometimes report a beta value for thermistors */ - if (sens > 1000) - sens = 4; - - printf("sensor = %s", sens == 0 ? "disabled" : - sens == 1 ? "diode" : - sens == 2 ? "transistor" : - sens == 3 ? "thermal diode" : - sens == 4 ? "thermistor" : - sens == 5 ? "AMD AMDSI" : - sens == 6 ? "Intel PECI" : - "unknown"); - } - printf("\n"); + if (get_feature_value(name, feature, &val)) { + printf("ERROR: Can't get %s data!\n", label); + free(label); + return; + } + + sensors_get_available_features(name, feature, i, has_features, + feature_vals, size, + SENSORS_FEATURE_TEMP); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { + max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN); + type = MINMAX; + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST); + type = HYST; + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + type = CRIT; + } else { + min = 0; + type = MAXONLY; + } + } else { + min = max = 0; + type = SINGLE; + } + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT)) + val = HUGE_VAL; + + print_label(label, label_size); + free(label); + + print_temp_info(val, max, min, type, 1, 1); + + /* ALARM features */ + if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) + || (type == MINMAX && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM) > 0.5) + || (type == MINMAX && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM) > 0.5) + || (type == CRIT && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5)) { + printf("ALARM "); + } + + if (type != CRIT && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { + if (fahrenheit) { + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT) = deg_ctof( + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT)); + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST) = deg_ctof( + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST)); + } + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) + printf("\n%*s(crit = %+5.1f%s, hyst = %+5.1f%s) ", + label_size + 10, "", + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), + degstr, + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST), + degstr); + else + printf("\n%*s(crit = %+5.1f%s) ", + label_size + 10, "", + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), + degstr); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) { + printf("ALARM "); + } + } + + /* print out temperature sensor info */ + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { + int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_SENS); + + /* older kernels / drivers sometimes report a beta value for + thermistors */ + if (sens > 1000) + sens = 4; + + printf("sensor = %s", sens == 0 ? "disabled" : + sens == 1 ? "diode" : + sens == 2 ? "transistor" : + sens == 3 ? "thermal diode" : + sens == 4 ? "thermistor" : + sens == 5 ? "AMD AMDSI" : + sens == 6 ? "Intel PECI" : "unknown"); + } + printf("\n"); } -#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] -#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] -static void print_generic_chip_in(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int label_size) +#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] +#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] +static void print_generic_chip_in(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int label_size) { - const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; - short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0, }; - double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = {0.0, }; - double val, alarm_max, alarm_min; - char *label; - - if (!(label = sensors_get_label(name, feature->number))) { - printf("ERROR: Can't get in label!\n"); - return; - } - - if (get_feature_value(name, feature, &val)) { - printf("ERROR: Can't get %s data!\n", label); - free(label); - return; - } - - sensors_get_available_features(name, feature, i, has_features, feature_vals, - size, SENSORS_FEATURE_IN); - - print_label(label, label_size); - free(label); - printf("%+6.2f V", val); - - if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && IN_FEATURE(SENSORS_FEATURE_IN_MAX)) - printf(" (min = %+6.2f V, max = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN), - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); - else if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) - printf(" (min = %+6.2f V)", IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN)); - else if (IN_FEATURE(SENSORS_FEATURE_IN_MAX)) - printf(" (max = %+6.2f V)", IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); - - if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM) || - IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { - alarm_max = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX_ALARM); - alarm_min = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN_ALARM); - - if (alarm_min || alarm_max) { - printf(" ALARM ("); - - if (alarm_min) - printf("MIN"); - if (alarm_max) - printf("%sMAX", (alarm_min) ? ", " : ""); - - printf(")"); - } - } else if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { - printf(" %s", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_ALARM) ? "ALARM" : ""); - } - - printf("\n"); + const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; + short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0, }; + double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0.0, }; + double val, alarm_max, alarm_min; + char *label; + + if (!(label = sensors_get_label(name, feature->number))) { + printf("ERROR: Can't get in label!\n"); + return; + } + + if (get_feature_value(name, feature, &val)) { + printf("ERROR: Can't get %s data!\n", label); + free(label); + return; + } + + sensors_get_available_features(name, feature, i, has_features, + feature_vals, size, SENSORS_FEATURE_IN); + + print_label(label, label_size); + free(label); + printf("%+6.2f V", val); + + if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && + IN_FEATURE(SENSORS_FEATURE_IN_MAX)) + printf(" (min = %+6.2f V, max = %+6.2f V)", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN), + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); + else if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) + printf(" (min = %+6.2f V)", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN)); + else if (IN_FEATURE(SENSORS_FEATURE_IN_MAX)) + printf(" (max = %+6.2f V)", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); + + if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM) || + IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { + alarm_max = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX_ALARM); + alarm_min = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN_ALARM); + + if (alarm_min || alarm_max) { + printf(" ALARM ("); + + if (alarm_min) + printf("MIN"); + if (alarm_max) + printf("%sMAX", (alarm_min) ? ", " : ""); + + printf(")"); + } + } else if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { + printf(" %s", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_ALARM) ? "ALARM" : ""); + } + + printf("\n"); } -#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] -#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] -static void print_generic_chip_fan(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int label_size) +#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] +#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] +static void print_generic_chip_fan(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int label_size) { - char *label; - const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; - short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = {0, }; - double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = {0.0, }; - double val; - - if (!(label = sensors_get_label(name, feature->number))) { - printf("ERROR: Can't get fan label!\n"); - return; - } - - if (get_feature_value(name, feature, &val)) - { - printf("ERROR: Can't get %s data!\n", label); - free(label); - return; - } - - print_label(label, label_size); - free(label); + char *label; + const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; + short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0, }; + double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0.0, }; + double val; - if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) - printf(" FAULT"); - else - printf("%4.0f RPM", val); - - sensors_get_available_features(name, feature, i, has_features, feature_vals, - size, SENSORS_FEATURE_FAN); - - if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN) && - FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) - printf(" (min = %4.0f RPM, div = %1.0f)", - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN), - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); - else if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) - printf(" (min = %4.0f RPM)", FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN)); - else if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) - printf(" (div = %1.0f)", FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); - - if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM) && - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_ALARM)) { - printf(" ALARM"); - } - - printf("\n"); + if (!(label = sensors_get_label(name, feature->number))) { + printf("ERROR: Can't get fan label!\n"); + return; + } + + if (get_feature_value(name, feature, &val)) { + printf("ERROR: Can't get %s data!\n", label); + free(label); + return; + } + + print_label(label, label_size); + free(label); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) + printf(" FAULT"); + else + printf("%4.0f RPM", val); + + sensors_get_available_features(name, feature, i, has_features, + feature_vals, size, SENSORS_FEATURE_FAN); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN) && + FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) + printf(" (min = %4.0f RPM, div = %1.0f)", + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN), + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); + else if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) + printf(" (min = %4.0f RPM)", + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN)); + else if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) + printf(" (div = %1.0f)", + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM) && + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_ALARM)) { + printf(" ALARM"); + } + + printf("\n"); } void print_generic_chip(const sensors_chip_name *name) { - const sensors_feature_data *feature; - int i, label_size; - - label_size = sensors_get_label_size(name); - - i = 0; - while((feature = sensors_get_all_features(name, &i))) { - if (feature->mapping != SENSORS_NO_MAPPING) - continue; - - switch (feature->type) { - case SENSORS_FEATURE_TEMP: - print_generic_chip_temp(name, feature, i, label_size); break; - case SENSORS_FEATURE_IN: - print_generic_chip_in(name, feature, i, label_size); break; - case SENSORS_FEATURE_FAN: - print_generic_chip_fan(name, feature, i, label_size); break; - case SENSORS_FEATURE_VID: - print_vid_info(name, feature->number, label_size); break; - default: continue; - } - } + const sensors_feature_data *feature; + int i, label_size; + + label_size = sensors_get_label_size(name); + + i = 0; + while ((feature = sensors_get_all_features(name, &i))) { + if (feature->mapping != SENSORS_NO_MAPPING) + continue; + + switch (feature->type) { + case SENSORS_FEATURE_TEMP: + print_generic_chip_temp(name, feature, i, label_size); + break; + case SENSORS_FEATURE_IN: + print_generic_chip_in(name, feature, i, label_size); + break; + case SENSORS_FEATURE_FAN: + print_generic_chip_fan(name, feature, i, label_size); + break; + case SENSORS_FEATURE_VID: + print_vid_info(name, feature->number, label_size); + break; + default: + continue; + } + } } diff --git a/prog/sensors/main.c b/prog/sensors/main.c index d6f387d6..f39907ad 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -30,14 +30,14 @@ #define HAVE_ICONV #endif -#include "lib/sensors.h" +#include "lib/sensors.h" #include "lib/error.h" #include "chips.h" #include "version.h" #include "chips_generic.h" -#define PROGRAM "sensors" -#define VERSION LM_VERSION +#define PROGRAM "sensors" +#define VERSION LM_VERSION #define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" FILE *config_file; @@ -57,254 +57,260 @@ char degstr[5]; /* store the correct string to print degrees */ void print_short_help(void) { - printf("Try `%s -h' for more information\n",PROGRAM); + printf("Try `%s -h' for more information\n", PROGRAM); } void print_long_help(void) { - printf("Usage: %s [OPTION]... [CHIP]...\n",PROGRAM); - printf(" -c, --config-file Specify a config file (default: %s)\n", - DEFAULT_CONFIG_FILE); - puts(" -h, --help Display this help text\n" - " -s, --set Execute `set' statements (root only)\n" - " -f, --fahrenheit Show temperatures in degrees fahrenheit\n" - " -A, --no-adapter Do not show adapter for each chip\n" - " -u Raw output (debugging only)\n" - " -v, --version Display the program version\n" - "\n" - "Use `-' after `-c' to read the config file from stdin.\n" - "If no chips are specified, all chip info will be printed.\n" - "Example chip names:\n" - "\tlm78-i2c-0-2d\t*-i2c-0-2d\n" - "\tlm78-i2c-0-*\t*-i2c-0-*\n" - "\tlm78-i2c-*-2d\t*-i2c-*-2d\n" - "\tlm78-i2c-*-*\t*-i2c-*-*\n" - "\tlm78-isa-0290\t*-isa-0290\n" - "\tlm78-isa-*\t*-isa-*\n" - "\tlm78-*"); + printf("Usage: %s [OPTION]... [CHIP]...\n", PROGRAM); + printf(" -c, --config-file Specify a config file (default: %s)\n", + DEFAULT_CONFIG_FILE); + puts(" -h, --help Display this help text\n" + " -s, --set Execute `set' statements (root only)\n" + " -f, --fahrenheit Show temperatures in degrees fahrenheit\n" + " -A, --no-adapter Do not show adapter for each chip\n" + " -u Raw output (debugging only)\n" + " -v, --version Display the program version\n" + "\n" + "Use `-' after `-c' to read the config file from stdin.\n" + "If no chips are specified, all chip info will be printed.\n" + "Example chip names:\n" + "\tlm78-i2c-0-2d\t*-i2c-0-2d\n" + "\tlm78-i2c-0-*\t*-i2c-0-*\n" + "\tlm78-i2c-*-2d\t*-i2c-*-2d\n" + "\tlm78-i2c-*-*\t*-i2c-*-*\n" + "\tlm78-isa-0290\t*-isa-0290\n" + "\tlm78-isa-*\t*-isa-*\n" + "\tlm78-*"); } void print_version(void) { - printf("%s version %s with libsensors version %s\n", PROGRAM, VERSION, libsensors_version); + printf("%s version %s with libsensors version %s\n", PROGRAM, VERSION, + libsensors_version); } -/* This examines global var config_file, and leaves the name there too. +/* This examines global var config_file, and leaves the name there too. It also opens config_file. */ static void open_config_file(const char* config_file_name) { - if (!strcmp(config_file_name,"-")) { - config_file = stdin; - return; - } + if (!strcmp(config_file_name, "-")) { + config_file = stdin; + return; + } - config_file = fopen(config_file_name, "r"); - if (!config_file) { - fprintf(stderr, "Could not open config file\n"); - perror(config_file_name); - exit(1); - } + config_file = fopen(config_file_name, "r"); + if (!config_file) { + fprintf(stderr, "Could not open config file\n"); + perror(config_file_name); + exit(1); + } } - + static void close_config_file(const char* config_file_name) { - if (fclose(config_file) == EOF) { - fprintf(stderr,"Could not close config file\n"); - perror(config_file_name); - } + if (fclose(config_file) == EOF) { + fprintf(stderr, "Could not close config file\n"); + perror(config_file_name); + } } static void set_degstr(void) { - const char *deg_default_text[2] = {" C", " F"}; + const char *deg_default_text[2] = { " C", " F" }; #ifdef HAVE_ICONV - /* Size hardcoded for better performance. - Don't forget to count the trailing \0! */ - size_t deg_latin1_size = 3; - char *deg_latin1_text[2] = {"\260C", "\260F"}; - size_t nconv; - size_t degstr_size = sizeof(degstr); - char *degstr_ptr = degstr; + /* Size hardcoded for better performance. + Don't forget to count the trailing \0! */ + size_t deg_latin1_size = 3; + char *deg_latin1_text[2] = { "\260C", "\260F" }; + size_t nconv; + size_t degstr_size = sizeof(degstr); + char *degstr_ptr = degstr; - iconv_t cd = iconv_open(nl_langinfo(CODESET), "ISO-8859-1"); - if (cd != (iconv_t) -1) { - nconv = iconv(cd, &(deg_latin1_text[fahrenheit]), °_latin1_size, - °str_ptr, °str_size); - iconv_close(cd); - - if (nconv != (size_t) -1) - return; - } + iconv_t cd = iconv_open(nl_langinfo(CODESET), "ISO-8859-1"); + if (cd != (iconv_t) -1) { + nconv = iconv(cd, &(deg_latin1_text[fahrenheit]), + °_latin1_size, °str_ptr, °str_size); + iconv_close(cd); + + if (nconv != (size_t) -1) + return; + } #endif /* HAVE_ICONV */ - /* There was an error during the conversion, use the default text */ - strcpy(degstr, deg_default_text[fahrenheit]); + /* There was an error during the conversion, use the default text */ + strcpy(degstr, deg_default_text[fahrenheit]); } int main (int argc, char *argv[]) { - int c,res,i,error; - const char *config_file_name = DEFAULT_CONFIG_FILE; + int c, res, i, error; + const char *config_file_name = DEFAULT_CONFIG_FILE; - struct option long_opts[] = { - { "help", no_argument, NULL, 'h' }, - { "set", no_argument, NULL, 's' }, - { "version", no_argument, NULL, 'v'}, - { "fahrenheit", no_argument, NULL, 'f' }, - { "no-adapter", no_argument, NULL, 'A' }, - { "config-file", required_argument, NULL, 'c' }, - { 0,0,0,0 } - }; + struct option long_opts[] = { + { "help", no_argument, NULL, 'h' }, + { "set", no_argument, NULL, 's' }, + { "version", no_argument, NULL, 'v'}, + { "fahrenheit", no_argument, NULL, 'f' }, + { "no-adapter", no_argument, NULL, 'A' }, + { "config-file", required_argument, NULL, 'c' }, + { 0, 0, 0, 0 } + }; - setlocale(LC_CTYPE, ""); + setlocale(LC_CTYPE, ""); - do_raw = 0; - do_sets = 0; - hide_adapter = 0; - while (1) { - c = getopt_long(argc, argv, "hsvfAc:u", long_opts, NULL); - if (c == EOF) - break; - switch(c) { - case ':': - case '?': - print_short_help(); - exit(1); - case 'h': - print_long_help(); - exit(0); - case 'v': - print_version(); - exit(0); - case 'c': - config_file_name = optarg; - break; - case 's': - do_sets = 1; - break; - case 'f': - fahrenheit = 1; - break; - case 'A': - hide_adapter = 1; - break; - case 'u': - do_raw = 1; - break; - default: - fprintf(stderr,"Internal error while parsing options!\n"); - exit(1); - } - } + do_raw = 0; + do_sets = 0; + hide_adapter = 0; + while (1) { + c = getopt_long(argc, argv, "hsvfAc:u", long_opts, NULL); + if (c == EOF) + break; + switch(c) { + case ':': + case '?': + print_short_help(); + exit(1); + case 'h': + print_long_help(); + exit(0); + case 'v': + print_version(); + exit(0); + case 'c': + config_file_name = optarg; + break; + case 's': + do_sets = 1; + break; + case 'f': + fahrenheit = 1; + break; + case 'A': + hide_adapter = 1; + break; + case 'u': + do_raw = 1; + break; + default: + fprintf(stderr, + "Internal error while parsing options!\n"); + exit(1); + } + } - open_config_file(config_file_name); - if ((res = sensors_init(config_file))) { - fprintf(stderr, "sensors_init: %s\n", sensors_strerror(res)); - exit(1); - } - close_config_file(config_file_name); + open_config_file(config_file_name); + if ((res = sensors_init(config_file))) { + fprintf(stderr, "sensors_init: %s\n", sensors_strerror(res)); + exit(1); + } + close_config_file(config_file_name); - /* build the degrees string */ - set_degstr(); + /* build the degrees string */ + set_degstr(); - if (optind == argc) { /* No chip name on command line */ - if (!do_the_real_work(NULL, &error)) { - fprintf(stderr, - "No sensors found!\n" - "Make sure you loaded all the kernel drivers you need.\n" - "Try sensors-detect to find out which these are.\n"); - error = 1; - } - } else { - int cnt = 0; - sensors_chip_name chip; + if (optind == argc) { /* No chip name on command line */ + if (!do_the_real_work(NULL, &error)) { + fprintf(stderr, + "No sensors found!\n" + "Make sure you loaded all the kernel drivers you need.\n" + "Try sensors-detect to find out which these are.\n"); + error = 1; + } + } else { + int cnt = 0; + sensors_chip_name chip; - for (i = optind; i < argc; i++) { - if (sensors_parse_chip_name(argv[i], &chip)) { - fprintf(stderr, "Parse error in chip name `%s'\n", argv[i]); - print_short_help(); - error = 1; - goto exit; - } - cnt += do_the_real_work(&chip, &error); - } + for (i = optind; i < argc; i++) { + if (sensors_parse_chip_name(argv[i], &chip)) { + fprintf(stderr, + "Parse error in chip name `%s'\n", + argv[i]); + print_short_help(); + error = 1; + goto exit; + } + cnt += do_the_real_work(&chip, &error); + } - if (!cnt) { - fprintf(stderr, "Specified sensor(s) not found!\n"); - error = 1; - } - } + if (!cnt) { + fprintf(stderr, "Specified sensor(s) not found!\n"); + error = 1; + } + } exit: - sensors_cleanup(); - exit(res); + sensors_cleanup(); + exit(res); } /* returns number of chips found */ int do_the_real_work(const sensors_chip_name *match, int *error) { - const sensors_chip_name *chip; - int chip_nr; - int cnt = 0; + const sensors_chip_name *chip; + int chip_nr; + int cnt = 0; - chip_nr = 0; - while ((chip = sensors_get_detected_chips(match, &chip_nr))) { - if (do_sets) { - if (do_a_set(chip)) - *error = 1; - } else - do_a_print(chip); - cnt++; - } - return cnt; + chip_nr = 0; + while ((chip = sensors_get_detected_chips(match, &chip_nr))) { + if (do_sets) { + if (do_a_set(chip)) + *error = 1; + } else + do_a_print(chip); + cnt++; + } + return cnt; } /* returns 1 on error */ int do_a_set(const sensors_chip_name *name) { - int res; + int res; - if ((res = sensors_do_chip_sets(name))) { - if (res == -SENSORS_ERR_PROC) { - fprintf(stderr,"%s: %s for writing;\n",sprintf_chip_name(name), - sensors_strerror(res)); - fprintf(stderr,"Run as root?\n"); - return 1; - } else if (res == -SENSORS_ERR_ACCESS_W) { - fprintf(stderr, "%s: At least one \"set\" statement failed\n", - sprintf_chip_name(name)); - } else { - fprintf(stderr,"%s: %s\n",sprintf_chip_name(name), - sensors_strerror(res)); - } - } - return 0; + if ((res = sensors_do_chip_sets(name))) { + if (res == -SENSORS_ERR_PROC) { + fprintf(stderr, "%s: %s for writing;\n", + sprintf_chip_name(name), + sensors_strerror(res)); + fprintf(stderr, "Run as root?\n"); + return 1; + } else if (res == -SENSORS_ERR_ACCESS_W) { + fprintf(stderr, + "%s: At least one \"set\" statement failed\n", + sprintf_chip_name(name)); + } else { + fprintf(stderr, "%s: %s\n", sprintf_chip_name(name), + sensors_strerror(res)); + } + } + return 0; } const char *sprintf_chip_name(const sensors_chip_name *name) { - #define BUF_SIZE 200 - static char buf[BUF_SIZE]; +#define BUF_SIZE 200 + static char buf[BUF_SIZE]; - if (sensors_snprintf_chip_name(buf, BUF_SIZE, name) < 0) - return NULL; - return buf; + if (sensors_snprintf_chip_name(buf, BUF_SIZE, name) < 0) + return NULL; + return buf; } void do_a_print(const sensors_chip_name *name) { - printf("%s\n",sprintf_chip_name(name)); - if (!hide_adapter) { - const char *adap = sensors_get_adapter_name(&name->bus); - if (adap) - printf("Adapter: %s\n", adap); - else - fprintf(stderr, "Can't get adapter name\n"); - } - if (do_raw) - print_chip_raw(name); - else - print_generic_chip(name); - printf("\n"); + printf("%s\n", sprintf_chip_name(name)); + if (!hide_adapter) { + const char *adap = sensors_get_adapter_name(&name->bus); + if (adap) + printf("Adapter: %s\n", adap); + else + fprintf(stderr, "Can't get adapter name\n"); + } + if (do_raw) + print_chip_raw(name); + else + print_generic_chip(name); + printf("\n"); } From 7268001a5d4108a8ace021ed78be79fd2d8d97b0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 11:45:46 +0000 Subject: [PATCH 203/718] libsensors no longer returns ignored features so no need to check for this in applications anymore. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4709 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/rrd.c | 9 +++------ prog/sensord/sense.c | 26 ++------------------------ prog/sensord/sensord.h | 1 - 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index 1e5e9452..60f6152c 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -155,17 +155,14 @@ applyToFeatures int labelNumber = feature->dataNumbers[0]; const char *rawLabel = NULL; char *label = NULL; - int valid = 0; - if (getValid (chip, labelNumber, &valid)) { - sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber); - ret = -1; - } else if (getRawLabel (chip, labelNumber, &rawLabel)) { + + if (getRawLabel (chip, labelNumber, &rawLabel)) { sensorLog (LOG_ERR, "Error getting raw sensor label: %s/#%d", chip->prefix, labelNumber); ret = -1; } else if (!(label = sensors_get_label (chip, labelNumber))) { sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); ret = -1; - } else if (valid) { + } else { rrdCheckLabel (rawLabel, num); ret = fn (data, rrdLabels[num], label, feature); ++ num; diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index d6fd8faa..ddd8747a 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -33,18 +33,6 @@ #define DO_SET 2 #define DO_RRD 3 -int -getValid -(const sensors_chip_name *name, int feature, int *valid) { - int err; - err = sensors_get_ignored (name, feature); - if (err >= 0) { - *valid = err; - err = 0; - } - return err; -} - int getRawLabel (const sensors_chip_name *name, int feature, const char **label) { @@ -95,17 +83,11 @@ readUnknownChip while ((ret == 0) && ((sensor = sensors_get_all_features (chip, &index0, &index1)) != NULL)) { char *label = NULL; - int valid = 0; double value; - if (getValid (chip, sensor->number, &valid)) { - sensorLog (LOG_ERR, "Error getting sensor validity: %s/%s", chip->prefix, sensor->name); - ret = 20; - } else if (!(label = sensors_get_label (chip, sensor->number))) { + if (!(label = sensors_get_label (chip, sensor->number))) { sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, sensor->name); ret = 21; - } else if (!valid) { - /* skip invalid */ } else if (!(sensor->mode & SENSORS_MODE_R)) { sensorLog (LOG_INFO, "%s: %s", sensor->name, label); } else if ((ret = sensors_get_value (chip, sensor->number, &value))) { @@ -154,17 +136,13 @@ doKnownChip int alarm = alarms & feature->alarmMask; int beep = beeps & feature->beepMask; char *label = NULL; - int valid = 0; if ((action == DO_SCAN) && !alarm) { continue; - } else if (getValid (chip, labelNumber, &valid)) { - sensorLog (LOG_ERR, "Error getting sensor validity: %s/#%d", chip->prefix, labelNumber); - ret = 22; } else if (!(label = sensors_get_label (chip, labelNumber))) { sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); ret = 22; - } else if (valid) { + } else { double values[MAX_DATA]; for (subindex = 0; !ret && (feature->dataNumbers[subindex] >= 0); ++ subindex) { diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index 46a001e8..769e30e2 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -58,7 +58,6 @@ extern int unloadLib (void); /* from sense.c */ -extern int getValid (const sensors_chip_name *name, int feature, int *valid); extern int getRawLabel (const sensors_chip_name *name, int feature, const char **label); extern int readChips (void); From c649ae5ac30e1157158a53264766706a65ad5211 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 12:19:07 +0000 Subject: [PATCH 204/718] Merge chips_generic.c into chips.c. The boundary between both files was only historical, and prevents us from doing a number of cleanups. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4710 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/Module.mk | 2 +- prog/sensors/chips.c | 336 ++++++++++++++++++++++++++++++++- prog/sensors/chips.h | 17 +- prog/sensors/chips_generic.c | 355 ----------------------------------- prog/sensors/chips_generic.h | 29 --- prog/sensors/main.c | 1 - 6 files changed, 335 insertions(+), 405 deletions(-) delete mode 100644 prog/sensors/chips_generic.c delete mode 100644 prog/sensors/chips_generic.h diff --git a/prog/sensors/Module.mk b/prog/sensors/Module.mk index b07dfb5a..00ef5205 100644 --- a/prog/sensors/Module.mk +++ b/prog/sensors/Module.mk @@ -27,7 +27,7 @@ PROGSENSORSMAN1FILES := $(MODULE_DIR)/sensors.1 # Regrettably, even 'simply expanded variables' will not put their currently # defined value verbatim into the command-list of rules... PROGSENSORSTARGETS := $(MODULE_DIR)/sensors3 -PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c $(MODULE_DIR)/chips_generic.c +PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c # Include all dependency files. We use '.rd' to indicate this will create # executables. diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 2bcf0b54..caaa23d7 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -35,12 +35,19 @@ static inline float deg_ctof(float cel) return cel * (9.0F / 5.0F) + 32.0F; } +#define HYST 0 +#define MINMAX 1 +#define MAXONLY 2 +#define CRIT 3 +#define SINGLE 4 +#define HYSTONLY 5 + /* minmax = 0 for limit/hysteresis, 1 for max/min, 2 for max only; curprec and limitprec are # of digits after decimal point for the current temp and the limits note: symbolic constants defined in chips.h */ -void print_temp_info(float n_cur, float n_over, float n_hyst, - int minmax, int curprec, int limitprec) +static void print_temp_info(float n_cur, float n_over, float n_hyst, + int minmax, int curprec, int limitprec) { /* note: deg_ctof() will preserve HUGEVAL */ if (fahrenheit) { @@ -77,7 +84,7 @@ void print_temp_info(float n_cur, float n_over, float n_hyst, printf("Unknown temperature mode!"); } -void print_label(const char *label, int space) +static void print_label(const char *label, int space) { int len = strlen(label)+1; if (len > space) @@ -86,7 +93,8 @@ void print_label(const char *label, int space) printf("%s:%*s", label, space - len, ""); } -void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size) +static void print_vid_info(const sensors_chip_name *name, int f_vid, + int label_size) { char *label; double vid; @@ -130,3 +138,323 @@ void print_chip_raw(const sensors_chip_name *name) free(label); } } + +static int get_feature_value(const sensors_chip_name *name, + const sensors_feature_data *feature, + double *val) +{ + return sensors_get_value(name, feature->number, val); +} + +static void sensors_get_available_features(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, short *has_features, + double *feature_vals, int size, + int first_val) +{ + const sensors_feature_data *iter; + + while ((iter = sensors_get_all_features(name, &i)) && + iter->mapping == feature->number) { + int indx; + + indx = iter->type - first_val - 1; + if (indx < 0 || indx >= size) { + printf("ERROR: Bug in sensors: index out of bound"); + return; + } + + if (get_feature_value(name, iter, &feature_vals[indx])) + printf("ERROR: Can't get %s data!\n", iter->name); + + has_features[indx] = 1; + } +} + +static int sensors_get_label_size(const sensors_chip_name *name) +{ + int i; + const sensors_feature_data *iter; + char *label; + unsigned int max_size = 11; /* 11 as minumum label width */ + + i = 0; + while ((iter = sensors_get_all_features(name, &i))) { + if ((label = sensors_get_label(name, iter->number)) && + strlen(label) > max_size) + max_size = strlen(label); + free(label); + } + return max_size + 1; +} + +#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] +#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] +static void print_generic_chip_temp(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int label_size) +{ + double val, max, min; + char *label; + int type; + const int size = SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP; + short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0, }; + double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0.0, }; + + if (!(label = sensors_get_label(name, feature->number))) { + printf("ERROR: Can't get temperature label!\n"); + return; + } + + if (get_feature_value(name, feature, &val)) { + printf("ERROR: Can't get %s data!\n", label); + free(label); + return; + } + + sensors_get_available_features(name, feature, i, has_features, + feature_vals, size, + SENSORS_FEATURE_TEMP); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { + max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN); + type = MINMAX; + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST); + type = HYST; + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { + min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + type = CRIT; + } else { + min = 0; + type = MAXONLY; + } + } else { + min = max = 0; + type = SINGLE; + } + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT)) + val = HUGE_VAL; + + print_label(label, label_size); + free(label); + + print_temp_info(val, max, min, type, 1, 1); + + /* ALARM features */ + if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) + || (type == MINMAX && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM) > 0.5) + || (type == MINMAX && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM) > 0.5) + || (type == CRIT && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5)) { + printf("ALARM "); + } + + if (type != CRIT && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { + if (fahrenheit) { + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT) = deg_ctof( + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT)); + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST) = deg_ctof( + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST)); + } + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) + printf("\n%*s(crit = %+5.1f%s, hyst = %+5.1f%s) ", + label_size + 10, "", + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), + degstr, + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST), + degstr); + else + printf("\n%*s(crit = %+5.1f%s) ", + label_size + 10, "", + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), + degstr); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) { + printf("ALARM "); + } + } + + /* print out temperature sensor info */ + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { + int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_SENS); + + /* older kernels / drivers sometimes report a beta value for + thermistors */ + if (sens > 1000) + sens = 4; + + printf("sensor = %s", sens == 0 ? "disabled" : + sens == 1 ? "diode" : + sens == 2 ? "transistor" : + sens == 3 ? "thermal diode" : + sens == 4 ? "thermistor" : + sens == 5 ? "AMD AMDSI" : + sens == 6 ? "Intel PECI" : "unknown"); + } + printf("\n"); +} + +#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] +#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] +static void print_generic_chip_in(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int label_size) +{ + const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; + short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0, }; + double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0.0, }; + double val, alarm_max, alarm_min; + char *label; + + if (!(label = sensors_get_label(name, feature->number))) { + printf("ERROR: Can't get in label!\n"); + return; + } + + if (get_feature_value(name, feature, &val)) { + printf("ERROR: Can't get %s data!\n", label); + free(label); + return; + } + + sensors_get_available_features(name, feature, i, has_features, + feature_vals, size, SENSORS_FEATURE_IN); + + print_label(label, label_size); + free(label); + printf("%+6.2f V", val); + + if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && + IN_FEATURE(SENSORS_FEATURE_IN_MAX)) + printf(" (min = %+6.2f V, max = %+6.2f V)", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN), + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); + else if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) + printf(" (min = %+6.2f V)", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN)); + else if (IN_FEATURE(SENSORS_FEATURE_IN_MAX)) + printf(" (max = %+6.2f V)", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); + + if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM) || + IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { + alarm_max = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX_ALARM); + alarm_min = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN_ALARM); + + if (alarm_min || alarm_max) { + printf(" ALARM ("); + + if (alarm_min) + printf("MIN"); + if (alarm_max) + printf("%sMAX", (alarm_min) ? ", " : ""); + + printf(")"); + } + } else if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { + printf(" %s", + IN_FEATURE_VAL(SENSORS_FEATURE_IN_ALARM) ? "ALARM" : ""); + } + + printf("\n"); +} + +#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] +#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] +static void print_generic_chip_fan(const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, int label_size) +{ + char *label; + const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; + short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0, }; + double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0.0, }; + double val; + + if (!(label = sensors_get_label(name, feature->number))) { + printf("ERROR: Can't get fan label!\n"); + return; + } + + if (get_feature_value(name, feature, &val)) { + printf("ERROR: Can't get %s data!\n", label); + free(label); + return; + } + + print_label(label, label_size); + free(label); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) + printf(" FAULT"); + else + printf("%4.0f RPM", val); + + sensors_get_available_features(name, feature, i, has_features, + feature_vals, size, SENSORS_FEATURE_FAN); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN) && + FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) + printf(" (min = %4.0f RPM, div = %1.0f)", + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN), + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); + else if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) + printf(" (min = %4.0f RPM)", + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN)); + else if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) + printf(" (div = %1.0f)", + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM) && + FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_ALARM)) { + printf(" ALARM"); + } + + printf("\n"); +} + +void print_generic_chip(const sensors_chip_name *name) +{ + const sensors_feature_data *feature; + int i, label_size; + + label_size = sensors_get_label_size(name); + + i = 0; + while ((feature = sensors_get_all_features(name, &i))) { + if (feature->mapping != SENSORS_NO_MAPPING) + continue; + + switch (feature->type) { + case SENSORS_FEATURE_TEMP: + print_generic_chip_temp(name, feature, i, label_size); + break; + case SENSORS_FEATURE_IN: + print_generic_chip_in(name, feature, i, label_size); + break; + case SENSORS_FEATURE_FAN: + print_generic_chip_fan(name, feature, i, label_size); + break; + case SENSORS_FEATURE_VID: + print_vid_info(name, feature->number, label_size); + break; + default: + continue; + } + } +} diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index 1ce18286..ad7f3831 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -22,20 +22,7 @@ #include "lib/sensors.h" -extern void print_chip_raw(const sensors_chip_name *name); - -/* some functions used by chips_generic.c */ -#define HYST 0 -#define MINMAX 1 -#define MAXONLY 2 -#define CRIT 3 -#define SINGLE 4 -#define HYSTONLY 5 -void print_temp_info(float n_cur, float n_over, float n_hyst, - int minmax, int curprec, int limitprec); - -void print_vid_info(const sensors_chip_name *name, int f_vid, int label_size); - -void print_label(const char *label, int space); +void print_chip_raw(const sensors_chip_name *name); +void print_generic_chip(const sensors_chip_name *name); #endif /* def PROG_SENSORS_CHIPS_H */ diff --git a/prog/sensors/chips_generic.c b/prog/sensors/chips_generic.c deleted file mode 100644 index 71460b8f..00000000 --- a/prog/sensors/chips_generic.c +++ /dev/null @@ -1,355 +0,0 @@ -/* - chips_generic.c - Part of sensors, a user-space program for hardware monitoring - Copyright (c) 1998-2003 Frodo Looijaard - and Mark D. Studebaker - Copyright (c) 2003-2006 The lm_sensors team - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include -#include - -#include "chips_generic.h" -#include "chips.h" - -static int get_feature_value(const sensors_chip_name *name, - const sensors_feature_data *feature, - double *val) -{ - return sensors_get_value(name, feature->number, val); -} - -static void sensors_get_available_features(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, short *has_features, - double *feature_vals, int size, - int first_val) -{ - const sensors_feature_data *iter; - - while ((iter = sensors_get_all_features(name, &i)) && - iter->mapping == feature->number) { - int indx; - - indx = iter->type - first_val - 1; - if (indx < 0 || indx >= size) { - printf("ERROR: Bug in sensors: index out of bound"); - return; - } - - if (get_feature_value(name, iter, &feature_vals[indx])) - printf("ERROR: Can't get %s data!\n", iter->name); - - has_features[indx] = 1; - } -} - -static int sensors_get_label_size(const sensors_chip_name *name) -{ - int i; - const sensors_feature_data *iter; - char *label; - unsigned int max_size = 11; /* 11 as minumum label width */ - - i = 0; - while ((iter = sensors_get_all_features(name, &i))) { - if ((label = sensors_get_label(name, iter->number)) && - strlen(label) > max_size) - max_size = strlen(label); - free(label); - } - return max_size + 1; -} - -extern int fahrenheit; -extern char degstr[5]; - -static inline float deg_ctof(float cel) -{ - return cel * (9.0F / 5.0F) + 32.0F; -} - -#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] -#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] -static void print_generic_chip_temp(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int label_size) -{ - double val, max, min; - char *label; - int type; - const int size = SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP; - short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0, }; - double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0.0, }; - - if (!(label = sensors_get_label(name, feature->number))) { - printf("ERROR: Can't get temperature label!\n"); - return; - } - - if (get_feature_value(name, feature, &val)) { - printf("ERROR: Can't get %s data!\n", label); - free(label); - return; - } - - sensors_get_available_features(name, feature, i, has_features, - feature_vals, size, - SENSORS_FEATURE_TEMP); - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { - max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN); - type = MINMAX; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST); - type = HYST; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); - type = CRIT; - } else { - min = 0; - type = MAXONLY; - } - } else { - min = max = 0; - type = SINGLE; - } - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT)) - val = HUGE_VAL; - - print_label(label, label_size); - free(label); - - print_temp_info(val, max, min, type, 1, 1); - - /* ALARM features */ - if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) - || (type == MINMAX && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM) > 0.5) - || (type == MINMAX && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM) > 0.5) - || (type == CRIT && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5)) { - printf("ALARM "); - } - - if (type != CRIT && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - if (fahrenheit) { - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT) = deg_ctof( - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT)); - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST) = deg_ctof( - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST)); - } - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) - printf("\n%*s(crit = %+5.1f%s, hyst = %+5.1f%s) ", - label_size + 10, "", - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), - degstr, - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST), - degstr); - else - printf("\n%*s(crit = %+5.1f%s) ", - label_size + 10, "", - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), - degstr); - - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) { - printf("ALARM "); - } - } - - /* print out temperature sensor info */ - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { - int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_SENS); - - /* older kernels / drivers sometimes report a beta value for - thermistors */ - if (sens > 1000) - sens = 4; - - printf("sensor = %s", sens == 0 ? "disabled" : - sens == 1 ? "diode" : - sens == 2 ? "transistor" : - sens == 3 ? "thermal diode" : - sens == 4 ? "thermistor" : - sens == 5 ? "AMD AMDSI" : - sens == 6 ? "Intel PECI" : "unknown"); - } - printf("\n"); -} - -#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] -#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] -static void print_generic_chip_in(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int label_size) -{ - const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; - short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0, }; - double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0.0, }; - double val, alarm_max, alarm_min; - char *label; - - if (!(label = sensors_get_label(name, feature->number))) { - printf("ERROR: Can't get in label!\n"); - return; - } - - if (get_feature_value(name, feature, &val)) { - printf("ERROR: Can't get %s data!\n", label); - free(label); - return; - } - - sensors_get_available_features(name, feature, i, has_features, - feature_vals, size, SENSORS_FEATURE_IN); - - print_label(label, label_size); - free(label); - printf("%+6.2f V", val); - - if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && - IN_FEATURE(SENSORS_FEATURE_IN_MAX)) - printf(" (min = %+6.2f V, max = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN), - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); - else if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) - printf(" (min = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN)); - else if (IN_FEATURE(SENSORS_FEATURE_IN_MAX)) - printf(" (max = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); - - if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM) || - IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { - alarm_max = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX_ALARM); - alarm_min = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN_ALARM); - - if (alarm_min || alarm_max) { - printf(" ALARM ("); - - if (alarm_min) - printf("MIN"); - if (alarm_max) - printf("%sMAX", (alarm_min) ? ", " : ""); - - printf(")"); - } - } else if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { - printf(" %s", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_ALARM) ? "ALARM" : ""); - } - - printf("\n"); -} - -#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] -#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] -static void print_generic_chip_fan(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int label_size) -{ - char *label; - const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; - short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0, }; - double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0.0, }; - double val; - - if (!(label = sensors_get_label(name, feature->number))) { - printf("ERROR: Can't get fan label!\n"); - return; - } - - if (get_feature_value(name, feature, &val)) { - printf("ERROR: Can't get %s data!\n", label); - free(label); - return; - } - - print_label(label, label_size); - free(label); - - if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) - printf(" FAULT"); - else - printf("%4.0f RPM", val); - - sensors_get_available_features(name, feature, i, has_features, - feature_vals, size, SENSORS_FEATURE_FAN); - - if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN) && - FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) - printf(" (min = %4.0f RPM, div = %1.0f)", - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN), - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); - else if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) - printf(" (min = %4.0f RPM)", - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN)); - else if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) - printf(" (div = %1.0f)", - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); - - if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM) && - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_ALARM)) { - printf(" ALARM"); - } - - printf("\n"); -} - -void print_generic_chip(const sensors_chip_name *name) -{ - const sensors_feature_data *feature; - int i, label_size; - - label_size = sensors_get_label_size(name); - - i = 0; - while ((feature = sensors_get_all_features(name, &i))) { - if (feature->mapping != SENSORS_NO_MAPPING) - continue; - - switch (feature->type) { - case SENSORS_FEATURE_TEMP: - print_generic_chip_temp(name, feature, i, label_size); - break; - case SENSORS_FEATURE_IN: - print_generic_chip_in(name, feature, i, label_size); - break; - case SENSORS_FEATURE_FAN: - print_generic_chip_fan(name, feature, i, label_size); - break; - case SENSORS_FEATURE_VID: - print_vid_info(name, feature->number, label_size); - break; - default: - continue; - } - } -} diff --git a/prog/sensors/chips_generic.h b/prog/sensors/chips_generic.h deleted file mode 100644 index 96eceb9d..00000000 --- a/prog/sensors/chips_generic.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - chips_generic.h - Part of sensors, a user-space program for hardware monitoring - Copyright (c) 1998-2003 Frodo Looijaard - and Mark D. Studebaker - Copyright (c) 2003-2006 The lm_sensors team - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef PROG_SENSORS_CHIPS_GENERIC_H -#define PROG_SENSORS_CHIPS_GENERIC_H - -#include "lib/sensors.h" - -void print_generic_chip(const sensors_chip_name *name); - -#endif diff --git a/prog/sensors/main.c b/prog/sensors/main.c index f39907ad..eeda6ef2 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -34,7 +34,6 @@ #include "lib/error.h" #include "chips.h" #include "version.h" -#include "chips_generic.h" #define PROGRAM "sensors" #define VERSION LM_VERSION From 364bd24c44c2908e25eeb3cfdae162170560404a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 13:21:05 +0000 Subject: [PATCH 205/718] config_file doesn't need to be a global. Also move the handling of the configuration file in a single separate function for clarity. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4711 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/main.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index eeda6ef2..6df47021 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -39,8 +39,6 @@ #define VERSION LM_VERSION #define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" -FILE *config_file; - extern int main(int argc, char *arv[]); static void print_short_help(void); static void print_long_help(void); @@ -89,29 +87,33 @@ void print_version(void) libsensors_version); } -/* This examines global var config_file, and leaves the name there too. - It also opens config_file. */ -static void open_config_file(const char* config_file_name) +/* Return 0 on success, and an exit error code otherwise */ +static int read_config_file(const char *config_file_name) { - if (!strcmp(config_file_name, "-")) { + FILE *config_file; + int err; + + if (!strcmp(config_file_name, "-")) config_file = stdin; - return; - } + else + config_file = fopen(config_file_name, "r"); - config_file = fopen(config_file_name, "r"); if (!config_file) { fprintf(stderr, "Could not open config file\n"); perror(config_file_name); - exit(1); + return 1; } -} -static void close_config_file(const char* config_file_name) -{ - if (fclose(config_file) == EOF) { - fprintf(stderr, "Could not close config file\n"); - perror(config_file_name); + err = sensors_init(config_file); + if (err) { + fprintf(stderr, "sensors_init: %s\n", sensors_strerror(err)); + return 1; } + + if (fclose(config_file) == EOF) + perror(config_file_name); + + return 0; } static void set_degstr(void) @@ -199,12 +201,9 @@ int main (int argc, char *argv[]) } } - open_config_file(config_file_name); - if ((res = sensors_init(config_file))) { - fprintf(stderr, "sensors_init: %s\n", sensors_strerror(res)); - exit(1); - } - close_config_file(config_file_name); + res = read_config_file(config_file_name); + if (res) + exit(res); /* build the degrees string */ set_degstr(); From 55291db894610fe328e502465e2c7d6bab9bb395 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 13:22:28 +0000 Subject: [PATCH 206/718] Reorder the functions so as to get rid of unneeded forward declarations. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4712 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/main.c | 157 +++++++++++++++++++++----------------------- 1 file changed, 74 insertions(+), 83 deletions(-) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 6df47021..e9ae9a0b 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -39,25 +39,16 @@ #define VERSION LM_VERSION #define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" -extern int main(int argc, char *arv[]); -static void print_short_help(void); -static void print_long_help(void); -static void print_version(void); -static void do_a_print(const sensors_chip_name *name); -static int do_a_set(const sensors_chip_name *name); -static int do_the_real_work(const sensors_chip_name *chip, int *error); -static const char *sprintf_chip_name(const sensors_chip_name *name); - int do_sets, do_raw, fahrenheit, hide_adapter; char degstr[5]; /* store the correct string to print degrees */ -void print_short_help(void) +static void print_short_help(void) { printf("Try `%s -h' for more information\n", PROGRAM); } -void print_long_help(void) +static void print_long_help(void) { printf("Usage: %s [OPTION]... [CHIP]...\n", PROGRAM); printf(" -c, --config-file Specify a config file (default: %s)\n", @@ -81,7 +72,7 @@ void print_long_help(void) "\tlm78-*"); } -void print_version(void) +static void print_version(void) { printf("%s version %s with libsensors version %s\n", PROGRAM, VERSION, libsensors_version); @@ -144,7 +135,77 @@ static void set_degstr(void) strcpy(degstr, deg_default_text[fahrenheit]); } -int main (int argc, char *argv[]) +static const char *sprintf_chip_name(const sensors_chip_name *name) +{ +#define BUF_SIZE 200 + static char buf[BUF_SIZE]; + + if (sensors_snprintf_chip_name(buf, BUF_SIZE, name) < 0) + return NULL; + return buf; +} + +static void do_a_print(const sensors_chip_name *name) +{ + printf("%s\n", sprintf_chip_name(name)); + if (!hide_adapter) { + const char *adap = sensors_get_adapter_name(&name->bus); + if (adap) + printf("Adapter: %s\n", adap); + else + fprintf(stderr, "Can't get adapter name\n"); + } + if (do_raw) + print_chip_raw(name); + else + print_generic_chip(name); + printf("\n"); +} + +/* returns 1 on error */ +static int do_a_set(const sensors_chip_name *name) +{ + int res; + + if ((res = sensors_do_chip_sets(name))) { + if (res == -SENSORS_ERR_PROC) { + fprintf(stderr, "%s: %s for writing;\n", + sprintf_chip_name(name), + sensors_strerror(res)); + fprintf(stderr, "Run as root?\n"); + return 1; + } else if (res == -SENSORS_ERR_ACCESS_W) { + fprintf(stderr, + "%s: At least one \"set\" statement failed\n", + sprintf_chip_name(name)); + } else { + fprintf(stderr, "%s: %s\n", sprintf_chip_name(name), + sensors_strerror(res)); + } + } + return 0; +} + +/* returns number of chips found */ +static int do_the_real_work(const sensors_chip_name *match, int *error) +{ + const sensors_chip_name *chip; + int chip_nr; + int cnt = 0; + + chip_nr = 0; + while ((chip = sensors_get_detected_chips(match, &chip_nr))) { + if (do_sets) { + if (do_a_set(chip)) + *error = 1; + } else + do_a_print(chip); + cnt++; + } + return cnt; +} + +int main(int argc, char *argv[]) { int c, res, i, error; const char *config_file_name = DEFAULT_CONFIG_FILE; @@ -242,73 +303,3 @@ exit: sensors_cleanup(); exit(res); } - -/* returns number of chips found */ -int do_the_real_work(const sensors_chip_name *match, int *error) -{ - const sensors_chip_name *chip; - int chip_nr; - int cnt = 0; - - chip_nr = 0; - while ((chip = sensors_get_detected_chips(match, &chip_nr))) { - if (do_sets) { - if (do_a_set(chip)) - *error = 1; - } else - do_a_print(chip); - cnt++; - } - return cnt; -} - -/* returns 1 on error */ -int do_a_set(const sensors_chip_name *name) -{ - int res; - - if ((res = sensors_do_chip_sets(name))) { - if (res == -SENSORS_ERR_PROC) { - fprintf(stderr, "%s: %s for writing;\n", - sprintf_chip_name(name), - sensors_strerror(res)); - fprintf(stderr, "Run as root?\n"); - return 1; - } else if (res == -SENSORS_ERR_ACCESS_W) { - fprintf(stderr, - "%s: At least one \"set\" statement failed\n", - sprintf_chip_name(name)); - } else { - fprintf(stderr, "%s: %s\n", sprintf_chip_name(name), - sensors_strerror(res)); - } - } - return 0; -} - -const char *sprintf_chip_name(const sensors_chip_name *name) -{ -#define BUF_SIZE 200 - static char buf[BUF_SIZE]; - - if (sensors_snprintf_chip_name(buf, BUF_SIZE, name) < 0) - return NULL; - return buf; -} - -void do_a_print(const sensors_chip_name *name) -{ - printf("%s\n", sprintf_chip_name(name)); - if (!hide_adapter) { - const char *adap = sensors_get_adapter_name(&name->bus); - if (adap) - printf("Adapter: %s\n", adap); - else - fprintf(stderr, "Can't get adapter name\n"); - } - if (do_raw) - print_chip_raw(name); - else - print_generic_chip(name); - printf("\n"); -} From 7ba794d9ba79cac3a02b93199909e2c49886db29 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 13:24:46 +0000 Subject: [PATCH 207/718] Clean up the global variables: * do_sets, do_raw and hide_adapter are only used in main.c and could thus be declared static. * fahrenheit and degstr are used in chips.c as well, so they should be declared in a header file. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4713 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 4 +--- prog/sensors/main.c | 4 +++- prog/sensors/main.h | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 prog/sensors/main.h diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index caaa23d7..cb02a3a9 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -24,12 +24,10 @@ #include #include +#include "main.h" #include "chips.h" #include "lib/sensors.h" -extern int fahrenheit; -extern char degstr[5]; - static inline float deg_ctof(float cel) { return cel * (9.0F / 5.0F) + 32.0F; diff --git a/prog/sensors/main.c b/prog/sensors/main.c index e9ae9a0b..a1b60ee6 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -32,6 +32,7 @@ #include "lib/sensors.h" #include "lib/error.h" +#include "main.h" #include "chips.h" #include "version.h" @@ -39,8 +40,9 @@ #define VERSION LM_VERSION #define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" -int do_sets, do_raw, fahrenheit, hide_adapter; +static int do_sets, do_raw, hide_adapter; +int fahrenheit; char degstr[5]; /* store the correct string to print degrees */ static void print_short_help(void) diff --git a/prog/sensors/main.h b/prog/sensors/main.h new file mode 100644 index 00000000..4604b796 --- /dev/null +++ b/prog/sensors/main.h @@ -0,0 +1,26 @@ +/* + main.h - Part of sensors, a user-space program for hardware monitoring + Copyright (C) 2007 Jean Delvare + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef PROG_SENSORS_MAIN_H +#define PROG_SENSORS_MAIN_H + +extern int fahrenheit; +extern char degstr[5]; + +#endif /* PROG_SENSORS_MAIN_H */ From f0f3df8a483f63ef48019433d8e85c3cfda9c258 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:33:21 +0000 Subject: [PATCH 208/718] Labels do fit in the imparted space by construction now, so no need to check. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4714 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index cb02a3a9..583d5fd1 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -85,10 +85,7 @@ static void print_temp_info(float n_cur, float n_over, float n_hyst, static void print_label(const char *label, int space) { int len = strlen(label)+1; - if (len > space) - printf("%s:\n%*s", label, space, ""); - else - printf("%s:%*s", label, space - len, ""); + printf("%s:%*s", label, space - len, ""); } static void print_vid_info(const sensors_chip_name *name, int f_vid, From 2cc20c4487518ffb8276e84268c65dbb3a1661ca Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:34:55 +0000 Subject: [PATCH 209/718] Only consider the main features when computing how much room we need to print the labels. This is both a fix (beforehand we would leave enough room to print possibly long subfeature names, even though we do not actually print subfeature names at all) and a significant performance boost. This change alone shrinks the CPU cost of a sensors run by 4.5%. I am still worried that this feature causes us to allocate each label string twice, but I guess this overhead is now acceptable. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4715 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 583d5fd1..57cec09c 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -175,6 +175,8 @@ static int sensors_get_label_size(const sensors_chip_name *name) i = 0; while ((iter = sensors_get_all_features(name, &i))) { + if (iter->mapping != SENSORS_NO_MAPPING) + continue; if ((label = sensors_get_label(name, iter->number)) && strlen(label) > max_size) max_size = strlen(label); From 02e4d6fe83c11bbd3c729493123b75c686764916 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:35:26 +0000 Subject: [PATCH 210/718] print_temp_info is only ever called with precision values of 1, so we can hard-code this precision for improved performance. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4716 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 57cec09c..9df7498b 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -40,12 +40,9 @@ static inline float deg_ctof(float cel) #define SINGLE 4 #define HYSTONLY 5 -/* minmax = 0 for limit/hysteresis, 1 for max/min, 2 for max only; - curprec and limitprec are # of digits after decimal point - for the current temp and the limits - note: symbolic constants defined in chips.h */ +/* symbolic constants for minmax defined above */ static void print_temp_info(float n_cur, float n_over, float n_hyst, - int minmax, int curprec, int limitprec) + int minmax) { /* note: deg_ctof() will preserve HUGEVAL */ if (fahrenheit) { @@ -54,30 +51,29 @@ static void print_temp_info(float n_cur, float n_over, float n_hyst, n_hyst = deg_ctof(n_hyst); } - /* use %* to pass precision as an argument */ if (n_cur != HUGE_VAL) - printf("%+6.*f%s ", curprec, n_cur, degstr); + printf("%+6.1f%s ", n_cur, degstr); else printf(" FAULT "); if (minmax == MINMAX) - printf("(low = %+5.*f%s, high = %+5.*f%s) ", - limitprec, n_hyst, degstr, - limitprec, n_over, degstr); + printf("(low = %+5.1f%s, high = %+5.1f%s) ", + n_hyst, degstr, + n_over, degstr); else if (minmax == MAXONLY) - printf("(high = %+5.*f%s) ", - limitprec, n_over, degstr); + printf("(high = %+5.1f%s) ", + n_over, degstr); else if (minmax == CRIT) - printf("(high = %+5.*f%s, crit = %+5.*f%s) ", - limitprec, n_over, degstr, - limitprec, n_hyst, degstr); + printf("(high = %+5.1f%s, crit = %+5.1f%s) ", + n_over, degstr, + n_hyst, degstr); else if (minmax == HYST) - printf("(high = %+5.*f%s, hyst = %+5.*f%s) ", - limitprec, n_over, degstr, - limitprec, n_hyst, degstr); + printf("(high = %+5.1f%s, hyst = %+5.1f%s) ", + n_over, degstr, + n_hyst, degstr); else if (minmax == HYSTONLY) - printf("(hyst = %+5.*f%s) ", - limitprec, n_over, degstr); + printf("(hyst = %+5.1f%s) ", + n_over, degstr); else if (minmax != SINGLE) printf("Unknown temperature mode!"); } @@ -241,7 +237,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, print_label(label, label_size); free(label); - print_temp_info(val, max, min, type, 1, 1); + print_temp_info(val, max, min, type); /* ALARM features */ if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && From 9da5883c983d7b9739919f31334339810704aac3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:36:46 +0000 Subject: [PATCH 211/718] Move the printing of the current temperature out of print_temp_info(). That way we don't need to use an arbitrary value to carry the fault information. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4717 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 9df7498b..1c8439f6 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -22,7 +22,6 @@ #include #include #include -#include #include "main.h" #include "chips.h" @@ -41,21 +40,14 @@ static inline float deg_ctof(float cel) #define HYSTONLY 5 /* symbolic constants for minmax defined above */ -static void print_temp_info(float n_cur, float n_over, float n_hyst, - int minmax) +static void print_temp_limits(float n_over, float n_hyst, + int minmax) { - /* note: deg_ctof() will preserve HUGEVAL */ if (fahrenheit) { - n_cur = deg_ctof(n_cur); n_over = deg_ctof(n_over); n_hyst = deg_ctof(n_hyst); } - if (n_cur != HUGE_VAL) - printf("%+6.1f%s ", n_cur, degstr); - else - printf(" FAULT "); - if (minmax == MINMAX) printf("(low = %+5.1f%s, high = %+5.1f%s) ", n_hyst, degstr, @@ -230,14 +222,18 @@ static void print_generic_chip_temp(const sensors_chip_name *name, type = SINGLE; } - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT)) - val = HUGE_VAL; - print_label(label, label_size); free(label); - print_temp_info(val, max, min, type); + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT)) { + printf(" FAULT "); + } else { + if (fahrenheit) + val = deg_ctof(val); + printf("%+6.1f%s ", val, degstr); + } + print_temp_limits(max, min, type); /* ALARM features */ if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && From 4716a8c8f166a4896bf30cace240f9ee579e20e6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:37:15 +0000 Subject: [PATCH 212/718] Change print_temp_limits() to expose a sane interface. This lets us get rid of arbitrary constants. Now we can reuse the same code to display the extra temperature limits. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4718 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 165 +++++++++++++++++++------------------------ 1 file changed, 74 insertions(+), 91 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 1c8439f6..a7517dd7 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -32,44 +32,6 @@ static inline float deg_ctof(float cel) return cel * (9.0F / 5.0F) + 32.0F; } -#define HYST 0 -#define MINMAX 1 -#define MAXONLY 2 -#define CRIT 3 -#define SINGLE 4 -#define HYSTONLY 5 - -/* symbolic constants for minmax defined above */ -static void print_temp_limits(float n_over, float n_hyst, - int minmax) -{ - if (fahrenheit) { - n_over = deg_ctof(n_over); - n_hyst = deg_ctof(n_hyst); - } - - if (minmax == MINMAX) - printf("(low = %+5.1f%s, high = %+5.1f%s) ", - n_hyst, degstr, - n_over, degstr); - else if (minmax == MAXONLY) - printf("(high = %+5.1f%s) ", - n_over, degstr); - else if (minmax == CRIT) - printf("(high = %+5.1f%s, crit = %+5.1f%s) ", - n_over, degstr, - n_hyst, degstr); - else if (minmax == HYST) - printf("(high = %+5.1f%s, hyst = %+5.1f%s) ", - n_over, degstr, - n_hyst, degstr); - else if (minmax == HYSTONLY) - printf("(hyst = %+5.1f%s) ", - n_over, degstr); - else if (minmax != SINGLE) - printf("Unknown temperature mode!"); -} - static void print_label(const char *label, int space) { int len = strlen(label)+1; @@ -173,15 +135,39 @@ static int sensors_get_label_size(const sensors_chip_name *name) return max_size + 1; } +static void print_temp_limits(float limit1, float limit2, + const char *name1, const char *name2, int alarm) +{ + if (fahrenheit) { + limit1 = deg_ctof(limit1); + limit2 = deg_ctof(limit2); + } + + if (name2) { + printf("(%-4s = %+5.1f%s, %-4s = %+5.1f%s) ", + name1, limit1, degstr, + name2, limit2, degstr); + } else if (name1) { + printf("(%-4s = %+5.1f%s) ", + name1, limit1, degstr); + } else { + printf(" "); + } + + if (alarm) + printf("ALARM "); +} + #define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] #define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] static void print_generic_chip_temp(const sensors_chip_name *name, const sensors_feature_data *feature, int i, int label_size) { - double val, max, min; + double val, limit1, limit2; + const char *s1, *s2; + int alarm, crit_displayed = 0; char *label; - int type; const int size = SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP; short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0, }; double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0.0, }; @@ -201,25 +187,45 @@ static void print_generic_chip_temp(const sensors_chip_name *name, feature_vals, size, SENSORS_FEATURE_TEMP); + alarm = TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM); if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { - max = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM)) + alarm |= 1; - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN); - type = MINMAX; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST); - type = HYST; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - min = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); - type = CRIT; + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { + limit1 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN); + s1 = "low"; + limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + s2 = "high"; + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM)) + alarm |= 1; } else { - min = 0; - type = MAXONLY; + limit1 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + s1 = "high"; + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { + limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST); + s2 = "hyst"; + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { + limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + s2 = "crit"; + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) + alarm |= 1; + crit_displayed = 1; + } else { + limit2 = 0; + s2 = NULL; + } } } else { - min = max = 0; - type = SINGLE; + limit1 = limit2 = 0; + s1 = s2 = NULL; } print_label(label, label_size); @@ -233,48 +239,25 @@ static void print_generic_chip_temp(const sensors_chip_name *name, val = deg_ctof(val); printf("%+6.1f%s ", val, degstr); } - print_temp_limits(max, min, type); + print_temp_limits(limit1, limit2, s1, s2, alarm); - /* ALARM features */ - if ((TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM) > 0.5) - || (type == MINMAX && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM) > 0.5) - || (type == MINMAX && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM) > 0.5) - || (type == CRIT && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM) > 0.5)) { - printf("ALARM "); - } + if (!crit_displayed && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { + limit1 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + s1 = "crit"; - if (type != CRIT && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - if (fahrenheit) { - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT) = deg_ctof( - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT)); - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST) = deg_ctof( - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST)); + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) { + limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST); + s2 = "hyst"; + } else { + limit2 = 0; + s2 = NULL; } - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) - printf("\n%*s(crit = %+5.1f%s, hyst = %+5.1f%s) ", - label_size + 10, "", - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), - degstr, - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST), - degstr); - else - printf("\n%*s(crit = %+5.1f%s) ", - label_size + 10, "", - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT), - degstr); + alarm = TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM); - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) { - printf("ALARM "); - } + printf("\n%*s", label_size + 10, ""); + print_temp_limits(limit1, limit2, s1, s2, alarm); } /* print out temperature sensor info */ From 868fd8d093d18c8edd5c785493757f5fe460e08f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:41:03 +0000 Subject: [PATCH 213/718] Avoid the conversions from double to float. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4719 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index a7517dd7..eff6d943 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -27,7 +27,7 @@ #include "chips.h" #include "lib/sensors.h" -static inline float deg_ctof(float cel) +static inline double deg_ctof(double cel) { return cel * (9.0F / 5.0F) + 32.0F; } @@ -135,7 +135,7 @@ static int sensors_get_label_size(const sensors_chip_name *name) return max_size + 1; } -static void print_temp_limits(float limit1, float limit2, +static void print_temp_limits(double limit1, double limit2, const char *name1, const char *name2, int alarm) { if (fahrenheit) { From 60b2bafabd142f01a342238b233d9ea647aac980 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:41:53 +0000 Subject: [PATCH 214/718] Drop function get_feature_value, it wasn't adding much value. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4720 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index eff6d943..4836c8d0 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -84,13 +84,6 @@ void print_chip_raw(const sensors_chip_name *name) } } -static int get_feature_value(const sensors_chip_name *name, - const sensors_feature_data *feature, - double *val) -{ - return sensors_get_value(name, feature->number, val); -} - static void sensors_get_available_features(const sensors_chip_name *name, const sensors_feature_data *feature, int i, short *has_features, @@ -109,7 +102,7 @@ static void sensors_get_available_features(const sensors_chip_name *name, return; } - if (get_feature_value(name, iter, &feature_vals[indx])) + if (sensors_get_value(name, iter->number, &feature_vals[indx])) printf("ERROR: Can't get %s data!\n", iter->name); has_features[indx] = 1; @@ -177,7 +170,7 @@ static void print_generic_chip_temp(const sensors_chip_name *name, return; } - if (get_feature_value(name, feature, &val)) { + if (sensors_get_value(name, feature->number, &val)) { printf("ERROR: Can't get %s data!\n", label); free(label); return; @@ -297,7 +290,7 @@ static void print_generic_chip_in(const sensors_chip_name *name, return; } - if (get_feature_value(name, feature, &val)) { + if (sensors_get_value(name, feature->number, &val)) { printf("ERROR: Can't get %s data!\n", label); free(label); return; @@ -362,7 +355,7 @@ static void print_generic_chip_fan(const sensors_chip_name *name, return; } - if (get_feature_value(name, feature, &val)) { + if (sensors_get_value(name, feature->number, &val)) { printf("ERROR: Can't get %s data!\n", label); free(label); return; From 9fe77731a9f26b5ffcb2b197ad2145d03de14a3a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:52:24 +0000 Subject: [PATCH 215/718] Fix error message in print_chip_raw(). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4723 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 4836c8d0..b54e2913 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -62,7 +62,7 @@ void print_chip_raw(const sensors_chip_name *name) a = 0; while ((data = sensors_get_all_features(name, &a))) { if (!(label = sensors_get_label(name, data->number))) { - printf("ERROR: Can't get feature `%s' data!\n", + printf("ERROR: Can't get feature `%s' label!\n", data->name); continue; } From deb41a945d7ca9598fd4e16bc257e5edbb7cf6da Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 20:55:36 +0000 Subject: [PATCH 216/718] Move print_chip_raw() at the top of the file, as it is indepdendent from all the other functions. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4724 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index b54e2913..951518ef 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -27,31 +27,6 @@ #include "chips.h" #include "lib/sensors.h" -static inline double deg_ctof(double cel) -{ - return cel * (9.0F / 5.0F) + 32.0F; -} - -static void print_label(const char *label, int space) -{ - int len = strlen(label)+1; - printf("%s:%*s", label, space - len, ""); -} - -static void print_vid_info(const sensors_chip_name *name, int f_vid, - int label_size) -{ - char *label; - double vid; - - if ((label = sensors_get_label(name, f_vid)) - && !sensors_get_value(name, f_vid, &vid)) { - print_label(label, label_size); - printf("%+6.3f V\n", vid); - } - free(label); -} - void print_chip_raw(const sensors_chip_name *name) { int a; @@ -84,6 +59,31 @@ void print_chip_raw(const sensors_chip_name *name) } } +static inline double deg_ctof(double cel) +{ + return cel * (9.0F / 5.0F) + 32.0F; +} + +static void print_label(const char *label, int space) +{ + int len = strlen(label)+1; + printf("%s:%*s", label, space - len, ""); +} + +static void print_vid_info(const sensors_chip_name *name, int f_vid, + int label_size) +{ + char *label; + double vid; + + if ((label = sensors_get_label(name, f_vid)) + && !sensors_get_value(name, f_vid, &vid)) { + print_label(label, label_size); + printf("%+6.3f V\n", vid); + } + free(label); +} + static void sensors_get_available_features(const sensors_chip_name *name, const sensors_feature_data *feature, int i, short *has_features, From 4e5d6954116bd5100ea16610b7bf5e010e088a73 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 21:10:42 +0000 Subject: [PATCH 217/718] Don't print the feature name for subfeatures in raw mode. Subfeatures typically don't have a label so printing their label is equivalent to printing their name, so printing it again is redundant. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4725 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 951518ef..d97aa743 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -48,8 +48,7 @@ void print_chip_raw(const sensors_chip_name *name) continue; } if (data->mapping != SENSORS_NO_MAPPING) - printf(" %s: %.2f (%s)\n", label, val, - data->name); + printf(" %s: %.2f\n", label, val); else printf("%s: %.2f (%s)\n", label, val, data->name); From eaeaffb89bfb1f94630213b3e3692d7e1ceabcb9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 21:14:37 +0000 Subject: [PATCH 218/718] Fix a memory leak on error in raw print mode. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4726 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/chips.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 8f900bcd..a7e98c53 100644 --- a/CHANGES +++ b/CHANGES @@ -53,6 +53,7 @@ SVN HEAD Program sensors: Drop all the chip-specific support Fix alignment of alarm for one-limit temperatures Drop option -U + Fix a memory leak on error (with -u) Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection Add /usr/sbin to the PATH (#2199) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index d97aa743..3fec5ca1 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -42,12 +42,10 @@ void print_chip_raw(const sensors_chip_name *name) continue; } if (data->mode & SENSORS_MODE_R) { - if (sensors_get_value(name, data->number, &val)) { + if (sensors_get_value(name, data->number, &val)) printf("ERROR: Can't get feature `%s' data!\n", data->name); - continue; - } - if (data->mapping != SENSORS_NO_MAPPING) + else if (data->mapping != SENSORS_NO_MAPPING) printf(" %s: %.2f\n", label, val); else printf("%s: %.2f (%s)\n", label, val, From 2ee12591dfef3268696314e7d56125dc50ca255f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 26 Aug 2007 21:26:20 +0000 Subject: [PATCH 219/718] Remove "generic" from all printing function names. This is the default mode now so no need to mention it explicitly. Rename print_vid_info to print_chip_vid and move it around for consistency. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4728 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 56 ++++++++++++++++++++++---------------------- prog/sensors/chips.h | 2 +- prog/sensors/main.c | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 3fec5ca1..5d5ec5e7 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -67,20 +67,6 @@ static void print_label(const char *label, int space) printf("%s:%*s", label, space - len, ""); } -static void print_vid_info(const sensors_chip_name *name, int f_vid, - int label_size) -{ - char *label; - double vid; - - if ((label = sensors_get_label(name, f_vid)) - && !sensors_get_value(name, f_vid, &vid)) { - print_label(label, label_size); - printf("%+6.3f V\n", vid); - } - free(label); -} - static void sensors_get_available_features(const sensors_chip_name *name, const sensors_feature_data *feature, int i, short *has_features, @@ -150,9 +136,9 @@ static void print_temp_limits(double limit1, double limit2, #define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] #define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] -static void print_generic_chip_temp(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int label_size) +static void print_chip_temp(const sensors_chip_name *name, + const sensors_feature_data *feature, int i, + int label_size) { double val, limit1, limit2; const char *s1, *s2; @@ -272,9 +258,9 @@ static void print_generic_chip_temp(const sensors_chip_name *name, #define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] #define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] -static void print_generic_chip_in(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int label_size) +static void print_chip_in(const sensors_chip_name *name, + const sensors_feature_data *feature, int i, + int label_size) { const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0, }; @@ -337,9 +323,9 @@ static void print_generic_chip_in(const sensors_chip_name *name, #define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] #define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] -static void print_generic_chip_fan(const sensors_chip_name *name, - const sensors_feature_data *feature, - int i, int label_size) +static void print_chip_fan(const sensors_chip_name *name, + const sensors_feature_data *feature, int i, + int label_size) { char *label; const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; @@ -390,7 +376,21 @@ static void print_generic_chip_fan(const sensors_chip_name *name, printf("\n"); } -void print_generic_chip(const sensors_chip_name *name) +static void print_chip_vid(const sensors_chip_name *name, int f_vid, + int label_size) +{ + char *label; + double vid; + + if ((label = sensors_get_label(name, f_vid)) + && !sensors_get_value(name, f_vid, &vid)) { + print_label(label, label_size); + printf("%+6.3f V\n", vid); + } + free(label); +} + +void print_chip(const sensors_chip_name *name) { const sensors_feature_data *feature; int i, label_size; @@ -404,16 +404,16 @@ void print_generic_chip(const sensors_chip_name *name) switch (feature->type) { case SENSORS_FEATURE_TEMP: - print_generic_chip_temp(name, feature, i, label_size); + print_chip_temp(name, feature, i, label_size); break; case SENSORS_FEATURE_IN: - print_generic_chip_in(name, feature, i, label_size); + print_chip_in(name, feature, i, label_size); break; case SENSORS_FEATURE_FAN: - print_generic_chip_fan(name, feature, i, label_size); + print_chip_fan(name, feature, i, label_size); break; case SENSORS_FEATURE_VID: - print_vid_info(name, feature->number, label_size); + print_chip_vid(name, feature->number, label_size); break; default: continue; diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index ad7f3831..06b82bc0 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -23,6 +23,6 @@ #include "lib/sensors.h" void print_chip_raw(const sensors_chip_name *name); -void print_generic_chip(const sensors_chip_name *name); +void print_chip(const sensors_chip_name *name); #endif /* def PROG_SENSORS_CHIPS_H */ diff --git a/prog/sensors/main.c b/prog/sensors/main.c index a1b60ee6..f441981a 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -160,7 +160,7 @@ static void do_a_print(const sensors_chip_name *name) if (do_raw) print_chip_raw(name); else - print_generic_chip(name); + print_chip(name); printf("\n"); } From 38d1d82cec2da11ae72225951764e00356c64149 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 29 Aug 2007 14:00:47 +0000 Subject: [PATCH 220/718] Looking up a mapping can't fail if looking up the feature itself succeeded (or that would be a bug in the library code.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4729 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/access.c b/lib/access.c index 64b75c53..632909a0 100644 --- a/lib/access.c +++ b/lib/access.c @@ -231,11 +231,13 @@ int sensors_get_value(const sensors_chip_name *name, int feature, return -SENSORS_ERR_WILDCARDS; if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; + if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) alt_feature = NULL; - else if (!(alt_feature = sensors_lookup_feature_nr(name, - main_feature->data.compute_mapping))) - return -SENSORS_ERR_NO_ENTRY; + else + alt_feature = sensors_lookup_feature_nr(name, + main_feature->data.compute_mapping); + if (!(main_feature->data.mode & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; for (chip = NULL; @@ -276,11 +278,13 @@ int sensors_set_value(const sensors_chip_name *name, int feature, return -SENSORS_ERR_WILDCARDS; if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; + if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) alt_feature = NULL; - else if (!(alt_feature = sensors_lookup_feature_nr(name, - main_feature->data.compute_mapping))) - return -SENSORS_ERR_NO_ENTRY; + else + alt_feature = sensors_lookup_feature_nr(name, + main_feature->data.compute_mapping); + if (!(main_feature->data.mode & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; for (chip = NULL; From 5b1068a00750a0e835e6e0bfb67922a7af97515c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 29 Aug 2007 14:08:47 +0000 Subject: [PATCH 221/718] Rename SENSORS_FEATURE_TEMP_SENS to SENSORS_FEATURE_TEMP_TYPE. This better reflects what this feature is, in line with the sysfs file name. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4730 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 2 +- lib/sensors.h | 2 +- prog/sensors/chips.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/access.c b/lib/access.c index 632909a0..e7d6c98e 100644 --- a/lib/access.c +++ b/lib/access.c @@ -521,7 +521,7 @@ static const struct feature_subtype_match temp_matches[] = { { "max_alarm", SENSORS_FEATURE_TEMP_MAX_ALARM }, { "crit_alarm", SENSORS_FEATURE_TEMP_CRIT_ALARM }, { "fault", SENSORS_FEATURE_TEMP_FAULT }, - { "type", SENSORS_FEATURE_TEMP_SENS }, + { "type", SENSORS_FEATURE_TEMP_TYPE }, { NULL, 0 } }; diff --git a/lib/sensors.h b/lib/sensors.h index d1269e19..59455ffa 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -149,7 +149,7 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_TEMP_MIN_ALARM, SENSORS_FEATURE_TEMP_CRIT_ALARM, SENSORS_FEATURE_TEMP_FAULT, - SENSORS_FEATURE_TEMP_SENS, + SENSORS_FEATURE_TEMP_TYPE, SENSORS_FEATURE_VID = 0x300, diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 5d5ec5e7..ed710015 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -144,9 +144,9 @@ static void print_chip_temp(const sensors_chip_name *name, const char *s1, *s2; int alarm, crit_displayed = 0; char *label; - const int size = SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP; - short has_features[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0, }; - double feature_vals[SENSORS_FEATURE_TEMP_SENS - SENSORS_FEATURE_TEMP] = { 0.0, }; + const int size = SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP; + short has_features[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP] = { 0, }; + double feature_vals[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP] = { 0.0, }; if (!(label = sensors_get_label(name, feature->number))) { printf("ERROR: Can't get temperature label!\n"); @@ -237,8 +237,8 @@ static void print_chip_temp(const sensors_chip_name *name, } /* print out temperature sensor info */ - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_SENS)) { - int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_SENS); + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_TYPE)) { + int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_TYPE); /* older kernels / drivers sometimes report a beta value for thermistors */ From ed2b9171ec1848904aa16c937f53dd1d152b6e65 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 30 Aug 2007 21:10:41 +0000 Subject: [PATCH 222/718] Allocate the large sparse feature table in sensors_read_dynamic_chip() dynamically. Having large amounts of data on the stack is generally not recommended. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4731 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 9ee2dfd8..2aa6f59b 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -36,7 +36,11 @@ char sensors_sysfs_mount[NAME_MAX]; -#define MAX_SENSORS_PER_TYPE 16 +#define MAX_SENSORS_PER_TYPE 16 +/* Room for all 3 types (in, fan, temp) with all their subfeatures + VID */ +#define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * \ + SENSORS_FEATURE_MAX_SUB_FEATURES * 3 \ + + MAX_SENSORS_PER_TYPE) static int get_type_scaling(int type) @@ -65,13 +69,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, int i, type, fnum = 1; struct sysfs_attribute *attr; struct dlist *attrs; - /* room for all 3 (in, fan, temp) types, with all their subfeatures - + VID. We use a large sparse table at first to store all - found features, so that we can store them sorted at type and index - and then later create a dense sorted table */ - sensors_chip_feature features[MAX_SENSORS_PER_TYPE * - SENSORS_FEATURE_MAX_SUB_FEATURES * 3 + - MAX_SENSORS_PER_TYPE]; + sensors_chip_feature *features; sensors_chip_feature *dyn_features; char *name; @@ -80,7 +78,12 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, if (attrs == NULL) return -ENOENT; - memset(features, 0, sizeof(features)); + /* We use a large sparse table at first to store all found features, + so that we can store them sorted at type and index and then later + create a dense sorted table. */ + features = calloc(ALL_POSSIBLE_FEATURES, sizeof(sensors_chip_feature)); + if (!features) + sensors_fatal_error(__FUNCTION__, "Out of memory"); dlist_for_each_data(attrs, attr, struct sysfs_attribute) { sensors_chip_feature feature; @@ -168,7 +171,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, if (fnum == 1) { /* No feature */ chip->feature = NULL; - return 0; + goto exit_free; } dyn_features = calloc(fnum, sizeof(sensors_chip_feature)); @@ -177,7 +180,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } fnum = 0; - for(i = 0; i < ARRAY_SIZE(features); i++) { + for(i = 0; i < ALL_POSSIBLE_FEATURES; i++) { if (features[i].data.name) { dyn_features[fnum] = features[i]; fnum++; @@ -186,6 +189,8 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, chip->feature = dyn_features; +exit_free: + free(features); return 0; } From b491ba49d43739a4ff75bcf661451db602c7469d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 30 Aug 2007 21:21:15 +0000 Subject: [PATCH 223/718] Make SENSORS_FEATURE_MAX_SUB_FEATURES private (and rename it to MAX_SUB_FEATURES in the process.) This value could change in the future so it's not safe to make it part of the libsensors API. And it isn't needed either, applications shouldn't need to use this value. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4732 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 4 ---- lib/sysfs.c | 16 ++++++---------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/lib/sensors.h b/lib/sensors.h index 59455ffa..60633f23 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -154,10 +154,6 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_VID = 0x300, SENSORS_FEATURE_UNKNOWN = INT_MAX, - - /* special the largest number of subfeatures used, iow the - highest ## from all the 0x?## above + 1*/ - SENSORS_FEATURE_MAX_SUB_FEATURES = 22 } sensors_feature_type; /* This structure is used when you want to get all features of a specific diff --git a/lib/sysfs.c b/lib/sysfs.c index 2aa6f59b..fcc93ced 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -37,9 +37,9 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 16 +#define MAX_SUB_FEATURES 22 /* Room for all 3 types (in, fan, temp) with all their subfeatures + VID */ -#define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * \ - SENSORS_FEATURE_MAX_SUB_FEATURES * 3 \ +#define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 3 \ + MAX_SENSORS_PER_TYPE) static @@ -122,12 +122,10 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* "calculate" a place to store the feature in our sparse, sorted table */ if (type == SENSORS_FEATURE_VID) { - i = nr + MAX_SENSORS_PER_TYPE * - SENSORS_FEATURE_MAX_SUB_FEATURES * 3; + i = nr + MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 3; } else { i = (type >> 8) * MAX_SENSORS_PER_TYPE * - SENSORS_FEATURE_MAX_SUB_FEATURES + - nr * SENSORS_FEATURE_MAX_SUB_FEATURES + + MAX_SUB_FEATURES + nr * MAX_SUB_FEATURES + (type & 0xFF); } @@ -149,12 +147,10 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, feature.data.compute_mapping = SENSORS_NO_MAPPING; } else if (type & 0x10) { /* sub feature without compute mapping */ - feature.data.mapping = i - - i % SENSORS_FEATURE_MAX_SUB_FEATURES + 1; + feature.data.mapping = i - i % MAX_SUB_FEATURES + 1; feature.data.compute_mapping = SENSORS_NO_MAPPING; } else { - feature.data.mapping = i - - i % SENSORS_FEATURE_MAX_SUB_FEATURES + 1; + feature.data.mapping = i - i % MAX_SUB_FEATURES + 1; feature.data.compute_mapping = feature.data.mapping; } From c00e21cf381a2061feac4ce09e54191e77493c01 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 30 Aug 2007 21:23:22 +0000 Subject: [PATCH 224/718] Reorder the members of the structures sensors_feature_data and sensors_bus_id. This prevents wasting space with padding on 64-bit systems, saving some memory (128 bytes for sensors_bus_id, nothing yet for sensors_feature_data but it will come later). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4733 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.h | 2 +- lib/libsensors.3 | 4 ++-- lib/sensors.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/data.h b/lib/data.h index e1708c93..5f089eda 100644 --- a/lib/data.h +++ b/lib/data.h @@ -113,8 +113,8 @@ typedef struct sensors_chip { /* Config file bus declaration: the bus type and number, combined with adapter name */ typedef struct sensors_bus { - sensors_bus_id bus; char *adapter; + sensors_bus_id bus; int lineno; } sensors_bus; diff --git a/lib/libsensors.3 b/lib/libsensors.3 index ddd0881c..dcd9ef1c 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -104,10 +104,10 @@ they point to internal structures! This structure is used when you want to get all features of a specific chip. .br \fBtypedef struct sensors_feature_data { -.br - int number; .br const char *name; +.br + int number; .br sensors_feature_type type; .br diff --git a/lib/sensors.h b/lib/sensors.h index 60633f23..699dcec6 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -159,8 +159,8 @@ typedef enum sensors_feature_type { /* This structure is used when you want to get all features of a specific chip. */ typedef struct sensors_feature_data { - int number; char *name; + int number; sensors_feature_type type; int mapping; int compute_mapping; From 02dc2e66796c57a8f1a5035764e824f7beb745b5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 31 Aug 2007 14:09:32 +0000 Subject: [PATCH 225/718] Add support for the Intel Tolapai SMBus controller. Patch from Jason Gaston. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4735 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index a7e98c53..81efef55 100644 --- a/CHANGES +++ b/CHANGES @@ -70,6 +70,7 @@ SVN HEAD Add Fintek F71806FG and F71862FG detection Add Winbond W83L786NR/NG/R/G detection Add Winbond W83L771W/G detection + Add Intel Tolapai SMBus detection 2.10.3 (20070319) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index b85e0284..5bb672ac 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -166,7 +166,14 @@ $revision =~ s/ \([^()]*\)//; procid => "Intel ICH9", driver => "i2c-i801", match => qr/^SMBus I801 adapter at [0-9a-f]{4}/, - }, + }, + { + vendid => 0x8086, + devid => 0x5032, + procid => "Intel Tolapai", + driver => "i2c-i801", + match => qr/^SMBus I801 adapter at [0-9a-f]{4}/, + }, { vendid => 0x1106, devid => 0x3040, From a82c6b0476fac3fa5c46f542fa9a1eac79f855a8 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 31 Aug 2007 14:42:20 +0000 Subject: [PATCH 226/718] Mass reindent, coding style and whitespace cleanups. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4736 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 6 +- lib/access.h | 4 +- lib/conf.h | 4 +- lib/data.c | 2 +- lib/data.h | 104 +++++++++++++++---------------- lib/error.c | 54 ++++++++--------- lib/error.h | 2 +- lib/general.c | 83 +++++++++++++------------ lib/general.h | 16 ++--- lib/init.c | 165 +++++++++++++++++++++++++------------------------- lib/scanner.h | 4 +- lib/sensors.h | 2 +- lib/sysfs.c | 40 ++++++------ lib/sysfs.h | 6 +- 14 files changed, 249 insertions(+), 243 deletions(-) diff --git a/lib/access.c b/lib/access.c index e7d6c98e..af8167cb 100644 --- a/lib/access.c +++ b/lib/access.c @@ -29,8 +29,8 @@ #include "general.h" static int sensors_eval_expr(const sensors_chip_name *name, - const sensors_expr *expr, - double val, double *result); + const sensors_expr *expr, + double val, double *result); /* Compare two chips name descriptions, to see whether they could match. Return 0 if it does not match, return 1 if it does match. */ @@ -158,7 +158,7 @@ char *sensors_get_label(const sensors_chip_name *name, int feature) for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->labels_count; i++) - if (!strcasecmp(featureptr->data.name,chip->labels[i].name)){ + if (!strcasecmp(featureptr->data.name, chip->labels[i].name)) { label = strdup(chip->labels[i].value); goto sensors_get_label_exit; } diff --git a/lib/access.h b/lib/access.h index b5639246..736f2c1d 100644 --- a/lib/access.h +++ b/lib/access.h @@ -26,8 +26,8 @@ /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found. */ -extern const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, - int feature); +const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, + int feature); /* Check whether the chip name is an 'absolute' name, which can only match one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 diff --git a/lib/conf.h b/lib/conf.h index 3fa07504..adf2136b 100644 --- a/lib/conf.h +++ b/lib/conf.h @@ -21,12 +21,12 @@ #define LIB_SENSORS_CONF_H /* This is defined in conf-lex.l */ -extern int sensors_yylex(void); +int sensors_yylex(void); extern char sensors_lex_error[]; extern int sensors_yylineno; extern FILE *sensors_yyin; /* This is defined in conf-parse.y */ -extern int sensors_yyparse(void); +int sensors_yyparse(void); #endif /* LIB_SENSORS_CONF_H */ diff --git a/lib/data.c b/lib/data.c index 6e0dbc9d..489a592c 100644 --- a/lib/data.c +++ b/lib/data.c @@ -48,7 +48,7 @@ sensors_bus *sensors_proc_bus = NULL; int sensors_proc_bus_count = 0; int sensors_proc_bus_max = 0; -static int sensors_substitute_chip(sensors_chip_name *name,int lineno); +static int sensors_substitute_chip(sensors_chip_name *name, int lineno); /* Parse a chip name to the internal representation. These are valid names: diff --git a/lib/data.h b/lib/data.h index 5f089eda..25818a6f 100644 --- a/lib/data.h +++ b/lib/data.h @@ -27,95 +27,97 @@ data. */ /* Kinds of expression operators recognized */ -typedef enum sensors_operation { - sensors_add, sensors_sub, sensors_multiply, sensors_divide, - sensors_negate, sensors_exp, sensors_log } sensors_operation; +typedef enum sensors_operation { + sensors_add, sensors_sub, sensors_multiply, sensors_divide, + sensors_negate, sensors_exp, sensors_log, +} sensors_operation; /* An expression can have several forms */ typedef enum sensors_expr_kind { - sensors_kind_val, sensors_kind_source, sensors_kind_var, - sensors_kind_sub } sensors_expr_kind; + sensors_kind_val, sensors_kind_source, sensors_kind_var, + sensors_kind_sub +} sensors_expr_kind; /* An expression. It is either a floating point value, a variable name, an operation on subexpressions, or the special value 'sub' } */ struct sensors_expr; typedef struct sensors_subexpr { - sensors_operation op; - struct sensors_expr *sub1; - struct sensors_expr *sub2; + sensors_operation op; + struct sensors_expr *sub1; + struct sensors_expr *sub2; } sensors_subexpr; typedef struct sensors_expr { - sensors_expr_kind kind; - union { - double val; - char *var; - sensors_subexpr subexpr; - } data; + sensors_expr_kind kind; + union { + double val; + char *var; + sensors_subexpr subexpr; + } data; } sensors_expr; /* Config file label declaration: a feature name, combined with the label value */ typedef struct sensors_label { - char *name; - char *value; - int lineno; + char *name; + char *value; + int lineno; } sensors_label; /* Config file set declaration: a feature name, combined with an expression */ typedef struct sensors_set { - char *name; - sensors_expr *value; - int lineno; + char *name; + sensors_expr *value; + int lineno; } sensors_set; -/* Config file compute declaration: a feature name, combined with two +/* Config file compute declaration: a feature name, combined with two expressions */ typedef struct sensors_compute { - char *name; - sensors_expr *from_proc; - sensors_expr *to_proc; - int lineno; + char *name; + sensors_expr *from_proc; + sensors_expr *to_proc; + int lineno; } sensors_compute; /* Config file ignore declaration: a feature name */ typedef struct sensors_ignore { - char *name; - int lineno; + char *name; + int lineno; } sensors_ignore; /* A list of chip names, used to represent a config file chips declaration */ typedef struct sensors_chip_name_list { - sensors_chip_name *fits; - int fits_count; - int fits_max; + sensors_chip_name *fits; + int fits_count; + int fits_max; } sensors_chip_name_list; /* A config file chip block */ typedef struct sensors_chip { - sensors_chip_name_list chips; - sensors_label *labels; - int labels_count; - int labels_max; - sensors_set *sets; - int sets_count; - int sets_max; - sensors_compute *computes; - int computes_count; - int computes_max; - sensors_ignore *ignores; - int ignores_count; - int ignores_max; - int lineno; + sensors_chip_name_list chips; + sensors_label *labels; + int labels_count; + int labels_max; + sensors_set *sets; + int sets_count; + int sets_max; + sensors_compute *computes; + int computes_count; + int computes_max; + sensors_ignore *ignores; + int ignores_count; + int ignores_max; + int lineno; } sensors_chip; /* Config file bus declaration: the bus type and number, combined with adapter name */ typedef struct sensors_bus { - char *adapter; - sensors_bus_id bus; - int lineno; + char *adapter; + sensors_bus_id bus; + int lineno; } sensors_bus; /* Internal data about a single chip feature. @@ -135,14 +137,14 @@ typedef struct sensors_bus { scaling is the number of decimal points to scale by. Divide the read value by 10**scaling to get the real value. */ typedef struct sensors_chip_feature { - sensors_feature_data data; - int scaling; + sensors_feature_data data; + int scaling; } sensors_chip_feature; /* Internal data about all features of a type of chip */ typedef struct sensors_chip_features { - struct sensors_chip_name chip; - struct sensors_chip_feature *feature; + struct sensors_chip_name chip; + struct sensors_chip_feature *feature; } sensors_chip_features; extern sensors_chip *sensors_config_chips; diff --git a/lib/error.c b/lib/error.c index 1a869f6c..9c90b624 100644 --- a/lib/error.c +++ b/lib/error.c @@ -23,43 +23,43 @@ #include "general.h" static void sensors_default_parse_error(const char *err, int lineno); -static void sensors_default_fatal_error(const char *proc,const char *err); +static void sensors_default_fatal_error(const char *proc, const char *err); -void (*sensors_parse_error) (const char *err, int lineno) = - sensors_default_parse_error; -void (*sensors_fatal_error) (const char *proc, const char *err) = - sensors_default_fatal_error; +void (*sensors_parse_error) (const char *err, int lineno) = + sensors_default_parse_error; +void (*sensors_fatal_error) (const char *proc, const char *err) = + sensors_default_fatal_error; -static const char *errorlist[] = - { /* Unknown error */ "sensors_strerror: Unknown error!", - /* SENSORS_ERR_WILDCARDS */ "Wildcard found in chip name", - /* SENSORS_ERR_NO_ENTRY */ "No such feature known", - /* SENSORS_ERR_ACCESS */ "Can't read or write", - /* SENSORS_ERR_PROC */ "Can't access sysfs file", - /* SENSORS_ERR_DIV_ZERO */ "Divide by zero", - /* SENSORS_ERR_CHIP_NAME */ "Can't parse chip name", - /* SENSORS_ERR_BUS_NAME */ "Can't parse bus name", - /* SENSORS_ERR_PARSE */ "General parse error", - /* SENSORS_ERR_ACCESS_W */ "Can't write", - /* SENSORS_ERR_ACCESS_R */ "Can't read" - }; +static const char *errorlist[] = { + /* Unknown error */ "sensors_strerror: Unknown error!", + /* SENSORS_ERR_WILDCARDS */ "Wildcard found in chip name", + /* SENSORS_ERR_NO_ENTRY */ "No such feature known", + /* SENSORS_ERR_ACCESS */ "Can't read or write", + /* SENSORS_ERR_PROC */ "Can't access sysfs file", + /* SENSORS_ERR_DIV_ZERO */ "Divide by zero", + /* SENSORS_ERR_CHIP_NAME */ "Can't parse chip name", + /* SENSORS_ERR_BUS_NAME */ "Can't parse bus name", + /* SENSORS_ERR_PARSE */ "General parse error", + /* SENSORS_ERR_ACCESS_W */ "Can't write", + /* SENSORS_ERR_ACCESS_R */ "Can't read", +}; const char *sensors_strerror(int errnum) { - if (errnum < 0) - errnum = -errnum; - if (errnum >= ARRAY_SIZE(errorlist)) - errnum = 0; - return errorlist[errnum]; -} + if (errnum < 0) + errnum = -errnum; + if (errnum >= ARRAY_SIZE(errorlist)) + errnum = 0; + return errorlist[errnum]; +} void sensors_default_parse_error(const char *err, int lineno) { - fprintf(stderr,"Error: Line %d: %s\n",lineno,err); + fprintf(stderr, "Error: Line %d: %s\n", lineno, err); } void sensors_default_fatal_error(const char *proc, const char *err) { - fprintf(stderr,"Fatal error in `%s': %s\n",proc,err); - exit(1); + fprintf(stderr, "Fatal error in `%s': %s\n", proc, err); + exit(1); } diff --git a/lib/error.h b/lib/error.h index 9ff72ffb..47febd68 100644 --- a/lib/error.h +++ b/lib/error.h @@ -39,7 +39,7 @@ extern "C" { /* This function returns a pointer to a string which describes the error. errnum may be negative (the corresponding positive error is returned). You may not modify the result! */ -extern const char *sensors_strerror(int errnum); +const char *sensors_strerror(int errnum); /* This function is called when a parse error is detected. Give it a new value, and your own function is called instead of the default (which diff --git a/lib/general.c b/lib/general.c index 9374b58c..f032d494 100644 --- a/lib/general.c +++ b/lib/general.c @@ -29,62 +29,65 @@ void sensors_malloc_array(void *list, int *num_el, int *max_el, int el_size) { - void **my_list = (void **)list; + void **my_list = (void **)list; - *my_list = malloc(el_size*A_BUNCH); - if (! *my_list) - sensors_fatal_error("sensors_malloc_array","Allocating new elements"); - *max_el = A_BUNCH; - *num_el = 0; + *my_list = malloc(el_size*A_BUNCH); + if (! *my_list) + sensors_fatal_error("sensors_malloc_array", + "Allocating new elements"); + *max_el = A_BUNCH; + *num_el = 0; } void sensors_free_array(void *list, int *num_el, int *max_el) { - void **my_list = (void **)list; + void **my_list = (void **)list; - free(*my_list); - *my_list = NULL; - *num_el = 0; - *max_el = 0; + free(*my_list); + *my_list = NULL; + *num_el = 0; + *max_el = 0; } void sensors_add_array_el(const void *el, void *list, int *num_el, - int *max_el, int el_size) + int *max_el, int el_size) { - int new_max_el; - void **my_list = (void *)list; - if (*num_el + 1 > *max_el) { - new_max_el = *max_el + A_BUNCH; - *my_list = realloc(*my_list,new_max_el * el_size); - if (! *my_list) - sensors_fatal_error("sensors_add_array_el","Allocating new elements"); - *max_el = new_max_el; - } - memcpy(((char *) *my_list) + *num_el * el_size, el, el_size); - (*num_el) ++; + int new_max_el; + void **my_list = (void *)list; + if (*num_el + 1 > *max_el) { + new_max_el = *max_el + A_BUNCH; + *my_list = realloc(*my_list, new_max_el * el_size); + if (! *my_list) + sensors_fatal_error("sensors_add_array_el", + "Allocating new elements"); + *max_el = new_max_el; + } + memcpy(((char *) *my_list) + *num_el * el_size, el, el_size); + (*num_el) ++; } -void sensors_add_array_els(const void *els, int nr_els, void *list, - int *num_el, int *max_el, int el_size) +void sensors_add_array_els(const void *els, int nr_els, void *list, + int *num_el, int *max_el, int el_size) { - int new_max_el; - void **my_list = (void *)list; - if (*num_el + nr_els > *max_el) { - new_max_el = (*max_el + nr_els + A_BUNCH); - new_max_el -= new_max_el % A_BUNCH; - *my_list = realloc(*my_list,new_max_el * el_size); - if (! *my_list) - sensors_fatal_error("sensors_add_array_els","Allocating new elements"); - *max_el = new_max_el; - } - memcpy(((char *)*my_list) + *num_el * el_size, els, el_size * nr_els); - *num_el += nr_els; + int new_max_el; + void **my_list = (void *)list; + if (*num_el + nr_els > *max_el) { + new_max_el = (*max_el + nr_els + A_BUNCH); + new_max_el -= new_max_el % A_BUNCH; + *my_list = realloc(*my_list, new_max_el * el_size); + if (! *my_list) + sensors_fatal_error("sensors_add_array_els", + "Allocating new elements"); + *max_el = new_max_el; + } + memcpy(((char *)*my_list) + *num_el * el_size, els, el_size * nr_els); + *num_el += nr_els; } /* Strip a string of all terminating spaces */ void sensors_strip_of_spaces(char *name) { - int i; - for (i = strlen(name)-1; (i>=0) && (name[i] == ' '); i--); - name[i+1] = '\0'; + int i; + for (i = strlen(name) - 1; i >= 0 && name[i] == ' '; i--); + name[i + 1] = '\0'; } diff --git a/lib/general.h b/lib/general.h index 5a5dee1a..73e5e620 100644 --- a/lib/general.h +++ b/lib/general.h @@ -25,16 +25,16 @@ made between the current number of elements and the maximum number. You can only add elements at the end. Primitive, but very useful for internal use. */ -extern void sensors_malloc_array(void *list, int *num_el, int *max_el, - int el_size); -extern void sensors_free_array(void *list, int *num_el, int *max_el); -extern void sensors_add_array_el(const void *el, void *list, int *num_el, - int *max_el, int el_size); -extern void sensors_add_array_els(const void *els, int nr_els, void *list, - int *num_el, int *max_el, int el_size); +void sensors_malloc_array(void *list, int *num_el, int *max_el, + int el_size); +void sensors_free_array(void *list, int *num_el, int *max_el); +void sensors_add_array_el(const void *el, void *list, int *num_el, + int *max_el, int el_size); +void sensors_add_array_els(const void *els, int nr_els, void *list, + int *num_el, int *max_el, int el_size); /* Strip a string of all terminating spaces */ -extern void sensors_strip_of_spaces(char *name); +void sensors_strip_of_spaces(char *name); #define ARRAY_SIZE(arr) (int)(sizeof(arr) / sizeof((arr)[0])) diff --git a/lib/init.c b/lib/init.c index 13c26f8e..bf7137c1 100644 --- a/lib/init.c +++ b/lib/init.c @@ -39,137 +39,138 @@ static void free_expr(sensors_expr *expr); int sensors_init(FILE *input) { - int res; + int res; - if (!sensors_init_sysfs()) - return -SENSORS_ERR_PROC; - if ((res = sensors_read_sysfs_bus()) || (res = sensors_read_sysfs_chips())) - return res; - if ((res = sensors_scanner_init(input))) - return -SENSORS_ERR_PARSE; - if ((res = sensors_yyparse())) - return -SENSORS_ERR_PARSE; - if ((res = sensors_substitute_busses())) - return res; - return 0; + if (!sensors_init_sysfs()) + return -SENSORS_ERR_PROC; + if ((res = sensors_read_sysfs_bus()) || + (res = sensors_read_sysfs_chips())) + return res; + if ((res = sensors_scanner_init(input))) + return -SENSORS_ERR_PARSE; + if ((res = sensors_yyparse())) + return -SENSORS_ERR_PARSE; + if ((res = sensors_substitute_busses())) + return res; + return 0; } void sensors_cleanup(void) { - int i; + int i; - sensors_scanner_exit(); + sensors_scanner_exit(); - for (i = 0; i < sensors_proc_chips_count; i++) { - free_chip_name(&sensors_proc_chips[i].chip); - free_chip_features(sensors_proc_chips[i].feature); - } - free(sensors_proc_chips); - sensors_proc_chips = NULL; - sensors_proc_chips_count = sensors_proc_chips_max = 0; - - for (i = 0; i < sensors_config_busses_count; i++) - free_bus(&sensors_config_busses[i]); - free(sensors_config_busses); - sensors_config_busses = NULL; - sensors_config_busses_count = sensors_config_busses_max = 0; + for (i = 0; i < sensors_proc_chips_count; i++) { + free_chip_name(&sensors_proc_chips[i].chip); + free_chip_features(sensors_proc_chips[i].feature); + } + free(sensors_proc_chips); + sensors_proc_chips = NULL; + sensors_proc_chips_count = sensors_proc_chips_max = 0; - for (i = 0; i < sensors_config_chips_count; i++) - free_chip(&sensors_config_chips[i]); - free(sensors_config_chips); - sensors_config_chips = NULL; - sensors_config_chips_count = sensors_config_chips_max = 0; + for (i = 0; i < sensors_config_busses_count; i++) + free_bus(&sensors_config_busses[i]); + free(sensors_config_busses); + sensors_config_busses = NULL; + sensors_config_busses_count = sensors_config_busses_max = 0; - for (i = 0; i < sensors_proc_bus_count; i++) - free_bus(&sensors_proc_bus[i]); - free(sensors_proc_bus); - sensors_proc_bus = NULL; - sensors_proc_bus_count = sensors_proc_bus_max = 0; + for (i = 0; i < sensors_config_chips_count; i++) + free_chip(&sensors_config_chips[i]); + free(sensors_config_chips); + sensors_config_chips = NULL; + sensors_config_chips_count = sensors_config_chips_max = 0; + + for (i = 0; i < sensors_proc_bus_count; i++) + free_bus(&sensors_proc_bus[i]); + free(sensors_proc_bus); + sensors_proc_bus = NULL; + sensors_proc_bus_count = sensors_proc_bus_max = 0; } void free_chip_name(sensors_chip_name *name) { - free(name->prefix); - free(name->path); + free(name->prefix); + free(name->path); } void free_chip_features(sensors_chip_feature *features) { - int i; + int i; - for (i = 0; features[i].data.name; i++) - free(features[i].data.name); - free(features); + for (i = 0; features[i].data.name; i++) + free(features[i].data.name); + free(features); } void free_bus(sensors_bus *bus) { - free(bus->adapter); + free(bus->adapter); } void free_chip(sensors_chip *chip) { - int i; + int i; - for (i = 0; i < chip->chips.fits_count; i++) - free_chip_name(&chip->chips.fits[i]); - free(chip->chips.fits); - chip->chips.fits_count = chip->chips.fits_max = 0; + for (i = 0; i < chip->chips.fits_count; i++) + free_chip_name(&chip->chips.fits[i]); + free(chip->chips.fits); + chip->chips.fits_count = chip->chips.fits_max = 0; - for (i = 0; i < chip->labels_count; i++) - free_label(&chip->labels[i]); - free(chip->labels); - chip->labels_count = chip->labels_max = 0; + for (i = 0; i < chip->labels_count; i++) + free_label(&chip->labels[i]); + free(chip->labels); + chip->labels_count = chip->labels_max = 0; - for (i = 0; i < chip->sets_count; i++) - free_set(&chip->sets[i]); - free(chip->sets); - chip->sets_count = chip->sets_max = 0; + for (i = 0; i < chip->sets_count; i++) + free_set(&chip->sets[i]); + free(chip->sets); + chip->sets_count = chip->sets_max = 0; - for (i = 0; i < chip->computes_count; i++) - free_compute(&chip->computes[i]); - free(chip->computes); - chip->computes_count = chip->computes_max = 0; + for (i = 0; i < chip->computes_count; i++) + free_compute(&chip->computes[i]); + free(chip->computes); + chip->computes_count = chip->computes_max = 0; - for (i = 0; i < chip->ignores_count; i++) - free_ignore(&chip->ignores[i]); - free(chip->ignores); - chip->ignores_count = chip->ignores_max = 0; + for (i = 0; i < chip->ignores_count; i++) + free_ignore(&chip->ignores[i]); + free(chip->ignores); + chip->ignores_count = chip->ignores_max = 0; } void free_label(sensors_label *label) { - free(label->name); - free(label->value); + free(label->name); + free(label->value); } void free_set(sensors_set *set) { - free(set->name); - free_expr(set->value); + free(set->name); + free_expr(set->value); } void free_compute(sensors_compute *compute) { - free(compute->name); - free_expr(compute->from_proc); - free_expr(compute->to_proc); + free(compute->name); + free_expr(compute->from_proc); + free_expr(compute->to_proc); } void free_ignore(sensors_ignore *ignore) { - free(ignore->name); + free(ignore->name); } void free_expr(sensors_expr *expr) { - if ((expr->kind) == sensors_kind_var) - free(expr->data.var); - else if ((expr->kind) == sensors_kind_sub) { - if (expr->data.subexpr.sub1) - free_expr(expr->data.subexpr.sub1); - if (expr->data.subexpr.sub2) - free_expr(expr->data.subexpr.sub2); - } - free(expr); + if ((expr->kind) == sensors_kind_var) + free(expr->data.var); + else if ((expr->kind) == sensors_kind_sub) { + if (expr->data.subexpr.sub1) + free_expr(expr->data.subexpr.sub1); + if (expr->data.subexpr.sub2) + free_expr(expr->data.subexpr.sub2); + } + free(expr); } diff --git a/lib/scanner.h b/lib/scanner.h index d8e9a413..b926fd06 100644 --- a/lib/scanner.h +++ b/lib/scanner.h @@ -20,8 +20,8 @@ #ifndef LIB_SENSORS_SCANNER_H #define LIB_SENSORS_SCANNER_H -extern int sensors_scanner_init(FILE *input); -extern void sensors_scanner_exit(void); +int sensors_scanner_init(FILE *input); +void sensors_scanner_exit(void); #endif diff --git a/lib/sensors.h b/lib/sensors.h index 699dcec6..b853687e 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -176,7 +176,7 @@ typedef struct sensors_feature_data { Do not try to change the returned structure; you will corrupt internal data structures. */ const sensors_feature_data *sensors_get_all_features - (const sensors_chip_name *name, int *nr); + (const sensors_chip_name *name, int *nr); #ifdef __cplusplus } diff --git a/lib/sysfs.c b/lib/sysfs.c index fcc93ced..a0e3c9a2 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -72,24 +72,24 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, sensors_chip_feature *features; sensors_chip_feature *dyn_features; char *name; - + attrs = sysfs_get_device_attributes(sysdir); - + if (attrs == NULL) return -ENOENT; - + /* We use a large sparse table at first to store all found features, so that we can store them sorted at type and index and then later create a dense sorted table. */ features = calloc(ALL_POSSIBLE_FEATURES, sizeof(sensors_chip_feature)); if (!features) sensors_fatal_error(__FUNCTION__, "Out of memory"); - + dlist_for_each_data(attrs, attr, struct sysfs_attribute) { sensors_chip_feature feature; name = attr->name; int nr; - + type = sensors_feature_get_type(name, &nr); if (type == SENSORS_FEATURE_UNKNOWN) continue; @@ -110,7 +110,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, nr--; break; } - + if (nr >= MAX_SENSORS_PER_TYPE) { fprintf(stderr, "libsensors error, more sensors of one" " type then MAX_SENSORS_PER_TYPE, ignoring " @@ -118,7 +118,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, free(feature.data.name); continue; } - + /* "calculate" a place to store the feature in our sparse, sorted table */ if (type == SENSORS_FEATURE_VID) { @@ -128,19 +128,19 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, MAX_SUB_FEATURES + nr * MAX_SUB_FEATURES + (type & 0xFF); } - - if (features[i].data.name) { + + if (features[i].data.name) { fprintf(stderr, "libsensors error, trying to add dupli" "cate feature: %s to dynamic feature table\n", name); free(feature.data.name); continue; } - + /* fill in the other feature members */ feature.data.number = i + 1; feature.data.type = type; - + if ((type & 0x00FF) == 0) { /* main feature */ feature.data.mapping = SENSORS_NO_MAPPING; @@ -153,7 +153,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, feature.data.mapping = i - i % MAX_SUB_FEATURES + 1; feature.data.compute_mapping = feature.data.mapping; } - + if (attr->method & SYSFS_METHOD_SHOW) feature.data.mode |= SENSORS_MODE_R; if (attr->method & SYSFS_METHOD_STORE) @@ -172,19 +172,19 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, dyn_features = calloc(fnum, sizeof(sensors_chip_feature)); if (dyn_features == NULL) { - sensors_fatal_error(__FUNCTION__,"Out of memory"); + sensors_fatal_error(__FUNCTION__, "Out of memory"); } - + fnum = 0; - for(i = 0; i < ALL_POSSIBLE_FEATURES; i++) { + for (i = 0; i < ALL_POSSIBLE_FEATURES; i++) { if (features[i].data.name) { dyn_features[fnum] = features[i]; fnum++; } } - + chip->feature = dyn_features; - + exit_free: free(features); return 0; @@ -268,7 +268,7 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) entry.chip.bus.nr = 0; } else goto exit_free; - + if (sensors_read_dynamic_chip(&entry, dev) < 0) goto exit_free; if (!entry.feature) { /* No feature, discard chip */ @@ -440,7 +440,7 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, return 0; } - + int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, double value) { @@ -451,7 +451,7 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, int dummy; char check; const char *suffix = ""; - + if (!(the_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; diff --git a/lib/sysfs.h b/lib/sysfs.h index 6aaa3508..847011bf 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -22,11 +22,11 @@ extern char sensors_sysfs_mount[]; -extern int sensors_init_sysfs(void); +int sensors_init_sysfs(void); -extern int sensors_read_sysfs_chips(void); +int sensors_read_sysfs_chips(void); -extern int sensors_read_sysfs_bus(void); +int sensors_read_sysfs_bus(void); /* Read a value out of a sysfs attribute file */ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, From 27200afa1da372b73cac420e799fc6d176d5e3c9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 31 Aug 2007 15:09:26 +0000 Subject: [PATCH 227/718] Reorder functions so that forward declarations are no longer needed. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4737 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/init.c | 184 +++++++++++++++++++++++++---------------------------- 1 file changed, 87 insertions(+), 97 deletions(-) diff --git a/lib/init.c b/lib/init.c index bf7137c1..c2149227 100644 --- a/lib/init.c +++ b/lib/init.c @@ -27,16 +27,6 @@ #include "sysfs.h" #include "scanner.h" -static void free_chip_name(sensors_chip_name *name); -static void free_chip_features(sensors_chip_feature *features); -static void free_bus(sensors_bus *bus); -static void free_chip(sensors_chip *chip); -static void free_label(sensors_label *label); -static void free_set(sensors_set *set); -static void free_compute(sensors_compute *compute); -static void free_ignore(sensors_ignore *ignore); -static void free_expr(sensors_expr *expr); - int sensors_init(FILE *input) { int res; @@ -55,6 +45,93 @@ int sensors_init(FILE *input) return 0; } +static void free_chip_name(sensors_chip_name *name) +{ + free(name->prefix); + free(name->path); +} + +static void free_chip_features(sensors_chip_feature *features) +{ + int i; + + for (i = 0; features[i].data.name; i++) + free(features[i].data.name); + free(features); +} + +static void free_bus(sensors_bus *bus) +{ + free(bus->adapter); +} + +static void free_label(sensors_label *label) +{ + free(label->name); + free(label->value); +} + +static void free_expr(sensors_expr *expr) +{ + if (expr->kind == sensors_kind_var) + free(expr->data.var); + else if (expr->kind == sensors_kind_sub) { + if (expr->data.subexpr.sub1) + free_expr(expr->data.subexpr.sub1); + if (expr->data.subexpr.sub2) + free_expr(expr->data.subexpr.sub2); + } + free(expr); +} + +static void free_set(sensors_set *set) +{ + free(set->name); + free_expr(set->value); +} + +static void free_compute(sensors_compute *compute) +{ + free(compute->name); + free_expr(compute->from_proc); + free_expr(compute->to_proc); +} + +static void free_ignore(sensors_ignore *ignore) +{ + free(ignore->name); +} + +static void free_chip(sensors_chip *chip) +{ + int i; + + for (i = 0; i < chip->chips.fits_count; i++) + free_chip_name(&chip->chips.fits[i]); + free(chip->chips.fits); + chip->chips.fits_count = chip->chips.fits_max = 0; + + for (i = 0; i < chip->labels_count; i++) + free_label(&chip->labels[i]); + free(chip->labels); + chip->labels_count = chip->labels_max = 0; + + for (i = 0; i < chip->sets_count; i++) + free_set(&chip->sets[i]); + free(chip->sets); + chip->sets_count = chip->sets_max = 0; + + for (i = 0; i < chip->computes_count; i++) + free_compute(&chip->computes[i]); + free(chip->computes); + chip->computes_count = chip->computes_max = 0; + + for (i = 0; i < chip->ignores_count; i++) + free_ignore(&chip->ignores[i]); + free(chip->ignores); + chip->ignores_count = chip->ignores_max = 0; +} + void sensors_cleanup(void) { int i; @@ -87,90 +164,3 @@ void sensors_cleanup(void) sensors_proc_bus = NULL; sensors_proc_bus_count = sensors_proc_bus_max = 0; } - -void free_chip_name(sensors_chip_name *name) -{ - free(name->prefix); - free(name->path); -} - -void free_chip_features(sensors_chip_feature *features) -{ - int i; - - for (i = 0; features[i].data.name; i++) - free(features[i].data.name); - free(features); -} - -void free_bus(sensors_bus *bus) -{ - free(bus->adapter); -} - -void free_chip(sensors_chip *chip) -{ - int i; - - for (i = 0; i < chip->chips.fits_count; i++) - free_chip_name(&chip->chips.fits[i]); - free(chip->chips.fits); - chip->chips.fits_count = chip->chips.fits_max = 0; - - for (i = 0; i < chip->labels_count; i++) - free_label(&chip->labels[i]); - free(chip->labels); - chip->labels_count = chip->labels_max = 0; - - for (i = 0; i < chip->sets_count; i++) - free_set(&chip->sets[i]); - free(chip->sets); - chip->sets_count = chip->sets_max = 0; - - for (i = 0; i < chip->computes_count; i++) - free_compute(&chip->computes[i]); - free(chip->computes); - chip->computes_count = chip->computes_max = 0; - - for (i = 0; i < chip->ignores_count; i++) - free_ignore(&chip->ignores[i]); - free(chip->ignores); - chip->ignores_count = chip->ignores_max = 0; -} - -void free_label(sensors_label *label) -{ - free(label->name); - free(label->value); -} - -void free_set(sensors_set *set) -{ - free(set->name); - free_expr(set->value); -} - -void free_compute(sensors_compute *compute) -{ - free(compute->name); - free_expr(compute->from_proc); - free_expr(compute->to_proc); -} - -void free_ignore(sensors_ignore *ignore) -{ - free(ignore->name); -} - -void free_expr(sensors_expr *expr) -{ - if ((expr->kind) == sensors_kind_var) - free(expr->data.var); - else if ((expr->kind) == sensors_kind_sub) { - if (expr->data.subexpr.sub1) - free_expr(expr->data.subexpr.sub1); - if (expr->data.subexpr.sub2) - free_expr(expr->data.subexpr.sub2); - } - free(expr); -} From 3c602aa03a521a608589b7553b33d79813dcd2cb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 1 Sep 2007 08:23:21 +0000 Subject: [PATCH 228/718] Remove broken ATI SB700 SMBus PCI ID. The SB700 SMBus actually uses the same PCI device ID as the SB600 SMBus. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4740 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 7 ------- 1 file changed, 7 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 5bb672ac..c0c85963 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -650,13 +650,6 @@ $revision =~ s/ \([^()]*\)//; driver => "i2c-piix4", match => qr/^SMBus PIIX4 adapter at /, } , - { - vendid => 0x1002, - devid => 0x4395, - procid => "ATI Technologies Inc SB700 SMBus", - driver => "i2c-piix4", - match => qr/^SMBus PIIX4 adapter at /, - }, { vendid => 0x100B, devid => 0x0500, From 4b012c9f63272a669f378d8378c2d6ef24c5b1a3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 2 Sep 2007 10:55:03 +0000 Subject: [PATCH 229/718] Drop useless return. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4742 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index a0e3c9a2..5c712db6 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -59,8 +59,6 @@ int get_type_scaling(int type) default: return 0; } - - return 0; } static int sensors_read_dynamic_chip(sensors_chip_features *chip, From 75859ca9dc12d3951c2baa0f11324cbb77686aa5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 2 Sep 2007 11:09:16 +0000 Subject: [PATCH 230/718] Use the feature type rather than the feature name to figure out whether we need to add "_input" to get the correct sysfs file name. This is much faster. This is still a ugly hack I'd like to get rid of, but at least now the slowdown is acceptable. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4743 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 5c712db6..ee854955 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -411,17 +411,15 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, int mag; char n[NAME_MAX]; FILE *f; - int dummy; - char check; const char *suffix = ""; if (!(the_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ - if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 - || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 - || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) + if (the_feature->data.type == SENSORS_FEATURE_IN + || the_feature->data.type == SENSORS_FEATURE_FAN + || the_feature->data.type == SENSORS_FEATURE_TEMP) suffix = "_input"; snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->data.name, @@ -446,17 +444,15 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, int mag; char n[NAME_MAX]; FILE *f; - int dummy; - char check; const char *suffix = ""; if (!(the_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ - if (sscanf(the_feature->data.name, "in%d%c", &dummy, &check) == 1 - || sscanf(the_feature->data.name, "fan%d%c", &dummy, &check) == 1 - || sscanf(the_feature->data.name, "temp%d%c", &dummy, &check) == 1) + if (the_feature->data.type == SENSORS_FEATURE_IN + || the_feature->data.type == SENSORS_FEATURE_FAN + || the_feature->data.type == SENSORS_FEATURE_TEMP) suffix = "_input"; snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->data.name, From 2a822a2d9607e5a210e0199f2d9226bcc063949c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 2 Sep 2007 11:15:27 +0000 Subject: [PATCH 231/718] Start numbering the features at 0, not 1. There's nothing wrong with having a feature number 0, and this makes the code slightly simpler. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4744 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index ee854955..e84e11ba 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -136,7 +136,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } /* fill in the other feature members */ - feature.data.number = i + 1; + feature.data.number = i; feature.data.type = type; if ((type & 0x00FF) == 0) { @@ -145,10 +145,10 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, feature.data.compute_mapping = SENSORS_NO_MAPPING; } else if (type & 0x10) { /* sub feature without compute mapping */ - feature.data.mapping = i - i % MAX_SUB_FEATURES + 1; + feature.data.mapping = i - i % MAX_SUB_FEATURES; feature.data.compute_mapping = SENSORS_NO_MAPPING; } else { - feature.data.mapping = i - i % MAX_SUB_FEATURES + 1; + feature.data.mapping = i - i % MAX_SUB_FEATURES; feature.data.compute_mapping = feature.data.mapping; } From 3d15175ecd7269b68f2e258928038c8d2c3dcea9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:06:03 +0000 Subject: [PATCH 232/718] Add max6680-* entry. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4755 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 6994cc14..9e303357 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -1869,7 +1869,7 @@ chip "max1619-*" # set temp2_hyst 40 -chip "lm90-*" "adm1032-*" "lm86-*" "max6657-*" "adt7461-*" +chip "lm90-*" "adm1032-*" "lm86-*" "max6657-*" "adt7461-*" "max6680-*" label temp1 "M/B Temp" label temp2 "CPU Temp" From 079ba265748eed5e5042c7507b4b8d0869cee903 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:07:14 +0000 Subject: [PATCH 233/718] Drop sensors_strip_of_spaces. There's no rationale for stripping trailing spaces of bus names and nothing else. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4756 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/conf-parse.y | 3 +-- lib/general.c | 8 -------- lib/general.h | 3 --- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/conf-parse.y b/lib/conf-parse.y index 3df1f808..30453eed 100644 --- a/lib/conf-parse.y +++ b/lib/conf-parse.y @@ -298,8 +298,7 @@ bus_id: NAME ; adapter_name: NAME - { sensors_strip_of_spaces($1); - $$ = $1; } + { $$ = $1; } ; function_name: NAME diff --git a/lib/general.c b/lib/general.c index f032d494..2900bfff 100644 --- a/lib/general.c +++ b/lib/general.c @@ -83,11 +83,3 @@ void sensors_add_array_els(const void *els, int nr_els, void *list, memcpy(((char *)*my_list) + *num_el * el_size, els, el_size * nr_els); *num_el += nr_els; } - -/* Strip a string of all terminating spaces */ -void sensors_strip_of_spaces(char *name) -{ - int i; - for (i = strlen(name) - 1; i >= 0 && name[i] == ' '; i--); - name[i + 1] = '\0'; -} diff --git a/lib/general.h b/lib/general.h index 73e5e620..e4f9c4d1 100644 --- a/lib/general.h +++ b/lib/general.h @@ -33,9 +33,6 @@ void sensors_add_array_el(const void *el, void *list, int *num_el, void sensors_add_array_els(const void *els, int nr_els, void *list, int *num_el, int *max_el, int el_size); -/* Strip a string of all terminating spaces */ -void sensors_strip_of_spaces(char *name); - #define ARRAY_SIZE(arr) (int)(sizeof(arr) / sizeof((arr)[0])) #endif /* LIB_SENSORS_GENERAL */ From 87efbc06c5bb5c4ee60bb0412f9726d3bf119c40 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:13:15 +0000 Subject: [PATCH 234/718] Rename sensors_feature_data.mode to flags, as we plan to use it to store non-mode flags soon. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4757 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 4 ++-- lib/data.h | 2 +- lib/libsensors.3 | 4 ++-- lib/sensors.h | 4 ++-- lib/sysfs.c | 4 ++-- prog/sensord/sense.c | 2 +- prog/sensors/chips.c | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/access.c b/lib/access.c index af8167cb..c6644ca1 100644 --- a/lib/access.c +++ b/lib/access.c @@ -238,7 +238,7 @@ int sensors_get_value(const sensors_chip_name *name, int feature, alt_feature = sensors_lookup_feature_nr(name, main_feature->data.compute_mapping); - if (!(main_feature->data.mode & SENSORS_MODE_R)) + if (!(main_feature->data.flags & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) @@ -285,7 +285,7 @@ int sensors_set_value(const sensors_chip_name *name, int feature, alt_feature = sensors_lookup_feature_nr(name, main_feature->data.compute_mapping); - if (!(main_feature->data.mode & SENSORS_MODE_W)) + if (!(main_feature->data.flags & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) diff --git a/lib/data.h b/lib/data.h index 25818a6f..151c5ac3 100644 --- a/lib/data.h +++ b/lib/data.h @@ -132,7 +132,7 @@ typedef struct sensors_bus { compute_mapping is like logical_mapping, only it refers to another feature whose compute line will be inherited (a group could be fan and fan_max, but not fan_div) - mode is a bitfield, its value is a combination of SENSORS_MODE_R (readable) + flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable) and SENSORS_MODE_W (writable). scaling is the number of decimal points to scale by. Divide the read value by 10**scaling to get the real value. */ diff --git a/lib/libsensors.3 b/lib/libsensors.3 index dcd9ef1c..5673b6d4 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -115,11 +115,11 @@ This structure is used when you want to get all features of a specific chip. .br int compute_mapping; .br - int mode; + unsigned int flags; .br } sensors_feature_data;\fP .br -The mode field is a bitfield, its value is a combination of +The flags field is a bitfield, its value is a combination of SENSORS_MODE_R (readable) and SENSORS_MODE_W (writable). \fBconst sensors_feature_data *sensors_get_all_features diff --git a/lib/sensors.h b/lib/sensors.h index b853687e..b6f55f5d 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -112,7 +112,7 @@ int sensors_do_chip_sets(const sensors_chip_name *name); const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name *match, int *nr); -/* These defines are used in the mode field of sensors_feature_data */ +/* These defines are used in the flags field of sensors_feature_data */ #define SENSORS_MODE_R 1 #define SENSORS_MODE_W 2 @@ -164,7 +164,7 @@ typedef struct sensors_feature_data { sensors_feature_type type; int mapping; int compute_mapping; - int mode; + unsigned int flags; } sensors_feature_data; /* This returns all features of a specific chip. They are returned in diff --git a/lib/sysfs.c b/lib/sysfs.c index e84e11ba..07ad7579 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -153,9 +153,9 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } if (attr->method & SYSFS_METHOD_SHOW) - feature.data.mode |= SENSORS_MODE_R; + feature.data.flags |= SENSORS_MODE_R; if (attr->method & SYSFS_METHOD_STORE) - feature.data.mode |= SENSORS_MODE_W; + feature.data.flags |= SENSORS_MODE_W; feature.scaling = get_type_scaling(type); diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index ddd8747a..2532723c 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -88,7 +88,7 @@ readUnknownChip if (!(label = sensors_get_label (chip, sensor->number))) { sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, sensor->name); ret = 21; - } else if (!(sensor->mode & SENSORS_MODE_R)) { + } else if (!(sensor->flags & SENSORS_MODE_R)) { sensorLog (LOG_INFO, "%s: %s", sensor->name, label); } else if ((ret = sensors_get_value (chip, sensor->number, &value))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/%s: %s", chip->prefix, sensor->name, sensors_strerror (ret)); diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index ed710015..576cf1f2 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -41,7 +41,7 @@ void print_chip_raw(const sensors_chip_name *name) data->name); continue; } - if (data->mode & SENSORS_MODE_R) { + if (data->flags & SENSORS_MODE_R) { if (sensors_get_value(name, data->number, &val)) printf("ERROR: Can't get feature `%s' data!\n", data->name); From 20c98f41b7f76b9b7282bb4c58a959f593f0a1cf Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:17:22 +0000 Subject: [PATCH 235/718] The compute mapping value is either SENSORS_NO_MAPPING or the same feature number as the logical mapping. This means that the compute mapping can be turned into a simple boolean flag. Doing so makes struct sensors_feature_data smaller, which saves some memory (about 17 kB in my tests.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4758 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 18 +++++++++--------- lib/data.h | 10 ++++------ lib/libsensors.3 | 5 ++--- lib/sensors.h | 8 ++++---- lib/sysfs.c | 9 +++------ 5 files changed, 22 insertions(+), 28 deletions(-) diff --git a/lib/access.c b/lib/access.c index c6644ca1..50f7f230 100644 --- a/lib/access.c +++ b/lib/access.c @@ -190,7 +190,7 @@ sensors_get_label_exit: /* Looks up whether a feature should be ignored. Returns 1 if it should be ignored, 0 if not. This function takes - logical mappings into account. */ + mappings into account. */ static int sensors_get_ignored(const sensors_chip_name *name, const sensors_chip_feature *feature) { @@ -232,11 +232,11 @@ int sensors_get_value(const sensors_chip_name *name, int feature, if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; - if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) - alt_feature = NULL; - else + if (main_feature->data.flags & SENSORS_COMPUTE_MAPPING) alt_feature = sensors_lookup_feature_nr(name, - main_feature->data.compute_mapping); + main_feature->data.mapping); + else + alt_feature = NULL; if (!(main_feature->data.flags & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; @@ -279,11 +279,11 @@ int sensors_set_value(const sensors_chip_name *name, int feature, if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; - if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING) - alt_feature = NULL; - else + if (main_feature->data.flags & SENSORS_COMPUTE_MAPPING) alt_feature = sensors_lookup_feature_nr(name, - main_feature->data.compute_mapping); + main_feature->data.mapping); + else + alt_feature = NULL; if (!(main_feature->data.flags & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; diff --git a/lib/data.h b/lib/data.h index 151c5ac3..c20d7a22 100644 --- a/lib/data.h +++ b/lib/data.h @@ -125,15 +125,13 @@ typedef struct sensors_bus { files and through user functions); number is the internal feature number, used in many functions to refer to this feature - logical_mapping is either SENSORS_NO_MAPPING if this is feature is the + mapping is either SENSORS_NO_MAPPING if this is feature is the main element of category; or it is the number of a feature with which this feature is logically grouped (a group could be fan, fan_max and fan_div) - compute_mapping is like logical_mapping, only it refers to another - feature whose compute line will be inherited (a group could be fan and - fan_max, but not fan_div) - flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable) - and SENSORS_MODE_W (writable). + flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable), + SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the + computation rules of the main feature). scaling is the number of decimal points to scale by. Divide the read value by 10**scaling to get the real value. */ typedef struct sensors_chip_feature { diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 5673b6d4..43a8f2c1 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -112,15 +112,14 @@ This structure is used when you want to get all features of a specific chip. sensors_feature_type type; .br int mapping; -.br - int compute_mapping; .br unsigned int flags; .br } sensors_feature_data;\fP .br The flags field is a bitfield, its value is a combination of -SENSORS_MODE_R (readable) and SENSORS_MODE_W (writable). +SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING +(affected by the computation rules of the main feature). \fBconst sensors_feature_data *sensors_get_all_features (const sensors_chip_name *name, int *nr);\fP diff --git a/lib/sensors.h b/lib/sensors.h index b6f55f5d..32cd7f4b 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -113,8 +113,9 @@ const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name *match, int *nr); /* These defines are used in the flags field of sensors_feature_data */ -#define SENSORS_MODE_R 1 -#define SENSORS_MODE_W 2 +#define SENSORS_MODE_R 1 +#define SENSORS_MODE_W 2 +#define SENSORS_COMPUTE_MAPPING 4 /* This define is used in the mapping field of sensors_feature_data if no mapping is available */ @@ -122,7 +123,7 @@ const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name /* This enum contains some "magic" used by sensors_read_dynamic_chip() from lib/sysfs.c. All the sensor types (in, fan, temp, vid) are a multiple of - 0x100 apart, and sensor features which should not have a compute_mapping to + 0x100 apart, and sensor features which should not have a compute mapping to the _input feature start at 0x?10. */ typedef enum sensors_feature_type { SENSORS_FEATURE_IN = 0x000, @@ -163,7 +164,6 @@ typedef struct sensors_feature_data { int number; sensors_feature_type type; int mapping; - int compute_mapping; unsigned int flags; } sensors_feature_data; diff --git a/lib/sysfs.c b/lib/sysfs.c index 07ad7579..3fdd9e53 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -142,14 +142,11 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, if ((type & 0x00FF) == 0) { /* main feature */ feature.data.mapping = SENSORS_NO_MAPPING; - feature.data.compute_mapping = SENSORS_NO_MAPPING; - } else if (type & 0x10) { - /* sub feature without compute mapping */ - feature.data.mapping = i - i % MAX_SUB_FEATURES; - feature.data.compute_mapping = SENSORS_NO_MAPPING; } else { + /* sub feature */ feature.data.mapping = i - i % MAX_SUB_FEATURES; - feature.data.compute_mapping = feature.data.mapping; + if (!(type & 0x10)) + feature.data.flags |= SENSORS_COMPUTE_MAPPING; } if (attr->method & SYSFS_METHOD_SHOW) From 7975800ac118ac503b3db6fa56ed9e3745611abc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:19:09 +0000 Subject: [PATCH 236/718] Renumber the features linearly, so that feature number N is at position N in the array. This allows for O(1) look-ups, as opposed to O(N) before. This makes sensors_lookup_feature_nr() 2.4 times faster in my real-world tests, resulting in a 6% performance boost on average in the runtime part of "sensors". git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4759 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 8 ++------ lib/sysfs.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/access.c b/lib/access.c index 50f7f230..a784579b 100644 --- a/lib/access.c +++ b/lib/access.c @@ -92,15 +92,11 @@ sensors_for_all_config_chips(const sensors_chip_name *name, const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature) { - int i, j; - const sensors_chip_feature *features; + int i; for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { - features = sensors_proc_chips[i].feature; - for (j = 0; features[j].data.name; j++) - if (features[j].data.number == feature) - return features + j; + return sensors_proc_chips[i].feature + feature; } return NULL; } diff --git a/lib/sysfs.c b/lib/sysfs.c index 3fdd9e53..5438de7d 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -178,6 +178,21 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } } + /* Renumber the features linearly, so that feature number N is at + position N in the array. This allows for O(1) look-ups. */ + for (i = 0; i < fnum; i++) { + int j, old; + + old = dyn_features[i].data.number; + dyn_features[i].data.number = i; + for (j = i + 1; + j < fnum && dyn_features[j].data.mapping != SENSORS_NO_MAPPING; + j++) { + if (dyn_features[j].data.mapping == old) + dyn_features[j].data.mapping = i; + } + } + chip->feature = dyn_features; exit_free: From 23f427401073e0b37ba83a19ad813273fca16cd0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:19:42 +0000 Subject: [PATCH 237/718] Store the feature list length separately instead of null-terminating the list. This make it possible to check for out-of-bound indexes without walking the entire list, so that direct look-ups are safer. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4760 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 9 ++++++--- lib/data.h | 1 + lib/init.c | 10 +++++----- lib/sysfs.c | 5 +++-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/access.c b/lib/access.c index a784579b..44eb5198 100644 --- a/lib/access.c +++ b/lib/access.c @@ -96,6 +96,9 @@ const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *c for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { + if (feature < 0 || + feature >= sensors_proc_chips[i].feature_count) + return NULL; return sensors_proc_chips[i].feature + feature; } return NULL; @@ -113,7 +116,7 @@ sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { features = sensors_proc_chips[i].feature; - for (j = 0; features[j].data.name; j++) + for (j = 0; j < sensors_proc_chips[i].feature_count; j++) if (!strcasecmp(features[j].data.name, feature)) return features + j; } @@ -350,10 +353,10 @@ const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *na for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { feature_list = sensors_proc_chips[i].feature; - while (feature_list[*nr].data.name + while (*nr < sensors_proc_chips[i].feature_count && sensors_get_ignored(name, &feature_list[*nr])) (*nr)++; - if (!feature_list[*nr].data.name) + if (*nr == sensors_proc_chips[i].feature_count) return NULL; return &feature_list[(*nr)++].data; } diff --git a/lib/data.h b/lib/data.h index c20d7a22..82afd0e0 100644 --- a/lib/data.h +++ b/lib/data.h @@ -143,6 +143,7 @@ typedef struct sensors_chip_feature { typedef struct sensors_chip_features { struct sensors_chip_name chip; struct sensors_chip_feature *feature; + int feature_count; } sensors_chip_features; extern sensors_chip *sensors_config_chips; diff --git a/lib/init.c b/lib/init.c index c2149227..a2af02b5 100644 --- a/lib/init.c +++ b/lib/init.c @@ -51,13 +51,13 @@ static void free_chip_name(sensors_chip_name *name) free(name->path); } -static void free_chip_features(sensors_chip_feature *features) +static void free_chip_features(sensors_chip_features *features) { int i; - for (i = 0; features[i].data.name; i++) - free(features[i].data.name); - free(features); + for (i = 0; i < features->feature_count; i++) + free(features->feature[i].data.name); + free(features->feature); } static void free_bus(sensors_bus *bus) @@ -140,7 +140,7 @@ void sensors_cleanup(void) for (i = 0; i < sensors_proc_chips_count; i++) { free_chip_name(&sensors_proc_chips[i].chip); - free_chip_features(sensors_proc_chips[i].feature); + free_chip_features(&sensors_proc_chips[i]); } free(sensors_proc_chips); sensors_proc_chips = NULL; diff --git a/lib/sysfs.c b/lib/sysfs.c index 5438de7d..9d66cf65 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -64,7 +64,7 @@ int get_type_scaling(int type) static int sensors_read_dynamic_chip(sensors_chip_features *chip, struct sysfs_device *sysdir) { - int i, type, fnum = 1; + int i, type, fnum = 0; struct sysfs_attribute *attr; struct dlist *attrs; sensors_chip_feature *features; @@ -160,7 +160,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, fnum++; } - if (fnum == 1) { /* No feature */ + if (!fnum) { /* No feature */ chip->feature = NULL; goto exit_free; } @@ -194,6 +194,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } chip->feature = dyn_features; + chip->feature_count = fnum; exit_free: free(features); From ed480f2eddbc20a9b0388b3e165437383c4ce55e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:20:35 +0000 Subject: [PATCH 238/718] Optimize the memory consumption in sensors_read_dynamic_chip(). The idea is to have separate indexing for subfeatures with a compute mapping and for subfeatures without it. They still follow each other in the big table but this avoids wasting memory due to the numbering gap between them. This cuts the amount of memory (temporarily) allocated by sensors_read_dynamic_chip() almost by half, and also speeds it up a little as it now takes less iterations to walk the sparse array. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4761 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 9d66cf65..f9d28eb3 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -37,9 +37,9 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 16 -#define MAX_SUB_FEATURES 22 +#define MAX_SUB_FEATURES 6 /* Room for all 3 types (in, fan, temp) with all their subfeatures + VID */ -#define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 3 \ +#define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 \ + MAX_SENSORS_PER_TYPE) static @@ -120,11 +120,12 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* "calculate" a place to store the feature in our sparse, sorted table */ if (type == SENSORS_FEATURE_VID) { - i = nr + MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 3; + i = nr + MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6; } else { i = (type >> 8) * MAX_SENSORS_PER_TYPE * - MAX_SUB_FEATURES + nr * MAX_SUB_FEATURES + - (type & 0xFF); + MAX_SUB_FEATURES * 2 + nr * MAX_SUB_FEATURES * 2 + + ((type & 0x10) >> 4) * MAX_SUB_FEATURES + + (type & 0x0F); } if (features[i].data.name) { @@ -144,7 +145,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, feature.data.mapping = SENSORS_NO_MAPPING; } else { /* sub feature */ - feature.data.mapping = i - i % MAX_SUB_FEATURES; + feature.data.mapping = i - i % (MAX_SUB_FEATURES * 2); if (!(type & 0x10)) feature.data.flags |= SENSORS_COMPUTE_MAPPING; } From b836fc0b53bccf861b30cbd0eb51fde263bd5c4f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:21:19 +0000 Subject: [PATCH 239/718] Now that we can deduce the scaling factor required for each feature from its type, there's no need to store this scaling factor. We can instead compute it at runtime. This saves some memory (about 10 kB in my real-world test), and the runtime overhead is totally negligible. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4762 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.h | 5 +---- lib/sysfs.c | 18 ++++++------------ 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/lib/data.h b/lib/data.h index 82afd0e0..cd1b6806 100644 --- a/lib/data.h +++ b/lib/data.h @@ -131,12 +131,9 @@ typedef struct sensors_bus { fan_div) flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the - computation rules of the main feature). - scaling is the number of decimal points to scale by. - Divide the read value by 10**scaling to get the real value. */ + computation rules of the main feature). */ typedef struct sensors_chip_feature { sensors_feature_data data; - int scaling; } sensors_chip_feature; /* Internal data about all features of a type of chip */ diff --git a/lib/sysfs.c b/lib/sysfs.c index f9d28eb3..dfbc4882 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -48,16 +48,16 @@ int get_type_scaling(int type) switch (type & 0xFF10) { case SENSORS_FEATURE_IN: case SENSORS_FEATURE_TEMP: - return 3; + return 1000; case SENSORS_FEATURE_FAN: - return 0; + return 1; } switch (type) { case SENSORS_FEATURE_VID: - return 3; + return 1000; default: - return 0; + return 1; } } @@ -155,8 +155,6 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, if (attr->method & SYSFS_METHOD_STORE) feature.data.flags |= SENSORS_MODE_W; - feature.scaling = get_type_scaling(type); - features[i] = feature; fnum++; } @@ -422,7 +420,6 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, double *value) { const sensors_chip_feature *the_feature; - int mag; char n[NAME_MAX]; FILE *f; const char *suffix = ""; @@ -443,8 +440,7 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, fclose(f); if (res != 1) return -SENSORS_ERR_PROC; - for (mag = the_feature->scaling; mag > 0; mag --) - *value /= 10.0; + *value /= get_type_scaling(the_feature->data.type); } else return -SENSORS_ERR_PROC; @@ -455,7 +451,6 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, double value) { const sensors_chip_feature *the_feature; - int mag; char n[NAME_MAX]; FILE *f; const char *suffix = ""; @@ -472,8 +467,7 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->data.name, suffix); if ((f = fopen(n, "w"))) { - for (mag = the_feature->scaling; mag > 0; mag --) - value *= 10.0; + value *= get_type_scaling(the_feature->data.type); fprintf(f, "%d", (int) value); fclose(f); } else From 75bd19ec3438496f7aa1ab64cc79849c9e51418d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:26:26 +0000 Subject: [PATCH 240/718] Minor optimizations in sensors_read_dynamic_chip(): * We don't need to compute the mapping during the first pass: this field is overwritten when renumbering the features anyway. * Only main features have features mapping to them. * Only subfeatures have mappings, so we can stop the scan at the next main feature. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4763 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index dfbc4882..b1e0ee5f 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -137,7 +137,6 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } /* fill in the other feature members */ - feature.data.number = i; feature.data.type = type; if ((type & 0x00FF) == 0) { @@ -145,7 +144,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, feature.data.mapping = SENSORS_NO_MAPPING; } else { /* sub feature */ - feature.data.mapping = i - i % (MAX_SUB_FEATURES * 2); + /* The mapping is set below after numbering */ if (!(type & 0x10)) feature.data.flags |= SENSORS_COMPUTE_MAPPING; } @@ -177,17 +176,18 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } } - /* Renumber the features linearly, so that feature number N is at + /* Number the features linearly, so that feature number N is at position N in the array. This allows for O(1) look-ups. */ for (i = 0; i < fnum; i++) { - int j, old; + int j; - old = dyn_features[i].data.number; dyn_features[i].data.number = i; - for (j = i + 1; - j < fnum && dyn_features[j].data.mapping != SENSORS_NO_MAPPING; - j++) { - if (dyn_features[j].data.mapping == old) + if (dyn_features[i].data.mapping == SENSORS_NO_MAPPING) { + /* Main feature, set the mapping field of all its + subfeatures */ + for (j = i + 1; j < fnum && + dyn_features[j].data.mapping != SENSORS_NO_MAPPING; + j++) dyn_features[j].data.mapping = i; } } From 5c121e2b74ee1d2ba93291b81b0a91e194f74144 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:29:36 +0000 Subject: [PATCH 241/718] Another minor optimization to sensors_read_dynamic_chip(): * We don't need a temporary structure for the feature being currently processed. Instead we can work on the large sparse array directly. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4764 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index b1e0ee5f..ad9f37e8 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -84,7 +84,6 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, sensors_fatal_error(__FUNCTION__, "Out of memory"); dlist_for_each_data(attrs, attr, struct sysfs_attribute) { - sensors_chip_feature feature; name = attr->name; int nr; @@ -92,14 +91,6 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, if (type == SENSORS_FEATURE_UNKNOWN) continue; - memset(&feature, 0, sizeof(sensors_chip_feature)); - /* check for _input extension and remove */ - i = strlen(name); - if (i > 6 && !strcmp(name + i - 6, "_input")) - feature.data.name = strndup(name, i-6); - else - feature.data.name = strdup(name); - /* Adjust the channel number */ switch (type & 0xFF00) { case SENSORS_FEATURE_FAN: @@ -113,7 +104,6 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, fprintf(stderr, "libsensors error, more sensors of one" " type then MAX_SENSORS_PER_TYPE, ignoring " "feature: %s\n", name); - free(feature.data.name); continue; } @@ -132,29 +122,34 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, fprintf(stderr, "libsensors error, trying to add dupli" "cate feature: %s to dynamic feature table\n", name); - free(feature.data.name); continue; } - /* fill in the other feature members */ - feature.data.type = type; + /* fill in the feature members */ + features[i].data.type = type; + + /* check for _input extension and remove */ + nr = strlen(name); + if (nr > 6 && !strcmp(name + nr - 6, "_input")) + features[i].data.name = strndup(name, nr - 6); + else + features[i].data.name = strdup(name); if ((type & 0x00FF) == 0) { /* main feature */ - feature.data.mapping = SENSORS_NO_MAPPING; + features[i].data.mapping = SENSORS_NO_MAPPING; } else { /* sub feature */ /* The mapping is set below after numbering */ if (!(type & 0x10)) - feature.data.flags |= SENSORS_COMPUTE_MAPPING; + features[i].data.flags |= SENSORS_COMPUTE_MAPPING; } if (attr->method & SYSFS_METHOD_SHOW) - feature.data.flags |= SENSORS_MODE_R; + features[i].data.flags |= SENSORS_MODE_R; if (attr->method & SYSFS_METHOD_STORE) - feature.data.flags |= SENSORS_MODE_W; + features[i].data.flags |= SENSORS_MODE_W; - features[i] = feature; fnum++; } From 3c53f5fa85c9a0ca833cae9c581bc910b0f9a35e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 08:31:25 +0000 Subject: [PATCH 242/718] Increase MAX_SENSORS_PER_TYPE from 16 to 20: the ADM1026 can have up to 17 voltage inputs, and bmcsensors used to support up to 20 voltage values. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4765 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index ad9f37e8..d28039c8 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -36,7 +36,7 @@ char sensors_sysfs_mount[NAME_MAX]; -#define MAX_SENSORS_PER_TYPE 16 +#define MAX_SENSORS_PER_TYPE 20 #define MAX_SUB_FEATURES 6 /* Room for all 3 types (in, fan, temp) with all their subfeatures + VID */ #define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 \ From 29bea1e84351aaf7caa9184583dfa7ee5464fb5d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 12:28:31 +0000 Subject: [PATCH 243/718] Add support for the standard beep_enable attribute (#2248). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4766 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 6 ++++++ lib/sensors.h | 2 ++ lib/sysfs.c | 15 +++++++++++---- prog/sensors/chips.c | 18 ++++++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/lib/access.c b/lib/access.c index 44eb5198..1c799f78 100644 --- a/lib/access.c +++ b/lib/access.c @@ -562,6 +562,12 @@ sensors_feature_type sensors_feature_get_type(const char *name, int *nr) int i, count; const struct feature_subtype_match *submatches; + /* Special case */ + if (!strcmp(name, "beep_enable")) { + *nr = 0; + return SENSORS_FEATURE_BEEP_ENABLE; + } + for (i = 0; i < ARRAY_SIZE(matches); i++) if ((count = sscanf(name, matches[i].name, nr, &c))) break; diff --git a/lib/sensors.h b/lib/sensors.h index 32cd7f4b..753d4fa4 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -154,6 +154,8 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_VID = 0x300, + SENSORS_FEATURE_BEEP_ENABLE = 0x1100, + SENSORS_FEATURE_UNKNOWN = INT_MAX, } sensors_feature_type; diff --git a/lib/sysfs.c b/lib/sysfs.c index d28039c8..10d69392 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -38,9 +38,10 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 20 #define MAX_SUB_FEATURES 6 -/* Room for all 3 types (in, fan, temp) with all their subfeatures + VID */ +/* Room for all 3 types (in, fan, temp) with all their subfeatures + VID + + misc features */ #define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 \ - + MAX_SENSORS_PER_TYPE) + + MAX_SENSORS_PER_TYPE + 1) static int get_type_scaling(int type) @@ -109,9 +110,15 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* "calculate" a place to store the feature in our sparse, sorted table */ - if (type == SENSORS_FEATURE_VID) { + switch (type) { + case SENSORS_FEATURE_VID: i = nr + MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6; - } else { + break; + case SENSORS_FEATURE_BEEP_ENABLE: + i = MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 + + MAX_SENSORS_PER_TYPE; + break; + default: i = (type >> 8) * MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 2 + nr * MAX_SUB_FEATURES * 2 + ((type & 0x10) >> 4) * MAX_SUB_FEATURES + diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 576cf1f2..bc9d512d 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -390,6 +390,20 @@ static void print_chip_vid(const sensors_chip_name *name, int f_vid, free(label); } +static void print_chip_beep_enable(const sensors_chip_name *name, int f_beep, + int label_size) +{ + char *label; + double beep_enable; + + if ((label = sensors_get_label(name, f_beep)) + && !sensors_get_value(name, f_beep, &beep_enable)) { + print_label(label, label_size); + printf("%s\n", beep_enable ? "enabled" : "disabled"); + } + free(label); +} + void print_chip(const sensors_chip_name *name) { const sensors_feature_data *feature; @@ -415,6 +429,10 @@ void print_chip(const sensors_chip_name *name) case SENSORS_FEATURE_VID: print_chip_vid(name, feature->number, label_size); break; + case SENSORS_FEATURE_BEEP_ENABLE: + print_chip_beep_enable(name, feature->number, + label_size); + break; default: continue; } From 6c4ea89ab95367ab8a9f3aec33b754cf0dff3b82 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 12:29:20 +0000 Subject: [PATCH 244/718] Renumber SENSORS_FEATURE_VID from 0x300 to 0x1000. If we ever need to add more "standard" feature types such as current or power, we want to give them numbers that immediately follow the fan, voltage and temperature features, so that the code is as simple as possible. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4767 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sensors.h b/lib/sensors.h index 753d4fa4..7100f1ec 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -152,7 +152,7 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_TEMP_FAULT, SENSORS_FEATURE_TEMP_TYPE, - SENSORS_FEATURE_VID = 0x300, + SENSORS_FEATURE_VID = 0x1000, SENSORS_FEATURE_BEEP_ENABLE = 0x1100, From 6b3803c386634f644879be4373a59194ce65f72b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 12:30:39 +0000 Subject: [PATCH 245/718] Fix memory leaks in the configuration file parser when a label, set, compute or ignore statement is found before the first chip statement. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4768 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/conf-parse.y | 39 ++++++++++++++++++++++++++------------- lib/init.c | 2 +- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/lib/conf-parse.y b/lib/conf-parse.y index 30453eed..a4504a37 100644 --- a/lib/conf-parse.y +++ b/lib/conf-parse.y @@ -37,6 +37,8 @@ extern int sensors_yylineno; static void sensors_yyerror(const char *err); static sensors_expr *malloc_expr(void); +/* free_expr is defined in init.c */ +void free_expr(sensors_expr *expr); static sensors_chip *current_chip = NULL; @@ -77,15 +79,6 @@ static sensors_chip *current_chip = NULL; &(list).fits_max, \ sizeof(sensors_chip_name)); -/* YYERROR can only be called in rules, not in other functions, so this must - be a macro */ -#define check_current_chip()\ - do { if (! current_chip) {\ - sensors_yyerror("Label, Set or Compute statement before first chip statement");\ - YYERROR;\ - }\ - } while (0) - %} %union { @@ -152,7 +145,12 @@ bus_statement: BUS bus_id adapter_name label_statement: LABEL function_name string { sensors_label new_el; - check_current_chip(); + if (!current_chip) { + sensors_yyerror("Label statement before first chip statement"); + free($2); + free($3); + YYERROR; + } new_el.lineno = $1; new_el.name = $2; new_el.value = $3; @@ -162,7 +160,12 @@ label_statement: LABEL function_name string set_statement: SET function_name expression { sensors_set new_el; - check_current_chip(); + if (!current_chip) { + sensors_yyerror("Set statement before first chip statement"); + free($2); + free($3); + YYERROR; + } new_el.lineno = $1; new_el.name = $2; new_el.value = $3; @@ -172,7 +175,13 @@ set_statement: SET function_name expression compute_statement: COMPUTE function_name expression ',' expression { sensors_compute new_el; - check_current_chip(); + if (!current_chip) { + sensors_yyerror("Compute statement before first chip statement"); + free($2); + free_expr($3); + free_expr($5); + YYERROR; + } new_el.lineno = $1; new_el.name = $2; new_el.from_proc = $3; @@ -183,7 +192,11 @@ compute_statement: COMPUTE function_name expression ',' expression ignore_statement: IGNORE function_name { sensors_ignore new_el; - check_current_chip(); + if (!current_chip) { + sensors_yyerror("Ignore statement before first chip statement"); + free($2); + YYERROR; + } new_el.lineno = $1; new_el.name = $2; ignore_add_el(&new_el); diff --git a/lib/init.c b/lib/init.c index a2af02b5..a06e429f 100644 --- a/lib/init.c +++ b/lib/init.c @@ -71,7 +71,7 @@ static void free_label(sensors_label *label) free(label->value); } -static void free_expr(sensors_expr *expr) +void free_expr(sensors_expr *expr) { if (expr->kind == sensors_kind_var) free(expr->data.var); From 61686376df1a04f075f86c761b349ee92100a468 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 12:31:12 +0000 Subject: [PATCH 246/718] Add support for temperature offset files, which are part of the standard sysfs interface. I don't think it makes much sense to display the offset values as part of the output of "sensors" (it would even probably confuse people) but having support for these in libsensors makes it possible to adjust the offsets in sensors.conf, which is convenient. This closes ticket #2248. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4769 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 1 + lib/sensors.h | 1 + lib/sysfs.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/access.c b/lib/access.c index 1c799f78..8fd926c0 100644 --- a/lib/access.c +++ b/lib/access.c @@ -521,6 +521,7 @@ static const struct feature_subtype_match temp_matches[] = { { "crit_alarm", SENSORS_FEATURE_TEMP_CRIT_ALARM }, { "fault", SENSORS_FEATURE_TEMP_FAULT }, { "type", SENSORS_FEATURE_TEMP_TYPE }, + { "offset", SENSORS_FEATURE_TEMP_OFFSET }, { NULL, 0 } }; diff --git a/lib/sensors.h b/lib/sensors.h index 7100f1ec..13cea557 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -151,6 +151,7 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_TEMP_CRIT_ALARM, SENSORS_FEATURE_TEMP_FAULT, SENSORS_FEATURE_TEMP_TYPE, + SENSORS_FEATURE_TEMP_OFFSET, SENSORS_FEATURE_VID = 0x1000, diff --git a/lib/sysfs.c b/lib/sysfs.c index 10d69392..8147d525 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -1,6 +1,7 @@ /* sysfs.c - Part of libsensors, a library for reading Linux sensor data Copyright (c) 2005 Mark M. Hoffman + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +38,7 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 20 -#define MAX_SUB_FEATURES 6 +#define MAX_SUB_FEATURES 7 /* Room for all 3 types (in, fan, temp) with all their subfeatures + VID + misc features */ #define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 \ @@ -56,6 +57,7 @@ int get_type_scaling(int type) switch (type) { case SENSORS_FEATURE_VID: + case SENSORS_FEATURE_TEMP_OFFSET: return 1000; default: return 1; From f27710deb7e0106ef6e5cbfb62338f67b944aebc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 14:28:19 +0000 Subject: [PATCH 247/718] sensors-conf-convert: New, script to convert old configuration files to use the new symbol names. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4770 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + Makefile | 6 +- etc/sensors-conf-convert | 467 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 473 insertions(+), 1 deletion(-) create mode 100755 etc/sensors-conf-convert diff --git a/CHANGES b/CHANGES index 81efef55..6b25ae3f 100644 --- a/CHANGES +++ b/CHANGES @@ -29,6 +29,7 @@ SVN HEAD Man pages: Drop "conforming to" sections Man page sensors.conf.5: Update the chip statement section Programs doc/*: Delete, obsolete + Program etc/sensors-conf-convert: New Programs i2cdump, i2cget, i2cset: Do not force the slave address by default Program i2cdump: Use the new I2C block read function Program isadump: Detect when address bit 7 is a busy flag diff --git a/Makefile b/Makefile index 95d9038a..7f02c412 100644 --- a/Makefile +++ b/Makefile @@ -178,13 +178,17 @@ MANPAGES := $(LIBMAN3FILES) $(LIBMAN5FILES) $(PROGDETECTMAN8FILES) $(PROGDUMPMAN user :: user_install:: - @echo "*** Important note:" + @echo "*** Important notes:" @echo "*** * The libsensors configuration file ($(ETCDIR)/sensors.conf) is never" @echo "*** overwritten by our installation process, so that you won't lose" @echo "*** your personal settings in that file. You still can get our latest" @echo "*** default config file in etc/sensors.conf.eg and manually copy it to" @echo "*** $(ETCDIR)/sensors.conf if you want. You will then want to edit it" @echo "*** to fit your needs again." + @echo "*** * The format of $(ETCDIR)/sensors.conf changed with lm-sensors 3.0.0." + @echo "*** If you have a custom configuration file using the old format, you" + @echo "*** can convert it using the sensors-conf-convert script. Otherwise just" + @echo "*** overwrite your old configuration file with the new default one." all :: user install :: all user_install diff --git a/etc/sensors-conf-convert b/etc/sensors-conf-convert new file mode 100755 index 00000000..bda09830 --- /dev/null +++ b/etc/sensors-conf-convert @@ -0,0 +1,467 @@ +#!/usr/bin/perl -w -pi.old + +# Convert a sensors.conf file from the old (Linux 2.4, lm-sensors 2) +# symbol names to the new (Linux 2.6, lm-sensors 3) symbol names. +# +# Copyright (C) 2007 Jean Delvare +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +# Implemented conversions: +# * The "algorithm name" part of bus statements is removed. +# * Bus statements for the ISA bus are removed. +# * Chip names containing dashes are removed. +# * Label, ignore, set and compute statements referencing features +# which are not part of the new interface are removed. +# * Label, ignore, set and compute statements referencing features +# which have been renamed are updated. This includes both general +# feature name changes and chip-specific feature name changes. +# +# Note that we have to look at the commented out lines too, so that +# the user doesn't have a bad surprise when uncommenting them. + +use strict; +use vars qw($debug $chip %trans @delete %chip_trans %chip_delete); + +BEGIN +{ + $debug = 0; + + %trans = ( + qr/\bvid\b/ => sub { "cpu0_vid" }, + qr/\bremote_temp\b/ => sub { "temp2" }, + qr/\bremote_temp_hyst\b/ => sub { "temp2_max_hyst" }, + qr/\bremote_temp_low\b/ => sub { "temp2_min" }, + qr/\bremote_temp_over\b/ => sub { "temp2_max" }, + qr/\btemp\b/ => sub { "temp1" }, + qr/\btemp_hyst\b/ => sub { "temp1_max_hyst" }, + qr/\btemp_low\b/ => sub { "temp1_min" }, + qr/\btemp_over\b/ => sub { "temp1_max" }, + qr/\btemp_high\b/ => sub { "temp1_max" }, + qr/\btemp_crit\b/ => sub { "temp1_crit" }, + + qr/\bvin(\d+)_max\b/ => sub { "in$1_max" }, + qr/\bvin(\d+)_min\b/ => sub { "in$1_min" }, + qr/\bvin(\d+)\b/ => sub { "in$1" }, + qr/\btemp(\d+)_over\b/ => sub { "temp$1_max" }, + qr/\btemp(\d+)_hyst\b/ => sub { "temp$1_max_hyst" }, + qr/\btemp(\d+)_high\b/ => sub { "temp$1_max" }, + qr/\btemp(\d+)_low\b/ => sub { "temp$1_min" }, + qr/\bsensor(\d+)\b/ => sub { "temp$1_type" }, + ); + + @delete = ( + qr/\balarms\b/, + qr/\bbeeps\b/, + qr/\bpwm\d*\b/, + qr/\bpwm\d+_enable\b/, + qr/\b(in|temp|fan)\d+_(state|status)\b/, + qr/\banalog_out\b/, + qr/\balarms_(in|temp|fan)\b/, + ); + + %chip_trans = ( + "gl518sm" => { + qr/\bvdd\b/ => sub { "in0" }, + qr/\bvdd_min\b/ => sub { "in0_min" }, + qr/\bvdd_max\b/ => sub { "in0_max" }, + }, + "gl520sm" => { + qr/\bvdd\b/ => sub { "in0" }, + qr/\bvdd_min\b/ => sub { "in0_min" }, + qr/\bvdd_max\b/ => sub { "in0_max" }, + }, + "lm80" => { + qr/\btemp_hot_hyst\b/ => sub { "temp1_max_hyst" }, + qr/\btemp_hot_max\b/ => sub { "temp1_max" }, + qr/\btemp_os_hyst\b/ => sub { "temp1_crit_hyst" }, + qr/\btemp_os_max\b/ => sub { "temp1_crit" }, + }, + "lm83" => { + qr/\btcrit\b/ => sub { "temp3_crit" }, + }, + "lm90" => { + qr/\btcrit(\d)\b/ => sub { "temp$1_crit" }, + qr/\bhyst(\d)\b/ => sub { "temp$1_crit_hyst" }, + }, + "adm1032" => { + qr/\btcrit(\d)\b/ => sub { "temp$1_crit" }, + qr/\bhyst(\d)\b/ => sub { "temp$1_crit_hyst" }, + }, + "lm86" => { + qr/\btcrit(\d)\b/ => sub { "temp$1_crit" }, + qr/\bhyst(\d)\b/ => sub { "temp$1_crit_hyst" }, + }, + "lm99" => { + qr/\btcrit(\d)\b/ => sub { "temp$1_crit" }, + qr/\bhyst(\d)\b/ => sub { "temp$1_crit_hyst" }, + }, + "adt7461" => { + qr/\btcrit(\d)\b/ => sub { "temp$1_crit" }, + qr/\bhyst(\d)\b/ => sub { "temp$1_crit_hyst" }, + }, + "max6657" => { + qr/\btcrit(\d)\b/ => sub { "temp$1_crit" }, + qr/\bhyst(\d)\b/ => sub { "temp$1_crit_hyst" }, + }, + "max6680" => { + qr/\btcrit(\d)\b/ => sub { "temp$1_crit" }, + qr/\bhyst(\d)\b/ => sub { "temp$1_crit_hyst" }, + }, + "lm93" => { + qr/\bvid([12])\b/ => sub { "cpu".($1-1)."_vid" }, + }, + "adm9240" => { + qr/"2\.5V(|_min|_max)"/ => sub { "in0$1" }, + qr/\bVccp1(|_min|_max)\b/ => sub { "in1$1" }, + qr/"3\.3V(|_min|_max)"/ => sub { "in2$1" }, + qr/"5V(|_min|_max)"/ => sub { "in3$1" }, + qr/"12V(|_min|_max)"/ => sub { "in4$1" }, + qr/\bVccp2(|_min|_max)\b/ => sub { "in5$1" }, + }, + "lm81" => { + qr/"2\.5V(|_min|_max)"/ => sub { "in0$1" }, + qr/\bVccp1(|_min|_max)\b/ => sub { "in1$1" }, + qr/"3\.3V(|_min|_max)"/ => sub { "in2$1" }, + qr/"5V(|_min|_max)"/ => sub { "in3$1" }, + qr/"12V(|_min|_max)"/ => sub { "in4$1" }, + qr/\bVccp2(|_min|_max)\b/ => sub { "in5$1" }, + }, + "ds1780" => { + qr/"2\.5V(|_min|_max)"/ => sub { "in0$1" }, + qr/\bVccp1(|_min|_max)\b/ => sub { "in1$1" }, + qr/"3\.3V(|_min|_max)"/ => sub { "in2$1" }, + qr/"5V(|_min|_max)"/ => sub { "in3$1" }, + qr/"12V(|_min|_max)"/ => sub { "in4$1" }, + qr/\bVccp2(|_min|_max)\b/ => sub { "in5$1" }, + }, + "adm1024" => { + qr/"2\.5V(|_min|_max)"/ => sub { "in0$1" }, + qr/\bVccp1(|_min|_max)\b/ => sub { "in1$1" }, + qr/"3\.3V(|_min|_max)"/ => sub { "in2$1" }, + qr/"5V(|_min|_max)"/ => sub { "in3$1" }, + qr/"12V(|_min|_max)"/ => sub { "in4$1" }, + qr/\bVccp2(|_min|_max)\b/ => sub { "in5$1" }, + qr/\btemp(\d)\b/ => sub { "temp".($1+1) }, + qr/\btemp(\d)_hyst\b/ => sub { "temp".($1+1)."_max_hyst" }, + qr/\btemp(\d)_over\b/ => sub { "temp".($1+1)."_max" }, + }, + "maxilife" => { + qr/\bvid(\d)(|_min|_max)\b/ => sub { "in".($1-1).$2 }, + }, + "thmc50" => { + qr/\btemp_hyst\b/ => sub { "temp1_min" }, + qr/\bremote_temp_hyst\b/ => sub { "temp2_min" }, + }, + "adm1022" => { + qr/\btemp_hyst\b/ => sub { "temp1_min" }, + qr/\bremote_temp_hyst\b/ => sub { "temp2_min" }, + }, + "adm1026" => { + qr/\bfan(\d)(|_div|_min)\b/ => sub { "fan".($1+1).$2 }, + qr/\btemp(\d)_therm\b/ => sub { "temp$1_crit" }, + }, + "via686a" => { + qr/"2\.0V"/ => sub { "in0" }, + qr/"2\.5V"/ => sub { "in1" }, + qr/"3\.3V"/ => sub { "in2" }, + qr/"5\.0V"/ => sub { "in3" }, + qr/"12V"/ => sub { "in4" }, + }, + "lm87" => { + qr/"2\.5V(|_min|_max)"/ => sub { "in0$1" }, + qr/\bVccp1(|_min|_max)\b/ => sub { "in1$1" }, + qr/"3\.3V(|_min|_max)"/ => sub { "in2$1" }, + qr/"5V(|_min|_max)"/ => sub { "in3$1" }, + qr/"12V(|_min|_max)"/ => sub { "in4$1" }, + qr/\bVccp2(|_min|_max)\b/ => sub { "in5$1" }, + qr/\bAIN1(|_min|_max)\b/ => sub { "in6$1" }, + qr/\bAIN2(|_min|_max)\b/ => sub { "in7$1" }, + qr/\bCPU_Temp\b/ => sub { "temp2" }, + }, + "fscpos" => { + qr/\bvolt12\b/ => sub { "in0" }, + qr/\bvolt5\b/ => sub { "in1" }, + qr/\bvoltbatt\b/ => sub { "in2" }, + }, + "fscscy" => { + qr/\bvolt12\b/ => sub { "in0" }, + qr/\bvolt5\b/ => sub { "in1" }, + qr/\bvoltbatt\b/ => sub { "in2" }, + }, + "pcf8591" => { + qr/\bch(\d)\b/ => sub { "in$1" }, + }, + "smsc47m192" => { + qr/\btemp(\d)_input_fault\b/ => sub { "temp$1_fault" }, + }, + "lm92" => { + qr/\btemp_hyst\b/ => sub { "temp1_crit_hyst" }, + }, + "max1619" => { + qr/\btemp2_hyst\b/ => sub { "temp2_crit_hyst" }, + }, + "lm78" => { + qr/\bin([56])_(min|max)\b/ => sub { "in$1_".($2 eq "max" ? "min" : "max") }, + }, + "lm79" => { + qr/\bin([56])_(min|max)\b/ => sub { "in$1_".($2 eq "max" ? "min" : "max") }, + }, + "w83781d" => { + qr/\bin([56])_(min|max)\b/ => sub { "in$1_".($2 eq "max" ? "min" : "max") }, + }, + "as99127f" => { + qr/\bin([56])_(min|max)\b/ => sub { "in$1_".($2 eq "max" ? "min" : "max") }, + }, + ); + + %chip_delete = ( + "adm1021" => [ + qr/\bdie_code\b/, + ], + "lm84" => [ + qr/\bdie_code\b/, + ], + "gl523" => [ + qr/\bdie_code\b/, + ], + "thmc10" => [ + qr/\bdie_code\b/, + ], + "gl518sm" => [ + qr/\bfan1_off\b/, + qr/\bfan1_off_pin\b/, + qr/\biterate\b/, + ], + "gl520sm" => [ + qr/\bfan1_off\b/, + qr/\btwo_temps\b/, + ], + "w83792d" => [ + qr/\bchassis\b/, + ], + "w83793" => [ + qr/\bchassis\b/, + ], + "maxilife" => [ + qr/\bpll(|_min|_max)\b/, + ], + "thmc50" => [ + qr/\banalog output\b/, + qr/\binterrupts\b/, + qr/\binterrupt mask\b/, + qr/\bdie_code\b/, + ], + "adm1022" => [ + qr/\banalog output\b/, + qr/\binterrupts\b/, + qr/\binterrupt mask\b/, + qr/\bdie_code\b/, + ], + "adm1026" => [ + qr/\balarm_mask\b/, + qr/\bgpio\b/, + qr/\bgpio_mask\b/, + qr/\bafc_pwm\b/, + qr/\bafc_analog_out\b/, + qr/\btemp\d_tmin\b/, + ], + "lm85" => [ + qr/\bpwm\d_(spinup|min|freq|min_ctl|zone|spinup_ctl)\b/, + qr/\bzone\d_(limit|hyst|range|critical|smooth)\b/, + qr/\bfan\d_(tach_mode|ppr)\b/, + ], + "lm85b" => [ + qr/\bpwm\d_(spinup|min|freq|min_ctl|zone|spinup_ctl)\b/, + qr/\bzone\d_(limit|hyst|range|critical|smooth)\b/, + qr/\bfan\d_(tach_mode|ppr)\b/, + ], + "lm85c" => [ + qr/\bpwm\d_(spinup|min|freq|min_ctl|zone|spinup_ctl)\b/, + qr/\bzone\d_(limit|hyst|range|critical|smooth)\b/, + qr/\bfan\d_(tach_mode|ppr)\b/, + ], + "emc6d100" => [ + qr/\bpwm\d_(spinup|min|freq|min_ctl|zone|spinup_ctl)\b/, + qr/\bzone\d_(limit|hyst|range|critical|smooth)\b/, + qr/\bfan\d_(tach_mode|ppr)\b/, + ], + "emc6d102" => [ + qr/\bpwm\d_(spinup|min|freq|min_ctl|zone|spinup_ctl)\b/, + qr/\bzone\d_(limit|hyst|range|critical|smooth)\b/, + qr/\bfan\d_(tach_mode|ppr)\b/, + ], + "adm1027" => [ + qr/\bpwm\d_(spinup|min|freq|min_ctl|zone|spinup_ctl)\b/, + qr/\bzone\d_(limit|hyst|range|critical|smooth)\b/, + qr/\bfan\d_(tach_mode|ppr)\b/, + ], + "adt7473" => [ + qr/\bpwm\d_(spinup|min|freq|min_ctl|zone|spinup_ctl)\b/, + qr/\bzone\d_(limit|hyst|range|critical|smooth)\b/, + qr/\bfan\d_(tach_mode|ppr)\b/, + ], + "fscpos" => [ + qr/\brev\b/, + qr/\bevent\b/, + qr/\bcontrol\b/, + qr/\bfan\d_ripple\b/, + qr/\bwdog_(preset|state|control)\b/, + ], + "fscscy" => [ + qr/\brev\b/, + qr/\bevent\b/, + qr/\bcontrol\b/, + qr/\btemp\d_lim\b/, + qr/\bfan\d_ripple\b/, + qr/\bwdog_(preset|state|control)\b/, + ], + "fscher" => [ + qr/\brev\b/, + qr/\bevent\b/, + qr/\bcontrol\b/, + qr/\bfan\d_ripple\b/, + qr/\bwdog_(preset|state|control)\b/, + ], + "pcf8591" => [ + qr/\bain_conf\b/, + qr/\baout_enable\b/, + qr/\baout\b/, + ], + "vt1211" => [ + qr/\bconfig\b/, + ], + "vt8231" => [ + qr/\bconfig\b/, + ], + "max6650" => [ + qr/\bspeed\b/, + ], + "max6651" => [ + qr/\bspeed\b/, + ], + "applesmc" => [ + qr/\bfan\d_(max|safe)\b/, + ], + ); + + print "# Converted by sensors-conf-convert on ".localtime()."\n"; +} + +sub substitute_line($$) +{ + my ($chip, $line) = @_; + + # First the chip-specific ones + if ($chip && exists $chip_trans{$chip}) { + foreach my $t (keys %{$chip_trans{$chip}}) { + $line =~ s/$t/$chip_trans{$chip}->{$t}->()/ge; + } + } + + # Then the general substitutions + foreach my $t (keys %trans) { + # Kudos to the nice folks in #perl on freenode :) + $line =~ s/$t/$trans{$t}->()/ge; + } + + return $line; +} + +sub delete_line($) +{ + my $feature = shift; + + # First the general deletions + foreach my $t (@delete) { + return 1 if $feature =~ m/$t/; + } + + # Then the chip-specific ones + if ($chip && exists $chip_delete{$chip}) { + foreach my $t (@{$chip_delete{$chip}}) { + return 1 if $feature =~ m/$t/; + } + } + + return 0; +} + +if (m/^# Converted by sensors-conf-convert/) { + print STDERR "WARNING: Converting an already converted file!\n"; + print STDERR " Result will be incorrect for some chip types.\n"; +} + +# Bus statements +if (m/^([\s#]*bus\s+"?i2c-\d+"?\s+"([^"]+)")\s+"[^"]*"/) { + print STDERR "Processing bus statement: $2\n" if $debug; + + if ($2 eq "ISA main adapter") { + $_ = ''; # Drop entirely + } else { + $_ = "$1\n"; # Drop algorithm name + } +} + +# Chip statements +elsif (m/^[\s#]*chip\s+"([\w\d*-]+)"/) { + # We only remember the first chip name, assuming that all chips + # in a given "chip" statement need the same specific processing + $chip = $1; + $chip =~ s/-.*//; + undef $chip if $chip eq "*"; + + # Remove dashes from chip names, as this is no longer allowed + s/(\s+"lm78-)j-/$1/g; + s/(\s+"maxilife-)(cg|co|as|nba)-/$1/g; + # Simplify possible duplicates + s/("lm78-\*")(\s+"lm78-\*")+/$1/g; + s/("maxilife-\*")(\s+"maxilife-\*")+/$1/g; + + # "*" is no longer a valid chip name + s/"\*"/"\*-\*"/g; + + print STDERR "Processing chip section: $chip\n" if $chip and $debug; +} + +# Drop references to lm78-j +elsif (m/^\s*#+.*lm78-?j/i) { + s/(lm78), lm78-?j/$1/gi; + s/(lm78)-?j/$1/gi; +} + +# Drop references to vrm +elsif (m/^[\s#]*set\s+vrm\s/i + || m/^\s*#+\s*adjust this if your vid is wrong/i + || m/^\s*#+\s*Also, one should set vrm prior to using vid in any formula/) { + $_ = ''; +} + +# Drop references to pwm +elsif (m/^\s*#+\s*PWM Output/i) { + $_ = ''; +} + +# Feature name substitution +elsif (m/^[\s#]*(?:label|ignore|set|compute)\s+(\S+)\s/) { + if (delete_line($1)) { + # Delete references to features that are now gone + $_ = ''; + } else { + # Substitute feature names + $_ = substitute_line($chip, $_); + } +} From 39f93afc8a734c46a0e6347bf963a9b253dc7c7d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 14:32:31 +0000 Subject: [PATCH 248/718] Print the conversion notice at the top of the converted file, not on stdout. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4771 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors-conf-convert | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/sensors-conf-convert b/etc/sensors-conf-convert index bda09830..b1405761 100755 --- a/etc/sensors-conf-convert +++ b/etc/sensors-conf-convert @@ -357,7 +357,9 @@ BEGIN qr/\bfan\d_(max|safe)\b/, ], ); +} +if ($. == 1) { print "# Converted by sensors-conf-convert on ".localtime()."\n"; } From d577b6eaae68bbb8347ccfd9a05fb74c738c6cac Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 15:00:40 +0000 Subject: [PATCH 249/718] Convert the default configuration file to use the new smybol names. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4772 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 785 +++++++++++++++++++------------------------- 1 file changed, 336 insertions(+), 449 deletions(-) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 9e303357..96add047 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -172,15 +172,15 @@ # # Sensor type adjustments (certain chips only): # ...Set temp1 to processor's thermal diode: -# set sensor1 1 (Winbond chips) -# set sensor1 3 (IT87xx and MTP008 chips) +# set temp1_type 1 (Winbond chips) +# set temp1_type 3 (IT87xx and MTP008 chips) # # ...Set temp1 sensor to 3904 transistor: -# set sensor1 2 (Winbond chips) +# set temp1_type 2 (Winbond chips) # # ...Set temp1 to thermistor: -# set sensor1 3435 (Winbond chips) -# set sensor1 2 (IT87xx and MTP008 chips) +# set temp1_type 3435 (Winbond chips) +# set temp1_type 2 (IT87xx and MTP008 chips) # # Often, a temperature sensor is disconnected; disable it with an ignore line: # ignore temp3 @@ -198,10 +198,10 @@ # # Here are some examples: # -# set in0_max vid*1.05 -# set in0_min vid*0.95 -# set temp1_over 40 -# set temp1_hyst 37 +# set in0_max cpu0_vid*1.05 +# set in0_min cpu0_vid*0.95 +# set temp1_max 40 +# set temp1_max_hyst 37 # # Think of tempx_over as 'alarm set' and tempx_hyst as 'alarm clear' # thresholds. In most cases the 'over' value should be higher than @@ -240,7 +240,7 @@ # --------- # There is one other feature: the 'bus' statement. An example is below. # -# bus "i2c-0" "SMBus PIIX4 adapter at e800" "Non-I2C SMBus adapter" +# bus "i2c-0" "SMBus PIIX4 adapter at e800" # # If we refer from now on to 'i2c-0' in 'chip' lines, this will run-time # be matched to this bus. So even if the PIIX4 is called 'i2c-5' at that @@ -324,32 +324,32 @@ chip "lm78-*" "lm79-*" "w83781d-*" # Here, we assume the VID readings are valid, and we use a max. 5% deviation -# set in0_min vid*0.95 -# set in0_max vid*1.05 -# set in1_min vid*0.95 -# set in1_max vid*1.05 +# set in0_min cpu0_vid*0.95 +# set in0_max cpu0_vid*1.05 +# set in1_min cpu0_vid*0.95 +# set in1_max cpu0_vid*1.05 # set in2_min 3.3 * 0.95 # set in2_max 3.3 * 1.05 # set in3_min 5.0 * 0.95 # set in3_max 5.0 * 1.05 # set in4_min 12 * 0.95 # set in4_max 12 * 1.05 -# set in5_max -12 * 0.95 -# set in5_min -12 * 1.05 -# set in6_max -5 * 0.95 -# set in6_min -5 * 1.05 +# set in5_min -12 * 0.95 +# set in5_max -12 * 1.05 +# set in6_min -5 * 0.95 +# set in6_max -5 * 1.05 -# Examples for lm78, lm78j, lm79 temperature limits -# set temp_over 40 -# set temp_hyst 37 +# Examples for lm78, lm79 temperature limits +# set temp1_max 40 +# set temp1_max_hyst 37 # Examples for w83781d temperature limits -# set temp1_over 40 -# set temp1_hyst 37 -# set temp2_over 52 -# set temp2_hyst 47 -# set temp3_over 52 -# set temp3_hyst 47 +# set temp1_max 40 +# set temp1_max_hyst 37 +# set temp2_max 52 +# set temp2_max_hyst 47 +# set temp3_max 52 +# set temp3_max_hyst 47 # Examples of fan low speed limits # set fan1_min 3000 @@ -364,7 +364,7 @@ chip "lm78-*" "lm79-*" "w83781d-*" # In case a lm78 is used together with a lm75, the lm78 temp sensor will # generally show the M/B temperature while the lm75 temp sensor will show # the CPU temperature. -# label temp "M/B Temp" +# label temp1 "M/B Temp" # Uncomment the following line to enable beeps for all alarms on this chip # set beep_enable 1 @@ -375,16 +375,16 @@ chip "lm75-*" # Most boards don't need scaling. Following is # for the Asus TX97-E. If it doesn't work for you, feel free to complain. -# compute temp @*2.0, @/2.0 +# compute temp1 @*2.0, @/2.0 # Examples for temperature limits -# set temp_over 70 -# set temp_hyst 65 +# set temp1_max 70 +# set temp1_max_hyst 65 # In case a lm75 is used together with a lm78, the lm78 temp sensor will # generally show the M/B temperature while the lm75 temp sensor will show # the CPU temperature. -# label temp "CPU Temp" +# label temp1 "CPU Temp" chip "sis5595-*" @@ -420,7 +420,7 @@ chip "sis5595-*" # The inverse of the driver formula is x = (1.20t - 62.77) # So the final formula is newt = (.345(1.20t - 62.77)) - 12). # Put this in the sensors.conf file as -# compute temp ((.345 * ((1.20 * @) - 62.77)) - 12), ... +# compute temp1 ((.345 * ((1.20 * @) - 62.77)) - 12), ... # where ... is the inverse function I leave to you. # # Look in your 'Vendor.ini' file to see which one is present @@ -430,18 +430,18 @@ chip "sis5595-*" # Fix up a 'compute' line to match your thermistor type. # Warning. You still don't have enough information to do this. # ThermistorType = NTC-10KC15-1608-1P (10K at 25C; Beta = 3435) -# compute temp ((X * ((1.20 * @) - 62.77)) - Y), ... +# compute temp1 ((X * ((1.20 * @) - 62.77)) - Y), ... # ThermistorType = NTC-103KC15-1608-1P (??) -# compute temp ((X * ((1.20 * @) - 62.77)) - Y), ... +# compute temp1 ((X * ((1.20 * @) - 62.77)) - Y), ... # ThermistorType = NTC-103AT-2 (10K at 25C; Beta = 3435) -# compute temp ((X * ((1.20 * @) - 62.77)) - Y), ... +# compute temp1 ((X * ((1.20 * @) - 62.77)) - Y), ... # ThermistorType = NTC-103JT (10K at 25C; Beta = 3435) -# compute temp ((X * ((1.20 * @) - 62.77)) - Y), ... +# compute temp1 ((X * ((1.20 * @) - 62.77)) - Y), ... # examples for sis5595 temperature limits; # for sis5595, temp_hyst is really the low limit, not a hysteresis value -# set temp_over 40 -# set temp_hyst 37 +# set temp1_max 40 +# set temp1_max_hyst 37 chip "w83782d-*" "w83627hf-*" @@ -478,10 +478,10 @@ chip "w83782d-*" "w83627hf-*" # set limits to 10% for the non-critical voltages # set limits to 20% for the battery voltage -# set in0_min vid*0.95 -# set in0_max vid*1.05 -# set in1_min vid*0.95 -# set in1_max vid*1.05 +# set in0_min cpu0_vid*0.95 +# set in0_max cpu0_vid*1.05 +# set in1_min cpu0_vid*0.95 +# set in1_max cpu0_vid*1.05 # set in2_min 3.3 * 0.95 # set in2_max 3.3 * 1.05 # set in3_min 5.0 * 0.95 @@ -501,17 +501,17 @@ chip "w83782d-*" "w83627hf-*" # 1 = PII/Celeron Diode; 2 = 3904 transistor; # 3435 = thermistor with Beta = 3435 # If temperature changes very little, try 1 or 2. -# set sensor1 1 -# set sensor2 2 -# set sensor3 3435 +# set temp1_type 1 +# set temp2_type 2 +# set temp3_type 3435 # examples for temperature limits -# set temp1_over 40 -# set temp1_hyst 37 -# set temp2_over 52 -# set temp2_hyst 47 -# set temp3_over 52 -# set temp3_hyst 47 +# set temp1_max 40 +# set temp1_max_hyst 37 +# set temp2_max 52 +# set temp2_max_hyst 47 +# set temp3_max 52 +# set temp3_max_hyst 47 chip "w83783s-*" @@ -538,8 +538,8 @@ chip "w83783s-*" # set limits to 10% for the non-critical voltages # set limits to 20% for the battery voltage -# set in0_min vid*0.95 -# set in0_max vid*1.05 +# set in0_min cpu0_vid*0.95 +# set in0_max cpu0_vid*1.05 # set in2_min 3.3 * 0.95 # set in2_max 3.3 * 1.05 # set in3_min 5.0 * 0.95 @@ -555,14 +555,14 @@ chip "w83783s-*" # 1 = PII/Celeron Diode; 2 = 3904 transistor; # 3435 = thermistor with Beta = 3435 # If temperature changes very little, try 1 or 2. -# set sensor1 1 -# set sensor2 2 +# set temp1_type 1 +# set temp2_type 2 # examples for temperature limits -# set temp1_over 40 -# set temp1_hyst 37 -# set temp2_over 52 -# set temp2_hyst 47 +# set temp1_max 40 +# set temp1_max_hyst 37 +# set temp2_max 52 +# set temp2_max_hyst 47 chip "w83697hf-*" @@ -640,15 +640,15 @@ chip "w83697hf-*" # 1 = PII/Celeron Diode; 2 = 3904 transistor; # 3435 = thermistor with Beta = 3435 # If temperature changes very little, try 1 or 2. -# set sensor1 1 -# set sensor2 2 -# set sensor3 3435 +# set temp1_type 1 +# set temp2_type 2 +# set temp3_type 3435 # examples for temperature limits -# set temp1_over 40 -# set temp1_hyst 37 -# set temp2_over 52 -# set temp2_hyst 47 +# set temp1_max 40 +# set temp1_max_hyst 37 +# set temp2_max 52 +# set temp2_max_hyst 47 chip "w83627thf-*" "w83637hf-*" @@ -686,8 +686,8 @@ chip "w83627thf-*" "w83637hf-*" # set limits to 20% for the battery voltage # if your vid is wrong, you'll need to adjust in0_min and in0_max -# set in0_min vid * 0.95 -# set in0_max vid * 1.05 +# set in0_min cpu0_vid * 0.95 +# set in0_max cpu0_vid * 1.05 # set in1_min 12 * 0.90 # set in1_max 12 * 1.10 # set in2_min 3.3 * 0.95 @@ -705,21 +705,21 @@ chip "w83627thf-*" "w83637hf-*" # 1 = PII/Celeron Diode; 2 = 3904 transistor; # 3435 = thermistor with Beta = 3435 # If temperature changes very little, try 1 or 2. -# set sensor1 1 -# set sensor2 2 -# set sensor3 3435 +# set temp1_type 1 +# set temp2_type 2 +# set temp3_type 3435 label temp1 "M/B Temp" label temp2 "CPU Temp" # ignore temp3 # examples for temperature limits -# set temp1_over 40 -# set temp1_hyst 37 -# set temp2_over 52 -# set temp2_hyst 47 -# set temp3_over 52 -# set temp3_hyst 47 +# set temp1_max 40 +# set temp1_max_hyst 37 +# set temp2_max 52 +# set temp2_max_hyst 47 +# set temp3_max 52 +# set temp3_max_hyst 47 # ignore fan1 label fan2 "CPU Fan" @@ -775,8 +775,8 @@ chip "w83792d-*" # temp2 limits examples -# set temp2_over 42 -# set temp2_hyst 37 +# set temp2_max 42 +# set temp2_max_hyst 37 # ignore examples @@ -880,28 +880,28 @@ chip "as99127f-*" # set limits to 10% for the non-critical voltages # set limits to 20% for the battery voltage -# set in0_min vid*0.95 -# set in0_max vid*1.05 -# set in1_min vid*0.95 -# set in1_max vid*1.05 +# set in0_min cpu0_vid*0.95 +# set in0_max cpu0_vid*1.05 +# set in1_min cpu0_vid*0.95 +# set in1_max cpu0_vid*1.05 # set in2_min 3.3 * 0.95 # set in2_max 3.3 * 1.05 # set in3_min 5.0 * 0.95 # set in3_max 5.0 * 1.05 # set in4_min 12 * 0.90 # set in4_max 12 * 1.10 -# set in5_max -12 * 0.90 -# set in5_min -12 * 1.10 -# set in6_max -5 * 0.95 -# set in6_min -5 * 1.05 +# set in5_min -12 * 0.90 +# set in5_max -12 * 1.10 +# set in6_min -5 * 0.95 +# set in6_max -5 * 1.05 # examples for temperature limits -# set temp1_over 40 -# set temp1_hyst 37 -# set temp2_over 52 -# set temp2_hyst 47 -# set temp3_over 52 -# set temp3_hyst 47 +# set temp1_max 40 +# set temp1_max_hyst 37 +# set temp2_max 52 +# set temp2_max_hyst 47 +# set temp3_max 52 +# set temp3_max_hyst 47 chip "gl518sm-*" @@ -911,31 +911,26 @@ chip "gl518sm-*" # Factors and labels taken from GL518SM datasheet, they seem to give # reasonable values with EISCA connected Fan78 - label vdd "+5V" - label vin1 "+3.3V" - label vin2 "+12V" - label vin3 "Vcore" + label in0 "+5V" + label in1 "+3.3V" + label in2 "+12V" + label in3 "Vcore" -# vin2 depends on external resistors (4,7k and 15k assumed here) -# vin1 and vin3 require no scaling +# in2 depends on external resistors (4,7k and 15k assumed here) +# in1 and in3 require no scaling - compute vin2 (197/47)*@ , @/(197/47) + compute in2 (197/47)*@ , @/(197/47) -# set vdd_min 4.8 -# set vdd_max 5.2 -# set vin1_min 3.20 -# set vin1_max 3.40 -# set vin2_min 11.0 -# set vin2_max 13.0 -# set vin3_min 2.10 -# set vin3_max 2.30 -# set fan1_off 0 +# set in0_min 4.8 +# set in0_max 5.2 +# set in1_min 3.20 +# set in1_max 3.40 +# set in2_min 11.0 +# set in2_max 13.0 +# set in3_min 2.10 +# set in3_max 2.30 # set fan2_min 0 -# Do NOT uncomment the following line with the Linux 2.6 kernel driver, -# as it'll raise an error. -# set iterate 2 - chip "gl520sm-*" @@ -948,35 +943,33 @@ chip "gl520sm-*" # Note that this means that you have either temp2 or vin4 but never both # at the same time. -# set two_temps 1 + label in0 "+5V" + label in1 "+3.3V" + label in2 "+12V" + label in3 "Vcore" + label in4 "-12V" - label vdd "+5V" - label vin1 "+3.3V" - label vin2 "+12V" - label vin3 "Vcore" - label vin4 "-12V" +# in1 and in3 require no scaling +# in2 depends on external resistors (4,7k and 15k assumed) -# vin1 and vin3 require no scaling -# vin2 depends on external resistors (4,7k and 15k assumed) - -# vin4 = ((R1+R2)/R2)*@ - (R1/R2)*vdd +# in4 = ((R1+R2)/R2)*@ - (R1/R2)*vdd # # -12 --| R1 |---t---| R2 |-- +5 # | # vin4 # - compute vin2 (197/47)*@ , @/(197/47) - compute vin4 (5*@)-(4*vdd) , (@+4*vdd)/5 + compute in2 (197/47)*@ , @/(197/47) + compute in4 (5*@)-(4*in0) , (@+4*in0)/5 -# set vdd_min 4.8 -# set vdd_max 5.2 -# set vin1_min 3.20 -# set vin1_max 3.40 -# set vin2_min 11.0 -# set vin2_max 13.0 -# set vin3_min 2.10 -# set vin3_max 2.30 +# set in0_min 4.8 +# set in0_max 5.2 +# set in1_min 3.20 +# set in1_max 3.40 +# set in2_min 11.0 +# set in2_max 13.0 +# set in3_min 2.10 +# set in3_max 2.30 chip "lm80-*" @@ -1038,19 +1031,13 @@ chip "lm80-*" # set in6_min -5 * 1.05 # set in6_max -5 * 0.95 -# examples for lm80 temperature limits -# WARNING - nonstandard names and functions for the lm80!!! # All 4 of these limits apply to the single temperature sensor. -# "hot" is like the standard alarm for most chips. -# "os" is the threshold for the overtemperature shutdown output. -# "os" may or may not do anything on your motherboard but it should -# be set higher than the "hot" thresholds. -# Note that the /proc file 'temp" also has five entries instead of -# the usual three. -# set temp_hot_hyst 45 -# set temp_hot_max 52 -# set temp_os_hyst 57 -# set temp_os_max 62 +# "crit" may or may not do anything on your motherboard but it should +# be set higher than the "max" thresholds. +# set temp1_max_hyst 45 +# set temp1_max 52 +# set temp1_crit_hyst 57 +# set temp1_crit 62 chip "via686a-*" @@ -1071,12 +1058,12 @@ chip "via686a-*" # if you have one of these boards you may want to uncomment the 'ignore 2.5V' # line below. - label "2.0V" "CPU core" - label "2.5V" "+2.5V" - #ignore "2.5V" - label "3.3V" "I/O" - label "5.0V" "+5V" - label "12V" "+12V" + label in0 "CPU core" + label in1 "+2.5V" + #ignore in1 + label in2 "I/O" + label in3 "+5V" + label in4 "+12V" label fan1 "CPU Fan" label fan2 "P/S Fan" @@ -1125,12 +1112,12 @@ chip "via686a-*" # we would still get some oscillation when the temp hovers around the limit # due to noise.) -# set temp1_hyst 40 -# set temp1_over 45 -# set temp2_hyst 55 -# set temp2_over 60 -# set temp3_hyst 60 -# set temp3_over 65 +# set temp1_max_hyst 40 +# set temp1_max 45 +# set temp2_max_hyst 55 +# set temp2_max 60 +# set temp3_max_hyst 60 +# set temp3_max 65 # You could set your fan limits too, but the defaults should be fine. @@ -1178,12 +1165,12 @@ chip "mtp008-*" compute in5 (@ * 36 - 118.61) / 7, (118.61 + 7 * @) / 36 # examples for temperature limits -# set temp1_over 40 -# set temp1_hyst 37 -# set temp2_over 52 -# set temp2_hyst 47 -# set temp3_over 52 -# set temp3_hyst 47 +# set temp1_max 40 +# set temp1_max_hyst 37 +# set temp2_max 52 +# set temp2_max_hyst 47 +# set temp3_max 52 +# set temp3_max_hyst 47 # End of standard mtp008 configuration @@ -1229,8 +1216,8 @@ chip "mtp008-*" # label fan3 "fan6" # ignore temp1 # label temp2 "MB Temp" -# set temp2_over 52 -# set temp2_hyst 47 +# set temp2_max 52 +# set temp2_max_hyst 47 # ignore temp3 chip "adm1025-*" "ne1619-*" @@ -1252,8 +1239,8 @@ chip "adm1025-*" "ne1619-*" label in5 "VCC" # Tolerate a 5% deviance for CPU power-supply -# set in1_min vid * 0.95 -# set in1_max vid * 1.05 +# set in1_min cpu0_vid * 0.95 +# set in1_max cpu0_vid * 1.05 # Tolerate a 10% deviance for other voltages # set in0_min 2.5 * 0.90 # set in0_max 2.5 * 1.10 @@ -1277,10 +1264,10 @@ chip "adm1025-*" "ne1619-*" # Temperatures label temp1 "CPU Temp" label temp2 "M/B Temp" -# set temp1_low 10 -# set temp1_high 60 -# set temp2_low 10 -# set temp2_high 45 +# set temp1_min 10 +# set temp1_max 60 +# set temp2_min 10 +# set temp2_max 45 chip "lm87-*" @@ -1311,34 +1298,34 @@ chip "lm87-*" # Warning - feature names starting with a number must be enclosed # with double quotes. - label "2.5V" "+2.5V" - label Vccp1 "VCore" - label "3.3V" "+3.3V" - label "5V" "+5V" - label "12V" "+12V" -# label Vccp2 "VCore2" + label in0 "+2.5V" + label in1 "VCore" + label in2 "+3.3V" + label in3 "+5V" + label in4 "+12V" +# label in5 "VCore2" label fan1 "CPU Fan" # label fan2 "Case Fan" label temp1 "M/B Temp" - label CPU_Temp "CPU Temp" + label temp2 "CPU Temp" # label temp3 "AUX Temp" -# set Vccp1_min vid * 0.95 -# set Vccp1_max vid * 1.05 -# set "3.3V_min" 3.3 * 0.92 -# set "3.3V_max" 3.3 * 1.08 -# set "5V_min" 5 * 0.92 -# set "5V_max" 5 * 1.08 -# set "12V_min" 12 * 0.90 -# set "12V_max" 12 * 1.10 +# set in1_min cpu0_vid * 0.95 +# set in1_max cpu0_vid * 1.05 +# set in2_min 3.3 * 0.92 +# set in2_max 3.3 * 1.08 +# set in3_min 5 * 0.92 +# set in3_max 5 * 1.08 +# set in4_min 12 * 0.90 +# set in4_max 12 * 1.10 # These ones are mutually exclusive with temp3. If you have temp3, # comment out these lines as they will trigger errors on "sensors -s". -# set "2.5V_min" 2.5 * 0.92 -# set "2.5V_max" 2.5 * 1.08 -# set Vccp2_min vid * 0.95 -# set Vccp2_max vid * 1.05 +# set in0_min 2.5 * 0.92 +# set in0_max 2.5 * 1.08 +# set in5_min cpu0_vid * 0.95 +# set in5_max cpu0_vid * 1.05 # Increase fan clock dividers if your fans read 0 RPM while you know # they are connected and running. @@ -1364,14 +1351,14 @@ chip "lm87-*" # just a guess, the datasheet gives no guidance. # Note that the Linux 2.6 driver needs no recompilation, it'll read the # configuration from the chip. -# label AIN1 "-12V" -# label AIN2 "-5V" -# set AIN1_min -12 * 0.95 -# set AIN2_min -5 * 0.95 -# set AIN1_max -12 * 1.05 -# set AIN2_max -5 * 1.05 -# compute AIN1 (7.50 * @) - 21.45 , (@ + 21.45) / 7.50 -# compute AIN2 (4.05 * @) - 10.07 , (@ + 10.07) / 4.05 +# label in6 "-12V" +# label in7 "-5V" +# set in6_min -12 * 0.95 +# set in7_min -5 * 0.95 +# set in6_max -12 * 1.05 +# set in7_max -5 * 1.05 +# compute in6 (7.50 * @) - 21.45 , (@ + 21.45) / 7.50 +# compute in7 (4.05 * @) - 10.07 , (@ + 10.07) / 4.05 chip "adm9240-*" "ds1780-*" "lm81-*" # @@ -1388,44 +1375,44 @@ chip "adm9240-*" "ds1780-*" "lm81-*" # Warning - feature names starting with a number must be enclosed # with double quotes. # -# label "2.5V" "xxx" -# label Vccp1 "xxx" -# label "3.3V" "xxx" -# label "5V" "xxx" -# label "12V" "xxx" -# label Vccp2 "xxx" +# label in0 "xxx" +# label in1 "xxx" +# label in2 "xxx" +# label in3 "xxx" +# label in4 "xxx" +# label in5 "xxx" # label fan1 "xxx" # label fan2 "xxx" -# label temp "xxx" +# label temp1 "xxx" # -# set Vccp1_min xxx -# set "2.5V_min" xxx -# set "3.3V_min" xxx -# set "5V_min" xxx -# set "12V_min" xxx -# set Vccp2_min xxx +# set in1_min xxx +# set in0_min xxx +# set in2_min xxx +# set in3_min xxx +# set in4_min xxx +# set in5_min xxx # -# set Vccp1_max xxx -# set "2.5V_max" xxx -# set "3.3V_max" xxx -# set "5V_max" xxx -# set "12V_max" xxx -# set Vccp2_max xxx +# set in1_max xxx +# set in0_max xxx +# set in2_max xxx +# set in3_max xxx +# set in4_max xxx +# set in5_max xxx # # set fan1_div xxx Note: do not uncomment with kernel 2.6 driver # set fan2_div xxx Note: do not uncomment with kernel 2.6 driver # set fan1_min xxx # set fan2_min xxx -# set temp1_hyst xxx -# set temp1_over xxx +# set temp1_max_hyst xxx +# set temp1_max xxx -# compute "2.5V" xxx -# compute Vccp1 xxx -# compute "3.3V" xxx -# compute "5V" xxx -# compute "12V" xxx -# compute Vccp2 xxx -# compute temp xxx +# compute in0 xxx +# compute in1 xxx +# compute in2 xxx +# compute in3 xxx +# compute in4 xxx +# compute in5 xxx +# compute temp1 xxx chip "adm1024-*" # @@ -1433,12 +1420,12 @@ chip "adm1024-*" # label fan1 "CPU1 fan" label fan2 "CPU2 fan" - label temp "SYS Temp" - label temp1 "CPU2 Temp" - label temp2 "CPU1 Temp" - ignore "2.5V" # This register is also used for temp2 - ignore "Vccp1" - ignore "Vccp2" + label temp1 "SYS Temp" + label temp2 "CPU2 Temp" + label temp3 "CPU1 Temp" + ignore in0 # This register is also used for temp3 + ignore in1 + ignore in5 chip "it87-*" "it8712-*" @@ -1457,10 +1444,6 @@ chip "it87-*" "it8712-*" label in7 "Stdby" label in8 "VBat" - # vid is not monitored by IT8705F - # comment out if you have IT8712 - ignore vid - # Incubus Saturnus reports that the IT87 chip on Asus A7V8X-X seems # to report the VCORE voltage approximately 0.05V higher than the board's # BIOS does. Although it doesn't make much sense physically, uncommenting @@ -1530,22 +1513,22 @@ chip "it87-*" "it8712-*" # The old method (modprobe it87 temp_type=0xXX) is no longer supported. # # 2 = thermistor; 3 = thermal diode; 0 = unused -# set sensor1 3 -# set sensor2 3 -# set sensor3 3 +# set temp1_type 3 +# set temp2_type 3 +# set temp3_type 3 # If a given sensor isn't used, you will probably want to ignore it # (see ignore statement right below). label temp1 "M/B Temp" -# set temp1_over 40 -# set temp1_low 15 +# set temp1_max 40 +# set temp1_min 15 label temp2 "CPU Temp" -# set temp2_over 45 -# set temp2_low 15 +# set temp2_max 45 +# set temp2_min 15 # ignore temp3 label temp3 "Temp3" -# set temp3_over 45 -# set temp3_low 15 +# set temp3_max 45 +# set temp3_min 15 # The A7V8X-X has temperatures inverted, and needs a conversion for # CPU temp. Thanks to Preben Randhol for the formula. @@ -1599,7 +1582,7 @@ chip "it87-*" "it8712-*" # set in7_min 5 * 0.95 # set in7_max 5 * 1.05 # vid not monitored by IT8705F -# ignore vid +# ignore cpu0_vid # compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1) # compute in4 ((30/10) +1)*@ , @/((30/10) +1) @@ -1637,8 +1620,8 @@ chip "it8716-*" # If vid (nominal CPU voltage) isn't correct, hardcode the correct value # instead. -# set in0_min vid * 0.95 -# set in0_max vid * 1.05 +# set in0_min cpu0_vid * 0.95 +# set in0_max cpu0_vid * 1.05 # set in1_min 1.8 * 0.95 # set in1_max 1.8 * 1.05 # set in2_min 3.3 * 0.95 @@ -1663,9 +1646,9 @@ chip "it8716-*" # appropriate lines below. # # 2 = thermistor; 3 = thermal diode; 0 = unused -# set sensor1 3 -# set sensor2 3 -# set sensor3 3 +# set temp1_type 3 +# set temp2_type 3 +# set temp3_type 3 # If a given sensor isn't used, you will probably want to ignore it # as well (see ignore statement right below). @@ -1676,10 +1659,10 @@ chip "it8716-*" # label temp2 "M/B Temp" # ignore temp3 -# set temp1_over 60 -# set temp1_low 10 -# set temp2_over 50 -# set temp2_low 10 +# set temp1_max 60 +# set temp1_min 10 +# set temp2_max 50 +# set temp2_min 10 # Fans @@ -1711,9 +1694,9 @@ chip "fscpos-*" # Voltage - label volt12 "+12V" - label volt5 "+5V" - label voltbatt "Battery" + label in0 "+12V" + label in1 "+5V" + label in2 "Battery" chip "fscscy-*" @@ -1737,9 +1720,9 @@ chip "fscscy-*" # Voltage - label volt12 "+12V" - label volt5 "+5V" - label voltbatt "+3.3V" + label in0 "+12V" + label in1 "+5V" + label in2 "+3.3V" chip "fscher-*" @@ -1767,25 +1750,6 @@ chip "fscher-*" compute in1 (@ * (20 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (20 * 33) compute in2 (@ * (10 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (10 * 33) -# Read documentation before enabling pwm settings -# (see the fscher driver documentation in the kernel tree) -# WARNING: IMPROPER VALUES MAY DAMAGE YOUR SYSTEM DUE TO OVERHEATING! - -# Allow fans to turn off -# set pwm1 0 -# set pwm2 0 -# set pwm3 0 - -# Min cooling -# set pwm1 2 -# set pwm2 1 -# set pwm3 1 - -# Max cooling -# set pwm1 255 -# set pwm2 255 -# set pwm3 255 - chip "pcf8591-*" # @@ -1793,44 +1757,33 @@ chip "pcf8591-*" # # Analog inputs - ignore ain_conf -# Since Linux 2.6, input configuration is set as module parameter, -# so the line below is for older kernels only. -# set ain_conf 0 - # You may discard ch2 and ch3 if you don't use them (depends on the input # configuration) -# ignore ch2 -# ignore ch3 +# ignore in2 +# ignore in3 - label ch0 "Chan. 0" - label ch1 "Chan. 1" - label ch2 "Chan. 2" - label ch3 "Chan. 3" + label in0 "Chan. 0" + label in1 "Chan. 1" + label in2 "Chan. 2" + label in3 "Chan. 3" # The driver assumes Vref = 2.56V and Agnd = 0V. If it doesn't match # your hardware, you have to use compute lines. The example below is # correct for Vref = 5.0V and Agnd = 0V. -# compute ch0 (@ * 500 / 256), (@ * 256 / 500) -# compute ch1 (@ * 500 / 256), (@ * 256 / 500) -# compute ch2 (@ * 500 / 256), (@ * 256 / 500) -# compute ch3 (@ * 500 / 256), (@ * 256 / 500) +# compute in0 (@ * 500 / 256), (@ * 256 / 500) +# compute in1 (@ * 500 / 256), (@ * 256 / 500) +# compute in2 (@ * 500 / 256), (@ * 256 / 500) +# compute in3 (@ * 500 / 256), (@ * 256 / 500) -# Analog output - - ignore aout_enable -# set aout_enable 1 - label aout "Output" -# set aout 0 chip "adm1021-*" "adm1023-*" "max1617-*" "max1617a-*" "thmc10-*" "lm84-*" "gl523sm-*" "mc1066-*" - label temp "Board Temp" - label remote_temp "CPU Temp" -# set temp_low 40 -# set temp_over 70 -# set remote_temp_low 40 -# set remote_temp_over 70 + label temp1 "Board Temp" + label temp2 "CPU Temp" +# set temp1_min 40 +# set temp1_max 70 +# set temp2_min 40 +# set temp2_max 70 chip "lm83-*" @@ -1844,15 +1797,15 @@ chip "lm83-*" # ignore temp4 # change high limits to fit your needs -# set temp1_high 55 -# set temp2_high 60 -# set temp3_high 65 -# set temp4_high 60 +# set temp1_max 55 +# set temp2_max 60 +# set temp3_max 65 +# set temp4_max 60 # change critical limit to fit your needs # only one limit for all four temperatures # should be higher than each of the high limits above -# set tcrit 85 +# set temp3_crit 85 chip "max1619-*" @@ -1865,27 +1818,27 @@ chip "max1619-*" # set temp2_max 100 # change critical limit and hysteresis to fit your needs -# set temp2_crit 50 -# set temp2_hyst 40 +# set temp2_crit 50 +# set temp2_crit_hyst 40 chip "lm90-*" "adm1032-*" "lm86-*" "max6657-*" "adt7461-*" "max6680-*" label temp1 "M/B Temp" label temp2 "CPU Temp" - label tcrit1 "M/B Crit" - label tcrit2 "CPU Crit" + label temp1_crit "M/B Crit" + label temp2_crit "CPU Crit" # change high and low limits to fit your needs -# set temp1_low 10 -# set temp1_high 55 -# set temp2_low 10 -# set temp2_high 66 +# set temp1_min 10 +# set temp1_max 55 +# set temp2_min 10 +# set temp2_max 66 # change critical limits to fit your needs # should be higher than the corresponding high limit above -# set tcrit1 75 -# set tcrit2 85 +# set temp1_crit 75 +# set temp2_crit 85 # change the hysteresis values (to critical limits) to fit your needs # note #1: hyst2 will be automatically set with the same delta @@ -1893,14 +1846,14 @@ chip "lm90-*" "adm1032-*" "lm86-*" "max6657-*" "adt7461-*" "max6680-*" # for both channels, cannot hold values greater than 31, so the delta # between critical temperatures and respective absolute hysteresis can # never exceed this value -# set hyst1 70 +# set temp1_crit_hyst 70 chip "lm99-*" label temp1 "G/C Temp" label temp2 "GPU Temp" - label tcrit1 "G/C Crit" - label tcrit2 "GPU Crit" + label temp1_crit "G/C Crit" + label temp2_crit "GPU Crit" # note #1: only the LM99 needs this; for a LM89, comment the compute line # out @@ -1910,15 +1863,15 @@ chip "lm99-*" compute temp2 @+16, @-16 # change high and low limits to fit your needs -# set temp1_low 10 -# set temp1_high 90 -# set temp2_low 10 -# set temp2_high 100 +# set temp1_min 10 +# set temp1_max 90 +# set temp2_min 10 +# set temp2_max 100 # change critical limits to fit your needs # should be higher than the corresponding high limit above -# set tcrit1 100 -# set tcrit2 110 +# set temp1_crit 100 +# set temp2_crit 110 # change the hysteresis values (to critical limits) to fit your needs # note #1: hyst2 will be automatically set with the same delta @@ -1926,7 +1879,7 @@ chip "lm99-*" # for both channels, cannot hold values greater than 31, so the delta # between critical temperatures and respective absolute hysteresis can # never exceed this value -# set hyst1 105 +# set temp1_crit_hyst 105 chip "lm63-*" @@ -1937,43 +1890,15 @@ chip "lm63-*" label fan1 "CPU Fan" # Change limits to fit your needs. Note that temp2_crit is read-only. -# set temp1_high 50 -# set temp2_low 10 -# set temp2_high 70 +# set temp1_max 50 +# set temp2_min 10 +# set temp2_max 70 # set temp2_crit_hyst 75 # set fan1_min 2000 chip "vt1211-*" -# 1 for temp, 0 for volt. -# Sensor Voltage Mode Temp Mode config bit -# -------- ------------ --------- -------------- -# Reading 1 temp1 -# Reading 3 temp2 -# UCH1/Reading2 in0 temp3 0x04 (4) -# UCH2 in1 temp4 0x08 (8) -# UCH3 in2 temp5 0x10 (16) -# UCH4 in3 temp6 0x20 (32) -# UCH5 in4 temp7 0x40 (64) -# 3.3V in5 - -# Set uch1-2 to temp mode, uch3-5 to voltage mode. This works only -# for the 2.4 driver. For the 2.6 driver use the uch_config module parameter. -# If the value doesn't match the hardware wiring, you'll get weird readings! -# set config 12 - -# The 2.6 driver will automatically ignore the inputs which are not -# configured, but the 2.4 driver will not so you'll need to add ignore -# statements depending on the config value above. -# ignore in0 -# ignore in1 -# ignore temp3 -# ignore temp4 - ignore temp5 - ignore temp6 - ignore temp7 - label in0 "+3.3V" label in1 "+2.5V" label in2 "VCore" @@ -2012,8 +1937,8 @@ chip "vt1211-*" # set in1_min 2.5 * 0.95 # set in1_max 2.5 * 1.05 # If your vid is wrong, hardcode the CPU voltage (e.g. 1.4) -# set in2_min vid * 0.97 -# set in2_max vid * 1.03 +# set in2_min cpu0_vid * 0.97 +# set in2_max cpu0_vid * 1.03 # set in3_min 5.0 * 0.95 # set in3_max 5.0 * 1.05 # set in4_min 12.0 * 0.90 @@ -2061,41 +1986,19 @@ chip "vt1211-*" compute temp7 1 / (1 / 298.15 - (` (2.2 / @ - 1)) / 3435) - 273.15, \ 2.2 / (1 + (^ (3435 / 298.15 - 3435 / (273.15 + @)))) -# set temp1_hyst 80 -# set temp1_over 85 -# set temp2_hyst 60 -# set temp2_over 65 -# set temp3_hyst 60 -# set temp3_over 65 -# set temp4_hyst 40 -# set temp4_over 45 +# set temp1_max_hyst 80 +# set temp1_max 85 +# set temp2_max_hyst 60 +# set temp2_max 65 +# set temp3_max_hyst 60 +# set temp3_max 65 +# set temp4_max_hyst 40 +# set temp4_max 45 # set fan1_min 3000 # set fan2_min 3000 chip "vt8231-*" -# -# 1 for temp, 0 for volt. -# Sensor Voltage Mode Temp Mode config bit -# -------- ------------ --------- -------------- -# Reading 1 temp1 -# UCH1 in0 temp2 0x04 (4) -# UCH2 in1 temp3 0x08 (8) -# UCH3 in2 temp4 0x10 (16) -# UCH4 in3 temp5 0x20 (32) -# UCH5 in4 temp6 0x40 (64) -# 3.3V in5 -# -# Hardware default is UCH1 in temp mode, UCH2-5 in voltage mode -# Note that the Linux 2.6 driver will not let you change the channel -# configuration. In theory, the BIOS should have done it properly. -# set config 4 - -# ignore in0 -# ignore temp3 -# ignore temp4 -# ignore temp5 -# ignore temp6 label in1 "+2.5V" label in2 "VCore" @@ -2152,10 +2055,10 @@ chip "vt8231-*" compute temp3 1 / (1 / 298.15 - (` (2.2 / @ - 1)) / 3435) - 273.15, \ 2.2 / (1 + (^ (3435 / 298.15 - 3435 / (273.15 + @)))) -# set temp1_hyst 60 -# set temp1_over 65 -# set temp2_hyst 40 -# set temp2_over 45 +# set temp1_max_hyst 60 +# set temp1_max 65 +# set temp2_max_hyst 40 +# set temp2_max 45 # set fan1_min 3000 # set fan2_min 3000 @@ -2192,8 +2095,8 @@ chip "smsc47m192-*" # set in0_max 2.5 * 1.05 label in1 "VCore" -# set in1_min vid * 0.95 -# set in1_max vid * 1.05 +# set in1_min cpu0_vid * 0.95 +# set in1_max cpu0_vid * 1.05 label in2 "+3.3V" # set in2_min 3.3 * 0.95 @@ -2241,13 +2144,13 @@ chip "smsc47m192-*" chip "asb100-*" label in0 "VCore 1" - #set in0_min vid * 0.95 - #set in0_max vid * 1.05 + #set in0_min cpu0_vid * 0.95 + #set in0_max cpu0_vid * 1.05 label in1 "VCore 2" ignore in1 - #set in1_min vid * 0.95 - #set in1_max vid * 1.05 + #set in1_min cpu0_vid * 0.95 + #set in1_max cpu0_vid * 1.05 label in2 "+3.3V" #set in2_min 3.3 * 0.95 @@ -2276,25 +2179,25 @@ chip "asb100-*" #set in6_min -5 * 1.05 label temp1 "M/B Temp" - #set temp1_over 45 - #set temp1_hyst 40 + #set temp1_max 45 + #set temp1_max_hyst 40 label temp2 "CPU Temp (Intel)" #ignore temp2 - #set temp2_over 60 - #set temp2_hyst 50 + #set temp2_max 60 + #set temp2_max_hyst 50 # PWRTMP connector on P4S333, for external sensor label temp3 "Power Temp" #ignore temp3 - #set temp3_over 45 - #set temp3_hyst 40 + #set temp3_max 45 + #set temp3_max_hyst 40 # Used for Athlon diode, ignore for P4S333 label temp4 "CPU Temp (AMD)" - #set temp4_over 60 - #set temp4_hyst 50 + #set temp4_max 60 + #set temp4_max_hyst 50 #ignore temp4 label fan1 "CPU Fan" @@ -2334,11 +2237,6 @@ chip "lm85c-*" "adm1027-*" "adt7463-*" "lm85-*" "lm85b-*" # label fan3 "Fan3" # label fan4 "Fan4" -# PWM Outputs - label pwm1 "CPU_PWM" - label pwm2 "Fan2_PWM" - label pwm3 "Fan3_PWM" - # Voltage scaling is done on-chip. No 'compute' directive # should be necessary. If in0 has external scaling set # it here. @@ -2347,9 +2245,7 @@ chip "lm85c-*" "adm1027-*" "adt7463-*" "lm85-*" "lm85b-*" # Adjust fans speeds for actual pulses per rev # compute fan1 @ * 2, @ / 2 # 1 pulse per rev -# set fan1_ppr 1 # ADM1027 or ADT7463 # compute fan2 @ / 2, @ * 2 # 4 pulse per rev -# set fan2_ppr 4 # ADM1027 or ADT7463 # Ignore fans you (or your motherboard) don't have # ignore fan2 @@ -2359,8 +2255,8 @@ chip "lm85c-*" "adm1027-*" "adt7463-*" "lm85-*" "lm85b-*" # Set voltage limits # set in0_min 1.5 * 0.95 # set in0_max 1.5 * 1.05 -# set in1_min vid * 0.95 -# set in1_max vid * 1.05 +# set in1_min cpu0_vid * 0.95 +# set in1_max cpu0_vid * 1.05 # set in2_min 3.3 * 0.95 # set in2_max 3.3 * 1.05 # set in3_min 5.0 * 0.95 @@ -2512,18 +2408,16 @@ chip "w83l785ts-*" chip "lm92-*" - label temp "CPU Temp" + label temp1 "CPU Temp" # Change limits as you see fit -# set temp_low 14 -# set temp_high 60 -# set temp_crit 72 -# Hysteresis is computed from critical limit for Linux 2.6, -# and from high limit for Linux 2.4. That might change in the future. -# Whatever, the same relative hysteresis is used for all of low, high +# set temp1_min 14 +# set temp1_max 60 +# set temp1_crit 72 +# Hysteresis is computed from critical limit +# The same relative hysteresis is used for all of low, high # and critical limits. -# set temp_hyst 70 # Linux 2.6 -# set temp_hyst 58 # Linux 2.4 +# set temp1_crit_hyst 70 # Winbond W83627EHF configuration originally contributed by Leon Moonen @@ -2572,10 +2466,10 @@ chip "w83627ehf-*" "w83627dhg-*" label temp3 "AUX Temp" # ignore temp3 -# set temp1_over 45 -# set temp1_hyst 40 -# set temp2_over 45 -# set temp2_hyst 40 +# set temp1_max 45 +# set temp1_max_hyst 40 +# set temp2_max 45 +# set temp2_max_hyst 40 # Fintek F71805F/FG configuration @@ -2637,12 +2531,12 @@ chip "f71805f-*" label temp2 "Sys Temp" label temp3 "Aux Temp" - #set temp1_max 60 - #set temp1_hyst 58 - #set temp2_max 50 - #set temp2_hyst 48 - #set temp3_max 50 - #set temp3_hyst 48 + #set temp1_max 60 + #set temp1_max_hyst 58 + #set temp2_max 50 + #set temp2_max_hyst 48 + #set temp3_max 50 + #set temp3_max_hyst 48 # Abit Uguru sensor part configuration. @@ -2738,13 +2632,6 @@ chip "dme1737-*" label fan5 "Fan5" label fan6 "Fan6" -# PWM Outputs - label pwm1 "CPU_PWM" - label pwm2 "Fan2_PWM" - label pwm3 "Fan3_PWM" - label pwm5 "Fan5_PWM" - label pwm6 "Fan6_PWM" - # Set voltage limits # set in0_min 5.0 * 0.95 # set in0_max 5.0 * 1.05 From 1d05faf18bf426591834b36ccf591d58090ec853 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 15:52:56 +0000 Subject: [PATCH 250/718] More cleanups: drop legacy references, sections for drivers not yet ported to Linux 2.6, etc. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4773 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 350 +++++--------------------------------------- 1 file changed, 39 insertions(+), 311 deletions(-) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 96add047..b5d795a7 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -53,14 +53,12 @@ # These features are defined for each chip in lib/chips.c. # # Undefined features will be silently ignored in 'label' and 'compute' lines. -# Undefined features in 'set' lines will result in 'Unknonw feature name' +# Undefined features in 'set' lines will result in 'Unknown feature name' # when running 'sensors -s'. # # Unfortunately, feature names starting with a number must be in # double quotes or you get "parse error, expecting 'NAME'". # -# If you have trouble, verify the features in lib/chips.c!!! -# # # LABEL LINES # ----------- @@ -69,10 +67,6 @@ # If no label is specified for a certain feature, the default name # (ie. 'fan1' for fan1) is used. # -# If you specify a label for in1, this label is also used for in1_min and -# in1_max, unless they have their own labels declared. There are several -# of these logical groups. -# # These are as advised in the LM78 and LM79 data sheets, and used on most # boards we have seen. # @@ -88,20 +82,17 @@ # COMPUTE LINES # ------------- # A compute line describes how to scale a certain feature. There are -# two expressions in it: the first describes how the /proc value must +# two expressions in it: the first describes how the driver value must # be translated to a user value, the second how a user value must be -# translated to a /proc value. '@' is the value to operate on. You may -# refer to other readable features (like '2 * vid'). +# translated to a driver value. '@' is the value to operate on. You may +# refer to other readable features (like 'cpu0_vid * 1.05'). # # The following operators are valid: + - * / ( ) ^ ` -# ^ is e**x and ` is ln(x) (valid in library version 2.0.0 / -# lm_sensors 2.8.0 or higher) +# ^ is e**x and ` is ln(x) # -# Like for the label statement, there are logical groups here. They are -# sometimes a bit different, though. For example, fan1_div is in the -# logical label group of fan1 (it gets the same label if none is declared -# for it), but it is not in the compute group of fan1 (as it uses a -# completely different system of values). +# Where it makes sense, compute lines are inherited by subfeatures. +# For example, the compute line for 'in0' is automatically applied to +# 'in0_min' and 'in0_max' as well. # # # VOLTAGE COMPUTATION DETAILS @@ -171,16 +162,12 @@ # compute temp1 @+5,@-5 # # Sensor type adjustments (certain chips only): -# ...Set temp1 to processor's thermal diode: -# set temp1_type 1 (Winbond chips) -# set temp1_type 3 (IT87xx and MTP008 chips) -# -# ...Set temp1 sensor to 3904 transistor: -# set temp1_type 2 (Winbond chips) -# -# ...Set temp1 to thermistor: -# set temp1_type 3435 (Winbond chips) -# set temp1_type 2 (IT87xx and MTP008 chips) +# set temp1_type 1 # PII/Celeron Diode +# set temp1_type 2 # 3904 transistor +# set temp1_type 3 # thermal diode +# set temp1_type 4 # thermistor +# set temp1_type 5 # AMD AMDSI +# set temp1_type 6 # Intel PECI # # Often, a temperature sensor is disconnected; disable it with an ignore line: # ignore temp3 @@ -203,9 +190,9 @@ # set temp1_max 40 # set temp1_max_hyst 37 # -# Think of tempx_over as 'alarm set' and tempx_hyst as 'alarm clear' -# thresholds. In most cases the 'over' value should be higher than -# the 'hyst' value by several degrees. +# Think of tempx_max as 'alarm set' and tempx_max_hyst as 'alarm clear' +# thresholds. In most cases the 'max' value should be higher than +# the 'max_hyst' value by several degrees. # # All the set statements from this file are commented out by default. # The reason is that the proper limits are highly system-dependent, @@ -216,11 +203,10 @@ # # IGNORE LINES # ------------ -# Ignore statements tell certain features are not wanted. User programs can -# still read them if they really want, though; this is just an advisory -# marking. 'in0' would also invalidate 'in0_max' and 'in0_min'. +# Ignore statements tell certain features are not wanted. As with compute +# statements, 'ignore in0' would also invalidate 'in0_max' and 'in0_min'. # 'ignore' does not disable anything in the actual sensor chip; it -# simply advises the user program to not access that data. +# simply prevents the user program from accessing that data. # # ignore in0 # @@ -373,8 +359,7 @@ chip "lm78-*" "lm79-*" "w83781d-*" chip "lm75-*" -# Most boards don't need scaling. Following is -# for the Asus TX97-E. If it doesn't work for you, feel free to complain. +# Most boards don't need scaling. Following is for the Asus TX97-E. # compute temp1 @*2.0, @/2.0 # Examples for temperature limits @@ -439,7 +424,6 @@ chip "sis5595-*" # compute temp1 ((X * ((1.20 * @) - 62.77)) - Y), ... # examples for sis5595 temperature limits; -# for sis5595, temp_hyst is really the low limit, not a hysteresis value # set temp1_max 40 # set temp1_max_hyst 37 @@ -661,9 +645,6 @@ chip "w83627thf-*" "w83637hf-*" # Note that in1 (+12V) is the usual in4, and in4 (-12V) is the usual in5. # Data sheet is obviously wrong for in4, the usual formula should work. # No in5 nor in6. -# sensors doesn't need the ignore lines but sensord does... - ignore in5 - ignore in6 label in0 "VCore" label in1 "+12V" @@ -939,9 +920,7 @@ chip "gl520sm-*" # The GL520SM has two application modes. In mode 1 it has two thermistor # inputs, in mode 2 it has only one and an extra (negative) voltage input. # The mode is supposed to be set properly by your BIOS so you should not -# need to change it. You can force it below if really needed though. -# Note that this means that you have either temp2 or vin4 but never both -# at the same time. +# need to change it. Note that you have either temp2 or in4, not both. label in0 "+5V" label in1 "+3.3V" @@ -975,8 +954,7 @@ chip "gl520sm-*" chip "lm80-*" # The values below should be correct if you own a qdi BX (brilliant1) -# mainboard. If not, please contact us, so we can figure out better readings. -# Many thanks go to Peter T. Breuer for helping us figure +# mainboard. Many thanks go to Peter T. Breuer for helping us figure # out how to handle the LM80. # For positive voltages (in0..in4), two resistors are used, with the following @@ -1034,10 +1012,10 @@ chip "lm80-*" # All 4 of these limits apply to the single temperature sensor. # "crit" may or may not do anything on your motherboard but it should # be set higher than the "max" thresholds. -# set temp1_max_hyst 45 -# set temp1_max 52 +# set temp1_max_hyst 45 +# set temp1_max 52 # set temp1_crit_hyst 57 -# set temp1_crit 62 +# set temp1_crit 62 chip "via686a-*" @@ -1045,17 +1023,16 @@ chip "via686a-*" # VIA is very specific about the voltage sensor inputs, and our labels # reflect what they say. Unfortunately, they are not at all specific about # how to convert any of the register values to real units. Fortunately, -# Jonathan Yew and Alex van Kaam -# came through with some data for temp conversion and formulae for voltage -# conversion. However, the conversions should be regarded as our best guess- -# YMMV. +# Jonathan Yew and Alex van Kaam came through with some data for temp +# conversion and formulae for voltage conversion. However, the conversions +# should be regarded as our best guess - YMMV. # On the Tyan S1598, the 2.5V sensor reads 0 and is not displayed in the BIOS. -# Linas Vepstas reports that this sensor shows nothing of +# Linas Vepstas reports that this sensor shows nothing of # interest on the Abit KA7 (Athlon), and is also not displayed in the BIOS. -# Likewise, Johannes Drechsel-Burkhard reports that this +# Likewise, Johannes Drechsel-Burkhard reports that this # sensor is unavailable in the BIOS of his MSI K7T Pro (Thunderbird). So, -# if you have one of these boards you may want to uncomment the 'ignore 2.5V' +# if you have one of these boards you may want to uncomment the 'ignore in1' # line below. label in0 "CPU core" @@ -1075,7 +1052,7 @@ chip "via686a-*" # different from temp1 & temp2 (as noted above, VIA has not provided # conversion info). So, you may wish to 'ignore temp3'. -# Johannes Drechsel-Burkhard notes that on his MSI K7T Pro, +# Johannes Drechsel-Burkhard notes that on his MSI K7T Pro, # temp1 is the CPU temp and temp2 is the SYS temp. Hugo van der Merwe notes # the same for his Gigabyte GA-7DXC, Olivier Martin for his Gigabyte # GA-7ZM and Patrick Thomson for his Chaintech CT-5ATA. @@ -1102,9 +1079,9 @@ chip "via686a-*" # set in4_min 12 * 0.9 # set in4_max 12 * 1.1 -# Set your temp limits here. Remember, 'tempX_over' is the temp at which an -# alarm is triggered, and 'tempX_hyst' is the temp at which an alarm turns off. -# Setting tempX_hyst to a few degrees below the corresponding tempX_over +# Set your temp limits here. Remember, 'tempX_max' is the temp at which an +# alarm is triggered, and 'tempX_max_hyst' is the temp at which an alarm turns off. +# Setting tempX_max_hyst to a few degrees below the corresponding tempX_max # prevents an oscillation between alarm on and off states. This kind of # oscillation is known as hyteresis, thus the name. (You typically get the # most serious and troublesome hysteresis when a sensor triggers something to @@ -1125,101 +1102,6 @@ chip "via686a-*" #set fan2_min 5000 -chip "mtp008-*" - -# The values below should be correct if you own a Tyan S1834D motherboard. -# If not, please contact us, so we can figure out better readings. -# FOR TYAN S2510 SEE END OF THIS SECTION. - -# For positive voltages outside the 0..4.09V range (in2..in4), two resistors -# are used, with the following formula (R1,R2: resistor values, Vs: read -# voltage, Vin: pin voltage) -# Vin = Vs * (R2 / (R1 + R2)) -# For negative voltages (in5) two resistors are used, with the following -# formula (R3,R4: resistor values, Vs: read voltage, Vin: pin voltage) -# Vin = ((4.096 - Vs) * (R3 / (R3 + R4))) + Vs - -# Here are the official MTP008 data sheet values: -# Vs R1,R3 R2,R4 Vin -# +12.0 28000 10000 +3.16 -# -12.0 232000 56000 +0.96 -# -5.0 120000 56000 +1.20 - - label in0 "VCore1" - label in1 "+3.3V" - label in2 "+12V" - label in3 "Vcore2" - ignore in4 - label in5 "-12V" - label in6 "Vtt" - - label fan1 "CPU1 Fan" - label fan2 "CPU2 Fan" - label fan3 "fan3" - - label temp1 "CPU1 Temp" - label temp2 "CPU2 Temp" - ignore temp3 - - compute in2 @ * 38 / 10, @ * 10 / 38 - compute in5 (@ * 36 - 118.61) / 7, (118.61 + 7 * @) / 36 - -# examples for temperature limits -# set temp1_max 40 -# set temp1_max_hyst 37 -# set temp2_max 52 -# set temp2_max_hyst 47 -# set temp3_max 52 -# set temp3_max_hyst 47 - -# End of standard mtp008 configuration - -# TYAN S2510 INFORMATION -# This motherboard has two mtp008's which are hooked up differently, -# so they must be configured separately. -# For this motherboard, COMMENT OUT the above mtp008 section and -# UNCOMMENT the following two sections. -# -#chip "mtp008-i2c-*-2c" -# label in0 "VCore1" -# set in0_min 1.60 -# set in0_max 1.80 -# label in1 "+3.3V" -# label in2 "+12V" -# label in3 "Vcore2" -# set in3_min 1.60 -# set in3_max 1.80 -# ignore in4 -# label in5 "-12V" -# label in6 "Vtt" -# label fan1 "CPU1 Fan" -# label fan2 "CPU2 Fan" -# label fan3 "fan3" -# label temp1 "CPU1 Temp" -# label temp2 "CPU2 Temp" -# ignore temp3 -# compute in2 @ * 38 / 10, @ * 10 / 38 -# compute in5 (@ * 36 - 118.61) / 7, (118.61 + 7 * @) / 36 -# -#chip "mtp008-i2c-*-2e" -# ignore in0 -# label in1 "+3.3V" -# ignore in2 -# label in3 "+5V" -# set in3_min 4.50 -# set in3_max 5.50 -# ignore in4 -# label in5 "+3.3V" -# ignore in6 -# label fan1 "fan4" -# label fan2 "fan5" -# label fan3 "fan6" -# ignore temp1 -# label temp2 "MB Temp" -# set temp2_max 52 -# set temp2_max_hyst 47 -# ignore temp3 - chip "adm1025-*" "ne1619-*" # The ADM1025 has integrated scaling resistors, rather @@ -1280,23 +1162,6 @@ chip "lm87-*" # motherboard connections match these labels, and that the # driver computations are correct. Therefore they do not need to # be overridden here. -# -# Note: AIN1 (-12?), AIN2 (-5?) and temp3 require changing -# #defines in the driver and recompiling!!! -# This does not apply to the Linux 2.6 driver. -# -# This chip has non-standard entries in lib/chips.c so -# the feature names are quite different from other chips. -# For this chip, libsensors anticipates the correct labeling. -# This is great if it's correct but makes it a little more -# difficult if you want to change it. -# -# This may not have been a good idea, so it may be changed in the future. -# Here is an entry with everything commented out so you can -# uncomment the appropriate line if you want to change it. -# -# Warning - feature names starting with a number must be enclosed -# with double quotes. label in0 "+2.5V" label in1 "VCore" @@ -1346,86 +1211,16 @@ chip "lm87-*" # set temp3_max 70 # LM87 AIN1 and AIN2 Section -# As described above, the driver must be recompiled to use either or -# both of these. -12 and -5 may be reversed on your board, this is +# -12 and -5 may be reversed on your board, this is # just a guess, the datasheet gives no guidance. -# Note that the Linux 2.6 driver needs no recompilation, it'll read the -# configuration from the chip. # label in6 "-12V" # label in7 "-5V" +# compute in6 (7.50 * @) - 21.45 , (@ + 21.45) / 7.50 +# compute in7 (4.05 * @) - 10.07 , (@ + 10.07) / 4.05 # set in6_min -12 * 0.95 # set in7_min -5 * 0.95 # set in6_max -12 * 1.05 # set in7_max -5 * 1.05 -# compute in6 (7.50 * @) - 21.45 , (@ + 21.45) / 7.50 -# compute in7 (4.05 * @) - 10.07 , (@ + 10.07) / 4.05 - -chip "adm9240-*" "ds1780-*" "lm81-*" -# -# These chips have non-standard entries in lib/chips.c so -# the feature names are quite different from other chips. -# For these chips, libsensors anticipates the correct labeling. -# This is great if it's correct but makes it a little more -# difficult if you want to change it. -# -# This may not have been a good idea, so it may be changed in the future. -# Here is an entry with everything commented out so you can -# uncomment the appropriate line if you want to change it. -# -# Warning - feature names starting with a number must be enclosed -# with double quotes. -# -# label in0 "xxx" -# label in1 "xxx" -# label in2 "xxx" -# label in3 "xxx" -# label in4 "xxx" -# label in5 "xxx" -# label fan1 "xxx" -# label fan2 "xxx" -# label temp1 "xxx" -# -# set in1_min xxx -# set in0_min xxx -# set in2_min xxx -# set in3_min xxx -# set in4_min xxx -# set in5_min xxx -# -# set in1_max xxx -# set in0_max xxx -# set in2_max xxx -# set in3_max xxx -# set in4_max xxx -# set in5_max xxx -# -# set fan1_div xxx Note: do not uncomment with kernel 2.6 driver -# set fan2_div xxx Note: do not uncomment with kernel 2.6 driver -# set fan1_min xxx -# set fan2_min xxx -# set temp1_max_hyst xxx -# set temp1_max xxx - -# compute in0 xxx -# compute in1 xxx -# compute in2 xxx -# compute in3 xxx -# compute in4 xxx -# compute in5 xxx -# compute temp1 xxx - -chip "adm1024-*" -# -# These settings work for me, adjust for your system -# - label fan1 "CPU1 fan" - label fan2 "CPU2 fan" - label temp1 "SYS Temp" - label temp2 "CPU2 Temp" - label temp3 "CPU1 Temp" - ignore in0 # This register is also used for temp3 - ignore in1 - ignore in5 chip "it87-*" "it8712-*" @@ -1510,7 +1305,6 @@ chip "it87-*" "it8712-*" # Important - if your temperature readings are completely whacky # you probably need to change the sensor type. # Adujst and uncomment the appropriate lines below. -# The old method (modprobe it87 temp_type=0xXX) is no longer supported. # # 2 = thermistor; 3 = thermal diode; 0 = unused # set temp1_type 3 @@ -1548,55 +1342,6 @@ chip "it87-*" "it8712-*" # ignore fan3 # set fan3_min 3000 -# The following is for the Inside Technologies 786LCD which uses either a -# IT8705F or a SIS950 for monitoring with the SIS630. -# -# delete or comment out above it87 section and uncomment the following. -#chip "it87-*" -# label in0 "VCore 1" -# label in1 "VCore 2" -# label in2 "+3.3V" -# label in3 "+5V" -# label in4 "+12V" -# label in5 "3.3 Stdby" -# label in6 "-12V" -# label in7 "Stdby" -# label in8 "VBat" - # in0 will depend on your processor VID value, set to voltage specified in - # bios setup screen -# set in0_min 1.7 * 0.95 -# set in0_max 1.7 * 1.05 -# set in1_min 2.4 -# set in1_max 2.6 -# set in2_min 3.3 * 0.95 -# set in2_max 3.3 * 1.05 -# set in3_min 5.0 * 0.95 -# set in3_max 5.0 * 1.05 - # +- 12V are very poor tolerance on this board. Verified with voltmeter -# set in4_min 12 * 0.90 -# set in4_max 12 * 1.10 -# set in5_min 3.3 * 0.95 -# set in5_max 3.3 * 1.05 -# set in6_max -12 * 0.90 -# set in6_min -12 * 1.10 -# set in7_min 5 * 0.95 -# set in7_max 5 * 1.05 - # vid not monitored by IT8705F -# ignore cpu0_vid - -# compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1) -# compute in4 ((30/10) +1)*@ , @/((30/10) +1) -# compute in6 (1+232/56)*@ - 4.096*232/56, (@ + 4.096*232/56)/(1+232/56) -# compute in7 ((6.8/10)+1)*@ , @/((6.8/10)+1) - # Temperature -# label temp1 "CPU Temp" -# ignore temp2 -# ignore temp3 - # Fans -# set fan1_min 3000 -# ignore fan2 -# ignore fan3 - chip "it8716-*" @@ -2046,7 +1791,6 @@ chip "vt8231-*" # Thermistor calculations # 3435 is the thermistor beta, 2.2 is the reference voltage. # '^' is the e**x operator; '`' is the ln(x) operator -# (valid in library version 1.4.0 / lm_sensors 2.7.1 or higher) # This assumes that the thermistor forms a resistor divider with a resistor # equal to its nominal value at 25 degrees C. @@ -2063,24 +1807,11 @@ chip "vt8231-*" # set fan1_min 3000 # set fan2_min 3000 -chip "bmc-*" -# -# You should not need compute lines here, the driver will -# do all the conversions. -# For label lines, copy from syslog/dmesg when the bmcsensors -# module is inserted. -# -# for example: -# label temp1 "Ambient Temp" - chip "smsc47m1-*" # SMSC LPC47M10x, LPC47M13x, LPC47M14x and LPC47B27x chips -# We don't set the fan mins by default anymore because they may not exist -# when using the Linux 2.6 driver (since we respect the original chip -# configuration). # set fan1_min 3000 # set fan2_min 3000 @@ -2430,9 +2161,6 @@ chip "w83627ehf-*" "w83627dhg-*" label in7 "VSB" label in8 "VBAT" -# The W83627DHG has no in9, uncomment the following line -# ignore in9 - # +12V is in1 and +5V is in6 as recommended by datasheet compute in1 @*(1+(56/10)), @/(1+(56/10)) compute in6 @*(1+(22/10)), @/(1+(22/10)) From 8b30917c16a88582ae6b22fd2232ea3ad5f82e2b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 15:56:28 +0000 Subject: [PATCH 251/718] Don't print an error message when libsensors returns a feature we don't know. Just ignore that feature. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4774 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index bc9d512d..72a8fcbe 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -80,10 +80,9 @@ static void sensors_get_available_features(const sensors_chip_name *name, int indx; indx = iter->type - first_val - 1; - if (indx < 0 || indx >= size) { - printf("ERROR: Bug in sensors: index out of bound"); - return; - } + if (indx < 0 || indx >= size) + /* New feature in libsensors? Ignore. */ + continue; if (sensors_get_value(name, iter->number, &feature_vals[indx])) printf("ERROR: Can't get %s data!\n", iter->name); From c8de95107186c788005062ca52869a8010d124db Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 16:09:38 +0000 Subject: [PATCH 252/718] Strip trailing whitespace. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4775 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index b5d795a7..b007cd01 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -246,7 +246,7 @@ # ----- # Some chips support alarms with beep warnings. When an alarm is triggered # you can be warned by a beeping signal through your computer speaker. It -# is possible to enable beeps for all alarms on a chip using the following +# is possible to enable beeps for all alarms on a chip using the following # line: # # set beep_enable 1 @@ -781,7 +781,7 @@ chip "w83793-*" label temp1 "CPU1 Temp" label temp2 "CPU2 Temp" - + # fan1 adjustments examples # set fan1_min 1500 @@ -830,7 +830,7 @@ chip "as99127f-*" # for temp2. Quoting Artur Gawryszczak (edited to reflect subsequent fixes # to the driver): # "I guess, that the formula "(@*15/43)+25, (@-25)*43/15" is correct -# for those Asus motherboards, which get CPU temperature from internal +# for those Asus motherboards, which get CPU temperature from internal # thermal diode (Pentium Coppermine, and above), while no formula is needed # for Athlon/Duron boards, which use a thermistor in the socket." # An alternative formula was then found and reported by Victor G. Marimon. @@ -1055,7 +1055,7 @@ chip "via686a-*" # Johannes Drechsel-Burkhard notes that on his MSI K7T Pro, # temp1 is the CPU temp and temp2 is the SYS temp. Hugo van der Merwe notes # the same for his Gigabyte GA-7DXC, Olivier Martin for his Gigabyte -# GA-7ZM and Patrick Thomson for his Chaintech CT-5ATA. +# GA-7ZM and Patrick Thomson for his Chaintech CT-5ATA. # Thomas Anglmaier notes: on Epox EP-7kxa temp2 is CPU and temp1 is SYS. label temp1 "SYS Temp" @@ -1856,7 +1856,7 @@ chip "smsc47m192-*" # Haven't yet heard from any board that has 1.8V connected, so # this might be more appropriate: # ignore in7 - + label temp1 "Chip Temp" # set temp1_min 0 # set temp1_max 60 @@ -2161,7 +2161,7 @@ chip "w83627ehf-*" "w83627dhg-*" label in7 "VSB" label in8 "VBAT" -# +12V is in1 and +5V is in6 as recommended by datasheet +# +12V is in1 and +5V is in6 as recommended by datasheet compute in1 @*(1+(56/10)), @/(1+(56/10)) compute in6 @*(1+(22/10)), @/(1+(22/10)) # set in1_min 12.0*0.9 @@ -2192,7 +2192,7 @@ chip "w83627ehf-*" "w83627dhg-*" label temp1 "Sys Temp" label temp2 "CPU Temp" label temp3 "AUX Temp" - + # ignore temp3 # set temp1_max 45 # set temp1_max_hyst 40 @@ -2430,7 +2430,7 @@ chip "f71882fg-*" label in8 "Battery" # never change the in0, in7 and in8 compute, these are hardwired in the chip! - compute in0 (@ * 2), (@ / 2) + compute in0 (@ * 2), (@ / 2) compute in2 (@ * 2), (@ / 2) compute in3 (@ * 2), (@ / 2) compute in4 (@ * 5.25), (@ / 5.25) From 65b9d4dd924ddb47f04fa6aa1308989742138935 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 16:14:53 +0000 Subject: [PATCH 253/718] Move sensors_feature_get_type() from access.c to sysfs.c, it's only called from this file. This lets the compiler do additional optimizations. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4776 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 90 --------------------------------------------------- lib/access.h | 2 -- lib/sysfs.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 92 deletions(-) diff --git a/lib/access.c b/lib/access.c index 8fd926c0..0f09006e 100644 --- a/lib/access.c +++ b/lib/access.c @@ -494,93 +494,3 @@ int sensors_do_chip_sets(const sensors_chip_name *name) } return res; } - -/* Static mappings for use by sensors_feature_get_type() */ -struct feature_subtype_match -{ - const char *name; - sensors_feature_type type; -}; - -struct feature_type_match -{ - const char *name; - const struct feature_subtype_match *submatches; -}; - -static const struct feature_subtype_match temp_matches[] = { - { "input", SENSORS_FEATURE_TEMP }, - { "max", SENSORS_FEATURE_TEMP_MAX }, - { "max_hyst", SENSORS_FEATURE_TEMP_MAX_HYST }, - { "min", SENSORS_FEATURE_TEMP_MIN }, - { "crit", SENSORS_FEATURE_TEMP_CRIT }, - { "crit_hyst", SENSORS_FEATURE_TEMP_CRIT_HYST }, - { "alarm", SENSORS_FEATURE_TEMP_ALARM }, - { "min_alarm", SENSORS_FEATURE_TEMP_MIN_ALARM }, - { "max_alarm", SENSORS_FEATURE_TEMP_MAX_ALARM }, - { "crit_alarm", SENSORS_FEATURE_TEMP_CRIT_ALARM }, - { "fault", SENSORS_FEATURE_TEMP_FAULT }, - { "type", SENSORS_FEATURE_TEMP_TYPE }, - { "offset", SENSORS_FEATURE_TEMP_OFFSET }, - { NULL, 0 } -}; - -static const struct feature_subtype_match in_matches[] = { - { "input", SENSORS_FEATURE_IN }, - { "min", SENSORS_FEATURE_IN_MIN }, - { "max", SENSORS_FEATURE_IN_MAX }, - { "alarm", SENSORS_FEATURE_IN_ALARM }, - { "min_alarm", SENSORS_FEATURE_IN_MIN_ALARM }, - { "max_alarm", SENSORS_FEATURE_IN_MAX_ALARM }, - { NULL, 0 } -}; - -static const struct feature_subtype_match fan_matches[] = { - { "input", SENSORS_FEATURE_FAN }, - { "min", SENSORS_FEATURE_FAN_MIN }, - { "div", SENSORS_FEATURE_FAN_DIV }, - { "alarm", SENSORS_FEATURE_FAN_ALARM }, - { "fault", SENSORS_FEATURE_FAN_FAULT }, - { NULL, 0 } -}; - -static const struct feature_subtype_match cpu_matches[] = { - { "vid", SENSORS_FEATURE_VID }, - { NULL, 0 } -}; - -static struct feature_type_match matches[] = { - { "temp%d%c", temp_matches }, - { "in%d%c", in_matches }, - { "fan%d%c", fan_matches }, - { "cpu%d%c", cpu_matches }, -}; - -/* Return the feature type and channel number based on the feature name */ -sensors_feature_type sensors_feature_get_type(const char *name, int *nr) -{ - char c; - int i, count; - const struct feature_subtype_match *submatches; - - /* Special case */ - if (!strcmp(name, "beep_enable")) { - *nr = 0; - return SENSORS_FEATURE_BEEP_ENABLE; - } - - for (i = 0; i < ARRAY_SIZE(matches); i++) - if ((count = sscanf(name, matches[i].name, nr, &c))) - break; - - if (i == ARRAY_SIZE(matches) || count != 2 || c != '_') - return SENSORS_FEATURE_UNKNOWN; /* no match */ - - submatches = matches[i].submatches; - name = strchr(name + 3, '_') + 1; - for (i = 0; submatches[i].name != NULL; i++) - if (!strcmp(name, submatches[i].name)) - return submatches[i].type; - - return SENSORS_FEATURE_UNKNOWN; -} diff --git a/lib/access.h b/lib/access.h index 736f2c1d..e2073c4a 100644 --- a/lib/access.h +++ b/lib/access.h @@ -34,6 +34,4 @@ const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *c if there are wildcards. */ int sensors_chip_name_has_wildcards(const sensors_chip_name *chip); -sensors_feature_type sensors_feature_get_type(const char *name, int *nr); - #endif /* def LIB_SENSORS_ACCESS_H */ diff --git a/lib/sysfs.c b/lib/sysfs.c index 8147d525..5dc7f6da 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -64,6 +64,97 @@ int get_type_scaling(int type) } } +/* Static mappings for use by sensors_feature_get_type() */ +struct feature_subtype_match +{ + const char *name; + sensors_feature_type type; +}; + +struct feature_type_match +{ + const char *name; + const struct feature_subtype_match *submatches; +}; + +static const struct feature_subtype_match temp_matches[] = { + { "input", SENSORS_FEATURE_TEMP }, + { "max", SENSORS_FEATURE_TEMP_MAX }, + { "max_hyst", SENSORS_FEATURE_TEMP_MAX_HYST }, + { "min", SENSORS_FEATURE_TEMP_MIN }, + { "crit", SENSORS_FEATURE_TEMP_CRIT }, + { "crit_hyst", SENSORS_FEATURE_TEMP_CRIT_HYST }, + { "alarm", SENSORS_FEATURE_TEMP_ALARM }, + { "min_alarm", SENSORS_FEATURE_TEMP_MIN_ALARM }, + { "max_alarm", SENSORS_FEATURE_TEMP_MAX_ALARM }, + { "crit_alarm", SENSORS_FEATURE_TEMP_CRIT_ALARM }, + { "fault", SENSORS_FEATURE_TEMP_FAULT }, + { "type", SENSORS_FEATURE_TEMP_TYPE }, + { "offset", SENSORS_FEATURE_TEMP_OFFSET }, + { NULL, 0 } +}; + +static const struct feature_subtype_match in_matches[] = { + { "input", SENSORS_FEATURE_IN }, + { "min", SENSORS_FEATURE_IN_MIN }, + { "max", SENSORS_FEATURE_IN_MAX }, + { "alarm", SENSORS_FEATURE_IN_ALARM }, + { "min_alarm", SENSORS_FEATURE_IN_MIN_ALARM }, + { "max_alarm", SENSORS_FEATURE_IN_MAX_ALARM }, + { NULL, 0 } +}; + +static const struct feature_subtype_match fan_matches[] = { + { "input", SENSORS_FEATURE_FAN }, + { "min", SENSORS_FEATURE_FAN_MIN }, + { "div", SENSORS_FEATURE_FAN_DIV }, + { "alarm", SENSORS_FEATURE_FAN_ALARM }, + { "fault", SENSORS_FEATURE_FAN_FAULT }, + { NULL, 0 } +}; + +static const struct feature_subtype_match cpu_matches[] = { + { "vid", SENSORS_FEATURE_VID }, + { NULL, 0 } +}; + +static struct feature_type_match matches[] = { + { "temp%d%c", temp_matches }, + { "in%d%c", in_matches }, + { "fan%d%c", fan_matches }, + { "cpu%d%c", cpu_matches }, +}; + +/* Return the feature type and channel number based on the feature name */ +static +sensors_feature_type sensors_feature_get_type(const char *name, int *nr) +{ + char c; + int i, count; + const struct feature_subtype_match *submatches; + + /* Special case */ + if (!strcmp(name, "beep_enable")) { + *nr = 0; + return SENSORS_FEATURE_BEEP_ENABLE; + } + + for (i = 0; i < ARRAY_SIZE(matches); i++) + if ((count = sscanf(name, matches[i].name, nr, &c))) + break; + + if (i == ARRAY_SIZE(matches) || count != 2 || c != '_') + return SENSORS_FEATURE_UNKNOWN; /* no match */ + + submatches = matches[i].submatches; + name = strchr(name + 3, '_') + 1; + for (i = 0; submatches[i].name != NULL; i++) + if (!strcmp(name, submatches[i].name)) + return submatches[i].type; + + return SENSORS_FEATURE_UNKNOWN; +} + static int sensors_read_dynamic_chip(sensors_chip_features *chip, struct sysfs_device *sysdir) { From ff8230310bdacf7cf98f7ec05260ff58b421014c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 16:45:19 +0000 Subject: [PATCH 254/718] Stop mentioning the alias trick for i2c-dev, it no longer works and it doesn't have anything to do with sensors anyway. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4777 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index c0c85963..5ad9eec7 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -5449,11 +5449,7 @@ sub generate_modprobes my ($chip,$detection,$nr,$i,@optionlist,@probelist,$driver,$isa,$adap); my $ipmi = 0; my $modprobes = ""; - my $configfile = ""; - - # These are always needed - $configfile .= "# I2C module options\n"; - $configfile .= "alias char-major-89 i2c-dev\n"; + my $configfile; # Collect all adapters used $nr = 0; @@ -5564,6 +5560,7 @@ sub generate_modprobes } next if not (@probelist or @optionlist); + $configfile = "# hwmon module options\n" unless defined $configfile; $configfile .= "options $chip->{driver}"; $configfile .= sprintf " ignore=%d,0x%02x",shift @optionlist, shift @optionlist @@ -5776,11 +5773,13 @@ sub main print "\n"; my ($modprobes, $configfile) = generate_modprobes 1; # 1 == prefer ISA - print "To make the sensors modules behave correctly, add these lines to\n". - "$modules_conf:\n\n"; - print "#----cut here----\n". - $configfile. - "#----cut here----\n\n"; + if (defined $configfile) { + print "To make the sensors modules behave correctly, add these lines to\n". + "$modules_conf:\n\n"; + print "#----cut here----\n". + $configfile. + "#----cut here----\n\n"; + } print "To load everything that is needed, add this to some /etc/rc* file:\n\n"; print "#----cut here----\n". From 5dec68540fd9713d0bf0f5836c87f7d769312830 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 20:10:00 +0000 Subject: [PATCH 255/718] Warning fix. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4778 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/conf-parse.y | 3 +-- lib/init.c | 1 + lib/init.h | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 lib/init.h diff --git a/lib/conf-parse.y b/lib/conf-parse.y index a4504a37..cad8dd6b 100644 --- a/lib/conf-parse.y +++ b/lib/conf-parse.y @@ -29,6 +29,7 @@ #include "error.h" #include "conf.h" #include "access.h" +#include "init.h" /* These two functions are defined in conf-lex.l */ extern int sensors_yylex(void); @@ -37,8 +38,6 @@ extern int sensors_yylineno; static void sensors_yyerror(const char *err); static sensors_expr *malloc_expr(void); -/* free_expr is defined in init.c */ -void free_expr(sensors_expr *expr); static sensors_chip *current_chip = NULL; diff --git a/lib/init.c b/lib/init.c index a06e429f..746fb67b 100644 --- a/lib/init.c +++ b/lib/init.c @@ -26,6 +26,7 @@ #include "conf.h" #include "sysfs.h" #include "scanner.h" +#include "init.h" int sensors_init(FILE *input) { diff --git a/lib/init.h b/lib/init.h new file mode 100644 index 00000000..6b7cd786 --- /dev/null +++ b/lib/init.h @@ -0,0 +1,27 @@ +/* + data.h - Part of libsensors, a Linux library for reading sensor data. + Copyright (C) 2007 Jean Delvare + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef LIB_SENSORS_INIT_H +#define LIB_SENSORS_INIT_H + +#include "data.h" + +void free_expr(sensors_expr *expr); + +#endif /* def LIB_SENSORS_INIT_H */ From 551500530ff96faf756be67f557173b5442858e1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 20:12:52 +0000 Subject: [PATCH 256/718] Fix header comment. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4779 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/init.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/init.h b/lib/init.h index 6b7cd786..c413e392 100644 --- a/lib/init.h +++ b/lib/init.h @@ -1,5 +1,5 @@ /* - data.h - Part of libsensors, a Linux library for reading sensor data. + init.h - Part of libsensors, a Linux library for reading sensor data. Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify From 5e5a996d834ed283a41e5c2ec49ea87e14c2fd11 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 20:19:35 +0000 Subject: [PATCH 257/718] Delete redundant declarations. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4780 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/conf-parse.y | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/conf-parse.y b/lib/conf-parse.y index cad8dd6b..34f426ab 100644 --- a/lib/conf-parse.y +++ b/lib/conf-parse.y @@ -31,11 +31,6 @@ #include "access.h" #include "init.h" -/* These two functions are defined in conf-lex.l */ -extern int sensors_yylex(void); -extern char sensors_lex_error[]; -extern int sensors_yylineno; - static void sensors_yyerror(const char *err); static sensors_expr *malloc_expr(void); From 8f352d518c6bed773b6f740b9e5b038e3a360f72 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 21:19:45 +0000 Subject: [PATCH 258/718] New sensors option: --bus-list. This option lists i2c buses that are used by sensor chips on the running system, in a format suitable for sensors.conf. This is a replacement for the old, broken grab_busses.sh script. Benefits of having this directly in sensors: * It lists only the i2c buses that are relevant to sensors. * sensors is installed by default, while most people didn't have access to grab_busses.sh. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4781 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + etc/sensors.conf.eg | 4 +--- prog/sensors/main.c | 38 ++++++++++++++++++++++++++++++++++++-- prog/sensors/sensors.1 | 15 ++++++++++++--- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 6b25ae3f..cff06701 100644 --- a/CHANGES +++ b/CHANGES @@ -55,6 +55,7 @@ SVN HEAD Fix alignment of alarm for one-limit temperatures Drop option -U Fix a memory leak on error (with -u) + New option --bus-list Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection Add /usr/sbin to the PATH (#2199) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index b007cd01..ffc21c10 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -237,9 +237,7 @@ # # chip "lm75-i2c-0-*" # -# You should really use the output of /proc/bus/chips to generate bus lines, -# because one mistyped characted will inhibit the match. Wildcards are not -# yet supported; spaces at the end are ignored, though. +# You can use "sensors --bus-list" to generate bus lines for your system. # # # BEEPS diff --git a/prog/sensors/main.c b/prog/sensors/main.c index f441981a..22f3efb1 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -59,6 +59,7 @@ static void print_long_help(void) " -s, --set Execute `set' statements (root only)\n" " -f, --fahrenheit Show temperatures in degrees fahrenheit\n" " -A, --no-adapter Do not show adapter for each chip\n" + " --bus-list Generate bus statements for sensors.conf\n" " -u Raw output (debugging only)\n" " -v, --version Display the program version\n" "\n" @@ -207,9 +208,35 @@ static int do_the_real_work(const sensors_chip_name *match, int *error) return cnt; } +/* List the buses in a format suitable for sensors.conf. We only list + bus types for which bus statements are actually useful and supported. + Known bug: i2c buses with number >= 32 or 64 could be listed several + times. Very unlikely to ever happen, though. */ +static void print_bus_list(void) +{ + const sensors_chip_name *chip; + int chip_nr; + unsigned long seen_i2c = 0; + + chip_nr = 0; + while ((chip = sensors_get_detected_chips(NULL, &chip_nr))) { + switch (chip->bus.type) { + case SENSORS_BUS_TYPE_I2C: + if (chip->bus.nr < (int)sizeof(unsigned long) * 8) { + if (seen_i2c & (1 << chip->bus.nr)) + break; + seen_i2c |= 1 << chip->bus.nr; + } + printf("bus \"i2c-%d\" \"%s\"\n", chip->bus.nr, + sensors_get_adapter_name(&chip->bus)); + break; + } + } +} + int main(int argc, char *argv[]) { - int c, res, i, error; + int c, res, i, error, do_bus_list; const char *config_file_name = DEFAULT_CONFIG_FILE; struct option long_opts[] = { @@ -219,6 +246,7 @@ int main(int argc, char *argv[]) { "fahrenheit", no_argument, NULL, 'f' }, { "no-adapter", no_argument, NULL, 'A' }, { "config-file", required_argument, NULL, 'c' }, + { "bus-list", no_argument, NULL, 'B' }, { 0, 0, 0, 0 } }; @@ -226,6 +254,7 @@ int main(int argc, char *argv[]) do_raw = 0; do_sets = 0; + do_bus_list = 0; hide_adapter = 0; while (1) { c = getopt_long(argc, argv, "hsvfAc:u", long_opts, NULL); @@ -257,6 +286,9 @@ int main(int argc, char *argv[]) case 'u': do_raw = 1; break; + case 'B': + do_bus_list = 1; + break; default: fprintf(stderr, "Internal error while parsing options!\n"); @@ -271,7 +303,9 @@ int main(int argc, char *argv[]) /* build the degrees string */ set_degstr(); - if (optind == argc) { /* No chip name on command line */ + if (do_bus_list) { + print_bus_list(); + } else if (optind == argc) { /* No chip name on command line */ if (!do_the_real_work(NULL, &error)) { fprintf(stderr, "No sensors found!\n" diff --git a/prog/sensors/sensors.1 b/prog/sensors/sensors.1 index a4d2b558..0a5525a3 100644 --- a/prog/sensors/sensors.1 +++ b/prog/sensors/sensors.1 @@ -22,7 +22,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH sensors 1 "August 2007" "lm-sensors 3" "Linux User's Manual" +.TH sensors 1 "September 2007" "lm-sensors 3" "Linux User's Manual" .SH NAME sensors \- print sensors information .SH SYNOPSIS @@ -33,10 +33,10 @@ sensors \- print sensors information .B ] .br .B sensors -s [ -.I options -.B ] [ .I chips .B ] +.br +.B sensors --bus-list .SH DESCRIPTION .B sensors @@ -44,6 +44,9 @@ is used to show the current readings of all sensor chips. .br .B sensors -s is used to set all limits as specified in the configuration file. +.br +.B sensors --bus-list +is used to generate bus statements suitable for the configuration file. .SH OPTIONS .IP "-c config-file" @@ -64,6 +67,12 @@ Raw output. This mode is only meant for debugging. Print the program version and exit. .IP -f Print the temperatures in degrees Fahrenheit instead of Celsius. +.IP --bus-list +Generate bus statements suitable for using in sensors.conf. Such bus statements +are only needed if you have several chips sharing the same address on different +buses of the same type. As bus numbers are usually not guaranteed to be stable +over reboots, these statements let you refer to each bus by its name rather +than numbers. .SH FILES .I /etc/sensors.conf .RS From 042532f7fbfde26b8480f45dfa397d0ebc7f83fb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 21:22:39 +0000 Subject: [PATCH 259/718] Delete grab_busses.sh, it's deprecated. Use sensors --bus-list instead. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4782 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + doc/progs | 6 ------ lib/sensors.conf.5 | 14 +++++--------- prog/config/grab_busses.sh | 29 ----------------------------- 4 files changed, 6 insertions(+), 44 deletions(-) delete mode 100755 prog/config/grab_busses.sh diff --git a/CHANGES b/CHANGES index cff06701..c686ae25 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,7 @@ SVN HEAD Makefile: Drop the package and version targets Man pages: Drop "conforming to" sections Man page sensors.conf.5: Update the chip statement section + Program config/grab_busses.sh: Delete, obsolete Programs doc/*: Delete, obsolete Program etc/sensors-conf-convert: New Programs i2cdump, i2cget, i2cset: Do not force the slave address by default diff --git a/doc/progs b/doc/progs index 2dbb87ae..1fc18e33 100644 --- a/doc/progs +++ b/doc/progs @@ -9,12 +9,6 @@ For more elaborate programs (for example, GUI sensor displays), see useful_addresses.html. -* prog/config/grab_busses.sh (written in bash and awk, not installed) - This program helps you generate the `bus' statements for your configuration - file. It read /proc/bus/i2c (or the file specified on the command-line), - and prints to stdout `bus' statements reflecting the currently detected - adapters. - * prog/daemon/healthd.sh (written in bash, not installed) An example of a very simple hardware health monitoring daemon. diff --git a/lib/sensors.conf.5 b/lib/sensors.conf.5 index 8bd5b737..44c2b564 100644 --- a/lib/sensors.conf.5 +++ b/lib/sensors.conf.5 @@ -23,7 +23,7 @@ .\" .\" References consulted: .\" sensors.conf.eg by Frodo Looijaard -.TH sensors.conf 5 "June 2007" "lm-sensors 3" "Linux Programmer's Manual" +.TH sensors.conf 5 "September 2007" "lm-sensors 3" "Linux User's Manual" .SH NAME sensors.conf \- libsensors configuration file @@ -141,11 +141,7 @@ always be quoted. The second argument is the adapter name, it must match exactly the adapter name as it appears in -.I /proc/bus/i2c -(2.4 kernel) -or -.I /sys/class/i2c-adapter/i2c-*/device/name -(2.6 kernel). +.IR /sys/class/i2c-adapter/i2c-*/name . It should always be quoted as well as it will most certainly contain spaces or dashes. @@ -158,9 +154,9 @@ all .I bus statements together at the top of your configuration file. -The program -.I prog/config/grab_busses.sh -in the source distribution can help you generate these lines. +Running +.B sensors --bus-list +will generate these lines for you. .SS CHIP STATEMENT diff --git a/prog/config/grab_busses.sh b/prog/config/grab_busses.sh deleted file mode 100755 index 3d2bc769..00000000 --- a/prog/config/grab_busses.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# This simple shell script grabs the contents of /proc/bus/i2c and outputs it -# in sensors.conf format through stdout. You can use it to generate those -# nasty 'bus' statements in config files. - -if [ $# = 0 ] ; then - file=/proc/bus/i2c -elif [ $# = 1 ] ; then - file="$1" -else - echo "Syntax: grab_busses [file]" >&2 - exit 1 -fi - -if [ ! -e "$file" ]; then - echo "Can't find file \`$file';"\ - "try \`modprobe i2c-proc' for /proc/bus/i2c" >&2 - exit 1 -fi - -cat -- "$file" | awk \ - ' BEGIN { FS = "\t" } - { sub(" *$","",$3) - sub(" *$","",$4) - printf "bus \"%s\" \"%s\" \"%s\"\n",$1,$3,$4 } - { nrlines++ } - END { printf "Total lines: %d\n",nrlines > "/dev/stderr" } - ' From 44c669a26df285c5024d9db1f03384f839b2abcb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 5 Sep 2007 21:31:01 +0000 Subject: [PATCH 260/718] Don't use -Wundef for the library, flex/bison-generated code doesn't play well with it. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4783 7894878c-1315-0410-8ee3-d5d059ff63e0 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7f02c412..c985497e 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ endif ifeq ($(WARN),1) ALL_CFLAGS += -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W \ - -Wmissing-prototypes -Wundef + -Wmissing-prototypes endif ALL_CPPFLAGS += $(CPPFLAGS) From 3ff2df927bc47945e046836e8efa5217612eeeaf Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 8 Sep 2007 10:47:03 +0000 Subject: [PATCH 261/718] Fix sensors output when a temperature channel has a critical limit but no max limit (for example the coretemp driver.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4791 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 72a8fcbe..54e08a08 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -198,6 +198,22 @@ static void print_chip_temp(const sensors_chip_name *name, s2 = NULL; } } + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { + limit1 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + s1 = "crit"; + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) { + limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST); + s2 = "hyst"; + } else { + limit2 = 0; + s2 = NULL; + } + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) + alarm |= 1; + crit_displayed = 1; } else { limit1 = limit2 = 0; s1 = s2 = NULL; From ab0e8eb73104e10791f24a09b54e1b5d936a7705 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 9 Sep 2007 17:32:59 +0000 Subject: [PATCH 262/718] Complete the previous memory leak fix. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4793 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/conf-parse.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/conf-parse.y b/lib/conf-parse.y index 34f426ab..e22c993b 100644 --- a/lib/conf-parse.y +++ b/lib/conf-parse.y @@ -157,7 +157,7 @@ set_statement: SET function_name expression if (!current_chip) { sensors_yyerror("Set statement before first chip statement"); free($2); - free($3); + free_expr($3); YYERROR; } new_el.lineno = $1; From e95e7694f52d271bdfa387d468c6af808a811eb6 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sun, 16 Sep 2007 14:50:37 +0000 Subject: [PATCH 263/718] Fix -W options so flex/yacc code compiles completely without warnings. Also, Use -Wundef everywhere except flex/yacc code, specifically. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4794 7894878c-1315-0410-8ee3-d5d059ff63e0 --- Makefile | 4 ++-- lib/Module.mk | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c985497e..36229b94 100644 --- a/Makefile +++ b/Makefile @@ -141,13 +141,13 @@ endif ifeq ($(WARN),1) ALL_CFLAGS += -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ -Wcast-align -Wwrite-strings -Wnested-externs -Winline -W \ - -Wmissing-prototypes + -Wmissing-prototypes -Wundef endif ALL_CPPFLAGS += $(CPPFLAGS) ALL_CFLAGS += $(CFLAGS) -PROGCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS) -Wundef +PROGCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS) PROGCFLAGS := $(ALL_CFLAGS) ARCPPFLAGS := $(ALL_CPPFLAGS) ARCFLAGS := $(ALL_CFLAGS) diff --git a/lib/Module.mk b/lib/Module.mk index abfd3d69..9cfdadf3 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -85,10 +85,18 @@ $(MODULE_DIR)/conf-parse.h: $(MODULE_DIR)/conf-parse.c INCLUDEFILES += $(LIBCSOURCES:.c=.ld) $(LIBCSOURCES:.c=.ad) # Special warning prevention for flex-generated files +FLEXNOWARN:=-Wno-shadow -Wno-undef -Wno-unused -Wno-missing-prototypes $(MODULE_DIR)/conf-lex.ao: $(MODULE_DIR)/conf-lex.c - $(CC) $(ARCPPFLAGS) $(ARCFLAGS) -Wno-unused -Wno-missing-prototypes -c $< -o $@ + $(CC) $(ARCPPFLAGS) $(ARCFLAGS) $(FLEXNOWARN) -c $< -o $@ $(MODULE_DIR)/conf-lex.lo: $(MODULE_DIR)/conf-lex.c - $(CC) $(LIBCPPFLAGS) $(LIBCFLAGS) -Wno-unused -Wno-missing-prototypes -c $< -o $@ + $(CC) $(LIBCPPFLAGS) $(LIBCFLAGS) $(FLEXNOWARN) -c $< -o $@ + +# Special warning prevention for bison-generated files +YACCNOWARN:=-Wno-undef +$(MODULE_DIR)/conf-parse.ao: $(MODULE_DIR)/conf-parse.c + $(CC) $(ARCPPFLAGS) $(ARCFLAGS) $(YACCNOWARN) -c $< -o $@ +$(MODULE_DIR)/conf-parse.lo: $(MODULE_DIR)/conf-parse.c + $(CC) $(LIBCPPFLAGS) $(LIBCFLAGS) $(YACCNOWARN) -c $< -o $@ REMOVELIBST := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(LIBDIR)/%,$(LIB_DIR)/$(LIBSTLIBNAME)) REMOVELIBSH := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(LIBDIR)/%,$(LIB_DIR)/$(LIBSHLIBNAME)) From db283337afc2a1871e6486da5b365fc615e36fd6 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sun, 16 Sep 2007 14:59:14 +0000 Subject: [PATCH 264/718] Add the following to svn:ignore properties: ./patches ./.pc ./prog/sensors/sensors3 git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4795 7894878c-1315-0410-8ee3-d5d059ff63e0 From 91866b3ea1fef92db7f360170968ebc8bb1e4b2c Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sun, 16 Sep 2007 15:34:52 +0000 Subject: [PATCH 265/718] Make sensors.conf entirely case-sensitive. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4796 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/access.c b/lib/access.c index 0f09006e..f8340f34 100644 --- a/lib/access.c +++ b/lib/access.c @@ -39,7 +39,7 @@ static int sensors_match_chip(const sensors_chip_name *chip1, { if ((chip1->prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && (chip2->prefix != SENSORS_CHIP_NAME_PREFIX_ANY) && - strcasecmp(chip1->prefix, chip2->prefix)) + strcmp(chip1->prefix, chip2->prefix)) return 0; if ((chip1->bus.type != SENSORS_BUS_TYPE_ANY) && @@ -117,7 +117,7 @@ sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { features = sensors_proc_chips[i].feature; for (j = 0; j < sensors_proc_chips[i].feature_count; j++) - if (!strcasecmp(features[j].data.name, feature)) + if (!strcmp(features[j].data.name, feature)) return features + j; } return NULL; @@ -157,7 +157,7 @@ char *sensors_get_label(const sensors_chip_name *name, int feature) for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->labels_count; i++) - if (!strcasecmp(featureptr->data.name, chip->labels[i].name)) { + if (!strcmp(featureptr->data.name, chip->labels[i].name)) { label = strdup(chip->labels[i].value); goto sensors_get_label_exit; } @@ -205,9 +205,9 @@ static int sensors_get_ignored(const sensors_chip_name *name, for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->ignores_count; i++) - if (!strcasecmp(feature->data.name, chip->ignores[i].name) || + if (!strcmp(feature->data.name, chip->ignores[i].name) || (main_feature_name && - !strcasecmp(main_feature_name, chip->ignores[i].name))) + !strcmp(main_feature_name, chip->ignores[i].name))) return 1; return 0; } @@ -242,10 +242,10 @@ int sensors_get_value(const sensors_chip_name *name, int feature, for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) { - if (!strcasecmp(main_feature->data.name, chip->computes[i].name)) { + if (!strcmp(main_feature->data.name, chip->computes[i].name)) { expr = chip->computes[i].from_proc; final_expr = 1; - } else if (alt_feature && !strcasecmp(alt_feature->data.name, + } else if (alt_feature && !strcmp(alt_feature->data.name, chip->computes[i].name)) { expr = chip->computes[i].from_proc; } @@ -289,10 +289,10 @@ int sensors_set_value(const sensors_chip_name *name, int feature, for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) - if (!strcasecmp(main_feature->data.name, chip->computes[i].name)) { + if (!strcmp(main_feature->data.name, chip->computes[i].name)) { expr = chip->computes->to_proc; final_expr = 1; - } else if (alt_feature && !strcasecmp(alt_feature->data.name, + } else if (alt_feature && !strcmp(alt_feature->data.name, chip->computes[i].name)) { expr = chip->computes[i].to_proc; } From fb362daf8d0e3667fe2fa0c91fef7e64c15a19ce Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sun, 16 Sep 2007 15:47:16 +0000 Subject: [PATCH 266/718] The sensors.conf file syntax currently allows for octal escape sequences, which nobody uses. This feature is not even mentioned in the sensors.conf man page. Kill it. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4797 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/conf-lex.l | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/lib/conf-lex.l b/lib/conf-lex.l index 9912c026..75832486 100644 --- a/lib/conf-lex.l +++ b/lib/conf-lex.l @@ -74,10 +74,6 @@ FLOAT [[:digit:]]*\.?[[:digit:]]+ NUM 0|([1-9][[:digit:]]*) - /* Only number between 1 and 255, octally represented. */ - -OCTESC (1[0-7]{0,2})|([2-7][0-7]?)|(0[1-7][0-7]?)|(00[1-7]) - %% @@ -311,26 +307,12 @@ ignore{BLANK}* { \\t buffer_add_char("\t"); \\v buffer_add_char("\v"); - /* We can't support \0, this would cause havoc! */ - -\\{OCTESC} { - int res; - sscanf(sensors_yytext+1,"%o",&res); - buffer_add_char(&res); - } - /* Other escapes: just copy the character behind the slash */ \\. { buffer_add_char(&sensors_yytext[1]); } - /* This prevents backing up; it is otherwise purely redundant */ - -\\00 { - buffer_add_char("00"); - } - /* Anything else (including a bare '\' which may be followed by EOF) */ \\ | From 0464f510627d50287c1e1bcc1ef6369f3825dbe2 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 18 Sep 2007 09:38:14 +0000 Subject: [PATCH 267/718] Fix fan fault handling. We were testing for fan fault before actually retrieving the fan features, so faults could not be detected. Swapping the instructions fixes it. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4801 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 54e08a08..ab021b0c 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -362,15 +362,15 @@ static void print_chip_fan(const sensors_chip_name *name, print_label(label, label_size); free(label); + sensors_get_available_features(name, feature, i, has_features, + feature_vals, size, SENSORS_FEATURE_FAN); + if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) printf(" FAULT"); else printf("%4.0f RPM", val); - sensors_get_available_features(name, feature, i, has_features, - feature_vals, size, SENSORS_FEATURE_FAN); - if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN) && FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) printf(" (min = %4.0f RPM, div = %1.0f)", From fee42795a22687cc8f7da1fecd26d7569e48e3ba Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 18 Sep 2007 19:35:28 +0000 Subject: [PATCH 268/718] Synchronize the sensord version with the lm-sensors version. We're using the same version number for sensord since October 2002! git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4802 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensord/args.c | 3 ++- prog/sensord/sensord.h | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index c686ae25..5e1c88a0 100644 --- a/CHANGES +++ b/CHANGES @@ -52,6 +52,7 @@ SVN HEAD Look for rrd in /usr/bin by default Add missing shell declarations Update URI + Program sensord: Syncronize the version with lm-sensors Program sensors: Drop all the chip-specific support Fix alignment of alarm for one-limit temperatures Drop option -U diff --git a/prog/sensord/args.c b/prog/sensord/args.c index 9113f122..1a7e4b7f 100644 --- a/prog/sensord/args.c +++ b/prog/sensord/args.c @@ -28,6 +28,7 @@ #include "sensord.h" #include "lib/error.h" +#include "version.h" #define MAX_CHIP_NAMES 32 @@ -231,7 +232,7 @@ parseArgs return -1; break; case 'v': - printf ("sensord version %s\n", version); + printf ("sensord version %s\n", LM_VERSION); exit (EXIT_SUCCESS); break; case 'h': diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index 769e30e2..47e34541 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -20,8 +20,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define version "0.6.3" - #include "lib/sensors.h" extern void sensorLog (int priority, const char *fmt, ...); From 8c817feaca6af451676cd9afa6f71b9c7762c40e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 18 Sep 2007 20:19:26 +0000 Subject: [PATCH 269/718] Stop including obsolete header files. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4803 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index f3f09e65..605f5c92 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -25,8 +25,6 @@ #include #include "sensord.h" -#include "lib/chips.h" -#include "kernel/include/sensors.h" /* TODO: Temp in C/F */ From bf9d0e2de6745cfdd11ae0140150394830a2007d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 18 Sep 2007 20:26:28 +0000 Subject: [PATCH 270/718] Drop DataType_mhz, libsensors doesn't support this kind of feature. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4804 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 2 -- prog/sensord/rrd.c | 4 ---- prog/sensord/sensord.h | 1 - 3 files changed, 7 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 605f5c92..807a3b69 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -946,8 +946,6 @@ static const FeatureDescriptor maxilife_features[] = { { SENSORS_MAXI_CG_FAN2, SENSORS_MAXI_CG_FAN2_MIN, SENSORS_MAXI_CG_FAN2_DIV, -1 } }, { fmtFans_Maxilife, rrdFans_Maxilife, DataType_rpm, MAXI_ALARM_FAN3, 0, { SENSORS_MAXI_CG_FAN3, SENSORS_MAXI_CG_FAN3_MIN, SENSORS_MAXI_CG_FAN3_DIV, -1 } }, - { fmtMHz_Maxilife, rrdMHz_Maxilife, DataType_mhz, MAXI_ALARM_PLL, 0, - { SENSORS_MAXI_CG_PLL, SENSORS_MAXI_CG_PLL_MIN, SENSORS_MAXI_CG_PLL_MAX, -1 } }, { fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID1, 0, { SENSORS_MAXI_CG_VID1, SENSORS_MAXI_CG_VID1_MIN, SENSORS_MAXI_CG_VID1_MAX, -1 } }, { fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID2, 0, diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index 60f6152c..e01da52c 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -203,10 +203,6 @@ rrdGetSensors_DS min = "0"; max = "250"; break; - case DataType_mhz: - min = "0"; - max = "U"; - break; default: min = max = "U"; break; diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index 47e34541..8bcb57f4 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -82,7 +82,6 @@ typedef enum { DataType_voltage = 0, DataType_rpm, DataType_temperature, - DataType_mhz, DataType_other = -1 } DataType; From 7d049ef6008bee680058d17521fb9662d811d94f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 18 Sep 2007 20:37:36 +0000 Subject: [PATCH 271/718] Drop all the chip-specific support from sensord. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4805 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensord/chips.c | 1132 ------------------------------------------ 2 files changed, 1 insertion(+), 1132 deletions(-) diff --git a/CHANGES b/CHANGES index 5e1c88a0..6424d830 100644 --- a/CHANGES +++ b/CHANGES @@ -53,6 +53,7 @@ SVN HEAD Add missing shell declarations Update URI Program sensord: Syncronize the version with lm-sensors + Drop all the chip-specific support Program sensors: Drop all the chip-specific support Fix alignment of alarm for one-limit temperatures Drop option -U diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 807a3b69..0f966be8 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -175,1140 +175,8 @@ rrdF3 return buff; } -/** DS1621 */ - -static const char * -fmtTemps_DS1621 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.2f C (min = %.1f C, max = %.1f C)", values[0], values[1], values[2]); - if (alarm) - sprintf (buff + strlen (buff), " [ALARM(%s)]", (alarm == DS1621_ALARM_TEMP_LOW) ? "LOW" : (alarm == DS1621_ALARM_TEMP_HIGH) ? "HIGH" : "LOW,HIGH"); - return buff; -} - -static const char *ds1621_names[] = { - SENSORS_DS1621_PREFIX, NULL -}; - -static const FeatureDescriptor ds1621_features[] = { - { fmtTemps_DS1621, rrdF2, DataType_temperature, DS1621_ALARM_TEMP_LOW | DS1621_ALARM_TEMP_HIGH, 0, - { SENSORS_DS1621_TEMP, SENSORS_DS1621_TEMP_HYST, SENSORS_DS1621_TEMP_OVER, -1 } }, /* hyst=min, over=max */ - { NULL } -}; - -static const ChipDescriptor ds1621_chip = { - ds1621_names, ds1621_features, SENSORS_DS1621_ALARMS, 0 -}; - -/** LM75 **/ - -static const char *lm75_names[] = { - SENSORS_LM75_PREFIX, NULL -}; - -static const FeatureDescriptor lm75_features[] = { - { fmtTemps_1, rrdF1, DataType_temperature, 0, 0, - { SENSORS_LM75_TEMP, SENSORS_LM75_TEMP_OVER, SENSORS_LM75_TEMP_HYST, -1 } }, - { NULL } -}; - -static const ChipDescriptor lm75_chip = { - lm75_names, lm75_features, 0, 0 -}; - -/** ADM1021 **/ - -static const char * -fmtTemps_ADM1021_0 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.0f C (min = %.0f C, max = %.0f C)", values[0], values[1], values[2]); - if (alarm) { - int low = alarm & ADM1021_ALARM_TEMP_LOW, high = alarm & ADM1021_ALARM_TEMP_HIGH; - sprintf (buff + strlen (buff), " [ALARM(%s%s%s)]", low ? "LOW" : "", (low && high) ? "," : "", high ? "HIGH" : ""); - } - return buff; -} - -static const char * -fmtTemps_ADM1021_1 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.0f C (min = %.0f C, max = %.0f C)", values[0], values[1], values[2]); - if (alarm) { - int na = alarm & ADM1021_ALARM_RTEMP_NA, low = alarm & ADM1021_ALARM_RTEMP_LOW, - high = alarm & ADM1021_ALARM_RTEMP_HIGH; - sprintf (buff + strlen (buff), " [ALARM(%s%s%s%s%s)]", na ? "N/A" : "", (na && (low || high)) ? "," : "", low ? "LOW" : "", (low && high) ? "," : "", high ? "HIGH" : ""); - } - return buff; -} - -static const char *adm1021_names[] = { - SENSORS_ADM1021_PREFIX, SENSORS_ADM1023_PREFIX, NULL -}; /* N.B: Assume bs sensors 1023 is =~ 1021 */ - -static const FeatureDescriptor adm1021_features[] = { - { fmtTemps_ADM1021_0, rrdF0, DataType_temperature, ADM1021_ALARM_TEMP_HIGH | ADM1021_ALARM_TEMP_LOW, 0, - { SENSORS_ADM1021_TEMP, SENSORS_ADM1021_TEMP_HYST, SENSORS_ADM1021_TEMP_OVER, -1 } }, /* hyst=min, over=max */ - { fmtTemps_ADM1021_1, rrdF0, DataType_temperature, ADM1021_ALARM_RTEMP_HIGH | ADM1021_ALARM_RTEMP_LOW | ADM1021_ALARM_RTEMP_NA, 0, - { SENSORS_ADM1021_REMOTE_TEMP, SENSORS_ADM1021_REMOTE_TEMP_HYST, SENSORS_ADM1021_REMOTE_TEMP_OVER, -1 } }, /* hyst=min, over=max */ - { fmtValu_0, NULL, DataType_other, 0, 0, - { SENSORS_ADM1021_DIE_CODE, -1 } }, - { NULL } -}; - -static const ChipDescriptor adm1021_chip = { - adm1021_names, adm1021_features, SENSORS_ADM1021_ALARMS, 0 -}; - -/** MAX1617 **/ - -static const char *max1617_names[] = { - SENSORS_MAX1617_PREFIX, SENSORS_MAX1617A_PREFIX, SENSORS_THMC10_PREFIX, SENSORS_LM84_PREFIX, SENSORS_GL523_PREFIX, NULL -}; /* N.B: Assume vs sensors these have no die code */ - -static const FeatureDescriptor max1617_features[] = { - { fmtTemps_ADM1021_0, rrdF0, DataType_temperature, ADM1021_ALARM_TEMP_HIGH | ADM1021_ALARM_TEMP_LOW, 0, - { SENSORS_MAX1617_TEMP, SENSORS_MAX1617_TEMP_HYST, SENSORS_MAX1617_TEMP_OVER, -1 } }, /* hyst=min, over=max */ - { fmtTemps_ADM1021_1, rrdF0, DataType_temperature, ADM1021_ALARM_RTEMP_HIGH | ADM1021_ALARM_RTEMP_LOW | ADM1021_ALARM_RTEMP_NA, 0, - { SENSORS_MAX1617_REMOTE_TEMP, SENSORS_MAX1617_REMOTE_TEMP_HYST, SENSORS_MAX1617_REMOTE_TEMP_OVER, -1 } }, /* hyst=min, over=max */ - { NULL } -}; - -static const ChipDescriptor max1617_chip = { - max1617_names, max1617_features, SENSORS_MAX1617_ALARMS, 0 -}; - -/** ADM9240 **/ - -static const char *adm9240_names[] = { - SENSORS_ADM9240_PREFIX, SENSORS_DS1780_PREFIX, SENSORS_LM81_PREFIX, NULL -}; - -static const FeatureDescriptor adm9240_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN0, 0, - { SENSORS_ADM9240_IN0, SENSORS_ADM9240_IN0_MIN, SENSORS_ADM9240_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN1, 0, - { SENSORS_ADM9240_IN1, SENSORS_ADM9240_IN1_MIN, SENSORS_ADM9240_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN2, 0, - { SENSORS_ADM9240_IN2, SENSORS_ADM9240_IN2_MIN, SENSORS_ADM9240_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN3, 0, - { SENSORS_ADM9240_IN3, SENSORS_ADM9240_IN3_MIN, SENSORS_ADM9240_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN4, 0, - { SENSORS_ADM9240_IN4, SENSORS_ADM9240_IN4_MIN, SENSORS_ADM9240_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM9240_ALARM_IN5, 0, - { SENSORS_ADM9240_IN5, SENSORS_ADM9240_IN5_MIN, SENSORS_ADM9240_IN5_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, ADM9240_ALARM_FAN1, 0, - { SENSORS_ADM9240_FAN1, SENSORS_ADM9240_FAN1_MIN, SENSORS_ADM9240_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, ADM9240_ALARM_FAN2, 0, - { SENSORS_ADM9240_FAN2, SENSORS_ADM9240_FAN2_MIN, SENSORS_ADM9240_FAN2_DIV, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, ADM9240_ALARM_TEMP, 0, - { SENSORS_ADM9240_TEMP, SENSORS_ADM9240_TEMP_OVER, SENSORS_ADM9240_TEMP_HYST, -1 } }, - { fmtVolt_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_ADM9240_VID, -1 } }, - { fmtChassisIntrusionDetection, NULL, DataType_other, ADM9240_ALARM_CHAS, 0, - { SENSORS_ADM9240_ALARMS, -1 } }, - { NULL } -}; - -static const ChipDescriptor adm9240_chip = { - adm9240_names, adm9240_features, SENSORS_ADM9240_ALARMS, 0 -}; - -/** SIS5595 **/ - -static const char *sis5595_names[] = { - SENSORS_SIS5595_PREFIX, NULL -}; - -static const FeatureDescriptor sis5595_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, SIS5595_ALARM_IN0, 0, - { SENSORS_SIS5595_IN0, SENSORS_SIS5595_IN0_MIN, SENSORS_SIS5595_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, SIS5595_ALARM_IN1, 0, - { SENSORS_SIS5595_IN1, SENSORS_SIS5595_IN1_MIN, SENSORS_SIS5595_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, SIS5595_ALARM_IN2, 0, - { SENSORS_SIS5595_IN2, SENSORS_SIS5595_IN2_MIN, SENSORS_SIS5595_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, SIS5595_ALARM_IN3, 0, - { SENSORS_SIS5595_IN3, SENSORS_SIS5595_IN3_MIN, SENSORS_SIS5595_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, SIS5595_ALARM_IN4, 0, - { SENSORS_SIS5595_IN4, SENSORS_SIS5595_IN4_MIN, SENSORS_SIS5595_IN4_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, SIS5595_ALARM_FAN1, 0, - { SENSORS_SIS5595_FAN1, SENSORS_SIS5595_FAN1_MIN, SENSORS_SIS5595_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, SIS5595_ALARM_FAN2, 0, - { SENSORS_SIS5595_FAN2, SENSORS_SIS5595_FAN2_MIN, SENSORS_SIS5595_FAN2_DIV, -1 } }, - { fmtTemps_0, rrdF0, DataType_temperature, SIS5595_ALARM_TEMP, 0, - { SENSORS_SIS5595_TEMP, SENSORS_SIS5595_TEMP_OVER, SENSORS_SIS5595_TEMP_HYST, -1 } }, - { fmtBoardTemperatureInput, NULL, DataType_other, SIS5595_ALARM_BTI, 0, - { SENSORS_SIS5595_ALARMS, -1 } }, - { NULL } -}; - -static const ChipDescriptor sis5595_chip = { - sis5595_names, sis5595_features, SENSORS_SIS5595_ALARMS, 0 -}; - -/** VIA686A **/ - -static const char *via686a_names[] = { - SENSORS_VIA686A_PREFIX, NULL -}; - -static const FeatureDescriptor via686a_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN0, 0, - { SENSORS_VIA686A_IN0, SENSORS_VIA686A_IN0_MIN, SENSORS_VIA686A_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN1, 0, - { SENSORS_VIA686A_IN1, SENSORS_VIA686A_IN1_MIN, SENSORS_VIA686A_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN2, 0, - { SENSORS_VIA686A_IN2, SENSORS_VIA686A_IN2_MIN, SENSORS_VIA686A_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN3, 0, - { SENSORS_VIA686A_IN3, SENSORS_VIA686A_IN3_MIN, SENSORS_VIA686A_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, VIA686A_ALARM_IN4, 0, - { SENSORS_VIA686A_IN4, SENSORS_VIA686A_IN4_MIN, SENSORS_VIA686A_IN4_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, VIA686A_ALARM_FAN1, 0, - { SENSORS_VIA686A_FAN1, SENSORS_VIA686A_FAN1_MIN, SENSORS_VIA686A_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, VIA686A_ALARM_FAN2, 0, - { SENSORS_VIA686A_FAN2, SENSORS_VIA686A_FAN2_MIN, SENSORS_VIA686A_FAN2_DIV, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VIA686A_ALARM_TEMP, 0, - { SENSORS_VIA686A_TEMP, SENSORS_VIA686A_TEMP_OVER, SENSORS_VIA686A_TEMP_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VIA686A_ALARM_TEMP2, 0, - { SENSORS_VIA686A_TEMP2, SENSORS_VIA686A_TEMP2_OVER, SENSORS_VIA686A_TEMP2_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VIA686A_ALARM_TEMP3, 0, - { SENSORS_VIA686A_TEMP3, SENSORS_VIA686A_TEMP3_OVER, SENSORS_VIA686A_TEMP3_HYST, -1 } }, - { NULL } -}; - -static const ChipDescriptor via686a_chip = { - via686a_names, via686a_features, SENSORS_VIA686A_ALARMS, 0 -}; - -/** LM78 **/ - -static const char *lm78_names[] = { - SENSORS_LM78_PREFIX, SENSORS_LM78J_PREFIX, SENSORS_LM79_PREFIX, NULL -}; - -static const FeatureDescriptor lm78_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN0, 0, - { SENSORS_LM78_IN0, SENSORS_LM78_IN0_MIN, SENSORS_LM78_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN1, 0, - { SENSORS_LM78_IN1, SENSORS_LM78_IN1_MIN, SENSORS_LM78_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN2, 0, - { SENSORS_LM78_IN2, SENSORS_LM78_IN2_MIN, SENSORS_LM78_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN3, 0, - { SENSORS_LM78_IN3, SENSORS_LM78_IN3_MIN, SENSORS_LM78_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN4, 0, - { SENSORS_LM78_IN4, SENSORS_LM78_IN4_MIN, SENSORS_LM78_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN5, 0, - { SENSORS_LM78_IN5, SENSORS_LM78_IN5_MIN, SENSORS_LM78_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM78_ALARM_IN6, 0, - { SENSORS_LM78_IN6, SENSORS_LM78_IN6_MIN, SENSORS_LM78_IN6_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, LM78_ALARM_FAN1, 0, - { SENSORS_LM78_FAN1, SENSORS_LM78_FAN1_MIN, SENSORS_LM78_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, LM78_ALARM_FAN2, 0, - { SENSORS_LM78_FAN2, SENSORS_LM78_FAN2_MIN, SENSORS_LM78_FAN2_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, LM78_ALARM_FAN3, 0, - { SENSORS_LM78_FAN3, SENSORS_LM78_FAN3_MIN, SENSORS_LM78_FAN3_DIV, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_rpm, LM78_ALARM_TEMP, 0, - { SENSORS_LM78_TEMP, SENSORS_LM78_TEMP_OVER, SENSORS_LM78_TEMP_HYST, -1 } }, - { fmtVolt_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_LM78_VID, -1 } }, - { fmtBoardTemperatureInput, NULL, DataType_other, LM78_ALARM_BTI, 0, - { SENSORS_LM78_ALARMS, -1 } }, - { fmtChassisIntrusionDetection, NULL, DataType_other, LM78_ALARM_CHAS, 0, - { SENSORS_LM78_ALARMS, -1 } }, - { NULL } -}; - -static const ChipDescriptor lm78_chip = { - lm78_names, lm78_features, SENSORS_LM78_ALARMS, 0 -}; - -/** GL518 **/ - -/* N.B: sensors supports a "gl518sm-r00" but it is not picked up in main.c... -static const char * -fmtVolts_GL518_R00 -(const double values[], int alarm, int beep) { - if (values[0] == 0.0) - sprintf (buff, "n/a (min = %+.2f V, max = %+.2f V)", values[1], values[2]); - else - sprintf (buff, "%+.2f V (min = %+.2f V, max = %+.2f V)", values[0], values[1], values[2]); - return fmtExtra (alarm, beep); -} -*/ - -static const char *gl518_names[] = { - SENSORS_GL518_PREFIX, NULL -}; - -static const FeatureDescriptor gl518_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, GL518_ALARM_VDD, GL518_ALARM_VDD, - { SENSORS_GL518_VDD, SENSORS_GL518_VDD_MIN, SENSORS_GL518_VDD_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, GL518_ALARM_VIN1, GL518_ALARM_VIN1, - { SENSORS_GL518_VIN1, SENSORS_GL518_VIN1_MIN, SENSORS_GL518_VIN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, GL518_ALARM_VIN2, GL518_ALARM_VIN2, - { SENSORS_GL518_VIN2, SENSORS_GL518_VIN2_MIN, SENSORS_GL518_VIN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, GL518_ALARM_VIN3, GL518_ALARM_VIN3, - { SENSORS_GL518_VIN3, SENSORS_GL518_VIN3_MIN, SENSORS_GL518_VIN3_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, GL518_ALARM_FAN1, GL518_ALARM_FAN1, - { SENSORS_GL518_FAN1, SENSORS_GL518_FAN1_MIN, SENSORS_GL518_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, GL518_ALARM_FAN2, GL518_ALARM_FAN2, - { SENSORS_GL518_FAN2, SENSORS_GL518_FAN2_MIN, SENSORS_GL518_FAN2_DIV, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, GL518_ALARM_TEMP, GL518_ALARM_TEMP, - { SENSORS_GL518_TEMP, SENSORS_GL518_TEMP_OVER, SENSORS_GL518_TEMP_HYST, -1 } }, - { fmtSoundAlarm, NULL, DataType_other, 0, 0, - { SENSORS_GL518_BEEP_ENABLE, -1 } }, - { NULL } -}; - -static const ChipDescriptor gl518_chip = { - gl518_names, gl518_features, SENSORS_GL518_ALARMS, SENSORS_GL518_BEEPS -}; - -/** ADM1025 **/ - -static const char * -fmtTemps_ADM1025 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.1f C (min = %.0f C, max = %.0f C)", values[0], values[1], values[2]); - return fmtExtra (alarm, beep); -} - -static const char *adm1025_names[] = { - SENSORS_ADM1025_PREFIX, NULL -}; - -static const FeatureDescriptor adm1025_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN0, 0, - { SENSORS_ADM1025_IN0, SENSORS_ADM1025_IN0_MIN, SENSORS_ADM1025_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN1, 0, - { SENSORS_ADM1025_IN1, SENSORS_ADM1025_IN1_MIN, SENSORS_ADM1025_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN2, 0, - { SENSORS_ADM1025_IN2, SENSORS_ADM1025_IN2_MIN, SENSORS_ADM1025_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN3, 0, - { SENSORS_ADM1025_IN3, SENSORS_ADM1025_IN3_MIN, SENSORS_ADM1025_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN4, 0, - { SENSORS_ADM1025_IN4, SENSORS_ADM1025_IN4_MIN, SENSORS_ADM1025_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, ADM1025_ALARM_IN5, 0, - { SENSORS_ADM1025_IN5, SENSORS_ADM1025_IN5_MIN, SENSORS_ADM1025_IN5_MAX, -1 } }, - { fmtTemps_ADM1025, rrdF1, DataType_temperature, ADM1025_ALARM_TEMP, 0, - { SENSORS_ADM1025_TEMP1, SENSORS_ADM1025_TEMP1_LOW, SENSORS_ADM1025_TEMP1_HIGH, -1 } }, - { fmtTemps_ADM1025, rrdF1, DataType_temperature, ADM1025_ALARM_RTEMP, 0, - { SENSORS_ADM1025_TEMP2, SENSORS_ADM1025_TEMP2_LOW, SENSORS_ADM1025_TEMP2_HIGH, -1 } }, - { NULL } -}; - -static const ChipDescriptor adm1025_chip = { - adm1025_names, adm1025_features, SENSORS_ADM1025_ALARMS, 0 -}; - -/** LM80 **/ - -static const char * -fmtTemps_LM80 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.2f C (hot limit = %.0f C, hot hysteresis = %.0f C, os limit = %.0f C, os hysteresis = %.0f C)", values[0], values[1], values[2], values[3], values[4]); - return fmtExtra (alarm, beep); -} - -static const char *lm80_names[] = { - SENSORS_LM80_PREFIX, NULL -}; - -static const FeatureDescriptor lm80_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN0, 0, - { SENSORS_LM80_IN0, SENSORS_LM80_IN0_MIN, SENSORS_LM80_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN1, 0, - { SENSORS_LM80_IN1, SENSORS_LM80_IN1_MIN, SENSORS_LM80_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN2, 0, - { SENSORS_LM80_IN2, SENSORS_LM80_IN2_MIN, SENSORS_LM80_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN3, 0, - { SENSORS_LM80_IN3, SENSORS_LM80_IN3_MIN, SENSORS_LM80_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN4, 0, - { SENSORS_LM80_IN4, SENSORS_LM80_IN4_MIN, SENSORS_LM80_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN5, 0, - { SENSORS_LM80_IN5, SENSORS_LM80_IN5_MIN, SENSORS_LM80_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, LM80_ALARM_IN6, 0, - { SENSORS_LM80_IN6, SENSORS_LM80_IN6_MIN, SENSORS_LM80_IN6_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, LM80_ALARM_FAN1, 0, - { SENSORS_LM80_FAN1, SENSORS_LM80_FAN1_MIN, SENSORS_LM80_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, LM80_ALARM_FAN2, 0, - { SENSORS_LM80_FAN2, SENSORS_LM80_FAN2_MIN, SENSORS_LM80_FAN2_DIV, -1 } }, - { fmtTemps_LM80, rrdF2, DataType_temperature, LM80_ALARM_TEMP_HOT, 0, - { SENSORS_LM80_TEMP, SENSORS_LM80_TEMP_HOT_MAX, SENSORS_LM80_TEMP_HOT_HYST, SENSORS_LM80_TEMP_OS_MAX, SENSORS_LM80_TEMP_OS_HYST, -1 } }, - { fmtBoardTemperatureInput, NULL, DataType_other, LM80_ALARM_BTI, 0, - { SENSORS_LM80_ALARMS, -1 } }, - { fmtChassisIntrusionDetection, NULL, DataType_other, LM80_ALARM_CHAS, 0, - { SENSORS_LM80_ALARMS, -1 } }, - { NULL } -}; - -static const ChipDescriptor lm80_chip = { - lm80_names, lm80_features, SENSORS_LM80_ALARMS, 0 -}; - -/** IT87 (thanks to Mike Black) **/ - -static const char *it87_names[] = { - SENSORS_IT87_PREFIX, SENSORS_IT8712_PREFIX, - SENSORS_IT8716_PREFIX, SENSORS_IT8718_PREFIX, NULL -}; - -static const FeatureDescriptor it87_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, IT87_ALARM_IN0, 0, - { SENSORS_IT87_IN0, SENSORS_IT87_IN0_MIN, SENSORS_IT87_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, IT87_ALARM_IN1, 0, - { SENSORS_IT87_IN1, SENSORS_IT87_IN1_MIN, SENSORS_IT87_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, IT87_ALARM_IN2, 0, - { SENSORS_IT87_IN2, SENSORS_IT87_IN2_MIN, SENSORS_IT87_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, IT87_ALARM_IN3, 0, - { SENSORS_IT87_IN3, SENSORS_IT87_IN3_MIN, SENSORS_IT87_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, IT87_ALARM_IN4, 0, - { SENSORS_IT87_IN4, SENSORS_IT87_IN4_MIN, SENSORS_IT87_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, IT87_ALARM_IN5, 0, - { SENSORS_IT87_IN5, SENSORS_IT87_IN5_MIN, SENSORS_IT87_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, IT87_ALARM_IN6, 0, - { SENSORS_IT87_IN6, SENSORS_IT87_IN6_MIN, SENSORS_IT87_IN6_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, IT87_ALARM_IN7, 0, - { SENSORS_IT87_IN7, SENSORS_IT87_IN7_MIN, SENSORS_IT87_IN7_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, IT87_ALARM_FAN1, 0, - { SENSORS_IT87_FAN1, SENSORS_IT87_FAN1_MIN, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, IT87_ALARM_FAN2, 0, - { SENSORS_IT87_FAN2, SENSORS_IT87_FAN2_MIN, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, IT87_ALARM_FAN3, 0, - { SENSORS_IT87_FAN3, SENSORS_IT87_FAN3_MIN, -1 } }, - { fmtTemps_minmax_0, rrdF1, DataType_temperature, IT87_ALARM_TEMP1, 0, - { SENSORS_IT87_TEMP1, SENSORS_IT87_TEMP1_LOW, SENSORS_IT87_TEMP1_HIGH, -1 } }, - { fmtTemps_minmax_0, rrdF1, DataType_temperature, IT87_ALARM_TEMP2, 0, - { SENSORS_IT87_TEMP2, SENSORS_IT87_TEMP2_LOW, SENSORS_IT87_TEMP2_HIGH, -1 } }, - { fmtTemps_minmax_0, rrdF1, DataType_temperature, IT87_ALARM_TEMP3, 0, - { SENSORS_IT87_TEMP3, SENSORS_IT87_TEMP3_LOW, SENSORS_IT87_TEMP3_HIGH, -1 } }, - { NULL } -}; - -static const ChipDescriptor it87_chip = { - it87_names, it87_features, SENSORS_IT87_ALARMS, 0 -}; - -/** W83781D **/ - -static const char * -fmtTemps_W83781D -(const double values[], int alarm, int beep) { - if (values[2] == 127) { - sprintf (buff, "%.0f C (limit = %.0f C)", - values[0], values[1]); - } else { - sprintf (buff, "%.0f C (limit = %.0f C, hysteresis = %.0f C)", - values[0], values[1], values[2]); - } - return fmtExtra (alarm, beep); -} - -static const char *w83781d_names[] = { - SENSORS_W83781D_PREFIX, NULL -}; - -static const FeatureDescriptor w83781d_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0, - { SENSORS_W83781D_IN0, SENSORS_W83781D_IN0_MIN, SENSORS_W83781D_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN1, W83781D_ALARM_IN1, - { SENSORS_W83781D_IN1, SENSORS_W83781D_IN1_MIN, SENSORS_W83781D_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN2, W83781D_ALARM_IN2, - { SENSORS_W83781D_IN2, SENSORS_W83781D_IN2_MIN, SENSORS_W83781D_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN3, W83781D_ALARM_IN3, - { SENSORS_W83781D_IN3, SENSORS_W83781D_IN3_MIN, SENSORS_W83781D_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN4, W83781D_ALARM_IN4, - { SENSORS_W83781D_IN4, SENSORS_W83781D_IN4_MIN, SENSORS_W83781D_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN5, W83781D_ALARM_IN5, - { SENSORS_W83781D_IN5, SENSORS_W83781D_IN5_MIN, SENSORS_W83781D_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN6, W83781D_ALARM_IN6, - { SENSORS_W83781D_IN6, SENSORS_W83781D_IN6_MIN, SENSORS_W83781D_IN6_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1, - { SENSORS_W83781D_FAN1, SENSORS_W83781D_FAN1_MIN, SENSORS_W83781D_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2, - { SENSORS_W83781D_FAN2, SENSORS_W83781D_FAN2_MIN, SENSORS_W83781D_FAN2_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3, - { SENSORS_W83781D_FAN3, SENSORS_W83781D_FAN3_MIN, SENSORS_W83781D_FAN3_DIV, -1 } }, - { fmtTemps_W83781D, rrdF0, DataType_temperature, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1, - { SENSORS_W83781D_TEMP1, SENSORS_W83781D_TEMP1_OVER, SENSORS_W83781D_TEMP1_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, W83781D_ALARM_TEMP23, W83781D_ALARM_TEMP23, - { SENSORS_W83781D_TEMP2, SENSORS_W83781D_TEMP2_OVER, SENSORS_W83781D_TEMP2_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, W83781D_ALARM_TEMP23, W83781D_ALARM_TEMP23, - { SENSORS_W83781D_TEMP3, SENSORS_W83781D_TEMP3_OVER, SENSORS_W83781D_TEMP3_HYST, -1 } }, - { fmtVolt_3, rrdF3, DataType_voltage, 0, 0, - { SENSORS_W83781D_VID, -1 } }, - { fmtChassisIntrusionDetection, NULL, DataType_other, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS, - { SENSORS_W83781D_ALARMS, -1 } }, - { fmtSoundAlarm, NULL, DataType_other, 0, 0, - { SENSORS_W83781D_BEEP_ENABLE, -1 } }, - { NULL } -}; - -static const ChipDescriptor w83781d_chip = { - w83781d_names, w83781d_features, SENSORS_W83781D_ALARMS, SENSORS_W83781D_BEEPS -}; - -/** AS99127F **/ - -static const char *as99127f_names[] = { - SENSORS_AS99127F_PREFIX, NULL -}; - -static const FeatureDescriptor as99127f_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0, - { SENSORS_W83781D_IN0, SENSORS_W83781D_IN0_MIN, SENSORS_W83781D_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN1, W83781D_ALARM_IN1, - { SENSORS_W83781D_IN1, SENSORS_W83781D_IN1_MIN, SENSORS_W83781D_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN2, W83781D_ALARM_IN2, - { SENSORS_W83781D_IN2, SENSORS_W83781D_IN2_MIN, SENSORS_W83781D_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN3, W83781D_ALARM_IN3, - { SENSORS_W83781D_IN3, SENSORS_W83781D_IN3_MIN, SENSORS_W83781D_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN4, W83781D_ALARM_IN4, - { SENSORS_W83781D_IN4, SENSORS_W83781D_IN4_MIN, SENSORS_W83781D_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN5, W83781D_ALARM_IN5, - { SENSORS_W83781D_IN5, SENSORS_W83781D_IN5_MIN, SENSORS_W83781D_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN6, W83781D_ALARM_IN6, - { SENSORS_W83781D_IN6, SENSORS_W83781D_IN6_MIN, SENSORS_W83781D_IN6_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1, - { SENSORS_W83781D_FAN1, SENSORS_W83781D_FAN1_MIN, SENSORS_W83781D_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2, - { SENSORS_W83781D_FAN2, SENSORS_W83781D_FAN2_MIN, SENSORS_W83781D_FAN2_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3, - { SENSORS_W83781D_FAN3, SENSORS_W83781D_FAN3_MIN, SENSORS_W83781D_FAN3_DIV, -1 } }, - { fmtTemps_W83781D, rrdF0, DataType_temperature, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1, - { SENSORS_W83781D_TEMP1, SENSORS_W83781D_TEMP1_OVER, SENSORS_W83781D_TEMP1_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2, - { SENSORS_W83781D_TEMP2, SENSORS_W83781D_TEMP2_OVER, SENSORS_W83781D_TEMP2_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, W83781D_ALARM_TEMP3, W83781D_ALARM_TEMP3, - { SENSORS_W83781D_TEMP3, SENSORS_W83781D_TEMP3_OVER, SENSORS_W83781D_TEMP3_HYST, -1 } }, - { fmtVolt_3, rrdF3, DataType_voltage, 0, 0, - { SENSORS_W83781D_VID, -1 } }, - { fmtChassisIntrusionDetection, NULL, DataType_other, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS, - { SENSORS_W83781D_ALARMS, -1 } }, - { fmtSoundAlarm, NULL, DataType_other, 0, 0, - { SENSORS_W83781D_BEEP_ENABLE, -1 } }, - { NULL } -}; - -static const ChipDescriptor as99127f_chip = { - as99127f_names, as99127f_features, SENSORS_W83781D_ALARMS, SENSORS_W83781D_BEEPS -}; - -/** W83782D **/ - -static const char * -fmtTemps_W8378x_0 -(const double values[], int alarm, int beep) { - int sensorID = (int) values[3]; - const char *sensor = (sensorID == 1) ? "PII/Celeron diode" : - (sensorID == 2) ? "3904 transistor" : "thermistor"; - if (values[2] == 127) { - sprintf (buff, "%.0f C (limit = %.0f C, sensors = %s)", - values[0], values[1], sensor); - } else { - sprintf (buff, "%.0f C (limit = %.0f C, hysteresis = %.0f C, sensors = %s)", - values[0], values[1], values[2], sensor); - } - return fmtExtra (alarm, beep); -} - -static const char * -fmtTemps_W8378x_1 -(const double values[], int alarm, int beep) { - int sensorID = (int) values[3]; - const char *sensor = (sensorID == 1) ? "PII/Celeron diode" : - (sensorID == 2) ? "3904 transistor" : "thermistor"; - sprintf (buff, "%.1f C (limit = %.0f C, hysteresis = %.0f C, sensor = %s)", - values[0], values[1], values[2], sensor); - return fmtExtra (alarm, beep); -} - -static const char *w83782d_names[] = { - SENSORS_W83782D_PREFIX, SENSORS_W83627HF_PREFIX, SENSORS_W83627THF_PREFIX, SENSORS_W83637HF_PREFIX, NULL -}; - -static const FeatureDescriptor w83782d_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0, - { SENSORS_W83782D_IN0, SENSORS_W83782D_IN0_MIN, SENSORS_W83782D_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN1, W83781D_ALARM_IN1, - { SENSORS_W83782D_IN1, SENSORS_W83782D_IN1_MIN, SENSORS_W83782D_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN2, W83781D_ALARM_IN2, - { SENSORS_W83782D_IN2, SENSORS_W83782D_IN2_MIN, SENSORS_W83782D_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN3, W83781D_ALARM_IN3, - { SENSORS_W83782D_IN3, SENSORS_W83782D_IN3_MIN, SENSORS_W83782D_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN4, W83781D_ALARM_IN4, - { SENSORS_W83782D_IN4, SENSORS_W83782D_IN4_MIN, SENSORS_W83782D_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN5, W83781D_ALARM_IN5, - { SENSORS_W83782D_IN5, SENSORS_W83782D_IN5_MIN, SENSORS_W83782D_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN6, W83781D_ALARM_IN6, - { SENSORS_W83782D_IN6, SENSORS_W83782D_IN6_MIN, SENSORS_W83782D_IN6_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83782D_ALARM_IN7, W83782D_ALARM_IN7, - { SENSORS_W83782D_IN7, SENSORS_W83782D_IN7_MIN, SENSORS_W83782D_IN7_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83782D_ALARM_IN8, W83782D_ALARM_IN8, - { SENSORS_W83782D_IN8, SENSORS_W83782D_IN8_MIN, SENSORS_W83782D_IN8_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1, - { SENSORS_W83782D_FAN1, SENSORS_W83782D_FAN1_MIN, SENSORS_W83782D_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2, - { SENSORS_W83782D_FAN2, SENSORS_W83782D_FAN2_MIN, SENSORS_W83782D_FAN2_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3, - { SENSORS_W83782D_FAN3, SENSORS_W83782D_FAN3_MIN, SENSORS_W83782D_FAN3_DIV, -1 } }, - { fmtTemps_W8378x_0, rrdF0, DataType_temperature, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1, - { SENSORS_W83782D_TEMP1, SENSORS_W83782D_TEMP1_OVER, SENSORS_W83782D_TEMP1_HYST, SENSORS_W83782D_SENS1, -1 } }, - { fmtTemps_W8378x_1, rrdF1, DataType_temperature, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2, - { SENSORS_W83782D_TEMP2, SENSORS_W83782D_TEMP2_OVER, SENSORS_W83782D_TEMP2_HYST, SENSORS_W83782D_SENS2, -1 } }, - { fmtTemps_W8378x_1, rrdF1, DataType_temperature, W83781D_ALARM_TEMP3, W83781D_ALARM_TEMP3, - { SENSORS_W83782D_TEMP3, SENSORS_W83782D_TEMP3_OVER, SENSORS_W83782D_TEMP3_HYST, SENSORS_W83782D_SENS3, -1 } }, - { fmtVolt_3, rrdF3, DataType_voltage, 0, 0, - { SENSORS_W83782D_VID, -1 } }, - { fmtChassisIntrusionDetection, NULL, DataType_other, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS, - { SENSORS_W83781D_ALARMS, -1 } }, - { fmtSoundAlarm, NULL, DataType_other, 0, 0, - { SENSORS_W83781D_BEEP_ENABLE, -1 } }, - { NULL } -}; - -static const ChipDescriptor w83782d_chip = { - w83782d_names, w83782d_features, SENSORS_W83782D_ALARMS, SENSORS_W83782D_BEEPS -}; - -/** W83783S **/ - -static const char *w83783s_names[] = { - SENSORS_W83783S_PREFIX, NULL -}; - -static const FeatureDescriptor w83783s_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0, - { SENSORS_W83783S_IN0, SENSORS_W83783S_IN0_MIN, SENSORS_W83783S_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN2, W83781D_ALARM_IN2, - { SENSORS_W83783S_IN2, SENSORS_W83783S_IN2_MIN, SENSORS_W83783S_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN3, W83781D_ALARM_IN3, - { SENSORS_W83783S_IN3, SENSORS_W83783S_IN3_MIN, SENSORS_W83783S_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN4, W83781D_ALARM_IN4, - { SENSORS_W83783S_IN4, SENSORS_W83783S_IN4_MIN, SENSORS_W83783S_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN5, W83781D_ALARM_IN5, - { SENSORS_W83783S_IN5, SENSORS_W83783S_IN5_MIN, SENSORS_W83783S_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN6, W83781D_ALARM_IN6, - { SENSORS_W83782D_IN6, SENSORS_W83782D_IN6_MIN, SENSORS_W83782D_IN6_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1, - { SENSORS_W83783S_FAN1, SENSORS_W83783S_FAN1_MIN, SENSORS_W83783S_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2, - { SENSORS_W83783S_FAN2, SENSORS_W83783S_FAN2_MIN, SENSORS_W83783S_FAN2_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN3, W83781D_ALARM_FAN3, - { SENSORS_W83783S_FAN3, SENSORS_W83783S_FAN3_MIN, SENSORS_W83783S_FAN3_DIV, -1 } }, - { fmtTemps_W8378x_0, rrdF0, DataType_temperature, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1, - { SENSORS_W83783S_TEMP1, SENSORS_W83783S_TEMP1_OVER, SENSORS_W83783S_TEMP1_HYST, SENSORS_W83783S_SENS1, -1 } }, - { fmtTemps_W8378x_1, rrdF1, DataType_temperature, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2, - { SENSORS_W83783S_TEMP2, SENSORS_W83783S_TEMP2_OVER, SENSORS_W83783S_TEMP2_HYST, SENSORS_W83783S_SENS2, -1 } }, - { fmtVolt_3, rrdF3, DataType_voltage, 0, 0, - { SENSORS_W83783S_VID, -1 } }, - { fmtSoundAlarm, NULL, DataType_other, 0, 0, - { SENSORS_W83781D_BEEP_ENABLE, -1 } }, - { NULL } -}; - -static const ChipDescriptor w83783s_chip = { - w83783s_names, w83783s_features, SENSORS_W83783S_ALARMS, SENSORS_W83783S_BEEPS -}; - -/** W83697HF **/ - -static const char *w83697hf_names[] = { - SENSORS_W83697HF_PREFIX, NULL -}; - -static const FeatureDescriptor w83697hf_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN0, W83781D_ALARM_IN0, - { SENSORS_W83782D_IN0, SENSORS_W83782D_IN0_MIN, SENSORS_W83782D_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN2, W83781D_ALARM_IN2, - { SENSORS_W83782D_IN2, SENSORS_W83782D_IN2_MIN, SENSORS_W83782D_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN3, W83781D_ALARM_IN3, - { SENSORS_W83782D_IN3, SENSORS_W83782D_IN3_MIN, SENSORS_W83782D_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN4, W83781D_ALARM_IN4, - { SENSORS_W83782D_IN4, SENSORS_W83782D_IN4_MIN, SENSORS_W83782D_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN5, W83781D_ALARM_IN5, - { SENSORS_W83782D_IN5, SENSORS_W83782D_IN5_MIN, SENSORS_W83782D_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, W83781D_ALARM_IN6, W83781D_ALARM_IN6, - { SENSORS_W83782D_IN6, SENSORS_W83782D_IN6_MIN, SENSORS_W83782D_IN6_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN1, W83781D_ALARM_FAN1, - { SENSORS_W83782D_FAN1, SENSORS_W83782D_FAN1_MIN, SENSORS_W83782D_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, W83781D_ALARM_FAN2, W83781D_ALARM_FAN2, - { SENSORS_W83782D_FAN2, SENSORS_W83782D_FAN2_MIN, SENSORS_W83782D_FAN2_DIV, -1 } }, - { fmtTemps_W8378x_0, rrdF0, DataType_temperature, W83781D_ALARM_TEMP1, W83781D_ALARM_TEMP1, - { SENSORS_W83782D_TEMP1, SENSORS_W83782D_TEMP1_OVER, SENSORS_W83782D_TEMP1_HYST, SENSORS_W83782D_SENS1, -1 } }, - { fmtTemps_W8378x_1, rrdF1, DataType_temperature, W83781D_ALARM_TEMP2, W83781D_ALARM_TEMP2, - { SENSORS_W83782D_TEMP2, SENSORS_W83782D_TEMP2_OVER, SENSORS_W83782D_TEMP2_HYST, SENSORS_W83782D_SENS2, -1 } }, - { fmtChassisIntrusionDetection, NULL, DataType_other, W83781D_ALARM_CHAS, W83781D_ALARM_CHAS, - { SENSORS_W83781D_ALARMS, -1 } }, - { fmtSoundAlarm, NULL, DataType_other, 0, 0, - { SENSORS_W83781D_BEEP_ENABLE, -1 } }, - { NULL } -}; - -static const ChipDescriptor w83697hf_chip = { - w83697hf_names, w83697hf_features, SENSORS_W83781D_ALARMS, SENSORS_W83781D_BEEPS -}; - - -/** MAXILIFE **/ - -static const char * -fmtTemps_Maxilife -(const double values[], int alarm, int beep) { - if (!values[0] && !values[1] && !values[2]) - return NULL; - return fmtTemps_1_0 (values, alarm, beep); -} - -static const char * -rrdTemps_Maxilife -(const double values[]) { - if (!values[0] && !values[1] && !values[2]) - return NULL; - return rrdF1 (values); -} - -static const char * -fmtFans_Maxilife -(const double values[], int alarm, int beep) { - if (!values[0] && !values[1] && !values[2]) - return NULL; - if (values[0] < 0) { - sprintf (buff, "Off (min = %.0f RPM, div = %.0f)", values[1], values[2]); - } else { - sprintf (buff, "%.0f RPM (min = %.0f RPM, div = %.0f)", values[0] / values[2], values[1] / values[2], values[2]); - } - return fmtExtra (alarm, beep); -} - -static const char * -rrdFans_Maxilife -(const double values[]) { - if (!values[0] && !values[1] && !values[2]) - return NULL; - if (values[0] < 0) { - return NULL; - } else { - sprintf (buff, "%.0f", values[0] / values[2]); - return buff; - } -} - -static const char * -fmtMHz_Maxilife -(const double values[], int alarm, int beep) { - if (!values[0] && !values[1] && !values[2]) - return NULL; - return fmtMHz_2 (values, alarm, beep); -} - -static const char * -rrdMHz_Maxilife -(const double values[]) { - if (!values[0] && !values[1] && !values[2]) - return NULL; - return rrdF2 (values); -} - -static const char * -fmtVolts_Maxilife -(const double values[], int alarm, int beep) { - if (!values[0] && !values[1] && !values[2]) - return NULL; - return fmtVolts_2 (values, alarm, beep); -} - -static const char * -rrdVolts_Maxilife -(const double values[]) { - if (!values[0] && !values[1] && !values[2]) - return NULL; - return rrdF2 (values); -} - -static const char *maxilife_names[] = { - SENSORS_MAXI_CG_PREFIX, SENSORS_MAXI_CO_PREFIX, SENSORS_MAXI_AS_PREFIX, SENSORS_MAXI_NBA_PREFIX, NULL -}; - -static const FeatureDescriptor maxilife_features[] = { - { fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, 0, 0, - { SENSORS_MAXI_CG_TEMP1, SENSORS_MAXI_CG_TEMP1_MAX, SENSORS_MAXI_CG_TEMP1_HYST, -1 } }, - { fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, MAXI_ALARM_TEMP2, 0, - { SENSORS_MAXI_CG_TEMP2, SENSORS_MAXI_CG_TEMP2_MAX, SENSORS_MAXI_CG_TEMP2_HYST, -1 } }, - { fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, 0, 0, - { SENSORS_MAXI_CG_TEMP3, SENSORS_MAXI_CG_TEMP3_MAX, SENSORS_MAXI_CG_TEMP3_HYST, -1 } }, - { fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, MAXI_ALARM_TEMP4, 0, - { SENSORS_MAXI_CG_TEMP4, SENSORS_MAXI_CG_TEMP4_MAX, SENSORS_MAXI_CG_TEMP4_HYST, -1 } }, - { fmtTemps_Maxilife, rrdTemps_Maxilife, DataType_temperature, MAXI_ALARM_TEMP5, 0, - { SENSORS_MAXI_CG_TEMP5, SENSORS_MAXI_CG_TEMP5_MAX, SENSORS_MAXI_CG_TEMP4_HYST, -1 } }, - { fmtFans_Maxilife, rrdFans_Maxilife, DataType_rpm, MAXI_ALARM_FAN1, 0, - { SENSORS_MAXI_CG_FAN1, SENSORS_MAXI_CG_FAN1_MIN, SENSORS_MAXI_CG_FAN1_DIV, -1 } }, - { fmtFans_Maxilife, rrdFans_Maxilife, DataType_rpm, MAXI_ALARM_FAN2, 0, - { SENSORS_MAXI_CG_FAN2, SENSORS_MAXI_CG_FAN2_MIN, SENSORS_MAXI_CG_FAN2_DIV, -1 } }, - { fmtFans_Maxilife, rrdFans_Maxilife, DataType_rpm, MAXI_ALARM_FAN3, 0, - { SENSORS_MAXI_CG_FAN3, SENSORS_MAXI_CG_FAN3_MIN, SENSORS_MAXI_CG_FAN3_DIV, -1 } }, - { fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID1, 0, - { SENSORS_MAXI_CG_VID1, SENSORS_MAXI_CG_VID1_MIN, SENSORS_MAXI_CG_VID1_MAX, -1 } }, - { fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID2, 0, - { SENSORS_MAXI_CG_VID2, SENSORS_MAXI_CG_VID2_MIN, SENSORS_MAXI_CG_VID2_MAX, -1 } }, - { fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID3, 0, - { SENSORS_MAXI_CG_VID3, SENSORS_MAXI_CG_VID3_MIN, SENSORS_MAXI_CG_VID3_MAX, -1 } }, - { fmtVolts_Maxilife, rrdVolts_Maxilife, DataType_voltage, MAXI_ALARM_VID4, 0, - { SENSORS_MAXI_CG_VID4, SENSORS_MAXI_CG_VID4_MIN, SENSORS_MAXI_CG_VID4_MAX, -1 } }, - { NULL } -}; - -static const ChipDescriptor maxilife_chip = { - maxilife_names, maxilife_features, SENSORS_MAXI_CG_ALARMS, 0 -}; - -/** ASB100 **/ - -static const char *asb100_names[] = { - SENSORS_ASB100_PREFIX, NULL -}; - -static const FeatureDescriptor asb100_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_ASB100_IN0, SENSORS_ASB100_IN0_MIN, SENSORS_ASB100_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_ASB100_IN1, SENSORS_ASB100_IN1_MIN, SENSORS_ASB100_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_ASB100_IN2, SENSORS_ASB100_IN2_MIN, SENSORS_ASB100_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_ASB100_IN3, SENSORS_ASB100_IN3_MIN, SENSORS_ASB100_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_ASB100_IN4, SENSORS_ASB100_IN4_MIN, SENSORS_ASB100_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_ASB100_IN5, SENSORS_ASB100_IN5_MIN, SENSORS_ASB100_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_ASB100_IN6, SENSORS_ASB100_IN6_MIN, SENSORS_ASB100_IN6_MAX, -1 } }, - - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_ASB100_FAN1, SENSORS_ASB100_FAN1_MIN, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_ASB100_FAN2, SENSORS_ASB100_FAN2_MIN, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_ASB100_FAN3, SENSORS_ASB100_FAN3_MIN, -1 } }, - - { fmtTemps_1_0, rrdF1, DataType_temperature, 0, 0, - { SENSORS_ASB100_TEMP1, SENSORS_ASB100_TEMP1_HYST, SENSORS_ASB100_TEMP1_OVER, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, 0, 0, - { SENSORS_ASB100_TEMP2, SENSORS_ASB100_TEMP2_HYST, SENSORS_ASB100_TEMP2_OVER, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, 0, 0, - { SENSORS_ASB100_TEMP3, SENSORS_ASB100_TEMP3_HYST, SENSORS_ASB100_TEMP3_OVER, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, 0, 0, - { SENSORS_ASB100_TEMP4, SENSORS_ASB100_TEMP4_HYST, SENSORS_ASB100_TEMP4_OVER, -1 } }, - - { NULL } -}; - -static const ChipDescriptor asb100_chip = { - asb100_names, asb100_features, 0, 0 -}; - -/** PC87360 **/ - -static const char * -fmtTemps_PC87360_0 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.0f C (min = %.0f C, max = %.0f C, crit = %.0f C)", - values[0], values[1], values[2], values[3]); - return fmtExtra (alarm, beep); -} - -static const char * -fmtTemps_PC87360_1 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.1f C (min = %.1f C, max = %.1f C, crit = %.1f C)", - values[0], values[1], values[2], values[3]); - return fmtExtra (alarm, beep); -} - -static const char *pc87360_names[] = { - SENSORS_PC87360_PREFIX, - SENSORS_PC87363_PREFIX, - SENSORS_PC87364_PREFIX, - SENSORS_PC87365_PREFIX, - SENSORS_PC87366_PREFIX, - NULL -}; - -static const FeatureDescriptor pc87360_features[] = { - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87360_FAN1, SENSORS_PC87360_FAN1_MIN, SENSORS_PC87360_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87360_FAN2, SENSORS_PC87360_FAN2_MIN, SENSORS_PC87360_FAN2_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87360_FAN3, SENSORS_PC87360_FAN3_MIN, SENSORS_PC87360_FAN3_DIV, -1 } }, - - { fmtTemps_PC87360_0, rrdF0, DataType_temperature, 3 << 0, 0, - { SENSORS_PC87360_TEMP1, SENSORS_PC87360_TEMP1_MIN, SENSORS_PC87360_TEMP1_MAX, - SENSORS_PC87360_TEMP1_CRIT, -1 } }, - { fmtTemps_PC87360_0, rrdF0, DataType_temperature, 3 << 2, 0, - { SENSORS_PC87360_TEMP2, SENSORS_PC87360_TEMP2_MIN, SENSORS_PC87360_TEMP2_MAX, - SENSORS_PC87360_TEMP2_CRIT, -1 } }, - { fmtTemps_PC87360_0, rrdF0, DataType_temperature, 3 << 4, 0, - { SENSORS_PC87360_TEMP3, SENSORS_PC87360_TEMP3_MIN, SENSORS_PC87360_TEMP3_MAX, - SENSORS_PC87360_TEMP3_CRIT, -1 } }, - { fmtTemps_PC87360_1, rrdF1, DataType_temperature, 0, 0, - { SENSORS_PC87360_TEMP4, SENSORS_PC87360_TEMP4_MIN, SENSORS_PC87360_TEMP4_MAX, - SENSORS_PC87360_TEMP4_CRIT, -1 } }, - { fmtTemps_PC87360_1, rrdF1, DataType_temperature, 0, 0, - { SENSORS_PC87360_TEMP5, SENSORS_PC87360_TEMP5_MIN, SENSORS_PC87360_TEMP5_MAX, - SENSORS_PC87360_TEMP5_CRIT, -1 } }, - { fmtTemps_PC87360_1, rrdF1, DataType_temperature, 0, 0, - { SENSORS_PC87360_TEMP6, SENSORS_PC87360_TEMP6_MIN, SENSORS_PC87360_TEMP6_MAX, - SENSORS_PC87360_TEMP6_CRIT, -1 } }, - - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN0, SENSORS_PC87360_IN0_MIN, SENSORS_PC87360_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN1, SENSORS_PC87360_IN1_MIN, SENSORS_PC87360_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN2, SENSORS_PC87360_IN2_MIN, SENSORS_PC87360_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN3, SENSORS_PC87360_IN3_MIN, SENSORS_PC87360_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN4, SENSORS_PC87360_IN4_MIN, SENSORS_PC87360_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN5, SENSORS_PC87360_IN5_MIN, SENSORS_PC87360_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN6, SENSORS_PC87360_IN6_MIN, SENSORS_PC87360_IN6_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN7, SENSORS_PC87360_IN7_MIN, SENSORS_PC87360_IN7_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN8, SENSORS_PC87360_IN8_MIN, SENSORS_PC87360_IN8_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN9, SENSORS_PC87360_IN9_MIN, SENSORS_PC87360_IN9_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_PC87360_IN10, SENSORS_PC87360_IN10_MIN, SENSORS_PC87360_IN10_MAX, -1 } }, - - { fmtVolt_3, rrdF3, DataType_voltage, 0, 0, - { SENSORS_PC87360_VID, -1 } }, - { NULL } -}; - -static const ChipDescriptor pc87360_chip = { - /* No room for SENSORS_PC87360_ALARMS_IN */ - pc87360_names, pc87360_features, SENSORS_PC87360_ALARMS_TEMP, 0 -}; - -/** PC87427 **/ - -static const char *pc87427_names[] = { - SENSORS_PC87427_PREFIX, - NULL -}; - -static const FeatureDescriptor pc87427_features[] = { - { fmtFans_nodiv_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87427_FAN(1), SENSORS_PC87427_FAN_MIN(1), -1, -1 } }, - { fmtFans_nodiv_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87427_FAN(2), SENSORS_PC87427_FAN_MIN(2), -1, -1 } }, - { fmtFans_nodiv_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87427_FAN(3), SENSORS_PC87427_FAN_MIN(3), -1, -1 } }, - { fmtFans_nodiv_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87427_FAN(4), SENSORS_PC87427_FAN_MIN(4), -1, -1 } }, - { fmtFans_nodiv_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87427_FAN(5), SENSORS_PC87427_FAN_MIN(5), -1, -1 } }, - { fmtFans_nodiv_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87427_FAN(6), SENSORS_PC87427_FAN_MIN(6), -1, -1 } }, - { fmtFans_nodiv_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87427_FAN(7), SENSORS_PC87427_FAN_MIN(7), -1, -1 } }, - { fmtFans_nodiv_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_PC87427_FAN(8), SENSORS_PC87427_FAN_MIN(8), -1, -1 } }, - { NULL } -}; - -static const ChipDescriptor pc87427_chip = { - pc87427_names, pc87427_features, 0, 0 -}; - -/** W83627EHF & W83627DHG **/ - -static const char *w83627ehf_names[] = { - SENSORS_W83627EHF_PREFIX, SENSORS_W83627DHG_PREFIX, NULL -}; - -static const FeatureDescriptor w83627ehf_features[] = { - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_W83627EHF_FAN1, SENSORS_W83627EHF_FAN1_MIN, SENSORS_W83627EHF_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_W83627EHF_FAN2, SENSORS_W83627EHF_FAN2_MIN, SENSORS_W83627EHF_FAN2_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_W83627EHF_FAN3, SENSORS_W83627EHF_FAN3_MIN, SENSORS_W83627EHF_FAN3_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_W83627EHF_FAN4, SENSORS_W83627EHF_FAN4_MIN, SENSORS_W83627EHF_FAN4_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_W83627EHF_FAN5, SENSORS_W83627EHF_FAN5_MIN, SENSORS_W83627EHF_FAN5_DIV, -1 } }, - { fmtTemps_0, rrdF0, DataType_temperature, 0, 0, - { SENSORS_W83627EHF_TEMP1, SENSORS_W83627EHF_TEMP1_OVER, SENSORS_W83627EHF_TEMP1_HYST, -1 } }, - { fmtTemps_1, rrdF1, DataType_temperature, 0, 0, - { SENSORS_W83627EHF_TEMP2, SENSORS_W83627EHF_TEMP2_OVER, SENSORS_W83627EHF_TEMP2_HYST, -1 } }, - { fmtTemps_1, rrdF1, DataType_temperature, 0, 0, - { SENSORS_W83627EHF_TEMP3, SENSORS_W83627EHF_TEMP3_OVER, SENSORS_W83627EHF_TEMP3_HYST, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN0, SENSORS_W83627EHF_IN0_MIN, SENSORS_W83627EHF_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN1, SENSORS_W83627EHF_IN1_MIN, SENSORS_W83627EHF_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN2, SENSORS_W83627EHF_IN2_MIN, SENSORS_W83627EHF_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN3, SENSORS_W83627EHF_IN3_MIN, SENSORS_W83627EHF_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN4, SENSORS_W83627EHF_IN4_MIN, SENSORS_W83627EHF_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN5, SENSORS_W83627EHF_IN5_MIN, SENSORS_W83627EHF_IN5_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN6, SENSORS_W83627EHF_IN6_MIN, SENSORS_W83627EHF_IN6_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN7, SENSORS_W83627EHF_IN7_MIN, SENSORS_W83627EHF_IN7_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN8, SENSORS_W83627EHF_IN8_MIN, SENSORS_W83627EHF_IN8_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, 0, 0, - { SENSORS_W83627EHF_IN9, SENSORS_W83627EHF_IN9_MIN, SENSORS_W83627EHF_IN9_MAX, -1 } }, - { NULL } -}; - -static const ChipDescriptor w83627ehf_chip = { - w83627ehf_names, w83627ehf_features, 0, 0 -}; - -/** F71805F **/ - -static const char *f71805f_names[] = { - SENSORS_F71805F_PREFIX, NULL -}; - -static const FeatureDescriptor f71805f_features[] = { - { fmtVolts_2, rrdF3, DataType_voltage, 0, 0, - { SENSORS_F71805F_IN(0), SENSORS_F71805F_IN_MIN(0), SENSORS_F71805F_IN_MAX(0), -1 } }, - { fmtVolts_2, rrdF3, DataType_voltage, 0, 0, - { SENSORS_F71805F_IN(1), SENSORS_F71805F_IN_MIN(1), SENSORS_F71805F_IN_MAX(1), -1 } }, - { fmtVolts_2, rrdF3, DataType_voltage, 0, 0, - { SENSORS_F71805F_IN(2), SENSORS_F71805F_IN_MIN(2), SENSORS_F71805F_IN_MAX(2), -1 } }, - { fmtVolts_2, rrdF3, DataType_voltage, 0, 0, - { SENSORS_F71805F_IN(3), SENSORS_F71805F_IN_MIN(3), SENSORS_F71805F_IN_MAX(3), -1 } }, - { fmtVolts_2, rrdF3, DataType_voltage, 0, 0, - { SENSORS_F71805F_IN(4), SENSORS_F71805F_IN_MIN(4), SENSORS_F71805F_IN_MAX(4), -1 } }, - { fmtVolts_2, rrdF3, DataType_voltage, 0, 0, - { SENSORS_F71805F_IN(5), SENSORS_F71805F_IN_MIN(5), SENSORS_F71805F_IN_MAX(5), -1 } }, - { fmtVolts_2, rrdF3, DataType_voltage, 0, 0, - { SENSORS_F71805F_IN(6), SENSORS_F71805F_IN_MIN(6), SENSORS_F71805F_IN_MAX(6), -1 } }, - { fmtVolts_2, rrdF3, DataType_voltage, 0, 0, - { SENSORS_F71805F_IN(7), SENSORS_F71805F_IN_MIN(7), SENSORS_F71805F_IN_MAX(7), -1 } }, - { fmtVolts_2, rrdF3, DataType_voltage, 0, 0, - { SENSORS_F71805F_IN(8), SENSORS_F71805F_IN_MIN(8), SENSORS_F71805F_IN_MAX(8), -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_F71805F_FAN(1), SENSORS_F71805F_FAN_MIN(1), -1, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_F71805F_FAN(2), SENSORS_F71805F_FAN_MIN(2), -1, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, 0, 0, - { SENSORS_F71805F_FAN(3), SENSORS_F71805F_FAN_MIN(3), -1, -1 } }, - { fmtTemps_0, rrdF0, DataType_temperature, 1 << 0, 0, - { SENSORS_F71805F_TEMP(1), SENSORS_F71805F_TEMP_MAX(1), SENSORS_F71805F_TEMP_HYST(1), -1 } }, - { fmtTemps_0, rrdF0, DataType_temperature, 1 << 1, 0, - { SENSORS_F71805F_TEMP(2), SENSORS_F71805F_TEMP_MAX(2), SENSORS_F71805F_TEMP_HYST(2), -1 } }, - { fmtTemps_0, rrdF0, DataType_temperature, 1 << 2, 0, - { SENSORS_F71805F_TEMP(3), SENSORS_F71805F_TEMP_MAX(3), SENSORS_F71805F_TEMP_HYST(3), -1 } }, - { NULL } -}; - -static const ChipDescriptor f71805f_chip = { - /* No room for SENSORS_F71805F_ALARMS_IN nor SENSORS_F71805F_ALARMS_FAN */ - f71805f_names, f71805f_features, SENSORS_F71805F_ALARMS_TEMP, 0 -}; - -/** VT1211 **/ - -static const char *vt1211_names[] = { - SENSORS_VT1211_PREFIX, NULL -}; - -static const FeatureDescriptor vt1211_features[] = { - { fmtVolts_2, rrdF2, DataType_voltage, VT1211_ALARM_IN0, 0, - { SENSORS_VT1211_IN0, SENSORS_VT1211_IN0_MIN, SENSORS_VT1211_IN0_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, VT1211_ALARM_IN1, 0, - { SENSORS_VT1211_IN1, SENSORS_VT1211_IN1_MIN, SENSORS_VT1211_IN1_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, VT1211_ALARM_IN2, 0, - { SENSORS_VT1211_IN2, SENSORS_VT1211_IN2_MIN, SENSORS_VT1211_IN2_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, VT1211_ALARM_IN3, 0, - { SENSORS_VT1211_IN3, SENSORS_VT1211_IN3_MIN, SENSORS_VT1211_IN3_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, VT1211_ALARM_IN4, 0, - { SENSORS_VT1211_IN4, SENSORS_VT1211_IN4_MIN, SENSORS_VT1211_IN4_MAX, -1 } }, - { fmtVolts_2, rrdF2, DataType_voltage, VT1211_ALARM_IN5, 0, - { SENSORS_VT1211_IN5, SENSORS_VT1211_IN5_MIN, SENSORS_VT1211_IN5_MAX, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, VT1211_ALARM_FAN1, 0, - { SENSORS_VT1211_FAN1, SENSORS_VT1211_FAN1_MIN, SENSORS_VT1211_FAN1_DIV, -1 } }, - { fmtFans_0, rrdF0, DataType_rpm, VT1211_ALARM_FAN2, 0, - { SENSORS_VT1211_FAN2, SENSORS_VT1211_FAN2_MIN, SENSORS_VT1211_FAN2_DIV, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VT1211_ALARM_TEMP1, 0, - { SENSORS_VT1211_TEMP1, SENSORS_VT1211_TEMP1_OVER, SENSORS_VT1211_TEMP1_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VT1211_ALARM_TEMP2, 0, - { SENSORS_VT1211_TEMP2, SENSORS_VT1211_TEMP2_OVER, SENSORS_VT1211_TEMP2_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VT1211_ALARM_TEMP3, 0, - { SENSORS_VT1211_TEMP3, SENSORS_VT1211_TEMP3_OVER, SENSORS_VT1211_TEMP3_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VT1211_ALARM_TEMP4, 0, - { SENSORS_VT1211_TEMP4, SENSORS_VT1211_TEMP4_OVER, SENSORS_VT1211_TEMP4_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VT1211_ALARM_TEMP5, 0, - { SENSORS_VT1211_TEMP5, SENSORS_VT1211_TEMP5_OVER, SENSORS_VT1211_TEMP5_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VT1211_ALARM_TEMP6, 0, - { SENSORS_VT1211_TEMP6, SENSORS_VT1211_TEMP6_OVER, SENSORS_VT1211_TEMP6_HYST, -1 } }, - { fmtTemps_1_0, rrdF1, DataType_temperature, VT1211_ALARM_TEMP7, 0, - { SENSORS_VT1211_TEMP7, SENSORS_VT1211_TEMP7_OVER, SENSORS_VT1211_TEMP7_HYST, -1 } }, - { fmtVolt_3, rrdF3, DataType_voltage, 0, 0, - { SENSORS_VT1211_VID, -1 } }, - { NULL } -}; - -static const ChipDescriptor vt1211_chip = { - vt1211_names, vt1211_features, SENSORS_VT1211_ALARMS, 0 -}; - -/** K8 **/ - -static const char *k8temp_names[] = { - SENSORS_K8TEMP_PREFIX, NULL -}; - -static const FeatureDescriptor k8temp_features[] = { - { fmtTemp_only, rrdF0, DataType_temperature, 0, 0, - { SENSORS_K8TEMP_TEMP1, -1 } }, - { NULL } -}; - -static const ChipDescriptor k8temp_chip = { - k8temp_names, k8temp_features, 0, 0 -}; - - /** ALL **/ const ChipDescriptor * const knownChips[] = { - &adm1021_chip, - &adm1025_chip, - &adm9240_chip, - &ds1621_chip, - &gl518_chip, - &lm75_chip, - &lm78_chip, - &lm80_chip, - &max1617_chip, - &maxilife_chip, - &sis5595_chip, - &via686a_chip, - &as99127f_chip, - &w83781d_chip, - &w83782d_chip, - &w83783s_chip, - &w83697hf_chip, - &it87_chip, - &asb100_chip, - &pc87360_chip, - &pc87427_chip, - &w83627ehf_chip, - &f71805f_chip, - &vt1211_chip, - &k8temp_chip, NULL }; From 73cdb48635359a274dc29654695cfb021e92a23b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 18 Sep 2007 20:46:06 +0000 Subject: [PATCH 272/718] Fix compilation breakage. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4806 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/sense.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index 2532723c..af46b652 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -37,9 +37,9 @@ int getRawLabel (const sensors_chip_name *name, int feature, const char **label) { const sensors_feature_data *rawFeature; - int nr1 = 0, nr2 = 0, err = 0; + int nr = 0, err = 0; do { - rawFeature = sensors_get_all_features (name, &nr1, &nr2); + rawFeature = sensors_get_all_features (name, &nr); } while (rawFeature && (rawFeature->number != feature)); /* TODO: Ensure labels match RRD construct and are not repeated! */ if (!rawFeature) { @@ -65,7 +65,7 @@ idChip const char *adapter; sensorLog (LOG_INFO, "Chip: %s", chipName (chip)); - adapter = sensors_get_adapter_name (chip->bus); + adapter = sensors_get_adapter_name (&chip->bus); if (adapter) sensorLog (LOG_INFO, "Adapter: %s", adapter); @@ -76,12 +76,12 @@ static int readUnknownChip (const sensors_chip_name *chip) { const sensors_feature_data *sensor; - int index0 = 0, index1 = 0; + int index0 = 0; int ret = 0; ret = idChip (chip); - while ((ret == 0) && ((sensor = sensors_get_all_features (chip, &index0, &index1)) != NULL)) { + while ((ret == 0) && ((sensor = sensors_get_all_features (chip, &index0)) != NULL)) { char *label = NULL; double value; From 0ec61f1bc76d1ba07b1f87cb7a29e7d342624ced Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 18 Sep 2007 20:53:42 +0000 Subject: [PATCH 273/718] Warning fixes. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4807 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/args.c | 2 +- prog/sensord/rrd.c | 29 ++++++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/prog/sensord/args.c b/prog/sensord/args.c index 1a7e4b7f..d2278259 100644 --- a/prog/sensord/args.c +++ b/prog/sensord/args.c @@ -80,7 +80,7 @@ static struct { { "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, { "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { "daemon", LOG_DAEMON }, { "user", LOG_USER }, - { NULL } + { NULL, 0 } }; static int diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index e01da52c..03cd7197 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -86,8 +86,8 @@ rrdNextChar static void rrdCheckLabel -(const char *rawLabel, int index) { - char *buffer = rrdLabels[index]; +(const char *rawLabel, int index0) { + char *buffer = rrdLabels[index0]; int i, j, okay; i = 0; @@ -104,7 +104,7 @@ rrdCheckLabel j = 0; okay = (i > 0); - while (okay && (j < index)) /* locate duplicates */ + while (okay && (j < index0)) /* locate duplicates */ okay = strcmp (rrdLabels[j ++], buffer); while (!okay) { /* uniquify duplicate labels with _? or _?? */ @@ -128,7 +128,7 @@ rrdCheckLabel } j = 0; okay = 1; - while (okay && (j < index)) + while (okay && (j < index0)) okay = strcmp (rrdLabels[j ++], buffer); } } @@ -274,12 +274,12 @@ rrdInit struct gr { DataType type; - char *h2; - char *image; - char *title; - char *axisTitle; - char *axisDefn; - char *options; + const char *h2; + const char *image; + const char *title; + const char *axisTitle; + const char *axisDefn; + const char *options; int loadAvg; }; @@ -357,7 +357,14 @@ static struct gr graphs[] = { "-s -1w --alt-autoscale", 0 }, { - DataType_other + DataType_other, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + 0 } }; From 4618795d52bd88bfb1a4d5024d3b48a5c9fc5f12 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Sep 2007 12:05:31 +0000 Subject: [PATCH 274/718] Add a sample configuration section for the thmc50 and adm1022. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4813 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + etc/sensors.conf.eg | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGES b/CHANGES index 6424d830..74b93670 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ SVN HEAD Legacy hotplug modules and documentation: Delete File doc/version-2: Delete, obsolete File sensors.conf.eg: Add a dme1737 section + Add a thmc50 section File lm_sensors.sysconfig: Delete, now generated by sensors-detect File README.patches: Delete, obsolete Library: Clean up pwm symbol names translation diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index ffc21c10..2ed453f5 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -2436,3 +2436,14 @@ chip "f71882fg-*" compute in6 (@ * 5.25), (@ / 5.25) compute in7 (@ * 2), (@ / 2) compute in8 (@ * 2), (@ / 2) + + +chip "adm1022-*" "thmc50-*" + + label temp1 "M/B Temp" + # Single CPU setup + label temp2 "CPU Temp" + + # Dual CPU setup (ADM1022 only) + #label temp2 "CPU0 Temp" + #label temp3 "CPU1 Temp" From 9730c5739533189e5a64cde0d10c9bfb91db75a5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Sep 2007 12:06:36 +0000 Subject: [PATCH 275/718] Add some more conversion rules for the thmc50 and adm1022. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4814 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors-conf-convert | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/sensors-conf-convert b/etc/sensors-conf-convert index b1405761..57cf77f6 100755 --- a/etc/sensors-conf-convert +++ b/etc/sensors-conf-convert @@ -165,10 +165,16 @@ BEGIN "thmc50" => { qr/\btemp_hyst\b/ => sub { "temp1_min" }, qr/\bremote_temp_hyst\b/ => sub { "temp2_min" }, + qr/\bremote_temp2\b/ => sub { "temp3" }, + qr/\bremote_temp2_hyst\b/ => sub { "temp3_min" }, + qr/\bremote_temp2_over\b/ => sub { "temp3_max" }, }, "adm1022" => { qr/\btemp_hyst\b/ => sub { "temp1_min" }, qr/\bremote_temp_hyst\b/ => sub { "temp2_min" }, + qr/\bremote_temp2\b/ => sub { "temp3" }, + qr/\bremote_temp2_hyst\b/ => sub { "temp3_min" }, + qr/\bremote_temp2_over\b/ => sub { "temp3_max" }, }, "adm1026" => { qr/\bfan(\d)(|_div|_min)\b/ => sub { "fan".($1+1).$2 }, From 347b0d1965e0109b32e8b654514dbffc1c0acd64 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Sep 2007 14:25:19 +0000 Subject: [PATCH 276/718] Fix a memory leak when daemonizing. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4815 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensord/sensord.c | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index 74b93670..5974c54e 100644 --- a/CHANGES +++ b/CHANGES @@ -55,6 +55,7 @@ SVN HEAD Update URI Program sensord: Syncronize the version with lm-sensors Drop all the chip-specific support + Fix a memory leak when daemonizing Program sensors: Drop all the chip-specific support Fix alignment of alarm for one-limit temperatures Drop option -U diff --git a/prog/sensord/sensord.c b/prog/sensord/sensord.c index b2a8bf78..85baf7c4 100644 --- a/prog/sensord/sensord.c +++ b/prog/sensord/sensord.c @@ -164,6 +164,7 @@ daemonize } else if (pid != 0) { fprintf (file, "%d\n", pid); fclose (file); + unloadLib (); exit (EXIT_SUCCESS); } From d3b00b0a86b2e4b38010daca7acd12eafd7f6c0c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Sep 2007 15:10:06 +0000 Subject: [PATCH 277/718] Fix memory leaks in command line parsing. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4816 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensord/args.c | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 5974c54e..d62c45fa 100644 --- a/CHANGES +++ b/CHANGES @@ -56,6 +56,7 @@ SVN HEAD Program sensord: Syncronize the version with lm-sensors Drop all the chip-specific support Fix a memory leak when daemonizing + Fix memory leaks in command line parsing Program sensors: Drop all the chip-specific support Fix alignment of alarm for one-limit temperatures Drop option -U diff --git a/prog/sensord/args.c b/prog/sensord/args.c index d2278259..a492fc8b 100644 --- a/prog/sensord/args.c +++ b/prog/sensord/args.c @@ -212,24 +212,20 @@ parseArgs doSet = 1; break; case 'c': - if ((sensorsCfgFile = strdup (optarg)) == NULL) - return -1; + sensorsCfgFile = optarg; break; case 'p': - if ((pidFile = strdup (optarg)) == NULL) - return -1; + pidFile = optarg; break; case 'r': - if ((rrdFile = strdup (optarg)) == NULL) - return -1; + rrdFile = optarg; break; case 'd': debug = 1; break; case 'g': doCGI = 1; - if ((cgiDir = strdup (optarg)) == NULL) - return -1; + cgiDir = optarg; break; case 'v': printf ("sensord version %s\n", LM_VERSION); From 2e773670b8ac35d6ebf40f3c938bb3215cd176d6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Sep 2007 15:11:34 +0000 Subject: [PATCH 278/718] Add generic chip support to sensord, much like sensors has. Alarm and beep mask support is still missing. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4817 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 214 +++++++++++++++++++++++++++++++++++++++-- prog/sensord/rrd.c | 13 ++- prog/sensord/sense.c | 15 ++- prog/sensord/sensord.h | 7 +- 4 files changed, 224 insertions(+), 25 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 0f966be8..cdeb979f 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -71,9 +71,9 @@ fmtTemps_1 } static const char * -fmtTemps_minmax_0 +fmtTemps_minmax_1 (const double values[], int alarm, int beep) { - sprintf (buff, "%.0f C (min = %.0f C, max = %.0f C)", values[0], values[1], values[2]); + sprintf (buff, "%.1f C (min = %.1f C, max = %.1f C)", values[0], values[1], values[2]); return fmtExtra (alarm, beep); } @@ -119,6 +119,13 @@ fmtFans_nodiv_0 return fmtExtra (alarm, beep); } +static const char * +fmtFan_only +(const double values[], int alarm, int beep) { + sprintf (buff, "%.0f RPM", values[0]); + return fmtExtra (alarm, beep); +} + static const char * fmtMHz_2 (const double values[], int alarm, int beep) { @@ -175,8 +182,203 @@ rrdF3 return buff; } -/** ALL **/ +static void getAvailableFeatures (const sensors_chip_name *name, + const sensors_feature_data *feature, + int i, short *has_features, + int *feature_nrs, int size, + int first_val) +{ + const sensors_feature_data *iter; -const ChipDescriptor * const knownChips[] = { - NULL -}; + while ((iter = sensors_get_all_features (name, &i)) && + iter->mapping == feature->number) { + int index0; + + index0 = iter->type - first_val - 1; + if (index0 < 0 || index0 >= size) + /* New feature in libsensors? Ignore. */ + continue; + + has_features[index0] = 1; + feature_nrs[index0] = iter->number; + } +} + +#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] +#define IN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_IN - 1] +static void fillChipVoltage (FeatureDescriptor *voltage, + const sensors_chip_name *name, + const sensors_feature_data *feature, int i) +{ + const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; + short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0, }; + int feature_nrs[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN]; + int pos = 0; + + voltage->rrd = rrdF2; + voltage->type = DataType_voltage; + voltage->dataNumbers[pos++] = feature->number; + + getAvailableFeatures (name, feature, i, has_features, + feature_nrs, size, SENSORS_FEATURE_IN); + + if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && + IN_FEATURE(SENSORS_FEATURE_IN_MAX)) { + voltage->format = fmtVolts_2; + voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_FEATURE_IN_MIN); + voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_FEATURE_IN_MAX); + } else { + voltage->format = fmtVolt_2; + } + + /* terminate the list */ + voltage->dataNumbers[pos] = -1; +} + +#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] +#define TEMP_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_TEMP - 1] +static void fillChipTemperature (FeatureDescriptor *temperature, + const sensors_chip_name *name, + const sensors_feature_data *feature, int i) +{ + const int size = SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP; + short has_features[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP] = { 0, }; + int feature_nrs[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP]; + int pos = 0; + + temperature->rrd = rrdF1; + temperature->type = DataType_temperature; + temperature->dataNumbers[pos++] = feature->number; + + getAvailableFeatures (name, feature, i, has_features, + feature_nrs, size, SENSORS_FEATURE_TEMP); + + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN) && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { + temperature->format = fmtTemps_minmax_1; + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MIN); + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MAX); + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX) && + TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { + temperature->format = fmtTemps_1; + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MAX); + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MAX_HYST); + } else { + temperature->format = fmtTemp_only; + } + + /* terminate the list */ + temperature->dataNumbers[pos] = -1; +} + +#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] +#define FAN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_FAN - 1] +static void fillChipFan (FeatureDescriptor *fan, + const sensors_chip_name *name, + const sensors_feature_data *feature, int i) +{ + const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; + short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0, }; + int feature_nrs[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN]; + int pos = 0; + + fan->rrd = rrdF0; + fan->type = DataType_rpm; + fan->dataNumbers[pos++] = feature->number; + + getAvailableFeatures (name, feature, i, has_features, + feature_nrs, size, SENSORS_FEATURE_FAN); + + if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) { + fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_FEATURE_FAN_MIN); + if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) { + fan->format = fmtFans_0; + fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_FEATURE_FAN_DIV); + } else { + fan->format = fmtFans_nodiv_0; + } + } else { + fan->format = fmtFan_only; + } + + /* terminate the list */ + fan->dataNumbers[pos] = -1; +} + +static void fillChipVid (FeatureDescriptor *voltage, + const sensors_feature_data *feature) +{ + voltage->format = fmtVolt_3; + voltage->rrd = rrdF3; + voltage->type = DataType_voltage; + voltage->dataNumbers[0] = feature->number; + voltage->dataNumbers[1] = -1; +} + +static void fillChipBeepEnable (FeatureDescriptor *voltage, + const sensors_feature_data *feature) +{ + voltage->format = fmtSoundAlarm; + voltage->rrd = rrdF0; + voltage->type = DataType_other; + voltage->dataNumbers[0] = feature->number; + voltage->dataNumbers[1] = -1; +} + +/* Note that alarms and beeps are no longer (or not yet) supported */ +ChipDescriptor * generateChipDescriptor (const sensors_chip_name *chip) +{ + int nr, count = 1; + const sensors_feature_data *sensor; + ChipDescriptor *descriptor; + FeatureDescriptor *features; + + /* How many main features do we have? */ + nr = 0; + while ((sensor = sensors_get_all_features(chip, &nr))) { + if (sensor->mapping == SENSORS_NO_MAPPING) + count++; + } + + /* Allocate the memory we need */ + descriptor = calloc(1, sizeof(ChipDescriptor)); + features = calloc(count, sizeof(FeatureDescriptor)); + if (!descriptor || !features) { + free(descriptor); + free(features); + return NULL; + } + descriptor->features = features; + + /* Fill in the data structures */ + count = 0; + nr = 0; + while ((sensor = sensors_get_all_features(chip, &nr))) { + if (sensor->mapping != SENSORS_NO_MAPPING) + continue; + + switch (sensor->type) { + case SENSORS_FEATURE_TEMP: + fillChipTemperature(&features[count], chip, sensor, nr); + break; + case SENSORS_FEATURE_IN: + fillChipVoltage(&features[count], chip, sensor, nr); + break; + case SENSORS_FEATURE_FAN: + fillChipFan(&features[count], chip, sensor, nr); + break; + case SENSORS_FEATURE_VID: + fillChipVid(&features[count], sensor); + break; + case SENSORS_FEATURE_BEEP_ENABLE: + fillChipBeepEnable(&features[count], sensor); + break; + default: + continue; + } + + count++; + } + + return descriptor; +} diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index 03cd7197..ce0259cd 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -141,14 +141,11 @@ applyToFeatures for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { while ((ret == 0) && ((chip = sensors_get_detected_chips (&chipNames[j], &i)) != NULL)) { - int index0, subindex, chipindex = -1; - for (index0 = 0; knownChips[index0]; ++ index0) - for (subindex = 0; knownChips[index0]->names[subindex]; ++ subindex) - if (!strcmp (chip->prefix, knownChips[index0]->names[subindex])) - chipindex = index0; - if (chipindex >= 0) { - const ChipDescriptor *descriptor = knownChips[chipindex]; + ChipDescriptor *descriptor; + descriptor = generateChipDescriptor (chip); + if (descriptor) { const FeatureDescriptor *features = descriptor->features; + int index0; for (index0 = 0; (ret == 0) && (num < MAX_RRD_SENSORS) && features[index0].format; ++ index0) { const FeatureDescriptor *feature = features + index0; @@ -170,6 +167,8 @@ applyToFeatures if (label) free (label); } + free (descriptor->features); + free (descriptor); } } } diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index af46b652..a21c75d1 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -197,14 +197,13 @@ doChip if (action == DO_SET) { ret = setChip (chip); } else { - int index0, subindex, chipindex = -1; - for (index0 = 0; knownChips[index0]; ++ index0) - for (subindex = 0; knownChips[index0]->names[subindex]; ++ subindex) - if (!strcmp (chip->prefix, knownChips[index0]->names[subindex])) - chipindex = index0; - if (chipindex >= 0) - ret = doKnownChip (chip, knownChips[chipindex], action); - else if (action == DO_READ) + ChipDescriptor *descriptor; + descriptor = generateChipDescriptor (chip); + if (descriptor) { + ret = doKnownChip (chip, descriptor, action); + free (descriptor->features); + free (descriptor); + } else if (action == DO_READ) ret = readUnknownChip (chip); } return ret; diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index 8bcb57f4..fa81ebd4 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -91,14 +91,13 @@ typedef struct { DataType type; int alarmMask; int beepMask; - const int dataNumbers[MAX_DATA + 1]; /* First entry is used for the label */ + int dataNumbers[MAX_DATA + 1]; /* First entry is used for the label */ } FeatureDescriptor; typedef struct { - const char * const *names; - const FeatureDescriptor *features; + FeatureDescriptor *features; int alarmNumber; int beepNumber; } ChipDescriptor; -extern const ChipDescriptor * const knownChips[]; +extern ChipDescriptor * generateChipDescriptor (const sensors_chip_name *chip); From 2837b67281320eeaf88d9a0799901174a6bb4c6c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Sep 2007 15:12:58 +0000 Subject: [PATCH 279/718] Delete unused formatting functions. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4818 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index cdeb979f..304cb382 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -42,27 +42,6 @@ fmtExtra return buff; } -static const char * -fmtValu_0 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.0f", values[0]); - return fmtExtra (alarm, beep); -} - -static const char * -fmtTemps_0 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.0f C (limit = %.0f C, hysteresis = %.0f C)", values[0], values[1], values[2]); - return fmtExtra (alarm, beep); -} - -static const char * -fmtTemps_1_0 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.1f C (limit = %.0f C, hysteresis = %.0f C)", values[0], values[1], values[2]); - return fmtExtra (alarm, beep); -} - static const char * fmtTemps_1 (const double values[], int alarm, int beep) { @@ -126,27 +105,6 @@ fmtFan_only return fmtExtra (alarm, beep); } -static const char * -fmtMHz_2 -(const double values[], int alarm, int beep) { - sprintf (buff, "%.2f MHz (min = %.2f MHz, max = %.2f MHz)", values[0], values[1], values[2]); - return fmtExtra (alarm, beep); -} - -static const char * -fmtChassisIntrusionDetection -(const double values[], int alarm, int beep) { - sprintf (buff, "Chassis intrusion detection"); - return fmtExtra (alarm, beep); -} - -static const char * -fmtBoardTemperatureInput -(const double values[], int alarm, int beep) { - sprintf (buff, "Board temperature input"); /* N.B: "(usually LM75 chips)" */ - return fmtExtra (alarm, beep); -} - static const char * fmtSoundAlarm (const double values[], int alarm, int beep) { From afddd2555290f2a3a05046dbbf774057ef2c527d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Sep 2007 15:16:14 +0000 Subject: [PATCH 280/718] Drop support for printing unknown chips: all chips are known now. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4819 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/sense.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index a21c75d1..5f569447 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -72,37 +72,6 @@ idChip return 0; } -static int -readUnknownChip -(const sensors_chip_name *chip) { - const sensors_feature_data *sensor; - int index0 = 0; - int ret = 0; - - ret = idChip (chip); - - while ((ret == 0) && ((sensor = sensors_get_all_features (chip, &index0)) != NULL)) { - char *label = NULL; - double value; - - if (!(label = sensors_get_label (chip, sensor->number))) { - sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, sensor->name); - ret = 21; - } else if (!(sensor->flags & SENSORS_MODE_R)) { - sensorLog (LOG_INFO, "%s: %s", sensor->name, label); - } else if ((ret = sensors_get_value (chip, sensor->number, &value))) { - sensorLog (LOG_ERR, "Error getting sensor data: %s/%s: %s", chip->prefix, sensor->name, sensors_strerror (ret)); - ret = 22; - } else { - sensorLog (LOG_INFO, " %s%s: %.2f", (sensor->mapping == SENSORS_NO_MAPPING) ? "" : "-", label, value); - } - if (label) - free (label); - } - - return ret; -} - static int doKnownChip (const sensors_chip_name *chip, const ChipDescriptor *descriptor, int action) { @@ -203,8 +172,7 @@ doChip ret = doKnownChip (chip, descriptor, action); free (descriptor->features); free (descriptor); - } else if (action == DO_READ) - ret = readUnknownChip (chip); + } } return ret; } From a46211007e86f0ef551e73beeb7075913b520bce Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 19 Sep 2007 16:53:16 +0000 Subject: [PATCH 281/718] Better error handling when a feature value can't be read. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4822 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index ab021b0c..bcd0b518 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -26,6 +26,7 @@ #include "main.h" #include "chips.h" #include "lib/sensors.h" +#include "lib/error.h" void print_chip_raw(const sensors_chip_name *name) { @@ -77,15 +78,19 @@ static void sensors_get_available_features(const sensors_chip_name *name, while ((iter = sensors_get_all_features(name, &i)) && iter->mapping == feature->number) { - int indx; + int indx, err; indx = iter->type - first_val - 1; if (indx < 0 || indx >= size) /* New feature in libsensors? Ignore. */ continue; - if (sensors_get_value(name, iter->number, &feature_vals[indx])) - printf("ERROR: Can't get %s data!\n", iter->name); + err = sensors_get_value(name, iter->number, &feature_vals[indx]); + if (err) { + printf("ERROR: Can't get %s data: %s\n", iter->name, + sensors_strerror(err)); + continue; + } has_features[indx] = 1; } From 071e4a8008522e638e973b443eb3f6ee6120cac3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 20 Sep 2007 16:22:13 +0000 Subject: [PATCH 282/718] Rename a few variables to something that makes more sense. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4824 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 304cb382..3c9bc540 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -263,24 +263,24 @@ static void fillChipFan (FeatureDescriptor *fan, fan->dataNumbers[pos] = -1; } -static void fillChipVid (FeatureDescriptor *voltage, +static void fillChipVid (FeatureDescriptor *vid, const sensors_feature_data *feature) { - voltage->format = fmtVolt_3; - voltage->rrd = rrdF3; - voltage->type = DataType_voltage; - voltage->dataNumbers[0] = feature->number; - voltage->dataNumbers[1] = -1; + vid->format = fmtVolt_3; + vid->rrd = rrdF3; + vid->type = DataType_voltage; + vid->dataNumbers[0] = feature->number; + vid->dataNumbers[1] = -1; } -static void fillChipBeepEnable (FeatureDescriptor *voltage, +static void fillChipBeepEnable (FeatureDescriptor *beepen, const sensors_feature_data *feature) { - voltage->format = fmtSoundAlarm; - voltage->rrd = rrdF0; - voltage->type = DataType_other; - voltage->dataNumbers[0] = feature->number; - voltage->dataNumbers[1] = -1; + beepen->format = fmtSoundAlarm; + beepen->rrd = rrdF0; + beepen->type = DataType_other; + beepen->dataNumbers[0] = feature->number; + beepen->dataNumbers[1] = -1; } /* Note that alarms and beeps are no longer (or not yet) supported */ From 36ded1b5fcaef657dc20c8caa97d6c04d3eeffd5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 20 Sep 2007 21:22:42 +0000 Subject: [PATCH 283/718] Restore support for alarms. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4825 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 37 +++++++++++++++++++++++++++++++++ prog/sensord/sense.c | 46 ++++++++++++++++++++++-------------------- prog/sensord/sensord.h | 6 ++---- 3 files changed, 63 insertions(+), 26 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 3c9bc540..421e5c5e 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -191,6 +191,19 @@ static void fillChipVoltage (FeatureDescriptor *voltage, /* terminate the list */ voltage->dataNumbers[pos] = -1; + + /* alarm if applicable */ + if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { + voltage->alarmNumber = IN_FEATURE_NR(SENSORS_FEATURE_IN_ALARM); + } else if (IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { + voltage->alarmNumber = IN_FEATURE_NR(SENSORS_FEATURE_IN_MIN_ALARM); + } else if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM)) { + voltage->alarmNumber = IN_FEATURE_NR(SENSORS_FEATURE_IN_MAX_ALARM); + } else { + voltage->alarmNumber = -1; + } + /* beep support missing for now */ + voltage->beepNumber = -1; } #define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] @@ -227,6 +240,17 @@ static void fillChipTemperature (FeatureDescriptor *temperature, /* terminate the list */ temperature->dataNumbers[pos] = -1; + + /* alarm if applicable */ + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM)) { + temperature->alarmNumber = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_ALARM); + } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM)) { + temperature->alarmNumber = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MAX_ALARM); + } else { + temperature->alarmNumber = -1; + } + /* beep support missing for now */ + temperature->beepNumber = -1; } #define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] @@ -261,6 +285,15 @@ static void fillChipFan (FeatureDescriptor *fan, /* terminate the list */ fan->dataNumbers[pos] = -1; + + /* alarm if applicable */ + if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM)) { + fan->alarmNumber = FAN_FEATURE_NR(SENSORS_FEATURE_FAN_ALARM); + } else { + fan->alarmNumber = -1; + } + /* beep support missing for now */ + fan->beepNumber = -1; } static void fillChipVid (FeatureDescriptor *vid, @@ -269,6 +302,8 @@ static void fillChipVid (FeatureDescriptor *vid, vid->format = fmtVolt_3; vid->rrd = rrdF3; vid->type = DataType_voltage; + vid->alarmNumber = -1; + vid->beepNumber = -1; vid->dataNumbers[0] = feature->number; vid->dataNumbers[1] = -1; } @@ -279,6 +314,8 @@ static void fillChipBeepEnable (FeatureDescriptor *beepen, beepen->format = fmtSoundAlarm; beepen->rrd = rrdF0; beepen->type = DataType_other; + beepen->alarmNumber = -1; + beepen->beepNumber = -1; beepen->dataNumbers[0] = feature->number; beepen->dataNumbers[1] = -1; } diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index 5f569447..14a816d6 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -76,44 +76,46 @@ static int doKnownChip (const sensors_chip_name *chip, const ChipDescriptor *descriptor, int action) { const FeatureDescriptor *features = descriptor->features; - int alarms = 0, beeps = 0; int index0, subindex; int ret = 0; double tmp; if (action == DO_READ) ret = idChip (chip); - if (!ret && descriptor->alarmNumber) { - if ((ret = sensors_get_value (chip, descriptor->alarmNumber, &tmp))) { - sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, descriptor->alarmNumber, sensors_strerror (ret)); - ret = 20; - } else { - alarms = (int) (tmp + 0.5); - } - } - if (!ret && descriptor->beepNumber) { - if ((ret = sensors_get_value (chip, descriptor->beepNumber, &tmp))) { - sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, descriptor->beepNumber, sensors_strerror (ret)); - ret = 21; - } else { - beeps = (int) (tmp + 0.5); - } - } for (index0 = 0; (ret == 0) && features[index0].format; ++ index0) { const FeatureDescriptor *feature = features + index0; int labelNumber = feature->dataNumbers[0]; - int alarm = alarms & feature->alarmMask; - int beep = beeps & feature->beepMask; + int alarm, beep; char *label = NULL; - if ((action == DO_SCAN) && !alarm) { - continue; - } else if (!(label = sensors_get_label (chip, labelNumber))) { + if (!(label = sensors_get_label (chip, labelNumber))) { sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); ret = 22; } else { double values[MAX_DATA]; + alarm = 0; + if (!ret && feature->alarmNumber != -1) { + if ((ret = sensors_get_value (chip, feature->alarmNumber, &tmp))) { + sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, feature->alarmNumber, sensors_strerror (ret)); + ret = 20; + } else { + alarm = (int) (tmp + 0.5); + } + } + if ((action == DO_SCAN) && !alarm) + continue; + + beep = 0; + if (!ret && feature->beepNumber != -1) { + if ((ret = sensors_get_value (chip, feature->beepNumber, &tmp))) { + sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, feature->beepNumber, sensors_strerror (ret)); + ret = 21; + } else { + beep = (int) (tmp + 0.5); + } + } + for (subindex = 0; !ret && (feature->dataNumbers[subindex] >= 0); ++ subindex) { if ((ret = sensors_get_value (chip, feature->dataNumbers[subindex], values + subindex))) { sensorLog (LOG_ERR, "Error getting sensor data: %s/#%d: %s", chip->prefix, feature->dataNumbers[subindex], sensors_strerror (ret)); diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index fa81ebd4..93bbbbe5 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -89,15 +89,13 @@ typedef struct { FormatterFN format; RRDFN rrd; DataType type; - int alarmMask; - int beepMask; + int alarmNumber; + int beepNumber; int dataNumbers[MAX_DATA + 1]; /* First entry is used for the label */ } FeatureDescriptor; typedef struct { FeatureDescriptor *features; - int alarmNumber; - int beepNumber; } ChipDescriptor; extern ChipDescriptor * generateChipDescriptor (const sensors_chip_name *chip); From 9cf1330eb002a228946ea85f651912f9cc682009 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 20 Sep 2007 21:23:19 +0000 Subject: [PATCH 284/718] Add support for beep features. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4826 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 3 +++ lib/sysfs.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/sensors.h b/lib/sensors.h index 13cea557..c7c5ffb4 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -132,12 +132,14 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_IN_ALARM = 0x010, SENSORS_FEATURE_IN_MIN_ALARM, SENSORS_FEATURE_IN_MAX_ALARM, + SENSORS_FEATURE_IN_BEEP, SENSORS_FEATURE_FAN = 0x100, SENSORS_FEATURE_FAN_MIN, SENSORS_FEATURE_FAN_ALARM = 0x110, SENSORS_FEATURE_FAN_FAULT, SENSORS_FEATURE_FAN_DIV, + SENSORS_FEATURE_FAN_BEEP, SENSORS_FEATURE_TEMP = 0x200, SENSORS_FEATURE_TEMP_MAX, @@ -152,6 +154,7 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_TEMP_FAULT, SENSORS_FEATURE_TEMP_TYPE, SENSORS_FEATURE_TEMP_OFFSET, + SENSORS_FEATURE_TEMP_BEEP, SENSORS_FEATURE_VID = 0x1000, diff --git a/lib/sysfs.c b/lib/sysfs.c index 5dc7f6da..8a2ac076 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -38,7 +38,7 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 20 -#define MAX_SUB_FEATURES 7 +#define MAX_SUB_FEATURES 8 /* Room for all 3 types (in, fan, temp) with all their subfeatures + VID + misc features */ #define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 \ From 49649fcf05ea71878dc41b73cff38a99e5219b57 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 20 Sep 2007 21:24:12 +0000 Subject: [PATCH 285/718] Restore support for beeps. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4827 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 421e5c5e..c7dcb0b0 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -168,9 +168,9 @@ static void fillChipVoltage (FeatureDescriptor *voltage, const sensors_chip_name *name, const sensors_feature_data *feature, int i) { - const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; - short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0, }; - int feature_nrs[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN]; + const int size = SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN; + short has_features[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN] = { 0, }; + int feature_nrs[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN]; int pos = 0; voltage->rrd = rrdF2; @@ -202,8 +202,12 @@ static void fillChipVoltage (FeatureDescriptor *voltage, } else { voltage->alarmNumber = -1; } - /* beep support missing for now */ - voltage->beepNumber = -1; + /* beep if applicable */ + if (IN_FEATURE(SENSORS_FEATURE_IN_BEEP)) { + voltage->beepNumber = IN_FEATURE_NR(SENSORS_FEATURE_IN_ALARM); + } else { + voltage->beepNumber = -1; + } } #define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] @@ -212,9 +216,9 @@ static void fillChipTemperature (FeatureDescriptor *temperature, const sensors_chip_name *name, const sensors_feature_data *feature, int i) { - const int size = SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP; - short has_features[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP] = { 0, }; - int feature_nrs[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP]; + const int size = SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP; + short has_features[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP] = { 0, }; + int feature_nrs[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP]; int pos = 0; temperature->rrd = rrdF1; @@ -249,8 +253,12 @@ static void fillChipTemperature (FeatureDescriptor *temperature, } else { temperature->alarmNumber = -1; } - /* beep support missing for now */ - temperature->beepNumber = -1; + /* beep if applicable */ + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_BEEP)) { + temperature->beepNumber = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_BEEP); + } else { + temperature->beepNumber = -1; + } } #define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] @@ -259,9 +267,9 @@ static void fillChipFan (FeatureDescriptor *fan, const sensors_chip_name *name, const sensors_feature_data *feature, int i) { - const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; - short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0, }; - int feature_nrs[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN]; + const int size = SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN; + short has_features[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN] = { 0, }; + int feature_nrs[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN]; int pos = 0; fan->rrd = rrdF0; @@ -292,8 +300,12 @@ static void fillChipFan (FeatureDescriptor *fan, } else { fan->alarmNumber = -1; } - /* beep support missing for now */ - fan->beepNumber = -1; + /* beep if applicable */ + if (FAN_FEATURE(SENSORS_FEATURE_FAN_BEEP)) { + fan->beepNumber = FAN_FEATURE_NR(SENSORS_FEATURE_FAN_BEEP); + } else { + fan->beepNumber = -1; + } } static void fillChipVid (FeatureDescriptor *vid, From 5bd020ad9226b17eae724e44d99941a2492ecaf7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 21 Sep 2007 12:15:18 +0000 Subject: [PATCH 286/718] Scan chip features only once at initialization time, rather than on each update. The chip list and chip features do not change until sensors_cleanup() is called, so there's no point in doing the same work over and over again. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4828 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 52 ++++++++++++++++++++++++++++++++++-------- prog/sensord/lib.c | 14 ++++++++++-- prog/sensord/rrd.c | 17 +++++++++----- prog/sensord/sense.c | 18 +++++++++------ prog/sensord/sensord.h | 5 +++- 5 files changed, 80 insertions(+), 26 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index c7dcb0b0..e7d5c60d 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -332,12 +332,11 @@ static void fillChipBeepEnable (FeatureDescriptor *beepen, beepen->dataNumbers[1] = -1; } -/* Note that alarms and beeps are no longer (or not yet) supported */ -ChipDescriptor * generateChipDescriptor (const sensors_chip_name *chip) +static +FeatureDescriptor * generateChipFeatures (const sensors_chip_name *chip) { int nr, count = 1; const sensors_feature_data *sensor; - ChipDescriptor *descriptor; FeatureDescriptor *features; /* How many main features do we have? */ @@ -348,14 +347,9 @@ ChipDescriptor * generateChipDescriptor (const sensors_chip_name *chip) } /* Allocate the memory we need */ - descriptor = calloc(1, sizeof(ChipDescriptor)); features = calloc(count, sizeof(FeatureDescriptor)); - if (!descriptor || !features) { - free(descriptor); - free(features); + if (!features) return NULL; - } - descriptor->features = features; /* Fill in the data structures */ count = 0; @@ -387,5 +381,43 @@ ChipDescriptor * generateChipDescriptor (const sensors_chip_name *chip) count++; } - return descriptor; + return features; +} + +ChipDescriptor * knownChips; + +int initKnownChips (void) +{ + int nr, count = 1; + const sensors_chip_name *name; + + /* How many chips do we have? */ + nr = 0; + while ((name = sensors_get_detected_chips(NULL, &nr))) + count++; + + /* Allocate the memory we need */ + knownChips = calloc(count, sizeof(ChipDescriptor)); + if (!knownChips) + return 1; + + /* Fill in the data structures */ + count = 0; + nr = 0; + while ((name = sensors_get_detected_chips(NULL, &nr))) { + knownChips[count].name = name; + if ((knownChips[count].features = generateChipFeatures(name))) + count++; + } + + return 0; +} + +void freeKnownChips (void) +{ + int index0; + + for (index0 = 0; knownChips[index0].features; index0++) + free (knownChips[index0].features); + free (knownChips); } diff --git a/prog/sensord/lib.c b/prog/sensord/lib.c index a3b2b0ac..d5459d63 100644 --- a/prog/sensord/lib.c +++ b/prog/sensord/lib.c @@ -116,18 +116,28 @@ loadConfig int loadLib (void) { - return loadConfig (0); + int ret; + ret = loadConfig (0); + if (!ret) + ret = initKnownChips (); + return ret; } int reloadLib (void) { - return loadConfig (1); + int ret; + freeKnownChips (); + ret = loadConfig (1); + if (!ret) + ret = initKnownChips (); + return ret; } int unloadLib (void) { + freeKnownChips (); sensors_cleanup (); return 0; } diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index ce0259cd..81885fa5 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -141,11 +141,18 @@ applyToFeatures for (j = 0; (ret == 0) && (j < numChipNames); ++ j) { while ((ret == 0) && ((chip = sensors_get_detected_chips (&chipNames[j], &i)) != NULL)) { - ChipDescriptor *descriptor; - descriptor = generateChipDescriptor (chip); - if (descriptor) { + int index0, chipindex = -1; + for (index0 = 0; knownChips[index0].features; ++ index0) + /* Trick: we compare addresses here. We know it works because both + pointers were returned by sensors_get_detected_chips(), so they + refer to libsensors internal structures, which do not move. */ + if (knownChips[index0].name == chip) { + chipindex = index0; + break; + } + if (chipindex >= 0) { + const ChipDescriptor *descriptor = &knownChips[chipindex]; const FeatureDescriptor *features = descriptor->features; - int index0; for (index0 = 0; (ret == 0) && (num < MAX_RRD_SENSORS) && features[index0].format; ++ index0) { const FeatureDescriptor *feature = features + index0; @@ -167,8 +174,6 @@ applyToFeatures if (label) free (label); } - free (descriptor->features); - free (descriptor); } } } diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index 14a816d6..ea6ef8cb 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -168,13 +168,17 @@ doChip if (action == DO_SET) { ret = setChip (chip); } else { - ChipDescriptor *descriptor; - descriptor = generateChipDescriptor (chip); - if (descriptor) { - ret = doKnownChip (chip, descriptor, action); - free (descriptor->features); - free (descriptor); - } + int index0, chipindex = -1; + for (index0 = 0; knownChips[index0].features; ++ index0) + /* Trick: we compare addresses here. We know it works because both + pointers were returned by sensors_get_detected_chips(), so they + refer to libsensors internal structures, which do not move. */ + if (knownChips[index0].name == chip) { + chipindex = index0; + break; + } + if (chipindex >= 0) + ret = doKnownChip (chip, &knownChips[chipindex], action); } return ret; } diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index 93bbbbe5..eee402a0 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -95,7 +95,10 @@ typedef struct { } FeatureDescriptor; typedef struct { + const sensors_chip_name *name; FeatureDescriptor *features; } ChipDescriptor; -extern ChipDescriptor * generateChipDescriptor (const sensors_chip_name *chip); +extern ChipDescriptor * knownChips; +extern int initKnownChips (void); +extern void freeKnownChips (void); From 60b50b6cb96b982b640764d421ba0a13b2beb06d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 21 Sep 2007 18:15:32 +0000 Subject: [PATCH 287/718] Fix compilation breakage with non-C99 compilers. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4829 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 8a2ac076..0e7993a8 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -163,7 +163,6 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, struct dlist *attrs; sensors_chip_feature *features; sensors_chip_feature *dyn_features; - char *name; attrs = sysfs_get_device_attributes(sysdir); @@ -178,7 +177,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, sensors_fatal_error(__FUNCTION__, "Out of memory"); dlist_for_each_data(attrs, attr, struct sysfs_attribute) { - name = attr->name; + char *name = attr->name; int nr; type = sensors_feature_get_type(name, &nr); From 08a686e3cc35992ffe6de3be3d085edb34517547 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 11:59:51 +0000 Subject: [PATCH 288/718] sensors_feature_data and sensors_chip_feature are now the exact same structure, so we can get rid of the former for simpler code. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4830 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 64 +++++++++++++++++++++++++-------------------------- lib/access.h | 2 +- lib/data.h | 18 +-------------- lib/init.c | 2 +- lib/sensors.h | 14 +++++++++-- lib/sysfs.c | 58 +++++++++++++++++++++++----------------------- 6 files changed, 76 insertions(+), 82 deletions(-) diff --git a/lib/access.c b/lib/access.c index f8340f34..1de8e4af 100644 --- a/lib/access.c +++ b/lib/access.c @@ -89,7 +89,7 @@ sensors_for_all_config_chips(const sensors_chip_name *name, /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ -const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, +const sensors_feature_data *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature) { int i; @@ -107,17 +107,17 @@ const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *c /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ -static const sensors_chip_feature * +static const sensors_feature_data * sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) { int i, j; - const sensors_chip_feature *features; + const sensors_feature_data *features; for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { features = sensors_proc_chips[i].feature; for (j = 0; j < sensors_proc_chips[i].feature_count; j++) - if (!strcmp(features[j].data.name, feature)) + if (!strcmp(features[j].name, feature)) return features + j; } return NULL; @@ -145,7 +145,7 @@ char *sensors_get_label(const sensors_chip_name *name, int feature) { char *label; const sensors_chip *chip; - const sensors_chip_feature *featureptr; + const sensors_feature_data *featureptr; char buf[128], path[PATH_MAX]; FILE *f; int i; @@ -157,14 +157,14 @@ char *sensors_get_label(const sensors_chip_name *name, int feature) for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->labels_count; i++) - if (!strcmp(featureptr->data.name, chip->labels[i].name)) { + if (!strcmp(featureptr->name, chip->labels[i].name)) { label = strdup(chip->labels[i].value); goto sensors_get_label_exit; } /* No user specified label, check for a _label sysfs file */ snprintf(path, PATH_MAX, "%s/%s_label", name->path, - featureptr->data.name); + featureptr->name); if ((f = fopen(path, "r"))) { i = fread(buf, 1, sizeof(buf) - 1, f); @@ -178,7 +178,7 @@ char *sensors_get_label(const sensors_chip_name *name, int feature) } /* No label, return the feature name instead */ - label = strdup(featureptr->data.name); + label = strdup(featureptr->name); sensors_get_label_exit: if (!label) @@ -191,21 +191,21 @@ sensors_get_label_exit: 1 if it should be ignored, 0 if not. This function takes mappings into account. */ static int sensors_get_ignored(const sensors_chip_name *name, - const sensors_chip_feature *feature) + const sensors_feature_data *feature) { const sensors_chip *chip; const char *main_feature_name; int i; - if (feature->data.mapping == SENSORS_NO_MAPPING) + if (feature->mapping == SENSORS_NO_MAPPING) main_feature_name = NULL; else main_feature_name = sensors_lookup_feature_nr(name, - feature->data.mapping)->data.name; + feature->mapping)->name; for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->ignores_count; i++) - if (!strcmp(feature->data.name, chip->ignores[i].name) || + if (!strcmp(feature->name, chip->ignores[i].name) || (main_feature_name && !strcmp(main_feature_name, chip->ignores[i].name))) return 1; @@ -218,8 +218,8 @@ static int sensors_get_ignored(const sensors_chip_name *name, int sensors_get_value(const sensors_chip_name *name, int feature, double *result) { - const sensors_chip_feature *main_feature; - const sensors_chip_feature *alt_feature; + const sensors_feature_data *main_feature; + const sensors_feature_data *alt_feature; const sensors_chip *chip; const sensors_expr *expr = NULL; double val; @@ -231,21 +231,21 @@ int sensors_get_value(const sensors_chip_name *name, int feature, if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; - if (main_feature->data.flags & SENSORS_COMPUTE_MAPPING) + if (main_feature->flags & SENSORS_COMPUTE_MAPPING) alt_feature = sensors_lookup_feature_nr(name, - main_feature->data.mapping); + main_feature->mapping); else alt_feature = NULL; - if (!(main_feature->data.flags & SENSORS_MODE_R)) + if (!(main_feature->flags & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) { - if (!strcmp(main_feature->data.name, chip->computes[i].name)) { + if (!strcmp(main_feature->name, chip->computes[i].name)) { expr = chip->computes[i].from_proc; final_expr = 1; - } else if (alt_feature && !strcmp(alt_feature->data.name, + } else if (alt_feature && !strcmp(alt_feature->name, chip->computes[i].name)) { expr = chip->computes[i].from_proc; } @@ -265,8 +265,8 @@ int sensors_get_value(const sensors_chip_name *name, int feature, int sensors_set_value(const sensors_chip_name *name, int feature, double value) { - const sensors_chip_feature *main_feature; - const sensors_chip_feature *alt_feature; + const sensors_feature_data *main_feature; + const sensors_feature_data *alt_feature; const sensors_chip *chip; const sensors_expr *expr = NULL; int i, res; @@ -278,21 +278,21 @@ int sensors_set_value(const sensors_chip_name *name, int feature, if (!(main_feature = sensors_lookup_feature_nr(name, feature))) return -SENSORS_ERR_NO_ENTRY; - if (main_feature->data.flags & SENSORS_COMPUTE_MAPPING) + if (main_feature->flags & SENSORS_COMPUTE_MAPPING) alt_feature = sensors_lookup_feature_nr(name, - main_feature->data.mapping); + main_feature->mapping); else alt_feature = NULL; - if (!(main_feature->data.flags & SENSORS_MODE_W)) + if (!(main_feature->flags & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) - if (!strcmp(main_feature->data.name, chip->computes[i].name)) { + if (!strcmp(main_feature->name, chip->computes[i].name)) { expr = chip->computes->to_proc; final_expr = 1; - } else if (alt_feature && !strcmp(alt_feature->data.name, + } else if (alt_feature && !strcmp(alt_feature->name, chip->computes[i].name)) { expr = chip->computes[i].to_proc; } @@ -347,7 +347,7 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus) const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *name, int *nr) { - sensors_chip_feature *feature_list; + sensors_feature_data *feature_list; int i; for (i = 0; i < sensors_proc_chips_count; i++) @@ -358,7 +358,7 @@ const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *na (*nr)++; if (*nr == sensors_proc_chips[i].feature_count) return NULL; - return &feature_list[(*nr)++].data; + return &feature_list[(*nr)++]; } return NULL; } @@ -370,7 +370,7 @@ int sensors_eval_expr(const sensors_chip_name *name, { double res1, res2; int res; - const sensors_chip_feature *feature; + const sensors_feature_data *feature; if (expr->kind == sensors_kind_val) { *result = expr->data.val; @@ -384,7 +384,7 @@ int sensors_eval_expr(const sensors_chip_name *name, if (!(feature = sensors_lookup_feature_name(name, expr->data.var))) return SENSORS_ERR_NO_ENTRY; - if (!(res = sensors_get_value(name, feature->data.number, result))) + if (!(res = sensors_get_value(name, feature->number, result))) return res; return 0; } @@ -432,7 +432,7 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) double value; int i, j; int err = 0, res; - const sensors_chip_feature *feature; + const sensors_feature_data *feature; int *feature_list = NULL; int feature_count = 0; int feature_max = 0; @@ -448,7 +448,7 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) err = SENSORS_ERR_NO_ENTRY; continue; } - feature_nr = feature->data.number; + feature_nr = feature->number; /* Check whether we already set this feature */ for (j = 0; j < feature_count; j++) diff --git a/lib/access.h b/lib/access.h index e2073c4a..1aabbdf0 100644 --- a/lib/access.h +++ b/lib/access.h @@ -26,7 +26,7 @@ /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found. */ -const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, +const sensors_feature_data *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature); /* Check whether the chip name is an 'absolute' name, which can only match diff --git a/lib/data.h b/lib/data.h index cd1b6806..c6d47fdd 100644 --- a/lib/data.h +++ b/lib/data.h @@ -120,26 +120,10 @@ typedef struct sensors_bus { int lineno; } sensors_bus; -/* Internal data about a single chip feature. - name is the string name used to refer to this feature (both in config - files and through user functions); - number is the internal feature number, used in many functions to refer - to this feature - mapping is either SENSORS_NO_MAPPING if this is feature is the - main element of category; or it is the number of a feature with which - this feature is logically grouped (a group could be fan, fan_max and - fan_div) - flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable), - SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the - computation rules of the main feature). */ -typedef struct sensors_chip_feature { - sensors_feature_data data; -} sensors_chip_feature; - /* Internal data about all features of a type of chip */ typedef struct sensors_chip_features { struct sensors_chip_name chip; - struct sensors_chip_feature *feature; + struct sensors_feature_data *feature; int feature_count; } sensors_chip_features; diff --git a/lib/init.c b/lib/init.c index 746fb67b..b956ecb6 100644 --- a/lib/init.c +++ b/lib/init.c @@ -57,7 +57,7 @@ static void free_chip_features(sensors_chip_features *features) int i; for (i = 0; i < features->feature_count; i++) - free(features->feature[i].data.name); + free(features->feature[i].name); free(features->feature); } diff --git a/lib/sensors.h b/lib/sensors.h index c7c5ffb4..d734224e 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -163,8 +163,18 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_UNKNOWN = INT_MAX, } sensors_feature_type; -/* This structure is used when you want to get all features of a specific - chip. */ +/* Data about a single chip feature: + name is the string name used to refer to this feature (in config files) + number is the internal feature number, used in many functions to refer + to this feature + type is the feature or subfeature type + mapping is either SENSORS_NO_MAPPING if this is feature is the + main element of category; or it is the number of a feature with which + this subfeature is logically grouped (a group could be fan, fan_min + and fan_div) + flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable), + SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the + computation rules of the main feature) */ typedef struct sensors_feature_data { char *name; int number; diff --git a/lib/sysfs.c b/lib/sysfs.c index 0e7993a8..b4341f1d 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -161,8 +161,8 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, int i, type, fnum = 0; struct sysfs_attribute *attr; struct dlist *attrs; - sensors_chip_feature *features; - sensors_chip_feature *dyn_features; + sensors_feature_data *features; + sensors_feature_data *dyn_features; attrs = sysfs_get_device_attributes(sysdir); @@ -172,7 +172,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* We use a large sparse table at first to store all found features, so that we can store them sorted at type and index and then later create a dense sorted table. */ - features = calloc(ALL_POSSIBLE_FEATURES, sizeof(sensors_chip_feature)); + features = calloc(ALL_POSSIBLE_FEATURES, sizeof(sensors_feature_data)); if (!features) sensors_fatal_error(__FUNCTION__, "Out of memory"); @@ -217,7 +217,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, (type & 0x0F); } - if (features[i].data.name) { + if (features[i].name) { fprintf(stderr, "libsensors error, trying to add dupli" "cate feature: %s to dynamic feature table\n", name); @@ -225,29 +225,29 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } /* fill in the feature members */ - features[i].data.type = type; + features[i].type = type; /* check for _input extension and remove */ nr = strlen(name); if (nr > 6 && !strcmp(name + nr - 6, "_input")) - features[i].data.name = strndup(name, nr - 6); + features[i].name = strndup(name, nr - 6); else - features[i].data.name = strdup(name); + features[i].name = strdup(name); if ((type & 0x00FF) == 0) { /* main feature */ - features[i].data.mapping = SENSORS_NO_MAPPING; + features[i].mapping = SENSORS_NO_MAPPING; } else { /* sub feature */ /* The mapping is set below after numbering */ if (!(type & 0x10)) - features[i].data.flags |= SENSORS_COMPUTE_MAPPING; + features[i].flags |= SENSORS_COMPUTE_MAPPING; } if (attr->method & SYSFS_METHOD_SHOW) - features[i].data.flags |= SENSORS_MODE_R; + features[i].flags |= SENSORS_MODE_R; if (attr->method & SYSFS_METHOD_STORE) - features[i].data.flags |= SENSORS_MODE_W; + features[i].flags |= SENSORS_MODE_W; fnum++; } @@ -257,14 +257,14 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, goto exit_free; } - dyn_features = calloc(fnum, sizeof(sensors_chip_feature)); + dyn_features = calloc(fnum, sizeof(sensors_feature_data)); if (dyn_features == NULL) { sensors_fatal_error(__FUNCTION__, "Out of memory"); } fnum = 0; for (i = 0; i < ALL_POSSIBLE_FEATURES; i++) { - if (features[i].data.name) { + if (features[i].name) { dyn_features[fnum] = features[i]; fnum++; } @@ -275,14 +275,14 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, for (i = 0; i < fnum; i++) { int j; - dyn_features[i].data.number = i; - if (dyn_features[i].data.mapping == SENSORS_NO_MAPPING) { + dyn_features[i].number = i; + if (dyn_features[i].mapping == SENSORS_NO_MAPPING) { /* Main feature, set the mapping field of all its subfeatures */ for (j = i + 1; j < fnum && - dyn_features[j].data.mapping != SENSORS_NO_MAPPING; + dyn_features[j].mapping != SENSORS_NO_MAPPING; j++) - dyn_features[j].data.mapping = i; + dyn_features[j].mapping = i; } } @@ -513,7 +513,7 @@ exit0: int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, double *value) { - const sensors_chip_feature *the_feature; + const sensors_feature_data *the_feature; char n[NAME_MAX]; FILE *f; const char *suffix = ""; @@ -522,19 +522,19 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ - if (the_feature->data.type == SENSORS_FEATURE_IN - || the_feature->data.type == SENSORS_FEATURE_FAN - || the_feature->data.type == SENSORS_FEATURE_TEMP) + if (the_feature->type == SENSORS_FEATURE_IN + || the_feature->type == SENSORS_FEATURE_FAN + || the_feature->type == SENSORS_FEATURE_TEMP) suffix = "_input"; - snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->data.name, + snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->name, suffix); if ((f = fopen(n, "r"))) { int res = fscanf(f, "%lf", value); fclose(f); if (res != 1) return -SENSORS_ERR_PROC; - *value /= get_type_scaling(the_feature->data.type); + *value /= get_type_scaling(the_feature->type); } else return -SENSORS_ERR_PROC; @@ -544,7 +544,7 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, double value) { - const sensors_chip_feature *the_feature; + const sensors_feature_data *the_feature; char n[NAME_MAX]; FILE *f; const char *suffix = ""; @@ -553,15 +553,15 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ - if (the_feature->data.type == SENSORS_FEATURE_IN - || the_feature->data.type == SENSORS_FEATURE_FAN - || the_feature->data.type == SENSORS_FEATURE_TEMP) + if (the_feature->type == SENSORS_FEATURE_IN + || the_feature->type == SENSORS_FEATURE_FAN + || the_feature->type == SENSORS_FEATURE_TEMP) suffix = "_input"; - snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->data.name, + snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->name, suffix); if ((f = fopen(n, "w"))) { - value *= get_type_scaling(the_feature->data.type); + value *= get_type_scaling(the_feature->type); fprintf(f, "%d", (int) value); fclose(f); } else From eba601a964cc55d44274e04d29d47610e224675b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:00:59 +0000 Subject: [PATCH 289/718] Split sensors_get_all_features() into two distinct functions, one to get the list of all main features, and one to get the list of all the subfeatures of a given main feature. This is a more logical interface for applications to use. The current implementation is admittedly less than optimal, because the storage structures weren't meant for it, but this issue can (and will) be addressed later. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4831 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 35 +++++++++++++++++++-- lib/libsensors.3 | 28 +++++++++++------ lib/sensors.h | 22 ++++++++----- prog/sensord/chips.c | 35 +++++++++------------ prog/sensord/sense.c | 25 ++++++++------- prog/sensors/chips.c | 75 ++++++++++++++++++++++---------------------- 6 files changed, 130 insertions(+), 90 deletions(-) diff --git a/lib/access.c b/lib/access.c index 1de8e4af..44f9c611 100644 --- a/lib/access.c +++ b/lib/access.c @@ -343,9 +343,8 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus) return NULL; } -/* nr-1 is the last feature returned */ -const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *name, - int *nr) +static const sensors_feature_data * +sensors_get_all_features(const sensors_chip_name *name, int *nr) { sensors_feature_data *feature_list; int i; @@ -363,6 +362,36 @@ const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *na return NULL; } +const sensors_feature_data * +sensors_get_features(const sensors_chip_name *name, int *nr) +{ + const sensors_feature_data *feature; + + while ((feature = sensors_get_all_features(name, nr))) { + if (feature->mapping == SENSORS_NO_MAPPING) + return feature; + } + return NULL; /* end of list */ +} + +const sensors_feature_data * +sensors_get_all_subfeatures(const sensors_chip_name *name, int feature, int *nr) +{ + const sensors_feature_data *subfeature; + + /* Seek directly to the first subfeature */ + if (*nr < feature) + *nr = feature; + + subfeature = sensors_get_all_features(name, nr); + if (!subfeature) + return NULL; /* end of list */ + if (subfeature->number == feature || + subfeature->mapping == feature) + return subfeature; + return NULL; /* end of subfeature list */ +} + /* Evaluate an expression */ int sensors_eval_expr(const sensors_chip_name *name, const sensors_expr *expr, diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 43a8f2c1..94f7ea4d 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -44,8 +44,10 @@ libsensors \- publicly accessible functions provided by the sensors library .B int sensors_do_chip_sets(const sensors_chip_name *name); .B const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name \fB*match, int *nr);\fP -.B const sensors_feature_data *sensors_get_all_features +.B const sensors_feature_data *sensors_get_features \fB(const sensors_chip_name *name, int *nr);\fP +.B const sensors_feature_data *sensors_get_all_subfeatures + \fB(const sensors_chip_name *name, int feature, int *nr);\fP .B const char *libsensors_version; .fi .SH DESCRIPTION @@ -121,16 +123,22 @@ The flags field is a bitfield, its value is a combination of SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the computation rules of the main feature). -\fBconst sensors_feature_data *sensors_get_all_features - (const sensors_chip_name *name, int *nr);\fP +\fBconst sensors_feature_data *sensors_get_features(const sensors_chip_name *name, int *nr);\fP .br -This returns all features of a specific chip. They are returned in bunches: -everything with the same mapping is returned just after each other, with -the master feature in front (that feature does not map to itself, but -has SENSORS_NO_MAPPING as mapping field). nr is an internally used variable. -Set it to zero to start again at the begin of the list. If no more features -are found NULL is returned. Do not try to change the returned structure; you -will corrupt internal data structures. +This returns all main features of a specific chip. nr is an internally +used variable. Set it to zero to start at the begin of the list. If no +more features are found NULL is returned. +Do not try to change the returned structure; you will corrupt internal +data structures. + +\fBconst sensors_feature_data *sensors_get_all_subfeatures(const sensors_chip_name *name, int feature, int *nr);\fP +.br +This returns all subfeatures of a given main feature (including that +main feature itself, in first position.) nr is an internally used +variable. Set it to zero to start at the begin of the list. If no more +features are found NULL is returned. +Do not try to change the returned structure; you will corrupt internal +data structures. \fBconst char *libsensors_version;\fP .br diff --git a/lib/sensors.h b/lib/sensors.h index d734224e..81c465aa 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -183,16 +183,22 @@ typedef struct sensors_feature_data { unsigned int flags; } sensors_feature_data; -/* This returns all features of a specific chip. They are returned in - bunches: everything with the same mapping is returned just after each - other, with the master feature in front (that feature does not map to - itself, but has SENSORS_NO_MAPPING as mapping field). nr is - an internally used variable. Set it to zero to start again at the - begin of the list. If no more features are found NULL is returned. +/* This returns all main features of a specific chip. nr is an internally + used variable. Set it to zero to start at the begin of the list. If no + more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. */ -const sensors_feature_data *sensors_get_all_features - (const sensors_chip_name *name, int *nr); +const sensors_feature_data * +sensors_get_features(const sensors_chip_name *name, int *nr); + +/* This returns all subfeatures of a given main feature (including that + main feature itself, in first position.) nr is an internally used + variable. Set it to zero to start at the begin of the list. If no more + features are found NULL is returned. + Do not try to change the returned structure; you will corrupt internal + data structures. */ +const sensors_feature_data * +sensors_get_all_subfeatures(const sensors_chip_name *name, int feature, int *nr); #ifdef __cplusplus } diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index e7d5c60d..529553f4 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -142,14 +142,14 @@ rrdF3 static void getAvailableFeatures (const sensors_chip_name *name, const sensors_feature_data *feature, - int i, short *has_features, + short *has_features, int *feature_nrs, int size, int first_val) { const sensors_feature_data *iter; + int i = 0; - while ((iter = sensors_get_all_features (name, &i)) && - iter->mapping == feature->number) { + while ((iter = sensors_get_all_subfeatures(name, feature->number, &i))) { int index0; index0 = iter->type - first_val - 1; @@ -166,7 +166,7 @@ static void getAvailableFeatures (const sensors_chip_name *name, #define IN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_IN - 1] static void fillChipVoltage (FeatureDescriptor *voltage, const sensors_chip_name *name, - const sensors_feature_data *feature, int i) + const sensors_feature_data *feature) { const int size = SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN; short has_features[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN] = { 0, }; @@ -177,7 +177,7 @@ static void fillChipVoltage (FeatureDescriptor *voltage, voltage->type = DataType_voltage; voltage->dataNumbers[pos++] = feature->number; - getAvailableFeatures (name, feature, i, has_features, + getAvailableFeatures (name, feature, has_features, feature_nrs, size, SENSORS_FEATURE_IN); if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && @@ -214,7 +214,7 @@ static void fillChipVoltage (FeatureDescriptor *voltage, #define TEMP_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_TEMP - 1] static void fillChipTemperature (FeatureDescriptor *temperature, const sensors_chip_name *name, - const sensors_feature_data *feature, int i) + const sensors_feature_data *feature) { const int size = SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP; short has_features[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP] = { 0, }; @@ -225,7 +225,7 @@ static void fillChipTemperature (FeatureDescriptor *temperature, temperature->type = DataType_temperature; temperature->dataNumbers[pos++] = feature->number; - getAvailableFeatures (name, feature, i, has_features, + getAvailableFeatures (name, feature, has_features, feature_nrs, size, SENSORS_FEATURE_TEMP); if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN) && @@ -265,7 +265,7 @@ static void fillChipTemperature (FeatureDescriptor *temperature, #define FAN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_FAN - 1] static void fillChipFan (FeatureDescriptor *fan, const sensors_chip_name *name, - const sensors_feature_data *feature, int i) + const sensors_feature_data *feature) { const int size = SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN; short has_features[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN] = { 0, }; @@ -276,7 +276,7 @@ static void fillChipFan (FeatureDescriptor *fan, fan->type = DataType_rpm; fan->dataNumbers[pos++] = feature->number; - getAvailableFeatures (name, feature, i, has_features, + getAvailableFeatures (name, feature, has_features, feature_nrs, size, SENSORS_FEATURE_FAN); if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) { @@ -341,10 +341,8 @@ FeatureDescriptor * generateChipFeatures (const sensors_chip_name *chip) /* How many main features do we have? */ nr = 0; - while ((sensor = sensors_get_all_features(chip, &nr))) { - if (sensor->mapping == SENSORS_NO_MAPPING) - count++; - } + while ((sensor = sensors_get_features(chip, &nr))) + count++; /* Allocate the memory we need */ features = calloc(count, sizeof(FeatureDescriptor)); @@ -354,19 +352,16 @@ FeatureDescriptor * generateChipFeatures (const sensors_chip_name *chip) /* Fill in the data structures */ count = 0; nr = 0; - while ((sensor = sensors_get_all_features(chip, &nr))) { - if (sensor->mapping != SENSORS_NO_MAPPING) - continue; - + while ((sensor = sensors_get_features(chip, &nr))) { switch (sensor->type) { case SENSORS_FEATURE_TEMP: - fillChipTemperature(&features[count], chip, sensor, nr); + fillChipTemperature(&features[count], chip, sensor); break; case SENSORS_FEATURE_IN: - fillChipVoltage(&features[count], chip, sensor, nr); + fillChipVoltage(&features[count], chip, sensor); break; case SENSORS_FEATURE_FAN: - fillChipFan(&features[count], chip, sensor, nr); + fillChipFan(&features[count], chip, sensor); break; case SENSORS_FEATURE_VID: fillChipVid(&features[count], sensor); diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index ea6ef8cb..7861fa54 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -36,18 +36,21 @@ int getRawLabel (const sensors_chip_name *name, int feature, const char **label) { - const sensors_feature_data *rawFeature; - int nr = 0, err = 0; - do { - rawFeature = sensors_get_all_features (name, &nr); - } while (rawFeature && (rawFeature->number != feature)); - /* TODO: Ensure labels match RRD construct and are not repeated! */ - if (!rawFeature) { - err = -1; - } else { - *label = rawFeature->name; + const sensors_feature_data *mainfeat, *sub; + int a, b; + + a = 0; + while ((mainfeat = sensors_get_features(name, &a))) { + b = 0; + while ((sub = sensors_get_all_subfeatures(name, mainfeat->number, &b))) { + if (sub->number == feature) { + *label = sub->name; + return 0; + } + } } - return err; + /* TODO: Ensure labels match RRD construct and are not repeated! */ + return -1; } static const char * diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index bcd0b518..83d113c9 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -30,30 +30,34 @@ void print_chip_raw(const sensors_chip_name *name) { - int a; - const sensors_feature_data *data; + int a, b; + const sensors_feature_data *feature, *sub; char *label; double val; a = 0; - while ((data = sensors_get_all_features(name, &a))) { - if (!(label = sensors_get_label(name, data->number))) { - printf("ERROR: Can't get feature `%s' label!\n", - data->name); - continue; + while ((feature = sensors_get_features(name, &a))) { + b = 0; + while ((sub = sensors_get_all_subfeatures(name, feature->number, + &b))) { + if (!(label = sensors_get_label(name, sub->number))) { + printf("ERROR: Can't get feature `%s' label!\n", + sub->name); + continue; + } + if (sub->flags & SENSORS_MODE_R) { + if (sensors_get_value(name, sub->number, &val)) + printf("ERROR: Can't get feature `%s' " + "data!\n", sub->name); + else if (sub->mapping != SENSORS_NO_MAPPING) + printf(" %s: %.2f\n", label, val); + else + printf("%s: %.2f (%s)\n", label, val, + sub->name); + } else + printf("(%s)\n", label); + free(label); } - if (data->flags & SENSORS_MODE_R) { - if (sensors_get_value(name, data->number, &val)) - printf("ERROR: Can't get feature `%s' data!\n", - data->name); - else if (data->mapping != SENSORS_NO_MAPPING) - printf(" %s: %.2f\n", label, val); - else - printf("%s: %.2f (%s)\n", label, val, - data->name); - } else - printf("(%s)\n", label); - free(label); } } @@ -70,14 +74,14 @@ static void print_label(const char *label, int space) static void sensors_get_available_features(const sensors_chip_name *name, const sensors_feature_data *feature, - int i, short *has_features, + short *has_features, double *feature_vals, int size, int first_val) { const sensors_feature_data *iter; + int i = 0; - while ((iter = sensors_get_all_features(name, &i)) && - iter->mapping == feature->number) { + while ((iter = sensors_get_all_subfeatures(name, feature->number, &i))) { int indx, err; indx = iter->type - first_val - 1; @@ -104,9 +108,7 @@ static int sensors_get_label_size(const sensors_chip_name *name) unsigned int max_size = 11; /* 11 as minumum label width */ i = 0; - while ((iter = sensors_get_all_features(name, &i))) { - if (iter->mapping != SENSORS_NO_MAPPING) - continue; + while ((iter = sensors_get_features(name, &i))) { if ((label = sensors_get_label(name, iter->number)) && strlen(label) > max_size) max_size = strlen(label); @@ -141,7 +143,7 @@ static void print_temp_limits(double limit1, double limit2, #define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] #define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] static void print_chip_temp(const sensors_chip_name *name, - const sensors_feature_data *feature, int i, + const sensors_feature_data *feature, int label_size) { double val, limit1, limit2; @@ -163,7 +165,7 @@ static void print_chip_temp(const sensors_chip_name *name, return; } - sensors_get_available_features(name, feature, i, has_features, + sensors_get_available_features(name, feature, has_features, feature_vals, size, SENSORS_FEATURE_TEMP); @@ -279,7 +281,7 @@ static void print_chip_temp(const sensors_chip_name *name, #define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] #define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] static void print_chip_in(const sensors_chip_name *name, - const sensors_feature_data *feature, int i, + const sensors_feature_data *feature, int label_size) { const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; @@ -299,7 +301,7 @@ static void print_chip_in(const sensors_chip_name *name, return; } - sensors_get_available_features(name, feature, i, has_features, + sensors_get_available_features(name, feature, has_features, feature_vals, size, SENSORS_FEATURE_IN); print_label(label, label_size); @@ -344,7 +346,7 @@ static void print_chip_in(const sensors_chip_name *name, #define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] #define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] static void print_chip_fan(const sensors_chip_name *name, - const sensors_feature_data *feature, int i, + const sensors_feature_data *feature, int label_size) { char *label; @@ -367,7 +369,7 @@ static void print_chip_fan(const sensors_chip_name *name, print_label(label, label_size); free(label); - sensors_get_available_features(name, feature, i, has_features, + sensors_get_available_features(name, feature, has_features, feature_vals, size, SENSORS_FEATURE_FAN); if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && @@ -432,19 +434,16 @@ void print_chip(const sensors_chip_name *name) label_size = sensors_get_label_size(name); i = 0; - while ((feature = sensors_get_all_features(name, &i))) { - if (feature->mapping != SENSORS_NO_MAPPING) - continue; - + while ((feature = sensors_get_features(name, &i))) { switch (feature->type) { case SENSORS_FEATURE_TEMP: - print_chip_temp(name, feature, i, label_size); + print_chip_temp(name, feature, label_size); break; case SENSORS_FEATURE_IN: - print_chip_in(name, feature, i, label_size); + print_chip_in(name, feature, label_size); break; case SENSORS_FEATURE_FAN: - print_chip_fan(name, feature, i, label_size); + print_chip_fan(name, feature, label_size); break; case SENSORS_FEATURE_VID: print_chip_vid(name, feature->number, label_size); From 79086fb7b845486e02868d1333c40714726bb3eb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:02:22 +0000 Subject: [PATCH 290/718] Rename struct sensors_feature_data to sensors_subfeature. This is a first step towards a clean separation between main features and subfeatures. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4832 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 56 ++++++++++++++++++++++---------------------- lib/access.h | 2 +- lib/data.h | 4 ++-- lib/init.c | 6 ++--- lib/libsensors.3 | 7 +++--- lib/sensors.h | 24 +++++++++---------- lib/sysfs.c | 34 +++++++++++++-------------- prog/sensord/chips.c | 16 ++++++------- prog/sensord/sense.c | 2 +- prog/sensors/chips.c | 16 ++++++------- 10 files changed, 84 insertions(+), 83 deletions(-) diff --git a/lib/access.c b/lib/access.c index 44f9c611..8e125073 100644 --- a/lib/access.c +++ b/lib/access.c @@ -89,7 +89,7 @@ sensors_for_all_config_chips(const sensors_chip_name *name, /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ -const sensors_feature_data *sensors_lookup_feature_nr(const sensors_chip_name *chip, +const sensors_subfeature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature) { int i; @@ -97,9 +97,9 @@ const sensors_feature_data *sensors_lookup_feature_nr(const sensors_chip_name *c for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { if (feature < 0 || - feature >= sensors_proc_chips[i].feature_count) + feature >= sensors_proc_chips[i].subfeature_count) return NULL; - return sensors_proc_chips[i].feature + feature; + return sensors_proc_chips[i].subfeature + feature; } return NULL; } @@ -107,18 +107,18 @@ const sensors_feature_data *sensors_lookup_feature_nr(const sensors_chip_name *c /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ -static const sensors_feature_data * +static const sensors_subfeature * sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) { int i, j; - const sensors_feature_data *features; + const sensors_subfeature *subfeatures; for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { - features = sensors_proc_chips[i].feature; - for (j = 0; j < sensors_proc_chips[i].feature_count; j++) - if (!strcmp(features[j].name, feature)) - return features + j; + subfeatures = sensors_proc_chips[i].subfeature; + for (j = 0; j < sensors_proc_chips[i].subfeature_count; j++) + if (!strcmp(subfeatures[j].name, feature)) + return subfeatures + j; } return NULL; } @@ -145,7 +145,7 @@ char *sensors_get_label(const sensors_chip_name *name, int feature) { char *label; const sensors_chip *chip; - const sensors_feature_data *featureptr; + const sensors_subfeature *featureptr; char buf[128], path[PATH_MAX]; FILE *f; int i; @@ -191,7 +191,7 @@ sensors_get_label_exit: 1 if it should be ignored, 0 if not. This function takes mappings into account. */ static int sensors_get_ignored(const sensors_chip_name *name, - const sensors_feature_data *feature) + const sensors_subfeature *feature) { const sensors_chip *chip; const char *main_feature_name; @@ -218,8 +218,8 @@ static int sensors_get_ignored(const sensors_chip_name *name, int sensors_get_value(const sensors_chip_name *name, int feature, double *result) { - const sensors_feature_data *main_feature; - const sensors_feature_data *alt_feature; + const sensors_subfeature *main_feature; + const sensors_subfeature *alt_feature; const sensors_chip *chip; const sensors_expr *expr = NULL; double val; @@ -265,8 +265,8 @@ int sensors_get_value(const sensors_chip_name *name, int feature, int sensors_set_value(const sensors_chip_name *name, int feature, double value) { - const sensors_feature_data *main_feature; - const sensors_feature_data *alt_feature; + const sensors_subfeature *main_feature; + const sensors_subfeature *alt_feature; const sensors_chip *chip; const sensors_expr *expr = NULL; int i, res; @@ -343,29 +343,29 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus) return NULL; } -static const sensors_feature_data * +static const sensors_subfeature * sensors_get_all_features(const sensors_chip_name *name, int *nr) { - sensors_feature_data *feature_list; + sensors_subfeature *subfeature_list; int i; for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { - feature_list = sensors_proc_chips[i].feature; - while (*nr < sensors_proc_chips[i].feature_count - && sensors_get_ignored(name, &feature_list[*nr])) + subfeature_list = sensors_proc_chips[i].subfeature; + while (*nr < sensors_proc_chips[i].subfeature_count + && sensors_get_ignored(name, &subfeature_list[*nr])) (*nr)++; - if (*nr == sensors_proc_chips[i].feature_count) + if (*nr == sensors_proc_chips[i].subfeature_count) return NULL; - return &feature_list[(*nr)++]; + return &subfeature_list[(*nr)++]; } return NULL; } -const sensors_feature_data * +const sensors_subfeature * sensors_get_features(const sensors_chip_name *name, int *nr) { - const sensors_feature_data *feature; + const sensors_subfeature *feature; while ((feature = sensors_get_all_features(name, nr))) { if (feature->mapping == SENSORS_NO_MAPPING) @@ -374,10 +374,10 @@ sensors_get_features(const sensors_chip_name *name, int *nr) return NULL; /* end of list */ } -const sensors_feature_data * +const sensors_subfeature * sensors_get_all_subfeatures(const sensors_chip_name *name, int feature, int *nr) { - const sensors_feature_data *subfeature; + const sensors_subfeature *subfeature; /* Seek directly to the first subfeature */ if (*nr < feature) @@ -399,7 +399,7 @@ int sensors_eval_expr(const sensors_chip_name *name, { double res1, res2; int res; - const sensors_feature_data *feature; + const sensors_subfeature *feature; if (expr->kind == sensors_kind_val) { *result = expr->data.val; @@ -461,7 +461,7 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) double value; int i, j; int err = 0, res; - const sensors_feature_data *feature; + const sensors_subfeature *feature; int *feature_list = NULL; int feature_count = 0; int feature_max = 0; diff --git a/lib/access.h b/lib/access.h index 1aabbdf0..3e569de4 100644 --- a/lib/access.h +++ b/lib/access.h @@ -26,7 +26,7 @@ /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found. */ -const sensors_feature_data *sensors_lookup_feature_nr(const sensors_chip_name *chip, +const sensors_subfeature *sensors_lookup_feature_nr(const sensors_chip_name *chip, int feature); /* Check whether the chip name is an 'absolute' name, which can only match diff --git a/lib/data.h b/lib/data.h index c6d47fdd..1de016ea 100644 --- a/lib/data.h +++ b/lib/data.h @@ -123,8 +123,8 @@ typedef struct sensors_bus { /* Internal data about all features of a type of chip */ typedef struct sensors_chip_features { struct sensors_chip_name chip; - struct sensors_feature_data *feature; - int feature_count; + struct sensors_subfeature *subfeature; + int subfeature_count; } sensors_chip_features; extern sensors_chip *sensors_config_chips; diff --git a/lib/init.c b/lib/init.c index b956ecb6..adf928b1 100644 --- a/lib/init.c +++ b/lib/init.c @@ -56,9 +56,9 @@ static void free_chip_features(sensors_chip_features *features) { int i; - for (i = 0; i < features->feature_count; i++) - free(features->feature[i].name); - free(features->feature); + for (i = 0; i < features->subfeature_count; i++) + free(features->subfeature[i].name); + free(features->subfeature); } static void free_bus(sensors_bus *bus) diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 94f7ea4d..3314e4a2 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -103,9 +103,10 @@ To start at the beginning of the list, use 0 for nr; NULL is returned if we are at the end of the list. Do not try to change these chip names, as they point to internal structures! -This structure is used when you want to get all features of a specific chip. +This structure contains information related to a given subfeature of a +specific chip. .br -\fBtypedef struct sensors_feature_data { +\fBtypedef struct sensors_subfeature { .br const char *name; .br @@ -117,7 +118,7 @@ This structure is used when you want to get all features of a specific chip. .br unsigned int flags; .br -} sensors_feature_data;\fP +} sensors_subfeature;\fP .br The flags field is a bitfield, its value is a combination of SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING diff --git a/lib/sensors.h b/lib/sensors.h index 81c465aa..95ec65ba 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -112,12 +112,12 @@ int sensors_do_chip_sets(const sensors_chip_name *name); const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name *match, int *nr); -/* These defines are used in the flags field of sensors_feature_data */ +/* These defines are used in the flags field of sensors_subfeature */ #define SENSORS_MODE_R 1 #define SENSORS_MODE_W 2 #define SENSORS_COMPUTE_MAPPING 4 -/* This define is used in the mapping field of sensors_feature_data if no +/* This define is used in the mapping field of sensors_subfeature if no mapping is available */ #define SENSORS_NO_MAPPING -1 @@ -163,32 +163,32 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_UNKNOWN = INT_MAX, } sensors_feature_type; -/* Data about a single chip feature: - name is the string name used to refer to this feature (in config files) - number is the internal feature number, used in many functions to refer +/* Data about a single chip subfeature: + name is the string name used to refer to this subfeature (in config files) + number is the internal subfeature number, used in many functions to refer to this feature - type is the feature or subfeature type - mapping is either SENSORS_NO_MAPPING if this is feature is the - main element of category; or it is the number of a feature with which + type is the subfeature type + mapping is either SENSORS_NO_MAPPING if this subfeature is the + main element of category; or it is the number of a subfeature with which this subfeature is logically grouped (a group could be fan, fan_min and fan_div) flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the computation rules of the main feature) */ -typedef struct sensors_feature_data { +typedef struct sensors_subfeature { char *name; int number; sensors_feature_type type; int mapping; unsigned int flags; -} sensors_feature_data; +} sensors_subfeature; /* This returns all main features of a specific chip. nr is an internally used variable. Set it to zero to start at the begin of the list. If no more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. */ -const sensors_feature_data * +const sensors_subfeature * sensors_get_features(const sensors_chip_name *name, int *nr); /* This returns all subfeatures of a given main feature (including that @@ -197,7 +197,7 @@ sensors_get_features(const sensors_chip_name *name, int *nr); features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. */ -const sensors_feature_data * +const sensors_subfeature * sensors_get_all_subfeatures(const sensors_chip_name *name, int feature, int *nr); #ifdef __cplusplus diff --git a/lib/sysfs.c b/lib/sysfs.c index b4341f1d..fd3e1892 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -161,8 +161,8 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, int i, type, fnum = 0; struct sysfs_attribute *attr; struct dlist *attrs; - sensors_feature_data *features; - sensors_feature_data *dyn_features; + sensors_subfeature *features; + sensors_subfeature *dyn_subfeatures; attrs = sysfs_get_device_attributes(sysdir); @@ -172,7 +172,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* We use a large sparse table at first to store all found features, so that we can store them sorted at type and index and then later create a dense sorted table. */ - features = calloc(ALL_POSSIBLE_FEATURES, sizeof(sensors_feature_data)); + features = calloc(ALL_POSSIBLE_FEATURES, sizeof(sensors_subfeature)); if (!features) sensors_fatal_error(__FUNCTION__, "Out of memory"); @@ -253,41 +253,41 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } if (!fnum) { /* No feature */ - chip->feature = NULL; + chip->subfeature = NULL; goto exit_free; } - dyn_features = calloc(fnum, sizeof(sensors_feature_data)); - if (dyn_features == NULL) { + dyn_subfeatures = calloc(fnum, sizeof(sensors_subfeature)); + if (dyn_subfeatures == NULL) { sensors_fatal_error(__FUNCTION__, "Out of memory"); } fnum = 0; for (i = 0; i < ALL_POSSIBLE_FEATURES; i++) { if (features[i].name) { - dyn_features[fnum] = features[i]; + dyn_subfeatures[fnum] = features[i]; fnum++; } } - /* Number the features linearly, so that feature number N is at + /* Number the subfeatures linearly, so that feature number N is at position N in the array. This allows for O(1) look-ups. */ for (i = 0; i < fnum; i++) { int j; - dyn_features[i].number = i; - if (dyn_features[i].mapping == SENSORS_NO_MAPPING) { + dyn_subfeatures[i].number = i; + if (dyn_subfeatures[i].mapping == SENSORS_NO_MAPPING) { /* Main feature, set the mapping field of all its subfeatures */ for (j = i + 1; j < fnum && - dyn_features[j].mapping != SENSORS_NO_MAPPING; + dyn_subfeatures[j].mapping != SENSORS_NO_MAPPING; j++) - dyn_features[j].mapping = i; + dyn_subfeatures[j].mapping = i; } } - chip->feature = dyn_features; - chip->feature_count = fnum; + chip->subfeature = dyn_subfeatures; + chip->subfeature_count = fnum; exit_free: free(features); @@ -375,7 +375,7 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) if (sensors_read_dynamic_chip(&entry, dev) < 0) goto exit_free; - if (!entry.feature) { /* No feature, discard chip */ + if (!entry.subfeature) { /* No feature, discard chip */ err = 0; goto exit_free; } @@ -513,7 +513,7 @@ exit0: int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, double *value) { - const sensors_feature_data *the_feature; + const sensors_subfeature *the_feature; char n[NAME_MAX]; FILE *f; const char *suffix = ""; @@ -544,7 +544,7 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, double value) { - const sensors_feature_data *the_feature; + const sensors_subfeature *the_feature; char n[NAME_MAX]; FILE *f; const char *suffix = ""; diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 529553f4..79258490 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -141,12 +141,12 @@ rrdF3 } static void getAvailableFeatures (const sensors_chip_name *name, - const sensors_feature_data *feature, + const sensors_subfeature *feature, short *has_features, int *feature_nrs, int size, int first_val) { - const sensors_feature_data *iter; + const sensors_subfeature *iter; int i = 0; while ((iter = sensors_get_all_subfeatures(name, feature->number, &i))) { @@ -166,7 +166,7 @@ static void getAvailableFeatures (const sensors_chip_name *name, #define IN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_IN - 1] static void fillChipVoltage (FeatureDescriptor *voltage, const sensors_chip_name *name, - const sensors_feature_data *feature) + const sensors_subfeature *feature) { const int size = SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN; short has_features[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN] = { 0, }; @@ -214,7 +214,7 @@ static void fillChipVoltage (FeatureDescriptor *voltage, #define TEMP_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_TEMP - 1] static void fillChipTemperature (FeatureDescriptor *temperature, const sensors_chip_name *name, - const sensors_feature_data *feature) + const sensors_subfeature *feature) { const int size = SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP; short has_features[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP] = { 0, }; @@ -265,7 +265,7 @@ static void fillChipTemperature (FeatureDescriptor *temperature, #define FAN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_FAN - 1] static void fillChipFan (FeatureDescriptor *fan, const sensors_chip_name *name, - const sensors_feature_data *feature) + const sensors_subfeature *feature) { const int size = SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN; short has_features[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN] = { 0, }; @@ -309,7 +309,7 @@ static void fillChipFan (FeatureDescriptor *fan, } static void fillChipVid (FeatureDescriptor *vid, - const sensors_feature_data *feature) + const sensors_subfeature *feature) { vid->format = fmtVolt_3; vid->rrd = rrdF3; @@ -321,7 +321,7 @@ static void fillChipVid (FeatureDescriptor *vid, } static void fillChipBeepEnable (FeatureDescriptor *beepen, - const sensors_feature_data *feature) + const sensors_subfeature *feature) { beepen->format = fmtSoundAlarm; beepen->rrd = rrdF0; @@ -336,7 +336,7 @@ static FeatureDescriptor * generateChipFeatures (const sensors_chip_name *chip) { int nr, count = 1; - const sensors_feature_data *sensor; + const sensors_subfeature *sensor; FeatureDescriptor *features; /* How many main features do we have? */ diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index 7861fa54..e8f5bce7 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -36,7 +36,7 @@ int getRawLabel (const sensors_chip_name *name, int feature, const char **label) { - const sensors_feature_data *mainfeat, *sub; + const sensors_subfeature *mainfeat, *sub; int a, b; a = 0; diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 83d113c9..6f0be8d4 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -31,7 +31,7 @@ void print_chip_raw(const sensors_chip_name *name) { int a, b; - const sensors_feature_data *feature, *sub; + const sensors_subfeature *feature, *sub; char *label; double val; @@ -73,12 +73,12 @@ static void print_label(const char *label, int space) } static void sensors_get_available_features(const sensors_chip_name *name, - const sensors_feature_data *feature, + const sensors_subfeature *feature, short *has_features, double *feature_vals, int size, int first_val) { - const sensors_feature_data *iter; + const sensors_subfeature *iter; int i = 0; while ((iter = sensors_get_all_subfeatures(name, feature->number, &i))) { @@ -103,7 +103,7 @@ static void sensors_get_available_features(const sensors_chip_name *name, static int sensors_get_label_size(const sensors_chip_name *name) { int i; - const sensors_feature_data *iter; + const sensors_subfeature *iter; char *label; unsigned int max_size = 11; /* 11 as minumum label width */ @@ -143,7 +143,7 @@ static void print_temp_limits(double limit1, double limit2, #define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] #define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] static void print_chip_temp(const sensors_chip_name *name, - const sensors_feature_data *feature, + const sensors_subfeature *feature, int label_size) { double val, limit1, limit2; @@ -281,7 +281,7 @@ static void print_chip_temp(const sensors_chip_name *name, #define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] #define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] static void print_chip_in(const sensors_chip_name *name, - const sensors_feature_data *feature, + const sensors_subfeature *feature, int label_size) { const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; @@ -346,7 +346,7 @@ static void print_chip_in(const sensors_chip_name *name, #define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] #define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] static void print_chip_fan(const sensors_chip_name *name, - const sensors_feature_data *feature, + const sensors_subfeature *feature, int label_size) { char *label; @@ -428,7 +428,7 @@ static void print_chip_beep_enable(const sensors_chip_name *name, int f_beep, void print_chip(const sensors_chip_name *name) { - const sensors_feature_data *feature; + const sensors_subfeature *feature; int i, label_size; label_size = sensors_get_label_size(name); From bfe337fe76aa796fae800b5c3f53b9b483d0efaf Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:02:59 +0000 Subject: [PATCH 291/718] Store current temperature, voltage and fan values together with the rest of the subfeatures. This makes the code more simple, and prepares for current values to be subfeatures like any others (i.e. they can be missing.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4833 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/chips.c | 41 ++++++++++++++++++---------------- prog/sensors/chips.c | 53 ++++++++++++++++---------------------------- 2 files changed, 41 insertions(+), 53 deletions(-) diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 79258490..85317fdb 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -152,7 +152,7 @@ static void getAvailableFeatures (const sensors_chip_name *name, while ((iter = sensors_get_all_subfeatures(name, feature->number, &i))) { int index0; - index0 = iter->type - first_val - 1; + index0 = iter->type - first_val; if (index0 < 0 || index0 >= size) /* New feature in libsensors? Ignore. */ continue; @@ -162,24 +162,25 @@ static void getAvailableFeatures (const sensors_chip_name *name, } } -#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] -#define IN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_IN - 1] +#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN] +#define IN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_IN] static void fillChipVoltage (FeatureDescriptor *voltage, const sensors_chip_name *name, const sensors_subfeature *feature) { - const int size = SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN; - short has_features[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN] = { 0, }; - int feature_nrs[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN]; + const int size = SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN + 1; + short has_features[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN + 1] = { 0, }; + int feature_nrs[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN + 1]; int pos = 0; voltage->rrd = rrdF2; voltage->type = DataType_voltage; - voltage->dataNumbers[pos++] = feature->number; getAvailableFeatures (name, feature, has_features, feature_nrs, size, SENSORS_FEATURE_IN); + voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_FEATURE_IN); + if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && IN_FEATURE(SENSORS_FEATURE_IN_MAX)) { voltage->format = fmtVolts_2; @@ -210,24 +211,25 @@ static void fillChipVoltage (FeatureDescriptor *voltage, } } -#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] -#define TEMP_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_TEMP - 1] +#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP] +#define TEMP_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_TEMP] static void fillChipTemperature (FeatureDescriptor *temperature, const sensors_chip_name *name, const sensors_subfeature *feature) { - const int size = SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP; - short has_features[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP] = { 0, }; - int feature_nrs[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP]; + const int size = SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP + 1; + short has_features[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP + 1] = { 0, }; + int feature_nrs[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP + 1]; int pos = 0; temperature->rrd = rrdF1; temperature->type = DataType_temperature; - temperature->dataNumbers[pos++] = feature->number; getAvailableFeatures (name, feature, has_features, feature_nrs, size, SENSORS_FEATURE_TEMP); + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP); + if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN) && TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { temperature->format = fmtTemps_minmax_1; @@ -261,24 +263,25 @@ static void fillChipTemperature (FeatureDescriptor *temperature, } } -#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] -#define FAN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_FAN - 1] +#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN] +#define FAN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_FAN] static void fillChipFan (FeatureDescriptor *fan, const sensors_chip_name *name, const sensors_subfeature *feature) { - const int size = SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN; - short has_features[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN] = { 0, }; - int feature_nrs[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN]; + const int size = SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN + 1; + short has_features[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN + 1] = { 0, }; + int feature_nrs[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN + 1]; int pos = 0; fan->rrd = rrdF0; fan->type = DataType_rpm; - fan->dataNumbers[pos++] = feature->number; getAvailableFeatures (name, feature, has_features, feature_nrs, size, SENSORS_FEATURE_FAN); + fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_FEATURE_FAN); + if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) { fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_FEATURE_FAN_MIN); if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) { diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 6f0be8d4..3c4c0e0f 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -84,7 +84,7 @@ static void sensors_get_available_features(const sensors_chip_name *name, while ((iter = sensors_get_all_subfeatures(name, feature->number, &i))) { int indx, err; - indx = iter->type - first_val - 1; + indx = iter->type - first_val; if (indx < 0 || indx >= size) /* New feature in libsensors? Ignore. */ continue; @@ -140,8 +140,8 @@ static void print_temp_limits(double limit1, double limit2, printf("ALARM "); } -#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP - 1] -#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP - 1] +#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP] +#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP] static void print_chip_temp(const sensors_chip_name *name, const sensors_subfeature *feature, int label_size) @@ -150,24 +150,19 @@ static void print_chip_temp(const sensors_chip_name *name, const char *s1, *s2; int alarm, crit_displayed = 0; char *label; - const int size = SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP; - short has_features[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP] = { 0, }; - double feature_vals[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP] = { 0.0, }; + const int size = SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP + 1; + short has_features[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP + 1] = { 0, }; + double feature_vals[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP + 1] = { 0.0, }; if (!(label = sensors_get_label(name, feature->number))) { printf("ERROR: Can't get temperature label!\n"); return; } - if (sensors_get_value(name, feature->number, &val)) { - printf("ERROR: Can't get %s data!\n", label); - free(label); - return; - } - sensors_get_available_features(name, feature, has_features, feature_vals, size, SENSORS_FEATURE_TEMP); + val = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP); alarm = TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM); @@ -278,15 +273,15 @@ static void print_chip_temp(const sensors_chip_name *name, printf("\n"); } -#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN - 1] -#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN - 1] +#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN] +#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN] static void print_chip_in(const sensors_chip_name *name, const sensors_subfeature *feature, int label_size) { - const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN; - short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0, }; - double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN] = { 0.0, }; + const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN + 1; + short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN + 1] = { 0, }; + double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN + 1] = { 0.0, }; double val, alarm_max, alarm_min; char *label; @@ -295,14 +290,9 @@ static void print_chip_in(const sensors_chip_name *name, return; } - if (sensors_get_value(name, feature->number, &val)) { - printf("ERROR: Can't get %s data!\n", label); - free(label); - return; - } - sensors_get_available_features(name, feature, has_features, feature_vals, size, SENSORS_FEATURE_IN); + val = IN_FEATURE_VAL(SENSORS_FEATURE_IN); print_label(label, label_size); free(label); @@ -343,16 +333,16 @@ static void print_chip_in(const sensors_chip_name *name, printf("\n"); } -#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN - 1] -#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN - 1] +#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN] +#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN] static void print_chip_fan(const sensors_chip_name *name, const sensors_subfeature *feature, int label_size) { char *label; - const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN; - short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0, }; - double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN] = { 0.0, }; + const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN + 1; + short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN + 1] = { 0, }; + double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN + 1] = { 0.0, }; double val; if (!(label = sensors_get_label(name, feature->number))) { @@ -360,17 +350,12 @@ static void print_chip_fan(const sensors_chip_name *name, return; } - if (sensors_get_value(name, feature->number, &val)) { - printf("ERROR: Can't get %s data!\n", label); - free(label); - return; - } - print_label(label, label_size); free(label); sensors_get_available_features(name, feature, has_features, feature_vals, size, SENSORS_FEATURE_FAN); + val = FAN_FEATURE_VAL(SENSORS_FEATURE_FAN); if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) From 96c914bfdaefe98a0e342b999f4e006e77ae7bc1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:05:16 +0000 Subject: [PATCH 292/718] Define a separate structure to represent main features. This allows for faster main features lookup. One side effect of this change is that subfeatures can no longer have labels nor be ignored. I do not think that this is a problem in practice, and actually this makes a lot of sense. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4834 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 64 +++++++++++++++-------------------- lib/data.h | 2 ++ lib/init.c | 3 ++ lib/libsensors.3 | 16 ++++----- lib/sensors.h | 17 ++++++++-- lib/sysfs.c | 26 ++++++++++++++ prog/sensord/chips.c | 41 +++++++++++++++------- prog/sensord/rrd.c | 10 ++---- prog/sensord/sense.c | 25 ++------------ prog/sensord/sensord.h | 5 ++- prog/sensors/chips.c | 77 ++++++++++++++++++++++++------------------ 11 files changed, 160 insertions(+), 126 deletions(-) diff --git a/lib/access.c b/lib/access.c index 8e125073..84ae2062 100644 --- a/lib/access.c +++ b/lib/access.c @@ -141,30 +141,27 @@ int sensors_chip_name_has_wildcards(const sensors_chip_name *chip) contain wildcard values! The returned string is newly allocated (free it yourself). On failure, NULL is returned. If no label exists for this feature, its name is returned itself. */ -char *sensors_get_label(const sensors_chip_name *name, int feature) +char *sensors_get_label(const sensors_chip_name *name, + const sensors_feature *feature) { char *label; const sensors_chip *chip; - const sensors_subfeature *featureptr; char buf[128], path[PATH_MAX]; FILE *f; int i; if (sensors_chip_name_has_wildcards(name)) return NULL; - if (!(featureptr = sensors_lookup_feature_nr(name, feature))) - return NULL; for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->labels_count; i++) - if (!strcmp(featureptr->name, chip->labels[i].name)) { + if (!strcmp(feature->name, chip->labels[i].name)) { label = strdup(chip->labels[i].value); goto sensors_get_label_exit; } /* No user specified label, check for a _label sysfs file */ - snprintf(path, PATH_MAX, "%s/%s_label", name->path, - featureptr->name); + snprintf(path, PATH_MAX, "%s/%s_label", name->path, feature->name); if ((f = fopen(path, "r"))) { i = fread(buf, 1, sizeof(buf) - 1, f); @@ -178,7 +175,7 @@ char *sensors_get_label(const sensors_chip_name *name, int feature) } /* No label, return the feature name instead */ - label = strdup(featureptr->name); + label = strdup(feature->name); sensors_get_label_exit: if (!label) @@ -188,26 +185,16 @@ sensors_get_label_exit: } /* Looks up whether a feature should be ignored. Returns - 1 if it should be ignored, 0 if not. This function takes - mappings into account. */ + 1 if it should be ignored, 0 if not. */ static int sensors_get_ignored(const sensors_chip_name *name, - const sensors_subfeature *feature) + const sensors_feature *feature) { const sensors_chip *chip; - const char *main_feature_name; int i; - if (feature->mapping == SENSORS_NO_MAPPING) - main_feature_name = NULL; - else - main_feature_name = sensors_lookup_feature_nr(name, - feature->mapping)->name; - for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->ignores_count; i++) - if (!strcmp(feature->name, chip->ignores[i].name) || - (main_feature_name && - !strcmp(main_feature_name, chip->ignores[i].name))) + if (!strcmp(feature->name, chip->ignores[i].name)) return 1; return 0; } @@ -352,42 +339,47 @@ sensors_get_all_features(const sensors_chip_name *name, int *nr) for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { subfeature_list = sensors_proc_chips[i].subfeature; - while (*nr < sensors_proc_chips[i].subfeature_count - && sensors_get_ignored(name, &subfeature_list[*nr])) - (*nr)++; - if (*nr == sensors_proc_chips[i].subfeature_count) + if (*nr >= sensors_proc_chips[i].subfeature_count) return NULL; return &subfeature_list[(*nr)++]; } return NULL; } -const sensors_subfeature * +const sensors_feature * sensors_get_features(const sensors_chip_name *name, int *nr) { - const sensors_subfeature *feature; + const sensors_feature *feature_list; + int i; - while ((feature = sensors_get_all_features(name, nr))) { - if (feature->mapping == SENSORS_NO_MAPPING) - return feature; - } + for (i = 0; i < sensors_proc_chips_count; i++) + if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { + feature_list = sensors_proc_chips[i].feature; + while (*nr < sensors_proc_chips[i].feature_count + && sensors_get_ignored(name, &feature_list[*nr])) + (*nr)++; + if (*nr >= sensors_proc_chips[i].feature_count) + return NULL; + return &feature_list[(*nr)++]; + } return NULL; /* end of list */ } const sensors_subfeature * -sensors_get_all_subfeatures(const sensors_chip_name *name, int feature, int *nr) +sensors_get_all_subfeatures(const sensors_chip_name *name, + const sensors_feature *feature, int *nr) { const sensors_subfeature *subfeature; /* Seek directly to the first subfeature */ - if (*nr < feature) - *nr = feature; + if (*nr < feature->first_subfeature) + *nr = feature->first_subfeature; subfeature = sensors_get_all_features(name, nr); if (!subfeature) return NULL; /* end of list */ - if (subfeature->number == feature || - subfeature->mapping == feature) + if (subfeature->number == feature->first_subfeature || + subfeature->mapping == feature->first_subfeature) return subfeature; return NULL; /* end of subfeature list */ } diff --git a/lib/data.h b/lib/data.h index 1de016ea..ec0d175d 100644 --- a/lib/data.h +++ b/lib/data.h @@ -123,7 +123,9 @@ typedef struct sensors_bus { /* Internal data about all features of a type of chip */ typedef struct sensors_chip_features { struct sensors_chip_name chip; + struct sensors_feature *feature; struct sensors_subfeature *subfeature; + int feature_count; int subfeature_count; } sensors_chip_features; diff --git a/lib/init.c b/lib/init.c index adf928b1..94f078eb 100644 --- a/lib/init.c +++ b/lib/init.c @@ -59,6 +59,9 @@ static void free_chip_features(sensors_chip_features *features) for (i = 0; i < features->subfeature_count; i++) free(features->subfeature[i].name); free(features->subfeature); + for (i = 0; i < features->feature_count; i++) + free(features->feature[i].name); + free(features->feature); } static void free_bus(sensors_bus *bus) diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 3314e4a2..41dc0882 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -36,7 +36,7 @@ libsensors \- publicly accessible functions provided by the sensors library .B int sensors_parse_chip_name(const char *orig_name, \fBsensors_chip_name *res);\fP .B const char *sensors_get_adapter_name(int bus_nr); -.B char *sensors_get_label(const sensors_chip_name *name, int feature);\fP +.B char *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);\fP .B int sensors_get_value(const sensors_chip_name *name, int feature, \fBdouble *value);\fP .B int sensors_set_value(const sensors_chip_name *name, int feature, @@ -44,10 +44,8 @@ libsensors \- publicly accessible functions provided by the sensors library .B int sensors_do_chip_sets(const sensors_chip_name *name); .B const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name \fB*match, int *nr);\fP -.B const sensors_feature_data *sensors_get_features - \fB(const sensors_chip_name *name, int *nr);\fP -.B const sensors_feature_data *sensors_get_all_subfeatures - \fB(const sensors_chip_name *name, int feature, int *nr);\fP +.B const sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);\fP +.B const sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);\fP .B const char *libsensors_version; .fi .SH DESCRIPTION @@ -73,7 +71,7 @@ Parse a chip name to the internal representation. Return 0 on succes, <0 on erro This function returns the adapter name of a bus number, as used within the sensors_chip_name structure. If it could not be found, it returns NULL. -\fBchar *sensors_get_label(const sensors_chip_name *name, int feature);\fP +\fBchar *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);\fP .br Look up the label which belongs to this chip. Note that chip should not contain wildcard values! The returned string is newly allocated (free it @@ -124,7 +122,7 @@ The flags field is a bitfield, its value is a combination of SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the computation rules of the main feature). -\fBconst sensors_feature_data *sensors_get_features(const sensors_chip_name *name, int *nr);\fP +\fBconst sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);\fP .br This returns all main features of a specific chip. nr is an internally used variable. Set it to zero to start at the begin of the list. If no @@ -132,12 +130,12 @@ more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. -\fBconst sensors_feature_data *sensors_get_all_subfeatures(const sensors_chip_name *name, int feature, int *nr);\fP +\fBconst sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);\fP .br This returns all subfeatures of a given main feature (including that main feature itself, in first position.) nr is an internally used variable. Set it to zero to start at the begin of the list. If no more -features are found NULL is returned. +subfeatures are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. diff --git a/lib/sensors.h b/lib/sensors.h index 95ec65ba..ce68ca50 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -82,11 +82,14 @@ int sensors_snprintf_chip_name(char *str, size_t size, it returns NULL */ const char *sensors_get_adapter_name(const sensors_bus_id *bus); +typedef struct sensors_feature sensors_feature; + /* Look up the label which belongs to this chip. Note that chip should not contain wildcard values! The returned string is newly allocated (free it yourself). On failure, NULL is returned. If no label exists for this feature, its name is returned itself. */ -char *sensors_get_label(const sensors_chip_name *name, int feature); +char *sensors_get_label(const sensors_chip_name *name, + const sensors_feature *feature); /* Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 @@ -163,6 +166,13 @@ typedef enum sensors_feature_type { SENSORS_FEATURE_UNKNOWN = INT_MAX, } sensors_feature_type; +/* Data about a single chip feature (or category leader) */ +struct sensors_feature { + char *name; + int first_subfeature; + sensors_feature_type type; +}; + /* Data about a single chip subfeature: name is the string name used to refer to this subfeature (in config files) number is the internal subfeature number, used in many functions to refer @@ -188,7 +198,7 @@ typedef struct sensors_subfeature { more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. */ -const sensors_subfeature * +const sensors_feature * sensors_get_features(const sensors_chip_name *name, int *nr); /* This returns all subfeatures of a given main feature (including that @@ -198,7 +208,8 @@ sensors_get_features(const sensors_chip_name *name, int *nr); Do not try to change the returned structure; you will corrupt internal data structures. */ const sensors_subfeature * -sensors_get_all_subfeatures(const sensors_chip_name *name, int feature, int *nr); +sensors_get_all_subfeatures(const sensors_chip_name *name, + const sensors_feature *feature, int *nr); #ifdef __cplusplus } diff --git a/lib/sysfs.c b/lib/sysfs.c index fd3e1892..2a50c41d 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -163,6 +163,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, struct dlist *attrs; sensors_subfeature *features; sensors_subfeature *dyn_subfeatures; + sensors_feature *dyn_features; attrs = sysfs_get_device_attributes(sysdir); @@ -289,6 +290,31 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, chip->subfeature = dyn_subfeatures; chip->subfeature_count = fnum; + /* And now the main features */ + fnum = 0; + for (i = 0; i < chip->subfeature_count; i++) { + if (chip->subfeature[i].mapping == SENSORS_NO_MAPPING) + fnum++; + } + + dyn_features = calloc(fnum, sizeof(sensors_feature)); + if (dyn_features == NULL) { + sensors_fatal_error(__FUNCTION__, "Out of memory"); + } + + fnum = 0; + for (i = 0; i < chip->subfeature_count; i++) { + if (chip->subfeature[i].mapping == SENSORS_NO_MAPPING) { + dyn_features[fnum].name = strdup(chip->subfeature[i].name); + dyn_features[fnum].first_subfeature = i; + dyn_features[fnum].type = chip->subfeature[i].type; + fnum++; + } + } + + chip->feature = dyn_features; + chip->feature_count = fnum; + exit_free: free(features); return 0; diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 85317fdb..5e9551ec 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -141,7 +141,7 @@ rrdF3 } static void getAvailableFeatures (const sensors_chip_name *name, - const sensors_subfeature *feature, + const sensors_feature *feature, short *has_features, int *feature_nrs, int size, int first_val) @@ -149,7 +149,7 @@ static void getAvailableFeatures (const sensors_chip_name *name, const sensors_subfeature *iter; int i = 0; - while ((iter = sensors_get_all_subfeatures(name, feature->number, &i))) { + while ((iter = sensors_get_all_subfeatures(name, feature, &i))) { int index0; index0 = iter->type - first_val; @@ -166,7 +166,7 @@ static void getAvailableFeatures (const sensors_chip_name *name, #define IN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_IN] static void fillChipVoltage (FeatureDescriptor *voltage, const sensors_chip_name *name, - const sensors_subfeature *feature) + const sensors_feature *feature) { const int size = SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN + 1; short has_features[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN + 1] = { 0, }; @@ -215,7 +215,7 @@ static void fillChipVoltage (FeatureDescriptor *voltage, #define TEMP_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_TEMP] static void fillChipTemperature (FeatureDescriptor *temperature, const sensors_chip_name *name, - const sensors_subfeature *feature) + const sensors_feature *feature) { const int size = SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP + 1; short has_features[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP + 1] = { 0, }; @@ -267,7 +267,7 @@ static void fillChipTemperature (FeatureDescriptor *temperature, #define FAN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_FAN] static void fillChipFan (FeatureDescriptor *fan, const sensors_chip_name *name, - const sensors_subfeature *feature) + const sensors_feature *feature) { const int size = SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN + 1; short has_features[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN + 1] = { 0, }; @@ -312,26 +312,42 @@ static void fillChipFan (FeatureDescriptor *fan, } static void fillChipVid (FeatureDescriptor *vid, - const sensors_subfeature *feature) + const sensors_chip_name *name, + const sensors_feature *feature) { + int i = 0; + const sensors_subfeature *sub; + + sub = sensors_get_all_subfeatures(name, feature, &i); + if (!sub) + return; + vid->format = fmtVolt_3; vid->rrd = rrdF3; vid->type = DataType_voltage; vid->alarmNumber = -1; vid->beepNumber = -1; - vid->dataNumbers[0] = feature->number; + vid->dataNumbers[0] = sub->number; vid->dataNumbers[1] = -1; } static void fillChipBeepEnable (FeatureDescriptor *beepen, - const sensors_subfeature *feature) + const sensors_chip_name *name, + const sensors_feature *feature) { + int i = 0; + const sensors_subfeature *sub; + + sub = sensors_get_all_subfeatures(name, feature, &i); + if (!sub) + return; + beepen->format = fmtSoundAlarm; beepen->rrd = rrdF0; beepen->type = DataType_other; beepen->alarmNumber = -1; beepen->beepNumber = -1; - beepen->dataNumbers[0] = feature->number; + beepen->dataNumbers[0] = sub->number; beepen->dataNumbers[1] = -1; } @@ -339,7 +355,7 @@ static FeatureDescriptor * generateChipFeatures (const sensors_chip_name *chip) { int nr, count = 1; - const sensors_subfeature *sensor; + const sensors_feature *sensor; FeatureDescriptor *features; /* How many main features do we have? */ @@ -367,15 +383,16 @@ FeatureDescriptor * generateChipFeatures (const sensors_chip_name *chip) fillChipFan(&features[count], chip, sensor); break; case SENSORS_FEATURE_VID: - fillChipVid(&features[count], sensor); + fillChipVid(&features[count], chip, sensor); break; case SENSORS_FEATURE_BEEP_ENABLE: - fillChipBeepEnable(&features[count], sensor); + fillChipBeepEnable(&features[count], chip, sensor); break; default: continue; } + features[count].feature = sensor; count++; } diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index 81885fa5..0d71c19e 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -156,15 +156,11 @@ applyToFeatures for (index0 = 0; (ret == 0) && (num < MAX_RRD_SENSORS) && features[index0].format; ++ index0) { const FeatureDescriptor *feature = features + index0; - int labelNumber = feature->dataNumbers[0]; - const char *rawLabel = NULL; + const char *rawLabel = features->feature->name; char *label = NULL; - if (getRawLabel (chip, labelNumber, &rawLabel)) { - sensorLog (LOG_ERR, "Error getting raw sensor label: %s/#%d", chip->prefix, labelNumber); - ret = -1; - } else if (!(label = sensors_get_label (chip, labelNumber))) { - sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); + if (!(label = sensors_get_label (chip, features->feature))) { + sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, rawLabel); ret = -1; } else { rrdCheckLabel (rawLabel, num); diff --git a/prog/sensord/sense.c b/prog/sensord/sense.c index e8f5bce7..8b18f9d9 100644 --- a/prog/sensord/sense.c +++ b/prog/sensord/sense.c @@ -33,26 +33,6 @@ #define DO_SET 2 #define DO_RRD 3 -int -getRawLabel -(const sensors_chip_name *name, int feature, const char **label) { - const sensors_subfeature *mainfeat, *sub; - int a, b; - - a = 0; - while ((mainfeat = sensors_get_features(name, &a))) { - b = 0; - while ((sub = sensors_get_all_subfeatures(name, mainfeat->number, &b))) { - if (sub->number == feature) { - *label = sub->name; - return 0; - } - } - } - /* TODO: Ensure labels match RRD construct and are not repeated! */ - return -1; -} - static const char * chipName (const sensors_chip_name *chip) { @@ -87,12 +67,11 @@ doKnownChip ret = idChip (chip); for (index0 = 0; (ret == 0) && features[index0].format; ++ index0) { const FeatureDescriptor *feature = features + index0; - int labelNumber = feature->dataNumbers[0]; int alarm, beep; char *label = NULL; - if (!(label = sensors_get_label (chip, labelNumber))) { - sensorLog (LOG_ERR, "Error getting sensor label: %s/#%d", chip->prefix, labelNumber); + if (!(label = sensors_get_label (chip, feature->feature))) { + sensorLog (LOG_ERR, "Error getting sensor label: %s/%s", chip->prefix, feature->feature->name); ret = 22; } else { double values[MAX_DATA]; diff --git a/prog/sensord/sensord.h b/prog/sensord/sensord.h index eee402a0..e8c47694 100644 --- a/prog/sensord/sensord.h +++ b/prog/sensord/sensord.h @@ -56,8 +56,6 @@ extern int unloadLib (void); /* from sense.c */ -extern int getRawLabel (const sensors_chip_name *name, int feature, const char **label); - extern int readChips (void); extern int scanChips (void); extern int setChips (void); @@ -91,7 +89,8 @@ typedef struct { DataType type; int alarmNumber; int beepNumber; - int dataNumbers[MAX_DATA + 1]; /* First entry is used for the label */ + const sensors_feature *feature; + int dataNumbers[MAX_DATA + 1]; } FeatureDescriptor; typedef struct { diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 3c4c0e0f..1e8cf6f3 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -31,32 +31,30 @@ void print_chip_raw(const sensors_chip_name *name) { int a, b; - const sensors_subfeature *feature, *sub; + const sensors_feature *feature; + const sensors_subfeature *sub; char *label; double val; a = 0; while ((feature = sensors_get_features(name, &a))) { + if (!(label = sensors_get_label(name, feature))) { + printf("ERROR: Can't get feature label!\n"); + continue; + } + printf("%s:\n", label); + free(label); + b = 0; - while ((sub = sensors_get_all_subfeatures(name, feature->number, - &b))) { - if (!(label = sensors_get_label(name, sub->number))) { - printf("ERROR: Can't get feature `%s' label!\n", - sub->name); - continue; - } + while ((sub = sensors_get_all_subfeatures(name, feature, &b))) { if (sub->flags & SENSORS_MODE_R) { if (sensors_get_value(name, sub->number, &val)) printf("ERROR: Can't get feature `%s' " "data!\n", sub->name); - else if (sub->mapping != SENSORS_NO_MAPPING) - printf(" %s: %.2f\n", label, val); else - printf("%s: %.2f (%s)\n", label, val, - sub->name); + printf(" %s: %.2f\n", sub->name, val); } else printf("(%s)\n", label); - free(label); } } } @@ -73,7 +71,7 @@ static void print_label(const char *label, int space) } static void sensors_get_available_features(const sensors_chip_name *name, - const sensors_subfeature *feature, + const sensors_feature *feature, short *has_features, double *feature_vals, int size, int first_val) @@ -81,7 +79,7 @@ static void sensors_get_available_features(const sensors_chip_name *name, const sensors_subfeature *iter; int i = 0; - while ((iter = sensors_get_all_subfeatures(name, feature->number, &i))) { + while ((iter = sensors_get_all_subfeatures(name, feature, &i))) { int indx, err; indx = iter->type - first_val; @@ -103,13 +101,13 @@ static void sensors_get_available_features(const sensors_chip_name *name, static int sensors_get_label_size(const sensors_chip_name *name) { int i; - const sensors_subfeature *iter; + const sensors_feature *iter; char *label; unsigned int max_size = 11; /* 11 as minumum label width */ i = 0; while ((iter = sensors_get_features(name, &i))) { - if ((label = sensors_get_label(name, iter->number)) && + if ((label = sensors_get_label(name, iter)) && strlen(label) > max_size) max_size = strlen(label); free(label); @@ -143,7 +141,7 @@ static void print_temp_limits(double limit1, double limit2, #define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP] #define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP] static void print_chip_temp(const sensors_chip_name *name, - const sensors_subfeature *feature, + const sensors_feature *feature, int label_size) { double val, limit1, limit2; @@ -154,7 +152,7 @@ static void print_chip_temp(const sensors_chip_name *name, short has_features[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP + 1] = { 0, }; double feature_vals[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP + 1] = { 0.0, }; - if (!(label = sensors_get_label(name, feature->number))) { + if (!(label = sensors_get_label(name, feature))) { printf("ERROR: Can't get temperature label!\n"); return; } @@ -276,7 +274,7 @@ static void print_chip_temp(const sensors_chip_name *name, #define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN] #define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN] static void print_chip_in(const sensors_chip_name *name, - const sensors_subfeature *feature, + const sensors_feature *feature, int label_size) { const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN + 1; @@ -285,7 +283,7 @@ static void print_chip_in(const sensors_chip_name *name, double val, alarm_max, alarm_min; char *label; - if (!(label = sensors_get_label(name, feature->number))) { + if (!(label = sensors_get_label(name, feature))) { printf("ERROR: Can't get in label!\n"); return; } @@ -336,7 +334,7 @@ static void print_chip_in(const sensors_chip_name *name, #define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN] #define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN] static void print_chip_fan(const sensors_chip_name *name, - const sensors_subfeature *feature, + const sensors_feature *feature, int label_size) { char *label; @@ -345,7 +343,7 @@ static void print_chip_fan(const sensors_chip_name *name, double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN + 1] = { 0.0, }; double val; - if (!(label = sensors_get_label(name, feature->number))) { + if (!(label = sensors_get_label(name, feature))) { printf("ERROR: Can't get fan label!\n"); return; } @@ -383,28 +381,42 @@ static void print_chip_fan(const sensors_chip_name *name, printf("\n"); } -static void print_chip_vid(const sensors_chip_name *name, int f_vid, +static void print_chip_vid(const sensors_chip_name *name, + const sensors_feature *feature, int label_size) { char *label; + const sensors_subfeature *subfeature; double vid; + int i = 0; - if ((label = sensors_get_label(name, f_vid)) - && !sensors_get_value(name, f_vid, &vid)) { + subfeature = sensors_get_all_subfeatures(name, feature, &i); + if (!subfeature) + return; + + if ((label = sensors_get_label(name, feature)) + && !sensors_get_value(name, subfeature->number, &vid)) { print_label(label, label_size); printf("%+6.3f V\n", vid); } free(label); } -static void print_chip_beep_enable(const sensors_chip_name *name, int f_beep, +static void print_chip_beep_enable(const sensors_chip_name *name, + const sensors_feature *feature, int label_size) { char *label; + const sensors_subfeature *subfeature; double beep_enable; + int i = 0; - if ((label = sensors_get_label(name, f_beep)) - && !sensors_get_value(name, f_beep, &beep_enable)) { + subfeature = sensors_get_all_subfeatures(name, feature, &i); + if (!subfeature) + return; + + if ((label = sensors_get_label(name, feature)) + && !sensors_get_value(name, subfeature->number, &beep_enable)) { print_label(label, label_size); printf("%s\n", beep_enable ? "enabled" : "disabled"); } @@ -413,7 +425,7 @@ static void print_chip_beep_enable(const sensors_chip_name *name, int f_beep, void print_chip(const sensors_chip_name *name) { - const sensors_subfeature *feature; + const sensors_feature *feature; int i, label_size; label_size = sensors_get_label_size(name); @@ -431,11 +443,10 @@ void print_chip(const sensors_chip_name *name) print_chip_fan(name, feature, label_size); break; case SENSORS_FEATURE_VID: - print_chip_vid(name, feature->number, label_size); + print_chip_vid(name, feature, label_size); break; case SENSORS_FEATURE_BEEP_ENABLE: - print_chip_beep_enable(name, feature->number, - label_size); + print_chip_beep_enable(name, feature, label_size); break; default: continue; From 9fe2b3c714225986f87404d060db12c34b4a67ca Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:06:51 +0000 Subject: [PATCH 293/718] sensors_get_all_features has a single caller now, so fold it thereinto. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4835 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/lib/access.c b/lib/access.c index 84ae2062..3a424c47 100644 --- a/lib/access.c +++ b/lib/access.c @@ -330,22 +330,6 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus) return NULL; } -static const sensors_subfeature * -sensors_get_all_features(const sensors_chip_name *name, int *nr) -{ - sensors_subfeature *subfeature_list; - int i; - - for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { - subfeature_list = sensors_proc_chips[i].subfeature; - if (*nr >= sensors_proc_chips[i].subfeature_count) - return NULL; - return &subfeature_list[(*nr)++]; - } - return NULL; -} - const sensors_feature * sensors_get_features(const sensors_chip_name *name, int *nr) { @@ -370,18 +354,23 @@ sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr) { const sensors_subfeature *subfeature; + int i; /* Seek directly to the first subfeature */ if (*nr < feature->first_subfeature) *nr = feature->first_subfeature; - subfeature = sensors_get_all_features(name, nr); - if (!subfeature) - return NULL; /* end of list */ - if (subfeature->number == feature->first_subfeature || - subfeature->mapping == feature->first_subfeature) - return subfeature; - return NULL; /* end of subfeature list */ + for (i = 0; i < sensors_proc_chips_count; i++) + if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { + if (*nr >= sensors_proc_chips[i].subfeature_count) + return NULL; /* end of list */ + subfeature = &sensors_proc_chips[i].subfeature[(*nr)++]; + if (subfeature->number == feature->first_subfeature || + subfeature->mapping == feature->first_subfeature) + return subfeature; + return NULL; /* end of subfeature list */ + } + return NULL; /* no matching chip */ } /* Evaluate an expression */ From e13c11d353009a3e750ad45a79381c1405279f1f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:07:53 +0000 Subject: [PATCH 294/718] Update the comments and symbols in the whole library code to refer to features and subfeatures as appropriate. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4836 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 85 +++++++++++++++++++------------------ lib/access.h | 7 +-- lib/data.h | 5 ++- lib/error.c | 2 +- lib/error.h | 2 +- lib/libsensors.3 | 18 ++++---- lib/sensors.h | 16 +++---- lib/sysfs.c | 108 ++++++++++++++++++++++++----------------------- lib/sysfs.h | 4 +- 9 files changed, 128 insertions(+), 119 deletions(-) diff --git a/lib/access.c b/lib/access.c index 3a424c47..e7a91b1a 100644 --- a/lib/access.c +++ b/lib/access.c @@ -86,20 +86,21 @@ sensors_for_all_config_chips(const sensors_chip_name *name, return NULL; } -/* Look up a resource in the intern chip list, and return a pointer to it. +/* Look up a subfeature in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ -const sensors_subfeature *sensors_lookup_feature_nr(const sensors_chip_name *chip, - int feature) +const sensors_subfeature * +sensors_lookup_subfeature_nr(const sensors_chip_name *chip, + int subfeat_nr) { int i; for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { - if (feature < 0 || - feature >= sensors_proc_chips[i].subfeature_count) + if (subfeat_nr < 0 || + subfeat_nr >= sensors_proc_chips[i].subfeature_count) return NULL; - return sensors_proc_chips[i].subfeature + feature; + return sensors_proc_chips[i].subfeature + subfeat_nr; } return NULL; } @@ -108,7 +109,8 @@ const sensors_subfeature *sensors_lookup_feature_nr(const sensors_chip_name *chi Do not modify the struct the return value points to! Returns NULL if not found.*/ static const sensors_subfeature * -sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) +sensors_lookup_subfeature_name(const sensors_chip_name *chip, + const char *name) { int i, j; const sensors_subfeature *subfeatures; @@ -117,7 +119,7 @@ sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { subfeatures = sensors_proc_chips[i].subfeature; for (j = 0; j < sensors_proc_chips[i].subfeature_count; j++) - if (!strcmp(subfeatures[j].name, feature)) + if (!strcmp(subfeatures[j].name, name)) return subfeatures + j; } return NULL; @@ -137,7 +139,7 @@ int sensors_chip_name_has_wildcards(const sensors_chip_name *chip) return 0; } -/* Look up the label which belongs to this chip. Note that chip should not +/* Look up the label for a given feature. Note that chip should not contain wildcard values! The returned string is newly allocated (free it yourself). On failure, NULL is returned. If no label exists for this feature, its name is returned itself. */ @@ -199,13 +201,13 @@ static int sensors_get_ignored(const sensors_chip_name *name, return 0; } -/* Read the value of a feature of a certain chip. Note that chip should not +/* Read the value of a subfeature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_get_value(const sensors_chip_name *name, int feature, +int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *result) { - const sensors_subfeature *main_feature; + const sensors_subfeature *subfeature; const sensors_subfeature *alt_feature; const sensors_chip *chip; const sensors_expr *expr = NULL; @@ -215,21 +217,21 @@ int sensors_get_value(const sensors_chip_name *name, int feature, if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; - if (!(main_feature = sensors_lookup_feature_nr(name, feature))) + if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; - if (main_feature->flags & SENSORS_COMPUTE_MAPPING) - alt_feature = sensors_lookup_feature_nr(name, - main_feature->mapping); + if (subfeature->flags & SENSORS_COMPUTE_MAPPING) + alt_feature = sensors_lookup_subfeature_nr(name, + subfeature->mapping); else alt_feature = NULL; - if (!(main_feature->flags & SENSORS_MODE_R)) + if (!(subfeature->flags & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) { - if (!strcmp(main_feature->name, chip->computes[i].name)) { + if (!strcmp(subfeature->name, chip->computes[i].name)) { expr = chip->computes[i].from_proc; final_expr = 1; } else if (alt_feature && !strcmp(alt_feature->name, @@ -237,7 +239,7 @@ int sensors_get_value(const sensors_chip_name *name, int feature, expr = chip->computes[i].from_proc; } } - if (sensors_read_sysfs_attr(name, feature, &val)) + if (sensors_read_sysfs_attr(name, subfeat_nr, &val)) return -SENSORS_ERR_PROC; if (!expr) *result = val; @@ -246,13 +248,13 @@ int sensors_get_value(const sensors_chip_name *name, int feature, return 0; } -/* Set the value of a feature of a certain chip. Note that chip should not +/* Set the value of a subfeature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_set_value(const sensors_chip_name *name, int feature, +int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value) { - const sensors_subfeature *main_feature; + const sensors_subfeature *subfeature; const sensors_subfeature *alt_feature; const sensors_chip *chip; const sensors_expr *expr = NULL; @@ -262,21 +264,21 @@ int sensors_set_value(const sensors_chip_name *name, int feature, if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; - if (!(main_feature = sensors_lookup_feature_nr(name, feature))) + if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; - if (main_feature->flags & SENSORS_COMPUTE_MAPPING) - alt_feature = sensors_lookup_feature_nr(name, - main_feature->mapping); + if (subfeature->flags & SENSORS_COMPUTE_MAPPING) + alt_feature = sensors_lookup_subfeature_nr(name, + subfeature->mapping); else alt_feature = NULL; - if (!(main_feature->flags & SENSORS_MODE_W)) + if (!(subfeature->flags & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; !final_expr && (i < chip->computes_count); i++) - if (!strcmp(main_feature->name, chip->computes[i].name)) { + if (!strcmp(subfeature->name, chip->computes[i].name)) { expr = chip->computes->to_proc; final_expr = 1; } else if (alt_feature && !strcmp(alt_feature->name, @@ -288,7 +290,7 @@ int sensors_set_value(const sensors_chip_name *name, int feature, if (expr) if ((res = sensors_eval_expr(name, expr, value, &to_write))) return res; - if (sensors_write_sysfs_attr(name, feature, to_write)) + if (sensors_write_sysfs_attr(name, subfeat_nr, to_write)) return -SENSORS_ERR_PROC; return 0; } @@ -380,7 +382,7 @@ int sensors_eval_expr(const sensors_chip_name *name, { double res1, res2; int res; - const sensors_subfeature *feature; + const sensors_subfeature *subfeature; if (expr->kind == sensors_kind_val) { *result = expr->data.val; @@ -391,10 +393,11 @@ int sensors_eval_expr(const sensors_chip_name *name, return 0; } if (expr->kind == sensors_kind_var) { - if (!(feature = sensors_lookup_feature_name(name, + if (!(subfeature = sensors_lookup_subfeature_name(name, expr->data.var))) return SENSORS_ERR_NO_ENTRY; - if (!(res = sensors_get_value(name, feature->number, result))) + if (!(res = sensors_get_value(name, subfeature->number, + result))) return res; return 0; } @@ -442,31 +445,31 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) double value; int i, j; int err = 0, res; - const sensors_subfeature *feature; + const sensors_subfeature *subfeature; int *feature_list = NULL; int feature_count = 0; int feature_max = 0; - int feature_nr; + int subfeat_nr; for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->sets_count; i++) { - feature = sensors_lookup_feature_name(name, + subfeature = sensors_lookup_subfeature_name(name, chip->sets[i].name); - if (!feature) { + if (!subfeature) { sensors_parse_error("Unknown feature name", chip->sets[i].lineno); err = SENSORS_ERR_NO_ENTRY; continue; } - feature_nr = feature->number; + subfeat_nr = subfeature->number; /* Check whether we already set this feature */ for (j = 0; j < feature_count; j++) - if (feature_list[j] == feature_nr) + if (feature_list[j] == subfeat_nr) break; if (j != feature_count) continue; - sensors_add_array_el(&feature_nr, &feature_list, + sensors_add_array_el(&subfeat_nr, &feature_list, &feature_count, &feature_max, sizeof(int)); @@ -478,8 +481,8 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) err = res; continue; } - if ((res = sensors_set_value(name, feature_nr, value))) { - sensors_parse_error("Failed to set feature", + if ((res = sensors_set_value(name, subfeat_nr, value))) { + sensors_parse_error("Failed to set value", chip->sets[i].lineno); err = res; continue; diff --git a/lib/access.h b/lib/access.h index 3e569de4..0ba96ce9 100644 --- a/lib/access.h +++ b/lib/access.h @@ -23,11 +23,12 @@ #include "sensors.h" #include "data.h" -/* Look up a resource in the intern chip list, and return a pointer to it. +/* Look up a subfeature in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found. */ -const sensors_subfeature *sensors_lookup_feature_nr(const sensors_chip_name *chip, - int feature); +const sensors_subfeature * +sensors_lookup_subfeature_nr(const sensors_chip_name *chip, + int subfeat_nr); /* Check whether the chip name is an 'absolute' name, which can only match one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 diff --git a/lib/data.h b/lib/data.h index ec0d175d..04d466ff 100644 --- a/lib/data.h +++ b/lib/data.h @@ -65,7 +65,8 @@ typedef struct sensors_label { int lineno; } sensors_label; -/* Config file set declaration: a feature name, combined with an expression */ +/* Config file set declaration: a subfeature name, combined with an + expression */ typedef struct sensors_set { char *name; sensors_expr *value; @@ -120,7 +121,7 @@ typedef struct sensors_bus { int lineno; } sensors_bus; -/* Internal data about all features of a type of chip */ +/* Internal data about all features and subfeatures of a chip */ typedef struct sensors_chip_features { struct sensors_chip_name chip; struct sensors_feature *feature; diff --git a/lib/error.c b/lib/error.c index 9c90b624..52ca8038 100644 --- a/lib/error.c +++ b/lib/error.c @@ -33,7 +33,7 @@ void (*sensors_fatal_error) (const char *proc, const char *err) = static const char *errorlist[] = { /* Unknown error */ "sensors_strerror: Unknown error!", /* SENSORS_ERR_WILDCARDS */ "Wildcard found in chip name", - /* SENSORS_ERR_NO_ENTRY */ "No such feature known", + /* SENSORS_ERR_NO_ENTRY */ "No such subfeature known", /* SENSORS_ERR_ACCESS */ "Can't read or write", /* SENSORS_ERR_PROC */ "Can't access sysfs file", /* SENSORS_ERR_DIV_ZERO */ "Divide by zero", diff --git a/lib/error.h b/lib/error.h index 47febd68..1b3c9ba7 100644 --- a/lib/error.h +++ b/lib/error.h @@ -21,7 +21,7 @@ #define LIB_SENSORS_ERROR_H #define SENSORS_ERR_WILDCARDS 1 /* Wildcard found in chip name */ -#define SENSORS_ERR_NO_ENTRY 2 /* No such feature known */ +#define SENSORS_ERR_NO_ENTRY 2 /* No such subfeature known */ #define SENSORS_ERR_ACCESS 3 /* Can't read or write */ #define SENSORS_ERR_PROC 4 /* Can't access /proc file */ #define SENSORS_ERR_DIV_ZERO 5 /* Divide by zero */ diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 41dc0882..d42247a0 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -37,9 +37,9 @@ libsensors \- publicly accessible functions provided by the sensors library \fBsensors_chip_name *res);\fP .B const char *sensors_get_adapter_name(int bus_nr); .B char *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature);\fP -.B int sensors_get_value(const sensors_chip_name *name, int feature, +.B int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, \fBdouble *value);\fP -.B int sensors_set_value(const sensors_chip_name *name, int feature, +.B int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, \fBdouble value);\fP .B int sensors_do_chip_sets(const sensors_chip_name *name); .B const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name @@ -78,15 +78,17 @@ contain wildcard values! The returned string is newly allocated (free it yourself). On failure, NULL is returned. If no label exists for this feature, its name is returned itself. -\fBint sensors_get_value(const sensors_chip_name *name, - int feature, double *value);\fP +\fBint sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *value);\fP .br -Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. +Read the value of a subfeature of a certain chip. Note that chip should not +contain wildcard values! This function will return 0 on success, and <0 on +failure. -\fBint sensors_set_value(const sensors_chip_name *name, - int feature, double value);\fP +\fBint sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value);\fP .br -Set the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. +Set the value of a subfeature of a certain chip. Note that chip should not +contain wildcard values! This function will return 0 on success, and <0 on +failure. .B int sensors_do_chip_sets(const sensors_chip_name *name); .br diff --git a/lib/sensors.h b/lib/sensors.h index ce68ca50..23ca3f7d 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -84,23 +84,23 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus); typedef struct sensors_feature sensors_feature; -/* Look up the label which belongs to this chip. Note that chip should not +/* Look up the label for a given feature. Note that chip should not contain wildcard values! The returned string is newly allocated (free it yourself). On failure, NULL is returned. If no label exists for this feature, its name is returned itself. */ char *sensors_get_label(const sensors_chip_name *name, const sensors_feature *feature); -/* Read the value of a feature of a certain chip. Note that chip should not +/* Read the value of a subfeature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_get_value(const sensors_chip_name *name, int feature, +int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *value); -/* Set the value of a feature of a certain chip. Note that chip should not +/* Set the value of a subfeature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ -int sensors_set_value(const sensors_chip_name *name, int feature, +int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value); /* Execute all set statements for this particular chip. The chip may contain @@ -126,8 +126,8 @@ const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name /* This enum contains some "magic" used by sensors_read_dynamic_chip() from lib/sysfs.c. All the sensor types (in, fan, temp, vid) are a multiple of - 0x100 apart, and sensor features which should not have a compute mapping to - the _input feature start at 0x?10. */ + 0x100 apart, and sensor subfeatures which should not have a compute + mapping to the _input subfeature start at 0x?10. */ typedef enum sensors_feature_type { SENSORS_FEATURE_IN = 0x000, SENSORS_FEATURE_IN_MIN, @@ -176,7 +176,7 @@ struct sensors_feature { /* Data about a single chip subfeature: name is the string name used to refer to this subfeature (in config files) number is the internal subfeature number, used in many functions to refer - to this feature + to this subfeature type is the subfeature type mapping is either SENSORS_NO_MAPPING if this subfeature is the main element of category; or it is the number of a subfeature with which diff --git a/lib/sysfs.c b/lib/sysfs.c index 2a50c41d..3d23ed3c 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -38,10 +38,11 @@ char sensors_sysfs_mount[NAME_MAX]; #define MAX_SENSORS_PER_TYPE 20 -#define MAX_SUB_FEATURES 8 +#define MAX_SUBFEATURES 8 /* Room for all 3 types (in, fan, temp) with all their subfeatures + VID + misc features */ -#define ALL_POSSIBLE_FEATURES (MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 \ +#define ALL_POSSIBLE_SUBFEATURES \ + (MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 6 \ + MAX_SENSORS_PER_TYPE + 1) static @@ -64,7 +65,7 @@ int get_type_scaling(int type) } } -/* Static mappings for use by sensors_feature_get_type() */ +/* Static mappings for use by sensors_subfeature_get_type() */ struct feature_subtype_match { const char *name; @@ -125,9 +126,10 @@ static struct feature_type_match matches[] = { { "cpu%d%c", cpu_matches }, }; -/* Return the feature type and channel number based on the feature name */ +/* Return the subfeature type and channel number based on the subfeature + name */ static -sensors_feature_type sensors_feature_get_type(const char *name, int *nr) +sensors_feature_type sensors_subfeature_get_type(const char *name, int *nr) { char c; int i, count; @@ -161,7 +163,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, int i, type, fnum = 0; struct sysfs_attribute *attr; struct dlist *attrs; - sensors_subfeature *features; + sensors_subfeature *all_subfeatures; sensors_subfeature *dyn_subfeatures; sensors_feature *dyn_features; @@ -170,18 +172,19 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, if (attrs == NULL) return -ENOENT; - /* We use a large sparse table at first to store all found features, - so that we can store them sorted at type and index and then later - create a dense sorted table. */ - features = calloc(ALL_POSSIBLE_FEATURES, sizeof(sensors_subfeature)); - if (!features) + /* We use a large sparse table at first to store all found + subfeatures, so that we can store them sorted at type and index + and then later create a dense sorted table. */ + all_subfeatures = calloc(ALL_POSSIBLE_SUBFEATURES, + sizeof(sensors_subfeature)); + if (!all_subfeatures) sensors_fatal_error(__FUNCTION__, "Out of memory"); dlist_for_each_data(attrs, attr, struct sysfs_attribute) { char *name = attr->name; int nr; - type = sensors_feature_get_type(name, &nr); + type = sensors_subfeature_get_type(name, &nr); if (type == SENSORS_FEATURE_UNKNOWN) continue; @@ -197,63 +200,62 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, if (nr >= MAX_SENSORS_PER_TYPE) { fprintf(stderr, "libsensors error, more sensors of one" " type then MAX_SENSORS_PER_TYPE, ignoring " - "feature: %s\n", name); + "subfeature: %s\n", name); continue; } - /* "calculate" a place to store the feature in our sparse, + /* "calculate" a place to store the subfeature in our sparse, sorted table */ switch (type) { case SENSORS_FEATURE_VID: - i = nr + MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6; + i = nr + MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 6; break; case SENSORS_FEATURE_BEEP_ENABLE: - i = MAX_SENSORS_PER_TYPE * MAX_SUB_FEATURES * 6 + + i = MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 6 + MAX_SENSORS_PER_TYPE; break; default: i = (type >> 8) * MAX_SENSORS_PER_TYPE * - MAX_SUB_FEATURES * 2 + nr * MAX_SUB_FEATURES * 2 + - ((type & 0x10) >> 4) * MAX_SUB_FEATURES + + MAX_SUBFEATURES * 2 + nr * MAX_SUBFEATURES * 2 + + ((type & 0x10) >> 4) * MAX_SUBFEATURES + (type & 0x0F); } - if (features[i].name) { + if (all_subfeatures[i].name) { fprintf(stderr, "libsensors error, trying to add dupli" - "cate feature: %s to dynamic feature table\n", + "cate subfeature: %s to dynamic feature table\n", name); continue; } - /* fill in the feature members */ - features[i].type = type; + /* fill in the subfeature members */ + all_subfeatures[i].type = type; /* check for _input extension and remove */ nr = strlen(name); if (nr > 6 && !strcmp(name + nr - 6, "_input")) - features[i].name = strndup(name, nr - 6); + all_subfeatures[i].name = strndup(name, nr - 6); else - features[i].name = strdup(name); + all_subfeatures[i].name = strdup(name); if ((type & 0x00FF) == 0) { - /* main feature */ - features[i].mapping = SENSORS_NO_MAPPING; + /* main subfeature */ + all_subfeatures[i].mapping = SENSORS_NO_MAPPING; } else { - /* sub feature */ /* The mapping is set below after numbering */ if (!(type & 0x10)) - features[i].flags |= SENSORS_COMPUTE_MAPPING; + all_subfeatures[i].flags |= SENSORS_COMPUTE_MAPPING; } if (attr->method & SYSFS_METHOD_SHOW) - features[i].flags |= SENSORS_MODE_R; + all_subfeatures[i].flags |= SENSORS_MODE_R; if (attr->method & SYSFS_METHOD_STORE) - features[i].flags |= SENSORS_MODE_W; + all_subfeatures[i].flags |= SENSORS_MODE_W; fnum++; } - if (!fnum) { /* No feature */ + if (!fnum) { /* No subfeature */ chip->subfeature = NULL; goto exit_free; } @@ -264,14 +266,14 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } fnum = 0; - for (i = 0; i < ALL_POSSIBLE_FEATURES; i++) { - if (features[i].name) { - dyn_subfeatures[fnum] = features[i]; + for (i = 0; i < ALL_POSSIBLE_SUBFEATURES; i++) { + if (all_subfeatures[i].name) { + dyn_subfeatures[fnum] = all_subfeatures[i]; fnum++; } } - /* Number the subfeatures linearly, so that feature number N is at + /* Number the subfeatures linearly, so that subfeature number N is at position N in the array. This allows for O(1) look-ups. */ for (i = 0; i < fnum; i++) { int j; @@ -316,7 +318,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, chip->feature_count = fnum; exit_free: - free(features); + free(all_subfeatures); return 0; } @@ -401,7 +403,7 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) if (sensors_read_dynamic_chip(&entry, dev) < 0) goto exit_free; - if (!entry.subfeature) { /* No feature, discard chip */ + if (!entry.subfeature) { /* No subfeature, discard chip */ err = 0; goto exit_free; } @@ -536,58 +538,58 @@ exit0: return ret; } -int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, +int sensors_read_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, double *value) { - const sensors_subfeature *the_feature; + const sensors_subfeature *subfeature; char n[NAME_MAX]; FILE *f; const char *suffix = ""; - if (!(the_feature = sensors_lookup_feature_nr(name, feature))) + if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ - if (the_feature->type == SENSORS_FEATURE_IN - || the_feature->type == SENSORS_FEATURE_FAN - || the_feature->type == SENSORS_FEATURE_TEMP) + if (subfeature->type == SENSORS_FEATURE_IN + || subfeature->type == SENSORS_FEATURE_FAN + || subfeature->type == SENSORS_FEATURE_TEMP) suffix = "_input"; - snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->name, + snprintf(n, NAME_MAX, "%s/%s%s", name->path, subfeature->name, suffix); if ((f = fopen(n, "r"))) { int res = fscanf(f, "%lf", value); fclose(f); if (res != 1) return -SENSORS_ERR_PROC; - *value /= get_type_scaling(the_feature->type); + *value /= get_type_scaling(subfeature->type); } else return -SENSORS_ERR_PROC; return 0; } -int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, +int sensors_write_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, double value) { - const sensors_subfeature *the_feature; + const sensors_subfeature *subfeature; char n[NAME_MAX]; FILE *f; const char *suffix = ""; - if (!(the_feature = sensors_lookup_feature_nr(name, feature))) + if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ - if (the_feature->type == SENSORS_FEATURE_IN - || the_feature->type == SENSORS_FEATURE_FAN - || the_feature->type == SENSORS_FEATURE_TEMP) + if (subfeature->type == SENSORS_FEATURE_IN + || subfeature->type == SENSORS_FEATURE_FAN + || subfeature->type == SENSORS_FEATURE_TEMP) suffix = "_input"; - snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->name, + snprintf(n, NAME_MAX, "%s/%s%s", name->path, subfeature->name, suffix); if ((f = fopen(n, "w"))) { - value *= get_type_scaling(the_feature->type); + value *= get_type_scaling(subfeature->type); fprintf(f, "%d", (int) value); fclose(f); } else diff --git a/lib/sysfs.h b/lib/sysfs.h index 847011bf..f90a7ae5 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -29,11 +29,11 @@ int sensors_read_sysfs_chips(void); int sensors_read_sysfs_bus(void); /* Read a value out of a sysfs attribute file */ -int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, +int sensors_read_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, double *value); /* Write a value to a sysfs attribute file */ -int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, +int sensors_write_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, double value); #endif /* !SENSORS_LIB_SYSFS_H */ From 65f1d1f1cd28b912168a711d824b49f64ce89035 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:12:19 +0000 Subject: [PATCH 295/718] Rename subfeature types from *_FEATURE_* to *_SUBFEATURE_*, to better reflect what they represent. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4837 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 68 ++++++++--------- lib/sysfs.c | 106 +++++++++++++------------- prog/sensord/chips.c | 120 +++++++++++++++--------------- prog/sensors/chips.c | 172 ++++++++++++++++++++++--------------------- 4 files changed, 234 insertions(+), 232 deletions(-) diff --git a/lib/sensors.h b/lib/sensors.h index 23ca3f7d..dc6dfd97 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -128,49 +128,49 @@ const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name lib/sysfs.c. All the sensor types (in, fan, temp, vid) are a multiple of 0x100 apart, and sensor subfeatures which should not have a compute mapping to the _input subfeature start at 0x?10. */ -typedef enum sensors_feature_type { - SENSORS_FEATURE_IN = 0x000, - SENSORS_FEATURE_IN_MIN, - SENSORS_FEATURE_IN_MAX, - SENSORS_FEATURE_IN_ALARM = 0x010, - SENSORS_FEATURE_IN_MIN_ALARM, - SENSORS_FEATURE_IN_MAX_ALARM, - SENSORS_FEATURE_IN_BEEP, +typedef enum sensors_subfeature_type { + SENSORS_SUBFEATURE_IN_INPUT = 0x000, + SENSORS_SUBFEATURE_IN_MIN, + SENSORS_SUBFEATURE_IN_MAX, + SENSORS_SUBFEATURE_IN_ALARM = 0x010, + SENSORS_SUBFEATURE_IN_MIN_ALARM, + SENSORS_SUBFEATURE_IN_MAX_ALARM, + SENSORS_SUBFEATURE_IN_BEEP, - SENSORS_FEATURE_FAN = 0x100, - SENSORS_FEATURE_FAN_MIN, - SENSORS_FEATURE_FAN_ALARM = 0x110, - SENSORS_FEATURE_FAN_FAULT, - SENSORS_FEATURE_FAN_DIV, - SENSORS_FEATURE_FAN_BEEP, + SENSORS_SUBFEATURE_FAN_INPUT = 0x100, + SENSORS_SUBFEATURE_FAN_MIN, + SENSORS_SUBFEATURE_FAN_ALARM = 0x110, + SENSORS_SUBFEATURE_FAN_FAULT, + SENSORS_SUBFEATURE_FAN_DIV, + SENSORS_SUBFEATURE_FAN_BEEP, - SENSORS_FEATURE_TEMP = 0x200, - SENSORS_FEATURE_TEMP_MAX, - SENSORS_FEATURE_TEMP_MAX_HYST, - SENSORS_FEATURE_TEMP_MIN, - SENSORS_FEATURE_TEMP_CRIT, - SENSORS_FEATURE_TEMP_CRIT_HYST, - SENSORS_FEATURE_TEMP_ALARM = 0x210, - SENSORS_FEATURE_TEMP_MAX_ALARM, - SENSORS_FEATURE_TEMP_MIN_ALARM, - SENSORS_FEATURE_TEMP_CRIT_ALARM, - SENSORS_FEATURE_TEMP_FAULT, - SENSORS_FEATURE_TEMP_TYPE, - SENSORS_FEATURE_TEMP_OFFSET, - SENSORS_FEATURE_TEMP_BEEP, + SENSORS_SUBFEATURE_TEMP_INPUT = 0x200, + SENSORS_SUBFEATURE_TEMP_MAX, + SENSORS_SUBFEATURE_TEMP_MAX_HYST, + SENSORS_SUBFEATURE_TEMP_MIN, + SENSORS_SUBFEATURE_TEMP_CRIT, + SENSORS_SUBFEATURE_TEMP_CRIT_HYST, + SENSORS_SUBFEATURE_TEMP_ALARM = 0x210, + SENSORS_SUBFEATURE_TEMP_MAX_ALARM, + SENSORS_SUBFEATURE_TEMP_MIN_ALARM, + SENSORS_SUBFEATURE_TEMP_CRIT_ALARM, + SENSORS_SUBFEATURE_TEMP_FAULT, + SENSORS_SUBFEATURE_TEMP_TYPE, + SENSORS_SUBFEATURE_TEMP_OFFSET, + SENSORS_SUBFEATURE_TEMP_BEEP, - SENSORS_FEATURE_VID = 0x1000, + SENSORS_SUBFEATURE_VID = 0x1000, - SENSORS_FEATURE_BEEP_ENABLE = 0x1100, + SENSORS_SUBFEATURE_BEEP_ENABLE = 0x1100, - SENSORS_FEATURE_UNKNOWN = INT_MAX, -} sensors_feature_type; + SENSORS_SUBFEATURE_UNKNOWN = INT_MAX, +} sensors_subfeature_type; /* Data about a single chip feature (or category leader) */ struct sensors_feature { char *name; int first_subfeature; - sensors_feature_type type; + sensors_subfeature_type type; }; /* Data about a single chip subfeature: @@ -188,7 +188,7 @@ struct sensors_feature { typedef struct sensors_subfeature { char *name; int number; - sensors_feature_type type; + sensors_subfeature_type type; int mapping; unsigned int flags; } sensors_subfeature; diff --git a/lib/sysfs.c b/lib/sysfs.c index 3d23ed3c..37ad62c9 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -49,16 +49,16 @@ static int get_type_scaling(int type) { switch (type & 0xFF10) { - case SENSORS_FEATURE_IN: - case SENSORS_FEATURE_TEMP: + case SENSORS_SUBFEATURE_IN_INPUT: + case SENSORS_SUBFEATURE_TEMP_INPUT: return 1000; - case SENSORS_FEATURE_FAN: + case SENSORS_SUBFEATURE_FAN_INPUT: return 1; } switch (type) { - case SENSORS_FEATURE_VID: - case SENSORS_FEATURE_TEMP_OFFSET: + case SENSORS_SUBFEATURE_VID: + case SENSORS_SUBFEATURE_TEMP_OFFSET: return 1000; default: return 1; @@ -66,56 +66,56 @@ int get_type_scaling(int type) } /* Static mappings for use by sensors_subfeature_get_type() */ -struct feature_subtype_match +struct subfeature_type_match { const char *name; - sensors_feature_type type; + sensors_subfeature_type type; }; struct feature_type_match { const char *name; - const struct feature_subtype_match *submatches; + const struct subfeature_type_match *submatches; }; -static const struct feature_subtype_match temp_matches[] = { - { "input", SENSORS_FEATURE_TEMP }, - { "max", SENSORS_FEATURE_TEMP_MAX }, - { "max_hyst", SENSORS_FEATURE_TEMP_MAX_HYST }, - { "min", SENSORS_FEATURE_TEMP_MIN }, - { "crit", SENSORS_FEATURE_TEMP_CRIT }, - { "crit_hyst", SENSORS_FEATURE_TEMP_CRIT_HYST }, - { "alarm", SENSORS_FEATURE_TEMP_ALARM }, - { "min_alarm", SENSORS_FEATURE_TEMP_MIN_ALARM }, - { "max_alarm", SENSORS_FEATURE_TEMP_MAX_ALARM }, - { "crit_alarm", SENSORS_FEATURE_TEMP_CRIT_ALARM }, - { "fault", SENSORS_FEATURE_TEMP_FAULT }, - { "type", SENSORS_FEATURE_TEMP_TYPE }, - { "offset", SENSORS_FEATURE_TEMP_OFFSET }, +static const struct subfeature_type_match temp_matches[] = { + { "input", SENSORS_SUBFEATURE_TEMP_INPUT }, + { "max", SENSORS_SUBFEATURE_TEMP_MAX }, + { "max_hyst", SENSORS_SUBFEATURE_TEMP_MAX_HYST }, + { "min", SENSORS_SUBFEATURE_TEMP_MIN }, + { "crit", SENSORS_SUBFEATURE_TEMP_CRIT }, + { "crit_hyst", SENSORS_SUBFEATURE_TEMP_CRIT_HYST }, + { "alarm", SENSORS_SUBFEATURE_TEMP_ALARM }, + { "min_alarm", SENSORS_SUBFEATURE_TEMP_MIN_ALARM }, + { "max_alarm", SENSORS_SUBFEATURE_TEMP_MAX_ALARM }, + { "crit_alarm", SENSORS_SUBFEATURE_TEMP_CRIT_ALARM }, + { "fault", SENSORS_SUBFEATURE_TEMP_FAULT }, + { "type", SENSORS_SUBFEATURE_TEMP_TYPE }, + { "offset", SENSORS_SUBFEATURE_TEMP_OFFSET }, { NULL, 0 } }; -static const struct feature_subtype_match in_matches[] = { - { "input", SENSORS_FEATURE_IN }, - { "min", SENSORS_FEATURE_IN_MIN }, - { "max", SENSORS_FEATURE_IN_MAX }, - { "alarm", SENSORS_FEATURE_IN_ALARM }, - { "min_alarm", SENSORS_FEATURE_IN_MIN_ALARM }, - { "max_alarm", SENSORS_FEATURE_IN_MAX_ALARM }, +static const struct subfeature_type_match in_matches[] = { + { "input", SENSORS_SUBFEATURE_IN_INPUT }, + { "min", SENSORS_SUBFEATURE_IN_MIN }, + { "max", SENSORS_SUBFEATURE_IN_MAX }, + { "alarm", SENSORS_SUBFEATURE_IN_ALARM }, + { "min_alarm", SENSORS_SUBFEATURE_IN_MIN_ALARM }, + { "max_alarm", SENSORS_SUBFEATURE_IN_MAX_ALARM }, { NULL, 0 } }; -static const struct feature_subtype_match fan_matches[] = { - { "input", SENSORS_FEATURE_FAN }, - { "min", SENSORS_FEATURE_FAN_MIN }, - { "div", SENSORS_FEATURE_FAN_DIV }, - { "alarm", SENSORS_FEATURE_FAN_ALARM }, - { "fault", SENSORS_FEATURE_FAN_FAULT }, +static const struct subfeature_type_match fan_matches[] = { + { "input", SENSORS_SUBFEATURE_FAN_INPUT }, + { "min", SENSORS_SUBFEATURE_FAN_MIN }, + { "div", SENSORS_SUBFEATURE_FAN_DIV }, + { "alarm", SENSORS_SUBFEATURE_FAN_ALARM }, + { "fault", SENSORS_SUBFEATURE_FAN_FAULT }, { NULL, 0 } }; -static const struct feature_subtype_match cpu_matches[] = { - { "vid", SENSORS_FEATURE_VID }, +static const struct subfeature_type_match cpu_matches[] = { + { "vid", SENSORS_SUBFEATURE_VID }, { NULL, 0 } }; @@ -129,16 +129,16 @@ static struct feature_type_match matches[] = { /* Return the subfeature type and channel number based on the subfeature name */ static -sensors_feature_type sensors_subfeature_get_type(const char *name, int *nr) +sensors_subfeature_type sensors_subfeature_get_type(const char *name, int *nr) { char c; int i, count; - const struct feature_subtype_match *submatches; + const struct subfeature_type_match *submatches; /* Special case */ if (!strcmp(name, "beep_enable")) { *nr = 0; - return SENSORS_FEATURE_BEEP_ENABLE; + return SENSORS_SUBFEATURE_BEEP_ENABLE; } for (i = 0; i < ARRAY_SIZE(matches); i++) @@ -146,7 +146,7 @@ sensors_feature_type sensors_subfeature_get_type(const char *name, int *nr) break; if (i == ARRAY_SIZE(matches) || count != 2 || c != '_') - return SENSORS_FEATURE_UNKNOWN; /* no match */ + return SENSORS_SUBFEATURE_UNKNOWN; /* no match */ submatches = matches[i].submatches; name = strchr(name + 3, '_') + 1; @@ -154,7 +154,7 @@ sensors_feature_type sensors_subfeature_get_type(const char *name, int *nr) if (!strcmp(name, submatches[i].name)) return submatches[i].type; - return SENSORS_FEATURE_UNKNOWN; + return SENSORS_SUBFEATURE_UNKNOWN; } static int sensors_read_dynamic_chip(sensors_chip_features *chip, @@ -185,13 +185,13 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, int nr; type = sensors_subfeature_get_type(name, &nr); - if (type == SENSORS_FEATURE_UNKNOWN) + if (type == SENSORS_SUBFEATURE_UNKNOWN) continue; /* Adjust the channel number */ switch (type & 0xFF00) { - case SENSORS_FEATURE_FAN: - case SENSORS_FEATURE_TEMP: + case SENSORS_SUBFEATURE_FAN_INPUT: + case SENSORS_SUBFEATURE_TEMP_INPUT: if (nr) nr--; break; @@ -207,10 +207,10 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* "calculate" a place to store the subfeature in our sparse, sorted table */ switch (type) { - case SENSORS_FEATURE_VID: + case SENSORS_SUBFEATURE_VID: i = nr + MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 6; break; - case SENSORS_FEATURE_BEEP_ENABLE: + case SENSORS_SUBFEATURE_BEEP_ENABLE: i = MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 6 + MAX_SENSORS_PER_TYPE; break; @@ -550,9 +550,9 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ - if (subfeature->type == SENSORS_FEATURE_IN - || subfeature->type == SENSORS_FEATURE_FAN - || subfeature->type == SENSORS_FEATURE_TEMP) + if (subfeature->type == SENSORS_SUBFEATURE_IN_INPUT + || subfeature->type == SENSORS_SUBFEATURE_FAN_INPUT + || subfeature->type == SENSORS_SUBFEATURE_TEMP_INPUT) suffix = "_input"; snprintf(n, NAME_MAX, "%s/%s%s", name->path, subfeature->name, @@ -581,9 +581,9 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, return -SENSORS_ERR_NO_ENTRY; /* REVISIT: this is a ugly hack */ - if (subfeature->type == SENSORS_FEATURE_IN - || subfeature->type == SENSORS_FEATURE_FAN - || subfeature->type == SENSORS_FEATURE_TEMP) + if (subfeature->type == SENSORS_SUBFEATURE_IN_INPUT + || subfeature->type == SENSORS_SUBFEATURE_FAN_INPUT + || subfeature->type == SENSORS_SUBFEATURE_TEMP_INPUT) suffix = "_input"; snprintf(n, NAME_MAX, "%s/%s%s", name->path, subfeature->name, diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 5e9551ec..43b34960 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -162,30 +162,30 @@ static void getAvailableFeatures (const sensors_chip_name *name, } } -#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN] -#define IN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_IN] +#define IN_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_IN_INPUT] +#define IN_FEATURE_NR(x) feature_nrs[x - SENSORS_SUBFEATURE_IN_INPUT] static void fillChipVoltage (FeatureDescriptor *voltage, const sensors_chip_name *name, const sensors_feature *feature) { - const int size = SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN + 1; - short has_features[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN + 1] = { 0, }; - int feature_nrs[SENSORS_FEATURE_IN_BEEP - SENSORS_FEATURE_IN + 1]; + const int size = SENSORS_SUBFEATURE_IN_BEEP - SENSORS_SUBFEATURE_IN_INPUT + 1; + short has_features[SENSORS_SUBFEATURE_IN_BEEP - SENSORS_SUBFEATURE_IN_INPUT + 1] = { 0, }; + int feature_nrs[SENSORS_SUBFEATURE_IN_BEEP - SENSORS_SUBFEATURE_IN_INPUT + 1]; int pos = 0; voltage->rrd = rrdF2; voltage->type = DataType_voltage; getAvailableFeatures (name, feature, has_features, - feature_nrs, size, SENSORS_FEATURE_IN); + feature_nrs, size, SENSORS_SUBFEATURE_IN_INPUT); - voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_FEATURE_IN); + voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_INPUT); - if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && - IN_FEATURE(SENSORS_FEATURE_IN_MAX)) { + if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN) && + IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX)) { voltage->format = fmtVolts_2; - voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_FEATURE_IN_MIN); - voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_FEATURE_IN_MAX); + voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_MIN); + voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_MAX); } else { voltage->format = fmtVolt_2; } @@ -194,52 +194,52 @@ static void fillChipVoltage (FeatureDescriptor *voltage, voltage->dataNumbers[pos] = -1; /* alarm if applicable */ - if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { - voltage->alarmNumber = IN_FEATURE_NR(SENSORS_FEATURE_IN_ALARM); - } else if (IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { - voltage->alarmNumber = IN_FEATURE_NR(SENSORS_FEATURE_IN_MIN_ALARM); - } else if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM)) { - voltage->alarmNumber = IN_FEATURE_NR(SENSORS_FEATURE_IN_MAX_ALARM); + if (IN_FEATURE(SENSORS_SUBFEATURE_IN_ALARM)) { + voltage->alarmNumber = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_ALARM); + } else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN_ALARM)) { + voltage->alarmNumber = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_MIN_ALARM); + } else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX_ALARM)) { + voltage->alarmNumber = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_MAX_ALARM); } else { voltage->alarmNumber = -1; } /* beep if applicable */ - if (IN_FEATURE(SENSORS_FEATURE_IN_BEEP)) { - voltage->beepNumber = IN_FEATURE_NR(SENSORS_FEATURE_IN_ALARM); + if (IN_FEATURE(SENSORS_SUBFEATURE_IN_BEEP)) { + voltage->beepNumber = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_ALARM); } else { voltage->beepNumber = -1; } } -#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP] -#define TEMP_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_TEMP] +#define TEMP_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_TEMP_INPUT] +#define TEMP_FEATURE_NR(x) feature_nrs[x - SENSORS_SUBFEATURE_TEMP_INPUT] static void fillChipTemperature (FeatureDescriptor *temperature, const sensors_chip_name *name, const sensors_feature *feature) { - const int size = SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP + 1; - short has_features[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP + 1] = { 0, }; - int feature_nrs[SENSORS_FEATURE_TEMP_BEEP - SENSORS_FEATURE_TEMP + 1]; + const int size = SENSORS_SUBFEATURE_TEMP_BEEP - SENSORS_SUBFEATURE_TEMP_INPUT + 1; + short has_features[SENSORS_SUBFEATURE_TEMP_BEEP - SENSORS_SUBFEATURE_TEMP_INPUT + 1] = { 0, }; + int feature_nrs[SENSORS_SUBFEATURE_TEMP_BEEP - SENSORS_SUBFEATURE_TEMP_INPUT + 1]; int pos = 0; temperature->rrd = rrdF1; temperature->type = DataType_temperature; getAvailableFeatures (name, feature, has_features, - feature_nrs, size, SENSORS_FEATURE_TEMP); + feature_nrs, size, SENSORS_SUBFEATURE_TEMP_INPUT); - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP); + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_INPUT); - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN) && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MIN) && + TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX)) { temperature->format = fmtTemps_minmax_1; - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MIN); - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MAX); - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX) && - TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MIN); + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MAX); + } else if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX) && + TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX_HYST)) { temperature->format = fmtTemps_1; - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MAX); - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MAX_HYST); + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MAX); + temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MAX_HYST); } else { temperature->format = fmtTemp_only; } @@ -248,45 +248,45 @@ static void fillChipTemperature (FeatureDescriptor *temperature, temperature->dataNumbers[pos] = -1; /* alarm if applicable */ - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM)) { - temperature->alarmNumber = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_ALARM); - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM)) { - temperature->alarmNumber = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_MAX_ALARM); + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_ALARM)) { + temperature->alarmNumber = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_ALARM); + } else if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX_ALARM)) { + temperature->alarmNumber = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MAX_ALARM); } else { temperature->alarmNumber = -1; } /* beep if applicable */ - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_BEEP)) { - temperature->beepNumber = TEMP_FEATURE_NR(SENSORS_FEATURE_TEMP_BEEP); + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_BEEP)) { + temperature->beepNumber = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_BEEP); } else { temperature->beepNumber = -1; } } -#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN] -#define FAN_FEATURE_NR(x) feature_nrs[x - SENSORS_FEATURE_FAN] +#define FAN_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_FAN_INPUT] +#define FAN_FEATURE_NR(x) feature_nrs[x - SENSORS_SUBFEATURE_FAN_INPUT] static void fillChipFan (FeatureDescriptor *fan, const sensors_chip_name *name, const sensors_feature *feature) { - const int size = SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN + 1; - short has_features[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN + 1] = { 0, }; - int feature_nrs[SENSORS_FEATURE_FAN_BEEP - SENSORS_FEATURE_FAN + 1]; + const int size = SENSORS_SUBFEATURE_FAN_BEEP - SENSORS_SUBFEATURE_FAN_INPUT + 1; + short has_features[SENSORS_SUBFEATURE_FAN_BEEP - SENSORS_SUBFEATURE_FAN_INPUT + 1] = { 0, }; + int feature_nrs[SENSORS_SUBFEATURE_FAN_BEEP - SENSORS_SUBFEATURE_FAN_INPUT + 1]; int pos = 0; fan->rrd = rrdF0; fan->type = DataType_rpm; getAvailableFeatures (name, feature, has_features, - feature_nrs, size, SENSORS_FEATURE_FAN); + feature_nrs, size, SENSORS_SUBFEATURE_FAN_INPUT); - fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_FEATURE_FAN); + fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_INPUT); - if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) { - fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_FEATURE_FAN_MIN); - if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) { + if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_MIN)) { + fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_MIN); + if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_DIV)) { fan->format = fmtFans_0; - fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_FEATURE_FAN_DIV); + fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_DIV); } else { fan->format = fmtFans_nodiv_0; } @@ -298,14 +298,14 @@ static void fillChipFan (FeatureDescriptor *fan, fan->dataNumbers[pos] = -1; /* alarm if applicable */ - if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM)) { - fan->alarmNumber = FAN_FEATURE_NR(SENSORS_FEATURE_FAN_ALARM); + if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_ALARM)) { + fan->alarmNumber = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_ALARM); } else { fan->alarmNumber = -1; } /* beep if applicable */ - if (FAN_FEATURE(SENSORS_FEATURE_FAN_BEEP)) { - fan->beepNumber = FAN_FEATURE_NR(SENSORS_FEATURE_FAN_BEEP); + if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_BEEP)) { + fan->beepNumber = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_BEEP); } else { fan->beepNumber = -1; } @@ -373,19 +373,19 @@ FeatureDescriptor * generateChipFeatures (const sensors_chip_name *chip) nr = 0; while ((sensor = sensors_get_features(chip, &nr))) { switch (sensor->type) { - case SENSORS_FEATURE_TEMP: + case SENSORS_SUBFEATURE_TEMP_INPUT: fillChipTemperature(&features[count], chip, sensor); break; - case SENSORS_FEATURE_IN: + case SENSORS_SUBFEATURE_IN_INPUT: fillChipVoltage(&features[count], chip, sensor); break; - case SENSORS_FEATURE_FAN: + case SENSORS_SUBFEATURE_FAN_INPUT: fillChipFan(&features[count], chip, sensor); break; - case SENSORS_FEATURE_VID: + case SENSORS_SUBFEATURE_VID: fillChipVid(&features[count], chip, sensor); break; - case SENSORS_FEATURE_BEEP_ENABLE: + case SENSORS_SUBFEATURE_BEEP_ENABLE: fillChipBeepEnable(&features[count], chip, sensor); break; default: diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 1e8cf6f3..b411820e 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -138,8 +138,8 @@ static void print_temp_limits(double limit1, double limit2, printf("ALARM "); } -#define TEMP_FEATURE(x) has_features[x - SENSORS_FEATURE_TEMP] -#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_TEMP] +#define TEMP_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_TEMP_INPUT] +#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_SUBFEATURE_TEMP_INPUT] static void print_chip_temp(const sensors_chip_name *name, const sensors_feature *feature, int label_size) @@ -148,9 +148,9 @@ static void print_chip_temp(const sensors_chip_name *name, const char *s1, *s2; int alarm, crit_displayed = 0; char *label; - const int size = SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP + 1; - short has_features[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP + 1] = { 0, }; - double feature_vals[SENSORS_FEATURE_TEMP_TYPE - SENSORS_FEATURE_TEMP + 1] = { 0.0, }; + const int size = SENSORS_SUBFEATURE_TEMP_TYPE - SENSORS_SUBFEATURE_TEMP_INPUT + 1; + short has_features[SENSORS_SUBFEATURE_TEMP_TYPE - SENSORS_SUBFEATURE_TEMP_INPUT + 1] = { 0, }; + double feature_vals[SENSORS_SUBFEATURE_TEMP_TYPE - SENSORS_SUBFEATURE_TEMP_INPUT + 1] = { 0.0, }; if (!(label = sensors_get_label(name, feature))) { printf("ERROR: Can't get temperature label!\n"); @@ -159,38 +159,38 @@ static void print_chip_temp(const sensors_chip_name *name, sensors_get_available_features(name, feature, has_features, feature_vals, size, - SENSORS_FEATURE_TEMP); - val = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP); + SENSORS_SUBFEATURE_TEMP_INPUT); + val = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_INPUT); - alarm = TEMP_FEATURE(SENSORS_FEATURE_TEMP_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_ALARM); - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX)) { - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_ALARM)) + alarm = TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_ALARM) && + TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_ALARM); + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX)) { + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX_ALARM) && + TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MAX_ALARM)) alarm |= 1; - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN)) { - limit1 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN); + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MIN)) { + limit1 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MIN); s1 = "low"; - limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MAX); s2 = "high"; - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MIN_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MIN_ALARM)) + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MIN_ALARM) && + TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MIN_ALARM)) alarm |= 1; } else { - limit1 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX); + limit1 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MAX); s1 = "high"; - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_MAX_HYST)) { - limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_MAX_HYST); + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX_HYST)) { + limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MAX_HYST); s2 = "hyst"; - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + } else if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT)) { + limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT); s2 = "crit"; - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM)) alarm |= 1; crit_displayed = 1; } else { @@ -198,20 +198,20 @@ static void print_chip_temp(const sensors_chip_name *name, s2 = NULL; } } - } else if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - limit1 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + } else if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT)) { + limit1 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT); s1 = "crit"; - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) { - limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST); + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_HYST)) { + limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_HYST); s2 = "hyst"; } else { limit2 = 0; s2 = NULL; } - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM)) + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM)) alarm |= 1; crit_displayed = 1; } else { @@ -222,8 +222,8 @@ static void print_chip_temp(const sensors_chip_name *name, print_label(label, label_size); free(label); - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_FAULT) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_FAULT)) { + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_FAULT) && + TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_FAULT)) { printf(" FAULT "); } else { if (fahrenheit) @@ -232,28 +232,28 @@ static void print_chip_temp(const sensors_chip_name *name, } print_temp_limits(limit1, limit2, s1, s2, alarm); - if (!crit_displayed && TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT)) { - limit1 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT); + if (!crit_displayed && TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT)) { + limit1 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT); s1 = "crit"; - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_HYST)) { - limit2 = TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_HYST); + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_HYST)) { + limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_HYST); s2 = "hyst"; } else { limit2 = 0; s2 = NULL; } - alarm = TEMP_FEATURE(SENSORS_FEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_CRIT_ALARM); + alarm = TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM) && + TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM); printf("\n%*s", label_size + 10, ""); print_temp_limits(limit1, limit2, s1, s2, alarm); } /* print out temperature sensor info */ - if (TEMP_FEATURE(SENSORS_FEATURE_TEMP_TYPE)) { - int sens = (int)TEMP_FEATURE_VAL(SENSORS_FEATURE_TEMP_TYPE); + if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_TYPE)) { + int sens = (int)TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_TYPE); /* older kernels / drivers sometimes report a beta value for thermistors */ @@ -271,15 +271,15 @@ static void print_chip_temp(const sensors_chip_name *name, printf("\n"); } -#define IN_FEATURE(x) has_features[x - SENSORS_FEATURE_IN] -#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_IN] +#define IN_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_IN_INPUT] +#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_SUBFEATURE_IN_INPUT] static void print_chip_in(const sensors_chip_name *name, const sensors_feature *feature, int label_size) { - const int size = SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN + 1; - short has_features[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN + 1] = { 0, }; - double feature_vals[SENSORS_FEATURE_IN_MAX_ALARM - SENSORS_FEATURE_IN + 1] = { 0.0, }; + const int size = SENSORS_SUBFEATURE_IN_MAX_ALARM - SENSORS_SUBFEATURE_IN_INPUT + 1; + short has_features[SENSORS_SUBFEATURE_IN_MAX_ALARM - SENSORS_SUBFEATURE_IN_INPUT + 1] = { 0, }; + double feature_vals[SENSORS_SUBFEATURE_IN_MAX_ALARM - SENSORS_SUBFEATURE_IN_INPUT + 1] = { 0.0, }; double val, alarm_max, alarm_min; char *label; @@ -289,29 +289,30 @@ static void print_chip_in(const sensors_chip_name *name, } sensors_get_available_features(name, feature, has_features, - feature_vals, size, SENSORS_FEATURE_IN); - val = IN_FEATURE_VAL(SENSORS_FEATURE_IN); + feature_vals, size, + SENSORS_SUBFEATURE_IN_INPUT); + val = IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_INPUT); print_label(label, label_size); free(label); printf("%+6.2f V", val); - if (IN_FEATURE(SENSORS_FEATURE_IN_MIN) && - IN_FEATURE(SENSORS_FEATURE_IN_MAX)) + if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN) && + IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX)) printf(" (min = %+6.2f V, max = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN), - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); - else if (IN_FEATURE(SENSORS_FEATURE_IN_MIN)) + IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MIN), + IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MAX)); + else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN)) printf(" (min = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN)); - else if (IN_FEATURE(SENSORS_FEATURE_IN_MAX)) + IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MIN)); + else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX)) printf(" (max = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX)); + IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MAX)); - if (IN_FEATURE(SENSORS_FEATURE_IN_MAX_ALARM) || - IN_FEATURE(SENSORS_FEATURE_IN_MIN_ALARM)) { - alarm_max = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MAX_ALARM); - alarm_min = IN_FEATURE_VAL(SENSORS_FEATURE_IN_MIN_ALARM); + if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX_ALARM) || + IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN_ALARM)) { + alarm_max = IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MAX_ALARM); + alarm_min = IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MIN_ALARM); if (alarm_min || alarm_max) { printf(" ALARM ("); @@ -323,24 +324,24 @@ static void print_chip_in(const sensors_chip_name *name, printf(")"); } - } else if (IN_FEATURE(SENSORS_FEATURE_IN_ALARM)) { + } else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_ALARM)) { printf(" %s", - IN_FEATURE_VAL(SENSORS_FEATURE_IN_ALARM) ? "ALARM" : ""); + IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_ALARM) ? "ALARM" : ""); } printf("\n"); } -#define FAN_FEATURE(x) has_features[x - SENSORS_FEATURE_FAN] -#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_FEATURE_FAN] +#define FAN_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_FAN_INPUT] +#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_SUBFEATURE_FAN_INPUT] static void print_chip_fan(const sensors_chip_name *name, const sensors_feature *feature, int label_size) { char *label; - const int size = SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN + 1; - short has_features[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN + 1] = { 0, }; - double feature_vals[SENSORS_FEATURE_FAN_DIV - SENSORS_FEATURE_FAN + 1] = { 0.0, }; + const int size = SENSORS_SUBFEATURE_FAN_DIV - SENSORS_SUBFEATURE_FAN_INPUT + 1; + short has_features[SENSORS_SUBFEATURE_FAN_DIV - SENSORS_SUBFEATURE_FAN_INPUT + 1] = { 0, }; + double feature_vals[SENSORS_SUBFEATURE_FAN_DIV - SENSORS_SUBFEATURE_FAN_INPUT + 1] = { 0.0, }; double val; if (!(label = sensors_get_label(name, feature))) { @@ -352,29 +353,30 @@ static void print_chip_fan(const sensors_chip_name *name, free(label); sensors_get_available_features(name, feature, has_features, - feature_vals, size, SENSORS_FEATURE_FAN); - val = FAN_FEATURE_VAL(SENSORS_FEATURE_FAN); + feature_vals, size, + SENSORS_SUBFEATURE_FAN_INPUT); + val = FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_INPUT); - if (FAN_FEATURE(SENSORS_FEATURE_FAN_FAULT) && - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_FAULT)) + if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_FAULT) && + FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_FAULT)) printf(" FAULT"); else printf("%4.0f RPM", val); - if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN) && - FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) + if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_MIN) && + FAN_FEATURE(SENSORS_SUBFEATURE_FAN_DIV)) printf(" (min = %4.0f RPM, div = %1.0f)", - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN), - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); - else if (FAN_FEATURE(SENSORS_FEATURE_FAN_MIN)) + FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_MIN), + FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_DIV)); + else if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_MIN)) printf(" (min = %4.0f RPM)", - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_MIN)); - else if (FAN_FEATURE(SENSORS_FEATURE_FAN_DIV)) + FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_MIN)); + else if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_DIV)) printf(" (div = %1.0f)", - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_DIV)); + FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_DIV)); - if (FAN_FEATURE(SENSORS_FEATURE_FAN_ALARM) && - FAN_FEATURE_VAL(SENSORS_FEATURE_FAN_ALARM)) { + if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_ALARM) && + FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_ALARM)) { printf(" ALARM"); } @@ -433,19 +435,19 @@ void print_chip(const sensors_chip_name *name) i = 0; while ((feature = sensors_get_features(name, &i))) { switch (feature->type) { - case SENSORS_FEATURE_TEMP: + case SENSORS_SUBFEATURE_TEMP_INPUT: print_chip_temp(name, feature, label_size); break; - case SENSORS_FEATURE_IN: + case SENSORS_SUBFEATURE_IN_INPUT: print_chip_in(name, feature, label_size); break; - case SENSORS_FEATURE_FAN: + case SENSORS_SUBFEATURE_FAN_INPUT: print_chip_fan(name, feature, label_size); break; - case SENSORS_FEATURE_VID: + case SENSORS_SUBFEATURE_VID: print_chip_vid(name, feature, label_size); break; - case SENSORS_FEATURE_BEEP_ENABLE: + case SENSORS_SUBFEATURE_BEEP_ENABLE: print_chip_beep_enable(name, feature, label_size); break; default: From da7b4e48da21fd4046ff93d0171bf64eb80d416e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:16:50 +0000 Subject: [PATCH 296/718] Introduce a separate type for main features. Make subfeatures map to the real main feature rather than the first subfeature. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4838 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 50 ++++++++----- lib/libsensors.3 | 7 +- lib/sensors.h | 20 +++-- lib/sysfs.c | 169 ++++++++++++++++++++----------------------- prog/sensord/chips.c | 10 +-- prog/sensors/chips.c | 10 +-- 6 files changed, 136 insertions(+), 130 deletions(-) diff --git a/lib/access.c b/lib/access.c index e7a91b1a..d905bff1 100644 --- a/lib/access.c +++ b/lib/access.c @@ -105,6 +105,24 @@ sensors_lookup_subfeature_nr(const sensors_chip_name *chip, return NULL; } +/* Look up a feature in the intern chip list, and return a pointer to it. + Do not modify the struct the return value points to! Returns NULL if + not found.*/ +static const sensors_feature * +sensors_lookup_feature_nr(const sensors_chip_name *chip, int feat_nr) +{ + int i; + + for (i = 0; i < sensors_proc_chips_count; i++) + if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { + if (feat_nr < 0 || + feat_nr >= sensors_proc_chips[i].feature_count) + return NULL; + return sensors_proc_chips[i].feature + feat_nr; + } + return NULL; +} + /* Look up a resource in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ @@ -208,12 +226,11 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *result) { const sensors_subfeature *subfeature; - const sensors_subfeature *alt_feature; + const sensors_feature *feature; const sensors_chip *chip; const sensors_expr *expr = NULL; double val; int res, i; - int final_expr = 0; if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; @@ -221,20 +238,17 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, return -SENSORS_ERR_NO_ENTRY; if (subfeature->flags & SENSORS_COMPUTE_MAPPING) - alt_feature = sensors_lookup_subfeature_nr(name, + feature = sensors_lookup_feature_nr(name, subfeature->mapping); else - alt_feature = NULL; + feature = NULL; if (!(subfeature->flags & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) - for (i = 0; !final_expr && (i < chip->computes_count); i++) { - if (!strcmp(subfeature->name, chip->computes[i].name)) { - expr = chip->computes[i].from_proc; - final_expr = 1; - } else if (alt_feature && !strcmp(alt_feature->name, + for (i = 0; !expr && (i < chip->computes_count); i++) { + if (feature && !strcmp(feature->name, chip->computes[i].name)) { expr = chip->computes[i].from_proc; } @@ -255,11 +269,10 @@ int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value) { const sensors_subfeature *subfeature; - const sensors_subfeature *alt_feature; + const sensors_feature *feature; const sensors_chip *chip; const sensors_expr *expr = NULL; int i, res; - int final_expr = 0; double to_write; if (sensors_chip_name_has_wildcards(name)) @@ -268,23 +281,21 @@ int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, return -SENSORS_ERR_NO_ENTRY; if (subfeature->flags & SENSORS_COMPUTE_MAPPING) - alt_feature = sensors_lookup_subfeature_nr(name, + feature = sensors_lookup_feature_nr(name, subfeature->mapping); else - alt_feature = NULL; + feature = NULL; if (!(subfeature->flags & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; for (chip = NULL; !expr && (chip = sensors_for_all_config_chips(name, chip));) - for (i = 0; !final_expr && (i < chip->computes_count); i++) - if (!strcmp(subfeature->name, chip->computes[i].name)) { - expr = chip->computes->to_proc; - final_expr = 1; - } else if (alt_feature && !strcmp(alt_feature->name, + for (i = 0; !expr && (i < chip->computes_count); i++) { + if (feature && !strcmp(feature->name, chip->computes[i].name)) { expr = chip->computes[i].to_proc; } + } to_write = value; if (expr) @@ -367,8 +378,7 @@ sensors_get_all_subfeatures(const sensors_chip_name *name, if (*nr >= sensors_proc_chips[i].subfeature_count) return NULL; /* end of list */ subfeature = &sensors_proc_chips[i].subfeature[(*nr)++]; - if (subfeature->number == feature->first_subfeature || - subfeature->mapping == feature->first_subfeature) + if (subfeature->mapping == feature->number) return subfeature; return NULL; /* end of subfeature list */ } diff --git a/lib/libsensors.3 b/lib/libsensors.3 index d42247a0..09d7f57b 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -134,10 +134,9 @@ data structures. \fBconst sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);\fP .br -This returns all subfeatures of a given main feature (including that -main feature itself, in first position.) nr is an internally used -variable. Set it to zero to start at the begin of the list. If no more -subfeatures are found NULL is returned. +This returns all subfeatures of a given main feature. nr is an internally +used variable. Set it to zero to start at the begin of the list. If no +more subfeatures are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. diff --git a/lib/sensors.h b/lib/sensors.h index dc6dfd97..e6fc8414 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -124,6 +124,16 @@ const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name mapping is available */ #define SENSORS_NO_MAPPING -1 +/* These must match the subfeature constants below (shifted by 8 bits) */ +typedef enum sensors_feature_type { + SENSORS_FEATURE_IN = 0x00, + SENSORS_FEATURE_FAN = 0x01, + SENSORS_FEATURE_TEMP = 0x02, + SENSORS_FEATURE_VID = 0x10, + SENSORS_FEATURE_BEEP_ENABLE = 0x11, + SENSORS_FEATURE_UNKNOWN = INT_MAX, +} sensors_feature_type; + /* This enum contains some "magic" used by sensors_read_dynamic_chip() from lib/sysfs.c. All the sensor types (in, fan, temp, vid) are a multiple of 0x100 apart, and sensor subfeatures which should not have a compute @@ -169,8 +179,9 @@ typedef enum sensors_subfeature_type { /* Data about a single chip feature (or category leader) */ struct sensors_feature { char *name; + int number; + sensors_feature_type type; int first_subfeature; - sensors_subfeature_type type; }; /* Data about a single chip subfeature: @@ -201,10 +212,9 @@ typedef struct sensors_subfeature { const sensors_feature * sensors_get_features(const sensors_chip_name *name, int *nr); -/* This returns all subfeatures of a given main feature (including that - main feature itself, in first position.) nr is an internally used - variable. Set it to zero to start at the begin of the list. If no more - features are found NULL is returned. +/* This returns all subfeatures of a given main feature. nr is an internally + used variable. Set it to zero to start at the begin of the list. If no + more features are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. */ const sensors_subfeature * diff --git a/lib/sysfs.c b/lib/sysfs.c index 37ad62c9..f96cee95 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -65,6 +65,25 @@ int get_type_scaling(int type) } } +static +char *get_feature_name(sensors_feature_type ftype, char *sfname) +{ + char *name, *underscore; + + switch (ftype) { + case SENSORS_FEATURE_IN: + case SENSORS_FEATURE_FAN: + case SENSORS_FEATURE_TEMP: + underscore = strchr(sfname, '_'); + name = strndup(sfname, underscore - sfname); + break; + default: + name = strdup(sfname); + } + + return name; +} + /* Static mappings for use by sensors_subfeature_get_type() */ struct subfeature_type_match { @@ -160,12 +179,14 @@ sensors_subfeature_type sensors_subfeature_get_type(const char *name, int *nr) static int sensors_read_dynamic_chip(sensors_chip_features *chip, struct sysfs_device *sysdir) { - int i, type, fnum = 0; + int i, fnum = 0, sfnum = 0, prev_slot; struct sysfs_attribute *attr; struct dlist *attrs; sensors_subfeature *all_subfeatures; sensors_subfeature *dyn_subfeatures; sensors_feature *dyn_features; + sensors_feature_type ftype; + sensors_subfeature_type sftype; attrs = sysfs_get_device_attributes(sysdir); @@ -184,12 +205,12 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, char *name = attr->name; int nr; - type = sensors_subfeature_get_type(name, &nr); - if (type == SENSORS_SUBFEATURE_UNKNOWN) + sftype = sensors_subfeature_get_type(name, &nr); + if (sftype == SENSORS_SUBFEATURE_UNKNOWN) continue; /* Adjust the channel number */ - switch (type & 0xFF00) { + switch (sftype & 0xFF00) { case SENSORS_SUBFEATURE_FAN_INPUT: case SENSORS_SUBFEATURE_TEMP_INPUT: if (nr) @@ -206,7 +227,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* "calculate" a place to store the subfeature in our sparse, sorted table */ - switch (type) { + switch (sftype) { case SENSORS_SUBFEATURE_VID: i = nr + MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 6; break; @@ -215,10 +236,10 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, MAX_SENSORS_PER_TYPE; break; default: - i = (type >> 8) * MAX_SENSORS_PER_TYPE * + i = (sftype >> 8) * MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 2 + nr * MAX_SUBFEATURES * 2 + - ((type & 0x10) >> 4) * MAX_SUBFEATURES + - (type & 0x0F); + ((sftype & 0x10) >> 4) * MAX_SUBFEATURES + + (sftype & 0x0F); } if (all_subfeatures[i].name) { @@ -229,93 +250,75 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } /* fill in the subfeature members */ - all_subfeatures[i].type = type; - - /* check for _input extension and remove */ - nr = strlen(name); - if (nr > 6 && !strcmp(name + nr - 6, "_input")) - all_subfeatures[i].name = strndup(name, nr - 6); - else - all_subfeatures[i].name = strdup(name); - - if ((type & 0x00FF) == 0) { - /* main subfeature */ - all_subfeatures[i].mapping = SENSORS_NO_MAPPING; - } else { - /* The mapping is set below after numbering */ - if (!(type & 0x10)) - all_subfeatures[i].flags |= SENSORS_COMPUTE_MAPPING; - } - + all_subfeatures[i].type = sftype; + all_subfeatures[i].name = strdup(name); + if (!(sftype & 0x10)) + all_subfeatures[i].flags |= SENSORS_COMPUTE_MAPPING; if (attr->method & SYSFS_METHOD_SHOW) all_subfeatures[i].flags |= SENSORS_MODE_R; if (attr->method & SYSFS_METHOD_STORE) all_subfeatures[i].flags |= SENSORS_MODE_W; - fnum++; + sfnum++; } - if (!fnum) { /* No subfeature */ + if (!sfnum) { /* No subfeature */ chip->subfeature = NULL; goto exit_free; } - dyn_subfeatures = calloc(fnum, sizeof(sensors_subfeature)); - if (dyn_subfeatures == NULL) { - sensors_fatal_error(__FUNCTION__, "Out of memory"); - } - - fnum = 0; + /* How many main features? */ + prev_slot = -1; for (i = 0; i < ALL_POSSIBLE_SUBFEATURES; i++) { - if (all_subfeatures[i].name) { - dyn_subfeatures[fnum] = all_subfeatures[i]; + if (!all_subfeatures[i].name) + continue; + + if (i >= MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 6 || + i / (MAX_SUBFEATURES * 2) != prev_slot) { fnum++; + prev_slot = i / (MAX_SUBFEATURES * 2); } } - /* Number the subfeatures linearly, so that subfeature number N is at - position N in the array. This allows for O(1) look-ups. */ - for (i = 0; i < fnum; i++) { - int j; + dyn_subfeatures = calloc(sfnum, sizeof(sensors_subfeature)); + dyn_features = calloc(fnum, sizeof(sensors_feature)); + if (!dyn_subfeatures || !dyn_features) + sensors_fatal_error(__FUNCTION__, "Out of memory"); - dyn_subfeatures[i].number = i; - if (dyn_subfeatures[i].mapping == SENSORS_NO_MAPPING) { - /* Main feature, set the mapping field of all its - subfeatures */ - for (j = i + 1; j < fnum && - dyn_subfeatures[j].mapping != SENSORS_NO_MAPPING; - j++) - dyn_subfeatures[j].mapping = i; + /* Copy from the sparse array to the compact array */ + sfnum = 0; + fnum = -1; + prev_slot = -1; + for (i = 0; i < ALL_POSSIBLE_SUBFEATURES; i++) { + if (!all_subfeatures[i].name) + continue; + + /* New main feature? */ + if (i >= MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 6 || + i / (MAX_SUBFEATURES * 2) != prev_slot) { + ftype = all_subfeatures[i].type >> 8; + fnum++; + prev_slot = i / (MAX_SUBFEATURES * 2); + + dyn_features[fnum].name = get_feature_name(ftype, + all_subfeatures[i].name); + dyn_features[fnum].number = fnum; + dyn_features[fnum].first_subfeature = sfnum; + dyn_features[fnum].type = ftype; } + + dyn_subfeatures[sfnum] = all_subfeatures[i]; + dyn_subfeatures[sfnum].number = sfnum; + /* Back to the feature */ + dyn_subfeatures[sfnum].mapping = fnum; + + sfnum++; } chip->subfeature = dyn_subfeatures; - chip->subfeature_count = fnum; - - /* And now the main features */ - fnum = 0; - for (i = 0; i < chip->subfeature_count; i++) { - if (chip->subfeature[i].mapping == SENSORS_NO_MAPPING) - fnum++; - } - - dyn_features = calloc(fnum, sizeof(sensors_feature)); - if (dyn_features == NULL) { - sensors_fatal_error(__FUNCTION__, "Out of memory"); - } - - fnum = 0; - for (i = 0; i < chip->subfeature_count; i++) { - if (chip->subfeature[i].mapping == SENSORS_NO_MAPPING) { - dyn_features[fnum].name = strdup(chip->subfeature[i].name); - dyn_features[fnum].first_subfeature = i; - dyn_features[fnum].type = chip->subfeature[i].type; - fnum++; - } - } - + chip->subfeature_count = sfnum; chip->feature = dyn_features; - chip->feature_count = fnum; + chip->feature_count = ++fnum; exit_free: free(all_subfeatures); @@ -544,19 +547,11 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, const sensors_subfeature *subfeature; char n[NAME_MAX]; FILE *f; - const char *suffix = ""; if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; - /* REVISIT: this is a ugly hack */ - if (subfeature->type == SENSORS_SUBFEATURE_IN_INPUT - || subfeature->type == SENSORS_SUBFEATURE_FAN_INPUT - || subfeature->type == SENSORS_SUBFEATURE_TEMP_INPUT) - suffix = "_input"; - - snprintf(n, NAME_MAX, "%s/%s%s", name->path, subfeature->name, - suffix); + snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "r"))) { int res = fscanf(f, "%lf", value); fclose(f); @@ -575,19 +570,11 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, const sensors_subfeature *subfeature; char n[NAME_MAX]; FILE *f; - const char *suffix = ""; if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; - /* REVISIT: this is a ugly hack */ - if (subfeature->type == SENSORS_SUBFEATURE_IN_INPUT - || subfeature->type == SENSORS_SUBFEATURE_FAN_INPUT - || subfeature->type == SENSORS_SUBFEATURE_TEMP_INPUT) - suffix = "_input"; - - snprintf(n, NAME_MAX, "%s/%s%s", name->path, subfeature->name, - suffix); + snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "w"))) { value *= get_type_scaling(subfeature->type); fprintf(f, "%d", (int) value); diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index 43b34960..e8b39886 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -373,19 +373,19 @@ FeatureDescriptor * generateChipFeatures (const sensors_chip_name *chip) nr = 0; while ((sensor = sensors_get_features(chip, &nr))) { switch (sensor->type) { - case SENSORS_SUBFEATURE_TEMP_INPUT: + case SENSORS_FEATURE_TEMP: fillChipTemperature(&features[count], chip, sensor); break; - case SENSORS_SUBFEATURE_IN_INPUT: + case SENSORS_FEATURE_IN: fillChipVoltage(&features[count], chip, sensor); break; - case SENSORS_SUBFEATURE_FAN_INPUT: + case SENSORS_FEATURE_FAN: fillChipFan(&features[count], chip, sensor); break; - case SENSORS_SUBFEATURE_VID: + case SENSORS_FEATURE_VID: fillChipVid(&features[count], chip, sensor); break; - case SENSORS_SUBFEATURE_BEEP_ENABLE: + case SENSORS_FEATURE_BEEP_ENABLE: fillChipBeepEnable(&features[count], chip, sensor); break; default: diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index b411820e..f367f68d 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -435,19 +435,19 @@ void print_chip(const sensors_chip_name *name) i = 0; while ((feature = sensors_get_features(name, &i))) { switch (feature->type) { - case SENSORS_SUBFEATURE_TEMP_INPUT: + case SENSORS_FEATURE_TEMP: print_chip_temp(name, feature, label_size); break; - case SENSORS_SUBFEATURE_IN_INPUT: + case SENSORS_FEATURE_IN: print_chip_in(name, feature, label_size); break; - case SENSORS_SUBFEATURE_FAN_INPUT: + case SENSORS_FEATURE_FAN: print_chip_fan(name, feature, label_size); break; - case SENSORS_SUBFEATURE_VID: + case SENSORS_FEATURE_VID: print_chip_vid(name, feature, label_size); break; - case SENSORS_SUBFEATURE_BEEP_ENABLE: + case SENSORS_FEATURE_BEEP_ENABLE: print_chip_beep_enable(name, feature, label_size); break; default: From 67d3060317acbffdc29449ded77c2a833166d280 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:18:46 +0000 Subject: [PATCH 297/718] We can plain skip the feature lookup and compute statement search for subfeatures with no compute mapping. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4839 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 69 ++++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/lib/access.c b/lib/access.c index d905bff1..1c2b0221 100644 --- a/lib/access.c +++ b/lib/access.c @@ -226,8 +226,6 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *result) { const sensors_subfeature *subfeature; - const sensors_feature *feature; - const sensors_chip *chip; const sensors_expr *expr = NULL; double val; int res, i; @@ -236,23 +234,28 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, return -SENSORS_ERR_WILDCARDS; if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; - - if (subfeature->flags & SENSORS_COMPUTE_MAPPING) - feature = sensors_lookup_feature_nr(name, - subfeature->mapping); - else - feature = NULL; - if (!(subfeature->flags & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; - for (chip = NULL; - !expr && (chip = sensors_for_all_config_chips(name, chip));) - for (i = 0; !expr && (i < chip->computes_count); i++) { - if (feature && !strcmp(feature->name, - chip->computes[i].name)) { - expr = chip->computes[i].from_proc; + + /* Apply compute statement if it exists */ + if (subfeature->flags & SENSORS_COMPUTE_MAPPING) { + const sensors_feature *feature; + const sensors_chip *chip; + + feature = sensors_lookup_feature_nr(name, + subfeature->mapping); + + chip = NULL; + while ((chip = sensors_for_all_config_chips(name, chip))) + for (i = 0; i < chip->computes_count; i++) { + if (!strcmp(feature->name, + chip->computes[i].name)) { + expr = chip->computes[i].from_proc; + break; + } } - } + } + if (sensors_read_sysfs_attr(name, subfeat_nr, &val)) return -SENSORS_ERR_PROC; if (!expr) @@ -269,8 +272,6 @@ int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value) { const sensors_subfeature *subfeature; - const sensors_feature *feature; - const sensors_chip *chip; const sensors_expr *expr = NULL; int i, res; double to_write; @@ -279,23 +280,27 @@ int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, return -SENSORS_ERR_WILDCARDS; if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; - - if (subfeature->flags & SENSORS_COMPUTE_MAPPING) - feature = sensors_lookup_feature_nr(name, - subfeature->mapping); - else - feature = NULL; - if (!(subfeature->flags & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; - for (chip = NULL; - !expr && (chip = sensors_for_all_config_chips(name, chip));) - for (i = 0; !expr && (i < chip->computes_count); i++) { - if (feature && !strcmp(feature->name, - chip->computes[i].name)) { - expr = chip->computes[i].to_proc; + + /* Apply compute statement if it exists */ + if (subfeature->flags & SENSORS_COMPUTE_MAPPING) { + const sensors_feature *feature; + const sensors_chip *chip; + + feature = sensors_lookup_feature_nr(name, + subfeature->mapping); + + chip = NULL; + while ((chip = sensors_for_all_config_chips(name, chip))) + for (i = 0; i < chip->computes_count; i++) { + if (!strcmp(feature->name, + chip->computes[i].name)) { + expr = chip->computes[i].to_proc; + break; + } } - } + } to_write = value; if (expr) From ba6614624bae88e27a7b24ddde2ba46bb5aea899 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:19:29 +0000 Subject: [PATCH 298/718] There's no rationale for preventing against setting the same subfeature value several times. If the user asks for that, let's just do it. Otherwise we have a performance penalty for all other users. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4840 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/lib/access.c b/lib/access.c index 1c2b0221..b4605663 100644 --- a/lib/access.c +++ b/lib/access.c @@ -458,13 +458,9 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) { sensors_chip *chip; double value; - int i, j; + int i; int err = 0, res; const sensors_subfeature *subfeature; - int *feature_list = NULL; - int feature_count = 0; - int feature_max = 0; - int subfeat_nr; for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->sets_count; i++) { @@ -476,17 +472,6 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) err = SENSORS_ERR_NO_ENTRY; continue; } - subfeat_nr = subfeature->number; - - /* Check whether we already set this feature */ - for (j = 0; j < feature_count; j++) - if (feature_list[j] == subfeat_nr) - break; - if (j != feature_count) - continue; - sensors_add_array_el(&subfeat_nr, &feature_list, - &feature_count, &feature_max, - sizeof(int)); res = sensors_eval_expr(name, chip->sets[i].value, 0, &value); @@ -496,14 +481,14 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) err = res; continue; } - if ((res = sensors_set_value(name, subfeat_nr, value))) { + if ((res = sensors_set_value(name, subfeature->number, + value))) { sensors_parse_error("Failed to set value", chip->sets[i].lineno); err = res; continue; } } - free(feature_list); return err; } From e7c345f4cf90b53c2a6fb2e3b9ac2ceb3d6bcd86 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:20:07 +0000 Subject: [PATCH 299/718] Pass a subfeature structure to sensors_read_sysfs_attr() and sensors_write_sysfs_attr(), rather than a subfeature number, so that we do not have to lookup the feature number again. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4841 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 4 ++-- lib/sysfs.c | 14 ++++---------- lib/sysfs.h | 6 ++++-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/access.c b/lib/access.c index b4605663..96b8195a 100644 --- a/lib/access.c +++ b/lib/access.c @@ -256,7 +256,7 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, } } - if (sensors_read_sysfs_attr(name, subfeat_nr, &val)) + if (sensors_read_sysfs_attr(name, subfeature, &val)) return -SENSORS_ERR_PROC; if (!expr) *result = val; @@ -306,7 +306,7 @@ int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, if (expr) if ((res = sensors_eval_expr(name, expr, value, &to_write))) return res; - if (sensors_write_sysfs_attr(name, subfeat_nr, to_write)) + if (sensors_write_sysfs_attr(name, subfeature, to_write)) return -SENSORS_ERR_PROC; return 0; } diff --git a/lib/sysfs.c b/lib/sysfs.c index f96cee95..a700bea0 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -541,16 +541,13 @@ exit0: return ret; } -int sensors_read_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, +int sensors_read_sysfs_attr(const sensors_chip_name *name, + const sensors_subfeature *subfeature, double *value) { - const sensors_subfeature *subfeature; char n[NAME_MAX]; FILE *f; - if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) - return -SENSORS_ERR_NO_ENTRY; - snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "r"))) { int res = fscanf(f, "%lf", value); @@ -564,16 +561,13 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, return 0; } -int sensors_write_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, +int sensors_write_sysfs_attr(const sensors_chip_name *name, + const sensors_subfeature *subfeature, double value) { - const sensors_subfeature *subfeature; char n[NAME_MAX]; FILE *f; - if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) - return -SENSORS_ERR_NO_ENTRY; - snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "w"))) { value *= get_type_scaling(subfeature->type); diff --git a/lib/sysfs.h b/lib/sysfs.h index f90a7ae5..f547bd7d 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -29,11 +29,13 @@ int sensors_read_sysfs_chips(void); int sensors_read_sysfs_bus(void); /* Read a value out of a sysfs attribute file */ -int sensors_read_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, +int sensors_read_sysfs_attr(const sensors_chip_name *name, + const sensors_subfeature *subfeature, double *value); /* Write a value to a sysfs attribute file */ -int sensors_write_sysfs_attr(const sensors_chip_name *name, int subfeat_nr, +int sensors_write_sysfs_attr(const sensors_chip_name *name, + const sensors_subfeature *subfeature, double value); #endif /* !SENSORS_LIB_SYSFS_H */ From 586cec7fa1905df3378862f2ed281731408eb8cb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:20:48 +0000 Subject: [PATCH 300/718] sensors_lookup_subfeature_nr() can now be made static. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4842 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 2 +- lib/access.h | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/access.c b/lib/access.c index 96b8195a..b6f08ff4 100644 --- a/lib/access.c +++ b/lib/access.c @@ -89,7 +89,7 @@ sensors_for_all_config_chips(const sensors_chip_name *name, /* Look up a subfeature in the intern chip list, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ -const sensors_subfeature * +static const sensors_subfeature * sensors_lookup_subfeature_nr(const sensors_chip_name *chip, int subfeat_nr) { diff --git a/lib/access.h b/lib/access.h index 0ba96ce9..bd735f41 100644 --- a/lib/access.h +++ b/lib/access.h @@ -23,13 +23,6 @@ #include "sensors.h" #include "data.h" -/* Look up a subfeature in the intern chip list, and return a pointer to it. - Do not modify the struct the return value points to! Returns NULL if - not found. */ -const sensors_subfeature * -sensors_lookup_subfeature_nr(const sensors_chip_name *chip, - int subfeat_nr); - /* Check whether the chip name is an 'absolute' name, which can only match one chip, or whether it has wildcards. Returns 0 if it is absolute, 1 if there are wildcards. */ From 36f5b0dc4d2ddd3685918f6f8d61778b11dc0410 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:23:06 +0000 Subject: [PATCH 301/718] New internal library function: sensors_lookup_chip(). It looks up a chip in the detected chip list. It is more efficient to do it once and for all than to do it over and over again in sensors_lookup_feature_nr() and sensors_lookup_subfeature_nr() as was done before. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4843 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 65 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/lib/access.c b/lib/access.c index b6f08ff4..eab42ca1 100644 --- a/lib/access.c +++ b/lib/access.c @@ -86,41 +86,44 @@ sensors_for_all_config_chips(const sensors_chip_name *name, return NULL; } -/* Look up a subfeature in the intern chip list, and return a pointer to it. - Do not modify the struct the return value points to! Returns NULL if +/* Look up a chip in the intern chip list, and return a pointer to it. + Do not modify the struct the return value points to! Returns NULL if not found.*/ -static const sensors_subfeature * -sensors_lookup_subfeature_nr(const sensors_chip_name *chip, - int subfeat_nr) +static const sensors_chip_features * +sensors_lookup_chip(const sensors_chip_name *name) { int i; for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { - if (subfeat_nr < 0 || - subfeat_nr >= sensors_proc_chips[i].subfeature_count) - return NULL; - return sensors_proc_chips[i].subfeature + subfeat_nr; - } + if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) + return &sensors_proc_chips[i]; + return NULL; } -/* Look up a feature in the intern chip list, and return a pointer to it. +/* Look up a subfeature of the given chip, and return a pointer to it. + Do not modify the struct the return value points to! Returns NULL if + not found.*/ +static const sensors_subfeature * +sensors_lookup_subfeature_nr(const sensors_chip_features *chip, + int subfeat_nr) +{ + if (subfeat_nr < 0 || + subfeat_nr >= chip->subfeature_count) + return NULL; + return chip->subfeature + subfeat_nr; +} + +/* Look up a feature of the given chip, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ static const sensors_feature * -sensors_lookup_feature_nr(const sensors_chip_name *chip, int feat_nr) +sensors_lookup_feature_nr(const sensors_chip_features *chip, int feat_nr) { - int i; - - for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { - if (feat_nr < 0 || - feat_nr >= sensors_proc_chips[i].feature_count) - return NULL; - return sensors_proc_chips[i].feature + feat_nr; - } - return NULL; + if (feat_nr < 0 || + feat_nr >= chip->feature_count) + return NULL; + return chip->feature + feat_nr; } /* Look up a resource in the intern chip list, and return a pointer to it. @@ -225,6 +228,7 @@ static int sensors_get_ignored(const sensors_chip_name *name, int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, double *result) { + const sensors_chip_features *chip_features; const sensors_subfeature *subfeature; const sensors_expr *expr = NULL; double val; @@ -232,7 +236,10 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; - if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) + if (!(chip_features = sensors_lookup_chip(name))) + return -SENSORS_ERR_NO_ENTRY; + if (!(subfeature = sensors_lookup_subfeature_nr(chip_features, + subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; if (!(subfeature->flags & SENSORS_MODE_R)) return -SENSORS_ERR_ACCESS_R; @@ -242,7 +249,7 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, const sensors_feature *feature; const sensors_chip *chip; - feature = sensors_lookup_feature_nr(name, + feature = sensors_lookup_feature_nr(chip_features, subfeature->mapping); chip = NULL; @@ -271,6 +278,7 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, double value) { + const sensors_chip_features *chip_features; const sensors_subfeature *subfeature; const sensors_expr *expr = NULL; int i, res; @@ -278,7 +286,10 @@ int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, if (sensors_chip_name_has_wildcards(name)) return -SENSORS_ERR_WILDCARDS; - if (!(subfeature = sensors_lookup_subfeature_nr(name, subfeat_nr))) + if (!(chip_features = sensors_lookup_chip(name))) + return -SENSORS_ERR_NO_ENTRY; + if (!(subfeature = sensors_lookup_subfeature_nr(chip_features, + subfeat_nr))) return -SENSORS_ERR_NO_ENTRY; if (!(subfeature->flags & SENSORS_MODE_W)) return -SENSORS_ERR_ACCESS_W; @@ -288,7 +299,7 @@ int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, const sensors_feature *feature; const sensors_chip *chip; - feature = sensors_lookup_feature_nr(name, + feature = sensors_lookup_feature_nr(chip_features, subfeature->mapping); chip = NULL; From e55b84392b3e61d15ab46ec3ffa4fa98663b89a9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:23:38 +0000 Subject: [PATCH 302/718] Use sensors_lookup_chip() to speed up sensors_lookup_subfeature_name() as well. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4844 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/lib/access.c b/lib/access.c index eab42ca1..349775d4 100644 --- a/lib/access.c +++ b/lib/access.c @@ -28,7 +28,7 @@ #include "sysfs.h" #include "general.h" -static int sensors_eval_expr(const sensors_chip_name *name, +static int sensors_eval_expr(const sensors_chip_features *chip_features, const sensors_expr *expr, double val, double *result); @@ -126,23 +126,18 @@ sensors_lookup_feature_nr(const sensors_chip_features *chip, int feat_nr) return chip->feature + feat_nr; } -/* Look up a resource in the intern chip list, and return a pointer to it. +/* Look up a subfeature by name, and return a pointer to it. Do not modify the struct the return value points to! Returns NULL if not found.*/ static const sensors_subfeature * -sensors_lookup_subfeature_name(const sensors_chip_name *chip, +sensors_lookup_subfeature_name(const sensors_chip_features *chip, const char *name) { - int i, j; - const sensors_subfeature *subfeatures; + int j; - for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { - subfeatures = sensors_proc_chips[i].subfeature; - for (j = 0; j < sensors_proc_chips[i].subfeature_count; j++) - if (!strcmp(subfeatures[j].name, name)) - return subfeatures + j; - } + for (j = 0; j < chip->subfeature_count; j++) + if (!strcmp(chip->subfeature[j].name, name)) + return chip->subfeature + j; return NULL; } @@ -267,7 +262,7 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, return -SENSORS_ERR_PROC; if (!expr) *result = val; - else if ((res = sensors_eval_expr(name, expr, val, result))) + else if ((res = sensors_eval_expr(chip_features, expr, val, result))) return res; return 0; } @@ -315,7 +310,8 @@ int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, to_write = value; if (expr) - if ((res = sensors_eval_expr(name, expr, value, &to_write))) + if ((res = sensors_eval_expr(chip_features, expr, + value, &to_write))) return res; if (sensors_write_sysfs_attr(name, subfeature, to_write)) return -SENSORS_ERR_PROC; @@ -402,7 +398,7 @@ sensors_get_all_subfeatures(const sensors_chip_name *name, } /* Evaluate an expression */ -int sensors_eval_expr(const sensors_chip_name *name, +int sensors_eval_expr(const sensors_chip_features *chip_features, const sensors_expr *expr, double val, double *result) { @@ -419,18 +415,20 @@ int sensors_eval_expr(const sensors_chip_name *name, return 0; } if (expr->kind == sensors_kind_var) { - if (!(subfeature = sensors_lookup_subfeature_name(name, + if (!(subfeature = sensors_lookup_subfeature_name(chip_features, expr->data.var))) return SENSORS_ERR_NO_ENTRY; - if (!(res = sensors_get_value(name, subfeature->number, - result))) + if (!(res = sensors_get_value(&chip_features->chip, + subfeature->number, result))) return res; return 0; } - if ((res = sensors_eval_expr(name, expr->data.subexpr.sub1, val, &res1))) + if ((res = sensors_eval_expr(chip_features, expr->data.subexpr.sub1, + val, &res1))) return res; if (expr->data.subexpr.sub2 && - (res = sensors_eval_expr(name, expr->data.subexpr.sub2, val, &res2))) + (res = sensors_eval_expr(chip_features, expr->data.subexpr.sub2, + val, &res2))) return res; switch (expr->data.subexpr.op) { case sensors_add: @@ -467,15 +465,18 @@ int sensors_eval_expr(const sensors_chip_name *name, failure. */ static int sensors_do_this_chip_sets(const sensors_chip_name *name) { + const sensors_chip_features *chip_features; sensors_chip *chip; double value; int i; int err = 0, res; const sensors_subfeature *subfeature; + chip_features = sensors_lookup_chip(name); /* Can't fail */ + for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (i = 0; i < chip->sets_count; i++) { - subfeature = sensors_lookup_subfeature_name(name, + subfeature = sensors_lookup_subfeature_name(chip_features, chip->sets[i].name); if (!subfeature) { sensors_parse_error("Unknown feature name", @@ -484,8 +485,9 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name) continue; } - res = sensors_eval_expr(name, chip->sets[i].value, 0, - &value); + res = sensors_eval_expr(chip_features, + chip->sets[i].value, 0, + &value); if (res) { sensors_parse_error("Error parsing expression", chip->sets[i].lineno); From c08a1683422520d7323997014312c3c4eac12daa Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:24:13 +0000 Subject: [PATCH 303/718] Use sensors_lookup_chip() wherever possible, it makes the code more readable. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4845 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/lib/access.c b/lib/access.c index 349775d4..5f442e6a 100644 --- a/lib/access.c +++ b/lib/access.c @@ -358,43 +358,39 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus) const sensors_feature * sensors_get_features(const sensors_chip_name *name, int *nr) { - const sensors_feature *feature_list; - int i; + const sensors_chip_features *chip; - for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { - feature_list = sensors_proc_chips[i].feature; - while (*nr < sensors_proc_chips[i].feature_count - && sensors_get_ignored(name, &feature_list[*nr])) - (*nr)++; - if (*nr >= sensors_proc_chips[i].feature_count) - return NULL; - return &feature_list[(*nr)++]; - } - return NULL; /* end of list */ + if (!(chip = sensors_lookup_chip(name))) + return NULL; /* No such chip */ + + while (*nr < chip->feature_count + && sensors_get_ignored(name, &chip->feature[*nr])) + (*nr)++; + if (*nr >= chip->feature_count) + return NULL; + return &chip->feature[(*nr)++]; } const sensors_subfeature * sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr) { + const sensors_chip_features *chip; const sensors_subfeature *subfeature; - int i; + + if (!(chip = sensors_lookup_chip(name))) + return NULL; /* No such chip */ /* Seek directly to the first subfeature */ if (*nr < feature->first_subfeature) *nr = feature->first_subfeature; - for (i = 0; i < sensors_proc_chips_count; i++) - if (sensors_match_chip(&sensors_proc_chips[i].chip, name)) { - if (*nr >= sensors_proc_chips[i].subfeature_count) - return NULL; /* end of list */ - subfeature = &sensors_proc_chips[i].subfeature[(*nr)++]; - if (subfeature->mapping == feature->number) - return subfeature; - return NULL; /* end of subfeature list */ - } - return NULL; /* no matching chip */ + if (*nr >= chip->subfeature_count) + return NULL; /* end of list */ + subfeature = &chip->subfeature[(*nr)++]; + if (subfeature->mapping == feature->number) + return subfeature; + return NULL; /* end of subfeature list */ } /* Evaluate an expression */ From e01466d9931624f6b34e1e2ef9efab1e82e60030 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:30:28 +0000 Subject: [PATCH 304/718] New public library function: sensors_get_subfeature(). Applications can use it to retrieve a specific subfeature by type. While it is slighly less efficient than looping over sensors_get_all_subfeatures(), it often makes the application code much more elegant. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4846 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 19 ++++ lib/libsensors.3 | 8 ++ lib/sensors.h | 9 ++ prog/sensord/chips.c | 138 +++++++++--------------- prog/sensors/chips.c | 242 ++++++++++++++++++++++--------------------- 5 files changed, 210 insertions(+), 206 deletions(-) diff --git a/lib/access.c b/lib/access.c index 5f442e6a..6a44c3fd 100644 --- a/lib/access.c +++ b/lib/access.c @@ -393,6 +393,25 @@ sensors_get_all_subfeatures(const sensors_chip_name *name, return NULL; /* end of subfeature list */ } +const sensors_subfeature * +sensors_get_subfeature(const sensors_chip_name *name, + const sensors_feature *feature, + sensors_subfeature_type type) +{ + const sensors_chip_features *chip; + int i; + + if (!(chip = sensors_lookup_chip(name))) + return NULL; /* No such chip */ + + for (i = feature->first_subfeature; i < chip->subfeature_count && + chip->subfeature[i].mapping == feature->number; i++) { + if (chip->subfeature[i].type == type) + return &chip->subfeature[i]; + } + return NULL; /* No such subfeature */ +} + /* Evaluate an expression */ int sensors_eval_expr(const sensors_chip_features *chip_features, const sensors_expr *expr, diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 09d7f57b..ec8eb025 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -46,6 +46,7 @@ libsensors \- publicly accessible functions provided by the sensors library \fB*match, int *nr);\fP .B const sensors_feature *sensors_get_features(const sensors_chip_name *name, int *nr);\fP .B const sensors_subfeature *sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr);\fP +.B const sensors_subfeature *sensors_get_subfeature(const sensors_chip_name *name, const sensors_feature *feature, sensors_subfeature_type type);\fP .B const char *libsensors_version; .fi .SH DESCRIPTION @@ -140,6 +141,13 @@ more subfeatures are found NULL is returned. Do not try to change the returned structure; you will corrupt internal data structures. +\fBconst sensors_subfeature *sensors_get_subfeature(const sensors_chip_name *name, const sensors_feature *feature, sensors_subfeature_type type);\fP +.br +This returns the subfeature of the given type for a given main feature, +if it exists, NULL otherwise. +Do not try to change the returned structure; you will corrupt internal +data structures. + \fBconst char *libsensors_version;\fP .br A string representing the version of libsensors. diff --git a/lib/sensors.h b/lib/sensors.h index e6fc8414..1cae70f3 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -221,6 +221,15 @@ const sensors_subfeature * sensors_get_all_subfeatures(const sensors_chip_name *name, const sensors_feature *feature, int *nr); +/* This returns the subfeature of the given type for a given main feature, + if it exists, NULL otherwise. + Do not try to change the returned structure; you will corrupt internal + data structures. */ +const sensors_subfeature * +sensors_get_subfeature(const sensors_chip_name *name, + const sensors_feature *feature, + sensors_subfeature_type type); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/prog/sensord/chips.c b/prog/sensord/chips.c index e8b39886..0f821258 100644 --- a/prog/sensord/chips.c +++ b/prog/sensord/chips.c @@ -140,52 +140,26 @@ rrdF3 return buff; } -static void getAvailableFeatures (const sensors_chip_name *name, - const sensors_feature *feature, - short *has_features, - int *feature_nrs, int size, - int first_val) -{ - const sensors_subfeature *iter; - int i = 0; - - while ((iter = sensors_get_all_subfeatures(name, feature, &i))) { - int index0; - - index0 = iter->type - first_val; - if (index0 < 0 || index0 >= size) - /* New feature in libsensors? Ignore. */ - continue; - - has_features[index0] = 1; - feature_nrs[index0] = iter->number; - } -} - -#define IN_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_IN_INPUT] -#define IN_FEATURE_NR(x) feature_nrs[x - SENSORS_SUBFEATURE_IN_INPUT] static void fillChipVoltage (FeatureDescriptor *voltage, const sensors_chip_name *name, const sensors_feature *feature) { - const int size = SENSORS_SUBFEATURE_IN_BEEP - SENSORS_SUBFEATURE_IN_INPUT + 1; - short has_features[SENSORS_SUBFEATURE_IN_BEEP - SENSORS_SUBFEATURE_IN_INPUT + 1] = { 0, }; - int feature_nrs[SENSORS_SUBFEATURE_IN_BEEP - SENSORS_SUBFEATURE_IN_INPUT + 1]; + const sensors_subfeature *sf, *sfmin, *sfmax; int pos = 0; voltage->rrd = rrdF2; voltage->type = DataType_voltage; - getAvailableFeatures (name, feature, has_features, - feature_nrs, size, SENSORS_SUBFEATURE_IN_INPUT); + sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_INPUT); + if (sf) + voltage->dataNumbers[pos++] = sf->number; - voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_INPUT); - - if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN) && - IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX)) { + sfmin = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_MIN); + sfmax = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_MAX); + if (sfmin && sfmax) { voltage->format = fmtVolts_2; - voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_MIN); - voltage->dataNumbers[pos++] = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_MAX); + voltage->dataNumbers[pos++] = sfmin->number; + voltage->dataNumbers[pos++] = sfmax->number; } else { voltage->format = fmtVolt_2; } @@ -194,52 +168,46 @@ static void fillChipVoltage (FeatureDescriptor *voltage, voltage->dataNumbers[pos] = -1; /* alarm if applicable */ - if (IN_FEATURE(SENSORS_SUBFEATURE_IN_ALARM)) { - voltage->alarmNumber = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_ALARM); - } else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN_ALARM)) { - voltage->alarmNumber = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_MIN_ALARM); - } else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX_ALARM)) { - voltage->alarmNumber = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_MAX_ALARM); + if ((sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_ALARM)) || + (sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_MIN_ALARM)) || + (sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_MAX_ALARM))) { + voltage->alarmNumber = sf->number; } else { voltage->alarmNumber = -1; } /* beep if applicable */ - if (IN_FEATURE(SENSORS_SUBFEATURE_IN_BEEP)) { - voltage->beepNumber = IN_FEATURE_NR(SENSORS_SUBFEATURE_IN_ALARM); + if ((sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_BEEP))) { + voltage->beepNumber = sf->number; } else { voltage->beepNumber = -1; } } -#define TEMP_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_TEMP_INPUT] -#define TEMP_FEATURE_NR(x) feature_nrs[x - SENSORS_SUBFEATURE_TEMP_INPUT] static void fillChipTemperature (FeatureDescriptor *temperature, const sensors_chip_name *name, const sensors_feature *feature) { - const int size = SENSORS_SUBFEATURE_TEMP_BEEP - SENSORS_SUBFEATURE_TEMP_INPUT + 1; - short has_features[SENSORS_SUBFEATURE_TEMP_BEEP - SENSORS_SUBFEATURE_TEMP_INPUT + 1] = { 0, }; - int feature_nrs[SENSORS_SUBFEATURE_TEMP_BEEP - SENSORS_SUBFEATURE_TEMP_INPUT + 1]; + const sensors_subfeature *sf, *sfmin, *sfmax, *sfhyst; int pos = 0; temperature->rrd = rrdF1; temperature->type = DataType_temperature; - getAvailableFeatures (name, feature, has_features, - feature_nrs, size, SENSORS_SUBFEATURE_TEMP_INPUT); + sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_INPUT); + if (sf) + temperature->dataNumbers[pos++] = sf->number; - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_INPUT); - - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MIN) && - TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX)) { + sfmin = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_MIN); + sfmax = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_MAX); + sfhyst = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_MAX_HYST); + if (sfmin && sfmax) { temperature->format = fmtTemps_minmax_1; - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MIN); - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MAX); - } else if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX) && - TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX_HYST)) { + temperature->dataNumbers[pos++] = sfmin->number; + temperature->dataNumbers[pos++] = sfmax->number; + } else if (sfmax && sfhyst) { temperature->format = fmtTemps_1; - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MAX); - temperature->dataNumbers[pos++] = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MAX_HYST); + temperature->dataNumbers[pos++] = sfmax->number; + temperature->dataNumbers[pos++] = sfhyst->number; } else { temperature->format = fmtTemp_only; } @@ -248,45 +216,41 @@ static void fillChipTemperature (FeatureDescriptor *temperature, temperature->dataNumbers[pos] = -1; /* alarm if applicable */ - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_ALARM)) { - temperature->alarmNumber = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_ALARM); - } else if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX_ALARM)) { - temperature->alarmNumber = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_MAX_ALARM); + if ((sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_ALARM)) || + (sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_MAX_ALARM))) { + temperature->alarmNumber = sf->number; } else { temperature->alarmNumber = -1; } /* beep if applicable */ - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_BEEP)) { - temperature->beepNumber = TEMP_FEATURE_NR(SENSORS_SUBFEATURE_TEMP_BEEP); + if ((sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_BEEP))) { + temperature->beepNumber = sf->number; } else { temperature->beepNumber = -1; } } -#define FAN_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_FAN_INPUT] -#define FAN_FEATURE_NR(x) feature_nrs[x - SENSORS_SUBFEATURE_FAN_INPUT] static void fillChipFan (FeatureDescriptor *fan, const sensors_chip_name *name, const sensors_feature *feature) { - const int size = SENSORS_SUBFEATURE_FAN_BEEP - SENSORS_SUBFEATURE_FAN_INPUT + 1; - short has_features[SENSORS_SUBFEATURE_FAN_BEEP - SENSORS_SUBFEATURE_FAN_INPUT + 1] = { 0, }; - int feature_nrs[SENSORS_SUBFEATURE_FAN_BEEP - SENSORS_SUBFEATURE_FAN_INPUT + 1]; + const sensors_subfeature *sf, *sfmin, *sfdiv; int pos = 0; fan->rrd = rrdF0; fan->type = DataType_rpm; - getAvailableFeatures (name, feature, has_features, - feature_nrs, size, SENSORS_SUBFEATURE_FAN_INPUT); + sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_INPUT); + if (sf) + fan->dataNumbers[pos++] = sf->number; - fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_INPUT); - - if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_MIN)) { - fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_MIN); - if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_DIV)) { + sfmin = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_MIN); + if (sfmin) { + fan->dataNumbers[pos++] = sfmin->number; + sfdiv = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_DIV); + if (sfdiv) { fan->format = fmtFans_0; - fan->dataNumbers[pos++] = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_DIV); + fan->dataNumbers[pos++] = sfdiv->number; } else { fan->format = fmtFans_nodiv_0; } @@ -298,14 +262,16 @@ static void fillChipFan (FeatureDescriptor *fan, fan->dataNumbers[pos] = -1; /* alarm if applicable */ - if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_ALARM)) { - fan->alarmNumber = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_ALARM); + sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_ALARM); + if (sf) { + fan->alarmNumber = sf->number; } else { fan->alarmNumber = -1; } /* beep if applicable */ - if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_BEEP)) { - fan->beepNumber = FAN_FEATURE_NR(SENSORS_SUBFEATURE_FAN_BEEP); + sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_BEEP); + if (sf) { + fan->beepNumber = sf->number; } else { fan->beepNumber = -1; } @@ -315,10 +281,9 @@ static void fillChipVid (FeatureDescriptor *vid, const sensors_chip_name *name, const sensors_feature *feature) { - int i = 0; const sensors_subfeature *sub; - sub = sensors_get_all_subfeatures(name, feature, &i); + sub = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_VID); if (!sub) return; @@ -335,10 +300,9 @@ static void fillChipBeepEnable (FeatureDescriptor *beepen, const sensors_chip_name *name, const sensors_feature *feature) { - int i = 0; const sensors_subfeature *sub; - sub = sensors_get_all_subfeatures(name, feature, &i); + sub = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_BEEP_ENABLE); if (!sub) return; diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index f367f68d..70ac93b7 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -70,32 +70,18 @@ static void print_label(const char *label, int space) printf("%s:%*s", label, space - len, ""); } -static void sensors_get_available_features(const sensors_chip_name *name, - const sensors_feature *feature, - short *has_features, - double *feature_vals, int size, - int first_val) +static double get_value(const sensors_chip_name *name, int subfeat_nr) { - const sensors_subfeature *iter; - int i = 0; + double val; + int err; - while ((iter = sensors_get_all_subfeatures(name, feature, &i))) { - int indx, err; - - indx = iter->type - first_val; - if (indx < 0 || indx >= size) - /* New feature in libsensors? Ignore. */ - continue; - - err = sensors_get_value(name, iter->number, &feature_vals[indx]); - if (err) { - printf("ERROR: Can't get %s data: %s\n", iter->name, - sensors_strerror(err)); - continue; - } - - has_features[indx] = 1; + err = sensors_get_value(name, subfeat_nr, &val); + if (err) { + printf("ERROR: Can't get value of subfeature %d: %s\n", + subfeat_nr, sensors_strerror(err)); + val = 0; } + return val; } static int sensors_get_label_size(const sensors_chip_name *name) @@ -138,59 +124,69 @@ static void print_temp_limits(double limit1, double limit2, printf("ALARM "); } -#define TEMP_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_TEMP_INPUT] -#define TEMP_FEATURE_VAL(x) feature_vals[x - SENSORS_SUBFEATURE_TEMP_INPUT] static void print_chip_temp(const sensors_chip_name *name, const sensors_feature *feature, int label_size) { + const sensors_subfeature *sf, *sfmin, *sfmax, *sfcrit, *sfhyst; double val, limit1, limit2; const char *s1, *s2; int alarm, crit_displayed = 0; char *label; - const int size = SENSORS_SUBFEATURE_TEMP_TYPE - SENSORS_SUBFEATURE_TEMP_INPUT + 1; - short has_features[SENSORS_SUBFEATURE_TEMP_TYPE - SENSORS_SUBFEATURE_TEMP_INPUT + 1] = { 0, }; - double feature_vals[SENSORS_SUBFEATURE_TEMP_TYPE - SENSORS_SUBFEATURE_TEMP_INPUT + 1] = { 0.0, }; if (!(label = sensors_get_label(name, feature))) { printf("ERROR: Can't get temperature label!\n"); return; } + print_label(label, label_size); + free(label); - sensors_get_available_features(name, feature, has_features, - feature_vals, size, - SENSORS_SUBFEATURE_TEMP_INPUT); - val = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_INPUT); + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_INPUT); + val = sf ? get_value(name, sf->number) : 0; - alarm = TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_ALARM) && - TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_ALARM); - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX)) { - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX_ALARM) && - TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MAX_ALARM)) + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_ALARM); + alarm = sf && get_value(name, sf->number); + + sfmin = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_MIN); + sfmax = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_MAX); + sfcrit = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_CRIT); + if (sfmax) { + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_MAX_ALARM); + if (sf && get_value(name, sf->number)) alarm |= 1; - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MIN)) { - limit1 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MIN); + if (sfmin) { + limit1 = get_value(name, sfmin->number); s1 = "low"; - limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MAX); + limit2 = get_value(name, sfmax->number); s2 = "high"; - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MIN_ALARM) && - TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MIN_ALARM)) + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_MIN_ALARM); + if (sf && get_value(name, sf->number)) alarm |= 1; } else { - limit1 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MAX); + limit1 = get_value(name, sfmax->number); s1 = "high"; - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_MAX_HYST)) { - limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_MAX_HYST); + sfhyst = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_MAX_HYST); + if (sfhyst) { + limit2 = get_value(name, sfhyst->number); s2 = "hyst"; - } else if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT)) { - limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT); + } else if (sfcrit) { + limit2 = get_value(name, sfcrit->number); s2 = "crit"; - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM)) + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_CRIT_ALARM); + if (sf && get_value(name, sf->number)) alarm |= 1; crit_displayed = 1; } else { @@ -198,20 +194,23 @@ static void print_chip_temp(const sensors_chip_name *name, s2 = NULL; } } - } else if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT)) { - limit1 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT); + } else if (sfcrit) { + limit1 = get_value(name, sfcrit->number); s1 = "crit"; - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_HYST)) { - limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_HYST); + sfhyst = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_CRIT_HYST); + if (sfhyst) { + limit2 = get_value(name, sfhyst->number); s2 = "hyst"; } else { limit2 = 0; s2 = NULL; } - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM)) + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_CRIT_ALARM); + if (sf && get_value(name, sf->number)) alarm |= 1; crit_displayed = 1; } else { @@ -219,11 +218,10 @@ static void print_chip_temp(const sensors_chip_name *name, s1 = s2 = NULL; } - print_label(label, label_size); - free(label); - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_FAULT) && - TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_FAULT)) { + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_FAULT); + if (sf && get_value(name, sf->number)) { printf(" FAULT "); } else { if (fahrenheit) @@ -232,28 +230,34 @@ static void print_chip_temp(const sensors_chip_name *name, } print_temp_limits(limit1, limit2, s1, s2, alarm); - if (!crit_displayed && TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT)) { - limit1 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT); + if (!crit_displayed && sfcrit) { + limit1 = get_value(name, sfcrit->number); s1 = "crit"; - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_HYST)) { - limit2 = TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_HYST); + sfhyst = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_CRIT_HYST); + if (sfhyst) { + limit2 = get_value(name, sfhyst->number); s2 = "hyst"; } else { limit2 = 0; s2 = NULL; } - alarm = TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM) && - TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_CRIT_ALARM); + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_CRIT_ALARM); + if (sf && get_value(name, sf->number)) + alarm |= 1; printf("\n%*s", label_size + 10, ""); print_temp_limits(limit1, limit2, s1, s2, alarm); } /* print out temperature sensor info */ - if (TEMP_FEATURE(SENSORS_SUBFEATURE_TEMP_TYPE)) { - int sens = (int)TEMP_FEATURE_VAL(SENSORS_SUBFEATURE_TEMP_TYPE); + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_TYPE); + if (sf) { + int sens = (int)get_value(name, sf->number); /* older kernels / drivers sometimes report a beta value for thermistors */ @@ -271,15 +275,11 @@ static void print_chip_temp(const sensors_chip_name *name, printf("\n"); } -#define IN_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_IN_INPUT] -#define IN_FEATURE_VAL(x) feature_vals[x - SENSORS_SUBFEATURE_IN_INPUT] static void print_chip_in(const sensors_chip_name *name, const sensors_feature *feature, int label_size) { - const int size = SENSORS_SUBFEATURE_IN_MAX_ALARM - SENSORS_SUBFEATURE_IN_INPUT + 1; - short has_features[SENSORS_SUBFEATURE_IN_MAX_ALARM - SENSORS_SUBFEATURE_IN_INPUT + 1] = { 0, }; - double feature_vals[SENSORS_SUBFEATURE_IN_MAX_ALARM - SENSORS_SUBFEATURE_IN_INPUT + 1] = { 0.0, }; + const sensors_subfeature *sf, *sfmin, *sfmax; double val, alarm_max, alarm_min; char *label; @@ -287,32 +287,38 @@ static void print_chip_in(const sensors_chip_name *name, printf("ERROR: Can't get in label!\n"); return; } - - sensors_get_available_features(name, feature, has_features, - feature_vals, size, - SENSORS_SUBFEATURE_IN_INPUT); - val = IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_INPUT); - print_label(label, label_size); free(label); + + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_IN_INPUT); + val = sf ? get_value(name, sf->number) : 0; printf("%+6.2f V", val); - if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN) && - IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX)) + sfmin = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_IN_MIN); + sfmax = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_IN_MAX); + if (sfmin && sfmax) printf(" (min = %+6.2f V, max = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MIN), - IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MAX)); - else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN)) + get_value(name, sfmin->number), + get_value(name, sfmax->number)); + else if (sfmin) printf(" (min = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MIN)); - else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX)) + get_value(name, sfmin->number)); + else if (sfmax) printf(" (max = %+6.2f V)", - IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MAX)); + get_value(name, sfmax->number)); - if (IN_FEATURE(SENSORS_SUBFEATURE_IN_MAX_ALARM) || - IN_FEATURE(SENSORS_SUBFEATURE_IN_MIN_ALARM)) { - alarm_max = IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MAX_ALARM); - alarm_min = IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_MIN_ALARM); + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_IN_ALARM); + sfmin = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_IN_MIN_ALARM); + sfmax = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_IN_MAX_ALARM); + if (sfmin || sfmax) { + alarm_max = sfmax ? get_value(name, sfmax->number) : 0; + alarm_min = sfmin ? get_value(name, sfmin->number) : 0; if (alarm_min || alarm_max) { printf(" ALARM ("); @@ -324,59 +330,57 @@ static void print_chip_in(const sensors_chip_name *name, printf(")"); } - } else if (IN_FEATURE(SENSORS_SUBFEATURE_IN_ALARM)) { + } else if (sf) { printf(" %s", - IN_FEATURE_VAL(SENSORS_SUBFEATURE_IN_ALARM) ? "ALARM" : ""); + get_value(name, sf->number) ? "ALARM" : ""); } printf("\n"); } -#define FAN_FEATURE(x) has_features[x - SENSORS_SUBFEATURE_FAN_INPUT] -#define FAN_FEATURE_VAL(x) feature_vals[x - SENSORS_SUBFEATURE_FAN_INPUT] static void print_chip_fan(const sensors_chip_name *name, const sensors_feature *feature, int label_size) { + const sensors_subfeature *sf, *sfmin, *sfdiv; char *label; - const int size = SENSORS_SUBFEATURE_FAN_DIV - SENSORS_SUBFEATURE_FAN_INPUT + 1; - short has_features[SENSORS_SUBFEATURE_FAN_DIV - SENSORS_SUBFEATURE_FAN_INPUT + 1] = { 0, }; - double feature_vals[SENSORS_SUBFEATURE_FAN_DIV - SENSORS_SUBFEATURE_FAN_INPUT + 1] = { 0.0, }; double val; if (!(label = sensors_get_label(name, feature))) { printf("ERROR: Can't get fan label!\n"); return; } - print_label(label, label_size); free(label); - sensors_get_available_features(name, feature, has_features, - feature_vals, size, - SENSORS_SUBFEATURE_FAN_INPUT); - val = FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_INPUT); - - if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_FAULT) && - FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_FAULT)) + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_FAN_INPUT); + val = sf ? get_value(name, sf->number) : 0; + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_FAN_FAULT); + if (sf && get_value(name, sf->number)) printf(" FAULT"); else printf("%4.0f RPM", val); - if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_MIN) && - FAN_FEATURE(SENSORS_SUBFEATURE_FAN_DIV)) + sfmin = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_FAN_MIN); + sfdiv = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_FAN_DIV); + if (sfmin && sfdiv) printf(" (min = %4.0f RPM, div = %1.0f)", - FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_MIN), - FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_DIV)); - else if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_MIN)) + get_value(name, sfmin->number), + get_value(name, sfdiv->number)); + else if (sfmin) printf(" (min = %4.0f RPM)", - FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_MIN)); - else if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_DIV)) + get_value(name, sfmin->number)); + else if (sfdiv) printf(" (div = %1.0f)", - FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_DIV)); + get_value(name, sfdiv->number)); - if (FAN_FEATURE(SENSORS_SUBFEATURE_FAN_ALARM) && - FAN_FEATURE_VAL(SENSORS_SUBFEATURE_FAN_ALARM)) { + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_FAN_ALARM); + if (sf && get_value(name, sf->number)) { printf(" ALARM"); } @@ -390,9 +394,9 @@ static void print_chip_vid(const sensors_chip_name *name, char *label; const sensors_subfeature *subfeature; double vid; - int i = 0; - subfeature = sensors_get_all_subfeatures(name, feature, &i); + subfeature = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_VID); if (!subfeature) return; @@ -411,9 +415,9 @@ static void print_chip_beep_enable(const sensors_chip_name *name, char *label; const sensors_subfeature *subfeature; double beep_enable; - int i = 0; - subfeature = sensors_get_all_subfeatures(name, feature, &i); + subfeature = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_BEEP_ENABLE); if (!subfeature) return; From 9698d82fd3bd6ad289efcd0c9876ce40edfce3f9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:33:12 +0000 Subject: [PATCH 305/718] Rename sensors_get_label_size() to get_label_size() for consistency. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4847 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensors/chips.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 70ac93b7..bdec0d26 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -84,7 +84,7 @@ static double get_value(const sensors_chip_name *name, int subfeat_nr) return val; } -static int sensors_get_label_size(const sensors_chip_name *name) +static int get_label_size(const sensors_chip_name *name) { int i; const sensors_feature *iter; @@ -434,7 +434,7 @@ void print_chip(const sensors_chip_name *name) const sensors_feature *feature; int i, label_size; - label_size = sensors_get_label_size(name); + label_size = get_label_size(name); i = 0; while ((feature = sensors_get_features(name, &i))) { From 5742812cfe003af85d7a13538b4110a0f0c6b856 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:36:56 +0000 Subject: [PATCH 306/718] Hide a warning in flex-generated file. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4848 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/Module.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Module.mk b/lib/Module.mk index 9cfdadf3..df0bd2ce 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -85,7 +85,7 @@ $(MODULE_DIR)/conf-parse.h: $(MODULE_DIR)/conf-parse.c INCLUDEFILES += $(LIBCSOURCES:.c=.ld) $(LIBCSOURCES:.c=.ad) # Special warning prevention for flex-generated files -FLEXNOWARN:=-Wno-shadow -Wno-undef -Wno-unused -Wno-missing-prototypes +FLEXNOWARN:=-Wno-shadow -Wno-undef -Wno-unused -Wno-missing-prototypes -Wno-sign-compare $(MODULE_DIR)/conf-lex.ao: $(MODULE_DIR)/conf-lex.c $(CC) $(ARCPPFLAGS) $(ARCFLAGS) $(FLEXNOWARN) -c $< -o $@ $(MODULE_DIR)/conf-lex.lo: $(MODULE_DIR)/conf-lex.c From c390c9e29f42ab587a0933eb3782f63317af2f1f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:47:27 +0000 Subject: [PATCH 307/718] Hide warnings about unused parameters. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4849 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/rrd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prog/sensord/rrd.c b/prog/sensord/rrd.c index 0d71c19e..bccec0d3 100644 --- a/prog/sensord/rrd.c +++ b/prog/sensord/rrd.c @@ -185,6 +185,7 @@ struct ds { static int rrdGetSensors_DS (void *_data, const char *rawLabel, const char *label, const FeatureDescriptor *feature) { + (void) label; /* no warning */ if (!feature || feature->rrd) { struct ds *data = (struct ds *) _data; char *ptr = rrdBuff + data->num * RRD_BUFF; @@ -287,6 +288,7 @@ static int rrdCGI_DEF (void *_data, const char *rawLabel, const char *label, const FeatureDescriptor *feature) { struct gr *data = (struct gr *) _data; + (void) label; /* no warning */ if (!feature || (feature->rrd && (feature->type == data->type))) printf ("\n\tDEF:%s=%s:%s:AVERAGE", rawLabel, rrdFile, rawLabel); return 0; From 9ba88a7d1f233892352eaaebcfe64c98eba16ded Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 12:49:47 +0000 Subject: [PATCH 308/718] Better prototype for get_type_scaling(). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4850 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index a700bea0..8b4720ea 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -46,7 +46,7 @@ char sensors_sysfs_mount[NAME_MAX]; + MAX_SENSORS_PER_TYPE + 1) static -int get_type_scaling(int type) +int get_type_scaling(sensors_subfeature_type type) { switch (type & 0xFF10) { case SENSORS_SUBFEATURE_IN_INPUT: From 06a8d04b5d87fecfcf7580144134a9703e02ca87 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 13:17:53 +0000 Subject: [PATCH 309/718] Preserve error values returned by sensors_read_sysfs_attr() and sensors_write_sysfs_attr(). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4851 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/access.c b/lib/access.c index 6a44c3fd..38e75c25 100644 --- a/lib/access.c +++ b/lib/access.c @@ -258,8 +258,9 @@ int sensors_get_value(const sensors_chip_name *name, int subfeat_nr, } } - if (sensors_read_sysfs_attr(name, subfeature, &val)) - return -SENSORS_ERR_PROC; + res = sensors_read_sysfs_attr(name, subfeature, &val); + if (res) + return res; if (!expr) *result = val; else if ((res = sensors_eval_expr(chip_features, expr, val, result))) @@ -313,9 +314,7 @@ int sensors_set_value(const sensors_chip_name *name, int subfeat_nr, if ((res = sensors_eval_expr(chip_features, expr, value, &to_write))) return res; - if (sensors_write_sysfs_attr(name, subfeature, to_write)) - return -SENSORS_ERR_PROC; - return 0; + return sensors_write_sysfs_attr(name, subfeature, to_write); } const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name From 2fea711456e12dbc9ed35d0cf248396efaaf8f66 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 13:33:32 +0000 Subject: [PATCH 310/718] Alignment. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4852 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/error.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/error.h b/lib/error.h index 1b3c9ba7..1e7b8ebd 100644 --- a/lib/error.h +++ b/lib/error.h @@ -20,16 +20,16 @@ #ifndef LIB_SENSORS_ERROR_H #define LIB_SENSORS_ERROR_H -#define SENSORS_ERR_WILDCARDS 1 /* Wildcard found in chip name */ -#define SENSORS_ERR_NO_ENTRY 2 /* No such subfeature known */ -#define SENSORS_ERR_ACCESS 3 /* Can't read or write */ -#define SENSORS_ERR_PROC 4 /* Can't access /proc file */ -#define SENSORS_ERR_DIV_ZERO 5 /* Divide by zero */ -#define SENSORS_ERR_CHIP_NAME 6 /* Can't parse chip name */ -#define SENSORS_ERR_BUS_NAME 7 /* Can't parse bus name */ -#define SENSORS_ERR_PARSE 8 /* General parse error */ -#define SENSORS_ERR_ACCESS_W 9 /* Can't write */ -#define SENSORS_ERR_ACCESS_R 10 /* Can't read */ +#define SENSORS_ERR_WILDCARDS 1 /* Wildcard found in chip name */ +#define SENSORS_ERR_NO_ENTRY 2 /* No such subfeature known */ +#define SENSORS_ERR_ACCESS 3 /* Can't read or write */ +#define SENSORS_ERR_PROC 4 /* Can't access /proc file */ +#define SENSORS_ERR_DIV_ZERO 5 /* Divide by zero */ +#define SENSORS_ERR_CHIP_NAME 6 /* Can't parse chip name */ +#define SENSORS_ERR_BUS_NAME 7 /* Can't parse bus name */ +#define SENSORS_ERR_PARSE 8 /* General parse error */ +#define SENSORS_ERR_ACCESS_W 9 /* Can't write */ +#define SENSORS_ERR_ACCESS_R 10 /* Can't read */ #ifdef __cplusplus extern "C" { From 4b6f9ee7276b596922d89619dd0b20d248344d7f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 13:48:52 +0000 Subject: [PATCH 311/718] Better error message if configuration file can't be loaded. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4853 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/lib.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/prog/sensord/lib.c b/prog/sensord/lib.c index d5459d63..9e47e871 100644 --- a/prog/sensord/lib.c +++ b/prog/sensord/lib.c @@ -79,10 +79,8 @@ loadConfig if (!strcmp (cfgPath, "-")) { if (!reload) { if ((ret = sensors_init (stdin))) { - if (ret == -SENSORS_ERR_PROC) - sensorLog (LOG_ERR, "Error reading /proc or /sys; modules probably not loaded"); - else - sensorLog (LOG_ERR, "Error %d loading sensors configuration file: ", ret); + sensorLog (LOG_ERR, "Error loading sensors configuration file : %s", + sensors_strerror (ret)); ret = 12; } } @@ -98,10 +96,8 @@ loadConfig sensorLog (LOG_ERR, "Error opening sensors configuration file: %s", cfgPath); ret = 11; } else if ((ret = sensors_init (cfg))) { - if (ret == -SENSORS_ERR_PROC) - sensorLog (LOG_ERR, "Error reading /proc or /sys; modules probably not loaded"); - else - sensorLog (LOG_ERR, "Error %d loading sensors configuration file: %s", ret, cfgPath); + sensorLog (LOG_ERR, "Error loading sensors configuration file %s: %s", + cfgPath, sensors_strerror (ret)); ret = 11; } else { cfgLastModified = stats.st_mtime; From ab36c5b0f8b53365f7728d3c0a1bda973530a16d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 13:53:11 +0000 Subject: [PATCH 312/718] Delete unused SENSORS_ERR_ACCESS. Rename SENSORS_ERR_PROC to the more neutral SENSORS_ERR_KERNEL. Introduce SENSORS_ERR_NO_DEVS for finer-grained error reporting. Use SENSORS_ERR_KERNEL and SENSORS_ERR_NO_DEVS where appropriate. No error message for invalid error codes. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4854 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/error.c | 7 ++++--- lib/error.h | 5 +++-- lib/init.c | 2 +- lib/sysfs.c | 20 ++++++++++---------- prog/sensors/main.c | 4 ++-- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lib/error.c b/lib/error.c index 52ca8038..ab104e96 100644 --- a/lib/error.c +++ b/lib/error.c @@ -1,6 +1,7 @@ /* error.c - Part of libsensors, a Linux library for reading sensor data. Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,11 +32,11 @@ void (*sensors_fatal_error) (const char *proc, const char *err) = sensors_default_fatal_error; static const char *errorlist[] = { - /* Unknown error */ "sensors_strerror: Unknown error!", + /* Invalid error code */ NULL, /* SENSORS_ERR_WILDCARDS */ "Wildcard found in chip name", /* SENSORS_ERR_NO_ENTRY */ "No such subfeature known", - /* SENSORS_ERR_ACCESS */ "Can't read or write", - /* SENSORS_ERR_PROC */ "Can't access sysfs file", + /* SENSORS_ERR_NO_DEVS */ "No devices found", + /* SENSORS_ERR_KERNEL */ "Kernel interface error", /* SENSORS_ERR_DIV_ZERO */ "Divide by zero", /* SENSORS_ERR_CHIP_NAME */ "Can't parse chip name", /* SENSORS_ERR_BUS_NAME */ "Can't parse bus name", diff --git a/lib/error.h b/lib/error.h index 1e7b8ebd..e9be52fb 100644 --- a/lib/error.h +++ b/lib/error.h @@ -1,6 +1,7 @@ /* error.h - Part of libsensors, a Linux library for reading sensor data. Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,8 +23,8 @@ #define SENSORS_ERR_WILDCARDS 1 /* Wildcard found in chip name */ #define SENSORS_ERR_NO_ENTRY 2 /* No such subfeature known */ -#define SENSORS_ERR_ACCESS 3 /* Can't read or write */ -#define SENSORS_ERR_PROC 4 /* Can't access /proc file */ +#define SENSORS_ERR_NO_DEVS 3 /* No devices found */ +#define SENSORS_ERR_KERNEL 4 /* Kernel interface error */ #define SENSORS_ERR_DIV_ZERO 5 /* Divide by zero */ #define SENSORS_ERR_CHIP_NAME 6 /* Can't parse chip name */ #define SENSORS_ERR_BUS_NAME 7 /* Can't parse bus name */ diff --git a/lib/init.c b/lib/init.c index 94f078eb..e06696d8 100644 --- a/lib/init.c +++ b/lib/init.c @@ -33,7 +33,7 @@ int sensors_init(FILE *input) int res; if (!sensors_init_sysfs()) - return -SENSORS_ERR_PROC; + return -SENSORS_ERR_KERNEL; if ((res = sensors_read_sysfs_bus()) || (res = sensors_read_sysfs_chips())) return res; diff --git a/lib/sysfs.c b/lib/sysfs.c index 8b4720ea..2fe9d826 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -344,7 +344,7 @@ int sensors_init_sysfs(void) static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) { int domain, bus, slot, fn; - int err = -SENSORS_ERR_PARSE; + int err = -SENSORS_ERR_KERNEL; struct sysfs_attribute *attr, *bus_attr; char bus_path[SYSFS_PATH_MAX]; sensors_chip_features entry; @@ -430,13 +430,13 @@ static int sensors_read_sysfs_chips_compat(void) if (!(bus = sysfs_open_bus("i2c"))) { if (errno && errno != ENOENT) - ret = -SENSORS_ERR_PROC; + ret = -SENSORS_ERR_NO_DEVS; goto exit0; } if (!(devs = sysfs_get_bus_devices(bus))) { if (errno && errno != ENOENT) - ret = -SENSORS_ERR_PROC; + ret = -SENSORS_ERR_NO_DEVS; goto exit1; } @@ -467,14 +467,14 @@ int sensors_read_sysfs_chips(void) if (!(clsdevs = sysfs_get_class_devices(cls))) { if (errno && errno != ENOENT) - ret = -SENSORS_ERR_PROC; + ret = -SENSORS_ERR_NO_DEVS; goto exit; } dlist_for_each_data(clsdevs, clsdev, struct sysfs_class_device) { struct sysfs_device *dev; if (!(dev = sysfs_get_classdev_device(clsdev))) { - ret = -SENSORS_ERR_PROC; + ret = -SENSORS_ERR_NO_DEVS; goto exit; } if ((ret = sensors_read_one_sysfs_chip(dev))) @@ -498,13 +498,13 @@ int sensors_read_sysfs_bus(void) if (!(cls = sysfs_open_class("i2c-adapter"))) { if (errno && errno != ENOENT) - ret = -SENSORS_ERR_PROC; + ret = -SENSORS_ERR_KERNEL; goto exit0; } if (!(clsdevs = sysfs_get_class_devices(cls))) { if (errno && errno != ENOENT) - ret = -SENSORS_ERR_PROC; + ret = -SENSORS_ERR_KERNEL; goto exit1; } @@ -553,10 +553,10 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int res = fscanf(f, "%lf", value); fclose(f); if (res != 1) - return -SENSORS_ERR_PROC; + return -SENSORS_ERR_KERNEL; *value /= get_type_scaling(subfeature->type); } else - return -SENSORS_ERR_PROC; + return -SENSORS_ERR_KERNEL; return 0; } @@ -574,7 +574,7 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, fprintf(f, "%d", (int) value); fclose(f); } else - return -SENSORS_ERR_PROC; + return -SENSORS_ERR_KERNEL; return 0; } diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 22f3efb1..d1e723b0 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -171,8 +171,8 @@ static int do_a_set(const sensors_chip_name *name) int res; if ((res = sensors_do_chip_sets(name))) { - if (res == -SENSORS_ERR_PROC) { - fprintf(stderr, "%s: %s for writing;\n", + if (res == -SENSORS_ERR_KERNEL) { + fprintf(stderr, "%s: %s;\n", sprintf_chip_name(name), sensors_strerror(res)); fprintf(stderr, "Run as root?\n"); From 55e467b151511921c1559309b9701720e311fefa Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 14:34:42 +0000 Subject: [PATCH 313/718] Don't arbitrarily write errors to stderr. In production mode, simply ignore the errors. In debug mode, call sensors_fatal_error(). As a side note, there is certainly room for improvement in the way errors are reported by libsensors. sensors_fatal_error() is fatal, and sensors_parse_error() is too specific, so we lack a more general error reporting function. printf-like formatting for error messages would also be a good idea. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4855 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 2fe9d826..2a436576 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -213,15 +213,17 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, switch (sftype & 0xFF00) { case SENSORS_SUBFEATURE_FAN_INPUT: case SENSORS_SUBFEATURE_TEMP_INPUT: - if (nr) - nr--; + nr--; break; } - if (nr >= MAX_SENSORS_PER_TYPE) { - fprintf(stderr, "libsensors error, more sensors of one" - " type then MAX_SENSORS_PER_TYPE, ignoring " - "subfeature: %s\n", name); + if (nr < 0 || nr >= MAX_SENSORS_PER_TYPE) { + /* More sensors of one type than MAX_SENSORS_PER_TYPE, + we have to ignore it */ +#ifdef DEBUG + sensors_fatal_error(__FUNCTION__, + "Increase MAX_SENSORS_PER_TYPE!"); +#endif continue; } @@ -243,9 +245,10 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, } if (all_subfeatures[i].name) { - fprintf(stderr, "libsensors error, trying to add dupli" - "cate subfeature: %s to dynamic feature table\n", - name); +#ifdef DEBUG + sensors_fatal_error(__FUNCTION__, + "Duplicate subfeature"); +#endif continue; } From df027fb0d5ea630e09e50ba766f955637e6ae8fc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 16:37:51 +0000 Subject: [PATCH 314/718] Drop all references to the MBM website, it's gone now. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4857 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/FAQ | 23 +++++++++-------------- doc/lm_sensors-FAQ.html | 8 +++----- doc/lm_sensors-FAQ.texi | 6 ++---- doc/useful_addresses.html | 5 ----- 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/doc/FAQ b/doc/FAQ index cc4b2c56..18be897b 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -355,10 +355,9 @@ for candidates, then *note Help::) 3. Check the manufacturer's website or ask their support - 4. Check the Motherboard Monitor (http://mbm.livewiredev.com/) - website and the "links" - (http://www.lm-sensors.org/wiki/UsefulLinks) page on our website - (http://www.lm-sensors.org) some good cross-references. + 4. Check the "links" (http://www.lm-sensors.org/wiki/UsefulLinks) + page on our website (http://www.lm-sensors.org) some good + cross-references. 3.2.2 Do you support motherboard XYZ? ------------------------------------- @@ -861,13 +860,12 @@ it was misidentified. We are working on improving that too. -------------------------------------- Do you own an ASUS motherboard? Perhaps your chip is being -misidentified. Look on the motherboard (or at -`http://mbm.livewiredev.com') for a 'Winbond' or Asus chip. Often the -real device is an Asus as99127f. If so, the driver can be forced to -recognize the as99127f with `force_as99127f=BUS,0x2d' where `BUS' is -your i2c bus number. Cat /proc/bus/i2c to see a list of bus numbers. -Read the w83781d module documentation (`doc/chips/w83781d') for more -details. +misidentified. Look on the motherboard for a 'Winbond' or Asus chip. +Often the real device is an Asus as99127f. If so, the driver can be +forced to recognize the as99127f with `force_as99127f=BUS,0x2d' where +`BUS' is your i2c bus number. Cat /proc/bus/i2c to see a list of bus +numbers. Read the w83781d module documentation (`doc/chips/w83781d') +for more details. 4.17.6 Bus hangs on Ali 1543 on Asus P5A boards! ------------------------------------------------ @@ -1085,9 +1083,6 @@ Either 2. Check the manufacturer's website. - 3. Check the Motherboard Monitor (http://mbm.livewiredev.com/) - website. - When you know what chips you have, check the Driver Status (http://www.lm-sensors.org/wiki/Devices) web page to see if support has been added for your chip in a later release or in SVN. diff --git a/doc/lm_sensors-FAQ.html b/doc/lm_sensors-FAQ.html index d004d244..fc77a032 100644 --- a/doc/lm_sensors-FAQ.html +++ b/doc/lm_sensors-FAQ.html @@ -588,7 +588,7 @@ for candidates, then see Help)
      1. Look at your motherboard.
      2. Check the manufacturer's website or ask their support -
      3. Check the Motherboard Monitor website and the +
      4. Check the "links" page on our website some good cross-references.
      @@ -1371,8 +1371,7 @@ misidentified. We are working on improving that too.

      4.17.5 Bad readings from a w8378[12]d!

      Do you own an ASUS motherboard? Perhaps your chip is being -misidentified. Look on the motherboard (or at -http://mbm.livewiredev.com) for a 'Winbond' or Asus chip. +misidentified. Look on the motherboard for a 'Winbond' or Asus chip. Often the real device is an Asus as99127f. If so, the driver can be forced to recognize the as99127f with force_as99127f=BUS,0x2d where BUS is your i2c bus number. @@ -1643,8 +1642,7 @@ Run devfs in the kernel to get the But in any case you should figure out what is on the board:

      1. Look at your motherboard. -
      2. Check the manufacturer's website. -
      3. Check the Motherboard Monitor website. +
      4. Check the manufacturer's website.

      When you know what chips you have, check the diff --git a/doc/lm_sensors-FAQ.texi b/doc/lm_sensors-FAQ.texi index de5a6f26..2a9b79ea 100644 --- a/doc/lm_sensors-FAQ.texi +++ b/doc/lm_sensors-FAQ.texi @@ -317,7 +317,7 @@ If that doesn't work: @enumerate 2 @item Look at your motherboard. @item Check the manufacturer's website or ask their support -@item Check the @uref{http://mbm.livewiredev.com/, Motherboard Monitor} website and the +@item Check the @uref{http://www.lm-sensors.org/wiki/UsefulLinks, "links"} page on @uref{http://www.lm-sensors.org, our website} some good cross-references. @end enumerate @@ -902,8 +902,7 @@ misidentified. We are working on improving that too. @subsection Bad readings from a w8378[12]d! Do you own an ASUS motherboard? Perhaps your chip is being -misidentified. Look on the motherboard (or at -@uref{http://mbm.livewiredev.com}) for a 'Winbond' or Asus chip. +misidentified. Look on the motherboard for a 'Winbond' or Asus chip. Often the real device is an Asus as99127f. If so, the driver can be forced to recognize the as99127f with @command{force_as99127f=BUS,0x2d} where @code{BUS} is your i2c bus number. @@ -1123,7 +1122,6 @@ But in any case you should figure out what is on the board: @enumerate @item Look at your motherboard. @item Check the manufacturer's website. -@item Check the @uref{http://mbm.livewiredev.com/, Motherboard Monitor} website. @end enumerate When you know what chips you have, check the diff --git a/doc/useful_addresses.html b/doc/useful_addresses.html index 108fe5e1..5b8e41f2 100644 --- a/doc/useful_addresses.html +++ b/doc/useful_addresses.html @@ -253,11 +253,6 @@ implementations. Please report any other references you have found!

    • Other hardware monitoring implementations (not using LM Sensors)
        -
      • Motherboard Monitor -
        A very comprehensive package for Windows, unfortunately discontinued. - Supports many many devices. Also has a great - database of motherboards. We wish to thank the author, Alex van Kaam, for the - great cooperation we had.
      • Alexander Larsson's LM78 module
        The original module LM Sensors is based upon.
      • From d1b374cc38507a6f1ed3e3310c92507165d59e83 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 17:42:27 +0000 Subject: [PATCH 315/718] Renumber feature and subfeature types to leave more room if we later need to add more feature or subfeature types. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4858 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 25 +++++++++++-------------- lib/sysfs.c | 8 ++++---- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/sensors.h b/lib/sensors.h index 1cae70f3..5472fd1e 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -124,43 +124,40 @@ const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name mapping is available */ #define SENSORS_NO_MAPPING -1 -/* These must match the subfeature constants below (shifted by 8 bits) */ typedef enum sensors_feature_type { SENSORS_FEATURE_IN = 0x00, SENSORS_FEATURE_FAN = 0x01, SENSORS_FEATURE_TEMP = 0x02, SENSORS_FEATURE_VID = 0x10, - SENSORS_FEATURE_BEEP_ENABLE = 0x11, + SENSORS_FEATURE_BEEP_ENABLE = 0x18, SENSORS_FEATURE_UNKNOWN = INT_MAX, } sensors_feature_type; -/* This enum contains some "magic" used by sensors_read_dynamic_chip() from - lib/sysfs.c. All the sensor types (in, fan, temp, vid) are a multiple of - 0x100 apart, and sensor subfeatures which should not have a compute - mapping to the _input subfeature start at 0x?10. */ +/* All the sensor types (in, fan, temp, vid) are a multiple of 0x100 apart, + and sensor subfeatures which have no compute mapping have bit 7 set. */ typedef enum sensors_subfeature_type { - SENSORS_SUBFEATURE_IN_INPUT = 0x000, + SENSORS_SUBFEATURE_IN_INPUT = SENSORS_FEATURE_IN << 8, SENSORS_SUBFEATURE_IN_MIN, SENSORS_SUBFEATURE_IN_MAX, - SENSORS_SUBFEATURE_IN_ALARM = 0x010, + SENSORS_SUBFEATURE_IN_ALARM = (SENSORS_FEATURE_IN << 8) | 0x80, SENSORS_SUBFEATURE_IN_MIN_ALARM, SENSORS_SUBFEATURE_IN_MAX_ALARM, SENSORS_SUBFEATURE_IN_BEEP, - SENSORS_SUBFEATURE_FAN_INPUT = 0x100, + SENSORS_SUBFEATURE_FAN_INPUT = SENSORS_FEATURE_FAN << 8, SENSORS_SUBFEATURE_FAN_MIN, - SENSORS_SUBFEATURE_FAN_ALARM = 0x110, + SENSORS_SUBFEATURE_FAN_ALARM = (SENSORS_FEATURE_FAN << 8) | 0x80, SENSORS_SUBFEATURE_FAN_FAULT, SENSORS_SUBFEATURE_FAN_DIV, SENSORS_SUBFEATURE_FAN_BEEP, - SENSORS_SUBFEATURE_TEMP_INPUT = 0x200, + SENSORS_SUBFEATURE_TEMP_INPUT = SENSORS_FEATURE_TEMP << 8, SENSORS_SUBFEATURE_TEMP_MAX, SENSORS_SUBFEATURE_TEMP_MAX_HYST, SENSORS_SUBFEATURE_TEMP_MIN, SENSORS_SUBFEATURE_TEMP_CRIT, SENSORS_SUBFEATURE_TEMP_CRIT_HYST, - SENSORS_SUBFEATURE_TEMP_ALARM = 0x210, + SENSORS_SUBFEATURE_TEMP_ALARM = (SENSORS_FEATURE_TEMP << 8) | 0x80, SENSORS_SUBFEATURE_TEMP_MAX_ALARM, SENSORS_SUBFEATURE_TEMP_MIN_ALARM, SENSORS_SUBFEATURE_TEMP_CRIT_ALARM, @@ -169,9 +166,9 @@ typedef enum sensors_subfeature_type { SENSORS_SUBFEATURE_TEMP_OFFSET, SENSORS_SUBFEATURE_TEMP_BEEP, - SENSORS_SUBFEATURE_VID = 0x1000, + SENSORS_SUBFEATURE_VID = SENSORS_FEATURE_VID << 8, - SENSORS_SUBFEATURE_BEEP_ENABLE = 0x1100, + SENSORS_SUBFEATURE_BEEP_ENABLE = SENSORS_FEATURE_BEEP_ENABLE << 8, SENSORS_SUBFEATURE_UNKNOWN = INT_MAX, } sensors_subfeature_type; diff --git a/lib/sysfs.c b/lib/sysfs.c index 2a436576..a4655120 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -48,7 +48,7 @@ char sensors_sysfs_mount[NAME_MAX]; static int get_type_scaling(sensors_subfeature_type type) { - switch (type & 0xFF10) { + switch (type & 0xFF80) { case SENSORS_SUBFEATURE_IN_INPUT: case SENSORS_SUBFEATURE_TEMP_INPUT: return 1000; @@ -240,8 +240,8 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, default: i = (sftype >> 8) * MAX_SENSORS_PER_TYPE * MAX_SUBFEATURES * 2 + nr * MAX_SUBFEATURES * 2 + - ((sftype & 0x10) >> 4) * MAX_SUBFEATURES + - (sftype & 0x0F); + ((sftype & 0x80) >> 7) * MAX_SUBFEATURES + + (sftype & 0x7F); } if (all_subfeatures[i].name) { @@ -255,7 +255,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip, /* fill in the subfeature members */ all_subfeatures[i].type = sftype; all_subfeatures[i].name = strdup(name); - if (!(sftype & 0x10)) + if (!(sftype & 0x80)) all_subfeatures[i].flags |= SENSORS_COMPUTE_MAPPING; if (attr->method & SYSFS_METHOD_SHOW) all_subfeatures[i].flags |= SENSORS_MODE_R; From 55a29cc2cefd2ba4cd88d994d0aa9f345c98bb1f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 17:48:57 +0000 Subject: [PATCH 316/718] Reserve some room in struct sensors_feature for future extension. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4859 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/sensors.h b/lib/sensors.h index 5472fd1e..fad3f367 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -178,7 +178,9 @@ struct sensors_feature { char *name; int number; sensors_feature_type type; + /* Members below are for libsensors internal use only */ int first_subfeature; + int padding1; }; /* Data about a single chip subfeature: From 56e301c8b524575efbb94a73f2fae7c232a0994f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Sep 2007 18:00:20 +0000 Subject: [PATCH 317/718] Document struct_feature. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4860 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/libsensors.3 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/libsensors.3 b/lib/libsensors.3 index ec8eb025..43d3cc6c 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -104,16 +104,32 @@ To start at the beginning of the list, use 0 for nr; NULL is returned if we are at the end of the list. Do not try to change these chip names, as they point to internal structures! -This structure contains information related to a given subfeature of a +This structure contains information related to a given feature of a specific chip. .br +\fBtypedef struct sensors_feature { +.br + const char *name; +.br + int number; +.br + sensors_feature_type type; +.br +} sensors_feature;\fP +.br +There are other member not documented here, which are only meant for libsensors +internal use. + +This structure contains information related to a given subfeature of a +specific chip feature. +.br \fBtypedef struct sensors_subfeature { .br const char *name; .br int number; .br - sensors_feature_type type; + sensors_subfeature_type type; .br int mapping; .br From 286c3320711b3ef2d26e314dacfde0833b5c5cc3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 09:14:38 +0000 Subject: [PATCH 318/718] The kernel directory is no more. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4863 7894878c-1315-0410-8ee3-d5d059ff63e0 --- README.directories | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.directories b/README.directories index f5c29871..efc5c8da 100644 --- a/README.directories +++ b/README.directories @@ -3,11 +3,9 @@ The directories within this package: * doc Documentation. * etc - A sample configuration file for the 'sensors' program. -* kernel - A few kernel-related header files. + A sample configuration file for libsensors. * lib - The user-space sensors support library code. + The user-space sensors support library code (libsensors). * prog Several supporting programs. Includes programs for detecting installed hardware and recommending specific modules to install. From b60f5a718ee14aff59fd32663e4918151c7f4589 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 09:15:28 +0000 Subject: [PATCH 319/718] Update for version 3. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4864 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CONTRIBUTORS | 110 +++++++-------------------------------------------- 1 file changed, 14 insertions(+), 96 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 08076c35..45e2d231 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,97 +1,15 @@ -This package could not have been created without the help of many, many people. -The most notable contributors are listed below. You are probably best off -to use the mailing list (see -http://www.lm-sensors.org/wiki/AuthorsAndContributors) if you have questions, -suggestions or problems. +Here is a list of the main contributors to lm-sensors version 3. -* Alexander Larsson - Wrote the original lm78 module; lm_sensors version 1 was no more than an - extension of this module. He still likes to keep an eye on current - developments, but is usually too busy with other things to do much work - on them -* Philip Edelbrock - Took up the development of the Alex' lm78 module. Responsible for most - SMBus code, and many, many other things. He is still one of the main - developers of the current package. -* Frodo Looijaard - Took up the development of Alex' lm78 module. Large pieces of code were - written by him. Designed lm_sensors version 2, and wrote most of its - core code, including many drivers. -* William Morgan - Helped with some patches in lm_sensors version 1. He provided us with - the original CVS archive, and even managed to explain to us how to use - it. -* Kyösti Mälkki - Author of the i2c-via and i2c-viapro host drivers. Sis5595 hack. - Extended support for GL518SM and GL520SM sensors. -* Mark D. Studebaker - Author of the i2c-ali15x3, i2c-i801, and i2c-i810 bus drivers. - Author (with Bob Dougherty) of the via686a 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. - Added DDC support and i2c-algo-bit layer to the i2c-voodoo3 bus driver. - Added the RRD interface. - Author of the smsc47m1, vt1211, and vt8231 chip drivers. -* Bob Dougherty - Author (with MDS) of the via686a driver. -* Jonathan Teh Soon Yew and Alex van Kaam - Contributed conversion factor data for the via686a driver. -* Geert Uytterhoeven - Author of the i2c-hydra driver. -* Adrian Baugh (http://www.adrianbaugh.org.uk/) - Original author of wmsensors; - he also tested lots of things, and helped us out on several occasions. -* Fons Rademakers - Author of the maxilife module (which could only be written under NDA) -* Merlin Hughes - Author of the AMD756 module and sensord. -* Constantine Gavrilov - Created and maintains the RPM files -* Simon Vogl - Wrote the new i2c kernel driver. This driver is indispensable for the - workings of lm_sensors version 2. -* Gerd Knorr (?) - Designed the i2c structs, which made it possible to use the smbus-is- - just-an-i2c-extension approach. -* Chen-Yuan Wu - Author of the adm1025 driver. -* Kris Van Hees - Author of the mtp008 chip driver. -* Ken Bowley - Author of the adm1024 driver -* Oleg I. Vdovikin - Author of the DEC Tsunami bus driver. -* Christophe Gauthron - Author of the IT87 driver. -* Hermann Jung - Author of the fscpos driver. -* Aurelien Jarno - Author of the pcf8591 driver. -* Abraham vd Merwe - Author of the LM92 driver. -* Mark M. Hoffman - Author of the i2c-sis645 bus driver. - 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. -* Jean Delvare - Author of the lm63, lm83, lm90 and w83l785ts SMBus chip drivers. - Author of the f71805f and pc87360 Super-I/O chip drivers. - Author of the i2c-amd756-s4882 SMBus multiplexing driver. - Perl scripts maintainer, tester, bug fixer, general support. -* Vojtech Pavlik - Author of the i2c-amd8111 bus driver. - Added support for amd8111 SMBus 1.0 controller to i2c-amd756. -* Philip Pokorny - Author of the LM85 chip driver. - Author of the ADM1026 chip driver. -* John Morris - Author of the MAX6650 chip driver. -* Reinhard Nissl - Author of the fscher driver. -* Alexey Fisher - Author of the max1619 chip driver. -* Rudolf Marek - Various fixes and support handling +* Frodo Looijaard + Original author of libsensors, sensors and isadump. +* Merlin Hughes + Original author of sensord. +* Bob Schlaermann + Dynamic chip feature detection (a.k.a. generic chip support) in + libsensors and sensors. +* Mark M. Hoffman + Many improvements to the libsensors configuration file scanner. +* Jean Delvare + New libsensors API, and migration of sensors and sensord thereto. + Many optimizations in libsensors and sensors. + Configuration file converter. From 62705162404e55f5e21ca98fc709342cfa7eac5c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 09:25:07 +0000 Subject: [PATCH 320/718] lm-sensors should now be safe to use on Thinkpad laptops. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4865 7894878c-1315-0410-8ee3-d5d059ff63e0 --- README.thinkpad | 108 ---------------------------------------- doc/FAQ | 18 +++---- doc/lm_sensors-FAQ.html | 30 +++-------- doc/lm_sensors-FAQ.texi | 12 ++--- doc/version.texi | 4 +- 5 files changed, 18 insertions(+), 154 deletions(-) delete mode 100644 README.thinkpad diff --git a/README.thinkpad b/README.thinkpad deleted file mode 100644 index 7ef1b733..00000000 --- a/README.thinkpad +++ /dev/null @@ -1,108 +0,0 @@ - -**** WARNING: IBM Thinkpad users should not install lm_sensors! **** - -The eeprom of some IBM Thinkpads has been corrupted after installing -lm_sensors. - -In our releases through 2.6.4, sensors-detect (our userspace detection script) -corrupts the Atmel 24RF08 eeprom. We have verified this in testing. -After the eeprom is corrupted, the checksum verification in the BIOS -will fail and the Thinkpad will not boot. - -The 24RF08 is an 8K eeprom appearing at addresses 0x54 - 0x57 with -an additional "access protection page" at address 0x5c. -This is an unusual eeprom that contains a RFID (Radio Frequency ID) -port for wireless access, and elaborate access protection mechanisms. -The 24RF08 gets confused (presumably due to a state machine flaw) by -the 'quick write 0' (*) probes our package uses for detection. -This behavior is in violation of the I2C specification. This corruption -mechanism has never been reported to us on any other eeprom, -Atmel or otherwise. - -We made several changes in release 2.6.5 (released September 15, 2002) -to minimize the chance of corruption. -Later evolutions were made and the current state is: - -1) The probing command (quick write 0) has been replaced by a different - command (read byte) for addresses where eeproms are known to live. - This should prevent corruption of 24RF08 eeproms in any system, - IBM or not. A similar change was made to i2cdetect as well, although - no corruption was ever reported using this tool. - -2) The i2c-piix4 module (the bus driver that is used for Intel PIIX4-based - systems, including IBM Thinkpads) now accesses DMI information - in the BIOS to identify the system manufacturer. If the system - manufacturer is IBM, i2c-piix4 will print a message and exit. - As the 24RF08 is on the PIIX4 SMBus, this prevents access to - the 24RF08. - -3) The sequence of probes in the eeprom module (when loaded with - checksum=1) has been changed so that 24RF08 eeproms will - not be corrupted. This *should* prevent corruption of 24RF08 - eeproms in non-IBM systems. - We do not have any reports of this corruption mechanism in releases - 2.6.4 or earlier but have verified that it can happen. - The ddcmon driver was changed in the same way, just in case. - -Even with these changes, we still DO NOT RECOMMEND INSTALLING -lm_sensors 2.6.5 or later on IBM Thinkpads, because: - -1) While these changes will dramatically reduce the chance of 24RF08 - corruption, these changes have not been heavily tested. - -2) lm_sensors won't run on most IBM systems because of these changes. - -3) Most IBM Thinkpads contain a proprietary Embedded Controller which - is used to access sensors. This controller is not on the SMBus, - and IBM will not release the programming interface to the - controller. So lm_sensors isn't useful on these Thinkpads anyway. - -You may want to try ACPI instead, it should let you get some information -about temperatures and fan status. - -As described above, our 2.6.5 release "blacklisted" all IBM systems. -For a moment, we have been planning to refine the system detection -so that only those models containing 24RF08's are blacklisted. After that, -we planned to use a different approach: a "white list" of known-to-be-safe -systems. In both cases, it would require continuous updates of a machines -list. This would have been slow and inefficient. - -The latest idea is to stop using the dangerous command for EEPROM -addresses. That way, risks of corruption are reduced to zero. This was -already done for user-space tools, as mentioned above. Once this will -have been tested and we are sure that there are no drawbacks, we'll -do the same on the kernel side in Linux 2.6. The change won't occur in -Linux 2.4 however, because it implies changes to both i2c modules and -lm_sensors modules. It is possible to use mismatching versions of -these modules, and when doing so, the fix would become more dangerous -than helpful. - -We do not have any reports of 24RF08 eeproms on non-IBM systems. -If there are any such systems with 24RF08 eeproms, these changes will -reduce the chances of corruption. However, there are -theoretical scenarios (involving multiple bus masters, -SMP systems, or simultaneous bus access) in which 24RF08's could -still be corrupted. If you know of any non-IBM systems which contain -these eeproms, please contact us. - - -Thanks to IBM, the Linux Thinkpad Mailing List, and Joe in Australia -for their assistance on this issue. - -For more information, see: - -The Linux Thinkpad Mailing List -http://www.bm-soft.com/~bm/tp_mailing.html - -Joe in Australia's Thinkpad Password Recovery Site -http://www.ja.axxs.net/unlock/ - -Atmel 24RF08 Datasheet -http://www.atmel.com/dyn/products/product_card.asp?part_id=2370 - -Site in the US that sells replacement AT24RF08 chips for all models -http://www.pwcrack.com/ - - -(*) 'Write Quick 0' is not an actual write and should never generate - a write operation to an eeprom location. diff --git a/doc/FAQ b/doc/FAQ index 18be897b..1b98231d 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -104,10 +104,9 @@ lm_sensors 4.31.2 Tyan 2460, 2462 4.31.3 Tyan 2466 4.31.4 Tyan 2688 - 4.32 Problems on particular systems - 4.33 Problems on 2.6 kernels - 4.33.1 i2c-viapro and via686a - 4.33.2 Where are my EEPROMs? + 4.32 Problems on 2.6 kernels + 4.32.1 i2c-viapro and via686a + 4.32.2 Where are my EEPROMs? 5 How to Ask for Help 5.1 What to send us when asking for help 5.2 What to do if a module won't insert? @@ -1201,12 +1200,7 @@ See support tickets 941, 840, and 841 for information. For board hangs, see support ticket 721 for information. Also *Note Inserting modules hangs my board: Section 4.29. -4.32 Problems on particular systems -=================================== - -For IBM systems, see `README.thinkpad'. - -4.33 Problems on 2.6 kernels +4.32 Problems on 2.6 kernels ============================ Not all drivers have been ported to 2.6. If your favorite driver is not @@ -1215,7 +1209,7 @@ not get a proper review yet. If you would like to port the driver, see the file Documentation/i2c/porting-clients in the 2.6 kernel tree for help, then send us the ported driver when you are done. -4.33.1 i2c-viapro and via686a +4.32.1 i2c-viapro and via686a ----------------------------- Until kernel 2.6.11, there was a PCI resource conflict between @@ -1224,7 +1218,7 @@ integrated sensors driver for VIA bridges). This caused the second loaded driver to silently fail working. So do not load both i2c-viapro and via686a together unless you have a recent kernel. -4.33.2 Where are my EEPROMs? +4.32.2 Where are my EEPROMs? ---------------------------- The 2.6.14-rc1 kernel introduced the hwmon class, which groups all diff --git a/doc/lm_sensors-FAQ.html b/doc/lm_sensors-FAQ.html index fc77a032..3ce911ad 100644 --- a/doc/lm_sensors-FAQ.html +++ b/doc/lm_sensors-FAQ.html @@ -164,11 +164,10 @@ Jean Delvare
      • 4.31.3 Tyan 2466
      • 4.31.4 Tyan 2688
      -
    • 4.32 Problems on particular systems -
    • 4.33 Problems on 2.6 kernels +
    • 4.32 Problems on 2.6 kernels
  • 5 How to Ask for Help @@ -903,8 +902,7 @@ Up: Top
  • Section 4.29: Inserting modules hangs my board
  • Section 4.30: Inserting modules slows down my board
  • Section 4.31: Problems on particular motherboards -
  • Section 4.32: Problems on particular systems -
  • Section 4.33: Problems on 2.6 kernels +
  • Section 4.32: Problems on 2.6 kernels
    @@ -1817,26 +1815,12 @@ Also Inserting modules hangs my board.


    -Next: , Previous: Section 4.31, Up: Problems
    -

    4.32 Problems on particular systems

    - -

    For IBM systems, see README.thinkpad. - -

    -


    - - -Previous: Section 4.32, -Up: Problems - -
    - -

    4.33 Problems on 2.6 kernels

    +

    4.32 Problems on 2.6 kernels

    Not all drivers have been ported to 2.6. If your favorite driver is not in 2.6, the reason is that nobody has ported it, or the ported code did @@ -1845,7 +1829,7 @@ If you would like to port the driver, see the file Documentation/i2c/porting-clients in the 2.6 kernel tree for help, then send us the ported driver when you are done. -

    4.33.1 i2c-viapro and via686a

    +

    4.32.1 i2c-viapro and via686a

    Until kernel 2.6.11, there was a PCI resource conflict between i2c-viapro (the SMBus driver for VIA bridges) and via686a (the integrated @@ -1853,7 +1837,7 @@ sensors driver for VIA bridges). This caused the second loaded driver to silently fail working. So do not load both i2c-viapro and via686a together unless you have a recent kernel. -

    4.33.2 Where are my EEPROMs?

    +

    4.32.2 Where are my EEPROMs?

    The 2.6.14-rc1 kernel introduced the hwmon class, which groups all hardware monitoring drivers in a logical way. The goal was to help diff --git a/doc/lm_sensors-FAQ.texi b/doc/lm_sensors-FAQ.texi index 2a9b79ea..e9894f66 100644 --- a/doc/lm_sensors-FAQ.texi +++ b/doc/lm_sensors-FAQ.texi @@ -567,8 +567,7 @@ to work. * Section 4.29:: Inserting modules hangs my board * Section 4.30:: Inserting modules slows down my board * Section 4.31:: Problems on particular motherboards -* Section 4.32:: Problems on particular systems -* Section 4.33:: Problems on 2.6 kernels +* Section 4.32:: Problems on 2.6 kernels @end menu @@ -1240,13 +1239,7 @@ For board hangs, see support ticket 721 for information. Also @ref{Section 4.29, Inserting modules hangs my board}. -@node Section 4.32, Section 4.33, Section 4.31, Problems -@section Problems on particular systems - -For IBM systems, see @file{README.thinkpad}. - - -@node Section 4.33, , Section 4.32, Problems +@node Section 4.32, , Section 4.31, Problems @section Problems on 2.6 kernels Not all drivers have been ported to 2.6. If your favorite driver is not @@ -1586,6 +1579,7 @@ will email you announcement. @appendix Revision History of This Document @itemize +@item Rev 2.19 (JD) Removed 4.32 (Thinkpad-specific issues), 2007-09-24 @item Rev 2.18 (JD) Removed version 1 specifics part, 2005-12-17 @item Rev 2.17 (JD) Added 5.9 (why we don't support undocumented chips), removed 6.9 (doesn't apply to the new mailing list), 2005-10-05 diff --git a/doc/version.texi b/doc/version.texi index f9ae6f78..40ed7bee 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,2 +1,2 @@ -@set UPDATED 17 December 2005 -@set VERSION 2.18 +@set UPDATED 24 September 2007 +@set VERSION 2.19 From 6f29063fdc87d7ce8e977177eddf653a66b9d6dd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 09:27:10 +0000 Subject: [PATCH 321/718] Delete. Most of the items are for kernel drivers, this information no longer belongs there. The rest is hopefully implemented now. Next TODOs will be handled in trac. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4866 7894878c-1315-0410-8ee3-d5d059ff63e0 --- TODO | 102 ----------------------------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 TODO diff --git a/TODO b/TODO deleted file mode 100644 index ad7c2f27..00000000 --- a/TODO +++ /dev/null @@ -1,102 +0,0 @@ -LM-Sensors TODO list -Contact us if you have comments or wish to help. ------------------------------------------------- - -KERNEL MODULES -============== - -* Harmonize 'smart fan' support. - The following drivers support pwm. The ones that support - automatic or smart fan support are identified. - We have a /proc standard for manual PWM support that allows - for /proc based applications like pwmconfig and fancontrol - in our package. - Without a /proc standard for smart fan support such applications - are much more difficult. - - Driver Manual PWM Smart fan - adm1026 standard not supported - asb100 standard ?? - it87 non-std yes - lm85 standard yes - vt1211 doesn't work not supported - w83627hf standard not supported - w83781d standard not supported (791 only) - - The following drivers are for chips that have manual PWM only. - - Driver Manual PWM - mtp008 standard - smsc47m1 standard - vt8231 standard - w83781d (except 791d) standard - -* Assistance on how to fix module refcounting is welcome. - To my understanding, it does not handle client->adapter->owner - correctly now, and it is possible to rmmod adapter while one of its - clients is in use. - -* ACPI and SMBus host - - ACPI subsystem may access SMBus host too. Locks? - - On my ancient board using i2c-via, suspend and power switch status - seems to be in the same register with SCL and SDA. - -* Suspend-to-disk, losing Vcc - - Reset i2c client to avoid alarms and SCI interrupts. Currently - sensors do not create interrupt with alarms. - -* Return from suspend - - Reinitialize i2c client. - -* Handle -1 returns from i2c layer rather than just delivering 0xFF to - /proc and libsensors; report errors through /proc 'alarms' or - new 'fail' entry? See adm1021 for a partial example. - -* ALL: cleanup_module is void; check also that cleaning up is done - properly, now we know that the module will be unloaded whatever we - do. - -* ALL chip drivers: add a readonly insmod option so we don't cause APM/ACPI - to go insane. - -* gl518sm: using iterate==2 causes a tread to be started. this thread remains - even after setting iterate==1 and/or removing the gl518sm module - - -* LM78 detection: Tom Webster has proven that the reset bit in the - id register can be one (strange!) - -* maxilife.c: Introduce new insmod variables - -* maxilife.c: Round REG_TO_VID correctly - -* Support 10-bit addresses. At this moment, they are supported nowhere, except - in Simon Vogl's i2c modules. - -* adm9240: check whether the current voltage computations are correct. - Probably not, as they are different from the datasheet specifications. - Also check for the supported dallas chip. - -* lm80: Check how OS alarms work. At page 17 of the sheet, it tells - something completely different from the description at page 25. - - -LIBRARY -======= - -* Easier use of /proc and libsensors without knowing the chip type - At the moment a programmer wishing to use the lm_sensors package needs to know - what chips are supported and needs to add all those chips into his package. - If you were to add a field or function to your structures to the effect of - sensor-function a programmer could use the package a lot more simply. - For values you could do something like - - enum sensor-type { volt, fan, temp, volt_min, volt_max, fan_div, fan_min, - temp_over, temp_hyst } - -* Some library routines are pretty inefficient right now. - -* Library should be split in more separate files, for better linking - behaviour. - -* Some adm9240 labels start with a digit; change this, it leads to confusing - syntax in the conf file (they have to be quoted) From 55eccd169aef01e453013dc9faea2a5f62c05159 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 09:44:10 +0000 Subject: [PATCH 322/718] Drop references to makefile targets which no longer exist. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4867 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/developers/makefiles | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/doc/developers/makefiles b/doc/developers/makefiles index 59c28fc8..4a4134b4 100644 --- a/doc/developers/makefiles +++ b/doc/developers/makefiles @@ -18,11 +18,6 @@ There are several interesting targets defined through this Makefile: of 'make clean' (without any other targets) will ignore any .d files; this is useful when they are out of date (and prevent the calling of any other target). - * version - Regenerate version.h, using the current date for the date-stamp, and - a user-supplied version number. - * package - Create a .tar.gz file containing everything except the SVN directories. The best way to understand the Module.mk subfiles is to examine one of them, for example lib/Module.mk. They are not too difficult to understand. @@ -47,13 +42,13 @@ Several files are generated by Makefiles: Dependency files for shared libraries. Automatically generated. * .ro Object files for executables. They will be linked together to create - the executable. This extension is used to distinguish them from - modules (which end on .o). Also, using a different extensions makes - the Makefile fragments much simpler. + the executable. * .ao Object files for static libraries * .lo Object files for shared libraries +The reason for using different extensions is to make the Makefile much +simpler. There are lots of comments within the main Makefile. Please read them if you want to know more. From 5d8fa82956f9e6d79fd92e82a3defe4b0934554b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 09:44:48 +0000 Subject: [PATCH 323/718] Minor update. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4868 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/developers/sysfs-interface | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/developers/sysfs-interface b/doc/developers/sysfs-interface index 00196f2e..bd646042 100644 --- a/doc/developers/sysfs-interface +++ b/doc/developers/sysfs-interface @@ -1,9 +1,9 @@ -sysfs access (2.6 kernels) --------------------------- +sysfs access +------------ In the 2.6 kernel, sensor chip drivers create subdirectories in the sysfs filesystem (usually /sys) which can be accessed -directly by applications, or through libsensors as before. +directly by applications, or preferably through libsensors. Naming and content standards for the entries in these subdirectories is documented in the file Documentation/hwmon/sysfs-interface in the From ac2c4eb65bcda5ffbaec27be6cf45568f8524920 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 10:02:35 +0000 Subject: [PATCH 324/718] Move lm_sensors.lsm to doc/developers. Users don't really care. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4870 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lm_sensors.lsm => doc/developers/lm_sensors.lsm | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lm_sensors.lsm => doc/developers/lm_sensors.lsm (100%) diff --git a/lm_sensors.lsm b/doc/developers/lm_sensors.lsm similarity index 100% rename from lm_sensors.lsm rename to doc/developers/lm_sensors.lsm From 01c2d7d0465cf14bf5f7c4576faf5dec1a851325 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 11:22:24 +0000 Subject: [PATCH 325/718] SENSORS_NO_MAPPING is no longer used, delete it. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4871 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/sensors.h b/lib/sensors.h index fad3f367..ae35dbe2 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -120,10 +120,6 @@ const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name #define SENSORS_MODE_W 2 #define SENSORS_COMPUTE_MAPPING 4 -/* This define is used in the mapping field of sensors_subfeature if no - mapping is available */ -#define SENSORS_NO_MAPPING -1 - typedef enum sensors_feature_type { SENSORS_FEATURE_IN = 0x00, SENSORS_FEATURE_FAN = 0x01, @@ -188,10 +184,9 @@ struct sensors_feature { number is the internal subfeature number, used in many functions to refer to this subfeature type is the subfeature type - mapping is either SENSORS_NO_MAPPING if this subfeature is the - main element of category; or it is the number of a subfeature with which - this subfeature is logically grouped (a group could be fan, fan_min - and fan_div) + mapping is the number of a main feature this subfeature belongs to + (for example subfeatures fan1_input, fan1_min, fan1_div and fan1_alarm + are mapped to main feature fan1) flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable), SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the computation rules of the main feature) */ From a6e9ec906374dcc0d98785107c73385dcfcf8d00 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 11:31:37 +0000 Subject: [PATCH 326/718] Strip for version 3. Ultimately the contents of this file should be folded into README. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4872 7894878c-1315-0410-8ee3-d5d059ff63e0 --- BACKGROUND | 67 ++++++++++++------------------------------------------ 1 file changed, 14 insertions(+), 53 deletions(-) diff --git a/BACKGROUND b/BACKGROUND index c757f90b..add629a2 100644 --- a/BACKGROUND +++ b/BACKGROUND @@ -1,58 +1,21 @@ -This package consists of many parts. This document offers a small tour -around the most important pieces. Not all aspects are discussed -exhaustively, but it should be enough to give you the feeling you -understand what you are seeing happen. - When you want to communicate with a piece of hardware, you need a kernel driver (well, that is not quite true, but it is in most cases the only -way to do it safely). In the past, this meant you had to patch the kernel -and recompile it. These days, you can use kernel modules. We support both -approaches. - -We have chooses for a very modular (no pun intended) setup. There are a -few general-purpose base kernel modules, which you always need. In -addition, there is one kernel module for each piece of hardware - whether -this is an I2C bus adapter, an SMBus adapter or a sensors chip. +way to do it safely). The kernel modules communicate their information through the /sys inter- -face. To keep things uncomplicated, the sensor chips always advert their -measurements 'as is'. This means that the values they report are not -immediately relevant to you - they must first be scaled and translated -to correspond to the real world. - -It is also possible to communicate directly with chips on an I2C bus -or SMBus. This is done through /dev files. This is useful if you -quickly want to test how a certain chip behaves, without having to -write a kernel driver. - -Note that all other parts of this package function in so-called user-space. -This is important, because bugs in kernel-space might crash your -computer or do other bad things. And kernel memory can not be swapped out! - -Applications could (and can) directly read the sensor values through the -/sys interface. This is harder than it sounds; because -no two chips are the same, the information they communicate may also -be very unlike. This would mean that every application would have to know -about every type of chip. But there is a better solution. +face. Because every motherboard is different, the sensor chips always +advert the measurements at their pins. This means that the values they +report are not always immediately relevant to you. They have to be +labelled properly, and sometimes they must be scaled to correspond to +the real world. libsensors is a (shared or static) library of access functions. It -knows about every type of chip supported by the kernel modules (or it -should, if it is up-to-date). It offers a simple-to-use interface for -applications to access the sensor chip readings, to set new limits, -and all other commonly needed things. From the application's point of -view, there is no need to know very much about a specific sensors chip. -Having some inside information can still be useful, but it is possible to -write a generic fall-back function that takes care of newer, unknown -chips, and to display all really important information. - -libsensors takes care of one other thing. The kernel modules report -so-called 'as is' values. They have to be scaled or translated to be -relevant in the real world. libsensors reads a configuration file -(usually /etc/sensors.conf) which specifies how this translation should -be done (with some other things). Again, the application does not have -to know about it. And because the configuration file is reread each time -a new application is started, you can change configuration values without -having to recompile anything. +offers a simple-to-use interface for applications to access the sensor +chip readings, to set new limits, and all other commonly needed things. +It has a configuration file where you can put all the +motherboard-specific labels and conversion rules. That way, all +applications do not need to duplicate the effort and can simply link +with libsensors and work out of the box. This package does not contain a nice graphical monitor. Look at the file doc/useful_addresses.html for pointers to such programs. It does contain @@ -60,10 +23,8 @@ an example console program that reports all current sensors values. This program is called 'sensors'. You can use it as a reference implementation for more intricate programs. -There are many, many kernel modules in this package, and there are lots +The Linux 2.6 kernel has many, many sensor drivers, and there are lots of different sensor chips supported. Sometimes, it can be hard to determine what chips and adapters you have, and which modules correspond to them. Fortunately, there is a user-space application 'sensors-detect' -that should tell you exactly what is available, and what you need to -do. This perl script uses the /dev interface, and you may use it as an -example how you can do this. +that should tell you exactly what is available, and what you need to do. From 08bcb3a5ce470b557aa3fd931b0fc196e5f2e6a1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 12:02:36 +0000 Subject: [PATCH 327/718] Update README for version 3. Delete the list of supported chips (it depends on the kernel version only). Drop references to I2C and SMBus. Fold README.directories into README. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4873 7894878c-1315-0410-8ee3-d5d059ff63e0 --- README | 150 +++++++++++++-------------------------------- README.directories | 14 ----- 2 files changed, 42 insertions(+), 122 deletions(-) delete mode 100644 README.directories diff --git a/README b/README index a8f04411..cd719f95 100644 --- a/README +++ b/README @@ -1,127 +1,66 @@ -============================================================================= +OVERVIEW OF THE LM-SENSORS PACKAGE +================================== - FOR QUICK INSTALLATION INSTRUCTIONS SEE THE 'QUICKSTART' FILE. - FOR FULL INSTALLATION INSTRUCTIONS SEE THE 'INSTALL' FILE. - FOR THE FAQ SEE THE 'doc/FAQ' or 'doc/lm_sensors-FAQ.html' FILES. +The lm-sensors package, version 3, provides user-space support for the +hardware monitoring drivers in Linux 2.6.5 and later. For older kernel +versions, you have to use lm-sensors version 2. -============================================================================= +The directories within this package: -OVERVIEW OF THE LM_SENSORS PACKAGE AND SUMMARY OF SUPPORTED DEVICES - -!!! This package is ONLY for 2.6 and 2.4 kernels (2.4.10 or later). !!! -!!! For 2.4 kernels, this package requires i2c-2.9.0 or later. !!! - -FOR 2.6 KERNELS, use only the userspace tools in this package! -Build and install them with 'make user' and 'make user_install'. -The kernel modules in this package will NOT compile for 2.6; -use the drivers already in the 2.6 kernel. Check the QUICKSTART -file for brief installation instructions please. - -============================================================================= - -This is the completely rewritten version 2 of lm_sensors, a collection of -modules for general SMBus[1] access and hardware monitoring. -Version 1 is now officially unsupported. - -WARNING! The drivers in this package will work on reasonably recent 2.4 -kernels only (2.4.10 and later). -Use lm_sensors-2.4.5 for 2.0 kernels. -Use lm_sensors-2.7.0 for 2.2, and early 2.4 (up to 2.4.9) kernels. -Use the drivers already in the kernel for 2.6 kernels; if you need -additional drivers in 2.6 please port and submit them to us. - -HOWEVER, the userspace tools in this package will work for -both 2.4 and 2.6 kernels. - -The I2C[2] package in existing 2.4 kernels is NOT sufficient -for compilation of this package. You need i2c-2.9.0 or later. - -See the lm_sensors download page for further guidance: - http://www.lm-sensors.org/wiki/Download +* doc + Documentation. +* etc + A sample configuration file for libsensors, and a script to convert + lm-sensors version 2 configuration files to work with version 3. +* lib + The user-space sensors support library code (libsensors). +* prog + Several supporting programs. The most important ones are: + - sensors-detect: A program for detecting installed hardware and + recommending specific modules to load. + - sensors: A console tool to report sensor readings and set new + sensor limits. + - sensord: A daemon to watch sensor values and log problems. It + includes RRD support. -============================================================================= +INSTALLING LM-SENSORS +--------------------- -At least the following hardware sensor chips are supported: - Analog Devices ADM1021, ADM1021A, ADM1022, ADM1023, ADM1024, - ADM1025, ADM1026, ADM1027, ADM1030, ADM1031, - ADM1032, ADM9240, ADT7461 and ADT7463 - Asus AS99127F, ASB100 Bach - Dallas Semiconductor DS75, DS1621, DS1625, DS1775, and DS1780 - Hewlett Packard Maxilife (several revisions including '99 NBA) - Fintek F71805F/FG - Fujitsu Siemens Poseidon, Scylla, Hermes - Genesys Logic GL518SM, GL520SM, GL523SM - Intel Xeon processor embedded sensors - ITE IT8705F, IT8712F - Maxim MAX1617, MAX1617A, MAX1619, MAX6650, MAX6651, - MAX6633, MAX6634, MAX6635, MAX6657, MAX6658, MAX6659 - Microchip TC1068, TCM1617, TCN75 - Myson MTP008 - National Semiconductor LM63, LM75, LM76, LM78, LM78-J, LM79, - LM80, LM81, LM82, LM83, LM84, LM85, LM86, LM87, - LM89, LM90, LM92, LM93, LM99, PC87360, - PC87363, PC87364, PC87365, PC87366 - Philips NE1617, NE1617A, NE1619, PCF8591 - SiS 5595, 950 embedded sensors - SMSC 47M1xx embedded sensors, EMC6D100, EMC6D101, EMC6D102 - TI THMC10 and THMC50 - VIA Technologies VT1211, VT8231 and VT82C686A/B embedded sensors - Winbond W83781D, W83782D, W83783S, W83791D, W83792D, - W83627HF, W83627THF, W83637HF, W83687THF and W83697HF - Smart Battery sensors - IPMI-BMC sensors +See the INSTALL file. -The list above may be out of date; -see our Devices page at http://www.lm-sensors.org/wiki/Devices -for the latest information on supported devices. -You may also refer to doc/chips/SUMMARY for details on what each chip -can monitor. - - -We always appreciate testers. If you own a specific monitoring chip we do -not yet (properly) support, and are willing to help us out, please contact -us. Even if you have no programming knowledge, you could help us by running -new modules and reporting on the results and output. If you want to offer -more substantial help, this is very welcome too, of course. - - -Don't ask us whether we support a particular mainboard; we do not know. -We *do* know what hardware we support, but usually, it is easier to -install everything and run sensors-detect. It will tell you what hardware -you have (and incidentally, what corresponding drivers are needed). - - -SMBus, also known as System Management Bus, is a protocol for communicating -through a I2C ('I squared C') bus. Many modern mainboards have a System -Management Bus. There are a lot of devices which can be connected to a -SMBus; the most notable are modern memory chips with EEPROM memories and -chips for hardware monitoring. +HARDWARE SUPPORT +---------------- Most modern mainboards incorporate some form of hardware monitoring chips. These chips read things like chip temperatures, fan rotation speeds and voltage levels. There are quite a few different chips which can be used by mainboard builders for approximately the same results. -Hardware monitoring chips often have an SMBus or I2C interface. Some are -connected to ISA bus instead. Some of them can do both, in which case we -either support both access methods (old drivers) or only support ISA -access (new drivers) as it is faster. +Laptops, on the other hand, rarely expose any hardware monitoring +chip. They often have some BIOS and/or ACPI magic to get the CPU +temperature value, but that's about it. For such laptops, the lm-sensors +package is of no use (sensors-detect will not find anything), and you have +to use acpi instead. -Because the SMBus is just a special case of the generalized I2C bus, we can -simulate the SMBus protocol on plain I2C busses. These busses are sometimes -used in other parts of your computer. If a supported chip is attached to -one of these additional busses, they can be used too. +This package doesn't contain chip-specific knowledge. It will support all +the hardware monitoring chips your kernel has drivers for. In other words, +if you find out that you have unsupported hardware (e.g. sensors-detect +told you so) then it means that you need a more recent kernel, or you +even need to wait for a new kernel driver to be written. Updating the +lm-sensors package itself will not help. -Please read INSTALL before trying to compile and install these modules. -There is a lot of additional documentation in the doc/ subdirectory. + +OTHER INFORMATION +----------------- The developers of this package can be reached through a mailing-list (see http://www.lm-sensors.org/wiki/AuthorsAndContributors). Do not hesitate to mail us if you have questions, suggestions, problems, want to contribute, or just want to report it works for you. But please try to -read the documentation and FAQ before you ask any questions! +read the documentation and FAQ before you ask any questions! It's all +under doc/. The latest version of this package can always be found at: http://www.lm-sensors.org/wiki/Download. Pre-release versions can be @@ -134,8 +73,3 @@ Note that libsensors falls under the GPL, not the LGPL. In more human language, that means it is FORBIDDEN to link any application to the library, even to the shared version, if the application itself does not fall under the GPL. - - ------ -[1] SMBus is a trademark of Intel Corporation -[2] I2C is a trademark of Philips Corporation diff --git a/README.directories b/README.directories deleted file mode 100644 index efc5c8da..00000000 --- a/README.directories +++ /dev/null @@ -1,14 +0,0 @@ -The directories within this package: - -* doc - Documentation. -* etc - A sample configuration file for libsensors. -* lib - The user-space sensors support library code (libsensors). -* prog - Several supporting programs. Includes programs for detecting installed - hardware and recommending specific modules to install. - Also includes programs to report sensor readings, for use - after the package has been installed. - Some of these use the sensors support library, some do not. From 05d54754529ff54c64c30965b3e11a02a28f2355 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 12:13:29 +0000 Subject: [PATCH 328/718] Fold BACKGROUND into README. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4874 7894878c-1315-0410-8ee3-d5d059ff63e0 --- BACKGROUND | 30 ------------------------------ README | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 30 deletions(-) delete mode 100644 BACKGROUND diff --git a/BACKGROUND b/BACKGROUND deleted file mode 100644 index add629a2..00000000 --- a/BACKGROUND +++ /dev/null @@ -1,30 +0,0 @@ -When you want to communicate with a piece of hardware, you need a kernel -driver (well, that is not quite true, but it is in most cases the only -way to do it safely). - -The kernel modules communicate their information through the /sys inter- -face. Because every motherboard is different, the sensor chips always -advert the measurements at their pins. This means that the values they -report are not always immediately relevant to you. They have to be -labelled properly, and sometimes they must be scaled to correspond to -the real world. - -libsensors is a (shared or static) library of access functions. It -offers a simple-to-use interface for applications to access the sensor -chip readings, to set new limits, and all other commonly needed things. -It has a configuration file where you can put all the -motherboard-specific labels and conversion rules. That way, all -applications do not need to duplicate the effort and can simply link -with libsensors and work out of the box. - -This package does not contain a nice graphical monitor. Look at the file -doc/useful_addresses.html for pointers to such programs. It does contain -an example console program that reports all current sensors values. This -program is called 'sensors'. You can use it as a reference implementation -for more intricate programs. - -The Linux 2.6 kernel has many, many sensor drivers, and there are lots -of different sensor chips supported. Sometimes, it can be hard to -determine what chips and adapters you have, and which modules correspond -to them. Fortunately, there is a user-space application 'sensors-detect' -that should tell you exactly what is available, and what you need to do. diff --git a/README b/README index cd719f95..16e91340 100644 --- a/README +++ b/README @@ -33,6 +33,8 @@ See the INSTALL file. HARDWARE SUPPORT ---------------- +To find out what hardware you have, just run 'sensors-detect' as root. + Most modern mainboards incorporate some form of hardware monitoring chips. These chips read things like chip temperatures, fan rotation speeds and voltage levels. There are quite a few different chips which can be used by @@ -52,6 +54,36 @@ even need to wait for a new kernel driver to be written. Updating the lm-sensors package itself will not help. +LIBSENSORS +---------- + +The kernel drivers communicate their information through the /sys +interface. Because every motherboard is different, the drivers always +advert the measurements at their pins. This means that the values they +report are not always immediately relevant to you. They have to be +labelled properly, and sometimes they must be scaled to correspond to +real-world values. + +libsensors is a (shared or static) library of access functions. It +offers a simple-to-use interface for applications to access the sensor +chip readings and configure them as you like. It has a configuration +file where you can put all the motherboard-specific labels and +conversion rules. That way, all applications do not need to duplicate +the effort and can simply link with libsensors and work out of the box. + + +APPLICATIONS +------------ + +This package does not contain a nice graphical monitor. Look at the file +doc/useful_addresses.html for pointers to such programs. It does contain +an example console program that reports all current sensors values. This +program is called 'sensors'. You can use it as a reference implementation +for more intricate programs. It also contains a daemon watching for +sensor values, logging alarms and feeding an RRD database with the sensor +measurements. + + OTHER INFORMATION ----------------- From 59d4afd8e1df006dbff014c15851399b82ac6ffa Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 13:03:38 +0000 Subject: [PATCH 329/718] Update for version 3. List the build-time and run-time dependencies. Drop all the instructions regarding kernel modules compilation. Drop documentation about Makefile variables, they are already documented in the Makefile itself. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4875 7894878c-1315-0410-8ee3-d5d059ff63e0 --- INSTALL | 175 ++++++++++---------------------------------------------- 1 file changed, 30 insertions(+), 145 deletions(-) diff --git a/INSTALL b/INSTALL index ab11952f..0a8252fe 100644 --- a/INSTALL +++ b/INSTALL @@ -1,166 +1,51 @@ -============================================================================= +INSTALLATION INSTRUCTIONS +========================= -DETAILED INSTALLATION INSTRUCTIONS -See QUICKSTART for the simple version. - -The driver modules in this package are ONLY for 2.4 kernels 2.4.10 or later! - -This package REQUIRES i2c-2.9.0 or later! The i2c subsystem found in the -Linux 2.4 kernel trees, even the latest ones, is outdated and won't work. - -FOR 2.5/2.6 KERNELS, do not attempt to compile the modules in this package. - Use the drivers already in the 2.5/2.6 kernel tree. - If you are running a 2.5/2.6 kernel, the ONLY thing you need to - do is 'make user' and 'make user_install'. Do NOT follow the rest - of these instructions. Please check the QUICKSTART instead. +The lm-sensors package, version 3, provides user-space support for the +hardware monitoring drivers in Linux 2.6.5 and later. For older kernel +versions, you have to use lm-sensors version 2. -============================================================================= -These are the installation instruction for the lm_sensors package. +Dependencies +============ -NOTE: MAKE SURE YOU HAVE THE I2C-ALGO-BIT DRIVER (PART OF THE I2C PACKAGE) - COMPILED INTO YOUR KERNEL OR AVAILABLE AS A MODULE; SOME I2C/SMBUS - MASTER DRIVERS DEPEND ON IT! +Build-time dependencies: +* GNU make +* gcc +* bison +* flex +* libsysfs header files (from sysfsutils-devel) +* rrd header files (optional, for sensord) -NOTE: YOU WILL HAVE TO GET AND INSTALL THE I2C PACKAGE FIRST! - -NOTE: PLEASE READ THE DOCUMENTATION IN THE DOC SUBDIRECTORY IF YOU GET STUCK! - - -Installing the i2c package -========================== - -This lm_sensors release REQUIRES i2c-2.9.0 or later, which is not in -any 2.4 kernel (and will never be). -Therefore, you must download and install the i2c package with -the same version number or higher as this lm_sensors package. - -You -will have to make very sure the correct i2c header files are found. If you -get weird compilation errors, this is almost certainly going wrong. The -i2c header files are in a i2c subdirectory of either /usr/local/include -(i2c compilation option 1) or /usr/src/linux*/include (i2c compilation -options 2 and 3). Especially if you have in the past placed the header -files in /usr/local/include, this will probably go wrong. See below on -how to fix this. - - -Mixing old and new, and using beta drivers -========================================== - -It is possible that you are running a previously patched kernel, or -a very new kernel which already has limited or full i2c or lm_sensors -support, but you want to use newer versions of the drivers. This is -possible, but there are some pitfalls. - -If you had compiled all i2c and lm_sensors drivers as modules, you are -in luck. You can simply compile the newest versions of i2c and -lm_sensors and install them. Just make sure the right modules are -loaded (best bet: remove the old ones first). - -If you have a certain driver compiled into your kernel, you may -encounter bad problems. We do not guarantee to keep internal kernel -interfaces unchanged. In plain language, this means that an older driver -may not work together with a newer driver, and your kernel may crash. -On the other hand, if you know what you are doing, compilation will -be smart. Drivers that are compiled right into your kernel will not -be compiled as a module again. You could do nothing with them anyway. - - -Having a proper kernel tree -=========================== - -Usually, if you compile a user-space application, you can get away with -having a different version of the kernel running than the version of the -kernel header files against which you compiled it. But a perfect match -is needed here. - -Let's say you want to use the lm_sensors modules with the kernel 2.4.32 you -are running now. What you need, is the original tree in which you -compiled that 2.4.32 kernel. A freshly unpacked 2.4.32 kernel will not -cut it, because `make *config dep' creates some files that are needed. -And even then, you will run into trouble, because you may not have -selected the exact same configuration variables. Plain advise: if you -do not have your original kernel tree anymore, recompile your kernel -first. - -Note that there is no need for a perfect match at compilation time, just -at run-time. This means you can cross-compile against a different kernel -version, and the Makefile does not check for this. - -Usually problems if the match is imperfect, is that either this package -won't compile at all (because it was a freshly unpacked tree without -some files generated by `make *config dep'), or that you can't insert -modules because of either a `kernel-module version mismatch' or because -of `unresolved kernel symbols'. If you get either of these messages, -check your kernel tree! - -To keep problems to a minimum, please use a 'vanilla' kernel tree, -as distributed on ftp://ftp.kernel/org/pub/linux/kernel, and not one -patched by your distribution. +Run-time dependencies: +* libsysfs (from sysfsutils) +* perl (for sensors-detect) +* rrd (optional, for sensord) Compilation =========== -This will compile and install the complete lm_sensors package. At the -top of the Makefile are a couple of configuration variables that you may -want to change. A list is found below. +At the top of the Makefile are a couple of configuration variables that +you may want to change. There's a description of what each variable does +in the Makefile itself. -Compilation is done by `make all'; `make install' installs the package. -You will get a lot of warnings about files which are not found, all -ending on `.*d'. You can safely ignore this; they contain dependency -information, which is regenerated on the spot. +Compilation is done by `make all'. You will get a lot of warnings about +files which are not found, all ending in `.*d'. You can safely ignore +this; they contain dependency information, which is regenerated on the +spot. -Please continue reading this file before you start compiling. - - -Makefile configuration variables -================================ - -SHELL (default: /bin/sh) - You may have to specify the full path to Bash here, if /bin/sh is some - other shell. There have been conflicting reports on whether this is - needed. -WARN (default: 0) - Generate additional compilation warnings; mainly interesting for - developers. -DEBUG (default: 0) - Some drivers will issue more debug information if you set this to - 1. Don't do it, unless you are a developer or are instructed to do - so by the lm_sensors team. -PREFIX (default: /usr/local) - Prefix for almost all installation directories. -ETCDIR (default: /etc) - Installation location of the sensors.conf configuration file. -LIBDIR (default: $(PREFIX)/lib) - Installation location of all static and shared libraries. -BINDIR (default: $(PREFIX)/bin) - Installation directory of programs useful for users. -SBINDIR (default: $(PREFIX)/sbin) - Installation directory of system administrator-only programs. -INCLUDEDIR (default: $(PREFIX)/include) - Base installation directory for include files (see next two vars). -LIBINCLUDEDIR (default: $(INCLUDEDIR)/sensors) - Installation directory for libsensors include files. -MANDIR (default: $(PREFIX)/man) - Base installation directory for manual pages. +`make install' installs the package (to /usr/local by default). Using the sensors package ========================= -You can now load the modules by using `modprobe'. For example, -`modprobe i2c-piix4' will load the i2c-piix4 module, and all i2c modules -on which it depends. - -You can not use demand-loading; you will have to issue explicit modprobe -instructions. - There is a scanning program installed called sensors-detect. It -will scan all available I2C and SMBus adapters for all known devices, -and will also look for ISA, PCI and Super-I/O chips with sensors, -and give you a list of what modules you need to insert. +will scan all available I2C and SMBus adapters for all known sensor +devices, and will also look for ISA, PCI and Super-I/O chips with +sensors, and give you a list of what kernel drivers you need to load +(using modprobe). You can use the installed sensors program to get a report of all detected sensor devices. There is also a manual page for this program. Calling From bc0cfc7a32f082cd0b1f12cdd3cb36d29f6d1dad Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 13:30:38 +0000 Subject: [PATCH 330/718] Fold QUICKSTART into INSTALL. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4876 7894878c-1315-0410-8ee3-d5d059ff63e0 --- INSTALL | 38 +++++++++++++++++++++++++++++++++----- QUICKSTART | 25 ------------------------- 2 files changed, 33 insertions(+), 30 deletions(-) delete mode 100644 QUICKSTART diff --git a/INSTALL b/INSTALL index 0a8252fe..e8ead18c 100644 --- a/INSTALL +++ b/INSTALL @@ -21,6 +21,7 @@ Run-time dependencies: * libsysfs (from sysfsutils) * perl (for sensors-detect) * rrd (optional, for sensord) +* proper kernel configuration (see below) Compilation @@ -38,6 +39,24 @@ spot. `make install' installs the package (to /usr/local by default). +Kernel configuration +==================== + +This package assumes that you have a properly configured kernel. If +you run a distribution kernel, that should be the case. If you're +building your own kernel, here are some recommendations: +* Enable "I2C support" (CONFIG_I2C=y or m). On many motherboards, the + sensor chip is connected to the SMBus, which is supported by I2C + in the Linux kernel. +* Enable "I2C device interface" (CONFIG_I2C_CHARDEV=m). sensors-detect + needs this to probe for SMBus hardware monitoring chips. +* In I2C Hardware Bus support, enable all drivers you might need, + preferably as modules. If you're not sure, select them all. +* Enable "Hardware Monitoring support" (CONFIG_HWMON=y or m). +* Enable all hardware monitoring drivers you might need, preferably + as modules. If you're not sure, select them all. + + Using the sensors package ========================= @@ -47,11 +66,20 @@ devices, and will also look for ISA, PCI and Super-I/O chips with sensors, and give you a list of what kernel drivers you need to load (using modprobe). -You can use the installed sensors program to get a report of all detected -sensor devices. There is also a manual page for this program. Calling -`sensors -s' will set the limits and other configuration settings -specified in /etc/sensors.conf. Again, read the manual pages for more -information. +After loading the suggested drivers, you can use the installed sensors +program to get a report of all detected sensor devices. Chek the manual +page for available options. + +The initial output of `sensors' will not be perfect. You have to adjust +the configuration file (/etc/sensors.conf) to match your motherboard. +This includes (re)labelling inputs, ignoring unused inputs, changing +voltage compute lines and setting limits. Write down all the sensor +information your BIOS displays as a hint to what you are supposed to +obtain in the end. Make sure you modify the right chip section. + +Once you are done with editing the configuration file, calling +`sensors -s' will set the new limits. Then the output of `sensors' +should look much better. There are many auxiliary programs not installed. You can find them under the prog subdirectory. A list can be found in doc/progs. diff --git a/QUICKSTART b/QUICKSTART deleted file mode 100644 index 092fc3eb..00000000 --- a/QUICKSTART +++ /dev/null @@ -1,25 +0,0 @@ -LM_SENSORS QUICK INSTALLATION INSTRUCTIONS ------------------------------------------- - -The instructions in this document will generally work if you have a standard -system, but not always!! - -Quickstart for Kernel 2.6 -------------------------- - -0) Just compile and install lm-sensors userspace tools. You can do that with: - 'make ; make install' -1) Make sure your kernel has support for all I2C bus drivers and - 'i2c device interface'. If you are using a distribution kernel, all is - already prepared, you don't need to recompile it. -2) Run 'sensors-detect' command, it will tell you what modules you need to load. -3) Load them and run 'sensors' command, you should see some results. -4) Find right section in /etc/sensors.conf, fix labels, limits, fan divisors -5) Run 'sensors -s' to apply the changes. - -You may also try our installation wizard at: - -http://www.lm-sensors.org/wiki/iwizard/1 - -We are aware that the documentation could be improved, please contact us if -you want to help us with that. From d4c69b1468b9ece5ffd0e0e71eaaae354484312d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 14:02:01 +0000 Subject: [PATCH 331/718] bash should no longer be needed at build time. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4877 7894878c-1315-0410-8ee3-d5d059ff63e0 --- Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 36229b94..c49fe9a2 100644 --- a/Makefile +++ b/Makefile @@ -19,14 +19,9 @@ # can just use the defaults, fortunately. # You need a full complement of GNU utilities to run this Makefile -# successfully; most notably, you need bash, GNU make, flex (>= 2.5.1) +# successfully; most notably, you need GNU make, flex (>= 2.5.1) # and bison. -# If your /bin/sh is not bash, change the below definition so that make can -# find bash. Or you can hope your sh-like shell understands all scripts. -# I think so, but I have not tested it. -#SHELL := /usr/bin/bash - # Uncomment the second line if you are a developer. This will enable many # additional warnings at compile-time #WARN := 0 From 38d16d299dc05ef3e9e76fac6d1066f54232d17a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 15:22:01 +0000 Subject: [PATCH 332/718] Add support for platform devices with no ID. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4878 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sysfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index a4655120..2e5f3d52 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -404,8 +404,12 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev) entry.chip.addr = (domain << 16) + (bus << 8) + (slot << 3) + fn; entry.chip.bus.type = SENSORS_BUS_TYPE_PCI; entry.chip.bus.nr = 0; - } else - goto exit_free; + } else { + /* platform device with no id? */ + entry.chip.bus.type = SENSORS_BUS_TYPE_ISA; + entry.chip.bus.nr = 0; + entry.chip.addr = 0; + } if (sensors_read_dynamic_chip(&entry, dev) < 0) goto exit_free; From 6c229f7a3c35649fa0432d582282ca2c95c754b6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 24 Sep 2007 16:34:56 +0000 Subject: [PATCH 333/718] Drop SENSORS_ERR_NO_DEVS: we return success, not error, when no device is found. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4879 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/error.c | 3 +-- lib/error.h | 3 +-- lib/sysfs.c | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/error.c b/lib/error.c index ab104e96..cf3fa9a7 100644 --- a/lib/error.c +++ b/lib/error.c @@ -35,14 +35,13 @@ static const char *errorlist[] = { /* Invalid error code */ NULL, /* SENSORS_ERR_WILDCARDS */ "Wildcard found in chip name", /* SENSORS_ERR_NO_ENTRY */ "No such subfeature known", - /* SENSORS_ERR_NO_DEVS */ "No devices found", + /* SENSORS_ERR_ACCESS_R */ "Can't read", /* SENSORS_ERR_KERNEL */ "Kernel interface error", /* SENSORS_ERR_DIV_ZERO */ "Divide by zero", /* SENSORS_ERR_CHIP_NAME */ "Can't parse chip name", /* SENSORS_ERR_BUS_NAME */ "Can't parse bus name", /* SENSORS_ERR_PARSE */ "General parse error", /* SENSORS_ERR_ACCESS_W */ "Can't write", - /* SENSORS_ERR_ACCESS_R */ "Can't read", }; const char *sensors_strerror(int errnum) diff --git a/lib/error.h b/lib/error.h index e9be52fb..66dd1294 100644 --- a/lib/error.h +++ b/lib/error.h @@ -23,14 +23,13 @@ #define SENSORS_ERR_WILDCARDS 1 /* Wildcard found in chip name */ #define SENSORS_ERR_NO_ENTRY 2 /* No such subfeature known */ -#define SENSORS_ERR_NO_DEVS 3 /* No devices found */ +#define SENSORS_ERR_ACCESS_R 3 /* Can't read */ #define SENSORS_ERR_KERNEL 4 /* Kernel interface error */ #define SENSORS_ERR_DIV_ZERO 5 /* Divide by zero */ #define SENSORS_ERR_CHIP_NAME 6 /* Can't parse chip name */ #define SENSORS_ERR_BUS_NAME 7 /* Can't parse bus name */ #define SENSORS_ERR_PARSE 8 /* General parse error */ #define SENSORS_ERR_ACCESS_W 9 /* Can't write */ -#define SENSORS_ERR_ACCESS_R 10 /* Can't read */ #ifdef __cplusplus extern "C" { diff --git a/lib/sysfs.c b/lib/sysfs.c index 2e5f3d52..8317a932 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -437,13 +437,13 @@ static int sensors_read_sysfs_chips_compat(void) if (!(bus = sysfs_open_bus("i2c"))) { if (errno && errno != ENOENT) - ret = -SENSORS_ERR_NO_DEVS; + ret = -SENSORS_ERR_KERNEL; goto exit0; } if (!(devs = sysfs_get_bus_devices(bus))) { if (errno && errno != ENOENT) - ret = -SENSORS_ERR_NO_DEVS; + ret = -SENSORS_ERR_KERNEL; goto exit1; } @@ -474,14 +474,14 @@ int sensors_read_sysfs_chips(void) if (!(clsdevs = sysfs_get_class_devices(cls))) { if (errno && errno != ENOENT) - ret = -SENSORS_ERR_NO_DEVS; + ret = -SENSORS_ERR_KERNEL; goto exit; } dlist_for_each_data(clsdevs, clsdev, struct sysfs_class_device) { struct sysfs_device *dev; if (!(dev = sysfs_get_classdev_device(clsdev))) { - ret = -SENSORS_ERR_NO_DEVS; + ret = -SENSORS_ERR_KERNEL; goto exit; } if ((ret = sensors_read_one_sysfs_chip(dev))) From b43ea0e83736f7eb710b7e956b2aa6650533f8a7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 25 Sep 2007 16:09:57 +0000 Subject: [PATCH 334/718] Reset the list of changes for 3.0.0-rc1. So many things changed since 2.10.x that there's little point in keeping the old history around. Anyone really interested will have to download a 2.10.x release and look there (or in SVN.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4881 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1683 +------------------------------------------------------ 1 file changed, 2 insertions(+), 1681 deletions(-) diff --git a/CHANGES b/CHANGES index d62c45fa..59386a18 100644 --- a/CHANGES +++ b/CHANGES @@ -1,1684 +1,5 @@ -lm_sensors CHANGES file +lm-sensors CHANGES file ----------------------- -SVN HEAD - File BUGS: Delete - File i2c-dev.h: Support I2C block reads with specified length - All bus modules and documentation: Delete - All chip modules and documentation: Delete - Legacy hotplug modules and documentation: Delete - File doc/version-2: Delete, obsolete - File sensors.conf.eg: Add a dme1737 section - Add a thmc50 section - File lm_sensors.sysconfig: Delete, now generated by sensors-detect - File README.patches: Delete, obsolete - Library: Clean up pwm symbol names translation - Always build with sysfs support - Delete procfs and sysctl support (Linux 2.4) - Delete all remnants of algorithm names - Drop all the chip-specific support - Fix a memory leak on error - Speed up sensors_get_ignored() a bit - No longer export sensors_chip_name_has_wildcards() - Delete sensors_do_all_sets(), unused - Pass structures by reference - Drop support for dummy type - New function sensors_snprintf_chip_name() - Drop support for dashes in chip names - Add support for devices on SPI adapters - Makefile: Drop the package and version targets - Man pages: Drop "conforming to" sections - Man page sensors.conf.5: Update the chip statement section - Program config/grab_busses.sh: Delete, obsolete - Programs doc/*: Delete, obsolete - Program etc/sensors-conf-convert: New - Programs i2cdump, i2cget, i2cset: Do not force the slave address by default - Program i2cdump: Use the new I2C block read function - Program isadump: Detect when address bit 7 is a busy flag - Fix Super-I/O exit sequence for Winbond/Fintek chips - Program matorb/displayit: Delete, obsolete - Program mkdev.sh: Delete, obsolete - Program mkpatch: Delete - Program fancontrol: Use let for arithmetic evaluation - No longer need awk and grep - Limit calls to external programs (Linux 2.6 only) - Check for configuration file validity - Support optional min and max PWM values - Better integration with init scripts - Use linear control instead of quadratic - Program fancontrol.pl: Delete, redundant - Program pwmconfig: Use smaller steps for low PWM values - Support optional min and max PWM values - Program rrd: Support only hwmon class devices - Look for rrd in /usr/bin by default - Add missing shell declarations - Update URI - Program sensord: Syncronize the version with lm-sensors - Drop all the chip-specific support - Fix a memory leak when daemonizing - Fix memory leaks in command line parsing - Program sensors: Drop all the chip-specific support - Fix alignment of alarm for one-limit temperatures - Drop option -U - Fix a memory leak on error (with -u) - New option --bus-list - Program sensors-detect: Stop Super-I/O probe after first family success - Fix SMSC DME1737 detection - Add /usr/sbin to the PATH (#2199) - Add ATI SB700 detection - Add Maxim MAX6680/MAX6681 detection - Add IT8726F detection - Fix IPMI support for 2.6 kernels - Add detection for non-standard SMSC Super-I/Os - No longer depend on i2cdetect - Add SMSC SCH5317 detection - Drop detection of most non-sensors I2C chips - Fix ADM1022 detection - Add detection of many SMSC Super-I/O chips - Add Fintek F71806FG and F71862FG detection - Add Winbond W83L786NR/NG/R/G detection - Add Winbond W83L771W/G detection - Add Intel Tolapai SMBus detection - - -2.10.3 (20070319) - Library: Do not skip i2c adapters with only a class device and no - physical device. This change is required to survive the - planned struct class_dev removal from future 2.6 kernels. - Add support for the SMSC LPC47M292 fans (prefix smsc47m2) - Recognize i2c-isa-based devices as such even after class_dev - is gone - Compile with -D_REENTRANT - Fix support of Linux 2.6's max6650 driver - Fix max1619 support - Man page i2cdetect.8: Scanning range can be restricted - Module bmcsensors: Fix debugging messages - Module i2c-ali1563: Improve the status messages (2.6 backport) - Fix device initialization (2.6 backport) - Module i2c-amd8111: Cleanups (2.6 backport) - Fix initialization race (2.6 backport) - Module i2c-nforce2: Drop unused reference to pci_dev (2.6 backport) - Module i2c-piix4: Add ATI SB600 support (2.6 backport) - Module i2c-viapro: Add CX700 support (2.6 backport) - Module smsc47m1: Add SMSC LPC47M292 support - Get rid of a useless semaphore (2.6 backport) - Programs i2cdetect, i2cdump, isadump: Flush output in real time - Program i2cdump: Cleaner output in SMBus block read mode - Program fancontrol.pl: Fix pwmN_enable access (#2190) - Program sensors: Add smsc47m2 support (fans) - Fix -A option (hide adapter name) on error - Program sensors-detect: Only probe relevant I2C addresses - Drop ARP-capable device detection - Add Maxim MAX6655/MAX6656 detection - (Olexiy Avramchenko) - Add Maxim MAX1668, MAX1805, MAX1989 detection - Add VIA CX700 detection - Drop legacy W83627HF ISA detection - Don't bufferize stdout during probes - Speed up the LM75 and LM77 detection - Clean up the EEPROM detection - Add Dallas DS75 detection - Add SMSC LPC47M292 detection - Add nVidia MCP61 and MCP65 detection - Fix ADM1028 detection - Add Nat. Semi. PC8347L Super-I/O detection - Add SMSC SCH5504 Super-I/O detection (no sensors) - Make the LM78 and W83781D detection safer - - -2.10.2 (20070115) - RPM: Obsolete, removed - File doc/fan-divisors: Update - File sensors_vid.h: Trim VID values to correct number of bits (2.6 backport) - Library: Add support for the pc87247 driver (fans only) - Probe for busses before chips - Drop support for algorithm names - Add support for coretemp driver - Major update/optimization of config-file scanner - Add config-file scanner regression tests - Add f71872f support - Add w83627dhg support (David Holl, #2157) - Get the i2c adapter names from classdev.name - Add adm1029 support (Corentin Labbe) - Man page i2cdetect.8: Describe the output convention - Man page sensors.1: Update (option -c) and clean up - Module bmcsensors: Fix several warnings - Fix fragile structure initialization - Module i2c-i801: Add ICH9 support - Module p4b_smbus: Add support for the ICH5 - Module f71805f: Fix the device address decoding (2.6 backport) - Module icspll: Delete. It was useless and dangerous. - Program decode-dimms.pl: Remove spaces at end of lines - Program eepromer: Fix loads of warnings - Program i2cdetect: Make the output clearer - Program py-smbus: New! Python i2c-dev bindings (prog/py-smbus) - Program unhide_ICH_SMBus: New! Unhides the ICH SMBus for 2.6 kernels - without need of recompilation. - Programs dump/*: More robust handling of user inputs - Programs pwmconfig, fancontrol: Handle write errors for bash 3.1 - Add support for non-i2c drivers - Program fancontrol.pl: Disable debugging by default - Add support for non-i2c drivers - More tolerant config file parsing - Program sensord: Add pc87247 support (fans only) - Add vt1211 support (#2150) - Add w83627dhg support (David Holl, #2157) - Add w83627ehf voltage support (Dave Platt) - Add k8temp support (Dave Platt) - Program sensors: Add pc87247 support (fans only) - Hide error on missing f71805f fan - Handle option -c more efficiently - Drop option -a (show algorithm names) - Add f71872f support - Add w83627dhg support (David Holl, #2157) - Add adm1029 support (Corentin Labbe) - Hide error on missing w83793 temp (Gong Jun) - Program sensors-detect: Add SMSC DME1737 detection - Add Fintek F71882FG and EPoX EP1308 detection - Add Intel Core thermal sensor detection - Preallocate memory for I2C_FUNCS ioctl (#2138) - Prevent misdetection of MAX6633/MAX6634/MAX6635 - Add Intel ICH9 detection - Add Maxim MAX6648/MAX6692 detection - Improve ADM1029 detection - Add Andigilog chips detection - Add Intel AMB FB-DIMM thermal sensor detection - Add ATI SB600 detection - - -2.10.1 (20060924) - File doc/developers/checklist renamed to dev/developers/release_checklist - with clarifications and updates for new SVN server. - File README.package: Delete. - File doc/busses/i2c-piix4: Update (2.6 backport) - File doc/developers/sysfs-interface: Update - File etc/sensors.conf.eg: Add an smsc47m192 section - Comment out all set statements - Add an it8716 section - Add a w83793 section - Adjust the vt1211 section to match the new driver - interface - Library: Fix device scan when no i2c support is present - Add support for W83627EHF voltage inputs and alarms - Add support for the smsc47m192 driver - Fix all memory leaks (yeah!) - Fix no sensors being reported as an error - Add support for the IT8716F and IT8718F chips - Add support for the W83793 chip (Yuan Mu) - Map the 2.6 adm1026's fan8 to fan0 - Missing sysfs busses and classes are not errors - Change vt1211 temp3-7 magnitude from 1 to 3 - Makefile: Don't grep autoconf.h on user-space targets - Fix depmod on non-running kernel version - Remove empty include directories on make user_uninstall - Module i2c-ali1535: Drop redundant semaphore (2.6 backport) - Module i2c-amd756-s4882: Improve static semaphore initialization - (2.6 backport) - Module i2c-i801: Disable PEC mode after every transaction (2.6 backport) - Add ICH8 support (2.6 backport) - Fix block transaction poll loops (2.6 backport) - Remove PCI function check (2.6 backport) - Cleanups (2.6 backport) - Module i2c-nforce2: Add nForce4 MCP51, MCP55 support (2.6 backport) - Module i2c-piix4: Add ServerWorks HT-1000 support (2.6 backport) - Add ATI IXP200, IXP300, IXP400 support (2.6 backport) - Drop the fix_hstcfg parameter (2.6 backport) - Module i2c-viapro: Fix compilation with kernels < 2.4.21 - Add VT8237A and VT8251 - Module lm83: Add LM82 support (2.6 backport) - Module vt1211: The VT1211 has no in6 - Rework the voltage and temperature conversions and the - temperature input order to match the Linux 2.6 driver - Module w83781d: Use real-time alarm registers when possible (2.6 backport) - Add specific alarm and beep defines for the W83791D - Module w83792d: Fix PWM range (2.6 backport) - Program decode-dimms.pl: Decode depending on the memory type - Decode the manufacturing date to an ISO8601 date - Add the memory size computation and provide brief - timing characteritics for SDRAM/DDR/DDR2 memory - Add memory size computation for Rambus memory - Various output cleanups and fixes - Program decode-edid.pl: Add /usr/sbin or /usr/local/sbin to $PATH if needed - Program decode-vaio.pl: Detect and skip false positives - Program i2cdetect: Add a mode to print adapter functionalities - Program i2cdump: Restore bank after bank switching - Add new mode W (read word on even register addresses) - Program mkpatch: Fix typo breaking f71805f - Turn warnings on (-w), and fix them - Print a usage message on missing command line parameters - Program pwmconfig: Use mktemp instead of tempfile - Program sensors: No error messages on missing w83792d fan4-7 (Yuan Mu) - Add smsc47m192 support - Add abituguru support (Hans de Goede) - Fix memory leak when printing an unknown chip - Add it8716 and it8718 support - Make each it87 fan and fan div optional - Print missing w83791d values - Add w83793 support (Yuan Mu) - The adt7463 may not have in4 (#2119) - Hide more vt1211 missing input errors - Clearer error messages when no sensors found - Program sensors-detect: Add ServerWorks HT-1000 SMBus detection - Add ATI IXP200/300/400 SMBus detection - Prevent warning on 64-bit PCI addresses - Add Fintek F75363SG, F75111R/RG/N, F75121R, - F75122R/RG, F75373S/SG, F75375S/SP, F75383S/M, - F75384S/M, F75387SG/RG and F81218D detection - Add Winbond W83793R/G and W83627DHG detection - Handle the W83791D driver difference between kernels - Add nForce4 MCP04, MCP51 and MCP55 detection - Add AMD Geode devices detection - Add ITE IT8716F and IT8718F detection - Add NatSemi/Winbond PC87427 detection - Get driver information for busy addresses from - sysfs (2.6 only) - Drop the ISA IT87xxF detection - Check i2c adapter functionalities before probing - Add Intel ICH8 SMBus detection - Add AMD K8 thermal sensors detection - Simplify detection of SiS5595, VIA686 and VT8231 - Add Analog Devices ADM1033, ADM1034, ADT7462, - ADT7466, ADT7470, ADT7473 and ADT7475 detection - Check for root user at startup - Attempt to be slightly more user-friendly - Add VT8237A and VT8251 - Remove detection of nVidia graphics adapters - Use sysfs for PCI device enumeration - Add generic PCI SMBus adapter detection - Add generic Super-I/O logical device detection - Add SMSC LPC47M172/182 detection - - -2.10.0 (20060214) - File doc/lm_sensors-FAQ.texi: Remove version 1 specifics part - File doc/busses/i2c-viapro: Update (2.6 backport) - File doc/chips/via686a: Update (2.6 backport) - File doc/chips/w83627hf: W83627THF VID clarification (2.6 backport) - File etc/sensors.conf.eg: Do not set vrm by default - File i2c-dev.h: Fix union i2c_smbus_data definition - Sync i2c_msg definition with i2c.h (Hideki Iwamoto) - Add missing parentheses around macros - Drop I2C_FUNC_SMBUS_EMUL - Drop I2C_FUNC_SMBUS_*_PEC - Drop I2C_SMBUS_*_PEC - File sensors_vid.h: Drop default VRM - Library: NOTE: libsensors(3) will no longer see eeprom (SPD) chips - This is intentional. Use decode-dimms.pl if you still - need your memory SPD data. - Library: Big update to use libsysfs. More TODO though. - Fix bus matching code for Linux 2.6 (Karsten Petersen) - Add f71805f, w83687thf support - Add platform drivers support - Fix sysctl warnings on x86_64 - Restore vt1211 temp1 - Makefile: Compile user-space programs with -Wundef - Module i2c-i801: Simplify the hardware PEC code - Always set PEC mode explicitly before each transaction - Module i2c-i810: Documentation update, PCI IDs cleanup - Module i2c-keywest: Remove bus probing code (2.6 backport) - Module i2c-nforce2: Remove dead code (2.6 backport) - Add the ID of the nForce4 MCP-04 (2.6 backport) - Module i2c-via: Remove dead code - Module i2c-viapro: Remove dead code - Support I2C block read (2.6 backport) - Code cleanups (2.6 backport) - Improve debug register dump (2.6 backport) - Modules i2c-ali1535, i2c-ali1563, i2c-ali15x3, i2c-amd756, i2c-amd8111, - i2c-i801, i2c-nforce2, i2c-piix4, i2c-sis5595, i2c-sis630, - i2c-sis645: Use pci_driver name to request I/O region; do - not initialize i2c_adapter name to "unset" (2.6 - backport) - Modules i2c-amd8111, i2c-i801, i2c-nforce2: Drop software PEC code - (2.6 backport) - Module adm9240: Cleanups (2.6 backport) - Module f71805f: New, supports the Fintek F71805F/FG Super-I/O - Module it87: Minor cleanups - Fix fan3_div setting bug (Anton V. Staaf) - Module lm90: Support the ADM1032-2 and ADT7461-2 (2.6 backport) - Separate the register read function - Add PEC support for the ADM1032 - Module via686a: Cleanups - Module w83627hf: Drop useless initialization step (2.6 backport) - Fix in4 for W83627THF and W83637HF (Yuan Mu) - Fix alarms (Yuan Mu) - Preserve fan min on fan div change (Yuan Mu) - Properly handle W83627THF without VID (Yuan Mu) - Fix in0 limit settings in "VRM9" mode (Yuan Mu) - Add W83687THF support - Module w83781d: Drop W83697HF support (Grant Coady) - Module w83792d: Bug fixes and code cleanups (Yuan Mu, 2.6 backport) - Fix fan control mode (PWM/DC) reporting - Fix fan div auto-adjust (Yuan Mu) - Fix the subclient handling - Module w83l785ts: Minor cleanup (2.6 backport) - Module vt1211: Restore temp1 - Modules vt1211, vt8231: Change default VRM to 9.1 - Program decode-dimms.pl: Add lookup tables for manufacturer names - Fix rounding error in PCxxxx speed computation - Improve text output - Improve speed under Linux 2.6 - Verify checksum before decoding anything - Improve manufacturing location decoding - Improve memory type detection - Improve part number decoding - Program i2cdump: Drop now useless #ifdef tests - Fix capability check for continuous byte mode - Program i2cget: New - Program i2cset: Add PEC support - Fix argc check - Programs i2cdetect, i2cdump, i2cset: Stop printing the algorithm name - Print the correct bus type if bus - functionality can be queried - Program isadump: Display the real addresses in flat mode - Program mkdev.sh: Silently skip already existing nodes - Program mkpatch: Include f71805f - Program sensord: Do not log algorithm names - Drop EEPROM support (Aurelien Jarno) - Add W83627EHF, F71805F/FG support - Fix PC87365/PC87366 alarms - Program sensors: Drop free_the_label - Fix compilation with uclibc (no iconv) - Add f71805f, w83687thf support - Program sensors-detect: Drop algorithm names - Do not rely on i2cdetect -l printing algo names - Simplify adapter name matching mechanism - New address for ADM1032, ADT7461 - Improve ADT7467, ADT7468 support - Fix MAX6659 reported driver - Add Fintek F71805F detection - Add Analog Devices ADT7476 detection - Add Intel 82845G detection - Add IT8201R/IT8203R/IT8206R/IT8266R detection - Fix udev detection in some corner case - Improve DS1621 detection - Always prefer ISA access over SMBus access - - -2.9.2 (20050906) - File doc/chips/*: Big update (2.6 backport) - Library: Drop ds1780-specific code (now use adm9240) - Fix memory leak in sensors_get_label() - Support /sys/class/hwmon (Linux 2.6.14+) - Limit stack usage in sensors_read_proc_chips() - Makefile: Detect 2.6+ kernels and check targets - Man page isaset.8: Fix typos - Module adm1031: Fix broken kfree() calls - Module i2c-ali1563: New (2.6 backport by Winbond) - Modules i2c-ipmb, i2c-ipmi: Support ipmi_request() additional argument - Modules it87, pc87360, sis5595, smsc47m1, vt1211, vt8231, - w83627hf.c: Tag find function __init - Module lm93: Fix memory leak - Module smsc47m1: Fix PWM enable polarity on read - Modules w83627hf, w83781d: Allow setting fan divisor to 128 - Program decode-dimms.pl: Support Linux 2.6 (Burkart Lingner) - Added DDR/DDR2 frequency reporting in convenient - form of DDRxxx PCyyyy - Program i2cdump: Properly handle short i2c block reads - Program fancontrol.pl: Fix compile errors - Program mkpatch: Include i2c-ali1563 - Include w83792d - Program pwmconfig: Fix unsafe temporary file use - Program rrd: Support 2.6 kernels - Program sensord: Add support for w83637hf - Support pc87360 (Henrik Brix Andersen) - Program sensors: Support the VAIO "VGN" prefix for eeprom - Program sensors-detect: Add SMSC LPC47M15x/LPC47M192 SMBus detection - Advertise the w83792d driver - Improve IT8705F and IT8712F detection - Merge LM82 and LM83 detection - Add W83687THF detection - - -2.9.1 (20050412) - File doc/busses/i2c-nforce2: Update - File doc/chips/it87: Update - File doc/chips/lm90: Update for adt7461 - File doc/chips/mic74: New - File etc/sensors.conf.eg: New sections for lm92 and w83792d - Library: Add support for 2.6 fscpos driver (Stefan Ott) - Fix sis5595 in4 (Aurelien Jarno) - Add support for 2.6 gl520sm driver (Maarten Deprez) - Add support for 2.6 bmcsensors driver (Yani Ioannou) - Add support for w83792d (Chunhao Huang/Winbond) - Add support for 2.6 adt7461 (James Chapman) - Add support for 2.6 lm92 - Add support for 2.6 vt1211 - Add preliminary support for 2.6 w83627ehf - Makefile: Support mips, sparc32 and sparc64 (Aurelien Jarno) - Use -fno-strict-aliasing on all architectures - Man pages pwmconfig, fancontrol: New (Aurelien Jarno) - Module bmcsensors: Fix compile error - Support IPMI V0.9 (Yani Ioannou/Vladislav Bogdanov) - Module ds1621: Fix detection (Aurelien Jarno) - Module eeprom: Discard SPD-centric checksum module parameter - Cleanup detection function (backport from Linux 2.6) - Module i2c-ali1535: Add delay loops for reliability (Ubel Walter) - Module i2c-i801: Temporarily disable broken I2C block read - Module i2c-ipmi: Fix bogus return in a middle of a function (Sergio - Gelato) - Module i2c-nforce2: Add nForce4 support (Hans-Frieder Vogt) - Module i2c-viapro: Prevent repeated resets - Module it87: Improve Super-I/O detection - Limit I2C address range - Support VID on the IT8712F - Module lm75: Only initialize CMP/INT bit - Module lm78: Fix bug with setting negative temperature limits - Module lm85: Properly differentiate between ADM1027 and ADT7463 - Add EMC6D102 support - Module lm90: Fix MAX6657, MAX6658 and MAX6659 detection - Add limited ADT7461 support - Module lm93: Fix IN10 (+5V) scaling - Module mic74: New - Module w83627hf: Support secondary Super-I/O address - Enable temp2 and temp3 if they are disabled - Module w83781d: Revert AS99127F temp2 and temp3 computation change - Skip final initialization step for AS99127F chips - Module w83792d: New (Chunhao Huang/Winbond) - Program ddcmon: New; user-space replacement for the ddcmon driver - Program eeprog: Fix missing first char in ascii mode (J. A. McMahan Jr.) - Program isadump: Handle Super-I/O keys - Program lm_sensors.init: Cleanups (Axel Thimm) - Program mkdev.sh: Add basic command-line interface - Program mkpatch: Add adm1031, fscher, lm63, lm93 and max1619 - Program pwmconfig: Secure the creation of temporary files (Aurelien Jarno) - Don't complain about read-only enable files (lm85) - Fix handling of alternate config file name - Program sensord: Fix erroneous error message (Aurelien Jarno) - Support sis5595 in4 (Aurelien Jarno) - Support w83627thf - Support the separate it8712 prefix (Aurelien Jarno) - Program sensors: Display sis5595 in4 (Aurelien Jarno) - No errors on missing pc87360 fans - Add gl520sm support (Maarten Deprez) - Improve vt1211 error/ignore handling (Michael Carland) - Support w83792d, w83627ehf - Program sensors-detect: Fix MAX6657, MAX6658 and MAX6659 detection - Improve IT8705F and IT8712F detection - Improve udev detection - Fix DS1621 detection - Add W83627EHF detection - Add ATI SMBus detection - Add VT1211 alias detection - Warn if chip modules not found - Add i2c-ipmi to list if bmcsensors is on it - Add PC87591 detection - Search for correct udev db file name - Add nForce3 250Gb and nForce4 detection - - -2.9.0 (20041228) - NOTE: Requires i2c-2.9.0 or newer! - File README.thinkpad: Update - File doc/chips/it87: Cleanups - File doc/chips/lm63: New - File etc/sensors.conf.eg: Set via686a voltage limits - File kernel/chips/Module.mk: Resync module list with mkpatch - File kernel/include/sensors_compat.h: Define __devexit_p if missing - (kernels 2.4.16 and older) - Modules (all bus drivers): Remove owner from i2c_adapter; restore inc_use - and dec_use removed in release 2.8.0 - Modules (all chip drivers): Remove owner from i2c_driver; pass - controlling_mod to i2c_register_entry() again - Module bmcsensors: Support function 1/x - Module i2c-amd756: Display the real bus name - Module i2c-amd756-s4882: New; SMBus multiplexing on the Tyan S4882 - Module i2c-i801: Support i2c block read (ICH5 and higher) - Add PEC support for ICH6 - Add support for ICH7 - Module i2c-ipmb: Remove from build since it doesn't work - Module i2c-nforce2: Support the nForce3 (Pro150 and 250Gb) - Module icspll: Fix compilation - Module lm63: New driver for the National Semiconductor LM63 - Module lm83: Use signed types for temperatures - Check limits on register writes - Module lm87: Round voltages properly - Retry on read errors (David Knierim) - Less agressive init (no reset) - Module lm90: Use signed types for temperatures - Check limits on register writes - Module lm93: Added module parameter for VID pin input thresholds. - Fix typo in dynamic VID alarms - Adds a couple log messages for failed transactions (David - Knierim) - Fix compilation breaking C99-ism (Axel Thimm) - Fix block read retries - Module pc87360: Support secondary Super-I/O address - Module smsc47m1: Add support for 47M15x and 47M192 (fans only) - Library: Add lm63 support - Add lpc47b397 support - Programs *.init: Rename lockfile to match file name - Programs i2cset, isaset: Written byte/word can be masked - Program decode-vaio.pl: Find eeproms on non-0 i2c bus too - Program mkpatch: Include i2c-amd756-s4882 - Program pwmconfig: Handle new (well, back to old) pwm files names for - Linux 2.6.10 and up - Program sensord: Do not scale load average (Aurelien Jarno) - Program sensors: Add lm63, lpc47b397 support - Support DDR2 memory module EEPROMs (Rudolf Marek) - Support only one location for the default configuration file - Display the default configuration file location in --help - Simplify the configuration file opening code - Program sensors-detect: Improve LM63 detection - Discard IBM Thinkpad detection code - Add PCA9556, LPC47B397, ICH7 detection - Fix W83792D detection, add W83791SD detection - - -2.8.8 (20041007) - File doc/donations: Update - File doc/lm_sensors-FAQ.texi: Add 4.6.1 - Update 4.7 - File doc/chips/gl518sm: Update "iterate" info - File doc/chips/it87: Discard outdated module parameters - File doc/chips/lm75: LM77 is not supported - File doc/chips/lm90: LM86, MAX6657 and MAX6658 are supported - File doc/chips/lm93: New - File doc/chips/w83l785ts: Improvements - File etc/sensors.conf.eg: Fix it87 lines order - Update lm87 section - File kernel/include/sensors_vid.h: Support VRM 10.0 - Library: Support 2.6 adm1025 - Preliminary support for 2.6 lm87 - Support 2.6 adm9240 - Allow an alternative sysfs file name for chip features (2.6) - Fix lm83 critical limits (2.6) - Add lm93 support - Prevent some procfs errors from being silently ignored - Makefiles: Implement user_uninstall (Rudolf Marek) - Spoof LOGNAME and HOSTNAME when making html man pages - Module adm1025: Refine detection - Update limit registers again (revert of 2.8.1) - Init high limits if they read 0 - Fix conversions - Module lm75: Refine detection - Module lm78: Fix init - Module lm83: Default to kind lm83 if forced. - Fix temperature macros. - Module lm90: Add LM86, MAX6657 and MAX6658 support - Module lm93: New - Module mtp008: Fix the setting of limits on temp2 - Module pca9540: Refine detection - Module pc87360: Change voltage/thermistor magnitude from 2 to 3 - Support VID - Fix fan_div file when fan count is less than 3 - Additional init and debug - Module smsc47m1: Fix pwm_enable being inverted - Module w83627hf: Add alternate VCORE/in0 calculation method - Remove reset of chip by driver on initialization - Module w83781d: Fix default VRM for w83791d - Module w83l785ts: Implement read error handling (backport from 2.6) - Programs i2cset, i2cdump, i2cdetect, isaset, isadump: - Wait for user input to continue (as opposed to 5 sec - delay), can be skipped with -y - Various cleanups and code refactoring - Update manual pages - Program fancontrol.init: New (Dean Takemori) - Program fancontrol.pl: Restore fans on many kinds of errors/interrupts - Program lm_sensors.init: Support 2.6 kernels and sensors in /usr/bin - (Giuseppe Della Bianca) - Program mkdev.sh: Detect devfs and refuse to run - Use mknod's mode instead of chmod - Program mkpatch: Include xeontemp and pc87360 - Program sensors: Rework adm1025 support - Display pc87365/pc87366 VID - Improve smsc47m1 support - Hide 2.6 adm1027 alarm_mask being missing - Print VRM version for all supported chips - Program sensors-detect: Support LM93, LM77, LM63 - Support PC8739x Super-I/O family (no sensors) - Fix PCA9540 support - Refine ADM1025/ADM1025A detection - Refine LM75 detection - Ignore missing /proc/modules (Andras Bali) - Script-wide Perl cleanups - Support udev - Support W83792D, LM96000 - - -2.8.7 (20040611) - File README.thinkpad: Update 24RF08 status - File doc/fan-divisors: More info on accuracy - File doc/lm_sensors-FAQ.texi: Update 4.27 - File doc/chips/adm1031: New - File doc/chips/max1619: New - File doc/chips/pc87360-fan: Renamed to pc87360 - File doc/chips/pc87360: Big update - File doc/chips/w83781d: Update AS99127F documentation - File etc/sensors.conf.eg: Add comments about BP6 voltages - Add comment on Asus A7V8X-X VCore - Misc fixes to lm80 section - Update via686a section - New lm99 section - Add section for LM85-like chips - Preliminary pc87366 section - Add comment on GL520SM application modes - Document beep_enable (Aurelien Jarno) - Preliminary max1619 section - Preliminary adm1030 and adm1031 sections - Library: Fix 2.6 VRM - Fix 2.6 hyst temp for 2.6 (lm75, lm78 and gl518sm) - Fully support the PC87360 family - Support the lm99 - Add version and date strings - Support 2.6 max1619 - Makefile: Do not run depmod on staged installs (Peter Breitenlohner) - Man page i2cdetect.8: document new command line flags - Man page i2cdump.8: More details on how i2cdump can write to a chip - Modules (all chip drivers): Rework memory allocation scheme. - Module adm1031: New (Alexandre d'Alton) - Module bmcsensors: Fix oops by creating thread for initialization - Modules dmi_scan, i2c-piix4: Move IBM detection into dmi_scan - Modules w83781d.c, smartbatt.c, lm75.c, gl520sm.c, gl518sm.c, ds1621.c, - asb100.c, lm92.c: Use swab16 - Modules eeprom, ddcmon: Unconditional prevention of 24RF08 corruption - Module gl520sm: Less agressive initialization process - Fix temp1 limits being unsettable in application - Ensure that temp2 and in4 are not used at the same time - Module i2c-i801: Support 6300ESB and ICH6 - Module i2c-piix4: Don't blacklist IBM with Serverworks chip - Module i2c-sis645: Add support for SiS655 - Module it87: Discard non-standard Super-I/O exit sequence (Bjorn Mork) - Module lm90: Support LM99 and LM89 - Module lm92: Support MAX6633, MAX6634, MAX6635 and LM76 - Get rid of useless i2c_probe call - Module max1619: New (Alexey Fisher) - Module p4b_smbus: Add support for mobile versions of the 82801 - (Axel Thimm) - Module pc87360-fan: Renamed to pc87360 - Module pc87360: Also support PC87365 and PC87366 - Add write support - Correctly set the chip name depending on the type - Add voltage and temperature support - Fix fan speed computation - Retrieve fans configuration from Super-I/O space - Export pwm_enable (read-only) - Honor pwm invert bits - Clear fan alarms after we read them - Do not read fan data when monitoring is disabled - Do not include SENSORS_INSMOD stuff - New module parameter: init - Fan clock dividers change automatically - Add thermistor dupport - Module smsc47m1: Lock on reads and writes - Various PWM fixes - Module thmc50: Fix address range - Module via686a: Fix voltage roundings - Simplify temperature conversions - Module w83781d: Drop PWM support for as99127f - Invert AS99127F beep bits in driver rather than user-space - Programs pwmconfig, fancontrol: Switch to new sysfs naming scheme - Program fancontrol: restore fans on TERM and KILL (Stephen Kitt) - Program fancontrol.pl: New - Program i2cdetect: Adapt probing method to address - Add -q and -r flags to force probing methods - Allow probing range selection - Program isadump: Major improvements - Program isaset: New - Program mkpatch: Patch dmi_scan.c in kernel instead of adding our own - module - Include i2c-nforce2 - Program sensord: New --rrd-no-average parameter - Syncronize time slots with rrd - Fix W83781D temp3 alarm (Aurelien Jarno) - Add ASB100 support (Andrew May) - Program sensors: Fully support the PC87360 family - Fix lm80 temperature alarms - Support the lm99 - Do not invert AS99127F beep bits anymore - Fix W83781D temp3 alarm (Aurelien Jarno) - Print library version string - Program sensors-detect: Rework Super I/O detection - Support SiS655/SiS96x - Support ADT7461 and ADT7467 - Better support for ADM1027, ADT7460 and ADT7463 - Explicitly support ADM1028 - Scan all logical devices of PC87365 and PC87366 - Detect LM92, LM76, MAX6633, MAX6634, MAX6635 - Detect eeproms with software write protect (not - enabled by default) - Support ALi 1563 (2.6 only) - Drop LTC1710 support - Use byte reads for probing on ranges 0x30-0x37 and - 0x50-0x5F - Improve LM89 and LM99 support - Support GeForce FX 5900 video cards - Fix devfs misdetection (Aurelien Jarno) - Detect 6300ESB, ICH6 - Fix double detection of ISA chips - Support MAX1619 - Support PC87373 Super-I/O - Fix unknown adapters appearing multiple times - Refine MAX6650/MAX6651 detection - - -2.8.6 (20040405) - File README.thinkpad: Update status - File doc/chips/pca9540: New - File doc/chips/pc87360-fan: New - File etc/sensors.conf.eg: Update pcf8591 default configuration - Library: Switch to new sysfs naming standard - Fix gcc 3.3 warnings (Philipp Thomas) - Support 2.6 ds1621 and pcf8591 - Change pcf8591 magnitudes - Support pc87360-fan - Makefile: Install shared library 755 - Man pages i2cdump.8, i2cset.8, isadump.8: New (Debian team) - Man pages i2cdetect.8, sensors-detect.8: New (Debian team) - Modules ds1621, pcf8591: Check for capabilities before using them - (Aurelien Jarno) - Modules pcf8574, pcf8591: Cleanups - Modules ddcmon, eeprom: Fix bogus init (Ralf Roesch) - Module adm1021: Better detection and initialization - Module pca9540: New driver for the Philips PCA9540 - Module pc87360-fan: New driver for the National Semiconductor PC87360, - PC87363 and PC87364 Super I/O chips - Module smsc47m1: Support the LPC47B27x - Programs i2cdetect, i2cdump, i2cset: Fix incorrect bus names if possible - Program i2cdetect: Skip special addresses by default - Program sensord: Prevent null pointer dereference (Tim Toohey) - Program sensors: Print the degree symbol in the terminal's current locale - (Aurelien Jarno) - Update pcf8591 print to support 2.6 driver - Support pc87360-fan - Program sensors-detect: Support Maxim MAX6900, ALi M5879, Philips PCA9540 - Improved SiS chips support - Add a white list of IBM systems - Drop support of undetectable adapters - Fix smart battery detection - Add smart battery charger and manager detection - Rework adm1021 and clones detection - The PC87360, PC87363 and PC87364 Super I/O chips - now have a (preliminary) driver - Rework Super I/O detection - Better support of devfs - Program sensors-detect-stat.pl: New - - -2.8.5 (20040305) - File doc/chips/SUMMARY: Update - File etc/sensors.conf.eg: Epox 8K3A tweaks. (Kronos) - Makefiles hotplug and rrd: Remove -o and -g arguments to install - Module bmcsensors: Increase max SDRs to 100 - Module fscher: Rename fanN_min to pwmN (Reinhard Nissl) - Module i2c-amd756: Don't register driver to avoid driver conflicts. - (Daniel Rune Jensen) - Module it87: Better temperature sensor types handling (Takeru Komoriya) - Fix reset=1 (Takeru Komoriya) - Module lm80: Code cleanups - Module vt1211: Fix bitmask in uch_config read and write; remove in6 and temp1 - Module vt8231: Fix bitmask in uch_config read and write; remove in6 and temp1 - Module w83627hf: Add w83637hf support - Fix exported name - Fix PWM in w83627thf - Preserve other bits when forcing temp2/3 to comparator mode - Module w83781d: Preserve other bits when forcing temp2/3 to comparator mode - Remove asb100 support - Modules asb100, fscher, lm90, max6650, w83l785ts, xeontemp: - Define driver ID if i2c-id.h doesn't have it yet. - Modules i2c-ali1535, i2c-hydra, i2c-i801, i2c-sis5595: - Backport oops fix from Linux 2.6. - Modules (all chips): Get rid of useless headers - Program decode-edid.pl: Add sysfs support - Program sensors: Add w83637hf support - Add support for Shuttle Ethernet EEPROMs - Drop 2.6 subclient detection - Program sensors-detect: Add heuristics to the LM80 detection function - Add support for W83L785R, improve W83L784R/AR - Add GeForce FX 5600 as supported by rivatv - More Super IO chips, better handling - Library: Update to match renames in fscher - Reverse temporary changes to w83l785ts mappings - Fix vt1211 and vt8231 uch_config not being writable - Add 2.6 lm80 support - Add w83637hf support - Remove in6 and temp1 from vt1211 and vt8231 - Add support for Shuttle Ethernet EEPROMs - Remove unused as99127f features - - -2.8.4 (20040207) - File doc/lm_sensors-FAQ.texi: Update 4.20. - File doc/chips/it87: Change hyst to low - File doc/chips/w83l785ts: New - File etc/sensors.conf.eg: Change it87 hyst to low - Fix w83697hf supposed to have temp3 - Limits initialization for adm1025/ne1619 - Handle fscher voltage conversions - Add Tyan Trinity S2495 KT400 setup (Eric - Schumann) - Fix fscher fan labels (Reinhard Nissl) - Library: Better 2.6 eeprom support - Change it87 hyst to low - Add 2.6 gl518sm, fscher support - Fix 2.6 negative voltages handling - Temporary fix to w83l785ts mappings - Module adm1025: Separate prefix for NE1619 - Module adm1026: Remove use of temporary ID - Define addresses as a range - Module bmcsensors: Fix reservations - Module fscher: Externalize voltage conversions - Module eeprom: Remove memtype - Module i2c-piix4: Fix resource release error - Various cleanups - Program decode-vaio.pl: Add sysfs support - Program mkpatch: Add max6650, lm83, lm90, asb100 and w83l785ts - Drop linux 2.2 support - Add w83627hf - Program sensors: Do not show algorithm by default - Cleanup temperature unit display code - Cleanup label spacing code - Fix output to UTF-8 terms (Marcel Sebek) - Simplify gl518sm print - Do not ignore errors in FSC chips prints - Fix w83l785ts print - Cleanup FSC chips prints - Program sensors-detect: Fix PATH issues - Correctly point to the fscher driver - - -2.8.3 (20040115) - File lm_sensors.spec: Update - Library: Add 2.6 eeprom, lm90 support - Fix 2.6 temp_hystX for 2.6.1-rc1 and later - Makefile: Update Alpha CMODFLAGS (Daniel Nilsson) - Makefiles: Remove -o and -g arguments to install; add DESTDIR where missing - Module i2c-amd756: Fix byte writes - Module i2c-tsunami: Cleanups (Daniel Nilsson) - Module it87: Fix sg_tlx writes; fix sensor type reporting; - add 8712 Super I/O detection; - remove initialization of temp_type and fan_ctl; - remove init and temp_type module parameters - Module lm90: Handle hysteresis differently - Module smartbatt: Fix detection, magnitudes, temp - Module w83781d: Fix negative voltages - Module w83l785ts: New - Program eeprog: Make 8 bit mode the default - Program fancontrol: Improvements, fixes, support 2.6 kernels - Program mkpatch: Add lm75.h - Program pwmconfig: Improvements, fixes, support 2.6 kernels - Program sensors: Add ASB100 support - Program sensors-detect: Add 8712 Super I/O detection; - add W83L785TS detection - - -2.8.2 (20031211) - IMPORTANT: Limit initialization removed from all chip drivers! - If you didn't run 'sensors -s' in the past you may need to now! - File sensors.conf.eg: Change lm75 scaling back to 1; - Add example for asb100 - Library: Fix bmcsensors scaling, increase number of sensors; - Add w83627thf support; Advance version to 3.0.0; - Add hermes, ADM1032, ASB100 support; - Add it87 sensor type support; - Add sysfs support for kernel 2.6; - Fix memory leaks - Makefiles: Install fancontrol, pwmconfig, decode-*.pl; - Fail if no kernel .config file exists; - Don't build module dependencies for user and user_install - Modules adm1021, adm1024, adm1025, adm9240, ds1621, gl518sm, gl520sm, - it87, lm75, lm78, lm80, lm83, lm87, lm90, mtp008, sis5595, - smsc47m1, thmc50, via686a, w83627hf, w83781d: - Remove initialization of limits by driver. - Modules it87, lm78, mtp008, sis5595, w83627hf: Fix IN_FROM_REG rounding - Modules (chip): Init cleanups - Module asb100: New - Module bmcsensors: Fix voltage scaling, voltage and fan limits - Modules ddcmon, eeprom: Add failure printks - Module fscher: New (Fujitsu-Siemens Hermes driver) - Module i2c-amd756: Fix AMD8111 support - Module i2c-amd8111: Fix byte writes - Module i2c-nforce2: Fix byte writes - Module i2c-piix4: Add support for CSB6; add fix_hstcfg option - Module i2c-sis630: Sync with 2.6.0-X driver version - Module i2c-viapro: Add support for Via 8237 - Module it87: Add pwm and "smart guardian" support; - add it87 sensor type support - Module lm75: Fix negative voltages - Module lm90: Add ADM1032 support - Module w83781d: Fix 791d and 627hf detection - Module w83627hf: Add VID support - Program dmidecode: Remove (sensors-detect doesn't need it anymore) - Program eeprog: New - Programs i2cdetect, i2cdump, i2cset: add -v (version) option; - support sysfs for i2c bus search - Program i2cdetect: Add -l option to list busses - Program i2cdump: Add 'c' mode for consective address reads - Program mkpatch: Cleanups - Program pwmconfig: Handle multiple fans controlled by a single pwm - Program sensord: Remove ddcmon support - Program sensors: Add ADM1032 support; add messages for sysfs - Program sensors-detect: Prefer Super I/O drivers; - Fix W83627HF and W83791D detection; detect CSB6; - Detect ADM1029, ADM1030, ADM1031; - Detect W83637HF, W83697UF; - Add it87 sensor type support; add sysfs support - Reduce lm80 misdetects; remove PCFxxxx "detection" - Detect VT8237 (KT600) - Use VPD instead of DMI+ACPI for Thinkpad detection - Suggest new asb100 driver instead of w83781d - - -2.8.1 (20031005) - NOTE: Requires i2c-2.8.1 or newer! - File sensors.conf.eg: Improved adm1025 section - Default temp labels for as99127f - Improved lm83 section - Better support for Asus A7V8X-X - File doc/chips/SUMMARY: Add SMSC manufacturer ID - File doc/chips/adm1025: Add decent documentation (almost new) - File doc/chips/lm83: Known motherboards list update, misc updates - Library: Change adm1025 names (hyst/over become low/high) - Swap adm1025 temp1 and temp2 to match the driver's order - Advance version to 2.0.1 - Update lm83 support - Add support for lm90, xeontemp, max6650 - Add separate messages for read and write errors - Add missing message for parse error - Makefile: Move LINUX_HEADERS from ALL_CPPFLAGS to MODCPPFLAGS - Modules (various): Fix includes for compilation on Alpha - Use the new i2c_delay function instead of the various - do_pause functions - Module i2c-ali15x3: Fix resource leak (Daniele Bellucci) - Module i2c-nforce2: Cleanups - Module i2c-i810: Use readl/writel for portable access to PCI memory - Module i2c-piix4: Force CPCI735 bug workaround (Tom Rini) - Module i2c-savage4: Use readl/writel for portable access to PCI memory - Module i2c-sis630: Fix detection - Add block data read/write support - Module i2c-sis645: Detection method change/bugfix - Module i2c-viapro: Prevent buffer overrun (Sergey Vlasov) - Module i2c-voodoo3: Use readl/writel for portable access to PCI memory - Module adm1025: Major driver update - Add support for Philips NE1619 - Simplify the driver a lot (unified voltages, unified - temperatures and much more) - Fix default voltage limits - Change default temperature limits - Swap remote and local temperatures to match the internal - registers order (make the code unification possible) - Export remote diode fault through alarms - Module ddcmon: Major update - Add half a dozen new features - Add checksum parameter (same as for the eeprom module) - Fix monitor limits - Module eeprom: Ignore Sony Vaio EEPROMs with a password set - Module lm78: Fix a fan_div/fan_min bug - Module lm83: Add t_crit and alarms support - Module lm90: New - Module max6650: New - Module saa1064: New - Module smsc47m1: Add support for 47M142 - Module w83627hf: Fix 697HF PWM; fix 697HF VBAT and V5SB alarms; - enhance w83627thf support - Module w83781d: Enhance chip detection; clean up error returns; - fix 697HF and 791D PWM; fix 697HF VBAT and V5SB alarms - Module xeontemp: New - Program decode-dimms.pl: Add Direct Rambus (DRDRAM) - Mark Rambus as unsupported - Program decode-edid.pl: New - Interfaces between our eeprom module and - parse-edid from the read-edid project - Program p4b_smbus: Fix SMP compilation - Program sensord: Add support for IT87 (Mike Black) - Change ADM1025 support to match the changes made to - the library - Program sensors: Rewrite and enhance EEPROM support - Change LM83 and ADM1025 support to match the changes - made to the library - Add DRDRAM support to print_eeprom - Exit(1) on /proc write failure (Malte Starostik) - Add LM90, MAX6650 support - Program sensors-detect: Add support for PCF8574, PCF8574A, SAA1064 - Add support for LM82, LM86, LM89 - Improved W83781D family detection - Add support for AS19927F rev.2, ASB100 Bach - Add support for Asus Mozart-2 (3 types) - Add support for NE1619 - Add support for FSC Hermes - Make sure /sbin is in the user's path - Fix EEPROM detection - Automatic module.conf and /dev/i2c* detection - Improve LM82 and LM83 detection - Handle "to-be-written" cleanly - Add detection for 47M14x Super I/O - Handle the one-address-many-chips-same-driver - case - - -2.8.0 (20030714) - NOTE: Requires i2c-2.8.0 or newer!!! - Dropped all kernel 2.2 and 2.3 compatibility; 2.4.9 or later required; - 2.4.13 or later required for mkpatch. - File i2c-dev.h: Include userspace portion removed from i2c-dev.h in - i2c package - File doc/chips/fscscy: Add watchdog documentation - File sensors.conf.eg: Fix vt1211/vt8231 thermistor calculations - File sensors.h: Now automatically generated - Library: Add support for exponents and logarithms for vt1211/vt8235 temps; - add adm1026, lm83, lm85, w83791d support; - Advance version to 2.0.0 - Makefiles: Generate warnings if new library won't be found by ld.so; - Modules now install in kernel/drivers/i2c/[busses,chips]; - Ensure that headers in /usr/local/include are used first; - Don't use /usr/include headers for modules; - Handle multiple UTS_RELEASE definitions in linux/version.h; - Automatically generate kernel/include/sensors.h; - Remove old gzipped modules; remove old misc directory if empty; - Remove pre-2.4 installation method; - -Wall now the default; - Add new targets user, user_install, and help; - Run depmod after module installation - Modules (all): Cleanups including - - Add #include - - C99 initializers - - Remove #ifdef MODULE - - Remove #ifndef THIS_MODULE - - Remove #ifndef MODULE_LICENSE - - Remove other 2.1/2.2 #ifdefs - - Remove #include "sensors.h", copy SYSCTL defs to module - - Remove excess #includes - - Remove argument in i2c_register_entry() - - Remove dummy xxx_command() definition - - Remove EXPORT_NO_SYMBOLS - - Remove init_MUTEX #define - - Remove xxx_inc_use() and xxx_dec_use() functions; modules - no longer adjust their own refcounts - - Use module_init() and module_exit() - - Update to new i2c_driver struct definition - Modules (bus PCI): Convert to PCI-module-style initialization - Modules (several): Add support for AMD Opteron VRM (VID) encoding - Module adm1021: Set alarm on failed reads and report old value; - merge changes from kernel 2.5.54 - Module adm1026: New - Module bmcsensors: Fix compile when DEBUG=1 - Modules ddcmon, eeprom: Use i2c block reads if possible; - better error handling - Module ds1307: Add to Makefile - Module gl520sm: Fix temperature over/hyst writes - Module lm75: merge changes from kernel 2.5.54 - Module lm83: New - Module lm85: New - Module i2c-ali1535: Check for invalid transaction - Module i2c-ali15x3: Check for invalid transaction - Module i2c-amd756: merge changes from kernel 2.5.54; - check for invalid transaction - Module i2c-amd8111: merge changes from kernel 2.5.54 - Module i2c-i801: Add support for 82801EB (ICH5) - Module i2c-i810: Fix for some chips - Module i2c-nforce2: New - Module i2c-piix4: Check for invalid transaction - Module i2c-sis5595: Check for invalid transaction; add more blacklist IDs - Module i2c-sis645: Add support for SiS648, SiS651, SiS745, and SiS746 - north bridges; SiS962 and SiS963 south bridges - Module i2c-viapro: Check for invalid transaction - Modules mtp008, smsc47m1, vt1211, vt8231, w83781d: Standardize and improve - pwm and pwm enable support; update docs - Module smbus-arp: Check adapter for HW or SW PEC support; - add reset option - Module w83781d: Add support for w83791d - Module w83627hf: New - Program decode-dimms.pl: Recognize DDR and Rambus - Program eeprom: Fix writes for small eeproms - Program eeprom, eepromer: Use local i2c-dev.h for build - Program fancontrol: New - Program lm_sensors.init: Call sensors -s in start() - Program mkpatch: Fix vt8231 compile; keep tsunami from menu on non-alpha; - Add adm1026,lm85 support; - Remove sensors.c file; add sensors_compat.h; - Remove patches to i2c-core.c and drivers/char/mem.c; - Now works only for kernels 2.4.13 or later - Program p4b_smbus: Fix 'make install'; - Install in same place as other modules; - Clear correct bits in config word - Program pwmconfig: New - Program sensors: add adm1026, lm85, w83791d support - Program sensors-detect: Add super i/o detection (smsc47m1, vt1211, - w83627hf, w83627thf, w83697hf); - Add support for SiS651, SiS961, SiS745, SiS746; - Support dmidecode 2.0 and later; - Fix "C" format error; - Add support for adm1026, 82801EB (ICH5), W83791D; - Add support for w83l785ts, nForce2; - Fix UTF-8 incompatibility; - Better support for lm75; - Add support for lm83 - -2.7.0 (20021208) - NOTE: Requires i2c-2.7.0 or newer. - File doc/busses/i2c-ali1535: Add license, miscellaneous changes - File doc/busses/i2c-ali15x3: Add license, miscellaneous changes - File doc/busses/i2c-sis645: Add license - File doc/chips/lm92: Add license, features - File doc/chips/maxilife: Add license, parameters, features - File doc/chips/smartbatt: Complete rewrite - File doc/chips/vt8231: Add license, parameters - File sensors.conf.eg: Add section for lm75; complete the lm78 section - Library: Add support for MC1066; add multiple VRM version support for lm87; - enhance adm1023 support; initial support for Sony Vaio eeprom; - add support for bmcsensors; add hacks for additional dummy drivers - Makefile: Take kernel source location from /lib/modules/x.x.x/build; - add flags for x86_64 compiles - Module adm1021: Add support for MC1066 - Module bmcsensors: New - Module dmi_scan: Rename symbol duplicated in kernel; apply fixes from - kernel 2.5.43; fix 2.2 kernel compiles - Module gl518sm: Iterate allowed only for rev 0x00 - Module i2c-amd756: Configure base address for nForce support; - check for uninitialized base address; - add support for amd8111 (SMBus 1.0) - Module i2c-amd8111: New (SMBus 2.0) - Module i2c-ipmb: New - Module i2c-ipmi: New - Module i2c-keywest: Sync with kernel 2.4.20 - Module i2c-sis630: Add support for SiS730 - Module i2c-sis645: Improve support for SiS645/961; - add support for SiS645DX/961 and SiS735; - fix 2.2 kernel compiles - Module i2c-viapro: Add support for VT8233A (new ID 0x3177) and VT8235 - Module lm87: Add multiple VRM version support - Module vt1211: Fix inx limits and alarms; fix in0 - Module vt8231: Fix inx limits and alarms; fix in0 - Module w83781d: Fix in0/in1 initialization - Module smartbatt: New - Modules (several): Remove #ifndefs, require i2c-2.7.0; HZ fixes - Program decode-dimms.pl: Code cleanup; valid HTML; better HTML output; - stop decoding on checksum error - Program dmidecode: Fix read bug; upgrade to version 1.8 - Program doc-insmod: Complete rewrite; fix author output - Program doc-features: Complete rewrite; handle missing sysctl entries; - handle unknown prefix with suggestion - Program lm_sensors.init: Remove spaces bug; add green/red output - Program mkpatch: Fix dmi_scan module compile; add sis630, sis645, amd8111 - Program rrd: Add sanity limits to newly-created RRD. - Program sensord: (v0.6.2) Add sanity limits to newly-created RRD. - Program sensors: Add support for MC1066, Rambus Rimms; - fix w83781d temp3 alarm; fix gl518sm rev 0x00 recognition; - initial support for Sony Vaio eeprom - Program sensors-detect: Add support for MC1066, smart battery, 8235, - IPMI, AMD8111; add help if no sensors found; - add ACPI method for IBM system detection; - work with old Perl versions again; - initial support for Sony Vaio eeprom - -2.6.5 (20020915) - NOTE: Requires i2c-2.6.1 or newer, or kernel 2.4.13 or newer. - File sensors.conf.eg: Fix temp[23] for as99127f; add vt8231 - Library: Fix fan3_div writes for w8378* and it87; add vt8231 - Module dmi_scan: new - Module ds1621: Fix enable/disable - Module eeprom: Do not corrupt 24RF08's when checksum=1 - Module i2c-i801: Check for uninitialized base address; - enable if not enabled - Module i2c-piix4: Refuse to load on IBM systems to prevent 24RF08 corruption - Module i2c-sis630: new - Module i2c-sis645: new - Module lm92: Fix in-kernel initialization - Module via686a: Remove VT8231 support - Module vt8231: new - Module w83781: recognize Asus "ASB100 Bach" as AS99127F - Program dmidecode: new - Programs i2cdetect, i2cdump, i2cset, isadump: Now installed by 'make install' - Program mkpatch: Add Config.in entries for, lm92, - pcf8574, pcf8591, smsc47m1, vt1211; - add dmi_scan - Program p4b_smbus: Fix compile for SMP and MODVERSIONS; fix PCI ID problem - Program lm_sensors.init: fix stop() - Program sensord: (v0.6.1) Add /usr/local/etc to config file path; - add support for logging loadavg in RRD; - fix down-converting raw labels for RRD; - update chip support, still behind sensors - Program sensors: Add /usr/local/etc to config file path; - fix -c and -u flags; add vt8231 - Program sensors-detect: recognize Asus "ASB100 Bach" as AS99127F; - refuse to run on IBM systems; - fix sysconfig module numbering; - change quick write to not corrupt 24RF08's - -2.6.4 (20020719) - NOTE: Requires i2c-2.6.1 or newer, or kernel 2.4.13 or newer. - File doc/vid: New - File include/sensors_vid.h: New - File sensors.conf.eg: Add vt1211, smsc47m1 - Library: Add multiple VRM version support for adm1025, w83781d; - fix 'flex scanner jammed' on some systems; - add vt1211, smsc47m1, lm92; - fix access mode checking - Makefiles: For 2.4+ kernels, modules now install in - kernel/drivers/[i2c,sensors] , not misc/ , and - 'make install' removes old versions in misc/ . - Use $CFLAGS and $CPPFLAGS if defined. - Module adm1025: Add multiple VID version support - Module ds1307: new - Module i2c-amd756: Add nVidia nForce support; fix block read length; - reliability improvements - Module i2c-hydra: Flush posted writes - Module i2c-i801: Add support for 82801DB (ICH4) - Module i2c-i810: Flush posted writes - Module i2c-savage4: new - Module i2c-viapro: Add support for VT8231 (0x8235), VT8233A (0x3147) - Module i2c-voodoo3: Flush posted writes - Module ds1307: New - Module lm92: New - Module smbus-arp: new - Module smsc47m1: new - Module via686a: Add support for VT8231 sensors - Module vt1211: new - Module w83781d: Add multiple VID version support; fix temp alarms - Program eeprom: new - Program i2cdump: Add smbus block command specification, add PEC support - Program lm_sensors.init: new - Program mkpatch: Add sensors_vid.h, i2c-savage4, lm92, - pcf8574, pcf8591, smsc47m1, vt1211 - Program p4b_smbus: Add support for ICH4 - Program rrd: Fix swapped CPU and MB temps in summ_week.cgi - Program sensord.init: Renamed, was prog/init/sensors - Program sensord: Major update, now requires rrd source; - not compiled by default - Program sensors: Recognize DDR SDRAM; add adm1025 VID; add -A - (don't display algo. and adap.) option; - add vt1211, smsc47m1, lm92 - Program sensors-detect: Add VT8231, VT8233A, several S3 devices; - add 82801DB, LM85; fix perl warnings; - generate /etc/sysconfig/lm_sensors for - lm_sensors.init script - -2.6.3 (20020322) - NOTE: Requires i2c-2.6.1 or newer, or kernel 2.4.13 or newer. - Chip modules (most): Allow THIS_MODULE definition for kernels 2.2.18+ - File doc/chips/it87: add more temp_type help - File sensors.conf.eg: Un-ignore it87 in8, temp3, fan3; - add adm1021 section; add lm87 AIN[1,2] template; - swap negative voltage limits for 782d,783s,627hf, - 697hf,it87; add more it87 help; swap neg. voltage - limits for lm78(-j), lm79, w83781d, as99127f - Library: Add PCF8591, W83697HF, ADM1023 support; - fix w83* fan_min computes; - swap neg. voltage limits for lm78(-j), lm79, w83781d, as99127f - Module adm1024: Add MODULE_LICENSE("GPL") - Module bt869: Add s-video out and DVD resolution support - Module eeprom: Add support for locations 128-255; rename /proc entries in hex - Module fscscy: implement min/max for voltages and fans - Module i2c-amd756: Add support for AMD768 - Module i2c-i810: Add support for 810E - Module i2c-keywest: Big update, sync with kernel 2.4.18 - Module i2c-piix4: Check for uninitialized base address - Module i2c-sis5595: Blacklist 645, 735 - Module i2c-viapro: Check for uninitialized base address - Module gl518sm: Standardize /proc entries in0-3 - Module lm87: Fix in0, in1, in5 initial limits; ain[1,2] -> in[6,7]; - fan -> fan1; fix temp2 limit writes - Module pcf8574: Add support for PCF8574A; /proc interface changed - Module pcf8591: new - Module sis5595: Blacklist 645, 735 - Module w83781d: Add W83697HF support; allow force_subclients parameter - for Tyan 2460 - Programs decode-dimms.pl, decode-xeon.pl: Update for new /proc names - Program decode-vaio.pl: new - Program i2cdump: Add i2c block read capability (requires i2c-2.6.3); - add text output - Program init/sensors: New SysV init script - Program mkpatch.pl: Add support for fscscy, add more help entries - Program p4b_smbus: new - Program rrd: Install summ_week.cgi - Program sensors: Add PCF8591, W83697HF, ADM1023 support, - clean up chassis intrusion prints - Program sensors-detect: Add several Nvidia chips, add PCF8591, add 810E; - fix Via686a and it87 detection; - add AMD768, IPMI-BMC-KCS and -SMIC; add Via 8231; - fix uninitialized values; it87 beats lm78 - -2.6.2 (20011118) - NOTE: Requires i2c-2.6.1 or newer, or kernel 2.4.13 or newer. - Chip Modules (all): malloc.h -> slab.h - Modules (all): Add MODULE_LICENSE("GPL") - File doc/FAQ: More updates and additions - File sensors.conf.eg: Fix it87 in5,in6 (-12,-5) calculations - Library: Add fscpos and fscscy support, fix gl520 in4 ID, - update it87 alarm ID's. - Module fscpos: new (Fujitsu-Siemens Poseidon driver) - Module fscscy: new (Fujitsu-Siemens Scylla driver) - Module i2c-amd756: Improve busy handling/printk's - Module i2c-i801: Add 82801CA/CAM support - Module i2c-keywest: Sync with PPC people, it works now - Module i2c-piix4: Add Intel 82443MX and SMSC Victory66 support - Module i2c-viapro: Add Via VT8233 support - Module it87: Merge alarm_* /proc entries to alarms - Module sis5595: Fix support for rev B0 - Module via686a: Make limit initializations reliable - Module w83781d: Allow init=0 parameter to bypass initialization - Program isadump: Add flat address space (PCI) support - Program mkpatch.pl: Add support for i2c-ali1535, adm1024, ds1621, - fscpos, it87, maxilife, mtp008 - Program sensors: Fix w83781d temp precision - Program sensors-detect: Add ALI1535, Via VT8233, it87 (i2c), - Fujitsu Poseidon and Scylla, - Intel 82443MX and 82801CA/CAM detection, - add ITE 8172G detection (driver in kernel 2.4.10) - -2.6.1 (20010830) - File BUGS: Updated - File doc/FAQ: More updates and additions - File doc/chips/adm1021: Claim support for Philips NE1617, NE1617A - File sensors.conf.eg: Fix/enhance it87 section - Library: ds1621 and it87 updates - Module i2c-ali15x3: Allow force_addr=0xaddr; enable if not enabled. - Module i2c-amd756: Add AMD 766 support - Module i2c-i801: Fix 82801BA detection broken by kernel 2.4.6 - Module i2c-piix4: Add Serverworks CSB5 support - Module i2c-sis5595: Recognize unsupported chips and refuse to load - Module adm1025: Fixed temp2 min/max writes - Module ds1621: Add 12-bit precision mode - Module it87: Enable all alarms, add in8 support, add sensor type selection - Module sensors: Don't initialize i2c-proc (moved to i2c-core); - remove support for module - Module sis5595: Recognize unsupported chips and refuse to load - Module w83781d: Fix fan speed for as99127f (broken by 2.6.0) - Program eepromer: new - Program mkpatch.pl: Fix dependencies on i2c-proc; disallow compilation - of sensors.c as a module in kernel - Program sensors: it87 updates; adjust temp. precision for some chips - Program sensors-detect: Fix ADM1024 and ADM1025 detection; - recognize unsupported SiS chips; - recognize AMD 766 and Serverworks CSB5. - -2.6.0 (20010612) - NOTE: i2c-2.6.0 MUST BE be compiled AND installed first!!! - If your make fails because it can't find , you - forgot this step!!! - File doc/FAQ: Many, many updates and additions - File doc/busses/i2c-sis5595: new - File doc/busses/i2c-tsunami: new - File doc/chips/it87: new - File doc/chips/via686a: Claim support for 686b. - File README.thinkpad: new - File sensors.conf.eg: Adjust as99127f in5 (-12V) and temp2 calculations; - Add lm87, adm9240, ds1780, lm81 templates; - Enhance help comments in file; - Add Tyan S2510 dual-MTP008 example; - Make separate sis5595 section. - Include file i2c-isa.h: No longer required, moved to i2c.h in i2c package - Include file sensors.h: Most contents moved to i2c-proc.h in i2c package - Library: Fix/standardize some lm87 and mtp008 entries; add sis5595 in4; - Add support for maxilife-nba and amd1024; - Change from sensors_* to i2c_* globals for new i2c-proc.[ch] - Chip Modules (all ISA): Remove #include "i2c-isa.h" - Chip Modules (all): Change from sensors_* to i2c_* globals - for new i2c-proc.[ch] - Makefiles: enhance to support Alpha architecture - Module adm1021: Fix lm84 and gl523sm support - Module adm1024: new - Module i2c-i801: Chip detection cleanup - Module i2c-i810: Fixed i2c_i810_init() not found in patched kernel - Module i2c-sis5595: Allow force_addr=0xaddr; enable if not enabled. - Module i2c-tsunami: New - Module i2c-via: Ensure i2c bus is tristated correctly. - Module it87: new driver for IT8705, IT8712, Sis950 chips - Module lm78: Recognize chipid=0x20 - Module lm87: Fix in0, in1 (2.5V and Vccp1) calculations - Module mtp008: Fix temp initializations; - Save BIOS pin configuration of temps and fans; - Fix sensor type reads/writes and fan min writes; - Fix spurious invalid sensor type messages - Module sensors: Disabled, moved to i2c package as i2c-proc.c; only - used for patched kernel now. - Add xxx_init() calls for drivers added to mkpatch in 2.5.5. - Module sis5595: Fix temp, add in4 for chip revision 0xc0; - Allow force_addr=0xaddr - Module via686a: Allow force_addr=0xaddr (for A7V/K7V boards) - Module w83781d: Don't reinitialize as99127f chip; this may cause fan/temp - reading changes; Add messages for subclient - registration failure - Programs i2cdetect, i2cdump: add devfs /dev/i2c/x support - Program i2cset: new - Program isadump: fix for Alpha arch. compiles - Program mkpatch.pl: Fix adm9240 typos; Add more chips to Configure.help; - Remove ltc1710; Fix i2c_sis5595 typo; - Support kernel 2.4.5 makefile change; - Add i2c-tsunami; fixed i2c-voodoo3 configuration - Program sens_update_rrd: new - Program sensord: Add -d (debug) and -p (pid-file) options - Program sensors: Change reported version from 1.3 to the lm_sensors version; - Fix swapped limit and hysteresis on 9240, 5595, 686a; - Change mtp008 temps from max/min to limit/hyst; - Add maxilife-nba, adm1024, it87 support. - Program sensors-detect: Recognize lm78 with chipid=0x20; - Recognize SMSC Victory66 South Bridge; - Add devfs /dev/i2c/x support; - Add adm1024, it87xx support; Add thinkpad warning. - Program tellerstats: new - -2.5.5 (20010115) - NOTE: i2c-2.5.5 MUST BE be compiled and installed first, UNLESS - you have kernel 2.4.0-prerelease or greater. - Chip modules (all): Update mutex definition (works now for new 2.2 kernels) - File doc/developers/proc: new - File sensors.conf.eg: Add mtp008 entries, adm1025 entries - Library: Add ds1621, mtp008 support - Module adm1021: Add support for adm1021a / adm1023 - Modules adm1021, thmc50: Rename /proc entries to temp[1-2] - Module adm1025: Add support for remote temp; rename /proc entries to - in[0-5] and temp[1-2]; fix negative temp readings - Module adm9240: Rename /proc entries to in[0-5] - Module ddcmon: allow force and force_ddcmon parameters - Module ds1621: new - Module i2c-ali1535: Enhance error checking and recovery; add mutex - Module i2c-i810: Add "dummy write" before reads per Intel prog. ref. - Module i2c-piix4: add support for ServerWorks southbridge OSB4 - Module lm87: cleanup, update voltage calculations - Module mtp008: new - Module pcf8574: change update time to 5 seconds - Modules sis5595, i2c-sis5595: Check for uninitialized base addresses - Module w83781d: fix beep setting via /proc - Programs editticket, readticket: new - Program mkpatch.pl: only works with 2.2 and 2.4 kernels; 2.3 support removed - Program mkpatch.pl: more fixes; now adds many more modules - Program sensors: Add ds1621, mtp008 support; add -f (Fahrenheit) option; - add adm1025 temp2; report temp limits correctly as - min/max or limit/hysteresis; print message if no - sensors are found. Removed false errors from lm87 reads. - Program sensors-detect: Add ds1621, mtp008 detection; - add ServerWorks detection - -2.5.4 (20001012) - Module i2c-viapro: Add support for Via 596B (0x3051) - Program m7101: moved to CVS tree, updated for 2.4.0 kernels - Program mkpatch.pl: fixed infinite loop - Program sensors-detect: Detect Via 596B (0x3051) - -2.5.3 (20001008) - NOTE: i2c 2.5.3 MUST BE be compiled and installed first. - File useful_addresses.html: update - Library: Add lm87 support - Module pcf8574: new - Module i2c-ali1535: new - Module i2c-ali15x3: removed force #ifdef. - Module i2c-i801: support Intel 82801BA (815E chipset) - Module i2c-i801: add i2c block write support, fix smbus block bugs - (requires i2c 2.5.3 package) - Module i2c-i810: support Intel 82815 - Module lm87: new - Module sensors: Fix for kernel 2.4.0-test8 - (remove copy_to_user_ret and put_user_ret) - Module w83781d: limit fan divisors to 8 max. for as99127f - Program decode-dimms: Add html output option, update for SPD spec 1.2B. - Program i2cdump: Add smbus block read support - Programs i2cdetect, i2cdump: Improve error reporting - Program sensors: new switch -u (--unknown) - Program sensors-detect: detect Intel 82801BA (815E chipset) - Program sensors-detect: detect Intel 82815 - Program sensors-detect: detect ITE IT8705F / IT8712F (no driver yet) - Program sensors-detect: detect National LM87 - Program sensors-detect: detect nVidia devices supported by i2c-riva.o - Program sensors-detect: Improve error reporting - -2.5.2 (20000709) - File sensors.conf.eg: Fix lm80 in8 calculation - Module w83781d: W83783S no longer crashes on unloading - Program sensors-detect: more robustness in case of unknown i2c adapters - Program sensors-detect, libsensors: fix eeprom size reporting - Program sensord: more flexibility, support for alarm scanning etc. - Program sensors: support for ignore setting on sensor alarms. - Programs: understand /dev/i2c* files (instead of /dev/i2c-*) too. - -2.5.1 (20000618) - Library: Add adm1025 support - Module adm1025: new - Module ddcmon: Fixed bus scan which could hang SMBus - Module i2c-keywest: new - Module maxilife: Add support for Maxilife '99 (NBA) - Module via686a: Enable sensors if not enabled by BIOS - Module w83781d: Improve w83783s support, w83627hf always has 2 pwm - Module w83781d: Fix sensor2&3 selection, enable VBAT (in8) monitoring - Module w83781d: Remove as99127f entries for in7-8, pwm3-4, sensor1-3 - Module w83781d: Fis as99127f fan speed (was 66% too high) - Module w83781d: Improve beep input checking - Program i2cdump: Add Winbond-style bank selection - Program isadump: Add Winbond-style bank selection - Program sensors: Add adm1025 support. - Program sensors: Remove some as99127f entries, fix as99127 "(beep)" - Program sensors-detect: Fix i801 detection, add adm1025 driver entry - File sensors.conf.eg: Add Maxilife '99 entries - File sensors.conf.eg: Remove some as99127f entries. - Note: For as99127f, reinstall sensors.conf.eg manually (make install - won't reinstall it) or else 'sensors -s' will fail. - -2.5.0 (20000312) - Dropped all kernel 2.0 and 2.1 compatibility - Module i2c-i810: new - Module ddcmon: new - Module via686a: new - Module i2c-amd756: fixed region request - Module i2c-voodoo3: Converted to use i2c-algo-bit layer - Module w83781d: Don't change pin settings at initialization; - also fix chip detection. - Library: Support for ddcmon and via686a - Program sensors-detect: Support for ddcmon and via686a - Program sensors: Support for eeprom, ddcmon and via686a - -2.4.5 (20000116) - Introduced DESTDIR installation prefix - Module lm80: fixes, temperature now read and set correctly - Module i2c-voodoo3: driver enhancements - Module w83781d: fixes, AS99127 works much better now - Library: New ignore keyword in config file - Programs: Support for new ignore keyword - Program sensors-detect: Support for MGA detections - -2.4.4 (19991201) - Addition of the alpha release of AMD 756 SMBus host support. - Many fixes and updates to the gl518sm driver - Updates and fixes for device detection - -2.4.0 (19990920) - Too much to list. - i2c and smbus parts are split off to a separate i2c package. - New drivers and other stuff. - -2.3.4 (19990616) - Module matorb: driver for Matrix-Orbital Displays (small LCD and VFDs) - All: Now compiles against kernel 2.0.x (again ;) - Module gl518sm: some updates and refinements - -2.3.3 (19990603) - All: Now compiles against kernel 2.3.x (x >= 1) - Module i2c-voodoo3: Timing issue fixes - Module bt869: Seems to be functional and relatively well tested - Many modules were modified to be more compatible with the new - Mutex structure in the new experimental kernels. - -2.3.2 (19990507) - Module i2c-hydra: Now compiles on 2.0.x kernels - Module i2c-lm75: Slightly better detection - * New, but not compiled by default: - Module i2c-voodoo3: beginning of Voodoo3 I2C bus driver - Module bt869: Beginning of BT869 (PAL/NTSC video converter) driver - -2.3.1 (19990501) - All: Now compiles on PPC - Module i2c-hydra: NEW - Module i2c-proc: Buffer overflow removed: `less /proc/bus-i2c-0' now works - Module w83781d: Removed deadlock (mutex was not initialized) - Documentation: A few glitches removed - Makefile: default module installation directory is now - /lib/modules/current/extra/misc - Program sensors-detect: PPC Hydra now detected - Program sensors: Now prints complete GL518SM information - Program sensors: SIS5595, ADM1021, MAX1617(A), ADM9240, DS1780 added - -2.3.0 (19990422) - All: Many, many changes and improvements - All: Many small bugs and problems removed - Modules: New insmod parameters - Modules: Much improved chip detection - Module maxilife: NEW - Module adm1021: MAX1617A now also supported - Module adm9240: DS1780 now also supported - Module w83781d: W83782D and W83783S now also supported - Program sensors-detect: NEW - Library: All chips now supported - Documentation: Very much improved - -2.2.2 (199903??) - Just some minor updates and bug fixes. - -2.2.1 (19990218) - All: Removed compile warnings - Module i2c-dev: Small bug removed if DEBUG=1 was used - Module sis5595: Now compiles for 2.0 kernels - Module adm1021: Detection corrected - -2.2.0 (19990216) - All: Set copyrights to include 1999 - All: Small bugfixes - I2C: Upgraded to newest archive of Simon Vogl - Module i2c-dev: NEW - Module i2c-ali15x3: NEW - Module i2c-via: This is old module bit-mb, now moved to the main lm_sensors - directories, and somewhat improved - Module sis5595: NEW - Modules: Renamed all bus modules to i2c-*, new directory lay-out - Library: Support for new chip drivers, several small bugs fixed - Library manual pages: NEW - Program i2cdetect: Moved to detect directory - Program detect.pl: NEW - Program doc-features: NEW - Program sensors: Added man-page - Document BUGS: Added cdrom bug and kernel i2c conflict - -2.1.2 (19990116) - Modules lm80.o, w83781d.o: fan-related Segmentation fault corrected - Module gl518sm.o: yet more bug fixes. It should at long last be usable now - Documentation in doc/kernel: NEW - -2.1.1 (19990107) - Module i2c-proc.o: Hack to make /proc/bus/ possible for kernels 2.0.35 - and older - Module gl518sm.o: Miscelaneous bugs and problems solved - Program isadump: NEW - -2.1.0 (19981230) - Library: Completely NEW - Program sensors: NEW - Program grab_busses: NEW - Program decode-dimms: More information - Module bit-mb.o: Removed spurious semicolon; now runs on more VIA chipsets - Module w83781d.o: NEW - Module lm80.o: NEW - Module gl518sm.o: new procfile beep, several small updates - Modules: Now use pin readings, no more scaling within the kernel (use the - library instead) - -2.0.2 (19981214) - Module eeprom.o: NEW - Program decode-dimms: NEW - Modules: fill_inode fix, will stop segfaults on unloading in kernels after - 2.1.58 - Modules: Somewhat less verbose on transfers - Module lm78.o now recognizes and handles lm78-j and lm79 - -2.0.1 (1998121?) - Module gl518sm.o updates, to make it actually work - Module lm75.o high/low-byte swapping write bug fixed - -2.0.0 (19981209) +3.0.0-rc1 (2007-09-25) Initial release From 015b75888c42876d0fd93aabff634ce9c1086ee4 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 25 Sep 2007 16:22:35 +0000 Subject: [PATCH 335/718] The LSM has a new address. Update the LSM record to format 4 (date in ISO8601 format). Update for release 3.0.0-rc1. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4882 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/developers/lm_sensors.lsm | 22 ++++++++++++---------- doc/developers/release_checklist | 5 +++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/doc/developers/lm_sensors.lsm b/doc/developers/lm_sensors.lsm index f197b53a..57e2cb2e 100644 --- a/doc/developers/lm_sensors.lsm +++ b/doc/developers/lm_sensors.lsm @@ -1,16 +1,18 @@ -Begin3 +Begin4 Title: lm_sensors -Version: 2.10.3 -Entered-date: 29DEC98 +Version: 3.0.0-rc1 +Entered-date: 2007-09-25 Description: Hardware health monitoring package for Linux. It consists of a library to allow applications to read sensors data more easily, and of an example program to pretty print this data. - Version 2 is a complete non-compatible modular rewrite of this - package. -Keywords: sensors health -Author: frodol@dds.nl (Frodo Looijaard) - phil@netroedge.com (Philip Edelbrock) - and other great contributors -Primary-site: http://www.lm-sensors.org/ + Also included is a fan speed control script. + http://www.lm-sensors.org/ +Keywords: sensors health hardware-monitoring fan-speed +Author: khali@linux-fr.org (Jean Delvare) +Maintained-by: khali@linux-fr.org (Jean Delvare) +Primary-site: http://dl.lm-sensors.org /lm-sensors/releases/ + lm_sensors-3.0.0-rc1.tar.gz + lm_sensors-3.0.0-rc1.tar.gz.asc +Alternate-site: ftp.netroedge.com /pub/lm-sensors/ Copying-policy: GPL End diff --git a/doc/developers/release_checklist b/doc/developers/release_checklist index 33efc2d0..31eb3912 100644 --- a/doc/developers/release_checklist +++ b/doc/developers/release_checklist @@ -9,8 +9,9 @@ Release steps: functionality is added, and patch if only bugs are fixed. `svn diff -r Vx-y-z lib' is your friend. - Update the CHANGES file (add the release date) -- Update lm_sensors.lsm and send it to the LSM by mailing it to - lsm@execpc.com with the subject `add' (no quotes). +- Update lm_sensors.lsm (Version, Entered-date and Primary-site) and send + it to the LSM by mailing it to lsm@qqx.org with the subject `add' (no + quotes). - Update version.h - Commit - Tag the release using SVN: From fa561e34c9f3b08ed6df86bbbde235c03f12fd23 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 25 Sep 2007 16:25:41 +0000 Subject: [PATCH 336/718] Prepare for 3.0.0-rc1 release. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4883 7894878c-1315-0410-8ee3-d5d059ff63e0 --- version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.h b/version.h index 8310b132..a34d6166 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define LM_VERSION "3.0.0-pre" +#define LM_VERSION "3.0.0-rc1" From c6e52a0e1e4353ceaac6b1ebba96e93ff4d9e03f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 25 Sep 2007 16:45:44 +0000 Subject: [PATCH 337/718] Now that we use SVN, there are no empty directories to delete. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4885 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/developers/release_checklist | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/developers/release_checklist b/doc/developers/release_checklist index 31eb3912..bab3db89 100644 --- a/doc/developers/release_checklist +++ b/doc/developers/release_checklist @@ -18,7 +18,6 @@ Release steps: svn copy http://lm-sensors.org/svn/lm-sensors/trunk \ http://lm-sensors.org/svn/lm-sensors/tags/V2-x-x \ -m "Create tag 'V2-x-x'." -- Remove empty directories (e.g. rmdir `find . -type d`) - Remove 'SVN' related files/directories (e.g. rm -fR `find . -name .svn`) - Rename lm_sensors2 to lm_sensors-#.#.# - Tar it up and post it (sign it) From 43e4f551b7fb51ca467dfaf95aaa452631d2a147 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 26 Sep 2007 17:15:13 +0000 Subject: [PATCH 338/718] Log the error code on failure, to make it easier to investigate problems. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4888 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 3 +++ prog/sensord/sensord.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 59386a18..74b9a482 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ lm-sensors CHANGES file ----------------------- +SVN + sensord: Log the error code on failure + 3.0.0-rc1 (2007-09-25) Initial release diff --git a/prog/sensord/sensord.c b/prog/sensord/sensord.c index 85baf7c4..68ff48e5 100644 --- a/prog/sensord/sensord.c +++ b/prog/sensord/sensord.c @@ -117,7 +117,10 @@ sensord } } - sensorLog (LOG_INFO, "sensord %s", ret ? "failed" : "stopped"); + if (ret) + sensorLog (LOG_INFO, "sensord failed (%d)", ret); + else + sensorLog (LOG_INFO, "sensord stopped"); return ret; } From 7a2931c852a1c9a146341bb67a2a9f110e4ce684 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 26 Sep 2007 17:17:30 +0000 Subject: [PATCH 339/718] V2 -> V3. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4889 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/developers/release_checklist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/developers/release_checklist b/doc/developers/release_checklist index bab3db89..11ddbc86 100644 --- a/doc/developers/release_checklist +++ b/doc/developers/release_checklist @@ -15,11 +15,11 @@ Release steps: - Update version.h - Commit - Tag the release using SVN: - svn copy http://lm-sensors.org/svn/lm-sensors/trunk \ - http://lm-sensors.org/svn/lm-sensors/tags/V2-x-x \ - -m "Create tag 'V2-x-x'." + svn copy http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0 \ + http://lm-sensors.org/svn/lm-sensors/tags/V3-x-x \ + -m "3.x.x release" - Remove 'SVN' related files/directories (e.g. rm -fR `find . -name .svn`) -- Rename lm_sensors2 to lm_sensors-#.#.# +- Rename the base directory to lm_sensors-3.x.x - Tar it up and post it (sign it) - Make sure the file permissions on both the archive and the signature are correct (664) From 19b4cf5e37e52eb7e1dbd5957a505fd857092100 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 26 Sep 2007 21:28:04 +0000 Subject: [PATCH 340/718] Fix spurious critical temperature alarm. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4892 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/chips.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 74b9a482..6f0f1068 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ lm-sensors CHANGES file SVN sensord: Log the error code on failure + sensors: Fix spurious critical temperature alarm 3.0.0-rc1 (2007-09-25) Initial release diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index bdec0d26..54fd3b47 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -246,8 +246,7 @@ static void print_chip_temp(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_CRIT_ALARM); - if (sf && get_value(name, sf->number)) - alarm |= 1; + alarm = sf && get_value(name, sf->number); printf("\n%*s", label_size + 10, ""); print_temp_limits(limit1, limit2, s1, s2, alarm); From 4db0f60d9a92c58d6b2e03950696ed0431124f6f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 26 Sep 2007 21:52:50 +0000 Subject: [PATCH 341/718] Install sensors-conf-convert as part of "make install". Users may need to convert their configuration file after installation, in particular if they install a distribution package. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4893 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + etc/Module.mk | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGES b/CHANGES index 6f0f1068..2340b9bd 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ lm-sensors CHANGES file ----------------------- SVN + Makefile: Add sensors-conf-convert to make install sensord: Log the error code on failure sensors: Fix spurious critical temperature alarm diff --git a/etc/Module.mk b/etc/Module.mk index 389c30b4..f71eb08a 100644 --- a/etc/Module.mk +++ b/etc/Module.mk @@ -31,6 +31,14 @@ install-etc: if [ ! -e $(DESTDIR)$(ETCINSTALL) ] ; then \ $(INSTALL) -m 644 $(ETCTARGET) $(DESTDIR)$(ETCINSTALL); \ fi + $(MKDIR) $(DESTDIR)$(BINDIR) + $(INSTALL) -m 755 $(MODULE_DIR)/sensors-conf-convert $(DESTDIR)$(BINDIR) + user_install :: install-etc +uninstall-etc: + $(RM) $(DESTDIR)$(BINDIR)/sensors-conf-convert + +user_uninstall :: uninstall-etc + # No clean rule From 1124e53305a8727f89840afa26375c915ce277ec Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 26 Sep 2007 22:05:47 +0000 Subject: [PATCH 342/718] Add a short help text to sensors-conf-convert. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4894 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + etc/sensors-conf-convert | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES b/CHANGES index 2340b9bd..20894860 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ SVN Makefile: Add sensors-conf-convert to make install sensord: Log the error code on failure sensors: Fix spurious critical temperature alarm + sensors-conf-convert: Add a short help text 3.0.0-rc1 (2007-09-25) Initial release diff --git a/etc/sensors-conf-convert b/etc/sensors-conf-convert index 57cf77f6..d92ce67b 100755 --- a/etc/sensors-conf-convert +++ b/etc/sensors-conf-convert @@ -363,6 +363,12 @@ BEGIN qr/\bfan\d_(max|safe)\b/, ], ); + + if (defined $ARGV[0] && ($ARGV[0] eq '-h' || $ARGV[0] eq '--help')) { + print "Convert sensors.conf from lm-sensors 2 format to lm-sensors 3 format\n", + "Typical usage: sensors-conf-convert /etc/sensors.conf\n"; + exit 0; + } } if ($. == 1) { From 301e18b511b8cc3f126a5723902d5ba7ad778114 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 29 Sep 2007 11:57:37 +0000 Subject: [PATCH 343/718] libsensors: Notify the caller when writing a value fails. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4895 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/sysfs.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 20894860..906b3666 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ lm-sensors CHANGES file SVN Makefile: Add sensors-conf-convert to make install + libsensors: Notify the caller when writing a value fails sensord: Log the error code on failure sensors: Fix spurious critical temperature alarm sensors-conf-convert: Add a short help text diff --git a/lib/sysfs.c b/lib/sysfs.c index 8317a932..f869cb13 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -577,9 +577,11 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "w"))) { + int res; value *= get_type_scaling(subfeature->type); - fprintf(f, "%d", (int) value); - fclose(f); + res = fprintf(f, "%d", (int) value); + if (fclose(f) || res < 0) + return -SENSORS_ERR_ACCESS_W; } else return -SENSORS_ERR_KERNEL; From 2c642d01e1e83d5739fbdd790903c44649b1fe24 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 29 Sep 2007 12:46:36 +0000 Subject: [PATCH 344/718] libsensors: Differentiate between different read error types. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4896 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/sysfs.c | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 906b3666..21b173fd 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm-sensors CHANGES file SVN Makefile: Add sensors-conf-convert to make install libsensors: Notify the caller when writing a value fails + Differentiate between different read error types sensord: Log the error code on failure sensors: Fix spurious critical temperature alarm sensors-conf-convert: Add a short help text diff --git a/lib/sysfs.c b/lib/sysfs.c index f869cb13..dbcd505a 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -558,9 +558,8 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "r"))) { int res = fscanf(f, "%lf", value); - fclose(f); - if (res != 1) - return -SENSORS_ERR_KERNEL; + if (fclose(f) || res != 1) + return -SENSORS_ERR_ACCESS_R; *value /= get_type_scaling(subfeature->type); } else return -SENSORS_ERR_KERNEL; From a26960485330535556f5935c7784b887899ccb4e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 29 Sep 2007 14:31:07 +0000 Subject: [PATCH 345/718] sensors: Print error messages to stderr. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4897 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/chips.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 21b173fd..a2592c58 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,7 @@ SVN Differentiate between different read error types sensord: Log the error code on failure sensors: Fix spurious critical temperature alarm + Print error messages to stderr sensors-conf-convert: Add a short help text 3.0.0-rc1 (2007-09-25) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 54fd3b47..625556fb 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -39,7 +39,7 @@ void print_chip_raw(const sensors_chip_name *name) a = 0; while ((feature = sensors_get_features(name, &a))) { if (!(label = sensors_get_label(name, feature))) { - printf("ERROR: Can't get feature label!\n"); + fprintf(stderr, "ERROR: Can't get feature label!\n"); continue; } printf("%s:\n", label); @@ -49,8 +49,9 @@ void print_chip_raw(const sensors_chip_name *name) while ((sub = sensors_get_all_subfeatures(name, feature, &b))) { if (sub->flags & SENSORS_MODE_R) { if (sensors_get_value(name, sub->number, &val)) - printf("ERROR: Can't get feature `%s' " - "data!\n", sub->name); + fprintf(stderr, "ERROR: Can't get " + "feature `%s' data!\n", + sub->name); else printf(" %s: %.2f\n", sub->name, val); } else @@ -77,8 +78,8 @@ static double get_value(const sensors_chip_name *name, int subfeat_nr) err = sensors_get_value(name, subfeat_nr, &val); if (err) { - printf("ERROR: Can't get value of subfeature %d: %s\n", - subfeat_nr, sensors_strerror(err)); + fprintf(stderr, "ERROR: Can't get value of subfeature %d: %s\n", + subfeat_nr, sensors_strerror(err)); val = 0; } return val; @@ -135,7 +136,7 @@ static void print_chip_temp(const sensors_chip_name *name, char *label; if (!(label = sensors_get_label(name, feature))) { - printf("ERROR: Can't get temperature label!\n"); + fprintf(stderr, "ERROR: Can't get temperature label!\n"); return; } print_label(label, label_size); @@ -283,7 +284,7 @@ static void print_chip_in(const sensors_chip_name *name, char *label; if (!(label = sensors_get_label(name, feature))) { - printf("ERROR: Can't get in label!\n"); + fprintf(stderr, "ERROR: Can't get in label!\n"); return; } print_label(label, label_size); @@ -346,7 +347,7 @@ static void print_chip_fan(const sensors_chip_name *name, double val; if (!(label = sensors_get_label(name, feature))) { - printf("ERROR: Can't get fan label!\n"); + fprintf(stderr, "ERROR: Can't get fan label!\n"); return; } print_label(label, label_size); From fa1f1aef327aad646ca492bda0d4fd4e924e962b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 29 Sep 2007 18:11:38 +0000 Subject: [PATCH 346/718] sensors: Make error messages more helpful and consistent. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4898 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/chips.c | 98 ++++++++++++++++++++++++-------------------- 2 files changed, 54 insertions(+), 45 deletions(-) diff --git a/CHANGES b/CHANGES index a2592c58..82af4b7f 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ SVN sensord: Log the error code on failure sensors: Fix spurious critical temperature alarm Print error messages to stderr + Make error messages more helpful and consistent sensors-conf-convert: Add a short help text 3.0.0-rc1 (2007-09-25) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 625556fb..d514b1a1 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -3,6 +3,7 @@ Copyright (c) 1998-2003 Frodo Looijaard and Mark D. Studebaker Copyright (c) 2003-2006 The lm_sensors team + Copytight (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +31,7 @@ void print_chip_raw(const sensors_chip_name *name) { - int a, b; + int a, b, err; const sensors_feature *feature; const sensors_subfeature *sub; char *label; @@ -39,7 +40,8 @@ void print_chip_raw(const sensors_chip_name *name) a = 0; while ((feature = sensors_get_features(name, &a))) { if (!(label = sensors_get_label(name, feature))) { - fprintf(stderr, "ERROR: Can't get feature label!\n"); + fprintf(stderr, "ERROR: Can't get label of feature " + "%s!\n", feature->name); continue; } printf("%s:\n", label); @@ -48,10 +50,12 @@ void print_chip_raw(const sensors_chip_name *name) b = 0; while ((sub = sensors_get_all_subfeatures(name, feature, &b))) { if (sub->flags & SENSORS_MODE_R) { - if (sensors_get_value(name, sub->number, &val)) + if ((err = sensors_get_value(name, sub->number, + &val))) fprintf(stderr, "ERROR: Can't get " - "feature `%s' data!\n", - sub->name); + "value of subfeature %s: %s\n", + sub->name, + sensors_strerror(err)); else printf(" %s: %.2f\n", sub->name, val); } else @@ -71,15 +75,16 @@ static void print_label(const char *label, int space) printf("%s:%*s", label, space - len, ""); } -static double get_value(const sensors_chip_name *name, int subfeat_nr) +static double get_value(const sensors_chip_name *name, + const sensors_subfeature *sub) { double val; int err; - err = sensors_get_value(name, subfeat_nr, &val); + err = sensors_get_value(name, sub->number, &val); if (err) { - fprintf(stderr, "ERROR: Can't get value of subfeature %d: %s\n", - subfeat_nr, sensors_strerror(err)); + fprintf(stderr, "ERROR: Can't get value of subfeature %s: %s\n", + sub->name, sensors_strerror(err)); val = 0; } return val; @@ -136,7 +141,8 @@ static void print_chip_temp(const sensors_chip_name *name, char *label; if (!(label = sensors_get_label(name, feature))) { - fprintf(stderr, "ERROR: Can't get temperature label!\n"); + fprintf(stderr, "ERROR: Can't get label of feature %s!\n", + feature->name); return; } print_label(label, label_size); @@ -144,11 +150,11 @@ static void print_chip_temp(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_INPUT); - val = sf ? get_value(name, sf->number) : 0; + val = sf ? get_value(name, sf) : 0; sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_ALARM); - alarm = sf && get_value(name, sf->number); + alarm = sf && get_value(name, sf); sfmin = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_MIN); @@ -159,35 +165,35 @@ static void print_chip_temp(const sensors_chip_name *name, if (sfmax) { sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_MAX_ALARM); - if (sf && get_value(name, sf->number)) + if (sf && get_value(name, sf)) alarm |= 1; if (sfmin) { - limit1 = get_value(name, sfmin->number); + limit1 = get_value(name, sfmin); s1 = "low"; - limit2 = get_value(name, sfmax->number); + limit2 = get_value(name, sfmax); s2 = "high"; sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_MIN_ALARM); - if (sf && get_value(name, sf->number)) + if (sf && get_value(name, sf)) alarm |= 1; } else { - limit1 = get_value(name, sfmax->number); + limit1 = get_value(name, sfmax); s1 = "high"; sfhyst = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_MAX_HYST); if (sfhyst) { - limit2 = get_value(name, sfhyst->number); + limit2 = get_value(name, sfhyst); s2 = "hyst"; } else if (sfcrit) { - limit2 = get_value(name, sfcrit->number); + limit2 = get_value(name, sfcrit); s2 = "crit"; sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_CRIT_ALARM); - if (sf && get_value(name, sf->number)) + if (sf && get_value(name, sf)) alarm |= 1; crit_displayed = 1; } else { @@ -196,13 +202,13 @@ static void print_chip_temp(const sensors_chip_name *name, } } } else if (sfcrit) { - limit1 = get_value(name, sfcrit->number); + limit1 = get_value(name, sfcrit); s1 = "crit"; sfhyst = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_CRIT_HYST); if (sfhyst) { - limit2 = get_value(name, sfhyst->number); + limit2 = get_value(name, sfhyst); s2 = "hyst"; } else { limit2 = 0; @@ -211,7 +217,7 @@ static void print_chip_temp(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_CRIT_ALARM); - if (sf && get_value(name, sf->number)) + if (sf && get_value(name, sf)) alarm |= 1; crit_displayed = 1; } else { @@ -222,7 +228,7 @@ static void print_chip_temp(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_FAULT); - if (sf && get_value(name, sf->number)) { + if (sf && get_value(name, sf)) { printf(" FAULT "); } else { if (fahrenheit) @@ -232,13 +238,13 @@ static void print_chip_temp(const sensors_chip_name *name, print_temp_limits(limit1, limit2, s1, s2, alarm); if (!crit_displayed && sfcrit) { - limit1 = get_value(name, sfcrit->number); + limit1 = get_value(name, sfcrit); s1 = "crit"; sfhyst = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_CRIT_HYST); if (sfhyst) { - limit2 = get_value(name, sfhyst->number); + limit2 = get_value(name, sfhyst); s2 = "hyst"; } else { limit2 = 0; @@ -247,7 +253,7 @@ static void print_chip_temp(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_CRIT_ALARM); - alarm = sf && get_value(name, sf->number); + alarm = sf && get_value(name, sf); printf("\n%*s", label_size + 10, ""); print_temp_limits(limit1, limit2, s1, s2, alarm); @@ -257,7 +263,7 @@ static void print_chip_temp(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_TYPE); if (sf) { - int sens = (int)get_value(name, sf->number); + int sens = (int)get_value(name, sf); /* older kernels / drivers sometimes report a beta value for thermistors */ @@ -284,7 +290,8 @@ static void print_chip_in(const sensors_chip_name *name, char *label; if (!(label = sensors_get_label(name, feature))) { - fprintf(stderr, "ERROR: Can't get in label!\n"); + fprintf(stderr, "ERROR: Can't get label of feature %s!\n", + feature->name); return; } print_label(label, label_size); @@ -292,7 +299,7 @@ static void print_chip_in(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_INPUT); - val = sf ? get_value(name, sf->number) : 0; + val = sf ? get_value(name, sf) : 0; printf("%+6.2f V", val); sfmin = sensors_get_subfeature(name, feature, @@ -301,14 +308,14 @@ static void print_chip_in(const sensors_chip_name *name, SENSORS_SUBFEATURE_IN_MAX); if (sfmin && sfmax) printf(" (min = %+6.2f V, max = %+6.2f V)", - get_value(name, sfmin->number), - get_value(name, sfmax->number)); + get_value(name, sfmin), + get_value(name, sfmax)); else if (sfmin) printf(" (min = %+6.2f V)", - get_value(name, sfmin->number)); + get_value(name, sfmin)); else if (sfmax) printf(" (max = %+6.2f V)", - get_value(name, sfmax->number)); + get_value(name, sfmax)); sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_ALARM); @@ -317,8 +324,8 @@ static void print_chip_in(const sensors_chip_name *name, sfmax = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_MAX_ALARM); if (sfmin || sfmax) { - alarm_max = sfmax ? get_value(name, sfmax->number) : 0; - alarm_min = sfmin ? get_value(name, sfmin->number) : 0; + alarm_max = sfmax ? get_value(name, sfmax) : 0; + alarm_min = sfmin ? get_value(name, sfmin) : 0; if (alarm_min || alarm_max) { printf(" ALARM ("); @@ -332,7 +339,7 @@ static void print_chip_in(const sensors_chip_name *name, } } else if (sf) { printf(" %s", - get_value(name, sf->number) ? "ALARM" : ""); + get_value(name, sf) ? "ALARM" : ""); } printf("\n"); @@ -347,7 +354,8 @@ static void print_chip_fan(const sensors_chip_name *name, double val; if (!(label = sensors_get_label(name, feature))) { - fprintf(stderr, "ERROR: Can't get fan label!\n"); + fprintf(stderr, "ERROR: Can't get label of feature %s!\n", + feature->name); return; } print_label(label, label_size); @@ -355,10 +363,10 @@ static void print_chip_fan(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_INPUT); - val = sf ? get_value(name, sf->number) : 0; + val = sf ? get_value(name, sf) : 0; sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_FAULT); - if (sf && get_value(name, sf->number)) + if (sf && get_value(name, sf)) printf(" FAULT"); else printf("%4.0f RPM", val); @@ -369,18 +377,18 @@ static void print_chip_fan(const sensors_chip_name *name, SENSORS_SUBFEATURE_FAN_DIV); if (sfmin && sfdiv) printf(" (min = %4.0f RPM, div = %1.0f)", - get_value(name, sfmin->number), - get_value(name, sfdiv->number)); + get_value(name, sfmin), + get_value(name, sfdiv)); else if (sfmin) printf(" (min = %4.0f RPM)", - get_value(name, sfmin->number)); + get_value(name, sfmin)); else if (sfdiv) printf(" (div = %1.0f)", - get_value(name, sfdiv->number)); + get_value(name, sfdiv)); sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_ALARM); - if (sf && get_value(name, sf->number)) { + if (sf && get_value(name, sf)) { printf(" ALARM"); } From 8a62e5f651b0a6c85deb7b7897642966ecd3bfd6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 29 Sep 2007 18:48:20 +0000 Subject: [PATCH 347/718] libsensors: Report I/O errors as such. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4899 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + lib/error.c | 1 + lib/error.h | 1 + lib/sysfs.c | 40 ++++++++++++++++++++++++++++++++++------ 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 82af4b7f..0b813022 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ SVN Makefile: Add sensors-conf-convert to make install libsensors: Notify the caller when writing a value fails Differentiate between different read error types + Report I/O errors as such sensord: Log the error code on failure sensors: Fix spurious critical temperature alarm Print error messages to stderr diff --git a/lib/error.c b/lib/error.c index cf3fa9a7..cbb94a34 100644 --- a/lib/error.c +++ b/lib/error.c @@ -42,6 +42,7 @@ static const char *errorlist[] = { /* SENSORS_ERR_BUS_NAME */ "Can't parse bus name", /* SENSORS_ERR_PARSE */ "General parse error", /* SENSORS_ERR_ACCESS_W */ "Can't write", + /* SENSORS_ERR_IO */ "I/O error", }; const char *sensors_strerror(int errnum) diff --git a/lib/error.h b/lib/error.h index 66dd1294..4684173e 100644 --- a/lib/error.h +++ b/lib/error.h @@ -30,6 +30,7 @@ #define SENSORS_ERR_BUS_NAME 7 /* Can't parse bus name */ #define SENSORS_ERR_PARSE 8 /* General parse error */ #define SENSORS_ERR_ACCESS_W 9 /* Can't write */ +#define SENSORS_ERR_IO 10 /* I/O error */ #ifdef __cplusplus extern "C" { diff --git a/lib/sysfs.c b/lib/sysfs.c index dbcd505a..daad9d02 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -557,9 +557,24 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "r"))) { - int res = fscanf(f, "%lf", value); - if (fclose(f) || res != 1) - return -SENSORS_ERR_ACCESS_R; + int res, err = 0; + + errno = 0; + res = fscanf(f, "%lf", value); + if (res == EOF && errno == EIO) + err = -SENSORS_ERR_IO; + else if (res != 1) + err = -SENSORS_ERR_ACCESS_R; + res = fclose(f); + if (err) + return err; + + if (res == EOF) { + if (errno == EIO) + return -SENSORS_ERR_IO; + else + return -SENSORS_ERR_ACCESS_R; + } *value /= get_type_scaling(subfeature->type); } else return -SENSORS_ERR_KERNEL; @@ -576,11 +591,24 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "w"))) { - int res; + int res, err = 0; + value *= get_type_scaling(subfeature->type); res = fprintf(f, "%d", (int) value); - if (fclose(f) || res < 0) - return -SENSORS_ERR_ACCESS_W; + if (res == -EIO) + err = -SENSORS_ERR_IO; + else if (res < 0) + err = -SENSORS_ERR_ACCESS_W; + res = fclose(f); + if (err) + return err; + + if (res == EOF) { + if (errno == EIO) + return -SENSORS_ERR_IO; + else + return -SENSORS_ERR_ACCESS_W; + } } else return -SENSORS_ERR_KERNEL; From 855b1aa6efc6118a8666d0b6e2d65af6b0d70f44 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 29 Sep 2007 19:08:30 +0000 Subject: [PATCH 348/718] The lm-sensors team has no legal existence and thus can't hold a copyright. I tried to assign the copyright back to the original author where possible. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4900 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/chips/SUMMARY | 4 ---- prog/detect/sensors-detect | 3 +-- prog/dump/isadump.c | 2 +- prog/dump/isaset.c | 2 +- prog/pwm/pwmconfig | 1 - prog/sensors/chips.c | 7 +++---- prog/tellerstats/gather.sh | 2 +- prog/tellerstats/tellerstats.sh | 2 +- 8 files changed, 8 insertions(+), 15 deletions(-) diff --git a/doc/chips/SUMMARY b/doc/chips/SUMMARY index c3900b00..3be9b396 100644 --- a/doc/chips/SUMMARY +++ b/doc/chips/SUMMARY @@ -298,7 +298,3 @@ This may help identify a chip after doing a 'i2cdump [bus] [address]'. 0xDA Dallas [A-Z]{3} at 0x00-0x02: Fujitsu-Siemens - - ------------------- -Copyright (c) 2001-2005 The lm_sensors group diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 5ad9eec7..34e17cf0 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -3,8 +3,7 @@ # # sensors-detect - Detect PCI bus and chips # Copyright (C) 1998 - 2002 Frodo Looijaard -# Copyright (C) 2000 - 2004 The lm_sensors team -# Copyright (C) 2005 - 2007 Jean Delvare +# Copyright (C) 2004 - 2007 Jean Delvare # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/prog/dump/isadump.c b/prog/dump/isadump.c index 55fd9005..968947a8 100644 --- a/prog/dump/isadump.c +++ b/prog/dump/isadump.c @@ -2,7 +2,7 @@ isadump.c - isadump, a user-space program to dump ISA registers Copyright (C) 2000 Frodo Looijaard , and Mark D. Studebaker - Copyright (C) 2004 The lm_sensors group + Copyright (C) 2004,2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/prog/dump/isaset.c b/prog/dump/isaset.c index c8b9ecfa..bd88cbf8 100644 --- a/prog/dump/isaset.c +++ b/prog/dump/isaset.c @@ -2,7 +2,7 @@ isaset.c - isaset, a user-space program to write ISA registers Copyright (C) 2000 Frodo Looijaard , and Mark D. Studebaker - Copyright (C) 2004 The lm_sensors group + Copyright (C) 2004,2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/prog/pwm/pwmconfig b/prog/pwm/pwmconfig index 1a900677..3ac750f3 100755 --- a/prog/pwm/pwmconfig +++ b/prog/pwm/pwmconfig @@ -9,7 +9,6 @@ # Verify that all fans are running at normal speed after this # program has exited!!! # -# Copyright 2003-2005 The lm_sensors project # Copyright (C) 2007 Jean Delvare # # This program is free software; you can redistribute it and/or modify diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index d514b1a1..7da51a81 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -1,9 +1,8 @@ /* chips.c - Part of sensors, a user-space program for hardware monitoring - Copyright (c) 1998-2003 Frodo Looijaard - and Mark D. Studebaker - Copyright (c) 2003-2006 The lm_sensors team - Copytight (C) 2007 Jean Delvare + Copyright (C) 1998-2003 Frodo Looijaard and + Mark D. Studebaker + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/prog/tellerstats/gather.sh b/prog/tellerstats/gather.sh index 67e8cb9f..d2be1e79 100755 --- a/prog/tellerstats/gather.sh +++ b/prog/tellerstats/gather.sh @@ -6,7 +6,7 @@ # Don't run manually as root or else files in data/ will get # root ownership then your (non-root) cron daemon won't work # -# Copyright 2001 The lm_sensors group +# Copyright (C) 2001 Philip Edelbrock # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/prog/tellerstats/tellerstats.sh b/prog/tellerstats/tellerstats.sh index 2b8327c6..aaccf6e2 100755 --- a/prog/tellerstats/tellerstats.sh +++ b/prog/tellerstats/tellerstats.sh @@ -3,7 +3,7 @@ # tellerstats.sh 3 # generate graphs from the data # -# Copyright 2001 The lm_sensors group +# Copyright (C) 2001 Philip Edelbrock # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by From 46d3a180cd24ff45dbc7e731b61c7b9566be0d99 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 29 Sep 2007 19:11:31 +0000 Subject: [PATCH 349/718] Discard a paranoid test in outb(). git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4901 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 8 -------- 1 file changed, 8 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 34e17cf0..c52a9164 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2185,14 +2185,6 @@ sub inb # Returns: -1 on failure, 0 on success. sub outb { - if ($_[1] > 0xff) - { - my ($package, $filename, $line, $sub) = caller(1); - print "\n*** Called outb with value=$_[1] from line $line\n", - "*** (in $sub). PLEASE REPORT!\n", - "*** Terminating.\n"; - exit(-1); - } my $towrite = pack "C", $_[1]; sysseek IOPORTS, $_[0], 0 or return -1; my $nrchars = syswrite IOPORTS, $towrite, 1; From 647b47cb6acd52fb43198548392f4a84c2374dc1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 29 Sep 2007 19:18:15 +0000 Subject: [PATCH 350/718] Add my copyright everywhere it is missing. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4902 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.h | 1 + lib/data.h | 1 + lib/init.c | 1 + lib/sysfs.h | 3 ++- prog/sensors/chips.h | 1 + prog/sensors/main.c | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/access.h b/lib/access.h index bd735f41..e1e72cab 100644 --- a/lib/access.h +++ b/lib/access.h @@ -1,6 +1,7 @@ /* access.h - Part of libsensors, a Linux library for reading sensor data. Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/data.h b/lib/data.h index 04d466ff..113c08c0 100644 --- a/lib/data.h +++ b/lib/data.h @@ -1,6 +1,7 @@ /* data.h - Part of libsensors, a Linux library for reading sensor data. Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/init.c b/lib/init.c index e06696d8..5f80a274 100644 --- a/lib/init.c +++ b/lib/init.c @@ -1,6 +1,7 @@ /* init.c - Part of libsensors, a Linux library for reading sensor data. Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/sysfs.h b/lib/sysfs.h index f547bd7d..db56fee4 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -1,6 +1,7 @@ /* sysfs.h - part of libsensors, a library for reading Linux sensor data - Copyright (C) Mark M. Hoffman + Copyright (C) Mark M. Hoffman + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index 06b82bc0..3e1a29c7 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -1,6 +1,7 @@ /* chips.h - Part of sensors, a user-space program for hardware monitoring Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/prog/sensors/main.c b/prog/sensors/main.c index d1e723b0..74ebb94f 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -1,6 +1,7 @@ /* main.c - Part of sensors, a user-space program for hardware monitoring Copyright (c) 1998, 1999 Frodo Looijaard + Copyright (C) 2007 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From e012d14d95344f4bd885f155d11eb603f64104bc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 30 Sep 2007 17:56:19 +0000 Subject: [PATCH 351/718] sensors: Better handling of the fault flags. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4910 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/chips.c | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index 0b813022..2f9804cc 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ SVN sensors: Fix spurious critical temperature alarm Print error messages to stderr Make error messages more helpful and consistent + Better handling of the fault flags sensors-conf-convert: Add a short help text 3.0.0-rc1 (2007-09-25) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 7da51a81..0c9f8e99 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -147,10 +147,6 @@ static void print_chip_temp(const sensors_chip_name *name, print_label(label, label_size); free(label); - sf = sensors_get_subfeature(name, feature, - SENSORS_SUBFEATURE_TEMP_INPUT); - val = sf ? get_value(name, sf) : 0; - sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_TEMP_ALARM); alarm = sf && get_value(name, sf); @@ -230,9 +226,15 @@ static void print_chip_temp(const sensors_chip_name *name, if (sf && get_value(name, sf)) { printf(" FAULT "); } else { - if (fahrenheit) - val = deg_ctof(val); - printf("%+6.1f%s ", val, degstr); + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_TEMP_INPUT); + if (sf) { + val = get_value(name, sf); + if (fahrenheit) + val = deg_ctof(val); + printf("%+6.1f%s ", val, degstr); + } else + printf(" N/A "); } print_temp_limits(limit1, limit2, s1, s2, alarm); @@ -350,7 +352,6 @@ static void print_chip_fan(const sensors_chip_name *name, { const sensors_subfeature *sf, *sfmin, *sfdiv; char *label; - double val; if (!(label = sensors_get_label(name, feature))) { fprintf(stderr, "ERROR: Can't get label of feature %s!\n", @@ -360,15 +361,18 @@ static void print_chip_fan(const sensors_chip_name *name, print_label(label, label_size); free(label); - sf = sensors_get_subfeature(name, feature, - SENSORS_SUBFEATURE_FAN_INPUT); - val = sf ? get_value(name, sf) : 0; sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_FAULT); if (sf && get_value(name, sf)) printf(" FAULT"); - else - printf("%4.0f RPM", val); + else { + sf = sensors_get_subfeature(name, feature, + SENSORS_SUBFEATURE_FAN_INPUT); + if (sf) + printf("%4.0f RPM", get_value(name, sf)); + else + printf(" N/A"); + } sfmin = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_FAN_MIN); From 618a41d13e0809e9ae5d705360baa39bda97bf9a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 1 Oct 2007 17:04:41 +0000 Subject: [PATCH 352/718] Fix SMSC SCH311x detection. The logical device number was missing. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4913 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 2f9804cc..09c5830e 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ SVN Make error messages more helpful and consistent Better handling of the fault flags sensors-conf-convert: Add a short help text + sennsors-detect: Fix SMSC SCH311x detection 3.0.0-rc1 (2007-09-25) Initial release diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index c52a9164..44568c78 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1831,16 +1831,19 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); name => "SMSC SCH3112 Super IO", driver => "dme1737", devid => 0x7c, + logdev => 0x0a, }, { name => "SMSC SCH3114 Super IO", driver => "dme1737", devid => 0x7d, + logdev => 0x0a, }, { name => "SMSC SCH3116 Super IO", driver => "dme1737", devid => 0x7f, + logdev => 0x0a, }, { name => "SMSC SCH4307 Super IO Fan Sensors", From cb5a94578dbdff2720b7637ed0228fdae0133fd9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 1 Oct 2007 17:05:34 +0000 Subject: [PATCH 353/718] Chip-specific code is gone. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4914 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/sensord.8 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/prog/sensord/sensord.8 b/prog/sensord/sensord.8 index b3f99074..a17b1c58 100644 --- a/prog/sensord/sensord.8 +++ b/prog/sensord/sensord.8 @@ -412,8 +412,5 @@ for further details. sensors.conf(5) .SH AUTHORS .B Sensord -was written by Merlin Hughes . Chip-specific formatting -code was ripped from -.BR sensors -which was written by Frodo Looijaard . Basics of round-robin +was written by Merlin Hughes . Basics of round-robin databases were misappropriated from Mark D. Studebaker. From 878333508c266223cbf001e09075657c42049e9b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 5 Oct 2007 17:12:14 +0000 Subject: [PATCH 354/718] List some more Winbond chips which can be detected with the same IDs. Patch by Uwe Hermann. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4917 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 44568c78..929d81b0 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1921,20 +1921,20 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); alias_detect => sub { vt1211_alias_detect(0, @_); }, }, { - name => "Winbond W83627HF Super IO Sensors", + name => "Winbond W83627HF/F/HG/G Super IO Sensors", driver => "w83627hf", devid => 0x52, logdev => 0x0b, alias_detect => sub { w83781d_alias_detect(3, @_); }, }, { - name => "Winbond W83627THF Super IO Sensors", + name => "Winbond W83627THF/THG Super IO Sensors", driver => "w83627hf", devid => 0x82, logdev => 0x0b, }, { - name => "Winbond W83637HF Super IO Sensors", + name => "Winbond W83637HF/HG Super IO Sensors", driver => "w83627hf", devid => 0x70, logdev => 0x0b, @@ -1946,19 +1946,19 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); logdev => 0x0b, }, { - name => "Winbond W83697HF Super IO Sensors", + name => "Winbond W83697HF/F/HG Super IO Sensors", driver => "w83627hf", devid => 0x60, logdev => 0x0b, }, { - name => "Winbond W83697SF/UF Super IO PWM", + name => "Winbond W83697SF/UF/UG Super IO PWM", driver => "to-be-written", devid => 0x68, logdev => 0x0b, }, { - name => "Winbond W83627EHF/EHG Super IO Sensors", + name => "Winbond W83627EHF/EF/EHG/EG Super IO Sensors", driver => "w83627ehf", # W83627EHF datasheet says 0x886x but 0x8853 was seen, thus the # broader mask. W83627EHG was seen with ID 0x8863. From 3a87a433fd880ada3749742574f6d2f92ad95840 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 7 Oct 2007 07:23:32 +0000 Subject: [PATCH 355/718] Drop the configuration file search path mechanism from sensord. It's confusing and useless. We dropped it from sensors years ago. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4918 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/sensord/args.c | 14 ++++++------- prog/sensord/lib.c | 46 +++++------------------------------------- prog/sensord/sensord.8 | 7 ++----- prog/sensord/sensord.c | 5 ++--- prog/sensord/sensord.h | 5 ++--- 5 files changed, 18 insertions(+), 59 deletions(-) diff --git a/prog/sensord/args.c b/prog/sensord/args.c index a492fc8b..66f459dc 100644 --- a/prog/sensord/args.c +++ b/prog/sensord/args.c @@ -30,10 +30,12 @@ #include "lib/error.h" #include "version.h" +#define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" + #define MAX_CHIP_NAMES 32 int isDaemon = 0; -const char *sensorsCfgFile = "sensors.conf"; +const char *sensorsCfgFile = DEFAULT_CONFIG_FILE; const char *pidFile = "/var/run/sensord.pid"; const char *rrdFile = NULL; const char *cgiDir = NULL; @@ -102,7 +104,7 @@ static const char *daemonSyntax = " -t, --rrd-interval

    I²C, SMBus and hardware monitoring references

    - -

    This document contains all kinds of useful references to I²C and SMBus -documents and implementations, and to hardware sensors documentation and -implementations. Please report any other references you have found!

    - - - - - - From 829254344c00c4f4b987c3f037326001bb8b4a93 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 9 Oct 2007 13:01:31 +0000 Subject: [PATCH 362/718] The ADM1024 is LM87-compatible. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4934 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 2ed453f5..2e6e9399 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -1150,7 +1150,7 @@ chip "adm1025-*" "ne1619-*" # set temp2_max 45 -chip "lm87-*" +chip "lm87-*" "adm1024-*" # # The LM87 has integrated scaling resistors, rather # than external resistors common to most sensor devices. From 80dd529f452b5beb650ef25e2b77a7f2467f762f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 9 Oct 2007 13:03:08 +0000 Subject: [PATCH 363/718] Fix some conversion rules for the adm1024. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4935 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors-conf-convert | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/sensors-conf-convert b/etc/sensors-conf-convert index d92ce67b..bceaa979 100755 --- a/etc/sensors-conf-convert +++ b/etc/sensors-conf-convert @@ -155,8 +155,9 @@ BEGIN qr/"5V(|_min|_max)"/ => sub { "in3$1" }, qr/"12V(|_min|_max)"/ => sub { "in4$1" }, qr/\bVccp2(|_min|_max)\b/ => sub { "in5$1" }, + qr/\btemp_hyst\b/ => sub { "temp1_min" }, qr/\btemp(\d)\b/ => sub { "temp".($1+1) }, - qr/\btemp(\d)_hyst\b/ => sub { "temp".($1+1)."_max_hyst" }, + qr/\btemp(\d)_hyst\b/ => sub { "temp".($1+1)."_min" }, qr/\btemp(\d)_over\b/ => sub { "temp".($1+1)."_max" }, }, "maxilife" => { From 6f3a373cdded2c75474091234c5c3000880c63ee Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 10 Oct 2007 19:45:13 +0000 Subject: [PATCH 364/718] Prepare for 3.0.0-rc2 release. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4936 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 +- version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 4727a3c1..403ddb27 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,7 @@ lm-sensors CHANGES file ----------------------- -SVN +3.0.0-rc2 (2007-10-10) useful_addresses.html: Moved to the wiki Makefile: Add sensors-conf-convert to make install libsensors: Notify the caller when writing a value fails diff --git a/version.h b/version.h index a34d6166..bb1fab22 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define LM_VERSION "3.0.0-rc1" +#define LM_VERSION "3.0.0-rc2" From bf2524aeae6c4313b9438b8105c376c3c0dfc56b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 13 Oct 2007 18:42:16 +0000 Subject: [PATCH 365/718] Drop extra slash. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4944 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/hotplug/unhide_ICH_SMBus | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prog/hotplug/unhide_ICH_SMBus b/prog/hotplug/unhide_ICH_SMBus index cadd4ead..ec8690f6 100755 --- a/prog/hotplug/unhide_ICH_SMBus +++ b/prog/hotplug/unhide_ICH_SMBus @@ -18,7 +18,7 @@ # ICH4-M 8086:24CC # ICH5 8086:24D0 -pcibus="/sys/bus/pci/slots/" +pcibus="/sys/bus/pci/slots" device="00:1f" if [ "$UID" -ne 0 ] ; then From 180ebb1d95fc51df188b7c256b2a4659adcbb01f Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 19 Oct 2007 09:43:31 +0000 Subject: [PATCH 366/718] Update sensors-detect for new fschmd driver git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4958 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 038265ab..2d30b73e 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1373,7 +1373,7 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); }, { name => "FSC Poseidon I", - driver => "fscpos", + driver => "fschmd", i2c_addrs => [0x73], i2c_detect => sub { fscpeg_detect(@_); }, }, @@ -1385,22 +1385,28 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); }, { name => "FSC Scylla", - driver => "fscscy", + driver => "fschmd", i2c_addrs => [0x73], i2c_detect => sub { fscscy_detect(@_); }, }, { name => "FSC Hermes", - driver => "fscher", + driver => "fschmd", i2c_addrs => [0x73], i2c_detect => sub { fscher_detect(@_); }, }, { name => "FSC Heimdal", - driver => "to-be-written", + driver => "fschmd", i2c_addrs => [0x73], i2c_detect => sub { fschmd_detect(@_); }, }, + { + name => "FSC Heracles", + driver => "fschmd", + i2c_addrs => [0x73], + i2c_detect => sub { fschrc_detect(@_); }, + }, { name => "ALi M5879", driver => "to-be-written", @@ -5016,6 +5022,27 @@ sub fschmd_detect return (8); } +# $_[0]: A reference to the file descriptor to access this chip. +# $_[1]: Address +# Returns: undef if not detected, (8) if detected. +# Registers used: +# 0x00-0x02: Identification ('H','R','C') +sub fschrc_detect +{ + my ($file,$addr) = @_; + # check the first 3 registers + if (i2c_smbus_read_byte_data($file,0x00) != 0x48) { + return; + } + if (i2c_smbus_read_byte_data($file,0x01) != 0x52) { + return; + } + if (i2c_smbus_read_byte_data($file,0x02) != 0x43) { + return; + } + return (8); +} + # $_[0]: A reference to the file descriptor to access this chip. # $_[1]: Address (unused) # Returns: undef if not detected, 5 if detected. From 0adc017e4d64f94b94a839bc691384a548ec211c Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 19 Oct 2007 09:48:49 +0000 Subject: [PATCH 367/718] The new fschmd driver uses the standard scaling values from the datasheet, so no conversion should be done from sensors.conf git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4959 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 7 ------- 1 file changed, 7 deletions(-) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 2e6e9399..4447b7c7 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -1486,13 +1486,6 @@ chip "fscher-*" label in1 "+5V" label in2 "Battery" -# Compute Voltages using mainboard dependant MRO-values -# (see the fscher driver documentation in the kernel tree) -# M R O O M R - compute in0 (@ * (49 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (49 * 33) - compute in1 (@ * (20 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (20 * 33) - compute in2 (@ * (10 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (10 * 33) - chip "pcf8591-*" # From e73a2f5b7249bab45949d299fc25075d17cc7261 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 19 Oct 2007 13:29:56 +0000 Subject: [PATCH 368/718] Only use fschmd driver for kernels >= 2.6.24 git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4961 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 73 +++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 20 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 2d30b73e..28ab4933 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1371,30 +1371,12 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x50..0x53], i2c_detect => sub { ddcmonitor_detect(@_); }, }, - { - name => "FSC Poseidon I", - driver => "fschmd", - i2c_addrs => [0x73], - i2c_detect => sub { fscpeg_detect(@_); }, - }, { name => "FSC Poseidon II", driver => "to-be-written", i2c_addrs => [0x73], i2c_detect => sub { fscpos_detect(@_); }, }, - { - name => "FSC Scylla", - driver => "fschmd", - i2c_addrs => [0x73], - i2c_detect => sub { fscscy_detect(@_); }, - }, - { - name => "FSC Hermes", - driver => "fschmd", - i2c_addrs => [0x73], - i2c_detect => sub { fscher_detect(@_); }, - }, { name => "FSC Heimdal", driver => "fschmd", @@ -1489,7 +1471,8 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); # Special case chip information goes here and would be included in # the chip_special_cases routine below -use vars qw(@chip_kern24_ids @chip_kern26_ids); +use vars qw(@chip_kern24_ids @chip_kern26_ids @chip_kern_lt_26_24_ids + @chip_kern_gt_eq_26_24_ids); @chip_kern24_ids = ( { name => "Analog Devices ADM1024", @@ -1544,6 +1527,50 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids); }, ); +# sigh special case for old seperate FSC drivers to new merged one mapping +@chip_kern_lt_26_24_ids = ( + { + name => "FSC Poseidon I", + driver => "fscpos", + i2c_addrs => [0x73], + i2c_detect => sub { fscpeg_detect(@_); }, + }, + { + name => "FSC Scylla", + driver => "fscscy", + i2c_addrs => [0x73], + i2c_detect => sub { fscscy_detect(@_); }, + }, + { + name => "FSC Hermes", + driver => "fscher", + i2c_addrs => [0x73], + i2c_detect => sub { fscher_detect(@_); }, + }, +); + +@chip_kern_gt_eq_26_24_ids = ( + { + name => "FSC Poseidon I", + driver => "fschmd", + i2c_addrs => [0x73], + i2c_detect => sub { fscpeg_detect(@_); }, + }, + { + name => "FSC Scylla", + driver => "fschmd", + i2c_addrs => [0x73], + i2c_detect => sub { fscscy_detect(@_); }, + }, + { + name => "FSC Hermes", + driver => "fschmd", + i2c_addrs => [0x73], + i2c_detect => sub { fscher_detect(@_); }, + }, +); + + # This is a list of all recognized superio chips. # Each entry must have the following fields: # name: The full chip name @@ -3445,8 +3472,14 @@ sub scan_cpu($) # This routine follows the pattern of the SiS adapter special cases sub chip_special_cases { - # Based on the kernel, add the appropriate chip structure to the + # Based on the kernel, add the appropriate chip structures to the # chip_ids detection list + if (kernel_version_at_least(2, 6, 24)) { + push @chip_ids, @chip_kern_gt_eq_26_24_ids; + } else { + push @chip_ids, @chip_kern_lt_26_24_ids; + } + if (kernel_version_at_least(2, 6, 0)) { push @chip_ids, @chip_kern26_ids; } else { From eec91d37b331ee16c3baba946fe9004d0a1a31a4 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 19 Oct 2007 21:41:44 +0000 Subject: [PATCH 369/718] Fix SMSC LPC47B357/M967 detection. Patch from Juerg Haefliger. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4962 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 3 +++ prog/detect/sensors-detect | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 403ddb27..aa96de86 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ lm-sensors CHANGES file ----------------------- +SVN HEAD + sensors-detect: Fix SMSC LPC47B357/M967 detection + 3.0.0-rc2 (2007-10-10) useful_addresses.html: Moved to the wiki Makefile: Add sensors-conf-convert to make install diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 28ab4933..bcd613e8 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1785,8 +1785,8 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids @chip_kern_lt_26_24_ids devid => 0x56, }, { - name => "SMSC LPC47B357 Super IO", - # no datasheet + name => "SMSC LPC47B357/M967 Super IO", + driver => "not-a-sensor", devid => 0x5d, }, { From 40706a7157898aa8f33b616d965302c66becad8b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 20 Oct 2007 08:36:05 +0000 Subject: [PATCH 370/718] Rename fsc-specific chip arrays to something clearer. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4965 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index aa96de86..1c6e5333 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ lm-sensors CHANGES file SVN HEAD sensors-detect: Fix SMSC LPC47B357/M967 detection + Select the right driver for FSC chips 3.0.0-rc2 (2007-10-10) useful_addresses.html: Moved to the wiki diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index bcd613e8..ccf8844d 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1471,8 +1471,8 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); # Special case chip information goes here and would be included in # the chip_special_cases routine below -use vars qw(@chip_kern24_ids @chip_kern26_ids @chip_kern_lt_26_24_ids - @chip_kern_gt_eq_26_24_ids); +use vars qw(@chip_kern24_ids @chip_kern26_ids + @chip_oldfsc_ids @chip_fschmd_ids); @chip_kern24_ids = ( { name => "Analog Devices ADM1024", @@ -1528,7 +1528,7 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids @chip_kern_lt_26_24_ids ); # sigh special case for old seperate FSC drivers to new merged one mapping -@chip_kern_lt_26_24_ids = ( +@chip_oldfsc_ids = ( { name => "FSC Poseidon I", driver => "fscpos", @@ -1549,7 +1549,7 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids @chip_kern_lt_26_24_ids }, ); -@chip_kern_gt_eq_26_24_ids = ( +@chip_fschmd_ids = ( { name => "FSC Poseidon I", driver => "fschmd", @@ -3475,9 +3475,9 @@ sub chip_special_cases # Based on the kernel, add the appropriate chip structures to the # chip_ids detection list if (kernel_version_at_least(2, 6, 24)) { - push @chip_ids, @chip_kern_gt_eq_26_24_ids; + push @chip_ids, @chip_fschmd_ids; } else { - push @chip_ids, @chip_kern_lt_26_24_ids; + push @chip_ids, @chip_oldfsc_ids; } if (kernel_version_at_least(2, 6, 0)) { From 2d73ead507184bfdccb6610200bf40f423d200d0 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 20 Oct 2007 08:42:51 +0000 Subject: [PATCH 371/718] No dates to update. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4967 7894878c-1315-0410-8ee3-d5d059ff63e0 --- doc/developers/release_checklist | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/developers/release_checklist b/doc/developers/release_checklist index 11ddbc86..7de9363c 100644 --- a/doc/developers/release_checklist +++ b/doc/developers/release_checklist @@ -27,7 +27,6 @@ Release steps: After release, remember to: - Copy to mirrors - Announce on Freshmeat -- Put back ???? for dates - Prep CHANGES files for next release - Mark the corresponding release milestone as complete using trac-admin e.g. 'trac-admin /srv/lm-sensors.org/trac milestone completed 2.10.2 2006-12-31' From 4db0a3284ca98e7b26bf4556c6a3c574b91e4e8b Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 20 Oct 2007 08:47:54 +0000 Subject: [PATCH 372/718] Recommend the fschmd driver for FSC Scylla chips even on old 2.6 kernels. There's no fscscy driver for Linux 2.6, so users would have to either upgrade to a newer 2.6 kernel (and use fschmd) or backport the fschmd driver. In either case they will use the fschmd driver, not fscscy. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4968 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index ccf8844d..41f7ad64 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1486,6 +1486,12 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids i2c_addrs => [0x2c..0x2f], i2c_detect => sub { w83781d_detect(7, @_); }, }, + { + name => "FSC Scylla", + driver => "fscscy", + i2c_addrs => [0x73], + i2c_detect => sub { fscscy_detect(@_); }, + }, { name => "IPMI BMC KCS", driver => "bmcsensors", @@ -1513,6 +1519,12 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids i2c_addrs => [0x2c..0x2f], i2c_detect => sub { w83781d_detect(7, @_); }, }, + { + name => "FSC Scylla", + driver => "fschmd", + i2c_addrs => [0x73], + i2c_detect => sub { fscscy_detect(@_); }, + }, { name => "IPMI BMC KCS", driver => "ipmisensors", @@ -1535,12 +1547,6 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids i2c_addrs => [0x73], i2c_detect => sub { fscpeg_detect(@_); }, }, - { - name => "FSC Scylla", - driver => "fscscy", - i2c_addrs => [0x73], - i2c_detect => sub { fscscy_detect(@_); }, - }, { name => "FSC Hermes", driver => "fscher", @@ -1556,12 +1562,6 @@ use vars qw(@chip_kern24_ids @chip_kern26_ids i2c_addrs => [0x73], i2c_detect => sub { fscpeg_detect(@_); }, }, - { - name => "FSC Scylla", - driver => "fschmd", - i2c_addrs => [0x73], - i2c_detect => sub { fscscy_detect(@_); }, - }, { name => "FSC Hermes", driver => "fschmd", From 3d9acfa6f900222097765358a8e0a087905db04f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 20 Oct 2007 14:05:35 +0000 Subject: [PATCH 373/718] sensord: Reload config on SIGHUP rather than automatically. Reloading the configuration on SIGHUP is common for daemons. Reloading automatically is less efficient and can be confusing or even racy. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4969 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensord/lib.c | 6 +----- prog/sensord/sensord.8 | 3 +++ prog/sensord/sensord.c | 13 ++++++++++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 1c6e5333..c976c7f4 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ lm-sensors CHANGES file ----------------------- SVN HEAD + sensord: Reload config on SIGHUP rather than automatically sensors-detect: Fix SMSC LPC47B357/M967 detection Select the right driver for FSC chips diff --git a/prog/sensord/lib.c b/prog/sensord/lib.c index ff5de5f8..dd1d0e11 100644 --- a/prog/sensord/lib.c +++ b/prog/sensord/lib.c @@ -31,8 +31,6 @@ #include "sensord.h" #include "lib/error.h" -static time_t cfgLastModified; - static int loadConfig (const char *cfgPath, int reload) { @@ -51,7 +49,7 @@ loadConfig } else if (stat (cfgPath, &stats) < 0) { sensorLog (LOG_ERR, "Error stating sensors configuration file: %s", cfgPath); ret = 10; - } else if (!reload || (difftime (stats.st_mtime, cfgLastModified) > 0.0)) { + } else { if (reload) { sensorLog (LOG_INFO, "configuration reloading"); sensors_cleanup (); @@ -63,8 +61,6 @@ loadConfig sensorLog (LOG_ERR, "Error loading sensors configuration file %s: %s", cfgPath, sensors_strerror (ret)); ret = 11; - } else { - cfgLastModified = stats.st_mtime; } if (cfg) fclose (cfg); diff --git a/prog/sensord/sensord.8 b/prog/sensord/sensord.8 index 19408dba..6aec0155 100644 --- a/prog/sensord/sensord.8 +++ b/prog/sensord/sensord.8 @@ -133,6 +133,9 @@ modules for chips in which you have no interest. Upon receipt of a SIGTERM (see .BR signal (7) for details) this daemon should gracefully shut down. + +Upon receipt of a SIGHUP, this daemon will rescan the kernel interface +for chips and features, and reload the libsensors configuration file. .SH LOGGING All messages from this daemon are logged to .BR syslog (3) diff --git a/prog/sensord/sensord.c b/prog/sensord/sensord.c index 872bb56a..b8f06a1f 100644 --- a/prog/sensord/sensord.c +++ b/prog/sensord/sensord.c @@ -37,6 +37,7 @@ static int logOpened = 0; static volatile sig_atomic_t done = 0; +static volatile sig_atomic_t reload = 0; #define LOG_BUFFER 4096 @@ -69,6 +70,9 @@ signalHandler case SIGTERM: done = 1; break; + case SIGHUP: + reload = 1; + break; } } @@ -86,8 +90,10 @@ sensord sensorLog (LOG_INFO, "sensord started"); while (!done && (ret == 0)) { - if (ret == 0) + if (reload) { ret = reloadLib (sensorsCfgFile); + reload = 0; + } if ((ret == 0) && scanTime) { /* should I scan on the read cycle? */ ret = scanChips (); if (scanValue <= 0) @@ -156,8 +162,9 @@ daemonize } /* I should use sigaction but... */ - if (signal (SIGTERM, signalHandler) == SIG_ERR) { - perror ("signal(SIGTERM)"); + if (signal (SIGTERM, signalHandler) == SIG_ERR || + signal (SIGHUP, signalHandler) == SIG_ERR) { + perror ("signal"); exit (EXIT_FAILURE); } From a3be2931c684c7c4622ebc3ecb836caa477fd98f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 21 Oct 2007 13:58:27 +0000 Subject: [PATCH 374/718] sensors-detect-stat.pl: Handle alternative chip lists. Ultimately this script should be folded into sensors-detect. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4971 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect-stat.pl | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index c976c7f4..5517bd08 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ SVN HEAD sensord: Reload config on SIGHUP rather than automatically sensors-detect: Fix SMSC LPC47B357/M967 detection Select the right driver for FSC chips + sensors-detect-stat.pl: Handle alternative chip lists 3.0.0-rc2 (2007-10-10) useful_addresses.html: Moved to the wiki diff --git a/prog/detect/sensors-detect-stat.pl b/prog/detect/sensors-detect-stat.pl index 596e9d43..77039247 100755 --- a/prog/detect/sensors-detect-stat.pl +++ b/prog/detect/sensors-detect-stat.pl @@ -3,7 +3,7 @@ # sensors-detect-stat.pl # Statistical analysis of sensors-detect i2c addresses scanner # Part of the lm_sensors project -# Copyright (C) 2003-2004 Jean Delvare +# Copyright (C) 2003-2007 Jean Delvare # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. use strict; -use vars qw(%histo $chips $file); +use vars qw(%histo $chips $file $skip); # Where is sensors-detect? # Use first argument, else try default locations. @@ -51,8 +51,21 @@ if (! -r $file) # Get the data. open (SD, $file) || die; +$skip = 0; while () { + # Some chips are handled differently depending on the kernel + # version, avoid counting them twice. + if (m/^\@chip_kern24_ids\s*=/ || m/^\@chip_oldfsc_ids\s*=/) { + $skip = 1; + next; + } + if ($skip && m/^\);$/) { + $skip = 0; + next; + } + next if $skip; + # The regular expression may seem a little bit complex, but we wouldn't # want to exec malicious code. next unless m/^\s*i2c_addrs\s*=>\s*(\[( *0x[\dA-Fa-f]{2}( *\.\. *0x[\dA-Fa-f]{2})? *,?)+\])\s*,/; From 2b1c2a0e6f545d41f6b3e50477a4a4d2cab0a6eb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 21 Oct 2007 14:31:38 +0000 Subject: [PATCH 375/718] sensors: Fix file handle leak on library initialization error. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4973 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/main.c | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index 5517bd08..34fe5fe6 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ lm-sensors CHANGES file SVN HEAD sensord: Reload config on SIGHUP rather than automatically + sensors: Fix file handle leak on library initialization error sensors-detect: Fix SMSC LPC47B357/M967 detection Select the right driver for FSC chips sensors-detect-stat.pl: Handle alternative chip lists diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 74ebb94f..6acfa668 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -102,6 +102,7 @@ static int read_config_file(const char *config_file_name) err = sensors_init(config_file); if (err) { fprintf(stderr, "sensors_init: %s\n", sensors_strerror(err)); + fclose(config_file); return 1; } From 2c41310ba0db7614ad1def7d4f201c273c9654e9 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 22 Oct 2007 09:39:15 +0000 Subject: [PATCH 376/718] add SENSORS_API_VERSION define to sensors.h git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4975 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/sensors.h b/lib/sensors.h index ae35dbe2..96332a4a 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -26,6 +26,12 @@ /* Publicly accessible library functions */ +/* libsensors API version define, first digit is the major version (changed + when the API + ABI breaks), the third digit is incremented to track small + API additions like new flags / enum values. The second digit is for tracking + larger additions like new methods. */ +#define SENSORS_API_VERSION 400 + #define SENSORS_CHIP_NAME_PREFIX_ANY NULL #define SENSORS_CHIP_NAME_ADDR_ANY -1 From 2b650945f10c7571f41952455151deb0a726886c Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 22 Oct 2007 18:27:04 +0000 Subject: [PATCH 377/718] sensors: Handle the case where voltage measurements aren't available. This will soon be the case of the Linux 2.6 gl518sm driver. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4977 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/chips.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 34fe5fe6..aa4f26f7 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm-sensors CHANGES file SVN HEAD sensord: Reload config on SIGHUP rather than automatically sensors: Fix file handle leak on library initialization error + Handle the case where voltage measurements aren't available sensors-detect: Fix SMSC LPC47B357/M967 detection Select the right driver for FSC chips sensors-detect-stat.pl: Handle alternative chip lists diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 0c9f8e99..76d69394 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -287,7 +287,7 @@ static void print_chip_in(const sensors_chip_name *name, int label_size) { const sensors_subfeature *sf, *sfmin, *sfmax; - double val, alarm_max, alarm_min; + double alarm_max, alarm_min; char *label; if (!(label = sensors_get_label(name, feature))) { @@ -300,8 +300,10 @@ static void print_chip_in(const sensors_chip_name *name, sf = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_INPUT); - val = sf ? get_value(name, sf) : 0; - printf("%+6.2f V", val); + if (sf) + printf("%+6.2f V", get_value(name, sf)); + else + printf(" N/A"); sfmin = sensors_get_subfeature(name, feature, SENSORS_SUBFEATURE_IN_MIN); From 0aee76dbbb892d58d1d6be98ea4d5026002b2d41 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 22 Oct 2007 19:27:38 +0000 Subject: [PATCH 378/718] make SENSORS_API_VERSION hexadecimal git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4978 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/sensors.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sensors.h b/lib/sensors.h index 96332a4a..2a4669ea 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -30,7 +30,7 @@ when the API + ABI breaks), the third digit is incremented to track small API additions like new flags / enum values. The second digit is for tracking larger additions like new methods. */ -#define SENSORS_API_VERSION 400 +#define SENSORS_API_VERSION 0x400 #define SENSORS_CHIP_NAME_PREFIX_ANY NULL #define SENSORS_CHIP_NAME_ADDR_ANY -1 From f7bc498fd00298c397549db39d23232e4a59b6ef Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 24 Oct 2007 13:03:36 +0000 Subject: [PATCH 379/718] re-add fscher compute lines for use with the old fscher driver git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4980 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 4447b7c7..7736007a 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -1486,6 +1486,14 @@ chip "fscher-*" label in1 "+5V" label in2 "Battery" +# Uncomment the computes line below when using the old fscher driver, leave +# them commented when using the newer unified fschmd driver +# +# M R O O M R +# compute in0 (@ * (49 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (49 * 33) +# compute in1 (@ * (20 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (20 * 33) +# compute in2 (@ * (10 * 33) / 255) + (0 / 100), (@ - (0 / 100)) * 255 / (10 * 33) + chip "pcf8591-*" # From fb920578a941024530e0b0f393c884c9092e8fa3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 25 Oct 2007 09:48:18 +0000 Subject: [PATCH 380/718] Let libsensors know the default path to its configuration file. That way, applications no longer have to care. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4985 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + Makefile | 4 ++-- lib/init.c | 24 ++++++++++++++++++++---- lib/libsensors.3 | 12 +++++++++++- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index aa4f26f7..f457672e 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ lm-sensors CHANGES file ----------------------- SVN HEAD + libsensors: Add a default configuration file sensord: Reload config on SIGHUP rather than automatically sensors: Fix file handle leak on library initialization error Handle the case where voltage measurements aren't available diff --git a/Makefile b/Makefile index c49fe9a2..02d0b9ea 100644 --- a/Makefile +++ b/Makefile @@ -144,9 +144,9 @@ ALL_CFLAGS += $(CFLAGS) PROGCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS) PROGCFLAGS := $(ALL_CFLAGS) -ARCPPFLAGS := $(ALL_CPPFLAGS) +ARCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS) ARCFLAGS := $(ALL_CFLAGS) -LIBCPPFLAGS := $(ALL_CPPFLAGS) +LIBCPPFLAGS := -DETCDIR="\"$(ETCDIR)\"" $(ALL_CPPFLAGS) LIBCFLAGS := -fpic -D_REENTRANT $(ALL_CFLAGS) .PHONY: all user clean install user_install uninstall user_uninstall diff --git a/lib/init.c b/lib/init.c index 5f80a274..15ad3a5a 100644 --- a/lib/init.c +++ b/lib/init.c @@ -29,6 +29,8 @@ #include "scanner.h" #include "init.h" +#define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" + int sensors_init(FILE *input) { int res; @@ -38,10 +40,24 @@ int sensors_init(FILE *input) if ((res = sensors_read_sysfs_bus()) || (res = sensors_read_sysfs_chips())) return res; - if ((res = sensors_scanner_init(input))) - return -SENSORS_ERR_PARSE; - if ((res = sensors_yyparse())) - return -SENSORS_ERR_PARSE; + + if (input) { + if (sensors_scanner_init(input) || + sensors_yyparse()) + return -SENSORS_ERR_PARSE; + } else { + /* No configuration provided, use default */ + input = fopen(DEFAULT_CONFIG_FILE, "r"); + if (!input) + return -SENSORS_ERR_PARSE; + if (sensors_scanner_init(input) || + sensors_yyparse()) { + fclose(input); + return -SENSORS_ERR_PARSE; + } + fclose(input); + } + if ((res = sensors_substitute_busses())) return res; return 0; diff --git a/lib/libsensors.3 b/lib/libsensors.3 index 43d3cc6c..a80abc1e 100644 --- a/lib/libsensors.3 +++ b/lib/libsensors.3 @@ -24,7 +24,7 @@ .\" .\" References consulted: .\" libsensors source code -.TH libsensors 3 "June 2007" "lm-sensors 3" "Linux Programmer's Manual" +.TH libsensors 3 "October 2007" "lm-sensors 3" "Linux Programmer's Manual" .SH NAME libsensors \- publicly accessible functions provided by the sensors library .SH SYNOPSIS @@ -57,6 +57,9 @@ value unequal to zero, you are in trouble; you can not assume anything will be initialized properly. If you want to reload the configuration file, call sensors_cleanup() below before calling sensors_init() again. +If FILE is NULL, the default configuration file is used (see the FILES +section below). Most applications will want to do that. + .B void sensors_cleanup(void); .br Clean-up function: You can't access anything after this, until the next sensors_init() call! @@ -168,6 +171,13 @@ data structures. .br A string representing the version of libsensors. +.SH FILES +.I /etc/sensors.conf +.RS +The system-wide +.BR libsensors (3) +configuration file. + .SH SEE ALSO sensors.conf(5) From f17e1cf5a866659c4cf2af219b944f4179abe551 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 25 Oct 2007 09:49:34 +0000 Subject: [PATCH 381/718] "sensors" no longer needs a default configuration file name. If no file name is provided on the command line, use the libsensors default. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4986 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensors/main.c | 31 +++++++++++++++++-------------- prog/sensors/sensors.1 | 8 ++++---- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index f457672e..63e8646e 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ SVN HEAD sensord: Reload config on SIGHUP rather than automatically sensors: Fix file handle leak on library initialization error Handle the case where voltage measurements aren't available + No default configuration file name sensors-detect: Fix SMSC LPC47B357/M967 detection Select the right driver for FSC chips sensors-detect-stat.pl: Handle alternative chip lists diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 6acfa668..54bfbe59 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -39,7 +39,6 @@ #define PROGRAM "sensors" #define VERSION LM_VERSION -#define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" static int do_sets, do_raw, hide_adapter; @@ -54,9 +53,8 @@ static void print_short_help(void) static void print_long_help(void) { printf("Usage: %s [OPTION]... [CHIP]...\n", PROGRAM); - printf(" -c, --config-file Specify a config file (default: %s)\n", - DEFAULT_CONFIG_FILE); - puts(" -h, --help Display this help text\n" + puts(" -c, --config-file Specify a config file\n" + " -h, --help Display this help text\n" " -s, --set Execute `set' statements (root only)\n" " -f, --fahrenheit Show temperatures in degrees fahrenheit\n" " -A, --no-adapter Do not show adapter for each chip\n" @@ -88,15 +86,20 @@ static int read_config_file(const char *config_file_name) FILE *config_file; int err; - if (!strcmp(config_file_name, "-")) - config_file = stdin; - else - config_file = fopen(config_file_name, "r"); + if (config_file_name) { + if (!strcmp(config_file_name, "-")) + config_file = stdin; + else + config_file = fopen(config_file_name, "r"); - if (!config_file) { - fprintf(stderr, "Could not open config file\n"); - perror(config_file_name); - return 1; + if (!config_file) { + fprintf(stderr, "Could not open config file\n"); + perror(config_file_name); + return 1; + } + } else { + /* Use libsensors default */ + config_file = NULL; } err = sensors_init(config_file); @@ -106,7 +109,7 @@ static int read_config_file(const char *config_file_name) return 1; } - if (fclose(config_file) == EOF) + if (config_file && fclose(config_file) == EOF) perror(config_file_name); return 0; @@ -239,7 +242,7 @@ static void print_bus_list(void) int main(int argc, char *argv[]) { int c, res, i, error, do_bus_list; - const char *config_file_name = DEFAULT_CONFIG_FILE; + const char *config_file_name = NULL; struct option long_opts[] = { { "help", no_argument, NULL, 'h' }, diff --git a/prog/sensors/sensors.1 b/prog/sensors/sensors.1 index 0a5525a3..f359bbdb 100644 --- a/prog/sensors/sensors.1 +++ b/prog/sensors/sensors.1 @@ -22,7 +22,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH sensors 1 "September 2007" "lm-sensors 3" "Linux User's Manual" +.TH sensors 1 "October 2007" "lm-sensors 3" "Linux User's Manual" .SH NAME sensors \- print sensors information .SH SYNOPSIS @@ -50,9 +50,9 @@ is used to generate bus statements suitable for the configuration file. .SH OPTIONS .IP "-c config-file" -Specify a configuration file. If no file is specified, `/etc/sensors.conf' -is used. Use `-c /dev/null' to temporarily disable this default configuration -file. +Specify a configuration file. If no file is specified, the libsensors +default configuration file is used. Use `-c /dev/null' to temporarily +disable this default configuration file. .IP -h Print a help text and exit. .IP -s From 6d5292cce4ea1c52270ee2c3b44f8fa6462b2e7e Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 25 Oct 2007 09:50:17 +0000 Subject: [PATCH 382/718] "sensord" no longer needs a default configuration file name. If no file name is provided on the command line, use the libsensors default. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4987 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/sensord/args.c | 8 +++----- prog/sensord/lib.c | 8 ++++---- prog/sensord/sensord.8 | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index 63e8646e..82d3fd2b 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm-sensors CHANGES file SVN HEAD libsensors: Add a default configuration file sensord: Reload config on SIGHUP rather than automatically + No default configuration file name sensors: Fix file handle leak on library initialization error Handle the case where voltage measurements aren't available No default configuration file name diff --git a/prog/sensord/args.c b/prog/sensord/args.c index 66f459dc..0ceafe2a 100644 --- a/prog/sensord/args.c +++ b/prog/sensord/args.c @@ -30,12 +30,10 @@ #include "lib/error.h" #include "version.h" -#define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf" - #define MAX_CHIP_NAMES 32 int isDaemon = 0; -const char *sensorsCfgFile = DEFAULT_CONFIG_FILE; +const char *sensorsCfgFile = NULL; const char *pidFile = "/var/run/sensord.pid"; const char *rrdFile = NULL; const char *cgiDir = NULL; @@ -104,7 +102,7 @@ static const char *daemonSyntax = " -t, --rrd-interval