mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-23 20:11:42 +00:00
compile fixes for i2c-amd8111.c, and add support in mkpatch.
Patch from
Vojtech Pavlik <vojtech@suse.cz>
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1658 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
01e6b327ed
commit
3467ff5106
4 files changed
+105
-14
No files matched your search
@@ -45,8 +45,3 @@ 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.
|
||||
|
||||
The 8111 used with the AMD Hammer. While the module should work either with
|
||||
CONFIG_X86 or CONFIG_X86_64, it will only be compiled with CONFIG_X86_64
|
||||
(as it was the easiest way to prevent compilation in 2.2 kernels).
|
||||
If you would like to compile it for CONFIG_X86, modify kernel/busses/Module.mk.
|
||||
@@ -40,12 +40,9 @@ endif
|
||||
ifneq ($(shell if grep -q '^CONFIG_I2C_AMD756=y' $(LINUX)/.config; then echo 1; fi),1)
|
||||
KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-amd756.o
|
||||
endif
|
||||
# Should also work for CONFIG_X86 but this is the easiest way to prevent compilation in 2.2 kernels...
|
||||
ifeq ($(shell if grep -q '^CONFIG_X86_64=' $(LINUX)/.config; then echo 1; fi),1)
|
||||
ifneq ($(shell if grep -q '^CONFIG_I2C_AMD8111=y' $(LINUX)/.config; then echo 1; fi),1)
|
||||
KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-amd8111.o
|
||||
endif
|
||||
endif
|
||||
ifneq ($(shell if grep -q '^CONFIG_I2C_HYDRA=y' $(LINUX)/.config; then echo 1; fi),1)
|
||||
KERNELBUSSESTARGETS += $(MODULE_DIR)/i2c-hydra.o
|
||||
endif
|
||||
|
||||
@@ -25,7 +25,31 @@
|
||||
#error Your i2c is too old - i2c-2.7.0 or greater required!
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
|
||||
#define min_t(t, x, y) (((x)<(y))?(x):(y))
|
||||
#define __devinit
|
||||
#define __devexit
|
||||
#define __devinitdata
|
||||
struct pci_device_id {
|
||||
unsigned int vendor, device;
|
||||
unsigned int subvendor, subdevice;
|
||||
unsigned int class, class_mask;
|
||||
unsigned long driver_data;
|
||||
};
|
||||
struct pci_driver {
|
||||
struct list_head node;
|
||||
char *name;
|
||||
const struct pci_device_id *id_table;
|
||||
int (*probe)(struct pci_dev *dev, const struct pci_device_id *id);
|
||||
void (*remove)(struct pci_dev *dev);
|
||||
};
|
||||
#define PCI_ANY_ID 0xffff
|
||||
#define IORESOURCE_IO 0x00000100
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
MODULE_AUTHOR ("Vojtech Pavlik <vojtech@suse.cz>");
|
||||
MODULE_DESCRIPTION("AMD8111 SMBus 2.0 driver");
|
||||
|
||||
@@ -359,7 +383,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
|
||||
if (~pci_resource_flags(dev, 0) & IORESOURCE_IO)
|
||||
return -1;
|
||||
|
||||
if (!(smbus = kmalloc(sizeof(struct amd_smbus), GFP_KERNEL)))
|
||||
if (!(smbus = (void*)kmalloc(sizeof(struct amd_smbus), GFP_KERNEL)))
|
||||
return -1;
|
||||
memset(smbus, 0, sizeof(struct amd_smbus));
|
||||
|
||||
@@ -368,10 +392,18 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
|
||||
smbus->base = pci_resource_start(dev, 0);
|
||||
smbus->size = pci_resource_len(dev, 0);
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,14)
|
||||
if (!request_region(smbus->base, smbus->size, "amd8111 SMBus 2.0")) {
|
||||
kfree(smbus);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
if (check_region(smbus->base, smbus->size) < 0) {
|
||||
kfree(smbus);
|
||||
return -1;
|
||||
}
|
||||
request_region(smbus->base, smbus->size, "amd8111 SMBus 2.0");
|
||||
#endif
|
||||
|
||||
sprintf(smbus->adapter.name, "SMBus2 AMD8111 adapter at %04x", smbus->base);
|
||||
smbus->adapter.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD8111;
|
||||
@@ -389,13 +421,17 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
|
||||
|
||||
pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
|
||||
printk(KERN_INFO "i2c-amd8111.c: AMD8111 SMBus 2.0 adapter at %#x\n", smbus->base);
|
||||
#else
|
||||
printk(KERN_INFO "i2c-amd8111.c: AMD8111 SMBus 2.0 adapter at pci%s\n", dev->slot_name);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __devexit amd8111_remove(struct pci_dev *dev)
|
||||
{
|
||||
struct amd_smbus *smbus = pci_get_drvdata(dev);
|
||||
struct amd_smbus *smbus = (void*) pci_get_drvdata(dev);
|
||||
if (i2c_del_adapter(&smbus->adapter)) {
|
||||
printk(KERN_WARNING "i2c-amd8111.c: Failed to unregister adapter.\n");
|
||||
return;
|
||||
@@ -408,6 +444,43 @@ static struct pci_device_id amd8111_id_table[] __devinitdata =
|
||||
{{ 0x1022, 0x746a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
|
||||
{ 0 }};
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
|
||||
|
||||
static struct pci_dev *amd8111_devs[8] = { NULL, /* ... */ };
|
||||
static int amd8111_devcnt = 0;
|
||||
|
||||
int i2c_amd_8111_init(void)
|
||||
{
|
||||
struct pci_dev *pci;
|
||||
struct pci_device_id *id;
|
||||
int found = 0;
|
||||
|
||||
for (id = amd8111_id_table; id->vendor; id++) {
|
||||
pci = NULL;
|
||||
while ((pci = pci_find_device(id->vendor, id->device, pci)))
|
||||
if (amd8111_devcnt < 8 && !amd8111_probe(pci, id))
|
||||
amd8111_devs[amd8111_devcnt++] = pci;
|
||||
}
|
||||
|
||||
return found ? 0 : -ENODEV;
|
||||
}
|
||||
|
||||
#ifdef MODULE
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_amd8111_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < amd8111_devcnt; i++)
|
||||
amd8111_remove(amd8111_devs[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
static struct pci_driver amd8111_driver = {
|
||||
.name = "amd8111 smbus 2.0",
|
||||
.id_table = amd8111_id_table,
|
||||
@@ -427,3 +500,5 @@ void __exit amd8111_exit(void)
|
||||
|
||||
module_init(amd8111_init);
|
||||
module_exit(amd8111_exit);
|
||||
|
||||
#endif
|
||||
+28
-4
@@ -79,7 +79,8 @@ sub gen_Documentation_Configure_help
|
||||
if (m@I2C mainboard interfaces@ or
|
||||
m@Acer Labs ALI 1535@ or
|
||||
m@Acer Labs ALI 1533 and 1543C@ or
|
||||
m@AMD 756/766@ or
|
||||
m@AMD 756/766/768/8111@ 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
|
||||
@@ -142,10 +143,17 @@ CONFIG_I2C_ALI15X3
|
||||
built as a module which can be inserted and removed while the kernel
|
||||
is running.
|
||||
|
||||
AMD 756/766/768
|
||||
AMD 756/766/768/8111
|
||||
CONFIG_I2C_AMD756
|
||||
If you say yes to this option, support will be included for the AMD
|
||||
756/766/768 mainboard I2C interfaces. This can also be
|
||||
756/766/768/8111 mainboard I2C interfaces. This can also be
|
||||
built as a module which can be inserted and removed while the kernel
|
||||
is running.
|
||||
|
||||
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.
|
||||
|
||||
@@ -800,7 +808,8 @@ sub gen_drivers_i2c_Config_in
|
||||
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 ' Apple Hydra Mac I/O' CONFIG_I2C_HYDRA $CONFIG_I2C_ALGOBIT
|
||||
dep_tristate ' AMD 756/766/768' CONFIG_I2C_AMD756 $CONFIG_I2C
|
||||
dep_tristate ' AMD 756/766/768/8111' CONFIG_I2C_AMD756 $CONFIG_I2C
|
||||
dep_tristate ' AMD 8111 SMBus 2.0' CONFIG_I2C_AMD8111 $CONFIG_I2C
|
||||
dep_tristate ' DEC Tsunami I2C interface' CONFIG_I2C_TSUNAMI $CONFIG_I2C_ALGOBIT $CONFIG_ALPHA
|
||||
dep_tristate ' Intel 82801AA, AB, BA, DB' CONFIG_I2C_I801 $CONFIG_I2C
|
||||
dep_tristate ' Intel i810AA/AB/E and i815' CONFIG_I2C_I810 $CONFIG_I2C_ALGOBIT
|
||||
@@ -1172,6 +1181,7 @@ sub gen_drivers_i2c_Makefile
|
||||
obj-$(CONFIG_I2C_ALI1535) += i2c-ali1535.o
|
||||
obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o
|
||||
obj-$(CONFIG_I2C_AMD756) += i2c-amd756.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
|
||||
@@ -1213,6 +1223,14 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_I2C_AMD8111),y)
|
||||
L_OBJS += i2c-amd8111.o
|
||||
else
|
||||
ifeq ($(CONFIG_I2C_AMD8111),m)
|
||||
M_OBJS += i2c-amd8111.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_I2C_HYDRA),y)
|
||||
L_OBJS += i2c-hydra.o
|
||||
else
|
||||
@@ -1363,6 +1381,9 @@ sub gen_drivers_i2c_i2c_core_c
|
||||
#ifdef CONFIG_I2C_AMD756
|
||||
extern int i2c_amd756_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_I2C_AMD8111
|
||||
extern int i2c_amd8111_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_I2C_HYDRA
|
||||
extern int i2c_hydra_init(void);
|
||||
#endif
|
||||
@@ -1414,6 +1435,9 @@ EOF
|
||||
#ifdef CONFIG_I2C_AMD756
|
||||
i2c_amd756_init();
|
||||
#endif
|
||||
#ifdef CONFIG_I2C_AMD8111
|
||||
i2c_amd8111_init();
|
||||
#endif
|
||||
#ifdef CONFIG_I2C_HYDRA
|
||||
i2c_hydra_init();
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user