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:
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