mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-02 07:15:39 +00:00
mh: Fix i2c-amd756 support for non-nForce chips (probably a
patch error vs changed source). Change module so it registers the detected device in i2c under its own name (e.g, AMD756/AMD766/AMD768/nVidia nForce rather than AMD7X6). Updated sensors-detect accordingly. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1367 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
amd756.c - Part of lm_sensors, Linux kernel modules for hardware
|
amd756.c - Part of lm_sensors, Linux kernel modules for hardware
|
||||||
monitoring
|
monitoring
|
||||||
|
|
||||||
Copyright (c) 1999 Merlin Hughes <merlin@merlin.org>
|
Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org>
|
||||||
|
|
||||||
Shamelessly ripped from i2c-piix4.c:
|
Shamelessly ripped from i2c-piix4.c:
|
||||||
|
|
||||||
@@ -155,6 +155,7 @@ static struct i2c_adapter amd756_adapter = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int __initdata amd756_initialized;
|
static int __initdata amd756_initialized;
|
||||||
|
static struct sd *amd756_sd = NULL;
|
||||||
static unsigned short amd756_smba = 0;
|
static unsigned short amd756_smba = 0;
|
||||||
|
|
||||||
/* Detect whether a AMD756 can be found, and initialize it, where necessary.
|
/* Detect whether a AMD756 can be found, and initialize it, where necessary.
|
||||||
@@ -196,8 +197,8 @@ int amd756_setup(void)
|
|||||||
pci_read_config_byte(AMD756_dev, SMBGCFG, &temp);
|
pci_read_config_byte(AMD756_dev, SMBGCFG, &temp);
|
||||||
if ((temp & 128) == 0) {
|
if ((temp & 128) == 0) {
|
||||||
printk("i2c-amd756.o: Error: SMBus controller I/O not enabled!\n");
|
printk("i2c-amd756.o: Error: SMBus controller I/O not enabled!\n");
|
||||||
|
return(-ENODEV);
|
||||||
}
|
}
|
||||||
return(-ENODEV);
|
|
||||||
|
|
||||||
/* Determine the address of the SMBus areas */
|
/* Determine the address of the SMBus areas */
|
||||||
/* Technically it is a dword but... */
|
/* Technically it is a dword but... */
|
||||||
@@ -223,6 +224,9 @@ int amd756_setup(void)
|
|||||||
printk("i2c-amd756.o: AMD756_smba = 0x%X\n", amd756_smba);
|
printk("i2c-amd756.o: AMD756_smba = 0x%X\n", amd756_smba);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
/* store struct sd * for future reference */
|
||||||
|
amd756_sd = currdev;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,13 +485,13 @@ int __init i2c_amd756_init(void)
|
|||||||
amd756_initialized = 0;
|
amd756_initialized = 0;
|
||||||
if ((res = amd756_setup())) {
|
if ((res = amd756_setup())) {
|
||||||
printk
|
printk
|
||||||
("i2c-amd756.o: AMD756/766 not detected, module not inserted.\n");
|
("i2c-amd756.o: AMD756 or compatible device not detected, module not inserted.\n");
|
||||||
amd756_cleanup();
|
amd756_cleanup();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
amd756_initialized++;
|
amd756_initialized++;
|
||||||
sprintf(amd756_adapter.name, "SMBus AMD7X6 adapter at %04x",
|
sprintf(amd756_adapter.name, "SMBus %s adapter at %04x",
|
||||||
amd756_smba);
|
amd756_sd->name, amd756_smba);
|
||||||
if ((res = i2c_add_adapter(&amd756_adapter))) {
|
if ((res = i2c_add_adapter(&amd756_adapter))) {
|
||||||
printk
|
printk
|
||||||
("i2c-amd756.o: Adapter registration failed, module not inserted.\n");
|
("i2c-amd756.o: Adapter registration failed, module not inserted.\n");
|
||||||
@@ -495,7 +499,8 @@ int __init i2c_amd756_init(void)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
amd756_initialized++;
|
amd756_initialized++;
|
||||||
printk("i2c-amd756.o: AMD756/766 bus detected and initialized\n");
|
printk("i2c-amd756.o: %s bus detected and initialized\n",
|
||||||
|
amd756_sd->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +527,7 @@ EXPORT_NO_SYMBOLS;
|
|||||||
#ifdef MODULE
|
#ifdef MODULE
|
||||||
|
|
||||||
MODULE_AUTHOR("Merlin Hughes <merlin@merlin.org>");
|
MODULE_AUTHOR("Merlin Hughes <merlin@merlin.org>");
|
||||||
MODULE_DESCRIPTION("AMD756/766 SMBus driver");
|
MODULE_DESCRIPTION("AMD756/766/768/nVidia nForce SMBus driver");
|
||||||
|
|
||||||
#ifdef MODULE_LICENSE
|
#ifdef MODULE_LICENSE
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
@@ -227,7 +227,7 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters);
|
|||||||
func => 3,
|
func => 3,
|
||||||
procid => "AMD-756 Athlon ACPI",
|
procid => "AMD-756 Athlon ACPI",
|
||||||
driver => "i2c-amd756",
|
driver => "i2c-amd756",
|
||||||
match => sub { $_[0] =~ /^SMBus AMD7X6 adapter at [0-9,a-f]{4}/ },
|
match => sub { $_[0] =~ /^SMBus AMD756 adapter at [0-9,a-f]{4}/ },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
vendid => 0x1022,
|
vendid => 0x1022,
|
||||||
@@ -235,7 +235,7 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters);
|
|||||||
func => 3,
|
func => 3,
|
||||||
procid => "AMD-766 Athlon ACPI",
|
procid => "AMD-766 Athlon ACPI",
|
||||||
driver => "i2c-amd756",
|
driver => "i2c-amd756",
|
||||||
match => sub { $_[0] =~ /^SMBus AMD7X6 adapter at [0-9,a-f]{4}/ },
|
match => sub { $_[0] =~ /^SMBus AMD766 adapter at [0-9,a-f]{4}/ },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
vendid => 0x1022,
|
vendid => 0x1022,
|
||||||
@@ -243,7 +243,7 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters);
|
|||||||
func => 3,
|
func => 3,
|
||||||
procid => "AMD-768 System Management",
|
procid => "AMD-768 System Management",
|
||||||
driver => "i2c-amd756",
|
driver => "i2c-amd756",
|
||||||
match => sub { $_[0] =~ /^SMBus AMD7X6 adapter at [0-9,a-f]{4}/ },
|
match => sub { $_[0] =~ /^SMBus AMD768 adapter at [0-9,a-f]{4}/ },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
vendid => 0x102b,
|
vendid => 0x102b,
|
||||||
@@ -515,7 +515,7 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters);
|
|||||||
func => 1,
|
func => 1,
|
||||||
procid => "nVidia nForce SMBus",
|
procid => "nVidia nForce SMBus",
|
||||||
driver => "i2c-amd756",
|
driver => "i2c-amd756",
|
||||||
match => sub { $_[0] =~ /^SMBus AMD7X6 adapter at [0-9,a-f]{4}/ },
|
match => sub { $_[0] =~ /^SMBus nVidia nForce adapter at [0-9,a-f]{4}/ },
|
||||||
} ,
|
} ,
|
||||||
{
|
{
|
||||||
vendid => 0x1166,
|
vendid => 0x1166,
|
||||||
|
Reference in New Issue
Block a user