From da76559ae66c86a31ff94b7282eb626335e31eb6 Mon Sep 17 00:00:00 2001 From: Merlin Hughes Date: Thu, 2 May 2002 14:44:31 +0000 Subject: [PATCH] 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 --- kernel/busses/i2c-amd756.c | 19 ++++++++++++------- prog/detect/sensors-detect | 8 ++++---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/kernel/busses/i2c-amd756.c b/kernel/busses/i2c-amd756.c index ae50969d..3b15697d 100644 --- a/kernel/busses/i2c-amd756.c +++ b/kernel/busses/i2c-amd756.c @@ -2,7 +2,7 @@ amd756.c - Part of lm_sensors, Linux kernel modules for hardware monitoring - Copyright (c) 1999 Merlin Hughes + Copyright (c) 1999-2002 Merlin Hughes Shamelessly ripped from i2c-piix4.c: @@ -155,6 +155,7 @@ static struct i2c_adapter amd756_adapter = { }; static int __initdata amd756_initialized; +static struct sd *amd756_sd = NULL; static unsigned short amd756_smba = 0; /* 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); if ((temp & 128) == 0) { printk("i2c-amd756.o: Error: SMBus controller I/O not enabled!\n"); + return(-ENODEV); } - return(-ENODEV); /* Determine the address of the SMBus areas */ /* 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); #endif /* DEBUG */ + /* store struct sd * for future reference */ + amd756_sd = currdev; + return 0; } @@ -481,13 +485,13 @@ int __init i2c_amd756_init(void) amd756_initialized = 0; if ((res = amd756_setup())) { 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(); return res; } amd756_initialized++; - sprintf(amd756_adapter.name, "SMBus AMD7X6 adapter at %04x", - amd756_smba); + sprintf(amd756_adapter.name, "SMBus %s adapter at %04x", + amd756_sd->name, amd756_smba); if ((res = i2c_add_adapter(&amd756_adapter))) { printk ("i2c-amd756.o: Adapter registration failed, module not inserted.\n"); @@ -495,7 +499,8 @@ int __init i2c_amd756_init(void) return res; } 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; } @@ -522,7 +527,7 @@ EXPORT_NO_SYMBOLS; #ifdef MODULE MODULE_AUTHOR("Merlin Hughes "); -MODULE_DESCRIPTION("AMD756/766 SMBus driver"); +MODULE_DESCRIPTION("AMD756/766/768/nVidia nForce SMBus driver"); #ifdef MODULE_LICENSE MODULE_LICENSE("GPL"); diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index c7939abb..9ad6cc09 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -227,7 +227,7 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters); func => 3, procid => "AMD-756 Athlon ACPI", 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, @@ -235,7 +235,7 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters); func => 3, procid => "AMD-766 Athlon ACPI", 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, @@ -243,7 +243,7 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters); func => 3, procid => "AMD-768 System Management", 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, @@ -515,7 +515,7 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters); func => 1, procid => "nVidia nForce SMBus", 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,