mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-02 13:30:30 +00:00
(Kyösti) some cleanups for 2.4+
Module refcounting using .owner, removing of inc/dec_use.
These require (yet unreleased) i2c 2.8.0+.
Named initializers everywhere. Unified namespace.
Cleanup for 2.5, remove EXPORT_NO_SYMBOLS, declare everything
static. Apply initcalls.
PCI device registration changes for busses started, replicating
from i2c-amd*. While everything does compile, nothing really
works. Well, maybe i2c-amd* ported back from 2.5 tree.
After updating your work directory, run
> cvs diff -u -r LAST-PRE-2-8-I2C > lm-2.8-patches-1
BEWARE: I have not even insmoded any of these yet.
To compile, you need i2c from cvs too.
For 2.4 kernel :
> cvs co -r lk2-4 i2c
For 2.5 kernel :
> cvs co i2c
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1698 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
2a462eaae3
commit
39391ba6ea
59 files changed
+1596
-5391
No files matched your search
@@ -229,21 +229,7 @@ void __init dmi_scan_mach(void)
|
||||
printk("dmi_scan.o: SM BIOS found\n");
|
||||
}
|
||||
|
||||
#ifdef MODULE
|
||||
MODULE_DESCRIPTION("SM BIOS DMI Scanner");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
EXPORT_SYMBOL(dmi_ident);
|
||||
EXPORT_SYMBOL(dmi_scan_mach);
|
||||
int init_module(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
+49
-111
@@ -66,9 +66,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#ifndef DECLARE_MUTEX
|
||||
#define DECLARE_MUTEX(name) struct semaphore name = MUTEX
|
||||
@@ -144,52 +142,9 @@ MODULE_LICENSE("GPL");
|
||||
/* -> Read = 1 */
|
||||
#define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_ali1535_init(void);
|
||||
static int __init ali1535_cleanup(void);
|
||||
static int ali1535_setup(void);
|
||||
static s32 ali1535_access(struct i2c_adapter *adap, u16 addr,
|
||||
unsigned short flags, char read_write,
|
||||
u8 command, int size,
|
||||
union i2c_smbus_data *data);
|
||||
static void ali1535_do_pause(unsigned int amount);
|
||||
static int ali1535_transaction(void);
|
||||
static void ali1535_inc(struct i2c_adapter *adapter);
|
||||
static void ali1535_dec(struct i2c_adapter *adapter);
|
||||
static u32 ali1535_func(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
/* name */ "Non-i2c SMBus adapter",
|
||||
/* id */ I2C_ALGO_SMBUS,
|
||||
/* master_xfer */ NULL,
|
||||
/* smbus_access */ ali1535_access,
|
||||
/* slave_send */ NULL,
|
||||
/* slave_rcv */ NULL,
|
||||
/* algo_control */ NULL,
|
||||
/* functionality */ ali1535_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter ali1535_adapter = {
|
||||
"unset",
|
||||
I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI1535,
|
||||
&smbus_algorithm,
|
||||
NULL,
|
||||
ali1535_inc,
|
||||
ali1535_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int __initdata ali1535_initialized;
|
||||
static unsigned short ali1535_smba = 0;
|
||||
DECLARE_MUTEX(i2c_ali1535_sem);
|
||||
|
||||
@@ -591,16 +546,6 @@ EXIT:
|
||||
return result;
|
||||
}
|
||||
|
||||
void ali1535_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void ali1535_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
u32 ali1535_func(struct i2c_adapter *adapter)
|
||||
{
|
||||
@@ -609,82 +554,75 @@ u32 ali1535_func(struct i2c_adapter *adapter)
|
||||
I2C_FUNC_SMBUS_BLOCK_DATA;
|
||||
}
|
||||
|
||||
int __init i2c_ali1535_init(void)
|
||||
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 = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "unset",
|
||||
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI1535,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
||||
static struct pci_device_id ali1535_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-ali1535.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
#ifdef DEBUG
|
||||
/* PE- It might be good to make this a permanent part of the code! */
|
||||
if (ali1535_initialized) {
|
||||
printk
|
||||
("i2c-ali1535.o: Oops, ali1535_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
#endif
|
||||
ali1535_initialized = 0;
|
||||
if ((res = ali1535_setup())) {
|
||||
if (ali1535_setup()) {
|
||||
printk
|
||||
("i2c-ali1535.o: ALI1535 not detected, module not inserted.\n");
|
||||
ali1535_cleanup();
|
||||
return res;
|
||||
return -ENODEV;
|
||||
}
|
||||
ali1535_initialized++;
|
||||
|
||||
sprintf(ali1535_adapter.name, "SMBus ALI1535 adapter at %04x",
|
||||
ali1535_smba);
|
||||
if ((res = i2c_add_adapter(&ali1535_adapter))) {
|
||||
printk
|
||||
("i2c-ali1535.o: Adapter registration failed, module not inserted.\n");
|
||||
ali1535_cleanup();
|
||||
return res;
|
||||
}
|
||||
ali1535_initialized++;
|
||||
printk
|
||||
("i2c-ali1535.o: ALI1535 SMBus Controller detected and initialized\n");
|
||||
return 0;
|
||||
i2c_add_adapter(&ali1535_adapter);
|
||||
}
|
||||
|
||||
int __init ali1535_cleanup(void)
|
||||
static void __devexit ali1535_remove(struct pci_dev *dev)
|
||||
{
|
||||
int res;
|
||||
if (ali1535_initialized >= 2) {
|
||||
if ((res = i2c_del_adapter(&ali1535_adapter))) {
|
||||
printk
|
||||
("i2c-ali1535.o: i2c_del_adapter failed, module not removed\n");
|
||||
return res;
|
||||
} else
|
||||
ali1535_initialized--;
|
||||
}
|
||||
if (ali1535_initialized >= 1) {
|
||||
release_region(ali1535_smba, ALI1535_SMB_IOSIZE);
|
||||
ali1535_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_adapter(&ali1535_adapter);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
release_region(ali1535_smba, ALI1535_SMB_IOSIZE);
|
||||
}
|
||||
|
||||
#ifdef RLX
|
||||
EXPORT_SYMBOL(ali1535_smba);
|
||||
EXPORT_SYMBOL(ali1535_access);
|
||||
EXPORT_SYMBOL(i2c_ali1535_sem);
|
||||
#else
|
||||
EXPORT_NO_SYMBOLS;
|
||||
#endif
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, "
|
||||
"Mark D. Studebaker <mdsxyz123@yahoo.com> and Dan Eaton <dan.eaton@rocketlogix.com>");
|
||||
MODULE_DESCRIPTION("ALI1535 SMBus driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_ali1535_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return ali1535_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_ali1535_init);
|
||||
module_exit(i2c_ali1535_exit);
|
||||
|
||||
+51
-109
@@ -72,9 +72,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
/* ALI15X3 SMBus address offsets */
|
||||
#define SMBHSTSTS (0 + ali15x3_smba)
|
||||
@@ -135,52 +133,10 @@ MODULE_PARM(force_addr, "i");
|
||||
MODULE_PARM_DESC(force_addr,
|
||||
"Initialize the base address of the i2c controller");
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_ali15x3_init(void);
|
||||
static int __init ali15x3_cleanup(void);
|
||||
static int ali15x3_setup(void);
|
||||
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);
|
||||
|
||||
static void ali15x3_do_pause(unsigned int amount);
|
||||
static int ali15x3_transaction(void);
|
||||
static void ali15x3_inc(struct i2c_adapter *adapter);
|
||||
static void ali15x3_dec(struct i2c_adapter *adapter);
|
||||
static u32 ali15x3_func(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
/* name */ "Non-I2C SMBus adapter",
|
||||
/* id */ I2C_ALGO_SMBUS,
|
||||
/* master_xfer */ NULL,
|
||||
/* smbus_access */ ali15x3_access,
|
||||
/* slave_send */ NULL,
|
||||
/* slave_rcv */ NULL,
|
||||
/* algo_control */ NULL,
|
||||
/* functionality */ ali15x3_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter ali15x3_adapter = {
|
||||
"unset",
|
||||
I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI15X3,
|
||||
&smbus_algorithm,
|
||||
NULL,
|
||||
ali15x3_inc,
|
||||
ali15x3_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int __initdata ali15x3_initialized;
|
||||
static unsigned short ali15x3_smba = 0;
|
||||
static int locked=0;
|
||||
|
||||
@@ -558,16 +514,6 @@ s32 ali15x3_access(struct i2c_adapter * adap, u16 addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ali15x3_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void ali15x3_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
u32 ali15x3_func(struct i2c_adapter *adapter)
|
||||
{
|
||||
@@ -576,74 +522,70 @@ u32 ali15x3_func(struct i2c_adapter *adapter)
|
||||
I2C_FUNC_SMBUS_BLOCK_DATA;
|
||||
}
|
||||
|
||||
int __init i2c_ali15x3_init(void)
|
||||
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 = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "unset",
|
||||
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI15X3,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
||||
|
||||
static struct pci_device_id ali15x3_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-ali15x3.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
#ifdef DEBUG
|
||||
/* PE- It might be good to make this a permanent part of the code! */
|
||||
if (ali15x3_initialized) {
|
||||
printk
|
||||
("i2c-ali15x3.o: Oops, ali15x3_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
#endif
|
||||
ali15x3_initialized = 0;
|
||||
if ((res = ali15x3_setup())) {
|
||||
if (ali15x3_setup()) {
|
||||
printk
|
||||
("i2c-ali15x3.o: ALI15X3 not detected, module not inserted.\n");
|
||||
ali15x3_cleanup();
|
||||
return res;
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
ali15x3_initialized++;
|
||||
|
||||
sprintf(ali15x3_adapter.name, "SMBus ALI15X3 adapter at %04x",
|
||||
ali15x3_smba);
|
||||
if ((res = i2c_add_adapter(&ali15x3_adapter))) {
|
||||
printk
|
||||
("i2c-ali15x3.o: Adapter registration failed, module not inserted.\n");
|
||||
ali15x3_cleanup();
|
||||
return res;
|
||||
}
|
||||
ali15x3_initialized++;
|
||||
printk
|
||||
("i2c-ali15x3.o: ALI15X3 SMBus Controller detected and initialized\n");
|
||||
return 0;
|
||||
i2c_add_adapter(&ali15x3_adapter);
|
||||
}
|
||||
|
||||
int __init ali15x3_cleanup(void)
|
||||
static void __devexit ali15x3_remove(struct pci_dev *dev)
|
||||
{
|
||||
int res;
|
||||
if (ali15x3_initialized >= 2) {
|
||||
if ((res = i2c_del_adapter(&ali15x3_adapter))) {
|
||||
printk
|
||||
("i2c-ali15x3.o: i2c_del_adapter failed, module not removed\n");
|
||||
return res;
|
||||
} else
|
||||
ali15x3_initialized--;
|
||||
}
|
||||
if (ali15x3_initialized >= 1) {
|
||||
release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE);
|
||||
ali15x3_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_adapter(&ali15x3_adapter);
|
||||
}
|
||||
|
||||
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);
|
||||
release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, and Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("ALI15X3 SMBus driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_ali15x3_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return ali15x3_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_ali15x3_init);
|
||||
module_exit(i2c_ali15x3_exit);
|
||||
@@ -203,6 +203,7 @@ static int amd756_transaction(void)
|
||||
}
|
||||
|
||||
/* 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)
|
||||
@@ -297,17 +298,6 @@ static s32 amd756_access(struct i2c_adapter * adap, u16 addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void amd756_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void amd756_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
static u32 amd756_func(struct i2c_adapter *adapter)
|
||||
{
|
||||
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
|
||||
@@ -323,11 +313,10 @@ static struct i2c_algorithm smbus_algorithm = {
|
||||
};
|
||||
|
||||
static struct i2c_adapter amd756_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "unset",
|
||||
.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 };
|
||||
@@ -405,10 +394,10 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void __devexit amd756_remove(struct pci_dev *dev)
|
||||
{
|
||||
i2c_del_adapter(&amd756_adapter);
|
||||
release_region(amd756_ioport, SMB_IOSIZE);
|
||||
}
|
||||
|
||||
static struct pci_driver amd756_driver = {
|
||||
@@ -418,20 +407,22 @@ static struct pci_driver amd756_driver = {
|
||||
.remove = __devexit_p(amd756_remove),
|
||||
};
|
||||
|
||||
static int __init amd756_init(void)
|
||||
static int __init i2c_amd756_init(void)
|
||||
{
|
||||
printk(KERN_INFO "i2c-amd756.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return pci_module_init(&amd756_driver);
|
||||
}
|
||||
|
||||
static void __exit amd756_exit(void)
|
||||
|
||||
static void __exit i2c_amd756_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&amd756_driver);
|
||||
release_region(amd756_ioport, SMB_IOSIZE);
|
||||
}
|
||||
|
||||
MODULE_AUTHOR("Merlin Hughes <merlin@merlin.org>");
|
||||
MODULE_DESCRIPTION("AMD756/766/768/nVidia nForce SMBus driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_init(amd756_init)
|
||||
module_exit(amd756_exit)
|
||||
module_init(i2c_amd756_init)
|
||||
module_exit(i2c_amd756_exit)
|
||||
+21
-29
@@ -320,15 +320,6 @@ s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void amd8111_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void amd8111_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
u32 amd8111_func(struct i2c_adapter *adapter)
|
||||
{
|
||||
@@ -345,9 +336,16 @@ static struct i2c_algorithm smbus_algorithm = {
|
||||
.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 -1;
|
||||
@@ -366,14 +364,14 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
|
||||
return -1;
|
||||
}
|
||||
|
||||
smbus->adapter.owner = THIS_MODULE;
|
||||
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;
|
||||
|
||||
if (i2c_add_adapter(&smbus->adapter)) {
|
||||
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);
|
||||
@@ -386,39 +384,33 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void __devexit amd8111_remove(struct pci_dev *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;
|
||||
}
|
||||
i2c_del_adapter(&smbus->adapter);
|
||||
release_region(smbus->base, smbus->size);
|
||||
kfree(smbus);
|
||||
}
|
||||
|
||||
static struct pci_device_id amd8111_id_table[] __devinitdata =
|
||||
{{ 0x1022, 0x746a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
|
||||
{ 0 }};
|
||||
|
||||
|
||||
static struct pci_driver amd8111_driver = {
|
||||
.name = "amd8111 smbus 2.0",
|
||||
.id_table = amd8111_id_table,
|
||||
.probe = amd8111_probe,
|
||||
.remove = __devexit_p(amd8111_remove),
|
||||
.name = "amd8111 smbus 2.0",
|
||||
.id_table = amd8111_ids,
|
||||
.probe = amd8111_probe,
|
||||
.remove = __devexit_p(amd8111_remove),
|
||||
};
|
||||
|
||||
int __init amd8111_init(void)
|
||||
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);
|
||||
}
|
||||
|
||||
void __exit amd8111_exit(void)
|
||||
|
||||
static void __exit i2c_amd8111_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&amd8111_driver);
|
||||
}
|
||||
|
||||
module_init(amd8111_init);
|
||||
module_exit(amd8111_exit);
|
||||
module_init(i2c_amd8111_init);
|
||||
module_exit(i2c_amd8111_exit);
|
||||
+50
-84
@@ -35,13 +35,8 @@
|
||||
#include <linux/i2c-algo-bit.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
/* PCI device */
|
||||
#define VENDOR PCI_VENDOR_ID_APPLE
|
||||
#define DEVICE PCI_DEVICE_ID_APPLE_HYDRA
|
||||
|
||||
#define HYDRA_CACHE_PD 0x00000030
|
||||
|
||||
@@ -104,105 +99,76 @@ static int bit_hydra_getsda(void *data)
|
||||
return (pdregr() & HYDRA_SDAT) != 0;
|
||||
}
|
||||
|
||||
static void bit_hydra_inc(struct i2c_adapter *adap)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
static void bit_hydra_dec(struct i2c_adapter *adap)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static struct i2c_algo_bit_data bit_hydra_data = {
|
||||
NULL,
|
||||
bit_hydra_setsda,
|
||||
bit_hydra_setscl,
|
||||
bit_hydra_getsda,
|
||||
bit_hydra_getscl,
|
||||
5, 5, 100, /*waits, timeout */
|
||||
.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 = {
|
||||
"Hydra i2c",
|
||||
I2C_HW_B_HYDRA,
|
||||
NULL,
|
||||
&bit_hydra_data,
|
||||
bit_hydra_inc,
|
||||
bit_hydra_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
.owner = THIS_MODULE,
|
||||
.name = "Hydra i2c",
|
||||
.id = I2C_HW_B_HYDRA,
|
||||
.algo_data = &bit_hydra_data,
|
||||
};
|
||||
|
||||
|
||||
static int find_hydra(void)
|
||||
/* PCI device */
|
||||
#define VENDOR PCI_VENDOR_ID_APPLE
|
||||
#define DEVICE PCI_DEVICE_ID_APPLE_HYDRA
|
||||
|
||||
static struct pci_device_id hydra_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit hydra_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
unsigned int base_addr;
|
||||
|
||||
if (!pci_present())
|
||||
return -ENODEV;
|
||||
|
||||
dev = pci_find_device(VENDOR, DEVICE, NULL);
|
||||
if (!dev) {
|
||||
printk("Hydra not found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
|
||||
base_addr = dev->resource[0].start;
|
||||
#else
|
||||
base_addr = dev->base_address[0];
|
||||
#endif
|
||||
hydra_base = (unsigned long) ioremap(base_addr, 0x100);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_hydra_init(void)
|
||||
{
|
||||
if (find_hydra() < 0) {
|
||||
printk("Error while reading PCI configuration\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
pdregw(0); /* clear SCLK_OE and SDAT_OE */
|
||||
|
||||
if (i2c_bit_add_bus(&bit_hydra_ops) == 0) {
|
||||
printk("Hydra i2c: Module succesfully loaded\n");
|
||||
return 0;
|
||||
} else {
|
||||
iounmap((void *) hydra_base);
|
||||
printk
|
||||
("Hydra i2c: Algo-bit error, couldn't register bus\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
return i2c_bit_add_bus(&bit_hydra_ops);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
static void __devexit hydra_remove(struct pci_dev *dev)
|
||||
{
|
||||
pdregw(0); /* clear SCLK_OE and SDAT_OE */
|
||||
i2c_bit_del_bus(&bit_hydra_ops);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
iounmap((void *) hydra_base);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
MODULE_AUTHOR("Geert Uytterhoeven <geert@linux-m68k.org>");
|
||||
MODULE_DESCRIPTION("i2c for Apple Hydra Mac I/O");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_hydra_init();
|
||||
}
|
||||
module_init(i2c_hydra_init);
|
||||
module_exit(i2c_hydra_exit);
|
||||
|
||||
void cleanup_module(void)
|
||||
{
|
||||
i2c_bit_del_bus(&bit_hydra_ops);
|
||||
if (hydra_base) {
|
||||
pdregw(0); /* clear SCLK_OE and SDAT_OE */
|
||||
iounmap((void *) hydra_base);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+54
-103
@@ -51,9 +51,7 @@
|
||||
#include <linux/i2c.h>
|
||||
#include "version.h"
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#ifdef I2C_FUNC_SMBUS_BLOCK_DATA_PEC
|
||||
#define HAVE_PEC
|
||||
@@ -127,53 +125,18 @@ MODULE_PARM_DESC(force_addr,
|
||||
"Forcibly enable the I801 at the given address. "
|
||||
"EXTREMELY DANGEROUS!");
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_i801_init(void);
|
||||
static int __init i801_cleanup(void);
|
||||
static int i801_setup(void);
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
static void i801_do_pause(unsigned int amount);
|
||||
static int i801_transaction(void);
|
||||
static int i801_block_transaction(union i2c_smbus_data *data,
|
||||
char read_write, int command);
|
||||
static void i801_inc(struct i2c_adapter *adapter);
|
||||
static void i801_dec(struct i2c_adapter *adapter);
|
||||
static u32 i801_func(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
/* name */ "Non-I2C SMBus adapter",
|
||||
/* id */ I2C_ALGO_SMBUS,
|
||||
/* master_xfer */ NULL,
|
||||
/* smbus_xfer */ i801_access,
|
||||
/* slave_send */ NULL,
|
||||
/* slave_rcv */ NULL,
|
||||
/* algo_control */ NULL,
|
||||
/* functionality */ i801_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter i801_adapter = {
|
||||
"unset",
|
||||
I2C_ALGO_SMBUS | I2C_HW_SMBUS_I801,
|
||||
&smbus_algorithm,
|
||||
NULL,
|
||||
i801_inc,
|
||||
i801_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int __initdata i801_initialized;
|
||||
static unsigned short i801_smba = 0;
|
||||
static struct pci_dev *I801_dev = NULL;
|
||||
static int isich4 = 0;
|
||||
@@ -670,15 +633,6 @@ s32 i801_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void i801_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void i801_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
u32 i801_func(struct i2c_adapter *adapter)
|
||||
{
|
||||
@@ -693,73 +647,70 @@ u32 i801_func(struct i2c_adapter *adapter)
|
||||
;
|
||||
}
|
||||
|
||||
int __init i2c_i801_init(void)
|
||||
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 = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "unset",
|
||||
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_I801,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
||||
|
||||
static struct pci_device_id i801_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
int res;
|
||||
printk(KERN_INFO "i2c-i801.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
#ifdef DEBUG
|
||||
/* PE- It might be good to make this a permanent part of the code! */
|
||||
if (i801_initialized) {
|
||||
printk
|
||||
(KERN_DEBUG "i2c-i801.o: Oops, i801_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
#endif
|
||||
i801_initialized = 0;
|
||||
if ((res = i801_setup())) {
|
||||
|
||||
if (i801_setup()) {
|
||||
printk
|
||||
(KERN_WARNING "i2c-i801.o: I801 not detected, module not inserted.\n");
|
||||
i801_cleanup();
|
||||
return res;
|
||||
return -ENODEV;
|
||||
}
|
||||
i801_initialized++;
|
||||
|
||||
sprintf(i801_adapter.name, "SMBus I801 adapter at %04x",
|
||||
i801_smba);
|
||||
if ((res = i2c_add_adapter(&i801_adapter))) {
|
||||
printk
|
||||
(KERN_ERR "i2c-i801.o: Adapter registration failed, module not inserted.\n");
|
||||
i801_cleanup();
|
||||
return res;
|
||||
}
|
||||
i801_initialized++;
|
||||
printk(KERN_INFO "i2c-i801.o: I801 bus detected and initialized\n");
|
||||
return 0;
|
||||
i2c_add_adapter(&i801_adapter);
|
||||
}
|
||||
|
||||
int __init i801_cleanup(void)
|
||||
static void __devexit i801_remove(struct pci_dev *dev)
|
||||
{
|
||||
int res;
|
||||
if (i801_initialized >= 2) {
|
||||
if ((res = i2c_del_adapter(&i801_adapter))) {
|
||||
printk
|
||||
(KERN_ERR "i2c-i801.o: i2c_del_adapter failed, module not removed\n");
|
||||
return res;
|
||||
} else
|
||||
i801_initialized--;
|
||||
}
|
||||
if (i801_initialized >= 1) {
|
||||
release_region(i801_smba, (isich4 ? 16 : 8));
|
||||
i801_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_adapter(&i801_adapter);
|
||||
}
|
||||
|
||||
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.o 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);
|
||||
release_region(i801_smba, (isich4 ? 16 : 8));
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, and Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("I801 SMBus driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_i801_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return i801_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_i801_init);
|
||||
module_exit(i2c_i801_exit);
|
||||
+64
-147
@@ -44,9 +44,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
/* PCI defines */
|
||||
#ifndef PCI_DEVICE_ID_INTEL_82810_IG1
|
||||
@@ -93,24 +91,10 @@ static int i810_supported[] = {PCI_DEVICE_ID_INTEL_82810_IG1,
|
||||
#define CYCLE_DELAY 10
|
||||
#define TIMEOUT (HZ / 2)
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_i810_init(void);
|
||||
static int __init i810i2c_cleanup(void);
|
||||
static int i810i2c_setup(void);
|
||||
|
||||
static void config_i810(struct pci_dev *dev);
|
||||
static void i810_inc(struct i2c_adapter *adapter);
|
||||
static void i810_dec(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
static int __initdata i810i2c_initialized;
|
||||
static unsigned char *mem;
|
||||
|
||||
static inline void outlong(unsigned int dat, int off)
|
||||
@@ -192,46 +176,6 @@ static int bit_i810ddc_getsda(void *data)
|
||||
return (0 != (readlong(I810_GPIOA) & SDA_VAL_IN));
|
||||
}
|
||||
|
||||
static struct i2c_algo_bit_data i810_i2c_bit_data = {
|
||||
NULL,
|
||||
bit_i810i2c_setsda,
|
||||
bit_i810i2c_setscl,
|
||||
bit_i810i2c_getsda,
|
||||
bit_i810i2c_getscl,
|
||||
CYCLE_DELAY, CYCLE_DELAY, TIMEOUT
|
||||
};
|
||||
|
||||
static struct i2c_adapter i810_i2c_adapter = {
|
||||
"I810/I815 I2C Adapter",
|
||||
I2C_HW_B_I810,
|
||||
NULL,
|
||||
&i810_i2c_bit_data,
|
||||
i810_inc,
|
||||
i810_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct i2c_algo_bit_data i810_ddc_bit_data = {
|
||||
NULL,
|
||||
bit_i810ddc_setsda,
|
||||
bit_i810ddc_setscl,
|
||||
bit_i810ddc_getsda,
|
||||
bit_i810ddc_getscl,
|
||||
CYCLE_DELAY, CYCLE_DELAY, TIMEOUT
|
||||
};
|
||||
|
||||
static struct i2c_adapter i810_ddc_adapter = {
|
||||
"I810/I815 DDC Adapter",
|
||||
I2C_HW_B_I810,
|
||||
NULL,
|
||||
&i810_ddc_bit_data,
|
||||
i810_inc,
|
||||
i810_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
/* Configures the chip */
|
||||
void config_i810(struct pci_dev *dev)
|
||||
@@ -239,11 +183,7 @@ void config_i810(struct pci_dev *dev)
|
||||
unsigned long cadr;
|
||||
|
||||
/* map I810 memory */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
|
||||
cadr = dev->resource[1].start;
|
||||
#else
|
||||
cadr = dev->base_address[1];
|
||||
#endif
|
||||
cadr += I810_IOCONTROL_OFFSET;
|
||||
cadr &= PCI_BASE_ADDRESS_MEM_MASK;
|
||||
mem = ioremap_nocache(cadr, 0x1000);
|
||||
@@ -255,110 +195,87 @@ void config_i810(struct pci_dev *dev)
|
||||
}
|
||||
}
|
||||
|
||||
/* Detect whether a supported device can be found,
|
||||
and initialize it */
|
||||
static int i810i2c_setup(void)
|
||||
|
||||
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 = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "I810/I815 I2C Adapter",
|
||||
.id = I2C_HW_B_I810,
|
||||
.algo_data = &i810_i2c_bit_data,
|
||||
};
|
||||
|
||||
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 = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "I810/I815 DDC Adapter",
|
||||
.id = I2C_HW_B_I810,
|
||||
.algo_data = &i810_ddc_bit_data,
|
||||
};
|
||||
|
||||
|
||||
static struct pci_device_id i810_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit i810_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
struct pci_dev *dev = NULL;
|
||||
int *num = i810_supported;
|
||||
config_i810(dev);
|
||||
printk("i2c-i810.o: i810/i815 found.\n");
|
||||
|
||||
do {
|
||||
if ((dev = pci_find_device(PCI_VENDOR_ID_INTEL,
|
||||
*num++, dev))) {
|
||||
config_i810(dev);
|
||||
if(!mem)
|
||||
return -ENOMEM;
|
||||
printk("i2c-i810.o: i810/i815 found.\n");
|
||||
return 0;
|
||||
}
|
||||
} while (*num != 0);
|
||||
i2c_bit_add_bus(&i810_i2c_adapter);
|
||||
i2c_bit_add_bus(&i810_ddc_adapter);
|
||||
}
|
||||
|
||||
return -ENODEV;
|
||||
static void __devexit i810_remove(struct pci_dev *dev)
|
||||
{
|
||||
i2c_bit_del_bus(&i810_ddc_adapter);
|
||||
i2c_bit_del_bus(&i810_i2c_adapter);
|
||||
}
|
||||
|
||||
|
||||
void i810_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
static struct pci_driver i810_driver = {
|
||||
.name = "i810 smbus",
|
||||
.id_table = i810_ids,
|
||||
.probe = i810_probe,
|
||||
.remove = __devexit_p(i810_remove),
|
||||
};
|
||||
|
||||
void i810_dec(struct i2c_adapter *adapter)
|
||||
static int __init i2c_i810_init(void)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
int __init i2c_i810_init(void)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-i810.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
|
||||
i810i2c_initialized = 0;
|
||||
if ((res = i810i2c_setup())) {
|
||||
printk
|
||||
("i2c-i810.o: i810/i815 not detected, module not inserted.\n");
|
||||
i810i2c_cleanup();
|
||||
return res;
|
||||
}
|
||||
if ((res = i2c_bit_add_bus(&i810_i2c_adapter))) {
|
||||
printk("i2c-i810.o: I2C adapter registration failed\n");
|
||||
} else {
|
||||
printk("i2c-i810.o: I810/I815 I2C bus initialized\n");
|
||||
i810i2c_initialized |= INIT2;
|
||||
}
|
||||
if ((res = i2c_bit_add_bus(&i810_ddc_adapter))) {
|
||||
printk("i2c-i810.o: DDC adapter registration failed\n");
|
||||
} else {
|
||||
printk("i2c-i810.o: I810/I815 DDC bus initialized\n");
|
||||
i810i2c_initialized |= INIT3;
|
||||
}
|
||||
if(!(i810i2c_initialized & (INIT2 | INIT3))) {
|
||||
printk("i2c-i810.o: Both registrations failed, module not inserted\n");
|
||||
i810i2c_cleanup();
|
||||
return res;
|
||||
}
|
||||
return 0;
|
||||
return pci_module_init(&i810_driver);
|
||||
}
|
||||
|
||||
int __init i810i2c_cleanup(void)
|
||||
|
||||
static void __exit i2c_i810_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
pci_unregister_driver(&i810_driver);
|
||||
iounmap(mem);
|
||||
if (i810i2c_initialized & INIT3) {
|
||||
if ((res = i2c_bit_del_bus(&i810_ddc_adapter))) {
|
||||
printk
|
||||
("i2c-i810.o: i2c_del_adapter failed, module not removed\n");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
if (i810i2c_initialized & INIT2) {
|
||||
if ((res = i2c_bit_del_bus(&i810_i2c_adapter))) {
|
||||
printk
|
||||
("i2c-i810.o: i2c_del_adapter failed, module not removed\n");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
i810i2c_initialized = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, Ralph Metzler <rjkm@thp.uni-koeln.de>, and Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("I810/I815 I2C/DDC driver");
|
||||
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_i810_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return i810i2c_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_i810_init);
|
||||
module_exit(i2c_i810_exit);
|
||||
@@ -30,51 +30,21 @@
|
||||
#include <linux/ipmi.h>
|
||||
#include "version.h"
|
||||
|
||||
static void i2c_ipmb_inc_use(struct i2c_adapter *adapter);
|
||||
static void i2c_ipmb_dec_use(struct i2c_adapter *adapter);
|
||||
static u32 i2c_ipmb_func(struct i2c_adapter *adapter);
|
||||
|
||||
int ipmb_access(struct i2c_adapter *adap,struct i2c_msg msgs[],
|
||||
int num);
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_ipmb_init(void);
|
||||
static int __init i2c_ipmb_cleanup(void);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* I2C Data */
|
||||
static struct i2c_algorithm i2c_ipmb_algorithm = {
|
||||
.name = "IPMB algorithm",
|
||||
.id = I2C_ALGO_IPMB,
|
||||
.master_xfer = ipmb_access,
|
||||
.smbus_xfer = NULL,
|
||||
.slave_send = NULL,
|
||||
.slave_recv = NULL,
|
||||
.algo_control = NULL,
|
||||
.functionality = i2c_ipmb_func,
|
||||
};
|
||||
|
||||
#define MAX_IPMB_ADAPTERS 8
|
||||
static struct i2c_adapter i2c_ipmb_adapter[MAX_IPMB_ADAPTERS];
|
||||
/*
|
||||
static struct i2c_adapter i2c_ipmb_adapter = {
|
||||
.name = "IPMB adapter",
|
||||
.id = I2C_ALGO_SMBUS | I2C_HW_IPMB,
|
||||
.algo = &i2c_ipmb_algorithm,
|
||||
.algo_data = NULL,
|
||||
.inc_use = &i2c_ipmb_inc_use,
|
||||
.dec_use = &i2c_ipmb_dec_use,
|
||||
.data = NULL,
|
||||
};
|
||||
*/
|
||||
|
||||
/* IPMI Data */
|
||||
#define IPMI_IPMB_CHANNEL 0
|
||||
@@ -240,7 +210,8 @@ static void ipmb_rcv_channel_info(struct ipmi_msg *msg)
|
||||
channel, type, protocol);
|
||||
}
|
||||
/*
|
||||
if ((rv = i2c_add_adapter(&i2c_ipmb_adapter))) {
|
||||
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;
|
||||
@@ -311,20 +282,6 @@ int ipmb_access(struct i2c_adapter *adap,struct i2c_msg msgs[],
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void i2c_ipmb_inc_use(struct i2c_adapter *adapter)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void i2c_ipmb_dec_use(struct i2c_adapter *adapter)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
static u32 i2c_ipmb_func(struct i2c_adapter *adapter)
|
||||
@@ -385,7 +342,7 @@ static struct ipmi_smi_watcher smi_watcher =
|
||||
.smi_gone = ipmb_smi_gone
|
||||
};
|
||||
|
||||
int __init i2c_ipmb_init(void)
|
||||
static int __init i2c_ipmb_init(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
@@ -402,28 +359,16 @@ int __init i2c_ipmb_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __init ipmi_cleanup(void)
|
||||
|
||||
static void __exit i2c_ipmi_exit(void)
|
||||
{
|
||||
ipmi_smi_watcher_unregister(&smi_watcher);
|
||||
ipmb_smi_gone(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef MODULE
|
||||
MODULE_AUTHOR("M. D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("IPMB-BMC access through i2c");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_ipmb_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return ipmi_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_ipmb_init);
|
||||
module_exit(i2c_ipmi_exit);
|
||||
+15
-63
@@ -30,45 +30,22 @@
|
||||
#include <linux/ipmi.h>
|
||||
#include "version.h"
|
||||
|
||||
static void i2c_ipmi_inc_use(struct i2c_adapter *adapter);
|
||||
static void i2c_ipmi_dec_use(struct i2c_adapter *adapter);
|
||||
static u32 i2c_ipmi_func(struct i2c_adapter *adapter);
|
||||
|
||||
static int bmcclient_i2c_send_message(struct i2c_adapter *, char *, int);
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_ipmi_init(void);
|
||||
static int __init i2c_ipmi_cleanup(void);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* I2C Data */
|
||||
static struct i2c_algorithm i2c_ipmi_algorithm = {
|
||||
.name = "IPMI algorithm",
|
||||
.id = I2C_ALGO_IPMI,
|
||||
.master_xfer = NULL,
|
||||
.smbus_xfer = NULL,
|
||||
.slave_send = &bmcclient_i2c_send_message,
|
||||
.slave_recv = NULL,
|
||||
.algo_control = NULL,
|
||||
.functionality = &i2c_ipmi_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter i2c_ipmi_adapter = {
|
||||
.name = "IPMI adapter",
|
||||
.id = I2C_ALGO_IPMI | I2C_HW_IPMI,
|
||||
.algo = &i2c_ipmi_algorithm,
|
||||
.algo_data = NULL,
|
||||
.inc_use = &i2c_ipmi_inc_use,
|
||||
.dec_use = &i2c_ipmi_dec_use,
|
||||
.data = NULL,
|
||||
/* Other fields not initialized */
|
||||
.owner = THIS_MODULE,
|
||||
.name = "IPMI adapter",
|
||||
.id = I2C_ALGO_IPMI | I2C_HW_IPMI,
|
||||
.algo = &i2c_ipmi_algorithm,
|
||||
};
|
||||
|
||||
/* IPMI Data */
|
||||
@@ -87,19 +64,6 @@ static int interfaces; /* number of BMC's found */
|
||||
static int (*rcv_callback)(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
|
||||
void i2c_ipmi_inc_use(struct i2c_adapter *adapter)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void i2c_ipmi_dec_use(struct i2c_adapter *adapter)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Dummy adapter... */
|
||||
static u32 i2c_ipmi_func(struct i2c_adapter *adapter)
|
||||
@@ -189,8 +153,7 @@ static struct ipmi_user_hndl ipmi_hndlrs =
|
||||
/* callback for each BMC found */
|
||||
static void ipmi_register_bmc(int ipmi_intf)
|
||||
{
|
||||
unsigned long flags;
|
||||
int rv;
|
||||
int error;
|
||||
|
||||
if(interfaces > 0) { /* 1 max for now */
|
||||
printk(KERN_INFO
|
||||
@@ -199,13 +162,14 @@ static void ipmi_register_bmc(int ipmi_intf)
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ipmi_create_user(ipmi_intf, &ipmi_hndlrs, NULL, &i2c_ipmi_user);
|
||||
if (rv < 0) {
|
||||
error = ipmi_create_user(ipmi_intf, &ipmi_hndlrs, NULL, &i2c_ipmi_user);
|
||||
if (error < 0) {
|
||||
printk(KERN_ERR "i2c-ipmi.o: Unable to register with ipmi\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((rv = i2c_add_adapter(&i2c_ipmi_adapter))) {
|
||||
return i2c_add_adapter(&i2c_ipmi_adapter);
|
||||
if (error) {
|
||||
printk(KERN_ERR "i2c-ipmi.o: Adapter registration failed, "
|
||||
"module i2c-ipmi.o is not inserted\n.");
|
||||
return;
|
||||
@@ -239,7 +203,7 @@ static struct ipmi_smi_watcher smi_watcher =
|
||||
.smi_gone = ipmi_smi_gone
|
||||
};
|
||||
|
||||
int __init i2c_ipmi_init(void)
|
||||
static int __init i2c_ipmi_init(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
@@ -256,28 +220,16 @@ int __init i2c_ipmi_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __init ipmi_cleanup(void)
|
||||
|
||||
static void __exit i2c_ipmi_exit(void)
|
||||
{
|
||||
ipmi_smi_watcher_unregister(&smi_watcher);
|
||||
ipmi_smi_gone(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef MODULE
|
||||
MODULE_AUTHOR("M. D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("IPMI-BMC access through i2c");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_ipmi_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return ipmi_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_ipmi_init);
|
||||
module_exit(i2c_ipmi_exit);
|
||||
+22
-102
@@ -31,67 +31,8 @@
|
||||
#include <linux/init.h>
|
||||
#include "version.h"
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
static void isa_inc_use(struct i2c_adapter *adapter);
|
||||
static void isa_dec_use(struct i2c_adapter *adapter);
|
||||
static u32 isa_func(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_isa_init(void);
|
||||
static int __init isa_cleanup(void);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* This is the actual algorithm we define */
|
||||
static struct i2c_algorithm isa_algorithm = {
|
||||
/* name */ "ISA bus algorithm",
|
||||
/* id */ I2C_ALGO_ISA,
|
||||
/* master_xfer */ NULL,
|
||||
/* smbus_access */ NULL,
|
||||
/* slave_send */ NULL,
|
||||
/* slave_rcv */ NULL,
|
||||
/* algo_control */ NULL,
|
||||
/* functionality */ &isa_func,
|
||||
};
|
||||
|
||||
/* There can only be one... */
|
||||
static struct i2c_adapter isa_adapter = {
|
||||
/* name */ "ISA main adapter",
|
||||
/* id */ I2C_ALGO_ISA | I2C_HW_ISA,
|
||||
/* algorithm */ &isa_algorithm,
|
||||
/* algo_data */ NULL,
|
||||
/* inc_use */ &isa_inc_use,
|
||||
/* dec_use */ &isa_dec_use,
|
||||
/* data */ NULL,
|
||||
/* Other fields not initialized */
|
||||
};
|
||||
|
||||
/* Used in isa_init/cleanup */
|
||||
static int __initdata isa_initialized;
|
||||
|
||||
void isa_inc_use(struct i2c_adapter *adapter)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void isa_dec_use(struct i2c_adapter *adapter)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* We can't do a thing... */
|
||||
static u32 isa_func(struct i2c_adapter *adapter)
|
||||
@@ -99,58 +40,37 @@ static u32 isa_func(struct i2c_adapter *adapter)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __init i2c_isa_init(void)
|
||||
/* This is the actual algorithm we define */
|
||||
static struct i2c_algorithm isa_algorithm = {
|
||||
.name = "ISA bus algorithm",
|
||||
.id = I2C_ALGO_ISA,
|
||||
.functionality = isa_func,
|
||||
};
|
||||
|
||||
/* There can only be one... */
|
||||
static struct i2c_adapter isa_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "ISA main adapter",
|
||||
.id = I2C_ALGO_ISA | I2C_HW_ISA,
|
||||
.algo = &isa_algorithm,
|
||||
};
|
||||
|
||||
static int __init i2c_isa_init(void)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-isa.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
#ifdef DEBUG
|
||||
if (isa_initialized) {
|
||||
printk
|
||||
("i2c-isa.o: Oops, isa_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
#endif
|
||||
isa_initialized = 0;
|
||||
if ((res = i2c_add_adapter(&isa_adapter))) {
|
||||
printk("i2c-isa.o: Adapter registration failed, "
|
||||
"module i2c-isa.o is not inserted\n.");
|
||||
isa_cleanup();
|
||||
return res;
|
||||
}
|
||||
isa_initialized++;
|
||||
printk("i2c-isa.o: ISA bus access for i2c modules initialized.\n");
|
||||
return 0;
|
||||
return i2c_add_adapter(&isa_adapter);
|
||||
}
|
||||
|
||||
int __init isa_cleanup(void)
|
||||
|
||||
static void __exit i2c_isa_exit(void)
|
||||
{
|
||||
int res;
|
||||
if (isa_initialized >= 1) {
|
||||
if ((res = i2c_del_adapter(&isa_adapter))) {
|
||||
printk
|
||||
("i2c-isa.o: Adapter deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
} else
|
||||
isa_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_adapter(&isa_adapter);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
|
||||
MODULE_DESCRIPTION("ISA bus access through i2c");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_isa_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return isa_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_isa_init);
|
||||
module_exit(i2c_isa_exit);
|
||||
+23
-38
@@ -76,7 +76,7 @@ MODULE_DESCRIPTION("I2C driver for Apple's Keywest");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_PARM(probe, "i");
|
||||
MODULE_PARM(debug, "i");
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
|
||||
int probe = 0;
|
||||
int debug = 0;
|
||||
@@ -415,35 +415,24 @@ keywest_func(struct i2c_adapter * adapter)
|
||||
I2C_FUNC_SMBUS_BLOCK_DATA;
|
||||
}
|
||||
|
||||
static void
|
||||
keywest_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
static void
|
||||
keywest_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
/* For now, we only handle combined mode (smbus) */
|
||||
static struct i2c_algorithm keywest_algorithm = {
|
||||
name: "Keywest i2c",
|
||||
id: I2C_ALGO_SMBUS,
|
||||
smbus_xfer: keywest_smbus_xfer,
|
||||
master_xfer: keywest_xfer,
|
||||
functionality: keywest_func,
|
||||
.name = "Keywest i2c",
|
||||
.id = I2C_ALGO_SMBUS,
|
||||
.smbus_xfer = keywest_smbus_xfer,
|
||||
.master_xfer = keywest_xfer,
|
||||
.functionality = keywest_func,
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
static int __init
|
||||
create_iface(struct device_node* np)
|
||||
{
|
||||
unsigned long steps, *psteps, *prate;
|
||||
unsigned bsteps, tsize, i, nchan, addroffset;
|
||||
struct keywest_iface* iface;
|
||||
int rc;
|
||||
int error;
|
||||
|
||||
psteps = (unsigned long *)get_property(np, "AAPL,address-step", NULL);
|
||||
steps = psteps ? (*psteps) : 0x10;
|
||||
@@ -518,8 +507,8 @@ create_iface(struct device_node* np)
|
||||
write_reg(reg_isr, KW_I2C_IRQ_MASK);
|
||||
|
||||
/* Request chip interrupt */
|
||||
rc = request_irq(iface->irq, keywest_irq, 0, "keywest i2c", iface);
|
||||
if (rc) {
|
||||
error = request_irq(iface->irq, keywest_irq, 0, "keywest i2c", iface);
|
||||
if (error) {
|
||||
printk(KERN_ERR "i2c-keywest: can't get IRQ %d !\n", iface->irq);
|
||||
iounmap((void *)iface->base);
|
||||
kfree(iface);
|
||||
@@ -536,14 +525,12 @@ create_iface(struct device_node* np)
|
||||
chan->adapter.id = I2C_ALGO_SMBUS;
|
||||
chan->adapter.algo = &keywest_algorithm;
|
||||
chan->adapter.algo_data = NULL;
|
||||
chan->adapter.inc_use = keywest_inc;
|
||||
chan->adapter.dec_use = keywest_dec;
|
||||
chan->adapter.client_register = NULL;
|
||||
chan->adapter.client_unregister = NULL;
|
||||
chan->adapter.data = chan;
|
||||
|
||||
rc = i2c_add_adapter(&chan->adapter);
|
||||
if (rc) {
|
||||
error = i2c_add_adapter(&chan->adapter);
|
||||
if (error) {
|
||||
printk("i2c-keywest.c: Adapter %s registration failed\n",
|
||||
chan->adapter.name);
|
||||
chan->adapter.data = NULL;
|
||||
@@ -567,10 +554,10 @@ create_iface(struct device_node* np)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
static void __exit
|
||||
dispose_iface(struct keywest_iface *iface)
|
||||
{
|
||||
int i, rc;
|
||||
int i, error;
|
||||
|
||||
ifaces = iface->next;
|
||||
|
||||
@@ -593,39 +580,37 @@ dispose_iface(struct keywest_iface *iface)
|
||||
struct keywest_chan* chan = &iface->channels[i];
|
||||
if (!chan->adapter.data)
|
||||
continue;
|
||||
rc = i2c_del_adapter(&chan->adapter);
|
||||
i2c_del_adapter(&chan->adapter);
|
||||
chan->adapter.data = NULL;
|
||||
/* We aren't that prepared to deal with this... */
|
||||
if (rc)
|
||||
if (error)
|
||||
printk("i2c-keywest.c: i2c_del_adapter failed, that's bad !\n");
|
||||
}
|
||||
iounmap((void *)iface->base);
|
||||
kfree(iface);
|
||||
}
|
||||
|
||||
static int __init
|
||||
i2c_keywest_init(void)
|
||||
static int __init i2c_keywest_init(void)
|
||||
{
|
||||
struct device_node *np;
|
||||
int rc = -ENODEV;
|
||||
int error = -ENODEV;
|
||||
|
||||
np = find_compatible_devices("i2c", "keywest");
|
||||
while (np != 0) {
|
||||
if (np->n_addrs >= 1 && np->n_intrs >= 1)
|
||||
rc = create_iface(np);
|
||||
error = create_iface(np);
|
||||
np = np->next;
|
||||
}
|
||||
if (ifaces)
|
||||
rc = 0;
|
||||
return rc;
|
||||
error = 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
static void __exit
|
||||
i2c_keywest_cleanup(void)
|
||||
static void __exit i2c_keywest_exit(void)
|
||||
{
|
||||
while(ifaces)
|
||||
dispose_iface(ifaces);
|
||||
}
|
||||
|
||||
module_init(i2c_keywest_init);
|
||||
module_exit(i2c_keywest_cleanup);
|
||||
module_exit(i2c_keywest_exit);
|
||||
+50
-105
@@ -135,51 +135,10 @@ MODULE_PARM_DESC(force_addr,
|
||||
"Forcibly enable the PIIX4 at the given address. "
|
||||
"EXTREMELY DANGEROUS!");
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_piix4_init(void);
|
||||
static int __init piix4_cleanup(void);
|
||||
static int piix4_setup(void);
|
||||
static s32 piix4_access(struct i2c_adapter *adap, u16 addr,
|
||||
unsigned short flags, char read_write,
|
||||
u8 command, int size, union i2c_smbus_data *data);
|
||||
static void piix4_do_pause(unsigned int amount);
|
||||
static int piix4_transaction(void);
|
||||
static void piix4_inc(struct i2c_adapter *adapter);
|
||||
static void piix4_dec(struct i2c_adapter *adapter);
|
||||
static u32 piix4_func(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
/* name */ "Non-I2C SMBus adapter",
|
||||
/* id */ I2C_ALGO_SMBUS,
|
||||
/* master_xfer */ NULL,
|
||||
/* smbus_access */ piix4_access,
|
||||
/* slave_send */ NULL,
|
||||
/* slave_rcv */ NULL,
|
||||
/* algo_control */ NULL,
|
||||
/* functionality */ piix4_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter piix4_adapter = {
|
||||
"unset",
|
||||
I2C_ALGO_SMBUS | I2C_HW_SMBUS_PIIX4,
|
||||
&smbus_algorithm,
|
||||
NULL,
|
||||
piix4_inc,
|
||||
piix4_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int __initdata piix4_initialized;
|
||||
static unsigned short piix4_smba = 0;
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
@@ -189,6 +148,7 @@ static unsigned short piix4_smba = 0;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,34)
|
||||
void dmi_scan_mach(void);
|
||||
#endif
|
||||
|
||||
static int __init ibm_dmi_probe(void)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34)
|
||||
@@ -520,16 +480,6 @@ s32 piix4_access(struct i2c_adapter * adap, u16 addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void piix4_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void piix4_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
u32 piix4_func(struct i2c_adapter *adapter)
|
||||
{
|
||||
@@ -538,72 +488,67 @@ u32 piix4_func(struct i2c_adapter *adapter)
|
||||
I2C_FUNC_SMBUS_BLOCK_DATA;
|
||||
}
|
||||
|
||||
int __init i2c_piix4_init(void)
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
.name = "Non-I2C SMBus adapter",
|
||||
.id = I2C_ALGO_SMBUS,
|
||||
.smbus_xfer = piix4_access,
|
||||
.functionality = piix4_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter piix4_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "unset",
|
||||
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_PIIX4,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
||||
|
||||
static struct pci_device_id piix4_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-piix4.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
if (piix4_initialized) {
|
||||
printk
|
||||
(KERN_ERR "i2c-piix4.o: Oops, piix4_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
piix4_initialized = 0;
|
||||
if ((res = piix4_setup())) {
|
||||
printk(KERN_ERR "i2c-piix4.o: Module insertion failed.\n");
|
||||
piix4_cleanup();
|
||||
return res;
|
||||
}
|
||||
piix4_initialized++;
|
||||
|
||||
sprintf(piix4_adapter.name, "SMBus PIIX4 adapter at %04x",
|
||||
piix4_smba);
|
||||
if ((res = i2c_add_adapter(&piix4_adapter))) {
|
||||
printk
|
||||
(KERN_ERR "i2c-piix4.o: Adapter registration failed, module not inserted.\n");
|
||||
piix4_cleanup();
|
||||
return res;
|
||||
}
|
||||
piix4_initialized++;
|
||||
printk(KERN_ERR "i2c-piix4.o: SMBus detected and initialized\n");
|
||||
return 0;
|
||||
|
||||
i2c_add_adapter(&piix4_adapter);
|
||||
}
|
||||
|
||||
int __init piix4_cleanup(void)
|
||||
static void __devexit piix4_remove(struct pci_dev *dev)
|
||||
{
|
||||
int res;
|
||||
if (piix4_initialized >= 2) {
|
||||
if ((res = i2c_del_adapter(&piix4_adapter))) {
|
||||
printk
|
||||
(KERN_ERR "i2c-piix4.o: i2c_del_adapter failed, module not removed\n");
|
||||
return res;
|
||||
} else
|
||||
piix4_initialized--;
|
||||
}
|
||||
if (piix4_initialized >= 1) {
|
||||
release_region(piix4_smba, 8);
|
||||
piix4_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_adapter(&piix4_adapter);
|
||||
}
|
||||
|
||||
|
||||
static struct pci_driver piix4_driver = {
|
||||
.name = "piix4 smbus",
|
||||
.id_table = piix4_ids,
|
||||
.probe = piix4_probe,
|
||||
.remove = __devexit_p(piix4_remove),
|
||||
};
|
||||
|
||||
static int __init i2c_piix4_init(void)
|
||||
{
|
||||
printk("i2c-piix4.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return pci_module_init(&piix4_driver);
|
||||
}
|
||||
|
||||
|
||||
static void __exit i2c_piix4_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&piix4_driver);
|
||||
release_region(piix4_smba, 8);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("PIIX4 SMBus driver");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_piix4_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return piix4_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_piix4_init);
|
||||
module_exit(i2c_piix4_exit);
|
||||
+50
-205
@@ -75,33 +75,19 @@
|
||||
#define CYCLE_DELAY 10
|
||||
#define TIMEOUT (HZ / 2)
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_savage4_init(void);
|
||||
static int __init savage4_cleanup(void);
|
||||
static int savage4_setup(void);
|
||||
|
||||
static void config_s4(struct pci_dev *dev);
|
||||
static void savage4_inc(struct i2c_adapter *adapter);
|
||||
static void savage4_dec(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
|
||||
static int __initdata savage4_initialized;
|
||||
|
||||
static unsigned char *mem;
|
||||
|
||||
extern inline void outlong(unsigned int dat)
|
||||
static inline void outlong(unsigned int dat)
|
||||
{
|
||||
*((unsigned int *) (mem + REG)) = dat;
|
||||
}
|
||||
|
||||
extern inline unsigned int readlong(void)
|
||||
static inline unsigned int readlong(void)
|
||||
{
|
||||
return *((unsigned int *) (mem + REG));
|
||||
}
|
||||
@@ -147,78 +133,6 @@ static int bit_savi2c_getsda(void *data)
|
||||
return (0 != (readlong() & I2C_SDA_IN));
|
||||
}
|
||||
|
||||
/*static void bit_savddc_setscl(void *data, int val)
|
||||
{
|
||||
unsigned int r;
|
||||
r = readlong();
|
||||
if(val)
|
||||
r |= DDC_SCL_OUT;
|
||||
else
|
||||
r &= ~DDC_SCL_OUT;
|
||||
outlong(r);
|
||||
}
|
||||
|
||||
static void bit_savddc_setsda(void *data, int val)
|
||||
{
|
||||
unsigned int r;
|
||||
r = readlong();
|
||||
if(val)
|
||||
r |= DDC_SDA_OUT;
|
||||
else
|
||||
r &= ~DDC_SDA_OUT;
|
||||
outlong(r);
|
||||
}
|
||||
|
||||
static int bit_savddc_getscl(void *data)
|
||||
{
|
||||
return (0 != (readlong() & DDC_SCL_IN));
|
||||
}
|
||||
|
||||
static int bit_savddc_getsda(void *data)
|
||||
{
|
||||
return (0 != (readlong() & DDC_SDA_IN));
|
||||
}
|
||||
*/
|
||||
static struct i2c_algo_bit_data sav_i2c_bit_data = {
|
||||
NULL,
|
||||
bit_savi2c_setsda,
|
||||
bit_savi2c_setscl,
|
||||
bit_savi2c_getsda,
|
||||
bit_savi2c_getscl,
|
||||
CYCLE_DELAY, CYCLE_DELAY, TIMEOUT
|
||||
};
|
||||
|
||||
static struct i2c_adapter savage4_i2c_adapter = {
|
||||
"I2C Savage4 adapter",
|
||||
I2C_HW_B_SAVG,
|
||||
NULL,
|
||||
&sav_i2c_bit_data,
|
||||
savage4_inc,
|
||||
savage4_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
/*
|
||||
static struct i2c_algo_bit_data sav_ddc_bit_data = {
|
||||
NULL,
|
||||
bit_savddc_setsda,
|
||||
bit_savddc_setscl,
|
||||
bit_savddc_getsda,
|
||||
bit_savddc_getscl,
|
||||
CYCLE_DELAY, CYCLE_DELAY, TIMEOUT
|
||||
};
|
||||
|
||||
static struct i2c_adapter savage4_ddc_adapter = {
|
||||
"DDC Voodoo3/Banshee adapter",
|
||||
I2C_HW_B_VOO,
|
||||
NULL,
|
||||
&sav_ddc_bit_data,
|
||||
savage4_inc,
|
||||
savage4_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
*/
|
||||
/* Configures the chip */
|
||||
|
||||
void config_s4(struct pci_dev *dev)
|
||||
@@ -226,11 +140,7 @@ void config_s4(struct pci_dev *dev)
|
||||
unsigned int cadr;
|
||||
|
||||
/* map memory */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
|
||||
cadr = dev->resource[0].start;
|
||||
#else
|
||||
cadr = dev->base_address[0];
|
||||
#endif
|
||||
cadr &= PCI_BASE_ADDRESS_MEM_MASK;
|
||||
mem = ioremap_nocache(cadr, 0x0080000);
|
||||
if(mem) {
|
||||
@@ -240,136 +150,71 @@ void config_s4(struct pci_dev *dev)
|
||||
}
|
||||
}
|
||||
|
||||
/* Detect chip and initialize it. */
|
||||
static int savage4_setup(void)
|
||||
|
||||
static struct i2c_algo_bit_data sav_i2c_bit_data = {
|
||||
.setsda = bit_savi2c_setsda,
|
||||
.setscl = bit_savi2c_setscl,
|
||||
.getsda = bit_savi2c_getsda,
|
||||
.getscl = bit_savi2c_getscl,
|
||||
.udelay = CYCLE_DELAY,
|
||||
.mdelay = CYCLE_DELAY,
|
||||
.timeout = TIMEOUT
|
||||
};
|
||||
|
||||
static struct i2c_adapter savage4_i2c_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "I2C Savage4 adapter",
|
||||
.id = I2C_HW_B_SAVG,
|
||||
.algo_data = &sav_i2c_bit_data,
|
||||
};
|
||||
|
||||
#if 0
|
||||
PCI_VENDOR_ID_S3, PCI_CHIP_SAVAGE4,
|
||||
PCI_VENDOR_ID_S3, PCI_CHIP_SAVAGE2000,
|
||||
#endif
|
||||
|
||||
static struct pci_device_id savage4_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit savage4_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
int s4_num;
|
||||
|
||||
s4_num = 0;
|
||||
|
||||
dev = NULL;
|
||||
do {
|
||||
if ((dev = pci_find_device(PCI_VENDOR_ID_S3,
|
||||
PCI_CHIP_SAVAGE4,
|
||||
dev))) {
|
||||
if (!s4_num)
|
||||
config_s4(dev);
|
||||
s4_num++;
|
||||
}
|
||||
} while (dev);
|
||||
|
||||
dev = NULL;
|
||||
do {
|
||||
if ((dev = pci_find_device(PCI_VENDOR_ID_S3,
|
||||
PCI_CHIP_SAVAGE2000,
|
||||
dev))) {
|
||||
if (!s4_num)
|
||||
config_s4(dev);
|
||||
s4_num++;
|
||||
}
|
||||
} while (dev);
|
||||
|
||||
if (s4_num > 0) {
|
||||
if(!mem)
|
||||
return -ENOMEM;
|
||||
printk("i2c-savage4: %d Savage4 found.\n", s4_num);
|
||||
if (s4_num > 1)
|
||||
printk("i2c-savage4: warning: only 1 supported.\n");
|
||||
return 0;
|
||||
} else {
|
||||
printk("i2c-savage4: No Savage4 found.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
config_s4(dev);
|
||||
return i2c_bit_add_bus(&savage4_i2c_adapter);
|
||||
}
|
||||
|
||||
void savage4_inc(struct i2c_adapter *adapter)
|
||||
static void __devexit savage4_remove(struct pci_dev *dev)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
i2c_bit_del_bus(&savage4_i2c_adapter);
|
||||
}
|
||||
|
||||
void savage4_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
int __init i2c_savage4_init(void)
|
||||
static struct pci_driver savage4_driver = {
|
||||
.name = "savage4 smbus",
|
||||
.id_table = savage4_ids,
|
||||
.probe = savage4_probe,
|
||||
.remove = __devexit_p(savage4_remove),
|
||||
};
|
||||
|
||||
static int __init i2c_savage4_init(void)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-savage4.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
savage4_initialized = 0;
|
||||
if ((res = savage4_setup())) {
|
||||
printk
|
||||
("i2c-savage4.o: Savage4 not detected, module not inserted.\n");
|
||||
savage4_cleanup();
|
||||
return res;
|
||||
}
|
||||
if ((res = i2c_bit_add_bus(&savage4_i2c_adapter))) {
|
||||
printk("i2c-savage4.o: I2C adapter registration failed\n");
|
||||
} else {
|
||||
printk("i2c-savage4.o: I2C bus initialized\n");
|
||||
savage4_initialized |= INIT2;
|
||||
}
|
||||
/*
|
||||
if ((res = i2c_bit_add_bus(&savage4_ddc_adapter))) {
|
||||
printk("i2c-savage4.o: DDC adapter registration failed\n");
|
||||
} else {
|
||||
printk("i2c-savage4.o: DDC bus initialized\n");
|
||||
savage4_initialized |= INIT3;
|
||||
}
|
||||
*/
|
||||
if(!(savage4_initialized & (INIT2 /* | INIT3 */ ))) {
|
||||
printk("i2c-savage4.o: Both registrations failed, module not inserted\n");
|
||||
savage4_cleanup();
|
||||
return res;
|
||||
}
|
||||
return 0;
|
||||
return pci_module_init(&savage4_driver);
|
||||
}
|
||||
|
||||
int __init savage4_cleanup(void)
|
||||
|
||||
static void __exit i2c_savage4_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
pci_unregister_driver(&savage4_driver);
|
||||
iounmap(mem);
|
||||
/*
|
||||
if (savage4_initialized & INIT3) {
|
||||
if ((res = i2c_bit_del_bus(&savage4_ddc_adapter))) {
|
||||
printk
|
||||
("i2c-savage4.o: i2c_bit_del_bus failed, module not removed\n");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (savage4_initialized & INIT2) {
|
||||
if ((res = i2c_bit_del_bus(&savage4_i2c_adapter))) {
|
||||
printk
|
||||
("i2c-savage4.o: i2c_bit_del_bus failed, module not removed\n");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, Ralph Metzler <rjkm@thp.uni-koeln.de>, and Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("Savage4 I2C/SMBus driver");
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_savage4_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return savage4_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_savage4_init);
|
||||
module_exit(i2c_savage4_exit);
|
||||
+52
-108
@@ -61,9 +61,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#ifndef PCI_DEVICE_ID_SI_540
|
||||
#define PCI_DEVICE_ID_SI_540 0x0540
|
||||
@@ -138,52 +136,9 @@ MODULE_PARM(force_addr, "i");
|
||||
MODULE_PARM_DESC(force_addr,
|
||||
"Initialize the base address of the i2c controller");
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_sis5595_init(void);
|
||||
static int __init sis5595_cleanup(void);
|
||||
static int sis5595_setup(void);
|
||||
static s32 sis5595_access(struct i2c_adapter *adap, u16 addr,
|
||||
unsigned short flags, char read_write,
|
||||
u8 command, int size,
|
||||
union i2c_smbus_data *data);
|
||||
static void sis5595_do_pause(unsigned int amount);
|
||||
static int sis5595_transaction(void);
|
||||
static void sis5595_inc(struct i2c_adapter *adapter);
|
||||
static void sis5595_dec(struct i2c_adapter *adapter);
|
||||
static u32 sis5595_func(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
/* name */ "Non-I2C SMBus adapter",
|
||||
/* id */ I2C_ALGO_SMBUS,
|
||||
/* master_xfer */ NULL,
|
||||
/* smbus_access */ sis5595_access,
|
||||
/* slave_send */ NULL,
|
||||
/* slave_rcv */ NULL,
|
||||
/* algo_control */ NULL,
|
||||
/* functionality */ sis5595_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter sis5595_adapter = {
|
||||
"unset",
|
||||
I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS5595,
|
||||
&smbus_algorithm,
|
||||
NULL,
|
||||
sis5595_inc,
|
||||
sis5595_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int __initdata sis5595_initialized;
|
||||
static unsigned short sis5595_base = 0;
|
||||
|
||||
static u8 sis5595_read(u8 reg)
|
||||
@@ -462,16 +417,6 @@ s32 sis5595_access(struct i2c_adapter * adap, u16 addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sis5595_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void sis5595_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
u32 sis5595_func(struct i2c_adapter *adapter)
|
||||
{
|
||||
@@ -480,72 +425,71 @@ u32 sis5595_func(struct i2c_adapter *adapter)
|
||||
I2C_FUNC_SMBUS_PROC_CALL;
|
||||
}
|
||||
|
||||
int __init i2c_sis5595_init(void)
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
.name = "Non-I2C SMBus adapter",
|
||||
.id = I2C_ALGO_SMBUS,
|
||||
.smbus_xfer = sis5595_access,
|
||||
.functionality = sis5595_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter sis5595_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "unset",
|
||||
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS5595,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
||||
static struct pci_device_id sis5595_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
#ifdef DEBUG
|
||||
/* PE- It might be good to make this a permanent part of the code! */
|
||||
if (sis5595_initialized) {
|
||||
printk
|
||||
("i2c-sis5595.o: Oops, sis5595_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
#endif
|
||||
sis5595_initialized = 0;
|
||||
if ((res = sis5595_setup())) {
|
||||
|
||||
if (sis5595_setup()) {
|
||||
printk
|
||||
("i2c-sis5595.o: SIS5595 not detected, module not inserted.\n");
|
||||
sis5595_cleanup();
|
||||
return res;
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
sis5595_initialized++;
|
||||
|
||||
sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x",
|
||||
sis5595_base + SMB_INDEX);
|
||||
if ((res = i2c_add_adapter(&sis5595_adapter))) {
|
||||
printk
|
||||
("i2c-sis5595.o: Adapter registration failed, module not inserted.\n");
|
||||
sis5595_cleanup();
|
||||
return res;
|
||||
}
|
||||
sis5595_initialized++;
|
||||
printk("i2c-sis5595.o: SIS5595 bus detected and initialized\n");
|
||||
return 0;
|
||||
i2c_add_adapter(&sis5595_adapter);
|
||||
}
|
||||
|
||||
int __init sis5595_cleanup(void)
|
||||
static void __devexit sis5595_remove(struct pci_dev *dev)
|
||||
{
|
||||
int res;
|
||||
if (sis5595_initialized >= 2) {
|
||||
if ((res = i2c_del_adapter(&sis5595_adapter))) {
|
||||
printk
|
||||
("i2c-sis5595.o: i2c_del_adapter failed, module not removed\n");
|
||||
return res;
|
||||
} else
|
||||
sis5595_initialized--;
|
||||
}
|
||||
if (sis5595_initialized >= 1) {
|
||||
release_region(sis5595_base + SMB_INDEX, 2);
|
||||
sis5595_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_adapter(&sis5595_adapter);
|
||||
}
|
||||
|
||||
|
||||
static struct pci_driver sis5595_driver = {
|
||||
.name = "sis5595 smbus",
|
||||
.id_table = sis5595_ids,
|
||||
.probe = sis5595_probe,
|
||||
.remove = __devexit_p(sis5595_remove),
|
||||
};
|
||||
|
||||
static int __init i2c_sis5595_init(void)
|
||||
{
|
||||
printk("i2c-sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return pci_module_init(&sis5595_driver);
|
||||
}
|
||||
|
||||
|
||||
static void __exit i2c_sis5595_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&sis5595_driver);
|
||||
release_region(sis5595_base + SMB_INDEX, 2);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
|
||||
MODULE_DESCRIPTION("SIS5595 SMBus driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_sis5595_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return sis5595_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_sis5595_init);
|
||||
module_exit(i2c_sis5595_exit);
|
||||
+62
-111
@@ -137,52 +137,15 @@ MODULE_PARM_DESC(force, "Forcibly enable the SIS630. DANGEROUS!");
|
||||
MODULE_PARM(high_clock, "i");
|
||||
MODULE_PARM_DESC(high_clock, "Set Host Master Clock to 56KHz (default 14KHz).");
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_sis630_init(void);
|
||||
static int __init i2c_sis630_cleanup(void);
|
||||
static int sis630_setup(void);
|
||||
static s32 sis630_access(struct i2c_adapter *adap, u16 addr,
|
||||
unsigned short flags, char read_write,
|
||||
u8 command, int size,
|
||||
union i2c_smbus_data *data);
|
||||
static void sis630_do_pause(unsigned int amount);
|
||||
static int sis630_transaction(int size);
|
||||
static void sis630_inc(struct i2c_adapter *adapter);
|
||||
static void sis630_dec(struct i2c_adapter *adapter);
|
||||
static u32 sis630_func(struct i2c_adapter *adapter);
|
||||
|
||||
static u8 sis630_read(u8 reg);
|
||||
static void sis630_write(u8 reg, u8 data);
|
||||
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
/* name */ "Non-I2C SMBus adapter",
|
||||
/* id */ I2C_ALGO_SMBUS,
|
||||
/* master_xfer */ NULL,
|
||||
/* smbus_access */ sis630_access,
|
||||
/* slave_send */ NULL,
|
||||
/* slave_rcv */ NULL,
|
||||
/* algo_control */ NULL,
|
||||
/* functionality */ sis630_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter sis630_adapter = {
|
||||
"unset",
|
||||
I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS630,
|
||||
&smbus_algorithm,
|
||||
NULL,
|
||||
sis630_inc,
|
||||
sis630_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static unsigned short acpi_base = 0;
|
||||
static int __initdata sis630_initialized;
|
||||
|
||||
|
||||
u8 sis630_read(u8 reg) {
|
||||
return inb(acpi_base + reg);
|
||||
@@ -305,7 +268,8 @@ int sis630_transaction(int size) {
|
||||
/* Return -1 on error. */
|
||||
s32 sis630_access(struct i2c_adapter * adap, u16 addr,
|
||||
unsigned short flags, char read_write,
|
||||
u8 command, int size, union i2c_smbus_data * data) {
|
||||
u8 command, int size, union i2c_smbus_data * data)
|
||||
{
|
||||
|
||||
switch (size) {
|
||||
case I2C_SMBUS_QUICK:
|
||||
@@ -374,13 +338,6 @@ s32 sis630_access(struct i2c_adapter * adap, u16 addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sis630_inc(struct i2c_adapter *adapter) {
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void sis630_dec(struct i2c_adapter *adapter) {
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
u32 sis630_func(struct i2c_adapter *adapter) {
|
||||
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA |
|
||||
@@ -452,88 +409,82 @@ int sis630_setup(void) {
|
||||
#endif
|
||||
|
||||
/* Everything is happy, let's grab the memory and set things up. */
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,14)
|
||||
if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, "sis630-smbus")){
|
||||
printk(KERN_ERR "i2c-sis630.o: SMBus registers 0x%04x-0x%04x "
|
||||
"already in use!\n",acpi_base + SMB_STS, acpi_base + SMB_SAA);
|
||||
return -ENODEV;
|
||||
}
|
||||
#else
|
||||
if (check_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION) < 0){
|
||||
printk(KERN_ERR "i2c-sis630.o: SMBus registers 0x%04x-0x%04x "
|
||||
"already in use!\n",acpi_base + SMB_STS, acpi_base + SMB_SAA);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
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,
|
||||
.name = "unset",
|
||||
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS630,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
||||
static struct pci_device_id sis630_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
|
||||
if (sis630_setup()) {
|
||||
printk(KERN_ERR "i2c-sis630.o: SIS630 comp. bus not detected, module not inserted.\n");
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, "sis630-smbus");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __init i2c_sis630_init(void) {
|
||||
int res;
|
||||
printk("i2c-sis630.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
|
||||
if (sis630_initialized) {
|
||||
printk(KERN_ERR "i2c-sis630.o: Oops, sis630_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
sis630_initialized = 0;
|
||||
if ((res = sis630_setup())) {
|
||||
printk(KERN_ERR "i2c-sis630.o: SIS630 comp. bus not detected, module not inserted.\n");
|
||||
i2c_sis630_cleanup();
|
||||
return res;
|
||||
}
|
||||
sis630_initialized++;
|
||||
sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x",
|
||||
acpi_base + SMB_STS);
|
||||
if ((res = i2c_add_adapter(&sis630_adapter))) {
|
||||
printk(KERN_ERR "i2c-sis630.o: Adapter registration failed, "
|
||||
"module not inserted.\n");
|
||||
i2c_sis630_cleanup();
|
||||
return res;
|
||||
}
|
||||
sis630_initialized++;
|
||||
printk(KERN_INFO "i2c-sis630.o: SIS630 comp. bus detected and initialized\n");
|
||||
|
||||
return 0;
|
||||
i2c_add_adapter(&sis630_adapter);
|
||||
}
|
||||
|
||||
int __init i2c_sis630_cleanup(void) {
|
||||
int res;
|
||||
if (sis630_initialized >= 2) {
|
||||
if ((res = i2c_del_adapter(&sis630_adapter))) {
|
||||
printk(KERN_ERR "i2c-sis630.o: i2c_del_adapter failed, module not"
|
||||
"removed\n");
|
||||
return res;
|
||||
} else
|
||||
sis630_initialized--;
|
||||
}
|
||||
if (sis630_initialized >= 1) {
|
||||
release_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION);
|
||||
sis630_initialized--;
|
||||
}
|
||||
return 0;
|
||||
static void __devexit sis630_remove(struct pci_dev *dev)
|
||||
{
|
||||
i2c_del_adapter(&sis630_adapter);
|
||||
}
|
||||
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
static struct pci_driver sis630_driver = {
|
||||
.name = "sis630 smbus",
|
||||
.id_table = sis630_ids,
|
||||
.probe = sis630_probe,
|
||||
.remove = __devexit_p(sis630_remove),
|
||||
};
|
||||
|
||||
static int __init i2c_sis630_init(void)
|
||||
{
|
||||
printk("i2c-sis630.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return pci_module_init(&sis630_driver);
|
||||
}
|
||||
|
||||
|
||||
static void __exit i2c_sis630_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&sis630_driver);
|
||||
release_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#ifdef MODULE
|
||||
MODULE_AUTHOR("Alexander Malysh <amalysh@web.de>");
|
||||
MODULE_DESCRIPTION("SIS630 SMBus driver");
|
||||
|
||||
int init_module(void) {
|
||||
return i2c_sis630_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void) {
|
||||
return i2c_sis630_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_sis630_init);
|
||||
module_exit(i2c_sis630_exit);
|
||||
+52
-101
@@ -46,9 +46,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
/* PCI identifiers */
|
||||
|
||||
@@ -111,47 +109,15 @@ MODULE_LICENSE("GPL");
|
||||
#define SIS645_PROC_CALL 0x04
|
||||
#define SIS645_BLOCK_DATA 0x05
|
||||
|
||||
|
||||
static int __init sis645_init(void);
|
||||
static void sis645_cleanup(void);
|
||||
|
||||
static int sis645_enable_smbus(struct pci_dev *dev);
|
||||
static int sis645_build_dev(struct pci_dev **smbus_dev,
|
||||
struct pci_dev *bridge_dev);
|
||||
static int sis645_setup(void);
|
||||
static s32 sis645_access(struct i2c_adapter *adap, u16 addr,
|
||||
unsigned short flags, char read_write,
|
||||
u8 command, int size,
|
||||
union i2c_smbus_data *data);
|
||||
|
||||
static void sis645_do_pause(unsigned int amount);
|
||||
static int sis645_transaction(int size);
|
||||
static void sis645_inc(struct i2c_adapter *adapter);
|
||||
static void sis645_dec(struct i2c_adapter *adapter);
|
||||
static u32 sis645_func(struct i2c_adapter *adapter);
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
/* name */ "Non-I2C SMBus adapter",
|
||||
/* id */ I2C_ALGO_SMBUS,
|
||||
/* master_xfer */ NULL,
|
||||
/* smbus_access */ sis645_access,
|
||||
/* slave_send */ NULL,
|
||||
/* slave_rcv */ NULL,
|
||||
/* algo_control */ NULL,
|
||||
/* functionality */ sis645_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter sis645_adapter = {
|
||||
"unset",
|
||||
I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS645,
|
||||
&smbus_algorithm,
|
||||
NULL,
|
||||
sis645_inc,
|
||||
sis645_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int sis645_initialized;
|
||||
static unsigned short sis645_smbus_base = 0;
|
||||
|
||||
static u8 sis645_read(u8 reg)
|
||||
@@ -324,11 +290,7 @@ static int sis645_setup(void)
|
||||
}
|
||||
|
||||
/* get the IO base address */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
|
||||
sis645_smbus_base = SIS645_SMBUS_dev->resource[BASE_IO_REG].start;
|
||||
#else
|
||||
sis645_smbus_base = SIS645_SMBUS_dev->base_address[BASE_IO_REG];
|
||||
#endif
|
||||
if (!sis645_smbus_base) {
|
||||
printk("i2c-sis645.o: SiS645 SMBus base address not initialized!\n");
|
||||
return -EINVAL;
|
||||
@@ -336,22 +298,12 @@ static int sis645_setup(void)
|
||||
printk("i2c-sis645.o: SiS645 SMBus base address: 0x%04x\n", sis645_smbus_base);
|
||||
|
||||
/* Everything is happy, let's grab the memory and set things up. */
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,14)
|
||||
if (!request_region(sis645_smbus_base, SIS645_SMB_IOREGION, "sis645-smbus")) {
|
||||
printk
|
||||
("i2c-sis645.o: SMBus registers 0x%04x-0x%04x already in use!\n",
|
||||
sis645_smbus_base, sis645_smbus_base + SIS645_SMB_IOREGION - 1);
|
||||
return -EINVAL;
|
||||
}
|
||||
#else
|
||||
if (check_region(sis645_smbus_base, SIS645_SMB_IOREGION) < 0) {
|
||||
printk
|
||||
("i2c-sis645.o: SMBus registers 0x%04x-0x%04x already in use!\n",
|
||||
sis645_smbus_base, sis645_smbus_base + SIS645_SMB_IOREGION - 1);
|
||||
return -EINVAL;
|
||||
}
|
||||
request_region(sis645_smbus_base, SIS645_SMB_IOREGION, "sis645-smbus");
|
||||
#endif
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -518,15 +470,6 @@ s32 sis645_access(struct i2c_adapter * adap, u16 addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sis645_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
static void sis645_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
static u32 sis645_func(struct i2c_adapter *adapter)
|
||||
{
|
||||
@@ -535,62 +478,70 @@ static u32 sis645_func(struct i2c_adapter *adapter)
|
||||
I2C_FUNC_SMBUS_PROC_CALL;
|
||||
}
|
||||
|
||||
static int __init sis645_init(void)
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
.name = "Non-I2C SMBus adapter",
|
||||
.id = I2C_ALGO_SMBUS,
|
||||
.smbus_xfer = sis645_access,
|
||||
.functionality = sis645_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter sis645_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "unset",
|
||||
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_SIS645,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
||||
static struct pci_device_id sis645_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit sis645_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-sis645.o: version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
|
||||
if (sis645_initialized) {
|
||||
printk("i2c-sis645.o: Oops, sis645_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
sis645_initialized = 0;
|
||||
if ((res = sis645_setup())) {
|
||||
if (sis645_setup()) {
|
||||
printk ("i2c-sis645.o: SiS645 not detected, module not inserted.\n");
|
||||
sis645_cleanup();
|
||||
return res;
|
||||
}
|
||||
|
||||
sis645_initialized++;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
sprintf(sis645_adapter.name, "SMBus SiS645 adapter at 0x%04x", sis645_smbus_base);
|
||||
if ((res = i2c_add_adapter(&sis645_adapter))) {
|
||||
printk ("i2c-sis645.o: Adapter registration failed, module not inserted.\n");
|
||||
sis645_cleanup();
|
||||
return res;
|
||||
}
|
||||
|
||||
sis645_initialized++;
|
||||
printk("i2c-sis645.o: SiS645 bus detected and initialized.\n");
|
||||
return 0;
|
||||
i2c_add_adapter(&sis645_adapter);
|
||||
}
|
||||
|
||||
static void sis645_cleanup(void)
|
||||
static void __devexit sis645_remove(struct pci_dev *dev)
|
||||
{
|
||||
int res;
|
||||
if (sis645_initialized >= 2) {
|
||||
if ((res = i2c_del_adapter(&sis645_adapter))) {
|
||||
printk("i2c-sis645.o: i2c_del_adapter failed, module not removed\n");
|
||||
return;
|
||||
} else
|
||||
sis645_initialized--;
|
||||
}
|
||||
if (sis645_initialized >= 1) {
|
||||
release_region(sis645_smbus_base, SIS645_SMB_IOREGION);
|
||||
sis645_initialized--;
|
||||
}
|
||||
return;
|
||||
i2c_del_adapter(&sis645_adapter);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
/* Register initialization functions using helper macros */
|
||||
module_init(sis645_init);
|
||||
module_exit(sis645_cleanup);
|
||||
static struct pci_driver sis645_driver = {
|
||||
.name = "sis645 smbus",
|
||||
.id_table = sis645_ids,
|
||||
.probe = sis645_probe,
|
||||
.remove = __devexit_p(sis645_remove),
|
||||
};
|
||||
|
||||
static int __init i2c_sis645_init(void)
|
||||
{
|
||||
printk("i2c-sis645.o: version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return pci_module_init(&sis645_driver);
|
||||
}
|
||||
|
||||
|
||||
static void __exit i2c_sis645_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&sis645_driver);
|
||||
release_region(sis645_smbus_base, SIS645_SMB_IOREGION);
|
||||
}
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Mark M. Hoffman <mhoffman@lightlink.com>");
|
||||
MODULE_DESCRIPTION("SiS645 SMBus driver");
|
||||
|
||||
#endif
|
||||
/* Register initialization functions using helper macros */
|
||||
module_init(i2c_sis645_init);
|
||||
module_exit(i2c_sis645_exit);
|
||||
+20
-68
@@ -39,9 +39,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
/* Memory Presence Detect Register (MPD-RW) bits
|
||||
with except of reserved RAZ bits */
|
||||
@@ -51,28 +49,13 @@ MODULE_LICENSE("GPL");
|
||||
#define MPD_DS 0x2 /* Data send - Must be a 1 to receive - WO */
|
||||
#define MPD_CKS 0x1 /* Clock send - WO */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_tsunami_init(void);
|
||||
static int __init i2c_tsunami_cleanup(void);
|
||||
static void i2c_tsunami_inc(struct i2c_adapter *adapter);
|
||||
static void i2c_tsunami_dec(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
extern inline void writempd(unsigned long value)
|
||||
static inline void writempd(unsigned long value)
|
||||
{
|
||||
TSUNAMI_cchip->mpd.csr = value;
|
||||
mb();
|
||||
}
|
||||
|
||||
extern inline unsigned long readmpd(void)
|
||||
static inline unsigned long readmpd(void)
|
||||
{
|
||||
return TSUNAMI_cchip->mpd.csr;
|
||||
}
|
||||
@@ -118,7 +101,7 @@ static int bit_tsunami_getsda(void *data)
|
||||
}
|
||||
|
||||
static struct i2c_algo_bit_data tsunami_i2c_bit_data = {
|
||||
NULL,
|
||||
|
||||
bit_tsunami_setsda,
|
||||
bit_tsunami_setscl,
|
||||
bit_tsunami_getsda,
|
||||
@@ -127,29 +110,22 @@ static struct i2c_algo_bit_data tsunami_i2c_bit_data = {
|
||||
};
|
||||
|
||||
static struct i2c_adapter tsunami_i2c_adapter = {
|
||||
"I2C Tsunami/Typhoon adapter",
|
||||
I2C_HW_B_TSUNA,
|
||||
NULL,
|
||||
&tsunami_i2c_bit_data,
|
||||
i2c_tsunami_inc,
|
||||
i2c_tsunami_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
.owner = THIS_MODULE,
|
||||
.name = "I2C Tsunami/Typhoon adapter",
|
||||
.id = I2C_HW_B_TSUNA,
|
||||
.algo_data = &tsunami_i2c_bit_data,
|
||||
};
|
||||
|
||||
void i2c_tsunami_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void i2c_tsunami_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
static struct pci_driver tsunami_driver = {
|
||||
.name = "tsunami smbus",
|
||||
.id_table = tsunami_ids,
|
||||
.probe = tsunami_probe,
|
||||
.remove = __devexit_p(tsunami_remove),
|
||||
};
|
||||
|
||||
int __init i2c_tsunami_init(void)
|
||||
static int __init i2c_tsunami_init(void)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-tsunami.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
|
||||
if (hwrpb->sys_type != ST_DEC_TSUNAMI) {
|
||||
@@ -158,43 +134,19 @@ int __init i2c_tsunami_init(void)
|
||||
} else {
|
||||
printk("i2c-tsunami.o: using Cchip MPD at 0x%lx.\n", &TSUNAMI_cchip->mpd);
|
||||
}
|
||||
|
||||
if ((res = i2c_bit_add_bus(&tsunami_i2c_adapter))) {
|
||||
printk("i2c-tsunami.o: I2C adapter registration failed\n");
|
||||
} else {
|
||||
printk("i2c-tsunami.o: I2C bus initialized\n");
|
||||
}
|
||||
|
||||
return res;
|
||||
i2c_bit_add_bus(&tsunami_i2c_adapter);
|
||||
}
|
||||
|
||||
int __init i2c_tsunami_cleanup(void)
|
||||
|
||||
static void __exit i2c_tsunami_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if ((res = i2c_bit_del_bus(&tsunami_i2c_adapter))) {
|
||||
printk("i2c-tsunami.o: i2c_bit_del_bus failed, module not removed\n");
|
||||
return res;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_bit_del_bus(&tsunami_i2c_adapter);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Oleg I. Vdovikin <vdovikin@jscc.ru>");
|
||||
MODULE_DESCRIPTION("Tsunami I2C/SMBus driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_tsunami_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return i2c_tsunami_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_tsunami_init);
|
||||
module_exit(i2c_tsunami_exit);
|
||||
+70
-88
@@ -33,9 +33,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
/* PCI device */
|
||||
#define VENDOR PCI_VENDOR_ID_VIA
|
||||
@@ -71,7 +69,7 @@ static u16 pm_io_base;
|
||||
open drain. So a we set a low value by setting the direction to
|
||||
output and a high value by setting the direction to input and
|
||||
relying on the required I2C pullup. The data value is initialized
|
||||
to 0 in i2c_via_init() and never changed.
|
||||
to 0 in via_init() and never changed.
|
||||
*/
|
||||
|
||||
static void bit_via_setscl(void *data, int state)
|
||||
@@ -96,45 +94,11 @@ static int bit_via_getsda(void *data)
|
||||
return (0 != (inb(I2C_IN) & I2C_SDA));
|
||||
}
|
||||
|
||||
static void bit_via_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
static void bit_via_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static struct i2c_algo_bit_data bit_data = {
|
||||
NULL,
|
||||
bit_via_setsda,
|
||||
bit_via_setscl,
|
||||
bit_via_getsda,
|
||||
bit_via_getscl,
|
||||
5, 5, HZ, /*waits, timeout */
|
||||
};
|
||||
|
||||
static struct i2c_adapter bit_via_ops = {
|
||||
"VIA i2c",
|
||||
I2C_HW_B_VIA,
|
||||
NULL,
|
||||
&bit_data,
|
||||
bit_via_inc,
|
||||
bit_via_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
/* When exactly was the new pci interface introduced? */
|
||||
static int find_via(void)
|
||||
{
|
||||
struct pci_dev *s_bridge;
|
||||
u16 base;
|
||||
u8 rev;
|
||||
|
||||
if (!pci_present())
|
||||
return -ENODEV;
|
||||
@@ -146,9 +110,37 @@ static int find_via(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (PCIBIOS_SUCCESSFUL !=
|
||||
pci_read_config_byte(s_bridge, PM_CFG_REVID, &rev))
|
||||
return -ENODEV;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_algo_bit_data bit_data = {
|
||||
.setsda = bit_via_setsda,
|
||||
.setscl = bit_via_setscl,
|
||||
.getsda = bit_via_getsda,
|
||||
.getscl = bit_via_getscl,
|
||||
.udelay = 5,
|
||||
.mdelay = 5,
|
||||
.timeout = HZ
|
||||
};
|
||||
|
||||
static struct i2c_adapter bit_via_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "VIA i2c",
|
||||
.id = I2C_HW_B_VIA,
|
||||
.algo_data = &bit_data,
|
||||
};
|
||||
|
||||
|
||||
static struct pci_device_id vt586b_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
u16 base;
|
||||
u8 rev;
|
||||
|
||||
pci_read_config_byte(dev, PM_CFG_REVID, &rev);
|
||||
|
||||
switch (rev) {
|
||||
case 0x00:
|
||||
@@ -164,62 +156,52 @@ static int find_via(void)
|
||||
/* later revision */
|
||||
}
|
||||
|
||||
if (PCIBIOS_SUCCESSFUL !=
|
||||
pci_read_config_word(s_bridge, base, &pm_io_base))
|
||||
return -ENODEV;
|
||||
|
||||
pci_read_config_word(dev, base, &pm_io_base);
|
||||
pm_io_base &= (0xff << 8);
|
||||
return 0;
|
||||
|
||||
return -ENODEV;
|
||||
|
||||
if (! request_region(I2C_DIR, IOSPACE, IOTEXT)) {
|
||||
printk("i2c-via.o: IO 0x%x-0x%x already in use\n",
|
||||
I2C_DIR, I2C_DIR + IOSPACE);
|
||||
return -EBUSY;
|
||||
}
|
||||
outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR);
|
||||
outb(inb(I2C_OUT) & ~(I2C_SDA | I2C_SCL), I2C_OUT);
|
||||
|
||||
i2c_bit_add_bus(&bit_via_adapter);
|
||||
}
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_via_init(void)
|
||||
static void __devexit vt586b_remove(struct pci_dev *dev)
|
||||
{
|
||||
i2c_bit_del_bus(&bit_via_adapter);
|
||||
}
|
||||
|
||||
|
||||
static struct pci_driver vt586b_driver = {
|
||||
.name = "vt586b smbus",
|
||||
.id_table = vt586b_ids,
|
||||
.probe = vt586b_probe,
|
||||
.remove = __devexit_p(vt586b_remove),
|
||||
};
|
||||
|
||||
static int __init i2c_vt586b_init(void)
|
||||
{
|
||||
printk("i2c-via.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
if (find_via() < 0) {
|
||||
printk("i2c-via.o: Error while reading PCI configuration\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (check_region(I2C_DIR, IOSPACE) < 0) {
|
||||
printk("i2c-via.o: IO 0x%x-0x%x already in use\n",
|
||||
I2C_DIR, I2C_DIR + IOSPACE);
|
||||
return -EBUSY;
|
||||
} else {
|
||||
request_region(I2C_DIR, IOSPACE, IOTEXT);
|
||||
outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR);
|
||||
outb(inb(I2C_OUT) & ~(I2C_SDA | I2C_SCL), I2C_OUT);
|
||||
}
|
||||
|
||||
if (i2c_bit_add_bus(&bit_via_ops) == 0) {
|
||||
printk("i2c-via.o: Module succesfully loaded\n");
|
||||
return 0;
|
||||
} else {
|
||||
release_region(I2C_DIR, IOSPACE);
|
||||
printk
|
||||
("i2c-via.o: Algo-bit error, couldn't register bus\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
return pci_module_init(&vt586b_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
static void __exit i2c_vt586b_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&vt586b_driver);
|
||||
release_region(I2C_DIR, IOSPACE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>");
|
||||
MODULE_DESCRIPTION("i2c for Via vt82c586b southbridge");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_via_init();
|
||||
}
|
||||
|
||||
void cleanup_module(void)
|
||||
{
|
||||
i2c_bit_del_bus(&bit_via_ops);
|
||||
release_region(I2C_DIR, IOSPACE);
|
||||
}
|
||||
#endif
|
||||
module_init(i2c_vt586b_init);
|
||||
module_exit(i2c_vt586b_exit);
|
||||
+55
-105
@@ -135,51 +135,15 @@ MODULE_PARM_DESC(force_addr,
|
||||
"Forcibly enable the SMBus at the given address. "
|
||||
"EXTREMELY DANGEROUS!");
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_vt596_init(void);
|
||||
static int __init vt596_cleanup(void);
|
||||
static int vt596_setup(void);
|
||||
static s32 vt596_access(struct i2c_adapter *adap, u16 addr,
|
||||
unsigned short flags, char read_write,
|
||||
u8 command, int size, union i2c_smbus_data *data);
|
||||
|
||||
|
||||
|
||||
|
||||
static void vt596_do_pause(unsigned int amount);
|
||||
static int vt596_transaction(void);
|
||||
static void vt596_inc(struct i2c_adapter *adapter);
|
||||
static void vt596_dec(struct i2c_adapter *adapter);
|
||||
static u32 vt596_func(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
/* name */ "Non-I2C SMBus adapter",
|
||||
/* id */ I2C_ALGO_SMBUS,
|
||||
/* master_xfer */ NULL,
|
||||
/* smbus_access */ vt596_access,
|
||||
/* slave_send */ NULL,
|
||||
/* slave_rcv */ NULL,
|
||||
/* algo_control */ NULL,
|
||||
/* functionality */ vt596_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter vt596_adapter = {
|
||||
"unset",
|
||||
I2C_ALGO_SMBUS | I2C_HW_SMBUS_VIA2,
|
||||
&smbus_algorithm,
|
||||
NULL,
|
||||
vt596_inc,
|
||||
vt596_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int __initdata vt596_initialized;
|
||||
static unsigned short vt596_smba = 0;
|
||||
|
||||
|
||||
@@ -481,16 +445,6 @@ s32 vt596_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vt596_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void vt596_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
u32 vt596_func(struct i2c_adapter *adapter)
|
||||
{
|
||||
@@ -499,77 +453,73 @@ u32 vt596_func(struct i2c_adapter *adapter)
|
||||
I2C_FUNC_SMBUS_BLOCK_DATA;
|
||||
}
|
||||
|
||||
int __init i2c_vt596_init(void)
|
||||
|
||||
static struct i2c_algorithm smbus_algorithm = {
|
||||
.name = "Non-I2C SMBus adapter",
|
||||
.id = I2C_ALGO_SMBUS,
|
||||
.smbus_xfer = vt596_access,
|
||||
.functionality = vt596_func,
|
||||
};
|
||||
|
||||
static struct i2c_adapter vt596_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "unset",
|
||||
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_VIA2,
|
||||
.algo = &smbus_algorithm,
|
||||
};
|
||||
|
||||
|
||||
static struct pci_device_id vt596_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit vt596_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-viapro.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
#ifdef DEBUG
|
||||
/* PE- It might be good to make this a permanent part of the code! */
|
||||
if (vt596_initialized) {
|
||||
printk
|
||||
("i2c-viapro.o: Oops, vt596_init called a second time!\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
#endif
|
||||
vt596_initialized = 0;
|
||||
if ((res = vt596_setup())) {
|
||||
|
||||
if (vt596_setup()) {
|
||||
printk
|
||||
("i2c-viapro.o: Can't detect vt82c596 or compatible device, module not inserted.\n");
|
||||
vt596_cleanup();
|
||||
return res;
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
vt596_initialized++;
|
||||
|
||||
sprintf(vt596_adapter.name, "SMBus Via Pro adapter at %04x",
|
||||
vt596_smba);
|
||||
if ((res = i2c_add_adapter(&vt596_adapter))) {
|
||||
printk
|
||||
("i2c-viapro.o: Adapter registration failed, module not inserted.\n");
|
||||
vt596_cleanup();
|
||||
return res;
|
||||
}
|
||||
vt596_initialized++;
|
||||
printk("i2c-viapro.o: Via Pro SMBus detected and initialized\n");
|
||||
return 0;
|
||||
i2c_add_adapter(&vt596_adapter);
|
||||
}
|
||||
|
||||
int __init vt596_cleanup(void)
|
||||
static void __devexit vt596_remove(struct pci_dev *dev)
|
||||
{
|
||||
int res;
|
||||
if (vt596_initialized >= 2) {
|
||||
if ((res = i2c_del_adapter(&vt596_adapter))) {
|
||||
printk
|
||||
("i2c-viapro.o: i2c_del_adapter failed, module not removed\n");
|
||||
return res;
|
||||
} else
|
||||
vt596_initialized--;
|
||||
}
|
||||
if (vt596_initialized >= 1) {
|
||||
release_region(vt596_smba, 8);
|
||||
vt596_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_adapter(&vt596_adapter);
|
||||
}
|
||||
|
||||
static struct pci_driver vt596_driver = {
|
||||
.name = "vt596 smbus",
|
||||
.id_table = vt596_ids,
|
||||
.probe = vt596_probe,
|
||||
.remove = __devexit_p(vt596_remove),
|
||||
};
|
||||
|
||||
static int __init i2c_vt596_init(void)
|
||||
{
|
||||
printk("i2c-viapro.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return pci_module_init(&vt596_driver);
|
||||
}
|
||||
|
||||
|
||||
static void __exit i2c_vt596_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&vt596_driver);
|
||||
release_region(vt596_smba, 8);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("vt82c596 SMBus driver");
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_vt596_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return vt596_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_vt596_init);
|
||||
module_exit(i2c_vt596_exit);
|
||||
+78
-174
@@ -36,9 +36,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
/* 3DFX defines */
|
||||
#ifndef PCI_DEVICE_ID_3DFX_VOODOO3
|
||||
@@ -72,33 +70,18 @@ MODULE_LICENSE("GPL");
|
||||
#define CYCLE_DELAY 10
|
||||
#define TIMEOUT (HZ / 2)
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init i2c_voodoo3_init(void);
|
||||
static int __init voodoo3_cleanup(void);
|
||||
static int voodoo3_setup(void);
|
||||
|
||||
static void config_v3(struct pci_dev *dev);
|
||||
static void voodoo3_inc(struct i2c_adapter *adapter);
|
||||
static void voodoo3_dec(struct i2c_adapter *adapter);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
|
||||
static int __initdata voodoo3_initialized;
|
||||
static unsigned char *mem;
|
||||
|
||||
extern inline void outlong(unsigned int dat)
|
||||
static inline void outlong(unsigned int dat)
|
||||
{
|
||||
*((unsigned int *) (mem + REG)) = dat;
|
||||
}
|
||||
|
||||
extern inline unsigned int readlong(void)
|
||||
static inline unsigned int readlong(void)
|
||||
{
|
||||
return *((unsigned int *) (mem + REG));
|
||||
}
|
||||
@@ -178,45 +161,6 @@ static int bit_vooddc_getsda(void *data)
|
||||
return (0 != (readlong() & DDC_SDA_IN));
|
||||
}
|
||||
|
||||
static struct i2c_algo_bit_data voo_i2c_bit_data = {
|
||||
NULL,
|
||||
bit_vooi2c_setsda,
|
||||
bit_vooi2c_setscl,
|
||||
bit_vooi2c_getsda,
|
||||
bit_vooi2c_getscl,
|
||||
CYCLE_DELAY, CYCLE_DELAY, TIMEOUT
|
||||
};
|
||||
|
||||
static struct i2c_adapter voodoo3_i2c_adapter = {
|
||||
"I2C Voodoo3/Banshee adapter",
|
||||
I2C_HW_B_VOO,
|
||||
NULL,
|
||||
&voo_i2c_bit_data,
|
||||
voodoo3_inc,
|
||||
voodoo3_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct i2c_algo_bit_data voo_ddc_bit_data = {
|
||||
NULL,
|
||||
bit_vooddc_setsda,
|
||||
bit_vooddc_setscl,
|
||||
bit_vooddc_getsda,
|
||||
bit_vooddc_getscl,
|
||||
CYCLE_DELAY, CYCLE_DELAY, TIMEOUT
|
||||
};
|
||||
|
||||
static struct i2c_adapter voodoo3_ddc_adapter = {
|
||||
"DDC Voodoo3/Banshee adapter",
|
||||
I2C_HW_B_VOO,
|
||||
NULL,
|
||||
&voo_ddc_bit_data,
|
||||
voodoo3_inc,
|
||||
voodoo3_dec,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* Configures the chip */
|
||||
|
||||
@@ -225,11 +169,7 @@ void config_v3(struct pci_dev *dev)
|
||||
unsigned int cadr;
|
||||
|
||||
/* map Voodoo3 memory */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13)
|
||||
cadr = dev->resource[0].start;
|
||||
#else
|
||||
cadr = dev->base_address[0];
|
||||
#endif
|
||||
cadr &= PCI_BASE_ADDRESS_MEM_MASK;
|
||||
mem = ioremap_nocache(cadr, 0x1000);
|
||||
if(mem) {
|
||||
@@ -239,130 +179,94 @@ void config_v3(struct pci_dev *dev)
|
||||
}
|
||||
}
|
||||
|
||||
/* Detect whether a Voodoo3 or a Banshee can be found,
|
||||
and initialize it. */
|
||||
static int voodoo3_setup(void)
|
||||
static struct i2c_algo_bit_data voo_i2c_bit_data = {
|
||||
.setsda = bit_vooi2c_setsda,
|
||||
.setscl = bit_vooi2c_setscl,
|
||||
.getsda = bit_vooi2c_getsda,
|
||||
.getscl = bit_vooi2c_getscl,
|
||||
.udelay = CYCLE_DELAY,
|
||||
.mdelay = CYCLE_DELAY,
|
||||
.timeout = TIMEOUT
|
||||
};
|
||||
|
||||
static struct i2c_adapter voodoo3_i2c_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "I2C Voodoo3/Banshee adapter",
|
||||
.id = I2C_HW_B_VOO,
|
||||
.algo_data = &voo_i2c_bit_data,
|
||||
};
|
||||
|
||||
static struct i2c_algo_bit_data voo_ddc_bit_data = {
|
||||
.setsda = bit_vooddc_setsda,
|
||||
.setscl = bit_vooddc_setscl,
|
||||
.getsda = bit_vooddc_getsda,
|
||||
.getscl = bit_vooddc_getscl,
|
||||
.udelay = CYCLE_DELAY,
|
||||
.mdelay = CYCLE_DELAY,
|
||||
.timeout = TIMEOUT
|
||||
};
|
||||
|
||||
static struct i2c_adapter voodoo3_ddc_adapter = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "DDC Voodoo3/Banshee adapter",
|
||||
.id = I2C_HW_B_VOO,
|
||||
.algo_data = &voo_ddc_bit_data,
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3,
|
||||
PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE,
|
||||
#endif
|
||||
static struct pci_device_id voodoo3_ids[] __devinitdata = {
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static int __devinit voodoo3_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
struct pci_dev *dev;
|
||||
int v3_num;
|
||||
|
||||
v3_num = 0;
|
||||
|
||||
dev = NULL;
|
||||
do {
|
||||
if ((dev = pci_find_device(PCI_VENDOR_ID_3DFX,
|
||||
PCI_DEVICE_ID_3DFX_VOODOO3,
|
||||
dev))) {
|
||||
if (!v3_num)
|
||||
config_v3(dev);
|
||||
v3_num++;
|
||||
}
|
||||
} while (dev);
|
||||
|
||||
dev = NULL;
|
||||
do {
|
||||
if ((dev = pci_find_device(PCI_VENDOR_ID_3DFX,
|
||||
PCI_DEVICE_ID_3DFX_BANSHEE,
|
||||
dev))) {
|
||||
if (!v3_num)
|
||||
config_v3(dev);
|
||||
v3_num++;
|
||||
}
|
||||
} while (dev);
|
||||
|
||||
if (v3_num > 0) {
|
||||
if(!mem)
|
||||
return -ENOMEM;
|
||||
printk("i2c-voodoo3: %d Banshee/Voodoo3 found.\n", v3_num);
|
||||
if (v3_num > 1)
|
||||
printk("i2c-voodoo3: warning: only 1 supported.\n");
|
||||
return 0;
|
||||
} else {
|
||||
printk("i2c-voodoo3: No Voodoo3 found.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
||||
void voodoo3_inc(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void voodoo3_dec(struct i2c_adapter *adapter)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
int __init i2c_voodoo3_init(void)
|
||||
{
|
||||
int res;
|
||||
printk("i2c-voodoo3.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
voodoo3_initialized = 0;
|
||||
if ((res = voodoo3_setup())) {
|
||||
if (voodoo3_setup()) {
|
||||
printk
|
||||
("i2c-voodoo3.o: Voodoo3 not detected, module not inserted.\n");
|
||||
voodoo3_cleanup();
|
||||
return res;
|
||||
return -ENODEV;
|
||||
}
|
||||
if ((res = i2c_bit_add_bus(&voodoo3_i2c_adapter))) {
|
||||
printk("i2c-voodoo3.o: I2C adapter registration failed\n");
|
||||
} else {
|
||||
printk("i2c-voodoo3.o: I2C bus initialized\n");
|
||||
voodoo3_initialized |= INIT2;
|
||||
}
|
||||
if ((res = i2c_bit_add_bus(&voodoo3_ddc_adapter))) {
|
||||
printk("i2c-voodoo3.o: DDC adapter registration failed\n");
|
||||
} else {
|
||||
printk("i2c-voodoo3.o: DDC bus initialized\n");
|
||||
voodoo3_initialized |= INIT3;
|
||||
}
|
||||
if(!(voodoo3_initialized & (INIT2 | INIT3))) {
|
||||
printk("i2c-voodoo3.o: Both registrations failed, module not inserted\n");
|
||||
voodoo3_cleanup();
|
||||
return res;
|
||||
}
|
||||
return 0;
|
||||
config_v3(dev);
|
||||
|
||||
i2c_bit_add_bus(&voodoo3_i2c_adapter);
|
||||
i2c_bit_add_bus(&voodoo3_ddc_adapter);
|
||||
}
|
||||
|
||||
int __init voodoo3_cleanup(void)
|
||||
static void __devexit voodoo3_remove(struct pci_dev *dev)
|
||||
{
|
||||
int res;
|
||||
|
||||
iounmap(mem);
|
||||
if (voodoo3_initialized & INIT3) {
|
||||
if ((res = i2c_bit_del_bus(&voodoo3_ddc_adapter))) {
|
||||
printk
|
||||
("i2c-voodoo3.o: i2c_bit_del_bus failed, module not removed\n");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
if (voodoo3_initialized & INIT2) {
|
||||
if ((res = i2c_bit_del_bus(&voodoo3_i2c_adapter))) {
|
||||
printk
|
||||
("i2c-voodoo3.o: i2c_bit_del_bus failed, module not removed\n");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
i2c_bit_del_bus(&voodoo3_i2c_adapter);
|
||||
i2c_bit_del_bus(&voodoo3_ddc_adapter);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
static struct pci_driver voodoo3_driver = {
|
||||
.name = "voodoo3 smbus",
|
||||
.id_table = voodoo3_ids,
|
||||
.probe = voodoo3_probe,
|
||||
.remove = __devexit_p(voodoo3_remove),
|
||||
};
|
||||
|
||||
static int __init i2c_voodoo3_init(void)
|
||||
{
|
||||
printk("i2c-voodoo3.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return pci_module_init(&voodoo3_driver);
|
||||
}
|
||||
|
||||
|
||||
static void __exit i2c_voodoo3_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&voodoo3_driver);
|
||||
iounmap(mem);
|
||||
}
|
||||
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, Ralph Metzler <rjkm@thp.uni-koeln.de>, and Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("Voodoo3 I2C/SMBus driver");
|
||||
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return i2c_voodoo3_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return voodoo3_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(i2c_voodoo3_init);
|
||||
module_exit(i2c_voodoo3_exit);
|
||||
+13
-29
@@ -120,8 +120,6 @@ static void adm1021_init_client(struct i2c_client *client);
|
||||
static int adm1021_detach_client(struct i2c_client *client);
|
||||
static int adm1021_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void adm1021_inc_use(struct i2c_client *client);
|
||||
static void adm1021_dec_use(struct i2c_client *client);
|
||||
static int adm1021_read_value(struct i2c_client *client, u8 reg);
|
||||
static int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask);
|
||||
static int adm1021_write_value(struct i2c_client *client, u8 reg,
|
||||
@@ -143,14 +141,13 @@ static int read_only = 0;
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver adm1021_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "ADM1021, MAX1617 sensor driver",
|
||||
.id = I2C_DRIVERID_ADM1021,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = adm1021_attach_adapter,
|
||||
.detach_client = adm1021_detach_client,
|
||||
.command = adm1021_command,
|
||||
.inc_use = adm1021_inc_use,
|
||||
.dec_use = adm1021_dec_use
|
||||
};
|
||||
|
||||
/* These files are created for each detected adm1021. This is just a template;
|
||||
@@ -185,7 +182,7 @@ static ctl_table adm1021_max_dir_table_template[] = {
|
||||
take more memory than the datastructure takes now. */
|
||||
static int adm1021_id = 0;
|
||||
|
||||
int adm1021_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int adm1021_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, adm1021_detect);
|
||||
}
|
||||
@@ -338,7 +335,7 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
void adm1021_init_client(struct i2c_client *client)
|
||||
static void adm1021_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Initialize the adm1021 chip */
|
||||
adm1021_write_value(client, ADM1021_REG_TOS_W,
|
||||
@@ -355,7 +352,7 @@ void adm1021_init_client(struct i2c_client *client)
|
||||
adm1021_write_value(client, ADM1021_REG_CONV_RATE_W, 0x04);
|
||||
}
|
||||
|
||||
int adm1021_detach_client(struct i2c_client *client)
|
||||
static int adm1021_detach_client(struct i2c_client *client)
|
||||
{
|
||||
|
||||
int err;
|
||||
@@ -377,33 +374,20 @@ int adm1021_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int adm1021_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int adm1021_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void adm1021_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void adm1021_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* All registers are byte-sized */
|
||||
int adm1021_read_value(struct i2c_client *client, u8 reg)
|
||||
static int adm1021_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
/* only update value if read succeeded; set fail bit if failed */
|
||||
int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask)
|
||||
static int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask)
|
||||
{
|
||||
int i;
|
||||
struct adm1021_data *data = client->data;
|
||||
@@ -417,7 +401,7 @@ int adm1021_rd_good(u8 *val, struct i2c_client *client, u8 reg, u8 mask)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
if (read_only > 0)
|
||||
return 0;
|
||||
@@ -425,7 +409,7 @@ int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
void adm1021_update_client(struct i2c_client *client)
|
||||
static void adm1021_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct adm1021_data *data = client->data;
|
||||
|
||||
@@ -613,13 +597,13 @@ void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
static int __init sensors_adm1021_init(void)
|
||||
static int __init sm_adm1021_init(void)
|
||||
{
|
||||
printk(KERN_INFO "adm1021.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return i2c_add_driver(&adm1021_driver);
|
||||
}
|
||||
|
||||
static void __exit sensors_adm1021_exit(void)
|
||||
static void __exit sm_adm1021_exit(void)
|
||||
{
|
||||
i2c_del_driver(&adm1021_driver);
|
||||
}
|
||||
@@ -632,5 +616,5 @@ MODULE_LICENSE("GPL");
|
||||
MODULE_PARM(read_only, "i");
|
||||
MODULE_PARM_DESC(read_only, "Don't set any values, read only mode");
|
||||
|
||||
module_init(sensors_adm1021_init)
|
||||
module_exit(sensors_adm1021_exit)
|
||||
module_init(sm_adm1021_init)
|
||||
module_exit(sm_adm1021_exit)
|
||||
+21
-95
@@ -37,15 +37,6 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
static unsigned short normal_i2c_range[] = { 0x2c, 0x2e, SENSORS_I2C_END };
|
||||
@@ -126,7 +117,7 @@ SENSORS_INSMOD_1(adm1024);
|
||||
#define IN_TO_REG(val,nr) (SENSORS_LIMIT(((val) & 0xff),0,255))
|
||||
#define IN_FROM_REG(val,nr) (val)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -202,11 +193,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
#define ADM1024_INIT_TEMP_HOT_MAX 700
|
||||
#define ADM1024_INIT_TEMP_HOT_HYST 600
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* 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
|
||||
dynamically allocated, at the same time when a new adm1024 client is
|
||||
@@ -240,13 +226,6 @@ struct adm1024_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_adm1024_init(void);
|
||||
static int __init adm1024_cleanup(void);
|
||||
|
||||
static int adm1024_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int adm1024_detect(struct i2c_adapter *adapter, int address,
|
||||
@@ -254,8 +233,6 @@ static int adm1024_detect(struct i2c_adapter *adapter, int address,
|
||||
static int adm1024_detach_client(struct i2c_client *client);
|
||||
static int adm1024_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void adm1024_inc_use(struct i2c_client *client);
|
||||
static void adm1024_dec_use(struct i2c_client *client);
|
||||
|
||||
static int adm1024_read_value(struct i2c_client *client, u8 register);
|
||||
static int adm1024_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -290,19 +267,15 @@ static void adm1024_vid(struct i2c_client *client, int operation,
|
||||
static int adm1024_id = 0;
|
||||
|
||||
static struct i2c_driver adm1024_driver = {
|
||||
/* name */ "ADM1024 sensor driver",
|
||||
/* id */ I2C_DRIVERID_ADM1024,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &adm1024_attach_adapter,
|
||||
/* detach_client */ &adm1024_detach_client,
|
||||
/* command */ &adm1024_command,
|
||||
/* inc_use */ &adm1024_inc_use,
|
||||
/* dec_use */ &adm1024_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "ADM1024 sensor driver",
|
||||
.id = I2C_DRIVERID_ADM1024,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = adm1024_attach_adapter,
|
||||
.detach_client = adm1024_detach_client,
|
||||
.command = adm1024_command,
|
||||
};
|
||||
|
||||
/* Used by adm1024_init/cleanup */
|
||||
static int __initdata adm1024_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected ADM1024. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -343,7 +316,7 @@ static ctl_table adm1024_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
int adm1024_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int adm1024_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, adm1024_detect);
|
||||
}
|
||||
@@ -460,7 +433,7 @@ static int adm1024_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int adm1024_detach_client(struct i2c_client *client)
|
||||
static int adm1024_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -480,37 +453,24 @@ int adm1024_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int adm1024_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int adm1024_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void adm1024_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void adm1024_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
int adm1024_read_value(struct i2c_client *client, u8 reg)
|
||||
static int adm1024_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return 0xFF & i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
int adm1024_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int adm1024_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
/* Called when we have found a new ADM1024. It should set limits, etc. */
|
||||
void adm1024_init_client(struct i2c_client *client)
|
||||
static void adm1024_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Reset all except Watchdog values and last conversion values
|
||||
This sets fan-divs to 2, among others. This makes most other
|
||||
@@ -566,7 +526,7 @@ void adm1024_init_client(struct i2c_client *client)
|
||||
adm1024_write_value(client, ADM1024_REG_CONFIG, 0x07);
|
||||
}
|
||||
|
||||
void adm1024_update_client(struct i2c_client *client)
|
||||
static void adm1024_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct adm1024_data *data = client->data;
|
||||
u8 i;
|
||||
@@ -879,58 +839,24 @@ void adm1024_vid(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_adm1024_init(void)
|
||||
static int __init sm_adm1024_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("adm1024.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
adm1024_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&adm1024_driver))) {
|
||||
printk
|
||||
("adm1024.o: Driver registration failed, module not inserted.\n");
|
||||
adm1024_cleanup();
|
||||
return res;
|
||||
}
|
||||
adm1024_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&adm1024_driver);
|
||||
}
|
||||
|
||||
int __init adm1024_cleanup(void)
|
||||
static void __exit sm_adm1024_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (adm1024_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&adm1024_driver))) {
|
||||
printk
|
||||
("adm1024.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
adm1024_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&adm1024_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("ADM1024 driver");
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_adm1024_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return adm1024_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_adm1024_init);
|
||||
module_exit(sm_adm1024_exit);
|
||||
+20
-96
@@ -37,18 +37,7 @@
|
||||
#include "sensors_vid.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -157,11 +146,6 @@ SENSORS_INSMOD_1(adm1025);
|
||||
#define ADM1025_INIT_TEMP_MAX 600
|
||||
#define ADM1025_INIT_TEMP_MIN 0
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* 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
|
||||
dynamically allocated, at the same time when a new adm1025 client is
|
||||
@@ -190,23 +174,12 @@ struct adm1025_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_adm1025_init(void);
|
||||
static int __init adm1025_cleanup(void);
|
||||
|
||||
static int adm1025_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int adm1025_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int adm1025_detach_client(struct i2c_client *client);
|
||||
static int adm1025_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void adm1025_inc_use(struct i2c_client *client);
|
||||
static void adm1025_dec_use(struct i2c_client *client);
|
||||
|
||||
static int adm1025_read_value(struct i2c_client *client, u8 register);
|
||||
static int adm1025_write_value(struct i2c_client *client, u8 register,
|
||||
u8 value);
|
||||
@@ -236,19 +209,15 @@ static void adm1025_vrm(struct i2c_client *client, int operation,
|
||||
static int adm1025_id = 0;
|
||||
|
||||
static struct i2c_driver adm1025_driver = {
|
||||
/* name */ "ADM1025 sensor driver",
|
||||
/* id */ I2C_DRIVERID_ADM1025,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &adm1025_attach_adapter,
|
||||
/* detach_client */ &adm1025_detach_client,
|
||||
/* command */ &adm1025_command,
|
||||
/* inc_use */ &adm1025_inc_use,
|
||||
/* dec_use */ &adm1025_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "ADM1025 sensor driver",
|
||||
.id = I2C_DRIVERID_ADM1025,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = adm1025_attach_adapter,
|
||||
.detach_client = adm1025_detach_client,
|
||||
.command = adm1025_command,
|
||||
};
|
||||
|
||||
/* Used by adm1025_init/cleanup */
|
||||
static int __initdata adm1025_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected ADM1025. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -283,7 +252,7 @@ static ctl_table adm1025_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
int adm1025_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int adm1025_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, adm1025_detect);
|
||||
}
|
||||
@@ -400,7 +369,7 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int adm1025_detach_client(struct i2c_client *client)
|
||||
static int adm1025_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -420,37 +389,24 @@ int adm1025_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int adm1025_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int adm1025_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void adm1025_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void adm1025_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
int adm1025_read_value(struct i2c_client *client, u8 reg)
|
||||
static int adm1025_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return 0xFF & i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
int adm1025_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int adm1025_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
/* Called when we have found a new ADM1025. It should set limits, etc. */
|
||||
void adm1025_init_client(struct i2c_client *client)
|
||||
static void adm1025_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct adm1025_data *data = client->data;
|
||||
|
||||
@@ -498,7 +454,7 @@ void adm1025_init_client(struct i2c_client *client)
|
||||
adm1025_write_value(client, ADM1025_REG_CONFIG, 0x01);
|
||||
}
|
||||
|
||||
void adm1025_update_client(struct i2c_client *client)
|
||||
static void adm1025_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct adm1025_data *data = client->data;
|
||||
u8 i;
|
||||
@@ -723,54 +679,22 @@ void adm1025_vrm(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_adm1025_init(void)
|
||||
static int __init sm_adm1025_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("adm1025.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
adm1025_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&adm1025_driver))) {
|
||||
printk
|
||||
("adm1025.o: Driver registration failed, module not inserted.\n");
|
||||
adm1025_cleanup();
|
||||
return res;
|
||||
}
|
||||
adm1025_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&adm1025_driver);
|
||||
}
|
||||
|
||||
int __init adm1025_cleanup(void)
|
||||
static void __exit sm_adm1025_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (adm1025_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&adm1025_driver))) {
|
||||
printk
|
||||
("adm1025.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
adm1025_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&adm1025_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("ADM1025 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_adm1025_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return adm1025_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_adm1025_init);
|
||||
module_exit(sm_adm1025_exit);
|
||||
+21
-96
@@ -62,18 +62,7 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -148,7 +137,7 @@ SENSORS_INSMOD_3(adm9240, ds1780, lm81);
|
||||
#define IN_TO_REG(val,nr) (SENSORS_LIMIT(((val) & 0xff),0,255))
|
||||
#define IN_FROM_REG(val,nr) (val)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -221,11 +210,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
#define ADM9240_INIT_TEMP_HOT_MAX 700
|
||||
#define ADM9240_INIT_TEMP_HOT_HYST 600
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* For each registered ADM9240, we need to keep some data in memory. That
|
||||
data is pointed to by adm9240_list[NR]->data. The structure itself is
|
||||
dynamically allocated, at the same time when a new adm9240 client is
|
||||
@@ -253,22 +237,12 @@ struct adm9240_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_adm9240_init(void);
|
||||
static int __init adm9240_cleanup(void);
|
||||
|
||||
static int adm9240_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int adm9240_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int adm9240_detach_client(struct i2c_client *client);
|
||||
static int adm9240_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void adm9240_inc_use(struct i2c_client *client);
|
||||
static void adm9240_dec_use(struct i2c_client *client);
|
||||
|
||||
static int adm9240_read_value(struct i2c_client *client, u8 register);
|
||||
static int adm9240_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -299,19 +273,15 @@ static void adm9240_vid(struct i2c_client *client, int operation,
|
||||
static int adm9240_id = 0;
|
||||
|
||||
static struct i2c_driver adm9240_driver = {
|
||||
/* name */ "ADM9240 sensor driver",
|
||||
/* id */ I2C_DRIVERID_ADM9240,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &adm9240_attach_adapter,
|
||||
/* detach_client */ &adm9240_detach_client,
|
||||
/* command */ &adm9240_command,
|
||||
/* inc_use */ &adm9240_inc_use,
|
||||
/* dec_use */ &adm9240_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "ADM9240 sensor driver",
|
||||
.id = I2C_DRIVERID_ADM9240,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = adm9240_attach_adapter,
|
||||
.detach_client = adm9240_detach_client,
|
||||
.command = adm9240_command,
|
||||
};
|
||||
|
||||
/* Used by adm9240_init/cleanup */
|
||||
static int __initdata adm9240_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected ADM9240. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -348,7 +318,7 @@ static ctl_table adm9240_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
int adm9240_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int adm9240_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, adm9240_detect);
|
||||
}
|
||||
@@ -480,7 +450,7 @@ static int adm9240_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int adm9240_detach_client(struct i2c_client *client)
|
||||
static int adm9240_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -500,37 +470,24 @@ int adm9240_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int adm9240_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int adm9240_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void adm9240_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void adm9240_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
int adm9240_read_value(struct i2c_client *client, u8 reg)
|
||||
static int adm9240_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return 0xFF & i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
int adm9240_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int adm9240_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
/* Called when we have found a new ADM9240. It should set limits, etc. */
|
||||
void adm9240_init_client(struct i2c_client *client)
|
||||
static void adm9240_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Reset all except Watchdog values and last conversion values
|
||||
This sets fan-divs to 2, among others. This makes most other
|
||||
@@ -575,7 +532,7 @@ void adm9240_init_client(struct i2c_client *client)
|
||||
adm9240_write_value(client, ADM9240_REG_CONFIG, 0x01);
|
||||
}
|
||||
|
||||
void adm9240_update_client(struct i2c_client *client)
|
||||
static void adm9240_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct adm9240_data *data = client->data;
|
||||
u8 i;
|
||||
@@ -824,54 +781,22 @@ void adm9240_vid(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_adm9240_init(void)
|
||||
static int __init sm_adm9240_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("adm9240.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
adm9240_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&adm9240_driver))) {
|
||||
printk
|
||||
("adm9240.o: Driver registration failed, module not inserted.\n");
|
||||
adm9240_cleanup();
|
||||
return res;
|
||||
}
|
||||
adm9240_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&adm9240_driver);
|
||||
}
|
||||
|
||||
int __init adm9240_cleanup(void)
|
||||
static void __exit sm_adm9240_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (adm9240_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&adm9240_driver))) {
|
||||
printk
|
||||
("adm9240.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
adm9240_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&adm9240_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("ADM9240 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_adm9240_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return adm9240_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_adm9240_init);
|
||||
module_exit(sm_adm9240_exit);
|
||||
+13
-78
@@ -40,11 +40,6 @@ static unsigned int normal_isa_range[] = { SENSORS_ISA_END };
|
||||
|
||||
SENSORS_INSMOD_1(bmcsensors);
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
struct bmcsensors_data {
|
||||
struct semaphore lock;
|
||||
int sysctl_id;
|
||||
@@ -56,13 +51,6 @@ struct bmcsensors_data {
|
||||
u8 alarms;
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_bmcsensors_init(void);
|
||||
static int __init bmcsensors_cleanup(void);
|
||||
|
||||
static int bmcsensors_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int bmcsensors_detect(struct i2c_adapter *adapter, int address,
|
||||
@@ -70,8 +58,6 @@ static int bmcsensors_detect(struct i2c_adapter *adapter, int address,
|
||||
static int bmcsensors_detach_client(struct i2c_client *client);
|
||||
static int bmcsensors_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void bmcsensors_inc_use(struct i2c_client *client);
|
||||
static void bmcsensors_dec_use(struct i2c_client *client);
|
||||
|
||||
static void bmcsensors_update_client(struct i2c_client *client);
|
||||
static int bmcsensors_find(int *address);
|
||||
@@ -92,14 +78,13 @@ static void bmcsensors_get_reading(struct i2c_client *client, int i);
|
||||
static int bmcsensors_id = 0;
|
||||
|
||||
static struct i2c_driver bmcsensors_driver = {
|
||||
/* name */ "BMC Sensors driver",
|
||||
/* id */ I2C_DRIVERID_BMCSENSORS,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &bmcsensors_attach_adapter,
|
||||
/* detach_client */ &bmcsensors_detach_client,
|
||||
/* command */ &bmcsensors_command,
|
||||
/* inc_use */ &bmcsensors_inc_use,
|
||||
/* dec_use */ &bmcsensors_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "BMC Sensors driver",
|
||||
.id = I2C_DRIVERID_BMCSENSORS,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = bmcsensors_attach_adapter,
|
||||
.detach_client = bmcsensors_detach_client,
|
||||
.command = bmcsensors_command,
|
||||
};
|
||||
|
||||
static struct bmcsensors_data bmc_data;
|
||||
@@ -114,9 +99,6 @@ struct i2c_client bmc_client = {
|
||||
0
|
||||
};
|
||||
|
||||
static bmcsensors_initialized;
|
||||
|
||||
|
||||
#define MAX_SDR_ENTRIES 50
|
||||
#define SDR_LIMITS 8
|
||||
#define SDR_MAX_ID_LENGTH 16
|
||||
@@ -806,19 +788,6 @@ static int bmcsensors_detach_client(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bmcsensors_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bmcsensors_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bmc_do_pause(unsigned int amount)
|
||||
{
|
||||
@@ -972,56 +941,22 @@ static void bmcsensors_alarms(struct i2c_client *client, int operation, int ctl_
|
||||
#endif
|
||||
}
|
||||
|
||||
static int __init sensors_bmcsensors_init(void)
|
||||
static int __init sm_bmcsensors_init(void)
|
||||
{
|
||||
int res, addr;
|
||||
|
||||
printk(KERN_INFO "bmcsensors.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
bmcsensors_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&bmcsensors_driver))) {
|
||||
printk(KERN_ERR
|
||||
"bmcsensors.o: Driver registration failed, module not inserted.\n");
|
||||
bmcsensors_cleanup();
|
||||
return res;
|
||||
}
|
||||
bmcsensors_initialized = 1;
|
||||
return 0;
|
||||
return i2c_add_driver(&bmcsensors_driver);
|
||||
}
|
||||
|
||||
static int __init bmcsensors_cleanup(void)
|
||||
static void __exit sm_bmcsensors_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (bmcsensors_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&bmcsensors_driver))) {
|
||||
printk(KERN_WARNING
|
||||
"bmcsensors.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
bmcsensors_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&bmcsensors_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("IPMI BMC sensors");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_bmcsensors_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return bmcsensors_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_bmcsensors_init);
|
||||
module_exit(sm_bmcsensors_exit);
|
||||
+21
-98
@@ -31,19 +31,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -88,18 +76,6 @@ struct bt869_data {
|
||||
u8 svideo; /* output format: (2=RGB) 1=SVIDEO, 0=Composite */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_bt869_init(void);
|
||||
static int __init bt869_cleanup(void);
|
||||
static int bt869_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int bt869_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
@@ -107,8 +83,6 @@ static void bt869_init_client(struct i2c_client *client);
|
||||
static int bt869_detach_client(struct i2c_client *client);
|
||||
static int bt869_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void bt869_inc_use(struct i2c_client *client);
|
||||
static void bt869_dec_use(struct i2c_client *client);
|
||||
static int bt869_read_value(struct i2c_client *client, u8 reg);
|
||||
static int bt869_write_value(struct i2c_client *client, u8 reg, u16 value);
|
||||
static void bt869_write_values(struct i2c_client *client, u16 *values);
|
||||
@@ -131,14 +105,13 @@ static void bt869_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver bt869_driver = {
|
||||
/* name */ "BT869 video-output chip driver",
|
||||
/* id */ I2C_DRIVERID_BT869,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &bt869_attach_adapter,
|
||||
/* detach_client */ &bt869_detach_client,
|
||||
/* command */ &bt869_command,
|
||||
/* inc_use */ &bt869_inc_use,
|
||||
/* dec_use */ &bt869_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "BT869 video-output chip driver",
|
||||
.id = I2C_DRIVERID_BT869,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = bt869_attach_adapter,
|
||||
.detach_client = bt869_detach_client,
|
||||
.command = bt869_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected bt869. This is just a template;
|
||||
@@ -487,12 +460,9 @@ static u16 registers_720_480[] =
|
||||
};
|
||||
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata bt869_initialized = 0;
|
||||
|
||||
int bt869_id = 0;
|
||||
|
||||
int bt869_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int bt869_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, bt869_detect);
|
||||
}
|
||||
@@ -596,7 +566,7 @@ int bt869_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int bt869_detach_client(struct i2c_client *client)
|
||||
static int bt869_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -616,31 +586,16 @@ int bt869_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int bt869_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int bt869_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void bt869_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void bt869_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* All registers are byte-sized.
|
||||
bt869 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int bt869_read_value(struct i2c_client *client, u8 reg)
|
||||
static int bt869_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return i2c_smbus_read_byte(client);
|
||||
}
|
||||
@@ -648,7 +603,7 @@ int bt869_read_value(struct i2c_client *client, u8 reg)
|
||||
/* All registers are byte-sized.
|
||||
bt869 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int bt869_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int bt869_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printk("bt869.o: write_value(0x%X, 0x%X)\n", reg, value);
|
||||
@@ -656,7 +611,7 @@ int bt869_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
void bt869_write_values(struct i2c_client *client, u16 *values)
|
||||
static void bt869_write_values(struct i2c_client *client, u16 *values)
|
||||
{
|
||||
/* writes set of registers from array. 0,0 marks end of table */
|
||||
while (*values) {
|
||||
@@ -665,7 +620,7 @@ void bt869_write_values(struct i2c_client *client, u16 *values)
|
||||
}
|
||||
}
|
||||
|
||||
void bt869_init_client(struct i2c_client *client)
|
||||
static void bt869_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct bt869_data *data = client->data;
|
||||
|
||||
@@ -690,7 +645,7 @@ void bt869_init_client(struct i2c_client *client)
|
||||
|
||||
}
|
||||
|
||||
void bt869_update_client(struct i2c_client *client)
|
||||
static void bt869_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct bt869_data *data = client->data;
|
||||
|
||||
@@ -917,54 +872,22 @@ void bt869_depth(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_bt869_init(void)
|
||||
static int __init sm_bt869_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("bt869.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
bt869_initialized = 0;
|
||||
if ((res = i2c_add_driver(&bt869_driver))) {
|
||||
printk
|
||||
("bt869.o: Driver registration failed, module not inserted.\n");
|
||||
bt869_cleanup();
|
||||
return res;
|
||||
}
|
||||
bt869_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&bt869_driver);
|
||||
}
|
||||
|
||||
int __init bt869_cleanup(void)
|
||||
static void __exit sm_bt869_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (bt869_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&bt869_driver))) {
|
||||
printk
|
||||
("bt869.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
bt869_initialized--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&bt869_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, Stephen Davies <steve@daviesfam.org>");
|
||||
MODULE_DESCRIPTION("bt869 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_bt869_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return bt869_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_bt869_init);
|
||||
module_exit(sm_bt869_exit);
|
||||
+17
-92
@@ -28,18 +28,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { 0x50, SENSORS_I2C_END };
|
||||
@@ -79,18 +68,6 @@ struct ddcmon_data {
|
||||
int memtype;
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_ddcmon_init(void);
|
||||
static int __init ddcmon_cleanup(void);
|
||||
|
||||
static int ddcmon_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int ddcmon_detect(struct i2c_adapter *adapter, int address,
|
||||
@@ -99,9 +76,6 @@ static int ddcmon_detach_client(struct i2c_client *client);
|
||||
static int ddcmon_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
|
||||
static void ddcmon_inc_use(struct i2c_client *client);
|
||||
static void ddcmon_dec_use(struct i2c_client *client);
|
||||
|
||||
static void ddcmon_idcall(struct i2c_client *client, int operation,
|
||||
int ctl_name, int *nrels_mag, long *results);
|
||||
static void ddcmon_size(struct i2c_client *client, int operation,
|
||||
@@ -117,14 +91,13 @@ static void ddcmon_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver ddcmon_driver = {
|
||||
/* name */ "DDCMON READER",
|
||||
/* id */ I2C_DRIVERID_DDCMON,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &ddcmon_attach_adapter,
|
||||
/* detach_client */ &ddcmon_detach_client,
|
||||
/* command */ &ddcmon_command,
|
||||
/* inc_use */ &ddcmon_inc_use,
|
||||
/* dec_use */ &ddcmon_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "DDCMON READER",
|
||||
.id = I2C_DRIVERID_DDCMON,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = ddcmon_attach_adapter,
|
||||
.detach_client = ddcmon_detach_client,
|
||||
.command = ddcmon_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected DDCMON. This is just a template;
|
||||
@@ -146,12 +119,9 @@ static ctl_table ddcmon_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata ddcmon_initialized = 0;
|
||||
|
||||
static int ddcmon_id = 0;
|
||||
|
||||
int ddcmon_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int ddcmon_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, ddcmon_detect);
|
||||
}
|
||||
@@ -236,7 +206,7 @@ int ddcmon_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int ddcmon_detach_client(struct i2c_client *client)
|
||||
static int ddcmon_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -252,26 +222,12 @@ int ddcmon_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int ddcmon_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int ddcmon_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ddcmon_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ddcmon_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ddcmon_update_client(struct i2c_client *client)
|
||||
static void ddcmon_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct ddcmon_data *data = client->data;
|
||||
int i, j;
|
||||
@@ -403,54 +359,23 @@ void ddcmon_serial(struct i2c_client *client, int operation,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_ddcmon_init(void)
|
||||
static int __init sm_ddcmon_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("ddcmon.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
ddcmon_initialized = 0;
|
||||
if ((res = i2c_add_driver(&ddcmon_driver))) {
|
||||
printk
|
||||
("ddcmon.o: Driver registration failed, module not inserted.\n");
|
||||
ddcmon_cleanup();
|
||||
return res;
|
||||
}
|
||||
ddcmon_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&ddcmon_driver);
|
||||
}
|
||||
|
||||
int __init ddcmon_cleanup(void)
|
||||
static void __exit sm_ddcmon_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (ddcmon_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&ddcmon_driver))) {
|
||||
printk
|
||||
("ddcmon.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
} else
|
||||
ddcmon_initialized--;
|
||||
return 0;
|
||||
i2c_del_driver(&ddcmon_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
|
||||
"Philip Edelbrock <phil@netroedge .com>, "
|
||||
"and Mark Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("DDCMON driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_ddcmon_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return ddcmon_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_ddcmon_init);
|
||||
module_exit(sm_ddcmon_exit);
|
||||
+14
-41
@@ -315,62 +315,35 @@ static int ds1307_command (struct i2c_client *client,unsigned int cmd,void *arg)
|
||||
return (-EINVAL);
|
||||
}
|
||||
|
||||
static void ds1307_inc_use (struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif /* #ifdef MODULE */
|
||||
}
|
||||
|
||||
static void ds1307_dec_use (struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif /* #ifdef MODULE */
|
||||
}
|
||||
|
||||
static struct i2c_driver ds1307 = {
|
||||
name: "ds1307",
|
||||
id: I2C_DRIVERID_DS1307,
|
||||
flags: I2C_DF_NOTIFY,
|
||||
attach_adapter: ds1307_attach_adapter,
|
||||
detach_client: ds1307_detach_client,
|
||||
command: ds1307_command,
|
||||
inc_use: ds1307_inc_use,
|
||||
dec_use: ds1307_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "ds1307",
|
||||
.id = I2C_DRIVERID_DS1307,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = ds1307_attach_adapter,
|
||||
.detach_client = ds1307_detach_client,
|
||||
.command = ds1307_command,
|
||||
};
|
||||
|
||||
static int __init ds1307_init (void)
|
||||
static int __init sm_ds1307_init(void)
|
||||
{
|
||||
int result;
|
||||
|
||||
if ((result = i2c_add_driver (&ds1307)))
|
||||
return (result);
|
||||
|
||||
printk ("Dallas Semiconductor DS1307 Real-Time Clock driver (V0.03)\n");
|
||||
|
||||
return (0);
|
||||
return i2c_add_driver(&ds1307);
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
|
||||
#undef __exit
|
||||
#define __exit
|
||||
#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
|
||||
|
||||
static void __exit ds1307_exit (void)
|
||||
static void __exit sm_ds1307_exit(void)
|
||||
{
|
||||
i2c_del_driver (&ds1307);
|
||||
i2c_del_driver(&ds1307);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
|
||||
MODULE_AUTHOR ("Abraham van der Merwe <abraham@2d3d.co.za>");
|
||||
MODULE_DESCRIPTION ("Linux support for DS1307 Real-Time Clock");
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE ("GPL");
|
||||
#endif /* #ifdef MODULE_LICENSE */
|
||||
|
||||
module_init (ds1307_init);
|
||||
module_exit (ds1307_exit);
|
||||
module_init(sm_ds1307_init);
|
||||
module_exit(sm_ds1307_exit);
|
||||
|
||||
+22
-97
@@ -29,18 +29,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -109,18 +98,6 @@ struct ds1621_data {
|
||||
u8 temp_int, temp_counter, temp_slope; /* Register values, byte */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_ds1621_init(void);
|
||||
static int __init ds1621_cleanup(void);
|
||||
static int ds1621_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int ds1621_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
@@ -128,8 +105,7 @@ static void ds1621_init_client(struct i2c_client *client);
|
||||
static int ds1621_detach_client(struct i2c_client *client);
|
||||
static int ds1621_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void ds1621_inc_use(struct i2c_client *client);
|
||||
static void ds1621_dec_use(struct i2c_client *client);
|
||||
|
||||
static u16 swap_bytes(u16 val);
|
||||
static int ds1621_read_value(struct i2c_client *client, u8 reg);
|
||||
static int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value);
|
||||
@@ -148,14 +124,13 @@ static void ds1621_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver ds1621_driver = {
|
||||
/* name */ "DS1621 sensor driver",
|
||||
/* id */ I2C_DRIVERID_DS1621,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &ds1621_attach_adapter,
|
||||
/* detach_client */ &ds1621_detach_client,
|
||||
/* command */ &ds1621_command,
|
||||
/* inc_use */ &ds1621_inc_use,
|
||||
/* dec_use */ &ds1621_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "DS1621 sensor driver",
|
||||
.id = I2C_DRIVERID_DS1621,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = ds1621_attach_adapter,
|
||||
.detach_client = ds1621_detach_client,
|
||||
.command = ds1621_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected DS1621. This is just a template;
|
||||
@@ -177,12 +152,9 @@ static ctl_table ds1621_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata ds1621_initialized = 0;
|
||||
|
||||
static int ds1621_id = 0;
|
||||
|
||||
int ds1621_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int ds1621_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, ds1621_detect);
|
||||
}
|
||||
@@ -287,7 +259,7 @@ int ds1621_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int ds1621_detach_client(struct i2c_client *client)
|
||||
static int ds1621_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -313,28 +285,13 @@ int ds1621_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int ds1621_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int ds1621_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void ds1621_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void ds1621_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
u16 swap_bytes(u16 val)
|
||||
static u16 swap_bytes(u16 val)
|
||||
{
|
||||
return (val >> 8) | (val << 8);
|
||||
}
|
||||
@@ -342,7 +299,7 @@ u16 swap_bytes(u16 val)
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
DS1621 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int ds1621_read_value(struct i2c_client *client, u8 reg)
|
||||
static int ds1621_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
if ((reg == DS1621_REG_CONF) || (reg == DS1621_REG_TEMP_COUNTER)
|
||||
|| (reg == DS1621_REG_TEMP_SLOPE))
|
||||
@@ -354,7 +311,7 @@ int ds1621_read_value(struct i2c_client *client, u8 reg)
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
DS1621 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
if ( (reg == DS1621_COM_START) || (reg == DS1621_COM_STOP) )
|
||||
return i2c_smbus_write_byte(client, reg);
|
||||
@@ -367,7 +324,7 @@ int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
swap_bytes(value));
|
||||
}
|
||||
|
||||
void ds1621_init_client(struct i2c_client *client)
|
||||
static void ds1621_init_client(struct i2c_client *client)
|
||||
{
|
||||
int reg;
|
||||
|
||||
@@ -382,7 +339,7 @@ void ds1621_init_client(struct i2c_client *client)
|
||||
ds1621_write_value(client, DS1621_REG_CONF, reg & 0xfe);
|
||||
}
|
||||
|
||||
void ds1621_update_client(struct i2c_client *client)
|
||||
static void ds1621_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct ds1621_data *data = client->data;
|
||||
u8 new_conf;
|
||||
@@ -573,53 +530,21 @@ void ds1621_polarity(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_ds1621_init(void)
|
||||
static int __init sm_ds1621_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("ds1621.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
ds1621_initialized = 0;
|
||||
if ((res = i2c_add_driver(&ds1621_driver))) {
|
||||
printk
|
||||
("ds1621.o: Driver registration failed, module not inserted.\n");
|
||||
ds1621_cleanup();
|
||||
return res;
|
||||
}
|
||||
ds1621_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&ds1621_driver);
|
||||
}
|
||||
|
||||
int __init ds1621_cleanup(void)
|
||||
static void __exit sm_ds1621_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (ds1621_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&ds1621_driver))) {
|
||||
printk
|
||||
("ds1621.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
ds1621_initialized--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&ds1621_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Christian W. Zuckschwerdt <zany@triq.net>");
|
||||
MODULE_DESCRIPTION("DS1621 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_ds1621_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return ds1621_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_ds1621_init);
|
||||
module_exit(sm_ds1621_exit);
|
||||
+18
-93
@@ -27,18 +27,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -85,18 +74,6 @@ struct eeprom_data {
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_eeprom_init(void);
|
||||
static int __init eeprom_cleanup(void);
|
||||
|
||||
static int eeprom_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int eeprom_detect(struct i2c_adapter *adapter, int address,
|
||||
@@ -105,9 +82,6 @@ static int eeprom_detach_client(struct i2c_client *client);
|
||||
static int eeprom_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
|
||||
static void eeprom_inc_use(struct i2c_client *client);
|
||||
static void eeprom_dec_use(struct i2c_client *client);
|
||||
|
||||
#if 0
|
||||
static int eeprom_write_value(struct i2c_client *client, u8 reg,
|
||||
u8 value);
|
||||
@@ -120,14 +94,13 @@ static void eeprom_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver eeprom_driver = {
|
||||
/* name */ "EEPROM READER",
|
||||
/* id */ I2C_DRIVERID_EEPROM,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &eeprom_attach_adapter,
|
||||
/* detach_client */ &eeprom_detach_client,
|
||||
/* command */ &eeprom_command,
|
||||
/* inc_use */ &eeprom_inc_use,
|
||||
/* dec_use */ &eeprom_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "EEPROM READER",
|
||||
.id = I2C_DRIVERID_EEPROM,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = eeprom_attach_adapter,
|
||||
.detach_client = eeprom_detach_client,
|
||||
.command = eeprom_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected EEPROM. This is just a template;
|
||||
@@ -171,12 +144,9 @@ static ctl_table eeprom_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata eeprom_initialized = 0;
|
||||
|
||||
static int eeprom_id = 0;
|
||||
|
||||
int eeprom_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int eeprom_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, eeprom_detect);
|
||||
}
|
||||
@@ -285,7 +255,7 @@ int eeprom_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int eeprom_detach_client(struct i2c_client *client)
|
||||
static int eeprom_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -305,34 +275,21 @@ int eeprom_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int eeprom_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int eeprom_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void eeprom_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void eeprom_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* No writes yet (PAE) */
|
||||
int eeprom_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int eeprom_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
void eeprom_update_client(struct i2c_client *client)
|
||||
static void eeprom_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct eeprom_data *data = client->data;
|
||||
int i, j;
|
||||
@@ -454,54 +411,22 @@ void eeprom_contents(struct i2c_client *client, int operation,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_eeprom_init(void)
|
||||
static int __init sm_eeprom_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("eeprom.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
eeprom_initialized = 0;
|
||||
if ((res = i2c_add_driver(&eeprom_driver))) {
|
||||
printk
|
||||
("eeprom.o: Driver registration failed, module not inserted.\n");
|
||||
eeprom_cleanup();
|
||||
return res;
|
||||
}
|
||||
eeprom_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&eeprom_driver);
|
||||
}
|
||||
|
||||
int __init eeprom_cleanup(void)
|
||||
static void __exit sm_eeprom_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (eeprom_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&eeprom_driver))) {
|
||||
printk
|
||||
("eeprom.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
} else
|
||||
eeprom_initialized--;
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&eeprom_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("EEPROM driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_eeprom_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return eeprom_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_eeprom_init);
|
||||
module_exit(sm_eeprom_exit);
|
||||
+20
-97
@@ -39,15 +39,6 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { 0x73, SENSORS_I2C_END };
|
||||
@@ -124,11 +115,6 @@ SENSORS_INSMOD_1(fscpos);
|
||||
|
||||
/* Initial limits */
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* 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
|
||||
dynamically allocated, at the same time when a new fscpos client is
|
||||
@@ -154,22 +140,12 @@ struct fscpos_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_fscpos_init(void);
|
||||
static int __init fscpos_cleanup(void);
|
||||
|
||||
static int fscpos_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int fscpos_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int fscpos_detach_client(struct i2c_client *client);
|
||||
static int fscpos_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void fscpos_inc_use(struct i2c_client *client);
|
||||
static void fscpos_dec_use(struct i2c_client *client);
|
||||
|
||||
static int fscpos_read_value(struct i2c_client *client, u8 register);
|
||||
static int fscpos_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -195,19 +171,15 @@ static void fscpos_wdog(struct i2c_client *client, int operation,
|
||||
static int fscpos_id = 0;
|
||||
|
||||
static struct i2c_driver fscpos_driver = {
|
||||
/* name */ "FSCPOS sensor driver",
|
||||
/* id */ I2C_DRIVERID_FSCPOS,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &fscpos_attach_adapter,
|
||||
/* detach_client */ &fscpos_detach_client,
|
||||
/* command */ &fscpos_command,
|
||||
/* inc_use */ &fscpos_inc_use,
|
||||
/* dec_use */ &fscpos_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "FSCPOS sensor driver",
|
||||
.id = I2C_DRIVERID_FSCPOS,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = fscpos_attach_adapter,
|
||||
.detach_client = fscpos_detach_client,
|
||||
.command = fscpos_command,
|
||||
};
|
||||
|
||||
/* Used by fscpos_init/cleanup */
|
||||
static int __initdata fscpos_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected FSCPOS. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -244,7 +216,7 @@ static ctl_table fscpos_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
int fscpos_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int fscpos_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, fscpos_detect);
|
||||
}
|
||||
@@ -337,7 +309,7 @@ int fscpos_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int fscpos_detach_client(struct i2c_client *client)
|
||||
static int fscpos_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -356,27 +328,13 @@ int fscpos_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int fscpos_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int fscpos_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fscpos_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void fscpos_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int fscpos_read_value(struct i2c_client *client, u8 reg)
|
||||
static int fscpos_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printk("fscpos: read reg 0x%02x\n",reg);
|
||||
@@ -384,7 +342,7 @@ int fscpos_read_value(struct i2c_client *client, u8 reg)
|
||||
return i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
int fscpos_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int fscpos_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printk("fscpos: write reg 0x%02x, val 0x%02x\n",reg, value);
|
||||
@@ -393,7 +351,7 @@ int fscpos_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
}
|
||||
|
||||
/* Called when we have found a new FSCPOS. It should set limits, etc. */
|
||||
void fscpos_init_client(struct i2c_client *client)
|
||||
static void fscpos_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct fscpos_data *data = client->data;
|
||||
|
||||
@@ -403,7 +361,7 @@ void fscpos_init_client(struct i2c_client *client)
|
||||
data->fan_min[2] = 0xff;
|
||||
}
|
||||
|
||||
void fscpos_update_client(struct i2c_client *client)
|
||||
static void fscpos_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct fscpos_data *data = client->data;
|
||||
|
||||
@@ -714,58 +672,23 @@ void fscpos_wdog(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_fscpos_init(void)
|
||||
static int __init sm_fscpos_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("fscpos.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
fscpos_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&fscpos_driver))) {
|
||||
printk
|
||||
("fscpos.o: Driver registration failed, module not inserted.\n");
|
||||
fscpos_cleanup();
|
||||
return res;
|
||||
}
|
||||
fscpos_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&fscpos_driver);
|
||||
}
|
||||
|
||||
int __init fscpos_cleanup(void)
|
||||
static void __exit sm_fscpos_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (fscpos_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&fscpos_driver))) {
|
||||
printk
|
||||
("fscpos.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
fscpos_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&fscpos_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Hermann Jung <hej@odn.de> based on work from Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("fujitsu siemens poseidon chip driver");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_fscpos_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return fscpos_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_fscpos_init);
|
||||
module_exit(sm_fscpos_exit);
|
||||
+20
-97
@@ -39,19 +39,7 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { 0x73, SENSORS_I2C_END };
|
||||
@@ -170,11 +158,6 @@ SENSORS_INSMOD_1(fscscy);
|
||||
|
||||
/* Initial limits */
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* 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
|
||||
dynamically allocated, at the same time when a new fscscy client is
|
||||
@@ -210,22 +193,12 @@ struct fscscy_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_fscscy_init(void);
|
||||
static int __init fscscy_cleanup(void);
|
||||
|
||||
static int fscscy_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int fscscy_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int fscscy_detach_client(struct i2c_client *client);
|
||||
static int fscscy_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void fscscy_inc_use(struct i2c_client *client);
|
||||
static void fscscy_dec_use(struct i2c_client *client);
|
||||
|
||||
static int fscscy_read_value(struct i2c_client *client, u8 register);
|
||||
static int fscscy_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -255,19 +228,15 @@ static void fscscy_intrusion(struct i2c_client *client, int operation,
|
||||
static int fscscy_id = 0;
|
||||
|
||||
static struct i2c_driver fscscy_driver = {
|
||||
/* name */ "FSCSCY sensor driver",
|
||||
/* id */ I2C_DRIVERID_FSCSCY,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &fscscy_attach_adapter,
|
||||
/* detach_client */ &fscscy_detach_client,
|
||||
/* command */ &fscscy_command,
|
||||
/* inc_use */ &fscscy_inc_use,
|
||||
/* dec_use */ &fscscy_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "FSCSCY sensor driver",
|
||||
.id = I2C_DRIVERID_FSCSCY,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = fscscy_attach_adapter,
|
||||
.detach_client = fscscy_detach_client,
|
||||
.command = fscscy_command,
|
||||
};
|
||||
|
||||
/* Used by fscscy_init/cleanup */
|
||||
static int __initdata fscscy_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected FSCSCY. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -316,7 +285,7 @@ static ctl_table fscscy_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
int fscscy_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int fscscy_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, fscscy_detect);
|
||||
}
|
||||
@@ -409,7 +378,7 @@ int fscscy_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int fscscy_detach_client(struct i2c_client *client)
|
||||
static int fscscy_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -428,27 +397,13 @@ int fscscy_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int fscscy_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int fscscy_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fscscy_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void fscscy_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int fscscy_read_value(struct i2c_client *client, u8 reg)
|
||||
static int fscscy_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printk("fscscy: read reg 0x%02x\n",reg);
|
||||
@@ -456,7 +411,7 @@ int fscscy_read_value(struct i2c_client *client, u8 reg)
|
||||
return i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
int fscscy_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int fscscy_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printk("fscscy: write reg 0x%02x, val 0x%02x\n",reg, value);
|
||||
@@ -465,7 +420,7 @@ int fscscy_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
}
|
||||
|
||||
/* Called when we have found a new FSCSCY. It should set limits, etc. */
|
||||
void fscscy_init_client(struct i2c_client *client)
|
||||
static void fscscy_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct fscscy_data *data = client->data;
|
||||
|
||||
@@ -488,7 +443,7 @@ void fscscy_init_client(struct i2c_client *client)
|
||||
data->volt_min[2] = data->volt_max[2] = fscscy_read_value(client, FSCSCY_REG_VOLT_BATT);
|
||||
}
|
||||
|
||||
void fscscy_update_client(struct i2c_client *client)
|
||||
static void fscscy_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct fscscy_data *data = client->data;
|
||||
|
||||
@@ -933,54 +888,22 @@ void fscscy_intrusion(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_fscscy_init(void)
|
||||
static int __init sm_fscscy_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("fscscy.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
fscscy_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&fscscy_driver))) {
|
||||
printk
|
||||
("fscscy.o: Driver registration failed, module not inserted.\n");
|
||||
fscscy_cleanup();
|
||||
return res;
|
||||
}
|
||||
fscscy_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&fscscy_driver);
|
||||
}
|
||||
|
||||
int __init fscscy_cleanup(void)
|
||||
static void __exit sm_fscscy_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (fscscy_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&fscscy_driver))) {
|
||||
printk
|
||||
("fscscy.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
fscscy_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&fscscy_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Martin Knoblauch <mkn@teraport.de> based on work (fscpos) from Hermann Jung <hej@odn.de>");
|
||||
MODULE_DESCRIPTION("fujitsu siemens scylla chip driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_fscscy_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return fscscy_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_fscscy_init);
|
||||
module_exit(sm_fscscy_exit);
|
||||
+26
-116
@@ -31,18 +31,7 @@
|
||||
#include <linux/smp_lock.h>
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { 0x2c, 0x2d, SENSORS_I2C_END };
|
||||
@@ -92,7 +81,7 @@ SENSORS_INSMOD_2(gl518sm_r00, gl518sm_r80);
|
||||
0,255))
|
||||
#define TEMP_FROM_REG(val) (((val) - 119) * 10)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -163,11 +152,7 @@ struct gl518_data {
|
||||
int iterate_lock;
|
||||
int quit_thread;
|
||||
struct task_struct *thread;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
|
||||
wait_queue_head_t wq;
|
||||
#else
|
||||
struct wait_queue *wq;
|
||||
#endif
|
||||
char valid; /* !=0 if following fields are valid */
|
||||
unsigned long last_updated; /* In jiffies */
|
||||
unsigned long last_updated_v00;
|
||||
@@ -189,18 +174,6 @@ struct gl518_data {
|
||||
u8 iterate; /* Voltage iteration mode */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_gl518sm_init(void);
|
||||
static int __init gl518_cleanup(void);
|
||||
static int gl518_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int gl518_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
@@ -208,17 +181,13 @@ static void gl518_init_client(struct i2c_client *client);
|
||||
static int gl518_detach_client(struct i2c_client *client);
|
||||
static int gl518_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void gl518_inc_use(struct i2c_client *client);
|
||||
static void gl518_dec_use(struct i2c_client *client);
|
||||
|
||||
static u16 swap_bytes(u16 val);
|
||||
static int gl518_read_value(struct i2c_client *client, u8 reg);
|
||||
static int gl518_write_value(struct i2c_client *client, u8 reg, u16 value);
|
||||
static void gl518_update_client(struct i2c_client *client);
|
||||
|
||||
static void gl518_update_client_rev00(struct i2c_client *client);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,68)
|
||||
static int gl518_update_thread(void *data);
|
||||
#endif
|
||||
static void gl518_update_iterate(struct i2c_client *client);
|
||||
|
||||
static void gl518_vin(struct i2c_client *client, int operation,
|
||||
@@ -240,14 +209,13 @@ static void gl518_iterate(struct i2c_client *client, int operation,
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver gl518_driver = {
|
||||
/* name */ "GL518SM sensor chip driver",
|
||||
/* id */ I2C_DRIVERID_GL518,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &gl518_attach_adapter,
|
||||
/* detach_client */ &gl518_detach_client,
|
||||
/* command */ &gl518_command,
|
||||
/* inc_use */ &gl518_inc_use,
|
||||
/* dec_use */ &gl518_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "GL518SM sensor chip driver",
|
||||
.id = I2C_DRIVERID_GL518,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = gl518_attach_adapter,
|
||||
.detach_client = gl518_detach_client,
|
||||
.command = gl518_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected GL518. This is just a template;
|
||||
@@ -283,16 +251,13 @@ static ctl_table gl518_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata gl518_initialized = 0;
|
||||
|
||||
/* I choose here for semi-static GL518SM allocation. Complete dynamic
|
||||
allocation could also be used; the code needed for this would probably
|
||||
take more memory than the datastructure takes now. */
|
||||
#define MAX_GL518_NR 4
|
||||
static struct i2c_client *gl518_list[MAX_GL518_NR];
|
||||
|
||||
int gl518_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int gl518_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, gl518_detect);
|
||||
}
|
||||
@@ -443,7 +408,7 @@ static int gl518_detect(struct i2c_adapter *adapter, int address,
|
||||
|
||||
|
||||
/* Called when we have found a new GL518SM. It should set limits, etc. */
|
||||
void gl518_init_client(struct i2c_client *client)
|
||||
static void gl518_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Power-on defaults (bit 7=1) */
|
||||
gl518_write_value(client, GL518_REG_CONF, 0x80);
|
||||
@@ -482,7 +447,7 @@ void gl518_init_client(struct i2c_client *client)
|
||||
gl518_write_value(client, GL518_REG_CONF, 0x44);
|
||||
}
|
||||
|
||||
int gl518_detach_client(struct i2c_client *client)
|
||||
static int gl518_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err, i;
|
||||
struct gl518_data *data = client->data;
|
||||
@@ -517,28 +482,13 @@ int gl518_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int gl518_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int gl518_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void gl518_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void gl518_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
u16 swap_bytes(u16 val)
|
||||
static u16 swap_bytes(u16 val)
|
||||
{
|
||||
return (val >> 8) | (val << 8);
|
||||
}
|
||||
@@ -546,7 +496,7 @@ u16 swap_bytes(u16 val)
|
||||
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized
|
||||
GL518 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int gl518_read_value(struct i2c_client *client, u8 reg)
|
||||
static int gl518_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
if ((reg >= 0x07) && (reg <= 0x0c))
|
||||
return swap_bytes(i2c_smbus_read_word_data(client, reg));
|
||||
@@ -557,7 +507,7 @@ int gl518_read_value(struct i2c_client *client, u8 reg)
|
||||
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized
|
||||
GL518 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int gl518_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int gl518_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
if ((reg >= 0x07) && (reg <= 0x0c))
|
||||
return i2c_smbus_write_word_data(client, reg,
|
||||
@@ -566,7 +516,7 @@ int gl518_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
void gl518_update_client(struct i2c_client *client)
|
||||
static void gl518_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct gl518_data *data = client->data;
|
||||
int val;
|
||||
@@ -645,7 +595,7 @@ void gl518_update_client(struct i2c_client *client)
|
||||
/* Here we decide how to run the iteration code.
|
||||
When called, we trigger the iteration and report the last
|
||||
measured voltage. No delay for user apps */
|
||||
void gl518_update_client_rev00(struct i2c_client *client)
|
||||
static void gl518_update_client_rev00(struct i2c_client *client)
|
||||
{
|
||||
struct gl518_data *data = client->data;
|
||||
int i;
|
||||
@@ -672,7 +622,7 @@ void gl518_update_client_rev00(struct i2c_client *client)
|
||||
}
|
||||
}
|
||||
|
||||
int gl518_update_thread(void *c)
|
||||
static int gl518_update_thread(void *c)
|
||||
{
|
||||
struct i2c_client *client = c;
|
||||
struct gl518_data *data = client->data;
|
||||
@@ -687,11 +637,7 @@ int gl518_update_thread(void *c)
|
||||
current->fs->umask = 0;
|
||||
strcpy(current->comm, "gl518sm");
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
|
||||
init_waitqueue_head(&(data->wq));
|
||||
#else
|
||||
data->wq = NULL;
|
||||
#endif
|
||||
data->thread = current;
|
||||
|
||||
#ifdef __SMP__
|
||||
@@ -719,7 +665,7 @@ int gl518_update_thread(void *c)
|
||||
comparisons for the GL518SM rev 00 that lacks support for direct
|
||||
reading of these values. Values are kept in iter_voltage */
|
||||
|
||||
void gl518_update_iterate(struct i2c_client *client)
|
||||
static void gl518_update_iterate(struct i2c_client *client)
|
||||
{
|
||||
struct gl518_data *data = client->data;
|
||||
int i, j, loop_more = 1, min[3], max[3], delta[3];
|
||||
@@ -1062,11 +1008,7 @@ void gl518_iterate(struct i2c_client *client, int operation, int ctl_name,
|
||||
data->quit_thread = 1;
|
||||
wake_up_interruptible(&data->wq);
|
||||
} else if ((data->iterate == 2) && (!data->thread)) {
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
|
||||
init_waitqueue_head(&(data->wq));
|
||||
#else
|
||||
data->wq = NULL;
|
||||
#endif
|
||||
kernel_thread(gl518_update_thread,
|
||||
(void *) client, 0);
|
||||
}
|
||||
@@ -1074,54 +1016,22 @@ void gl518_iterate(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_gl518sm_init(void)
|
||||
static int __init sm_gl518sm_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("gl518sm.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
gl518_initialized = 0;
|
||||
if ((res = i2c_add_driver(&gl518_driver))) {
|
||||
printk
|
||||
("gl518sm.o: Driver registration failed, module not inserted.\n");
|
||||
gl518_cleanup();
|
||||
return res;
|
||||
}
|
||||
gl518_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&gl518_driver);
|
||||
}
|
||||
|
||||
int __init gl518_cleanup(void)
|
||||
static void __exit sm_gl518sm_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (gl518_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&gl518_driver))) {
|
||||
printk
|
||||
("gl518.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
gl518_initialized--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&gl518_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Kyösti Mälkki <kmalkki@cc.hut.fi>");
|
||||
MODULE_DESCRIPTION("GL518SM driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_gl518sm_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return gl518_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_gl518sm_init);
|
||||
module_exit(sm_gl518sm_exit);
|
||||
+23
-98
@@ -28,18 +28,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { 0x2c, 0x2d, SENSORS_I2C_END };
|
||||
@@ -94,7 +83,7 @@ That's why _TEMP2 and _VIN4 access the same register
|
||||
0,255))
|
||||
#define TEMP_FROM_REG(val) (((val) - 130) * 10)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -185,18 +174,6 @@ struct gl520_data {
|
||||
u8 two_temps; /* Boolean */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_gl520_init(void);
|
||||
static int __init gl520_cleanup(void);
|
||||
static int gl520_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int gl520_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
@@ -204,8 +181,7 @@ static void gl520_init_client(struct i2c_client *client);
|
||||
static int gl520_detach_client(struct i2c_client *client);
|
||||
static int gl520_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void gl520_inc_use(struct i2c_client *client);
|
||||
static void gl520_dec_use(struct i2c_client *client);
|
||||
|
||||
static u16 swap_bytes(u16 val);
|
||||
static int gl520_read_value(struct i2c_client *client, u8 reg);
|
||||
static int gl520_write_value(struct i2c_client *client, u8 reg, u16 value);
|
||||
@@ -232,14 +208,13 @@ static void gl520_config(struct i2c_client *client, int operation,
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver gl520_driver = {
|
||||
/* name */ "GL520SM sensor chip driver",
|
||||
/* id */ I2C_DRIVERID_GL520,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &gl520_attach_adapter,
|
||||
/* detach_client */ &gl520_detach_client,
|
||||
/* command */ &gl520_command,
|
||||
/* inc_use */ &gl520_inc_use,
|
||||
/* dec_use */ &gl520_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "GL520SM sensor chip driver",
|
||||
.id = I2C_DRIVERID_GL520,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = gl520_attach_adapter,
|
||||
.detach_client = gl520_detach_client,
|
||||
.command = gl520_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected GL520. This is just a template;
|
||||
@@ -281,15 +256,12 @@ static ctl_table gl520_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata gl520_initialized = 0;
|
||||
|
||||
/* I choose here for semi-static GL520SM allocation. Complete dynamic
|
||||
allocation could also be used; the code needed for this would probably
|
||||
take more memory than the datastructure takes now. */
|
||||
static int gl520_id = 0;
|
||||
|
||||
int gl520_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int gl520_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, gl520_detect);
|
||||
}
|
||||
@@ -402,7 +374,7 @@ static int gl520_detect(struct i2c_adapter *adapter, int address,
|
||||
|
||||
|
||||
/* Called when we have found a new GL520SM. It should set limits, etc. */
|
||||
void gl520_init_client(struct i2c_client *client)
|
||||
static void gl520_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Power-on defaults (bit 7=1) */
|
||||
gl520_write_value(client, GL520_REG_CONF, 0x80);
|
||||
@@ -449,7 +421,7 @@ void gl520_init_client(struct i2c_client *client)
|
||||
gl520_write_value(client, GL520_REG_CONF, 0x44);
|
||||
}
|
||||
|
||||
int gl520_detach_client(struct i2c_client *client)
|
||||
static int gl520_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -469,28 +441,13 @@ int gl520_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int gl520_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int gl520_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void gl520_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void gl520_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
u16 swap_bytes(u16 val)
|
||||
static u16 swap_bytes(u16 val)
|
||||
{
|
||||
return (val >> 8) | (val << 8);
|
||||
}
|
||||
@@ -498,7 +455,7 @@ u16 swap_bytes(u16 val)
|
||||
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized
|
||||
GL520 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int gl520_read_value(struct i2c_client *client, u8 reg)
|
||||
static int gl520_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
if ((reg >= 0x07) && (reg <= 0x0c))
|
||||
return swap_bytes(i2c_smbus_read_word_data(client, reg));
|
||||
@@ -509,7 +466,7 @@ int gl520_read_value(struct i2c_client *client, u8 reg)
|
||||
/* Registers 0x07 to 0x0c are word-sized, others are byte-sized
|
||||
GL520 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int gl520_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int gl520_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
if ((reg >= 0x07) && (reg <= 0x0c))
|
||||
return i2c_smbus_write_word_data(client, reg,
|
||||
@@ -518,7 +475,7 @@ int gl520_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
void gl520_update_client(struct i2c_client *client)
|
||||
static void gl520_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct gl520_data *data = client->data;
|
||||
int val;
|
||||
@@ -874,54 +831,22 @@ void gl520_config(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_gl520_init(void)
|
||||
static int __init sm_gl520sm_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("gl520sm.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
gl520_initialized = 0;
|
||||
if ((res = i2c_add_driver(&gl520_driver))) {
|
||||
printk
|
||||
("gl520sm.o: Driver registration failed, module not inserted.\n");
|
||||
gl520_cleanup();
|
||||
return res;
|
||||
}
|
||||
gl520_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&gl520_driver);
|
||||
}
|
||||
|
||||
int __init gl520_cleanup(void)
|
||||
static void __exit sm_gl520sm_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (gl520_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&gl520_driver))) {
|
||||
printk
|
||||
("gl520.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
gl520_initialized--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&gl520_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Kyösti Mälkki <kmalkki@cc.hut.fi>");
|
||||
MODULE_DESCRIPTION("GL520SM driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_gl520_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return gl520_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_gl520sm_init);
|
||||
module_exit(sm_gl520sm_exit);
|
||||
+18
-94
@@ -37,19 +37,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
|
||||
/* Addresses to scan */
|
||||
#define ADDRESS 0x69
|
||||
@@ -74,27 +62,12 @@ struct icspll_data {
|
||||
int memtype;
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_icspll_init(void);
|
||||
static int __init icspll_cleanup(void);
|
||||
|
||||
static int icspll_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int icspll_detach_client(struct i2c_client *client);
|
||||
static int icspll_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static int icspll_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static void icspll_inc_use(struct i2c_client *client);
|
||||
static void icspll_dec_use(struct i2c_client *client);
|
||||
|
||||
#if 0
|
||||
static int icspll_write_value(struct i2c_client *client, u8 reg,
|
||||
@@ -108,14 +81,13 @@ static void icspll_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver icspll_driver = {
|
||||
/* name */ "Clock chip reader",
|
||||
/* id */ I2C_DRIVERID_ICSPLL,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &icspll_attach_adapter,
|
||||
/* detach_client */ &icspll_detach_client,
|
||||
/* command */ &icspll_command,
|
||||
/* inc_use */ &icspll_inc_use,
|
||||
/* dec_use */ &icspll_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "Clock chip reader",
|
||||
.id = I2C_DRIVERID_ICSPLL,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = icspll_attach_adapter,
|
||||
.detach_client = icspll_detach_client,
|
||||
.command = icspll_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected ICSPLL. This is just a template;
|
||||
@@ -132,11 +104,8 @@ static ctl_table icspll_dir_table_template[] = {
|
||||
/* holding place for data - block read could be as much as 32 */
|
||||
static u8 tempdata[MAXBLOCK_SIZE];
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata icspll_initialized = 0;
|
||||
|
||||
static int icspll_id = 0;
|
||||
int icspll_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int icspll_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, icspll_detect);
|
||||
}
|
||||
@@ -215,7 +184,7 @@ int icspll_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int icspll_detach_client(struct i2c_client *client)
|
||||
static int icspll_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -234,35 +203,22 @@ int icspll_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int icspll_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int icspll_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void icspll_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void icspll_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* No writes yet (PAE) */
|
||||
int icspll_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int icspll_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
return i2c_smbus_write_block_data(client->adapter, client->addr,
|
||||
reg, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
void icspll_update_client(struct i2c_client *client)
|
||||
static void icspll_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct icspll_data *data = client->data;
|
||||
int i, len;
|
||||
@@ -320,54 +276,22 @@ void icspll_contents(struct i2c_client *client, int operation,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_icspll_init(void)
|
||||
static int __init sm_icspll_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("icspll.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
icspll_initialized = 0;
|
||||
if ((res = i2c_add_driver(&icspll_driver))) {
|
||||
printk
|
||||
("icspll.o: Driver registration failed, module not inserted.\n");
|
||||
icspll_cleanup();
|
||||
return res;
|
||||
}
|
||||
icspll_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&icspll_driver);
|
||||
}
|
||||
|
||||
int __init icspll_cleanup(void)
|
||||
static void __exit sm_icspll_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (icspll_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&icspll_driver))) {
|
||||
printk
|
||||
("icspll.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
} else
|
||||
icspll_initialized--;
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&icspll_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, and Mark Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("ICSPLL driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_icspll_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return icspll_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_icspll_init);
|
||||
module_exit(sm_icspll_exit);
|
||||
+21
-99
@@ -45,18 +45,7 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -126,7 +115,7 @@ static int temp_type = 0x2a;
|
||||
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
|
||||
#define IN_FROM_REG(val) (((val) * 16) / 10)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -204,11 +193,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
#define IT87_INIT_TEMP_HIGH_3 600
|
||||
#define IT87_INIT_TEMP_LOW_3 200
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* 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
|
||||
dynamically allocated, at the same time when a new it87 client is
|
||||
@@ -236,22 +220,12 @@ struct it87_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_it87_init(void);
|
||||
static int __init it87_cleanup(void);
|
||||
|
||||
static int it87_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int it87_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int it87_detach_client(struct i2c_client *client);
|
||||
static int it87_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void it87_inc_use(struct i2c_client *client);
|
||||
static void it87_dec_use(struct i2c_client *client);
|
||||
|
||||
static int it87_read_value(struct i2c_client *client, u8 register);
|
||||
static int it87_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -274,19 +248,15 @@ static void it87_fan_div(struct i2c_client *client, int operation,
|
||||
int ctl_name, int *nrels_mag, long *results);
|
||||
|
||||
static struct i2c_driver it87_driver = {
|
||||
/* name */ "IT87xx sensor driver",
|
||||
/* id */ I2C_DRIVERID_IT87,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &it87_attach_adapter,
|
||||
/* detach_client */ &it87_detach_client,
|
||||
/* command */ &it87_command,
|
||||
/* inc_use */ &it87_inc_use,
|
||||
/* dec_use */ &it87_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "IT87xx sensor driver",
|
||||
.id = I2C_DRIVERID_IT87,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = it87_attach_adapter,
|
||||
.detach_client = it87_detach_client,
|
||||
.command = it87_command,
|
||||
};
|
||||
|
||||
/* Used by it87_init/cleanup */
|
||||
static int __initdata it87_initialized = 0;
|
||||
|
||||
static int it87_id = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
@@ -340,7 +310,7 @@ static ctl_table it87_dir_table_template[] = {
|
||||
* it87_driver is inserted (when this module is loaded), for each
|
||||
available adapter
|
||||
* when a new adapter is inserted (and it87_driver is still present) */
|
||||
int it87_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int it87_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, it87_detect);
|
||||
}
|
||||
@@ -498,7 +468,7 @@ int it87_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int it87_detach_client(struct i2c_client *client)
|
||||
static int it87_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -519,27 +489,11 @@ int it87_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int it87_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int it87_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void it87_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void it87_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* The SMBus locks itself, but ISA access must be locked explicitely!
|
||||
We don't want to lock the whole ISA bus, so we lock each client
|
||||
@@ -548,7 +502,7 @@ void it87_dec_use(struct i2c_client *client)
|
||||
would slow down the IT87 access and should not be necessary.
|
||||
There are some ugly typecasts here, but the good new is - they should
|
||||
nowhere else be necessary! */
|
||||
int it87_read_value(struct i2c_client *client, u8 reg)
|
||||
static int it87_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
int res;
|
||||
if (i2c_is_isa_client(client)) {
|
||||
@@ -568,7 +522,7 @@ int it87_read_value(struct i2c_client *client, u8 reg)
|
||||
would slow down the IT87 access and should not be necessary.
|
||||
There are some ugly typecasts here, but the good new is - they should
|
||||
nowhere else be necessary! */
|
||||
int it87_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int it87_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
if (i2c_is_isa_client(client)) {
|
||||
down(&(((struct it87_data *) (client->data))->lock));
|
||||
@@ -581,7 +535,7 @@ int it87_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
}
|
||||
|
||||
/* Called when we have found a new IT87. It should set limits, etc. */
|
||||
void it87_init_client(struct i2c_client *client)
|
||||
static void it87_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Reset all except Watchdog values and last conversion values
|
||||
This sets fan-divs to 2, among others */
|
||||
@@ -657,7 +611,7 @@ void it87_init_client(struct i2c_client *client)
|
||||
| (update_vbat ? 0x41 : 0x01));
|
||||
}
|
||||
|
||||
void it87_update_client(struct i2c_client *client)
|
||||
static void it87_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct it87_data *data = client->data;
|
||||
int i;
|
||||
@@ -884,41 +838,18 @@ void it87_fan_div(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_it87_init(void)
|
||||
static int __init sm_it87_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("it87.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
it87_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&it87_driver))) {
|
||||
printk
|
||||
("it87.o: Driver registration failed, module not inserted.\n");
|
||||
it87_cleanup();
|
||||
return res;
|
||||
}
|
||||
it87_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&it87_driver);
|
||||
}
|
||||
|
||||
int __init it87_cleanup(void)
|
||||
static void __exit sm_it87_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (it87_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&it87_driver))) {
|
||||
printk
|
||||
("it87.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
it87_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&it87_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Chris Gauthron <chrisg@0-in.com>");
|
||||
MODULE_DESCRIPTION("IT8705F, IT8712F, Sis950 driver");
|
||||
@@ -927,14 +858,5 @@ MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value");
|
||||
MODULE_PARM(temp_type, "i");
|
||||
MODULE_PARM_DESC(temp_type, "Temperature sensor type, normally leave unset");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_it87_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return it87_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_it87_init);
|
||||
module_exit(sm_it87_exit);
|
||||
+14
-31
@@ -74,8 +74,7 @@ static void lm75_init_client(struct i2c_client *client);
|
||||
static int lm75_detach_client(struct i2c_client *client);
|
||||
static int lm75_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void lm75_inc_use(struct i2c_client *client);
|
||||
static void lm75_dec_use(struct i2c_client *client);
|
||||
|
||||
static u16 swap_bytes(u16 val);
|
||||
static int lm75_read_value(struct i2c_client *client, u8 reg);
|
||||
static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value);
|
||||
@@ -86,14 +85,13 @@ static void lm75_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver lm75_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "LM75 sensor chip driver",
|
||||
.id = I2C_DRIVERID_LM75,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = lm75_attach_adapter,
|
||||
.detach_client = lm75_detach_client,
|
||||
.command = lm75_command,
|
||||
.inc_use = lm75_inc_use,
|
||||
.dec_use = lm75_dec_use
|
||||
};
|
||||
|
||||
/* These files are created for each detected LM75. This is just a template;
|
||||
@@ -109,7 +107,7 @@ static ctl_table lm75_dir_table_template[] = {
|
||||
|
||||
static int lm75_id = 0;
|
||||
|
||||
int lm75_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int lm75_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, lm75_detect);
|
||||
}
|
||||
@@ -221,7 +219,7 @@ int lm75_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int lm75_detach_client(struct i2c_client *client)
|
||||
static int lm75_detach_client(struct i2c_client *client)
|
||||
{
|
||||
struct lm75_data *data = client->data;
|
||||
|
||||
@@ -231,28 +229,13 @@ int lm75_detach_client(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lm75_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int lm75_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void lm75_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void lm75_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
u16 swap_bytes(u16 val)
|
||||
static u16 swap_bytes(u16 val)
|
||||
{
|
||||
return (val >> 8) | (val << 8);
|
||||
}
|
||||
@@ -260,7 +243,7 @@ u16 swap_bytes(u16 val)
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
LM75 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int lm75_read_value(struct i2c_client *client, u8 reg)
|
||||
static int lm75_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
if (reg == LM75_REG_CONF)
|
||||
return i2c_smbus_read_byte_data(client, reg);
|
||||
@@ -271,7 +254,7 @@ int lm75_read_value(struct i2c_client *client, u8 reg)
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
LM75 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
if (reg == LM75_REG_CONF)
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
@@ -280,7 +263,7 @@ int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
swap_bytes(value));
|
||||
}
|
||||
|
||||
void lm75_init_client(struct i2c_client *client)
|
||||
static void lm75_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Initialize the LM75 chip */
|
||||
lm75_write_value(client, LM75_REG_TEMP_OS,
|
||||
@@ -290,7 +273,7 @@ void lm75_init_client(struct i2c_client *client)
|
||||
lm75_write_value(client, LM75_REG_CONF, 0);
|
||||
}
|
||||
|
||||
void lm75_update_client(struct i2c_client *client)
|
||||
static void lm75_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct lm75_data *data = client->data;
|
||||
|
||||
@@ -338,13 +321,13 @@ void lm75_temp(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_lm75_init(void)
|
||||
static int __init sm_lm75_init(void)
|
||||
{
|
||||
printk(KERN_INFO "lm75.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return i2c_add_driver(&lm75_driver);
|
||||
}
|
||||
|
||||
static void __exit sensors_lm75_exit(void)
|
||||
static void __exit sm_lm75_exit(void)
|
||||
{
|
||||
i2c_del_driver(&lm75_driver);
|
||||
}
|
||||
@@ -353,5 +336,5 @@ MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
|
||||
MODULE_DESCRIPTION("LM75 driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_init(sensors_lm75_init);
|
||||
module_exit(sensors_lm75_exit);
|
||||
module_init(sm_lm75_init);
|
||||
module_exit(sm_lm75_exit);
|
||||
+21
-98
@@ -32,18 +32,7 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -92,7 +81,7 @@ SENSORS_INSMOD_3(lm78, lm78j, lm79);
|
||||
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
|
||||
#define IN_FROM_REG(val) (((val) * 16) / 10)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -162,11 +151,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
#define LM78_INIT_TEMP_OVER 600
|
||||
#define LM78_INIT_TEMP_HYST 500
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* There are some complications in a module like this. First off, LM78 chips
|
||||
may be both present on the SMBus and the ISA bus, and we have to handle
|
||||
those cases separately at some places. Second, there might be several
|
||||
@@ -209,22 +193,12 @@ struct lm78_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_lm78_init(void);
|
||||
static int __init lm78_cleanup(void);
|
||||
|
||||
static int lm78_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int lm78_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int lm78_detach_client(struct i2c_client *client);
|
||||
static int lm78_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void lm78_inc_use(struct i2c_client *client);
|
||||
static void lm78_dec_use(struct i2c_client *client);
|
||||
|
||||
static int lm78_read_value(struct i2c_client *client, u8 register);
|
||||
static int lm78_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -247,19 +221,15 @@ static void lm78_fan_div(struct i2c_client *client, int operation,
|
||||
int ctl_name, int *nrels_mag, long *results);
|
||||
|
||||
static struct i2c_driver lm78_driver = {
|
||||
/* name */ "LM78(-J) and LM79 sensor driver",
|
||||
/* id */ I2C_DRIVERID_LM78,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &lm78_attach_adapter,
|
||||
/* detach_client */ &lm78_detach_client,
|
||||
/* command */ &lm78_command,
|
||||
/* inc_use */ &lm78_inc_use,
|
||||
/* dec_use */ &lm78_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "LM78(-J) and LM79 sensor driver",
|
||||
.id = I2C_DRIVERID_LM78,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = lm78_attach_adapter,
|
||||
.detach_client = lm78_detach_client,
|
||||
.command = lm78_command,
|
||||
};
|
||||
|
||||
/* Used by lm78_init/cleanup */
|
||||
static int __initdata lm78_initialized = 0;
|
||||
|
||||
static int lm78_id = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
@@ -305,7 +275,7 @@ static ctl_table lm78_dir_table_template[] = {
|
||||
* lm78_driver is inserted (when this module is loaded), for each
|
||||
available adapter
|
||||
* when a new adapter is inserted (and lm78_driver is still present) */
|
||||
int lm78_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int lm78_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, lm78_detect);
|
||||
}
|
||||
@@ -469,7 +439,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int lm78_detach_client(struct i2c_client *client)
|
||||
static int lm78_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -490,26 +460,11 @@ int lm78_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int lm78_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int lm78_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void lm78_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void lm78_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* The SMBus locks itself, but ISA access must be locked explicitely!
|
||||
@@ -519,7 +474,7 @@ void lm78_dec_use(struct i2c_client *client)
|
||||
would slow down the LM78 access and should not be necessary.
|
||||
There are some ugly typecasts here, but the good new is - they should
|
||||
nowhere else be necessary! */
|
||||
int lm78_read_value(struct i2c_client *client, u8 reg)
|
||||
static int lm78_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
int res;
|
||||
if (i2c_is_isa_client(client)) {
|
||||
@@ -539,7 +494,7 @@ int lm78_read_value(struct i2c_client *client, u8 reg)
|
||||
would slow down the LM78 access and should not be necessary.
|
||||
There are some ugly typecasts here, but the good new is - they should
|
||||
nowhere else be necessary! */
|
||||
int lm78_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int lm78_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
if (i2c_is_isa_client(client)) {
|
||||
down(&(((struct lm78_data *) (client->data))->lock));
|
||||
@@ -552,7 +507,7 @@ int lm78_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
}
|
||||
|
||||
/* Called when we have found a new LM78. It should set limits, etc. */
|
||||
void lm78_init_client(struct i2c_client *client)
|
||||
static void lm78_init_client(struct i2c_client *client)
|
||||
{
|
||||
int vid;
|
||||
|
||||
@@ -614,7 +569,7 @@ void lm78_init_client(struct i2c_client *client)
|
||||
|
||||
}
|
||||
|
||||
void lm78_update_client(struct i2c_client *client)
|
||||
static void lm78_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct lm78_data *data = client->data;
|
||||
int i;
|
||||
@@ -820,53 +775,21 @@ void lm78_fan_div(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_lm78_init(void)
|
||||
static int __init sm_lm78_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("lm78.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
lm78_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&lm78_driver))) {
|
||||
printk
|
||||
("lm78.o: Driver registration failed, module not inserted.\n");
|
||||
lm78_cleanup();
|
||||
return res;
|
||||
}
|
||||
lm78_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&lm78_driver);
|
||||
}
|
||||
|
||||
int __init lm78_cleanup(void)
|
||||
static void __exit sm_lm78_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (lm78_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&lm78_driver))) {
|
||||
printk
|
||||
("lm78.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
lm78_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&lm78_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
|
||||
MODULE_DESCRIPTION("LM78, LM78-J and LM79 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_lm78_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return lm78_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_lm78_init);
|
||||
module_exit(sm_lm78_exit);
|
||||
+23
-97
@@ -33,18 +33,7 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -90,7 +79,7 @@ SENSORS_INSMOD_1(lm80);
|
||||
#define IN_TO_REG(val,nr) (SENSORS_LIMIT((val),0,255))
|
||||
#define IN_FROM_REG(val,nr) (val)
|
||||
|
||||
extern inline unsigned char FAN_TO_REG(unsigned rpm, unsigned div)
|
||||
static inline unsigned char FAN_TO_REG(unsigned rpm, unsigned div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -102,7 +91,7 @@ extern inline unsigned char FAN_TO_REG(unsigned rpm, unsigned div)
|
||||
#define FAN_FROM_REG(val,div) ((val)==0?-1:\
|
||||
(val)==255?0:1350000/((div)*(val)))
|
||||
|
||||
extern inline long TEMP_FROM_REG(u16 temp)
|
||||
static inline long TEMP_FROM_REG(u16 temp)
|
||||
{
|
||||
long res;
|
||||
|
||||
@@ -174,10 +163,6 @@ extern inline long TEMP_FROM_REG(u16 temp)
|
||||
#define LM80_INIT_TEMP_HOT_MAX 700
|
||||
#define LM80_INIT_TEMP_HOT_HYST 600
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* For each registered LM80, we need to keep some data in memory. That
|
||||
data is pointed to by lm80_list[NR]->data. The structure itself is
|
||||
@@ -205,13 +190,6 @@ struct lm80_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_lm80_init(void);
|
||||
static int __init lm80_cleanup(void);
|
||||
|
||||
static int lm80_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int lm80_detect(struct i2c_adapter *adapter, int address,
|
||||
@@ -219,8 +197,6 @@ static int lm80_detect(struct i2c_adapter *adapter, int address,
|
||||
static int lm80_detach_client(struct i2c_client *client);
|
||||
static int lm80_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void lm80_inc_use(struct i2c_client *client);
|
||||
static void lm80_dec_use(struct i2c_client *client);
|
||||
|
||||
static int lm80_read_value(struct i2c_client *client, u8 register);
|
||||
static int lm80_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -243,19 +219,15 @@ static void lm80_fan_div(struct i2c_client *client, int operation,
|
||||
static int lm80_id = 0;
|
||||
|
||||
static struct i2c_driver lm80_driver = {
|
||||
/* name */ "LM80 sensor driver",
|
||||
/* id */ I2C_DRIVERID_LM80,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &lm80_attach_adapter,
|
||||
/* detach_client */ &lm80_detach_client,
|
||||
/* command */ &lm80_command,
|
||||
/* inc_use */ &lm80_inc_use,
|
||||
/* dec_use */ &lm80_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "LM80 sensor driver",
|
||||
.id = I2C_DRIVERID_LM80,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = lm80_attach_adapter,
|
||||
.detach_client = lm80_detach_client,
|
||||
.command = lm80_command,
|
||||
};
|
||||
|
||||
/* Used by lm80_init/cleanup */
|
||||
static int __initdata lm80_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected LM80. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -290,7 +262,7 @@ static ctl_table lm80_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
int lm80_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int lm80_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, lm80_detect);
|
||||
}
|
||||
@@ -395,7 +367,7 @@ int lm80_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int lm80_detach_client(struct i2c_client *client)
|
||||
static int lm80_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -414,38 +386,24 @@ int lm80_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int lm80_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int lm80_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void lm80_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void lm80_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int lm80_read_value(struct i2c_client *client, u8 reg)
|
||||
static int lm80_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
int lm80_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
/* Called when we have found a new LM80. It should set limits, etc. */
|
||||
void lm80_init_client(struct i2c_client *client)
|
||||
static void lm80_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Reset all except Watchdog values and last conversion values
|
||||
This sets fan-divs to 2, among others. This makes most other
|
||||
@@ -499,7 +457,7 @@ void lm80_init_client(struct i2c_client *client)
|
||||
lm80_write_value(client, LM80_REG_CONFIG, 0x01);
|
||||
}
|
||||
|
||||
void lm80_update_client(struct i2c_client *client)
|
||||
static void lm80_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct lm80_data *data = client->data;
|
||||
int i;
|
||||
@@ -707,54 +665,22 @@ void lm80_fan_div(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_lm80_init(void)
|
||||
static int __init sm_lm80_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("lm80.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
lm80_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&lm80_driver))) {
|
||||
printk
|
||||
("lm80.o: Driver registration failed, module not inserted.\n");
|
||||
lm80_cleanup();
|
||||
return res;
|
||||
}
|
||||
lm80_initialized++;
|
||||
return 0;
|
||||
printk("lm80.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
return i2c_add_driver(&lm80_driver);
|
||||
}
|
||||
|
||||
int __init lm80_cleanup(void)
|
||||
static void __exit sm_lm80_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (lm80_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&lm80_driver))) {
|
||||
printk
|
||||
("lm80.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
lm80_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&lm80_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("LM80 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_lm80_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return lm80_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_lm80_init);
|
||||
module_exit(sm_lm80_exit);
|
||||
+22
-95
@@ -71,14 +71,6 @@ Set to '1' the appropriate defines, as nessesary:
|
||||
them insmod params, but it would be too much work. ;') */
|
||||
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -171,7 +163,7 @@ SENSORS_INSMOD_1(lm87);
|
||||
#define IN_TO_REG(val,nr) (SENSORS_LIMIT(((val) & 0xff),0,255))
|
||||
#define IN_FROM_REG(val,nr) (val)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -212,11 +204,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
#define LM87_INIT_INT_TEMP_MAX 600
|
||||
#define LM87_INIT_INT_TEMP_MIN 100
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* For each registered LM87, we need to keep some data in memory. That
|
||||
data is pointed to by LM87_list[NR]->data. The structure itself is
|
||||
dynamically allocated, at the same time when a new LM87 client is
|
||||
@@ -259,22 +246,12 @@ struct lm87_data {
|
||||
u8 vrm; /* VRM version * 10 */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_lm87_init(void);
|
||||
static int __init lm87_cleanup(void);
|
||||
|
||||
static int lm87_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int lm87_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int lm87_detach_client(struct i2c_client *client);
|
||||
static int lm87_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void lm87_inc_use(struct i2c_client *client);
|
||||
static void lm87_dec_use(struct i2c_client *client);
|
||||
|
||||
static int lm87_read_value(struct i2c_client *client, u8 register);
|
||||
static int lm87_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -311,19 +288,15 @@ static void lm87_vrm(struct i2c_client *client, int operation,
|
||||
static int lm87_id = 0;
|
||||
|
||||
static struct i2c_driver LM87_driver = {
|
||||
/* name */ "LM87 sensor driver",
|
||||
/* id */ I2C_DRIVERID_LM87,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &lm87_attach_adapter,
|
||||
/* detach_client */ &lm87_detach_client,
|
||||
/* command */ &lm87_command,
|
||||
/* inc_use */ &lm87_inc_use,
|
||||
/* dec_use */ &lm87_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "LM87 sensor driver",
|
||||
.id = I2C_DRIVERID_LM87,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = lm87_attach_adapter,
|
||||
.detach_client = lm87_detach_client,
|
||||
.command = lm87_command,
|
||||
};
|
||||
|
||||
/* Used by LM87_init/cleanup */
|
||||
static int __initdata lm87_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected LM87. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -388,7 +361,7 @@ static ctl_table LM87_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
int lm87_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int lm87_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
struct i2c_client_address_data lm87_client_data;
|
||||
@@ -487,7 +460,7 @@ static int lm87_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int lm87_detach_client(struct i2c_client *client)
|
||||
static int lm87_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -507,37 +480,24 @@ int lm87_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int lm87_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int lm87_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void lm87_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void lm87_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
int lm87_read_value(struct i2c_client *client, u8 reg)
|
||||
static int lm87_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return 0xFF & i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
int lm87_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int lm87_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
/* Called when we have found a new LM87. It should set limits, etc. */
|
||||
void lm87_init_client(struct i2c_client *client)
|
||||
static void lm87_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct lm87_data *data = client->data;
|
||||
int vid;
|
||||
@@ -640,7 +600,7 @@ void lm87_init_client(struct i2c_client *client)
|
||||
lm87_write_value(client, LM87_REG_CONFIG, 0x01);
|
||||
}
|
||||
|
||||
void lm87_update_client(struct i2c_client *client)
|
||||
static void lm87_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct lm87_data *data = client->data;
|
||||
int i;
|
||||
@@ -1041,44 +1001,20 @@ void lm87_vrm(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_lm87_init(void)
|
||||
static int __init sm_lm87_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("lm87.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
lm87_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&LM87_driver))) {
|
||||
printk
|
||||
("lm87.o: Driver registration failed, module not inserted.\n");
|
||||
lm87_cleanup();
|
||||
return res;
|
||||
}
|
||||
lm87_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&LM87_driver);
|
||||
}
|
||||
|
||||
int __init lm87_cleanup(void)
|
||||
static void __exit sm_lm87_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (lm87_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&LM87_driver))) {
|
||||
printk
|
||||
("lm87.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
lm87_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&LM87_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
#ifdef MODULE_LICENSE
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, "
|
||||
@@ -1086,14 +1022,5 @@ MODULE_AUTHOR
|
||||
|
||||
MODULE_DESCRIPTION("LM87 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_lm87_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return lm87_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_lm87_init);
|
||||
module_exit(sm_lm87_exit);
|
||||
+14
-40
@@ -356,62 +356,36 @@ static int lm92_command (struct i2c_client *client,unsigned int cmd,void *arg)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void lm92_inc_use (struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif /* #ifdef MODULE */
|
||||
}
|
||||
|
||||
static void lm92_dec_use (struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif /* #ifdef MODULE */
|
||||
}
|
||||
|
||||
static struct i2c_driver lm92_driver = {
|
||||
name: "lm92",
|
||||
id: I2C_DRIVERID_LM92,
|
||||
flags: I2C_DF_NOTIFY,
|
||||
attach_adapter: lm92_attach_adapter,
|
||||
detach_client: lm92_detach_client,
|
||||
command: lm92_command,
|
||||
inc_use: lm92_inc_use,
|
||||
dec_use: lm92_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "lm92",
|
||||
.id = I2C_DRIVERID_LM92,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = lm92_attach_adapter,
|
||||
.detach_client = lm92_detach_client,
|
||||
.command = lm92_command,
|
||||
};
|
||||
|
||||
int __init sensors_lm92_init (void)
|
||||
static int __init sm_lm92_init(void)
|
||||
{
|
||||
int result;
|
||||
|
||||
if ((result = i2c_add_driver (&lm92_driver)))
|
||||
return (result);
|
||||
|
||||
printk ("lm92.o version %s (%s)\n",LM_VERSION,LM_DATE);
|
||||
|
||||
return (0);
|
||||
return i2c_add_driver(&lm92_driver);
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
|
||||
#undef __exit
|
||||
#define __exit
|
||||
#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
|
||||
|
||||
static void __exit sensors_lm92_exit (void)
|
||||
static void __exit sm_lm92_exit(void)
|
||||
{
|
||||
i2c_del_driver (&lm92_driver);
|
||||
i2c_del_driver(&lm92_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
|
||||
MODULE_AUTHOR ("Abraham van der Merwe <abraham@2d3d.co.za>");
|
||||
MODULE_DESCRIPTION ("Linux support for LM92 Temperature Sensor");
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE ("GPL");
|
||||
#endif /* #ifdef MODULE_LICENSE */
|
||||
|
||||
module_init (sensors_lm92_init);
|
||||
module_exit (sensors_lm92_exit);
|
||||
module_init(sm_lm92_init);
|
||||
module_exit(sm_lm92_exit);
|
||||
|
||||
+18
-94
@@ -49,18 +49,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -89,26 +78,13 @@ struct ltc1710_data {
|
||||
u8 status; /* Register values */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_ltc1710_init(void);
|
||||
static int __init ltc1710_cleanup(void);
|
||||
static int ltc1710_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int ltc1710_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int ltc1710_detach_client(struct i2c_client *client);
|
||||
static int ltc1710_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void ltc1710_inc_use(struct i2c_client *client);
|
||||
static void ltc1710_dec_use(struct i2c_client *client);
|
||||
|
||||
static void ltc1710_switch1(struct i2c_client *client, int operation,
|
||||
int ctl_name, int *nrels_mag, long *results);
|
||||
static void ltc1710_switch2(struct i2c_client *client, int operation,
|
||||
@@ -118,14 +94,13 @@ static void ltc1710_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver ltc1710_driver = {
|
||||
/* name */ "LTC1710 sensor chip driver",
|
||||
/* id */ I2C_DRIVERID_LTC1710,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ <c1710_attach_adapter,
|
||||
/* detach_client */ <c1710_detach_client,
|
||||
/* command */ <c1710_command,
|
||||
/* inc_use */ <c1710_inc_use,
|
||||
/* dec_use */ <c1710_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "LTC1710 sensor chip driver",
|
||||
.id = I2C_DRIVERID_LTC1710,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = ltc1710_attach_adapter,
|
||||
.detach_client = ltc1710_detach_client,
|
||||
.command = ltc1710_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected LTC1710. This is just a template;
|
||||
@@ -141,15 +116,12 @@ static ctl_table ltc1710_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata ltc1710_initialized = 0;
|
||||
|
||||
/* I choose here for semi-static LTC1710 allocation. Complete dynamic
|
||||
allocation could also be used; the code needed for this would probably
|
||||
take more memory than the datastructure takes now. */
|
||||
static int ltc1710_id = 0;
|
||||
|
||||
int ltc1710_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int ltc1710_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, ltc1710_detect);
|
||||
}
|
||||
@@ -247,7 +219,7 @@ int ltc1710_detect(struct i2c_adapter *adapter, int address,
|
||||
}
|
||||
|
||||
|
||||
int ltc1710_detach_client(struct i2c_client *client)
|
||||
static int ltc1710_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -267,29 +239,13 @@ int ltc1710_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int ltc1710_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int ltc1710_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void ltc1710_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void ltc1710_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void ltc1710_update_client(struct i2c_client *client)
|
||||
static void ltc1710_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct ltc1710_data *data = client->data;
|
||||
|
||||
@@ -349,54 +305,22 @@ void ltc1710_switch2(struct i2c_client *client, int operation,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_ltc1710_init(void)
|
||||
static int __init sm_ltc1710_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("ltc1710.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
ltc1710_initialized = 0;
|
||||
if ((res = i2c_add_driver(<c1710_driver))) {
|
||||
printk
|
||||
("ltc1710.o: Driver registration failed, module not inserted.\n");
|
||||
ltc1710_cleanup();
|
||||
return res;
|
||||
}
|
||||
ltc1710_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(<c1710_driver);
|
||||
}
|
||||
|
||||
int __init ltc1710_cleanup(void)
|
||||
static void __exit sm_ltc1710_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (ltc1710_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(<c1710_driver))) {
|
||||
printk
|
||||
("ltc1710.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
ltc1710_initialized--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(<c1710_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("LTC1710 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_ltc1710_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return ltc1710_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_ltc1710_init);
|
||||
module_exit(sm_ltc1710_exit);
|
||||
+21
-97
@@ -30,19 +30,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { 0x2E, SENSORS_I2C_END };
|
||||
@@ -66,18 +54,6 @@ struct matorb_data {
|
||||
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_matorb_init(void);
|
||||
static int __init matorb_cleanup(void);
|
||||
static int matorb_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int matorb_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
@@ -85,8 +61,7 @@ static void matorb_init_client(struct i2c_client *client);
|
||||
static int matorb_detach_client(struct i2c_client *client);
|
||||
static int matorb_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void matorb_inc_use(struct i2c_client *client);
|
||||
static void matorb_dec_use(struct i2c_client *client);
|
||||
|
||||
static int matorb_write_value(struct i2c_client *client, u8 reg,
|
||||
u16 value);
|
||||
static void matorb_disp(struct i2c_client *client, int operation,
|
||||
@@ -96,14 +71,13 @@ static void matorb_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver matorb_driver = {
|
||||
/* name */ "Matrix Orbital LCD driver",
|
||||
/* id */ I2C_DRIVERID_MATORB,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &matorb_attach_adapter,
|
||||
/* detach_client */ &matorb_detach_client,
|
||||
/* command */ &matorb_command,
|
||||
/* inc_use */ &matorb_inc_use,
|
||||
/* dec_use */ &matorb_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "Matrix Orbital LCD driver",
|
||||
.id = I2C_DRIVERID_MATORB,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = matorb_attach_adapter,
|
||||
.detach_client = matorb_detach_client,
|
||||
.command = matorb_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected MATORB. This is just a template;
|
||||
@@ -117,12 +91,9 @@ static ctl_table matorb_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata matorb_initialized = 0;
|
||||
|
||||
static int matorb_id = 0;
|
||||
|
||||
int matorb_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int matorb_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, matorb_detect);
|
||||
}
|
||||
@@ -209,7 +180,7 @@ int matorb_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int matorb_detach_client(struct i2c_client *client)
|
||||
static int matorb_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -229,32 +200,17 @@ int matorb_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int matorb_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int matorb_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void matorb_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void matorb_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
MATORB uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int matorb_read_value(struct i2c_client *client, u8 reg)
|
||||
static int matorb_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return -1; /* Doesn't support reads */
|
||||
}
|
||||
@@ -263,7 +219,7 @@ int matorb_read_value(struct i2c_client *client, u8 reg)
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
MATORB uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int matorb_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int matorb_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
if (reg == 0) {
|
||||
return i2c_smbus_write_byte(client, value);
|
||||
@@ -272,12 +228,12 @@ int matorb_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
}
|
||||
}
|
||||
|
||||
void matorb_init_client(struct i2c_client *client)
|
||||
static void matorb_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Initialize the MATORB chip */
|
||||
}
|
||||
|
||||
void matorb_update_client(struct i2c_client *client)
|
||||
static void matorb_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct matorb_data *data = client->data;
|
||||
|
||||
@@ -317,54 +273,22 @@ void matorb_disp(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_matorb_init(void)
|
||||
static int __init sm_matorb_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("matorb.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
matorb_initialized = 0;
|
||||
if ((res = i2c_add_driver(&matorb_driver))) {
|
||||
printk
|
||||
("matorb.o: Driver registration failed, module not inserted.\n");
|
||||
matorb_cleanup();
|
||||
return res;
|
||||
}
|
||||
matorb_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&matorb_driver);
|
||||
}
|
||||
|
||||
int __init matorb_cleanup(void)
|
||||
static void __exit sm_matorb_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (matorb_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&matorb_driver))) {
|
||||
printk
|
||||
("matorb.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
matorb_initialized--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&matorb_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("MATORB driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_matorb_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return matorb_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_matorb_init);
|
||||
module_exit(sm_matorb_exit);
|
||||
+22
-102
@@ -65,19 +65,7 @@ static const char *version_str = "2.00 29/2/2000 Fons Rademakers";
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
|
||||
#undef AUTODETECT /* try to autodetect MaxiLife version */
|
||||
/*#define AUTODETECT*/
|
||||
@@ -133,7 +121,7 @@ SENSORS_INSMOD_1(maxilife);
|
||||
#define FAN_FROM_REG(val) ((val)==0xfe ? 0 : (val)==0xff ? -1 : \
|
||||
(val)==0x00 ? -1 : (1171860 / (val)))
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm)
|
||||
static inline u8 FAN_TO_REG(long rpm)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -241,11 +229,6 @@ extern inline u8 FAN_TO_REG(long rpm)
|
||||
(nr)==5 ? ((val) * 823 - 149140) : 0)
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* The following product codenames apply:
|
||||
Cristal/Geronimo: HP KAYAK XU/XAs
|
||||
(Dual Pentium II Slot 1, Deschutes/Klamath)
|
||||
@@ -288,22 +271,12 @@ struct maxi_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_maxi_init(void);
|
||||
static int __init maxi_cleanup(void);
|
||||
|
||||
static int maxi_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int maxi_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int maxi_detach_client(struct i2c_client *client);
|
||||
static int maxi_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void maxi_inc_use(struct i2c_client *client);
|
||||
static void maxi_dec_use(struct i2c_client *client);
|
||||
|
||||
static int maxi_read_value(struct i2c_client *client, u8 register);
|
||||
static int maxi_read_token(struct i2c_client *client, u16 token);
|
||||
@@ -341,19 +314,15 @@ static void maxi_alarms(struct i2c_client *client, int operation,
|
||||
/* The driver. I choose to use type i2c_driver, as at is identical to
|
||||
the smbus_driver. */
|
||||
static struct i2c_driver maxi_driver = {
|
||||
/* name */ "HP MaxiLife driver",
|
||||
/* id */ I2C_DRIVERID_MAXILIFE,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &maxi_attach_adapter,
|
||||
/* detach_client */ &maxi_detach_client,
|
||||
/* command */ &maxi_command,
|
||||
/* inc_use */ &maxi_inc_use,
|
||||
/* dec_use */ &maxi_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "HP MaxiLife driver",
|
||||
.id = I2C_DRIVERID_MAXILIFE,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = maxi_attach_adapter,
|
||||
.detach_client = maxi_detach_client,
|
||||
.command = maxi_command,
|
||||
};
|
||||
|
||||
/* Used by maxi_init/cleanup */
|
||||
static int __initdata maxi_initialized = 0;
|
||||
|
||||
static int maxi_id = 0;
|
||||
|
||||
/* Default firmware version. Use module option "maxi_version"
|
||||
@@ -416,7 +385,7 @@ static ctl_table maxi_dir_table_template[] = {
|
||||
- maxi_driver is inserted (when this module is loaded), for each
|
||||
available adapter
|
||||
- when a new adapter is inserted (and maxi_driver is still present) */
|
||||
int maxi_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int maxi_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, maxi_detect);
|
||||
}
|
||||
@@ -637,7 +606,7 @@ int maxi_detect(struct i2c_adapter *adapter, int address,
|
||||
- maxi_driver is removed (when this module is unloaded)
|
||||
- when an adapter is removed which has a maxi client (and maxi_driver
|
||||
is still present). */
|
||||
int maxi_detach_client(struct i2c_client *client)
|
||||
static int maxi_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -654,36 +623,19 @@ int maxi_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int maxi_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int maxi_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void maxi_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void maxi_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Read byte from specified register (-1 in case of error, value otherwise). */
|
||||
int maxi_read_value(struct i2c_client *client, u8 reg)
|
||||
static int maxi_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
/* Read the byte value for a MaxiLife token (-1 in case of error, value otherwise */
|
||||
int maxi_read_token(struct i2c_client *client, u16 token)
|
||||
static int maxi_read_token(struct i2c_client *client, u16 token)
|
||||
{
|
||||
u8 lowToken, highToken;
|
||||
int error, value;
|
||||
@@ -749,7 +701,7 @@ int maxi_read_token(struct i2c_client *client, u16 token)
|
||||
|
||||
#ifndef NOWRITE
|
||||
/* Write byte to specified register (-1 in case of error, 0 otherwise). */
|
||||
int maxi_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int maxi_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
@@ -822,7 +774,7 @@ int maxi_write_token_loop(struct i2c_client *client, u16 token, u8 len,
|
||||
}
|
||||
|
||||
/* Called when we have found a new MaxiLife. It should set limits, etc. */
|
||||
void maxi_init_client(struct i2c_client *client)
|
||||
static void maxi_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct maxi_data *data = client->data;
|
||||
|
||||
@@ -834,7 +786,7 @@ void maxi_init_client(struct i2c_client *client)
|
||||
}
|
||||
}
|
||||
|
||||
void maxi_update_client(struct i2c_client *client)
|
||||
static void maxi_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct maxi_data *data = client->data;
|
||||
int i;
|
||||
@@ -1386,56 +1338,24 @@ void maxi_alarms(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_maxi_init(void)
|
||||
static int __init sm_maxilife_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("maxilife: Version %s (lm_sensors %s (%s))\n", version_str,
|
||||
LM_VERSION, LM_DATE);
|
||||
maxi_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&maxi_driver))) {
|
||||
printk
|
||||
("maxilife: Driver registration failed, module not inserted.\n");
|
||||
maxi_cleanup();
|
||||
return res;
|
||||
}
|
||||
maxi_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&maxi_driver);
|
||||
}
|
||||
|
||||
int __init maxi_cleanup(void)
|
||||
static void __exit sm_maxilife_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (maxi_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&maxi_driver))) {
|
||||
printk
|
||||
("maxilife: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
maxi_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&maxi_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Fons Rademakers <Fons.Rademakers@cern.ch>");
|
||||
MODULE_DESCRIPTION("HP MaxiLife driver");
|
||||
MODULE_PARM(maxi_version, "i");
|
||||
MODULE_PARM_DESC(maxi_version, "MaxiLife firmware version");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_maxi_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return maxi_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_maxilife_init);
|
||||
module_exit(sm_maxilife_exit);
|
||||
+22
-97
@@ -32,18 +32,7 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = {SENSORS_I2C_END};
|
||||
@@ -131,7 +120,7 @@ SENSORS_INSMOD_1(mtp008);
|
||||
* and the rpm is therefore:
|
||||
* rpm = 1350000 / (count * div)
|
||||
*/
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -250,11 +239,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
#define MTP008_INIT_TEMP2_OVER 700 /* 70 Celsius */
|
||||
#define MTP008_INIT_TEMP2_HYST 500 /* 50 Celsius */
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/*
|
||||
* For each registered MTP008, we need to keep some data in memory. The
|
||||
* structure itself is dynamically allocated, at the same time when a new
|
||||
@@ -287,21 +271,12 @@ struct mtp008_data {
|
||||
u8 pwmenable; /* Register 0x57 value */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
static int __init sensors_mtp008_init(void);
|
||||
#else
|
||||
extern int __init sensors_mtp008_init(void);
|
||||
#endif
|
||||
static int __init mtp008_cleanup(void);
|
||||
|
||||
static int mtp008_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int mtp008_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int mtp008_detach_client(struct i2c_client *client);
|
||||
static int mtp008_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void mtp008_inc_use(struct i2c_client *client);
|
||||
static void mtp008_dec_use(struct i2c_client *client);
|
||||
|
||||
static int mtp008_read_value(struct i2c_client *client, u8 register);
|
||||
static int mtp008_write_value(struct i2c_client *client, u8 register, u8 value);
|
||||
@@ -334,19 +309,15 @@ static int mtp008_id = 0;
|
||||
|
||||
static struct i2c_driver mtp008_driver =
|
||||
{
|
||||
/* name */ "MTP008 sensor driver",
|
||||
/* id */ I2C_DRIVERID_MTP008,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &mtp008_attach_adapter,
|
||||
/* detach_client */ &mtp008_detach_client,
|
||||
/* command */ &mtp008_command,
|
||||
/* inc_use */ &mtp008_inc_use,
|
||||
/* dec_use */ &mtp008_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "MTP008 sensor driver",
|
||||
.id = I2C_DRIVERID_MTP008,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = mtp008_attach_adapter,
|
||||
.detach_client = mtp008_detach_client,
|
||||
.command = mtp008_command,
|
||||
};
|
||||
|
||||
/* Used by mtp008_init/cleanup */
|
||||
static int __initdata mtp008_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected chip. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -409,7 +380,7 @@ static ctl_table mtp008_dir_table_template[] =
|
||||
* mtp008_driver is inserted (when this module is loaded), for each available
|
||||
* adapter when a new adapter is inserted (and mtp008_driver is still present)
|
||||
*/
|
||||
int mtp008_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int mtp008_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
struct i2c_client_address_data mtp008_addr_data;
|
||||
|
||||
@@ -513,7 +484,7 @@ int mtp008_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int mtp008_detach_client(struct i2c_client *client)
|
||||
static int mtp008_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -531,37 +502,24 @@ int mtp008_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int mtp008_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int mtp008_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mtp008_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void mtp008_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
int mtp008_read_value(struct i2c_client *client, u8 reg)
|
||||
static int mtp008_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return i2c_smbus_read_byte_data(client, reg) & 0xff;
|
||||
}
|
||||
|
||||
int mtp008_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int mtp008_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
/* Called when we have found a new MTP008. It should set limits, etc. */
|
||||
void mtp008_init_client(struct i2c_client *client)
|
||||
static void mtp008_init_client(struct i2c_client *client)
|
||||
{
|
||||
int vid;
|
||||
u8 save1, save2;
|
||||
@@ -651,7 +609,7 @@ void mtp008_init_client(struct i2c_client *client)
|
||||
);
|
||||
}
|
||||
|
||||
void mtp008_update_client(struct i2c_client *client)
|
||||
static void mtp008_update_client(struct i2c_client *client)
|
||||
{
|
||||
int i;
|
||||
u8 inp;
|
||||
@@ -761,7 +719,7 @@ void mtp008_update_client(struct i2c_client *client)
|
||||
up(&data->update_lock);
|
||||
}
|
||||
|
||||
void mtp008_getsensortype(struct mtp008_data *data, u8 inp)
|
||||
static void mtp008_getsensortype(struct mtp008_data *data, u8 inp)
|
||||
{
|
||||
inp &= 0x0f;
|
||||
data->sens[0] = (inp >> 3) + 2; /* 2 or 3 */
|
||||
@@ -1201,56 +1159,23 @@ void mtp008_sens(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_mtp008_init(void)
|
||||
static int __init sm_mtp008_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("mtp008.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
mtp008_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&mtp008_driver))) {
|
||||
printk("mtp008.o: Driver registration failed, "
|
||||
"module not inserted.\n");
|
||||
mtp008_cleanup();
|
||||
return res;
|
||||
}
|
||||
mtp008_initialized++;
|
||||
|
||||
return 0;
|
||||
return i2c_add_driver(&mtp008_driver);
|
||||
}
|
||||
|
||||
int __init mtp008_cleanup(void)
|
||||
static void __exit sm_mtp008_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (mtp008_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&mtp008_driver))) {
|
||||
printk("mtp008.o: Driver deregistration failed, "
|
||||
"module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
mtp008_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&mtp008_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
|
||||
"Philip Edelbrock <phil@netroedge.com>, "
|
||||
"and Kris Van Hees <aedil@alchar.org>");
|
||||
MODULE_DESCRIPTION("MTP008 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_mtp008_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return mtp008_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_mtp008_init);
|
||||
module_exit(sm_mtp008_exit);
|
||||
+19
-95
@@ -46,18 +46,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -86,26 +75,13 @@ struct pcf8574_data {
|
||||
u8 read, write; /* Register values */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_pcf8574_init(void);
|
||||
static int __init pcf8574_cleanup(void);
|
||||
static int pcf8574_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int pcf8574_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int pcf8574_detach_client(struct i2c_client *client);
|
||||
static int pcf8574_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void pcf8574_inc_use(struct i2c_client *client);
|
||||
static void pcf8574_dec_use(struct i2c_client *client);
|
||||
|
||||
static void pcf8574_read(struct i2c_client *client, int operation,
|
||||
int ctl_name, int *nrels_mag, long *results);
|
||||
static void pcf8574_write(struct i2c_client *client, int operation,
|
||||
@@ -115,14 +91,13 @@ static void pcf8574_init_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver pcf8574_driver = {
|
||||
/* name */ "PCF8574 sensor chip driver",
|
||||
/* id */ I2C_DRIVERID_PCF8574,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &pcf8574_attach_adapter,
|
||||
/* detach_client */ &pcf8574_detach_client,
|
||||
/* command */ &pcf8574_command,
|
||||
/* inc_use */ &pcf8574_inc_use,
|
||||
/* dec_use */ &pcf8574_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "PCF8574 sensor chip driver",
|
||||
.id = I2C_DRIVERID_PCF8574,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = pcf8574_attach_adapter,
|
||||
.detach_client = pcf8574_detach_client,
|
||||
.command = pcf8574_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected PCF8574. This is just a template;
|
||||
@@ -138,15 +113,12 @@ static ctl_table pcf8574_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata pcf8574_initialized = 0;
|
||||
|
||||
/* I choose here for semi-static PCF8574 allocation. Complete dynamic
|
||||
allocation could also be used; the code needed for this would probably
|
||||
take more memory than the datastructure takes now. */
|
||||
static int pcf8574_id = 0;
|
||||
|
||||
int pcf8574_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int pcf8574_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, pcf8574_detect);
|
||||
}
|
||||
@@ -255,7 +227,7 @@ int pcf8574_detect(struct i2c_adapter *adapter, int address,
|
||||
}
|
||||
|
||||
|
||||
int pcf8574_detach_client(struct i2c_client *client)
|
||||
static int pcf8574_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -275,29 +247,13 @@ int pcf8574_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int pcf8574_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int pcf8574_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void pcf8574_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void pcf8574_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Called when we have found a new PCF8574. */
|
||||
void pcf8574_init_client(struct i2c_client *client)
|
||||
static void pcf8574_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct pcf8574_data *data = client->data;
|
||||
data->write = PCF8574_INIT;
|
||||
@@ -305,7 +261,7 @@ void pcf8574_init_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
|
||||
void pcf8574_update_client(struct i2c_client *client)
|
||||
static void pcf8574_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct pcf8574_data *data = client->data;
|
||||
|
||||
@@ -357,54 +313,22 @@ void pcf8574_write(struct i2c_client *client, int operation,
|
||||
}
|
||||
|
||||
|
||||
int __init sensors_pcf8574_init(void)
|
||||
static int __init sm_pcf8574_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("pcf8574.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
pcf8574_initialized = 0;
|
||||
if ((res = i2c_add_driver(&pcf8574_driver))) {
|
||||
printk
|
||||
("pcf8574.o: Driver registration failed, module not inserted.\n");
|
||||
pcf8574_cleanup();
|
||||
return res;
|
||||
}
|
||||
pcf8574_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&pcf8574_driver);
|
||||
}
|
||||
|
||||
int __init pcf8574_cleanup(void)
|
||||
static void __exit sm_pcf8574_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (pcf8574_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&pcf8574_driver))) {
|
||||
printk
|
||||
("pcf8574.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
pcf8574_initialized--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&pcf8574_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, Dan Eaton <dan.eaton@rocketlogix.com> and Aurelien Jarno <aurelien@aurel32.net>");
|
||||
MODULE_DESCRIPTION("PCF8574 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_pcf8574_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return pcf8574_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_pcf8574_init);
|
||||
module_exit(sm_pcf8574_exit);
|
||||
+18
-99
@@ -26,14 +26,6 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -78,12 +70,6 @@ SENSORS_INSMOD_1(pcf8591);
|
||||
#define REG_TO_SIGNED(reg) (reg & 0x80)?(reg - 256):(reg)
|
||||
/* Convert signed 8 bit value to signed value */
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
struct pcf8591_data {
|
||||
struct semaphore lock;
|
||||
@@ -99,21 +85,12 @@ struct pcf8591_data {
|
||||
u8 aout;
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_pcf8591_init(void);
|
||||
static int __init pcf8591_cleanup(void);
|
||||
static int pcf8591_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int pcf8591_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int pcf8591_detach_client(struct i2c_client *client);
|
||||
static int pcf8591_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void pcf8591_inc_use(struct i2c_client *client);
|
||||
static void pcf8591_dec_use(struct i2c_client *client);
|
||||
|
||||
static void pcf8591_update_client(struct i2c_client *client);
|
||||
static void pcf8591_init_client(struct i2c_client *client);
|
||||
@@ -130,22 +107,17 @@ static void pcf8591_aout(struct i2c_client *client, int operation,
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver pcf8591_driver = {
|
||||
/* name */ "PCF8591 sensor chip driver",
|
||||
/* id */ I2C_DRIVERID_PCF8591,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &pcf8591_attach_adapter,
|
||||
/* detach_client */ &pcf8591_detach_client,
|
||||
/* command */ &pcf8591_command,
|
||||
/* inc_use */ &pcf8591_inc_use,
|
||||
/* dec_use */ &pcf8591_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "PCF8591 sensor chip driver",
|
||||
.id = I2C_DRIVERID_PCF8591,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = pcf8591_attach_adapter,
|
||||
.detach_client = pcf8591_detach_client,
|
||||
.command = pcf8591_command,
|
||||
};
|
||||
|
||||
/* Used by lm78_init/cleanup */
|
||||
static int __initdata pcf8591_initialized = 0;
|
||||
|
||||
static int pcf8591_id = 0;
|
||||
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected PCF8591. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -175,7 +147,7 @@ static ctl_table pcf8591_dir_table_template[] = {
|
||||
* pcf8591_driver is inserted (when this module is loaded), for each
|
||||
available adapter
|
||||
* when a new adapter is inserted (and pcf8591_driver is still present) */
|
||||
int pcf8591_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int pcf8591_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, pcf8591_detect);
|
||||
}
|
||||
@@ -275,7 +247,7 @@ int pcf8591_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int pcf8591_detach_client(struct i2c_client *client)
|
||||
static int pcf8591_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -299,29 +271,14 @@ int pcf8591_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int pcf8591_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int pcf8591_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void pcf8591_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void pcf8591_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Called when we have found a new PCF8591. */
|
||||
void pcf8591_init_client(struct i2c_client *client)
|
||||
static void pcf8591_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct pcf8591_data *data = client->data;
|
||||
data->control_byte = PCF8591_INIT_CONTROL_BYTE;
|
||||
@@ -330,7 +287,7 @@ void pcf8591_init_client(struct i2c_client *client)
|
||||
i2c_smbus_write_byte_data(client, data->control_byte, data->aout);
|
||||
}
|
||||
|
||||
void pcf8591_update_client(struct i2c_client *client)
|
||||
static void pcf8591_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct pcf8591_data *data = client->data;
|
||||
|
||||
@@ -487,60 +444,22 @@ void pcf8591_aout(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_pcf8591_init(void)
|
||||
static int __init sm_pcf8591_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk(KERN_INFO "pcf8591.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
pcf8591_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&pcf8591_driver))) {
|
||||
printk
|
||||
(KERN_ERR "pcf8591.o: Driver registration failed, module not inserted.\n");
|
||||
pcf8591_cleanup();
|
||||
return res;
|
||||
}
|
||||
pcf8591_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&pcf8591_driver);
|
||||
}
|
||||
|
||||
int __init pcf8591_cleanup(void)
|
||||
static void __exit sm_pcf8591_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (pcf8591_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&pcf8591_driver))) {
|
||||
printk
|
||||
(KERN_ERR "pcf8591.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
pcf8591_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&pcf8591_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Aurelien Jarno <aurelien@aurel32.net>");
|
||||
MODULE_DESCRIPTION("PCF8591 driver");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_pcf8591_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return pcf8591_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
|
||||
|
||||
|
||||
|
||||
module_init(sm_pcf8591_init);
|
||||
module_exit(sm_pcf8591_exit);
|
||||
+22
-94
@@ -60,18 +60,7 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* If force_addr is set to anything different from 0, we forcibly enable
|
||||
the device at the given address. */
|
||||
@@ -174,7 +163,7 @@ static int blacklist[] = {
|
||||
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
|
||||
#define IN_FROM_REG(val) (((val) * 16) / 10)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -234,11 +223,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
#define SIS5595_INIT_TEMP_OVER 600
|
||||
#define SIS5595_INIT_TEMP_HYST 100
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* 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
|
||||
dynamically allocated, at the time when the new sis5595 client is
|
||||
@@ -267,22 +251,12 @@ struct sis5595_data {
|
||||
|
||||
static struct pci_dev *s_bridge; /* pointer to the (only) sis5595 */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_sis5595_init(void);
|
||||
static int __init sis5595_cleanup(void);
|
||||
|
||||
static int sis5595_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int sis5595_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int sis5595_detach_client(struct i2c_client *client);
|
||||
static int sis5595_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void sis5595_inc_use(struct i2c_client *client);
|
||||
static void sis5595_dec_use(struct i2c_client *client);
|
||||
|
||||
static int sis5595_read_value(struct i2c_client *client, u8 register);
|
||||
static int sis5595_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -308,19 +282,15 @@ static int sis5595_id = 0;
|
||||
/* The driver. I choose to use type i2c_driver, as at is identical to both
|
||||
smbus_driver and isa_driver, and clients could be of either kind */
|
||||
static struct i2c_driver sis5595_driver = {
|
||||
/* name */ "SiS 5595",
|
||||
/* id */ I2C_DRIVERID_SIS5595,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &sis5595_attach_adapter,
|
||||
/* detach_client */ &sis5595_detach_client,
|
||||
/* command */ &sis5595_command,
|
||||
/* inc_use */ &sis5595_inc_use,
|
||||
/* dec_use */ &sis5595_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "SiS 5595",
|
||||
.id = I2C_DRIVERID_SIS5595,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = sis5595_attach_adapter,
|
||||
.detach_client = sis5595_detach_client,
|
||||
.command = sis5595_command,
|
||||
};
|
||||
|
||||
/* Used by sis5595_init/cleanup */
|
||||
static int __initdata sis5595_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected SIS5595. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -352,13 +322,13 @@ static ctl_table sis5595_dir_table_template[] = {
|
||||
};
|
||||
|
||||
/* This is called when the module is loaded */
|
||||
int sis5595_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int sis5595_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, sis5595_detect);
|
||||
}
|
||||
|
||||
/* Locate SiS bridge and correct base address for SIS5595 */
|
||||
int sis5595_find_sis(int *address)
|
||||
static int sis5595_find_sis(int *address)
|
||||
{
|
||||
u16 val;
|
||||
int *i;
|
||||
@@ -516,7 +486,7 @@ int sis5595_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int sis5595_detach_client(struct i2c_client *client)
|
||||
static int sis5595_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -536,30 +506,17 @@ int sis5595_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int sis5595_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int sis5595_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sis5595_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sis5595_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* ISA access must be locked explicitly.
|
||||
There are some ugly typecasts here, but the good news is - they should
|
||||
nowhere else be necessary! */
|
||||
int sis5595_read_value(struct i2c_client *client, u8 reg)
|
||||
static int sis5595_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -570,7 +527,7 @@ int sis5595_read_value(struct i2c_client *client, u8 reg)
|
||||
return res;
|
||||
}
|
||||
|
||||
int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
down(&(((struct sis5595_data *) (client->data))->lock));
|
||||
outb_p(reg, client->addr + SIS5595_ADDR_REG_OFFSET);
|
||||
@@ -580,7 +537,7 @@ int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
}
|
||||
|
||||
/* Called when we have found a new SIS5595. It should set limits, etc. */
|
||||
void sis5595_init_client(struct i2c_client *client)
|
||||
static void sis5595_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct sis5595_data *data = client->data;
|
||||
|
||||
@@ -627,7 +584,7 @@ void sis5595_init_client(struct i2c_client *client)
|
||||
|
||||
}
|
||||
|
||||
void sis5595_update_client(struct i2c_client *client)
|
||||
static void sis5595_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct sis5595_data *data = client->data;
|
||||
int i;
|
||||
@@ -831,12 +788,11 @@ void sis5595_fan_div(struct i2c_client *client, int operation,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_sis5595_init(void)
|
||||
static int __init sm_sis5595_init(void)
|
||||
{
|
||||
int res, addr;
|
||||
|
||||
printk("sis5595.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
sis5595_initialized = 0;
|
||||
|
||||
if (sis5595_find_sis(&addr)) {
|
||||
printk("sis5595.o: SIS5595 not detected, module not inserted.\n");
|
||||
@@ -844,46 +800,18 @@ int __init sensors_sis5595_init(void)
|
||||
}
|
||||
normal_isa[0] = addr;
|
||||
|
||||
if ((res = i2c_add_driver(&sis5595_driver))) {
|
||||
printk
|
||||
("sis5595.o: Driver registration failed, module not inserted.\n");
|
||||
sis5595_cleanup();
|
||||
return res;
|
||||
}
|
||||
sis5595_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&sis5595_driver);
|
||||
}
|
||||
|
||||
int __init sis5595_cleanup(void)
|
||||
static void __exit sm_sis5595_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (sis5595_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&sis5595_driver))) {
|
||||
printk
|
||||
("sis5595.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
sis5595_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&sis5595_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>");
|
||||
MODULE_DESCRIPTION("SiS 5595 Sensor device");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_sis5595_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return sis5595_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_sis5595_init);
|
||||
module_exit(sm_sis5595_exit);
|
||||
+24
-93
@@ -33,14 +33,6 @@
|
||||
#include <linux/init.h>
|
||||
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { 0x0b, SENSORS_I2C_END };
|
||||
@@ -99,18 +91,6 @@ struct smartbatt_data {
|
||||
u16 relchg, abschg; /* Register values */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_smartbatt_init(void);
|
||||
static int __init smartbatt_cleanup(void);
|
||||
static int smartbatt_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int smartbatt_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
@@ -118,8 +98,7 @@ static void smartbatt_init_client(struct i2c_client *client);
|
||||
static int smartbatt_detach_client(struct i2c_client *client);
|
||||
static int smartbatt_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void smartbatt_inc_use(struct i2c_client *client);
|
||||
static void smartbatt_dec_use(struct i2c_client *client);
|
||||
|
||||
static u16 swap_bytes(u16 val);
|
||||
static int sb_read(struct i2c_client *client, u8 reg);
|
||||
#if 0
|
||||
@@ -142,14 +121,13 @@ static void smartbatt_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver smartbatt_driver = {
|
||||
/* name */ "Smart Battery chip driver",
|
||||
/* id */ I2C_DRIVERID_SMARTBATT,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &smartbatt_attach_adapter,
|
||||
/* detach_client */ &smartbatt_detach_client,
|
||||
/* command */ &smartbatt_command,
|
||||
/* inc_use */ &smartbatt_inc_use,
|
||||
/* dec_use */ &smartbatt_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "Smart Battery chip driver",
|
||||
.id = I2C_DRIVERID_SMARTBATT,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = smartbatt_attach_adapter,
|
||||
.detach_client = smartbatt_detach_client,
|
||||
.command = smartbatt_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected SMARTBATT. This is just a template;
|
||||
@@ -173,12 +151,9 @@ static ctl_table smartbatt_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata smartbatt_initialized = 0;
|
||||
|
||||
static int smartbatt_id = 0;
|
||||
|
||||
int smartbatt_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int smartbatt_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, smartbatt_detect);
|
||||
}
|
||||
@@ -269,7 +244,7 @@ int smartbatt_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int smartbatt_detach_client(struct i2c_client *client)
|
||||
static int smartbatt_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -295,39 +270,24 @@ int smartbatt_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int smartbatt_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int smartbatt_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void smartbatt_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Nothing here yet */
|
||||
void smartbatt_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
u16 swap_bytes(u16 val)
|
||||
static u16 swap_bytes(u16 val)
|
||||
{
|
||||
return (val >> 8) | (val << 8);
|
||||
}
|
||||
|
||||
int sb_read(struct i2c_client *client, u8 reg)
|
||||
static int sb_read(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return swap_bytes(i2c_smbus_read_word_data(client, reg));
|
||||
}
|
||||
|
||||
#if 0
|
||||
int smartbatt_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int smartbatt_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
return i2c_smbus_write_word_data(client, reg, swap_bytes(value));
|
||||
}
|
||||
@@ -338,7 +298,7 @@ int smartbatt_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
all we could do is print this out at startup if we wanted.
|
||||
*/
|
||||
int
|
||||
battery_info(int fd, struct battery_info *info)
|
||||
static battery_info(int fd, struct battery_info *info)
|
||||
{
|
||||
int n;
|
||||
int val;
|
||||
@@ -377,12 +337,12 @@ battery_info(int fd, struct battery_info *info)
|
||||
}
|
||||
#endif
|
||||
|
||||
void smartbatt_init_client(struct i2c_client *client)
|
||||
static void smartbatt_init_client(struct i2c_client *client)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void smartbatt_update_client(struct i2c_client *client)
|
||||
static void smartbatt_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct smartbatt_data *data = client->data;
|
||||
|
||||
@@ -492,51 +452,22 @@ void smartbatt_charge(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_smartbatt_init(void)
|
||||
static int __init sm_smartbatt_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("smartbatt.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
smartbatt_initialized = 0;
|
||||
if ((res = i2c_add_driver(&smartbatt_driver))) {
|
||||
printk
|
||||
("smartbatt.o: Driver registration failed, module not inserted.\n");
|
||||
smartbatt_cleanup();
|
||||
return res;
|
||||
}
|
||||
smartbatt_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&smartbatt_driver);
|
||||
}
|
||||
|
||||
int __init smartbatt_cleanup(void)
|
||||
static void __exit sm_smartbatt_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (smartbatt_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&smartbatt_driver)))
|
||||
return res;
|
||||
smartbatt_initialized--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&smartbatt_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("M. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("Smart Battery driver");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_smartbatt_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return smartbatt_cleanup();
|
||||
}
|
||||
#endif /* MODULE */
|
||||
module_init(sm_smartbatt_init);
|
||||
module_exit(sm_smartbatt_exit);
|
||||
+19
-86
@@ -36,10 +36,6 @@
|
||||
#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
#define ARP_ADDRESS 0x61
|
||||
static unsigned short normal_i2c[] = { ARP_ADDRESS, SENSORS_I2C_END };
|
||||
@@ -115,18 +111,6 @@ struct arp_data {
|
||||
struct arp_device dev[ARP_MAX_DEVICES];
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_smbusarp_init(void);
|
||||
static int __init smbusarp_cleanup(void);
|
||||
|
||||
static int smbusarp_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int smbusarp_detect(struct i2c_adapter *adapter, int address,
|
||||
@@ -135,21 +119,18 @@ static int smbusarp_detach_client(struct i2c_client *client);
|
||||
static int smbusarp_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
|
||||
static void smbusarp_inc_use(struct i2c_client *client);
|
||||
static void smbusarp_dec_use(struct i2c_client *client);
|
||||
static int smbusarp_init_client(struct i2c_client *client);
|
||||
static void smbusarp_contents(struct i2c_client *client, int operation,
|
||||
int ctl_name, int *nrels_mag, long *results);
|
||||
|
||||
static struct i2c_driver smbusarp_driver = {
|
||||
/* name */ "SMBUS ARP",
|
||||
/* id */ I2C_DRIVERID_ARP,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &smbusarp_attach_adapter,
|
||||
/* detach_client */ &smbusarp_detach_client,
|
||||
/* command */ &smbusarp_command,
|
||||
/* inc_use */ &smbusarp_inc_use,
|
||||
/* dec_use */ &smbusarp_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "SMBUS ARP",
|
||||
.id = I2C_DRIVERID_ARP,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = smbusarp_attach_adapter,
|
||||
.detach_client = smbusarp_detach_client,
|
||||
.command = smbusarp_command,
|
||||
};
|
||||
|
||||
static ctl_table smbusarp_dir_table_template[] = {
|
||||
@@ -172,12 +153,9 @@ static ctl_table smbusarp_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata smbusarp_initialized = 0;
|
||||
|
||||
static int smbusarp_id = 0;
|
||||
|
||||
int smbusarp_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int smbusarp_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, smbusarp_detect);
|
||||
}
|
||||
@@ -241,7 +219,7 @@ int smbusarp_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int smbusarp_detach_client(struct i2c_client *client)
|
||||
static int smbusarp_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -260,27 +238,13 @@ int smbusarp_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
|
||||
int smbusarp_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int smbusarp_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void smbusarp_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void smbusarp_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
u8 choose_addr(u8 * pool)
|
||||
static u8 choose_addr(u8 * pool)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -291,7 +255,7 @@ u8 choose_addr(u8 * pool)
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
int smbusarp_init_client(struct i2c_client *client)
|
||||
static int smbusarp_init_client(struct i2c_client *client)
|
||||
{
|
||||
int ret = -1;
|
||||
#ifdef I2C_PEC_SUPPORTED
|
||||
@@ -483,7 +447,7 @@ void smbusarp_contents(struct i2c_client *client, int operation,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_smbusarp_init(void)
|
||||
static int __init sm_smbusarp_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -491,50 +455,19 @@ int __init sensors_smbusarp_init(void)
|
||||
/* magic force invocation */
|
||||
force_arp[0] = -1;
|
||||
force_arp[1] = ARP_ADDRESS;
|
||||
smbusarp_initialized = 0;
|
||||
if ((res = i2c_add_driver(&smbusarp_driver))) {
|
||||
printk
|
||||
(KERN_ERR "smbus-arp.o: Driver registration failed, module not inserted.\n");
|
||||
smbusarp_cleanup();
|
||||
return res;
|
||||
}
|
||||
smbusarp_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&smbusarp_driver);
|
||||
}
|
||||
|
||||
int __init smbusarp_cleanup(void)
|
||||
static void __exit sm_smbusarp_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (smbusarp_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&smbusarp_driver))) {
|
||||
printk
|
||||
(KERN_ERR "smbus-arp.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
} else
|
||||
smbusarp_initialized--;
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&smbusarp_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("SMBUS ARP Driver");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_smbusarp_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return smbusarp_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_smbusarp_init);
|
||||
module_exit(sm_smbusarp_exit);
|
||||
+22
-92
@@ -33,14 +33,6 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
static int force_addr = 0;
|
||||
MODULE_PARM(force_addr, "i");
|
||||
@@ -109,7 +101,7 @@ superio_exit(void)
|
||||
#define SMSC47M1_REG_FAN(nr) (0x58 + (nr))
|
||||
#define SMSC47M1_REG_FAN_MIN(nr) (0x5a + (nr))
|
||||
|
||||
extern inline u8 MIN_TO_REG(long rpm, int div)
|
||||
static inline u8 MIN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 0;
|
||||
@@ -130,11 +122,6 @@ extern inline u8 MIN_TO_REG(long rpm, int div)
|
||||
#define SMSC47M1_INIT_FAN_MIN_1 3000
|
||||
#define SMSC47M1_INIT_FAN_MIN_2 3000
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
struct smsc47m1_data {
|
||||
struct semaphore lock;
|
||||
int sysctl_id;
|
||||
@@ -150,13 +137,6 @@ struct smsc47m1_data {
|
||||
u8 pwm[2]; /* Register value (bit 7 is enable) */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_smsc47m1_init(void);
|
||||
static int __init smsc47m1_cleanup(void);
|
||||
|
||||
static int smsc47m1_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int smsc47m1_detect(struct i2c_adapter *adapter, int address,
|
||||
@@ -164,8 +144,6 @@ static int smsc47m1_detect(struct i2c_adapter *adapter, int address,
|
||||
static int smsc47m1_detach_client(struct i2c_client *client);
|
||||
static int smsc47m1_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void smsc47m1_inc_use(struct i2c_client *client);
|
||||
static void smsc47m1_dec_use(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,
|
||||
@@ -187,18 +165,15 @@ static void smsc47m1_pwm(struct i2c_client *client, int operation,
|
||||
static int smsc47m1_id = 0;
|
||||
|
||||
static struct i2c_driver smsc47m1_driver = {
|
||||
/* name */ "SMSC47M1xx fan driver",
|
||||
/* id */ I2C_DRIVERID_SMSC47M1,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &smsc47m1_attach_adapter,
|
||||
/* detach_client */ &smsc47m1_detach_client,
|
||||
/* command */ &smsc47m1_command,
|
||||
/* inc_use */ &smsc47m1_inc_use,
|
||||
/* dec_use */ &smsc47m1_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "SMSC47M1xx fan driver",
|
||||
.id = I2C_DRIVERID_SMSC47M1,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = smsc47m1_attach_adapter,
|
||||
.detach_client = smsc47m1_detach_client,
|
||||
.command = smsc47m1_command,
|
||||
};
|
||||
|
||||
static int __initdata smsc47m1_initialized = 0;
|
||||
|
||||
static ctl_table smsc47m1_dir_table_template[] = {
|
||||
{SMSC47M1_SYSCTL_FAN1, "fan1", NULL, 0, 0644, NULL, &i2c_proc_real,
|
||||
&i2c_sysctl_real, NULL, &smsc47m1_fan},
|
||||
@@ -215,12 +190,12 @@ static ctl_table smsc47m1_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
int smsc47m1_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int smsc47m1_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, smsc47m1_detect);
|
||||
}
|
||||
|
||||
int smsc47m1_find(int *address)
|
||||
static int smsc47m1_find(int *address)
|
||||
{
|
||||
u16 val;
|
||||
|
||||
@@ -320,7 +295,7 @@ int smsc47m1_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int smsc47m1_detach_client(struct i2c_client *client)
|
||||
static int smsc47m1_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -339,26 +314,12 @@ int smsc47m1_detach_client(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int smsc47m1_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int smsc47m1_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void smsc47m1_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void smsc47m1_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
int smsc47m1_read_value(struct i2c_client *client, u8 reg)
|
||||
static int smsc47m1_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -366,13 +327,13 @@ int smsc47m1_read_value(struct i2c_client *client, u8 reg)
|
||||
return res;
|
||||
}
|
||||
|
||||
int smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
static int smsc47m1_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
{
|
||||
outb_p(value, client->addr + reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void smsc47m1_init_client(struct i2c_client *client)
|
||||
static void smsc47m1_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* configure pins for tach function */
|
||||
smsc47m1_write_value(client, SMSC47M1_REG_TPIN1, 0x05);
|
||||
@@ -383,7 +344,7 @@ void smsc47m1_init_client(struct i2c_client *client)
|
||||
MIN_TO_REG(SMSC47M1_INIT_FAN_MIN_2, 2));
|
||||
}
|
||||
|
||||
void smsc47m1_update_client(struct i2c_client *client)
|
||||
static void smsc47m1_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct smsc47m1_data *data = client->data;
|
||||
int i;
|
||||
@@ -516,12 +477,11 @@ void smsc47m1_pwm(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_smsc47m1_init(void)
|
||||
static int __init sm_smsc47m1_init(void)
|
||||
{
|
||||
int res, addr;
|
||||
|
||||
printk("smsc47m1.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
smsc47m1_initialized = 0;
|
||||
|
||||
if (smsc47m1_find(&addr)) {
|
||||
printk("smsc47m1.o: SMSC47M1xx not detected, module not inserted.\n");
|
||||
@@ -529,49 +489,19 @@ int __init sensors_smsc47m1_init(void)
|
||||
}
|
||||
normal_isa[0] = addr;
|
||||
|
||||
if ((res = i2c_add_driver(&smsc47m1_driver))) {
|
||||
printk
|
||||
("smsc47m1.o: Driver registration failed, module not inserted.\n");
|
||||
smsc47m1_cleanup();
|
||||
return res;
|
||||
}
|
||||
smsc47m1_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&smsc47m1_driver);
|
||||
}
|
||||
|
||||
int __init smsc47m1_cleanup(void)
|
||||
static void __exit sm_smsc47m1_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (smsc47m1_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&smsc47m1_driver))) {
|
||||
printk
|
||||
("smsc47m1.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
smsc47m1_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&smsc47m1_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("SMSC47M110x Fan sensors");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_smsc47m1_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return smsc47m1_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_smsc47m1_init);
|
||||
module_exit(sm_smsc47m1_exit);
|
||||
+22
-91
@@ -29,18 +29,7 @@
|
||||
#include "version.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* Addresses to scan */
|
||||
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
|
||||
@@ -100,18 +89,6 @@ struct thmc50_data {
|
||||
inter, inter_mask, die_code, analog_out; /* Register values */
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_thmc50_init(void);
|
||||
static int __init thmc50_cleanup(void);
|
||||
static int thmc50_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int thmc50_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
@@ -119,8 +96,7 @@ static void thmc50_init_client(struct i2c_client *client);
|
||||
static int thmc50_detach_client(struct i2c_client *client);
|
||||
static int thmc50_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void thmc50_inc_use(struct i2c_client *client);
|
||||
static void thmc50_dec_use(struct i2c_client *client);
|
||||
|
||||
static int thmc50_read_value(struct i2c_client *client, u8 reg);
|
||||
static int thmc50_write_value(struct i2c_client *client, u8 reg,
|
||||
u16 value);
|
||||
@@ -142,14 +118,13 @@ static void thmc50_update_client(struct i2c_client *client);
|
||||
|
||||
/* This is the driver that will be inserted */
|
||||
static struct i2c_driver thmc50_driver = {
|
||||
/* name */ "THMC50 sensor chip driver",
|
||||
/* id */ I2C_DRIVERID_THMC50,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &thmc50_attach_adapter,
|
||||
/* detach_client */ &thmc50_detach_client,
|
||||
/* command */ &thmc50_command,
|
||||
/* inc_use */ &thmc50_inc_use,
|
||||
/* dec_use */ &thmc50_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "THMC50 sensor chip driver",
|
||||
.id = I2C_DRIVERID_THMC50,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = thmc50_attach_adapter,
|
||||
.detach_client = thmc50_detach_client,
|
||||
.command = thmc50_command,
|
||||
};
|
||||
|
||||
/* These files are created for each detected THMC50. This is just a template;
|
||||
@@ -173,12 +148,10 @@ static ctl_table thmc50_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata thmc50_initialized = 0;
|
||||
|
||||
static int thmc50_id = 0;
|
||||
|
||||
int thmc50_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int thmc50_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, thmc50_detect);
|
||||
}
|
||||
@@ -292,7 +265,7 @@ int thmc50_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int thmc50_detach_client(struct i2c_client *client)
|
||||
static int thmc50_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -312,29 +285,16 @@ int thmc50_detach_client(struct i2c_client *client)
|
||||
|
||||
|
||||
/* No commands defined yet */
|
||||
int thmc50_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int thmc50_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void thmc50_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void thmc50_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
THMC50 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int thmc50_read_value(struct i2c_client *client, u8 reg)
|
||||
static int thmc50_read_value(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
return i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
@@ -342,12 +302,12 @@ int thmc50_read_value(struct i2c_client *client, u8 reg)
|
||||
/* All registers are word-sized, except for the configuration register.
|
||||
THMC50 uses a high-byte first convention, which is exactly opposite to
|
||||
the usual practice. */
|
||||
int thmc50_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
static int thmc50_write_value(struct i2c_client *client, u8 reg, u16 value)
|
||||
{
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
void thmc50_init_client(struct i2c_client *client)
|
||||
static void thmc50_init_client(struct i2c_client *client)
|
||||
{
|
||||
/* Initialize the THMC50 chip */
|
||||
thmc50_write_value(client, THMC50_REG_TEMP_OS,
|
||||
@@ -357,7 +317,7 @@ void thmc50_init_client(struct i2c_client *client)
|
||||
thmc50_write_value(client, THMC50_REG_CONF, 1);
|
||||
}
|
||||
|
||||
void thmc50_update_client(struct i2c_client *client)
|
||||
static void thmc50_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct thmc50_data *data = client->data;
|
||||
|
||||
@@ -526,54 +486,25 @@ void thmc50_analog_out(struct i2c_client *client, int operation,
|
||||
|
||||
|
||||
|
||||
int __init sensors_thmc50_init(void)
|
||||
static int __init sm_thmc50_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk("thmc50.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
thmc50_initialized = 0;
|
||||
if ((res = i2c_add_driver(&thmc50_driver))) {
|
||||
printk
|
||||
("thmc50.o: Driver registration failed, module not inserted.\n");
|
||||
thmc50_cleanup();
|
||||
return res;
|
||||
}
|
||||
thmc50_initialized++;
|
||||
return 0;
|
||||
|
||||
return i2c_add_driver(&thmc50_driver);
|
||||
}
|
||||
|
||||
int __init thmc50_cleanup(void)
|
||||
static void __exit sm_thmc50_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (thmc50_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&thmc50_driver))) {
|
||||
printk
|
||||
("thmc50.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
thmc50_initialized--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
i2c_del_driver(&thmc50_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>");
|
||||
MODULE_DESCRIPTION("THMC50 driver");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_thmc50_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return thmc50_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_thmc50_init);
|
||||
module_exit(sm_thmc50_exit);
|
||||
+24
-90
@@ -46,22 +46,12 @@
|
||||
#include "sensors.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
#ifndef PCI_DEVICE_ID_VIA_82C686_4
|
||||
#define PCI_DEVICE_ID_VIA_82C686_4 0x3057
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* If force_addr is set to anything different from 0, we forcibly enable
|
||||
the device at the given address. */
|
||||
@@ -149,7 +139,7 @@ static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e };
|
||||
//
|
||||
// These get us close, but they don't completely agree with what my BIOS
|
||||
// says- they are all a bit low. But, it all we have to go on...
|
||||
extern inline u8 IN_TO_REG(long val, int inNum)
|
||||
static inline u8 IN_TO_REG(long val, int inNum)
|
||||
{
|
||||
// to avoid floating point, we multiply everything by 100.
|
||||
// val is guaranteed to be positive, so we can achieve the effect of
|
||||
@@ -174,7 +164,7 @@ extern inline u8 IN_TO_REG(long val, int inNum)
|
||||
/ 1000, 0, 255);
|
||||
}
|
||||
|
||||
extern inline long IN_FROM_REG(u8 val, int inNum)
|
||||
static inline long IN_FROM_REG(u8 val, int inNum)
|
||||
{
|
||||
// to avoid floating point, we multiply everything by 100.
|
||||
// val is guaranteed to be positive, so we can achieve the effect of
|
||||
@@ -194,7 +184,7 @@ extern inline long IN_FROM_REG(u8 val, int inNum)
|
||||
// Higher register values = slower fans (the fan's strobe gates a counter).
|
||||
// But this chip saturates back at 0, not at 255 like all the other chips.
|
||||
// So, 0 means 0 RPM
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 0;
|
||||
@@ -302,7 +292,7 @@ static const u8 viaLUT[] =
|
||||
// No interpolation here. Just check the limits and go.
|
||||
// The +5 effectively rounds off properly and the +50 is because
|
||||
// the temps start at -50
|
||||
extern inline u8 TEMP_TO_REG(long val)
|
||||
static inline u8 TEMP_TO_REG(long val)
|
||||
{
|
||||
return (u8)
|
||||
SENSORS_LIMIT(viaLUT[((val <= -500) ? 0 : (val >= 1100) ? 160 :
|
||||
@@ -317,7 +307,7 @@ extern inline u8 TEMP_TO_REG(long val)
|
||||
/* for 10-bit temperature readings */
|
||||
// You might _think_ this is too long to inline, but's it's really only
|
||||
// called once...
|
||||
extern inline long TEMP_FROM_REG10(u16 val)
|
||||
static inline long TEMP_FROM_REG10(u16 val)
|
||||
{
|
||||
// the temp values are already *10, so we don't need to do that.
|
||||
long temp;
|
||||
@@ -386,11 +376,6 @@ extern inline long TEMP_FROM_REG10(u16 val)
|
||||
#define VIA686A_INIT_TEMP_OVER 600
|
||||
#define VIA686A_INIT_TEMP_HYST 500
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* For the VIA686A, we need to keep some data in memory. That
|
||||
data is pointed to by via686a_list[NR]->data. The structure itself is
|
||||
dynamically allocated, at the same time when a new via686a client is
|
||||
@@ -417,22 +402,12 @@ struct via686a_data {
|
||||
|
||||
static struct pci_dev *s_bridge; /* pointer to the (only) via686a */
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_via686a_init(void);
|
||||
static int __init via686a_cleanup(void);
|
||||
|
||||
static int via686a_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int via686a_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int via686a_detach_client(struct i2c_client *client);
|
||||
static int via686a_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void via686a_inc_use(struct i2c_client *client);
|
||||
static void via686a_dec_use(struct i2c_client *client);
|
||||
|
||||
static int via686a_read_value(struct i2c_client *client, u8 register);
|
||||
static void via686a_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -458,19 +433,15 @@ static int via686a_id = 0;
|
||||
/* The driver. I choose to use type i2c_driver, as at is identical to both
|
||||
smbus_driver and isa_driver, and clients could be of either kind */
|
||||
static struct i2c_driver via686a_driver = {
|
||||
/* name */ "VIA 686A",
|
||||
/* id */ I2C_DRIVERID_VIA686A,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &via686a_attach_adapter,
|
||||
/* detach_client */ &via686a_detach_client,
|
||||
/* command */ &via686a_command,
|
||||
/* inc_use */ &via686a_inc_use,
|
||||
/* dec_use */ &via686a_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "VIA 686A",
|
||||
.id = I2C_DRIVERID_VIA686A,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = via686a_attach_adapter,
|
||||
.detach_client = via686a_detach_client,
|
||||
.command = via686a_command,
|
||||
};
|
||||
|
||||
/* Used by via686a_init/cleanup */
|
||||
static int __initdata via686a_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected VIA686A. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -517,13 +488,13 @@ static inline void via686a_write_value(struct i2c_client *client, u8 reg,
|
||||
}
|
||||
|
||||
/* This is called when the module is loaded */
|
||||
int via686a_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int via686a_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, via686a_detect);
|
||||
}
|
||||
|
||||
/* Locate chip and get correct base address */
|
||||
int via686a_find(int *address)
|
||||
static int via686a_find(int *address)
|
||||
{
|
||||
u16 val;
|
||||
|
||||
@@ -644,7 +615,7 @@ int via686a_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int via686a_detach_client(struct i2c_client *client)
|
||||
static int via686a_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -664,23 +635,14 @@ int via686a_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int via686a_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int via686a_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void via686a_inc_use(struct i2c_client *client)
|
||||
{
|
||||
MOD_INC_USE_COUNT;
|
||||
}
|
||||
|
||||
void via686a_dec_use(struct i2c_client *client)
|
||||
{
|
||||
MOD_DEC_USE_COUNT;
|
||||
}
|
||||
|
||||
/* Called when we have found a new VIA686A. Set limits, etc. */
|
||||
void via686a_init_client(struct i2c_client *client)
|
||||
static void via686a_init_client(struct i2c_client *client)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -734,7 +696,7 @@ void via686a_init_client(struct i2c_client *client)
|
||||
!(VIA686A_TEMP_MODE_MASK | VIA686A_TEMP_MODE_CONTINUOUS));
|
||||
}
|
||||
|
||||
void via686a_update_client(struct i2c_client *client)
|
||||
static void via686a_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct via686a_data *data = client->data;
|
||||
int i;
|
||||
@@ -939,12 +901,11 @@ void via686a_fan_div(struct i2c_client *client, int operation,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_via686a_init(void)
|
||||
static int __init sm_via686a_init(void)
|
||||
{
|
||||
int res, addr;
|
||||
|
||||
printk("via686a.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
via686a_initialized = 0;
|
||||
|
||||
if (via686a_find(&addr)) {
|
||||
printk("via686a.o: No Via 686A sensors found.\n");
|
||||
@@ -952,46 +913,19 @@ int __init sensors_via686a_init(void)
|
||||
}
|
||||
normal_isa[0] = addr;
|
||||
|
||||
if ((res = i2c_add_driver(&via686a_driver))) {
|
||||
printk("via686a.o: Driver registration failed.\n");
|
||||
via686a_cleanup();
|
||||
return res;
|
||||
}
|
||||
via686a_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&via686a_driver);
|
||||
}
|
||||
|
||||
int __init via686a_cleanup(void)
|
||||
static void __exit sm_via686a_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (via686a_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&via686a_driver))) {
|
||||
printk
|
||||
("via686a.o: Driver deregistration failed.\n");
|
||||
return res;
|
||||
}
|
||||
via686a_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&via686a_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR
|
||||
("Kyösti Mälkki <kmalkki@cc.hut.fi>, Mark Studebaker <mdsxyz123@yahoo.com>, Bob Dougherty <bobd@stanford.edu>");
|
||||
MODULE_DESCRIPTION("VIA 686A Sensor device");
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_via686a_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return via686a_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_via686a_init);
|
||||
module_exit(sm_via686a_exit);
|
||||
+20
-90
@@ -36,14 +36,6 @@
|
||||
#include "sensors_vid.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
static int force_addr = 0;
|
||||
MODULE_PARM(force_addr, "i");
|
||||
@@ -177,7 +169,7 @@ static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e, 0x2c, 0x2e, 0x30, 0x32 };
|
||||
/********* FAN RPM CONVERSIONS ********/
|
||||
/* But this chip saturates back at 0, not at 255 like all the other chips.
|
||||
So, 0 means 0 RPM */
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 0;
|
||||
@@ -188,11 +180,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
#define MIN_TO_REG(a,b) FAN_TO_REG(a,b)
|
||||
#define FAN_FROM_REG(val,div) ((val)==0?0:(val)==255?0:1310720/((val)*(div)))
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
struct vt1211_data {
|
||||
struct semaphore lock;
|
||||
int sysctl_id;
|
||||
@@ -218,22 +205,12 @@ struct vt1211_data {
|
||||
u8 uch_config;
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_vt1211_init(void);
|
||||
static int __init vt1211_cleanup(void);
|
||||
|
||||
static int vt1211_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int vt1211_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int vt1211_detach_client(struct i2c_client *client);
|
||||
static int vt1211_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void vt1211_inc_use(struct i2c_client *client);
|
||||
static void vt1211_dec_use(struct i2c_client *client);
|
||||
|
||||
static inline int vt_rdval(struct i2c_client *client, u8 register);
|
||||
static inline void vt1211_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -265,18 +242,15 @@ static void vt1211_temp(struct i2c_client *client, int operation,
|
||||
static int vt1211_id = 0;
|
||||
|
||||
static struct i2c_driver vt1211_driver = {
|
||||
/* name */ "VT1211 sensors driver",
|
||||
/* id */ I2C_DRIVERID_VT1211,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &vt1211_attach_adapter,
|
||||
/* detach_client */ &vt1211_detach_client,
|
||||
/* command */ &vt1211_command,
|
||||
/* inc_use */ &vt1211_inc_use,
|
||||
/* dec_use */ &vt1211_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "VT1211 sensors driver",
|
||||
.id = I2C_DRIVERID_VT1211,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = vt1211_attach_adapter,
|
||||
.detach_client = vt1211_detach_client,
|
||||
.command = vt1211_command,
|
||||
};
|
||||
|
||||
static int __initdata vt1211_initialized = 0;
|
||||
|
||||
static ctl_table vt1211_dir_table_template[] = {
|
||||
{VT1211_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real,
|
||||
&i2c_sysctl_real, NULL, &vt1211_in},
|
||||
@@ -327,12 +301,12 @@ static ctl_table vt1211_dir_table_template[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
int vt1211_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int vt1211_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, vt1211_detect);
|
||||
}
|
||||
|
||||
int vt1211_find(int *address)
|
||||
static int vt1211_find(int *address)
|
||||
{
|
||||
u16 val;
|
||||
|
||||
@@ -439,7 +413,7 @@ int vt1211_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int vt1211_detach_client(struct i2c_client *client)
|
||||
static int vt1211_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -458,24 +432,11 @@ int vt1211_detach_client(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vt1211_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int vt1211_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vt1211_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void vt1211_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int vt_rdval(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
@@ -487,7 +448,7 @@ static inline void vt1211_write_value(struct i2c_client *client, u8 reg, u8 valu
|
||||
outb_p(value, client->addr + reg);
|
||||
}
|
||||
|
||||
void vt1211_init_client(struct i2c_client *client)
|
||||
static void vt1211_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct vt1211_data *data = client->data;
|
||||
|
||||
@@ -497,7 +458,7 @@ void vt1211_init_client(struct i2c_client *client)
|
||||
vt1211_write_value(client, VT1211_REG_TEMP2_CONFIG, 0);
|
||||
}
|
||||
|
||||
void vt1211_update_client(struct i2c_client *client)
|
||||
static void vt1211_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct vt1211_data *data = client->data;
|
||||
int i, j;
|
||||
@@ -799,12 +760,11 @@ void vt1211_uch(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_vt1211_init(void)
|
||||
static int __init sm_vt1211_init(void)
|
||||
{
|
||||
int res, addr;
|
||||
|
||||
printk("vt1211.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
vt1211_initialized = 0;
|
||||
|
||||
if (vt1211_find(&addr)) {
|
||||
printk("vt1211.o: VT1211 not detected, module not inserted.\n");
|
||||
@@ -812,49 +772,19 @@ int __init sensors_vt1211_init(void)
|
||||
}
|
||||
normal_isa[0] = addr;
|
||||
|
||||
if ((res = i2c_add_driver(&vt1211_driver))) {
|
||||
printk
|
||||
("vt1211.o: Driver registration failed, module not inserted.\n");
|
||||
vt1211_cleanup();
|
||||
return res;
|
||||
}
|
||||
vt1211_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&vt1211_driver);
|
||||
}
|
||||
|
||||
int __init vt1211_cleanup(void)
|
||||
static void __exit sm_vt1211_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (vt1211_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&vt1211_driver))) {
|
||||
printk
|
||||
("vt1211.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
vt1211_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&vt1211_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("VT1211 sensors");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_vt1211_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return vt1211_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_vt1211_init);
|
||||
module_exit(sm_vt1211_exit);
|
||||
+20
-91
@@ -37,14 +37,6 @@
|
||||
#include "sensors_vid.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
static int force_addr = 0;
|
||||
MODULE_PARM(force_addr, "i");
|
||||
@@ -135,7 +127,7 @@ static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e, 0x2c, 0x2e, 0x30, 0x32 };
|
||||
/********* FAN RPM CONVERSIONS ********/
|
||||
/* But this chip saturates back at 0, not at 255 like all the other chips.
|
||||
So, 0 means 0 RPM */
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 0;
|
||||
@@ -146,11 +138,6 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
#define MIN_TO_REG(a,b) FAN_TO_REG(a,b)
|
||||
#define FAN_FROM_REG(val,div) ((val)==0?0:(val)==255?0:1310720/((val)*(div)))
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
struct vt8231_data {
|
||||
struct semaphore lock;
|
||||
int sysctl_id;
|
||||
@@ -176,22 +163,12 @@ struct vt8231_data {
|
||||
u8 uch_config;
|
||||
};
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_vt8231_init(void);
|
||||
static int __init vt8231_cleanup(void);
|
||||
|
||||
static int vt8231_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int vt8231_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int vt8231_detach_client(struct i2c_client *client);
|
||||
static int vt8231_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void vt8231_inc_use(struct i2c_client *client);
|
||||
static void vt8231_dec_use(struct i2c_client *client);
|
||||
|
||||
static inline int vt_rdval(struct i2c_client *client, u8 register);
|
||||
static inline void vt8231_write_value(struct i2c_client *client, u8 register,
|
||||
@@ -223,18 +200,15 @@ static void vt8231_temp(struct i2c_client *client, int operation,
|
||||
static int vt8231_id = 0;
|
||||
|
||||
static struct i2c_driver vt8231_driver = {
|
||||
/* name */ "VT8231 sensors driver",
|
||||
/* id */ I2C_DRIVERID_VT8231,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &vt8231_attach_adapter,
|
||||
/* detach_client */ &vt8231_detach_client,
|
||||
/* command */ &vt8231_command,
|
||||
/* inc_use */ &vt8231_inc_use,
|
||||
/* dec_use */ &vt8231_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "VT8231 sensors driver",
|
||||
.id = I2C_DRIVERID_VT8231,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = vt8231_attach_adapter,
|
||||
.detach_client = vt8231_detach_client,
|
||||
.command = vt8231_command,
|
||||
};
|
||||
|
||||
static int __initdata vt8231_initialized = 0;
|
||||
|
||||
static ctl_table vt8231_dir_table_template[] = {
|
||||
{VT8231_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real,
|
||||
&i2c_sysctl_real, NULL, &vt8231_in},
|
||||
@@ -287,13 +261,13 @@ static ctl_table vt8231_dir_table_template[] = {
|
||||
|
||||
static struct pci_dev *s_bridge;
|
||||
|
||||
int vt8231_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int vt8231_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, vt8231_detect);
|
||||
}
|
||||
|
||||
/* Locate chip and get correct base address */
|
||||
int vt8231_find(int *address)
|
||||
static int vt8231_find(int *address)
|
||||
{
|
||||
u16 val;
|
||||
|
||||
@@ -409,7 +383,7 @@ int vt8231_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int vt8231_detach_client(struct i2c_client *client)
|
||||
static int vt8231_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -428,24 +402,11 @@ int vt8231_detach_client(struct i2c_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vt8231_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int vt8231_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vt8231_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void vt8231_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int vt_rdval(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
@@ -457,7 +418,7 @@ static inline void vt8231_write_value(struct i2c_client *client, u8 reg, u8 valu
|
||||
outb_p(value, client->addr + reg);
|
||||
}
|
||||
|
||||
void vt8231_init_client(struct i2c_client *client)
|
||||
static void vt8231_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct vt8231_data *data = client->data;
|
||||
|
||||
@@ -467,7 +428,7 @@ void vt8231_init_client(struct i2c_client *client)
|
||||
vt8231_write_value(client, VT8231_REG_TEMP2_CONFIG, 0);
|
||||
}
|
||||
|
||||
void vt8231_update_client(struct i2c_client *client)
|
||||
static void vt8231_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct vt8231_data *data = client->data;
|
||||
int i, j;
|
||||
@@ -769,12 +730,11 @@ void vt8231_uch(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_vt8231_init(void)
|
||||
static int __init sm_vt8231_init(void)
|
||||
{
|
||||
int res, addr;
|
||||
|
||||
printk("vt8231.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
vt8231_initialized = 0;
|
||||
|
||||
if (vt8231_find(&addr)) {
|
||||
printk("vt8231.o: VT8231 not detected, module not inserted.\n");
|
||||
@@ -782,49 +742,18 @@ int __init sensors_vt8231_init(void)
|
||||
}
|
||||
normal_isa[0] = addr;
|
||||
|
||||
if ((res = i2c_add_driver(&vt8231_driver))) {
|
||||
printk
|
||||
("vt8231.o: Driver registration failed, module not inserted.\n");
|
||||
vt8231_cleanup();
|
||||
return res;
|
||||
}
|
||||
vt8231_initialized++;
|
||||
return 0;
|
||||
}
|
||||
return i2c_add_driver(&vt8231_driver);}
|
||||
|
||||
int __init vt8231_cleanup(void)
|
||||
static void __exit sm_vt8231_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (vt8231_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&vt8231_driver))) {
|
||||
printk
|
||||
("vt8231.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
vt8231_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&vt8231_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("VT8231 sensors");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_vt8231_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return vt8231_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_vt8231_init);
|
||||
module_exit(sm_vt8231_exit);
|
||||
+23
-93
@@ -46,18 +46,11 @@
|
||||
#include "sensors_vid.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef I2C_DRIVERID_W83627HF
|
||||
#define I2C_DRIVERID_W83627HF 1038
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
static int force_addr;
|
||||
MODULE_PARM(force_addr, "i");
|
||||
@@ -219,7 +212,7 @@ static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 };
|
||||
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
|
||||
#define IN_FROM_REG(val) (((val) * 16) / 10)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -246,7 +239,7 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
|
||||
#define DIV_FROM_REG(val) (1 << (val))
|
||||
|
||||
extern inline u8 DIV_TO_REG(long val)
|
||||
static inline u8 DIV_TO_REG(long val)
|
||||
{
|
||||
int i;
|
||||
val = SENSORS_LIMIT(val, 1, 128) >> 1;
|
||||
@@ -356,11 +349,6 @@ extern inline u8 DIV_TO_REG(long val)
|
||||
#define W83781D_INIT_TEMP3_OVER 600
|
||||
#define W83781D_INIT_TEMP3_HYST 500
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* There are some complications in a module like this. First off, W83781D chips
|
||||
may be both present on the SMBus and the ISA bus, and we have to handle
|
||||
those cases separately at some places. Second, there might be several
|
||||
@@ -419,22 +407,12 @@ struct w83627hf_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_w83627hf_init(void);
|
||||
static int __init w83627hf_cleanup(void);
|
||||
|
||||
static int w83627hf_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int w83627hf_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int w83627hf_detach_client(struct i2c_client *client);
|
||||
static int w83627hf_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void w83627hf_inc_use(struct i2c_client *client);
|
||||
static void w83627hf_dec_use(struct i2c_client *client);
|
||||
|
||||
static int w83627hf_read_value(struct i2c_client *client, u16 register);
|
||||
static int w83627hf_write_value(struct i2c_client *client, u16 register,
|
||||
@@ -469,19 +447,15 @@ static void w83627hf_sens(struct i2c_client *client, int operation,
|
||||
static int w83627hf_id = 0;
|
||||
|
||||
static struct i2c_driver w83627hf_driver = {
|
||||
/* name */ "W83781D sensor driver",
|
||||
/* id */ I2C_DRIVERID_W83627HF,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &w83627hf_attach_adapter,
|
||||
/* detach_client */ &w83627hf_detach_client,
|
||||
/* command */ &w83627hf_command,
|
||||
/* inc_use */ &w83627hf_inc_use,
|
||||
/* dec_use */ &w83627hf_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "W83781D sensor driver",
|
||||
.id = I2C_DRIVERID_W83627HF,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = w83627hf_attach_adapter,
|
||||
.detach_client = w83627hf_detach_client,
|
||||
.command = w83627hf_command,
|
||||
};
|
||||
|
||||
/* Used by w83627hf_init/cleanup */
|
||||
static int __initdata w83627hf_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected chip. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -594,12 +568,12 @@ static ctl_table w83697hf_dir_table_template[] = {
|
||||
* w83627hf_driver is inserted (when this module is loaded), for each
|
||||
available adapter
|
||||
* when a new adapter is inserted (and w83627hf_driver is still present) */
|
||||
int w83627hf_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int w83627hf_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, w83627hf_detect);
|
||||
}
|
||||
|
||||
int w83627hf_find(int *address)
|
||||
static int w83627hf_find(int *address)
|
||||
{
|
||||
u16 val;
|
||||
|
||||
@@ -740,7 +714,7 @@ int w83627hf_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int w83627hf_detach_client(struct i2c_client *client)
|
||||
static int w83627hf_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -760,24 +734,11 @@ int w83627hf_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int w83627hf_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int w83627hf_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void w83627hf_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w83627hf_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
ISA access must always be locked explicitly!
|
||||
@@ -785,7 +746,7 @@ void w83627hf_dec_use(struct i2c_client *client)
|
||||
would slow down the W83781D access and should not be necessary.
|
||||
There are some ugly typecasts here, but the good news is - they should
|
||||
nowhere else be necessary! */
|
||||
int w83627hf_read_value(struct i2c_client *client, u16 reg)
|
||||
static int w83627hf_read_value(struct i2c_client *client, u16 reg)
|
||||
{
|
||||
int res, word_sized, bank;
|
||||
struct i2c_client *cl;
|
||||
@@ -820,7 +781,7 @@ int w83627hf_read_value(struct i2c_client *client, u16 reg)
|
||||
return res;
|
||||
}
|
||||
|
||||
int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value)
|
||||
static int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value)
|
||||
{
|
||||
int word_sized, bank;
|
||||
struct i2c_client *cl;
|
||||
@@ -855,7 +816,7 @@ int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value)
|
||||
}
|
||||
|
||||
/* Called when we have found a new W83781D. It should set limits, etc. */
|
||||
void w83627hf_init_client(struct i2c_client *client)
|
||||
static void w83627hf_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct w83627hf_data *data = client->data;
|
||||
int vid = 0, i;
|
||||
@@ -1001,7 +962,7 @@ void w83627hf_init_client(struct i2c_client *client)
|
||||
| 0x01);
|
||||
}
|
||||
|
||||
void w83627hf_update_client(struct i2c_client *client)
|
||||
static void w83627hf_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct w83627hf_data *data = client->data;
|
||||
int i;
|
||||
@@ -1455,7 +1416,7 @@ void w83627hf_sens(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
}
|
||||
|
||||
int __init sensors_w83627hf_init(void)
|
||||
static int __init sm_w83627hf_init(void)
|
||||
{
|
||||
int res, addr;
|
||||
|
||||
@@ -1466,52 +1427,21 @@ int __init sensors_w83627hf_init(void)
|
||||
}
|
||||
normal_isa[0] = addr;
|
||||
|
||||
w83627hf_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&w83627hf_driver))) {
|
||||
printk
|
||||
(KERN_ERR "w83627hf.o: Driver registration failed, module not inserted.\n");
|
||||
w83627hf_cleanup();
|
||||
return res;
|
||||
}
|
||||
w83627hf_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&w83627hf_driver);
|
||||
}
|
||||
|
||||
int __init w83627hf_cleanup(void)
|
||||
static void __exit sm_w83627hf_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (w83627hf_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&w83627hf_driver))) {
|
||||
return res;
|
||||
}
|
||||
w83627hf_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&w83627hf_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
|
||||
"Philip Edelbrock <phil@netroedge.com>, "
|
||||
"and Mark Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("W83627HF driver");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_w83627hf_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return w83627hf_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_w83627hf_init);
|
||||
module_exit(sm_w83627hf_exit);
|
||||
+23
-99
@@ -49,15 +49,6 @@
|
||||
#include "sensors_vid.h"
|
||||
#include <linux/init.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) || \
|
||||
(LINUX_VERSION_CODE == KERNEL_VERSION(2,3,0))
|
||||
#define init_MUTEX(s) do { *(s) = MUTEX; } while(0)
|
||||
#endif
|
||||
|
||||
#ifndef THIS_MODULE
|
||||
#define THIS_MODULE NULL
|
||||
#endif
|
||||
|
||||
/* RT Table support #defined so we can take it out if it gets bothersome */
|
||||
#define W83781D_RT 1
|
||||
|
||||
@@ -169,7 +160,7 @@ static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 };
|
||||
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
|
||||
#define IN_FROM_REG(val) (((val) * 16) / 10)
|
||||
|
||||
extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
static inline u8 FAN_TO_REG(long rpm, int div)
|
||||
{
|
||||
if (rpm == 0)
|
||||
return 255;
|
||||
@@ -203,7 +194,7 @@ extern inline u8 FAN_TO_REG(long rpm, int div)
|
||||
|
||||
#define DIV_FROM_REG(val) (1 << (val))
|
||||
|
||||
extern inline u8 DIV_TO_REG(long val, enum chips type)
|
||||
static inline u8 DIV_TO_REG(long val, enum chips type)
|
||||
{
|
||||
int i;
|
||||
val = SENSORS_LIMIT(val, 1,
|
||||
@@ -314,11 +305,6 @@ extern inline u8 DIV_TO_REG(long val, enum chips type)
|
||||
#define W83781D_INIT_TEMP3_OVER 600
|
||||
#define W83781D_INIT_TEMP3_HYST 500
|
||||
|
||||
#ifdef MODULE
|
||||
extern int init_module(void);
|
||||
extern int cleanup_module(void);
|
||||
#endif /* MODULE */
|
||||
|
||||
/* There are some complications in a module like this. First off, W83781D chips
|
||||
may be both present on the SMBus and the ISA bus, and we have to handle
|
||||
those cases separately at some places. Second, there might be several
|
||||
@@ -380,22 +366,12 @@ struct w83781d_data {
|
||||
};
|
||||
|
||||
|
||||
#ifdef MODULE
|
||||
static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int __init sensors_w83781d_init(void);
|
||||
static int __init w83781d_cleanup(void);
|
||||
|
||||
static int w83781d_attach_adapter(struct i2c_adapter *adapter);
|
||||
static int w83781d_detect(struct i2c_adapter *adapter, int address,
|
||||
unsigned short flags, int kind);
|
||||
static int w83781d_detach_client(struct i2c_client *client);
|
||||
static int w83781d_command(struct i2c_client *client, unsigned int cmd,
|
||||
void *arg);
|
||||
static void w83781d_inc_use(struct i2c_client *client);
|
||||
static void w83781d_dec_use(struct i2c_client *client);
|
||||
|
||||
static int w83781d_read_value(struct i2c_client *client, u16 register);
|
||||
static int w83781d_write_value(struct i2c_client *client, u16 register,
|
||||
@@ -435,19 +411,15 @@ static u16 swap_bytes(u16 val);
|
||||
static int w83781d_id = 0;
|
||||
|
||||
static struct i2c_driver w83781d_driver = {
|
||||
/* name */ "W83781D sensor driver",
|
||||
/* id */ I2C_DRIVERID_W83781D,
|
||||
/* flags */ I2C_DF_NOTIFY,
|
||||
/* attach_adapter */ &w83781d_attach_adapter,
|
||||
/* detach_client */ &w83781d_detach_client,
|
||||
/* command */ &w83781d_command,
|
||||
/* inc_use */ &w83781d_inc_use,
|
||||
/* dec_use */ &w83781d_dec_use
|
||||
.owner = THIS_MODULE,
|
||||
.name = "W83781D sensor driver",
|
||||
.id = I2C_DRIVERID_W83781D,
|
||||
.flags = I2C_DF_NOTIFY,
|
||||
.attach_adapter = w83781d_attach_adapter,
|
||||
.detach_client = w83781d_detach_client,
|
||||
.command = w83781d_command,
|
||||
};
|
||||
|
||||
/* Used by w83781d_init/cleanup */
|
||||
static int __initdata w83781d_initialized = 0;
|
||||
|
||||
/* The /proc/sys entries */
|
||||
/* These files are created for each detected chip. This is just a template;
|
||||
though at first sight, you might think we could use a statically
|
||||
@@ -756,7 +728,7 @@ static ctl_table w83697hf_dir_table_template[] = {
|
||||
* w83781d_driver is inserted (when this module is loaded), for each
|
||||
available adapter
|
||||
* when a new adapter is inserted (and w83781d_driver is still present) */
|
||||
int w83781d_attach_adapter(struct i2c_adapter *adapter)
|
||||
static int w83781d_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_detect(adapter, &addr_data, w83781d_detect);
|
||||
}
|
||||
@@ -1065,7 +1037,7 @@ int w83781d_detect(struct i2c_adapter *adapter, int address,
|
||||
return err;
|
||||
}
|
||||
|
||||
int w83781d_detach_client(struct i2c_client *client)
|
||||
static int w83781d_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -1098,26 +1070,13 @@ int w83781d_detach_client(struct i2c_client *client)
|
||||
}
|
||||
|
||||
/* No commands defined yet */
|
||||
int w83781d_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
static int w83781d_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void w83781d_inc_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_INC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w83781d_dec_use(struct i2c_client *client)
|
||||
{
|
||||
#ifdef MODULE
|
||||
MOD_DEC_USE_COUNT;
|
||||
#endif
|
||||
}
|
||||
|
||||
u16 swap_bytes(u16 val)
|
||||
static u16 swap_bytes(u16 val)
|
||||
{
|
||||
return (val >> 8) | (val << 8);
|
||||
}
|
||||
@@ -1128,7 +1087,7 @@ u16 swap_bytes(u16 val)
|
||||
would slow down the W83781D access and should not be necessary.
|
||||
There are some ugly typecasts here, but the good news is - they should
|
||||
nowhere else be necessary! */
|
||||
int w83781d_read_value(struct i2c_client *client, u16 reg)
|
||||
static int w83781d_read_value(struct i2c_client *client, u16 reg)
|
||||
{
|
||||
int res, word_sized, bank;
|
||||
struct i2c_client *cl;
|
||||
@@ -1204,7 +1163,7 @@ int w83781d_read_value(struct i2c_client *client, u16 reg)
|
||||
return res;
|
||||
}
|
||||
|
||||
int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value)
|
||||
static int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value)
|
||||
{
|
||||
int word_sized, bank;
|
||||
struct i2c_client *cl;
|
||||
@@ -1273,7 +1232,7 @@ int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value)
|
||||
}
|
||||
|
||||
/* Called when we have found a new W83781D. It should set limits, etc. */
|
||||
void w83781d_init_client(struct i2c_client *client)
|
||||
static void w83781d_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct w83781d_data *data = client->data;
|
||||
int vid = 0, i, p;
|
||||
@@ -1477,7 +1436,7 @@ void w83781d_init_client(struct i2c_client *client)
|
||||
| 0x01);
|
||||
}
|
||||
|
||||
void w83781d_update_client(struct i2c_client *client)
|
||||
static void w83781d_update_client(struct i2c_client *client)
|
||||
{
|
||||
struct w83781d_data *data = client->data;
|
||||
int i, j;
|
||||
@@ -2043,59 +2002,24 @@ void w83781d_rt(struct i2c_client *client, int operation, int ctl_name,
|
||||
}
|
||||
#endif
|
||||
|
||||
int __init sensors_w83781d_init(void)
|
||||
static int __init sm_w83781d_init(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
printk(KERN_INFO "w83781d.o version %s (%s)\n", LM_VERSION, LM_DATE);
|
||||
w83781d_initialized = 0;
|
||||
|
||||
if ((res = i2c_add_driver(&w83781d_driver))) {
|
||||
printk
|
||||
(KERN_ERR "w83781d.o: Driver registration failed, module not inserted.\n");
|
||||
w83781d_cleanup();
|
||||
return res;
|
||||
}
|
||||
w83781d_initialized++;
|
||||
return 0;
|
||||
return i2c_add_driver(&w83781d_driver);
|
||||
}
|
||||
|
||||
int __init w83781d_cleanup(void)
|
||||
static void __exit sm_w83781d_exit(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (w83781d_initialized >= 1) {
|
||||
if ((res = i2c_del_driver(&w83781d_driver))) {
|
||||
printk
|
||||
(KERN_ERR "w83781d.o: Driver deregistration failed, module not removed.\n");
|
||||
return res;
|
||||
}
|
||||
w83781d_initialized--;
|
||||
}
|
||||
return 0;
|
||||
i2c_del_driver(&w83781d_driver);
|
||||
}
|
||||
|
||||
EXPORT_NO_SYMBOLS;
|
||||
|
||||
#ifdef MODULE
|
||||
|
||||
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
|
||||
"Philip Edelbrock <phil@netroedge.com>, "
|
||||
"and Mark Studebaker <mdsxyz123@yahoo.com>");
|
||||
MODULE_DESCRIPTION("W83781D driver");
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
|
||||
|
||||
int init_module(void)
|
||||
{
|
||||
return sensors_w83781d_init();
|
||||
}
|
||||
|
||||
int cleanup_module(void)
|
||||
{
|
||||
return w83781d_cleanup();
|
||||
}
|
||||
|
||||
#endif /* MODULE */
|
||||
module_init(sm_w83781d_init);
|
||||
module_exit(sm_w83781d_exit);
|
||||
@@ -18,168 +18,3 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* Not configurable as a module */
|
||||
|
||||
#include <linux/init.h>
|
||||
|
||||
#ifdef CONFIG_SENSORS_ADM1021
|
||||
extern int sensors_adm1021_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_ADM1025
|
||||
extern int sensors_adm1025_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_ADM9240
|
||||
extern int sensors_adm9240_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_BT869
|
||||
extern int sensors_bt869_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_DDCMON
|
||||
extern int sensors_ddcmon_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_DS1621
|
||||
extern int sensors_ds1621_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_GL518SM
|
||||
extern int sensors_gl518sm_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_GL520SM
|
||||
extern int sensors_gl520_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM75
|
||||
extern int sensors_lm75_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM78
|
||||
extern int sensors_lm78_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM80
|
||||
extern int sensors_lm80_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM87
|
||||
extern int sensors_lm87_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM92
|
||||
extern int sensors_lm92_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_MTP008
|
||||
extern int sensors_mtp008_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_PCF8574
|
||||
extern int sensors_pcf8574_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_PCF8591
|
||||
extern int sensors_pcf8591_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_SIS5595
|
||||
extern int sensors_sis5595_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_SMSC47M1
|
||||
extern int sensors_smsc47m1_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_THMC50
|
||||
extern int sensors_thmc50_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_VIA686A
|
||||
extern int sensors_via686a_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_VT1211
|
||||
extern int sensors_vt1211_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_VT8231
|
||||
extern int sensors_vt8231_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_W83781D
|
||||
extern int sensors_w83781d_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_EEPROM
|
||||
extern int sensors_eeprom_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LTC1710
|
||||
extern int sensors_ltc1710_init(void);
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_IT87
|
||||
extern int sensors_it87_init(void);
|
||||
#endif
|
||||
|
||||
int __init sensors_init_all(void)
|
||||
{
|
||||
#ifdef CONFIG_SENSORS_ADM1021
|
||||
sensors_adm1021_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_ADM1025
|
||||
sensors_adm1025_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_ADM9240
|
||||
sensors_adm9240_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_BT869
|
||||
sensors_bt869_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_DDCMON
|
||||
sensors_ddcmon_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_DS1621
|
||||
sensors_ds1621_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_GL518SM
|
||||
sensors_gl518sm_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_GL520SM
|
||||
sensors_gl520_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM75
|
||||
sensors_lm75_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM78
|
||||
sensors_lm78_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM80
|
||||
sensors_lm80_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM87
|
||||
sensors_lm87_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LM92
|
||||
sensors_lm92_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_PCF8574
|
||||
sensors_pcf8574_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_PCF8591
|
||||
sensors_pcf8591_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_MTP008
|
||||
sensors_mtp008_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_SIS5595
|
||||
sensors_sis5595_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_SMSC47M1
|
||||
sensors_smsc47m1_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_THMC50
|
||||
sensors_thmc50_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_VIA686A
|
||||
sensors_via686a_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_VT1211
|
||||
sensors_vt1211_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_VT8231
|
||||
sensors_vt8231_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_W83781D
|
||||
sensors_w83781d_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_EEPROM
|
||||
sensors_eeprom_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_LTC1710
|
||||
sensors_ltc1710_init();
|
||||
#endif
|
||||
#ifdef CONFIG_SENSORS_IT87
|
||||
sensors_it87_init();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user