X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fi2c%2Fbusses%2Fi2c-sis630.c;h=acb75e2824140220fcea0b4e010fac3e0c69f0fb;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=516f51abe901ded679bf26f63e6201a9795061e0;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 516f51abe..acb75e282 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c @@ -48,9 +48,9 @@ Note: we assume there can only be one device, with one SMBus interface. */ -#include #include #include +#include #include #include #include @@ -92,16 +92,18 @@ #define SIS630_PCALL 0x04 #define SIS630_BLOCK_DATA 0x05 +static struct pci_driver sis630_driver; + /* insmod parameters */ -static int high_clock = 0; -static int force = 0; -MODULE_PARM(high_clock, "i"); +static int high_clock; +static int force; +module_param(high_clock, bool, 0); MODULE_PARM_DESC(high_clock, "Set Host Master Clock to 56KHz (default 14KHz)."); -MODULE_PARM(force, "i"); +module_param(force, bool, 0); MODULE_PARM_DESC(force, "Forcibly enable the SIS630. DANGEROUS!"); /* acpi base address */ -static unsigned short acpi_base = 0; +static unsigned short acpi_base; /* supported chips */ static int supported[] = { @@ -144,7 +146,7 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldc dev_dbg(&adap->dev, "saved clock 0x%02x\n", *oldclock); /* disable timeout interrupt , set Host Master Clock to 56KHz if requested */ - if (high_clock > 0) + if (high_clock) sis630_write(SMB_CNT, 0x20); else sis630_write(SMB_CNT, (*oldclock & ~0x40)); @@ -165,7 +167,7 @@ static int sis630_transaction_wait(struct i2c_adapter *adap, int size) /* We will always wait for a fraction of a second! */ do { - i2c_delay(1); + msleep(1); temp = sis630_read(SMB_STS); /* check if block transmitted */ if (size == SIS630_BLOCK_DATA && (temp & 0x10)) @@ -209,7 +211,7 @@ static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock) * restore old Host Master Clock if high_clock is set * and oldclock was not 56KHz */ - if (high_clock > 0 && !(oldclock & 0x20)) + if (high_clock && !(oldclock & 0x20)) sis630_write(SMB_CNT,(sis630_read(SMB_CNT) & ~0x20)); dev_dbg(&adap->dev, "SMB_CNT after clock restore 0x%02x\n", sis630_read(SMB_CNT)); @@ -400,7 +402,7 @@ static int sis630_setup(struct pci_dev *sis630_dev) if (dummy) { pci_dev_put(dummy); } - else if (force > 0) { + else if (force) { dev_err(&sis630_dev->dev, "WARNING: Can't detect SIS630 compatible device, but " "loading because of force option enabled\n"); } @@ -432,7 +434,8 @@ static int sis630_setup(struct pci_dev *sis630_dev) dev_dbg(&sis630_dev->dev, "ACPI base at 0x%04x\n", acpi_base); /* Everything is happy, let's grab the memory and set things up. */ - if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, "sis630-smbus")) { + if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, + sis630_driver.name)) { dev_err(&sis630_dev->dev, "SMBus registers 0x%04x-0x%04x already " "in use!\n", acpi_base + SMB_STS, acpi_base + SMB_SAA); goto exit; @@ -448,24 +451,24 @@ exit: static struct i2c_algorithm smbus_algorithm = { - .name = "Non-I2C SMBus adapter", - .id = I2C_ALGO_SMBUS, .smbus_xfer = sis630_access, .functionality = sis630_func, }; static struct i2c_adapter sis630_adapter = { .owner = THIS_MODULE, - .class = I2C_ADAP_CLASS_SMBUS, - .name = "unset", + .class = I2C_CLASS_HWMON, .algo = &smbus_algorithm, }; static struct pci_device_id sis630_ids[] __devinitdata = { { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, + { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC) }, { 0, } }; +MODULE_DEVICE_TABLE (pci, sis630_ids); + static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_id *id) { if (sis630_setup(dev)) { @@ -493,7 +496,7 @@ static void __devexit sis630_remove(struct pci_dev *dev) static struct pci_driver sis630_driver = { - .name = "sis630 smbus", + .name = "sis630_smbus", .id_table = sis630_ids, .probe = sis630_probe, .remove = __devexit_p(sis630_remove), @@ -501,7 +504,7 @@ static struct pci_driver sis630_driver = { static int __init i2c_sis630_init(void) { - return pci_module_init(&sis630_driver); + return pci_register_driver(&sis630_driver); }