Changeset 9
- Timestamp:
- 11/19/98 16:14:01 (15 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 3 added
- 6 modified
-
kernel/Module.mk (modified) (1 diff)
-
kernel/busses (added)
-
kernel/busses/i2c-piix4.c (added)
-
kernel/include/smbus.h (modified) (2 diffs)
-
kernel/smbus.c (modified) (2 diffs)
-
src/Module.mk (modified) (1 diff)
-
src/piix4.c (added)
-
src/smbus.c (modified) (2 diffs)
-
src/smbus.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/kernel/Module.mk
r8 r9 23 23 # Regrettably, even 'simply expanded variables' will not put their currently 24 24 # defined value verbatim into the command-list of rules... 25 SRCTARGETS := $(MODULE_DIR)/smbus.o 25 SRCTARGETS := $(MODULE_DIR)/smbus.o $(MODULE_DIR)/piix4.o 26 26 27 27 # Include all dependency files -
lm-sensors/trunk/kernel/include/smbus.h
r8 r9 110 110 int retries; 111 111 112 /* Here ended i2c_a lgorithm*/113 s32 (* smbus_access) ( __u8 addr, char read_write,114 __u8 command, int size, union smbus_data * data);112 /* Here ended i2c_adapter */ 113 s32 (* smbus_access) (u8 addr, char read_write, 114 u8 command, int size, union smbus_data * data); 115 115 }; 116 116 … … 122 122 #define ALGO_SMBUS 0x40000 123 123 124 /* SMBus Adapter ids */ 125 #define SMBUS_PIIX4 1 126 124 127 /* This union is used within smbus_access routines */ 125 128 union smbus_data { 126 __u8 byte;127 __u16 word;128 __u8 block[32];129 u8 byte; 130 u16 word; 131 u8 block[32]; 129 132 }; 130 133 -
lm-sensors/trunk/kernel/smbus.c
r8 r9 20 20 #include <linux/module.h> 21 21 #include <linux/kernel.h> 22 23 #ifdef SPINLOCK 24 #include <asm/spinlock.h> 25 #else 26 #include <asm/semaphore.h> 27 #endif 28 22 29 #include "smbus.h" 23 30 … … 58 65 /* OK, so you want to access a bus using the SMBus protocols. Well, it either 59 66 is registered as a SMBus-only adapter (like the PIIX4), or we need to 60 simulate the SMBus commands using the i2c access routines. */ 67 simulate the SMBus commands using the i2c access routines. 68 We do all locking here, so you can ignore that in the adapter-specific 69 smbus_accesss routine. */ 61 70 s32 smbus_access (struct smbus_adapter * adapter, u8 addr, char read_write, 62 71 u8 command, int size, union smbus_data * data) 63 72 { 73 int res; 74 #ifdef SPINLOCK 75 spin_lock_irqsave(&adapter->lock,adapter->lockflags); 76 #else 77 down(&adapter->lock); 78 #endif 64 79 if (adapter->id & ALGO_SMBUS) 65 re turnadapter->smbus_access(addr,read_write,command,size,data);80 res = adapter->smbus_access(addr,read_write,command,size,data); 66 81 else 67 return smbus_access_i2c(adapter,addr,read_write,command,size,data); 82 res = smbus_access_i2c(adapter,addr,read_write,command,size,data); 83 #ifdef SPINLOCK 84 spin_unlock_irqrestore(&adapter->lock,adapter->lockflags); 85 #else 86 up(&adapter->lock); 87 #endif 88 return res; 68 89 } 69 90 -
lm-sensors/trunk/src/Module.mk
r8 r9 23 23 # Regrettably, even 'simply expanded variables' will not put their currently 24 24 # defined value verbatim into the command-list of rules... 25 SRCTARGETS := $(MODULE_DIR)/smbus.o 25 SRCTARGETS := $(MODULE_DIR)/smbus.o $(MODULE_DIR)/piix4.o 26 26 27 27 # Include all dependency files -
lm-sensors/trunk/src/smbus.c
r8 r9 20 20 #include <linux/module.h> 21 21 #include <linux/kernel.h> 22 23 #ifdef SPINLOCK 24 #include <asm/spinlock.h> 25 #else 26 #include <asm/semaphore.h> 27 #endif 28 22 29 #include "smbus.h" 23 30 … … 58 65 /* OK, so you want to access a bus using the SMBus protocols. Well, it either 59 66 is registered as a SMBus-only adapter (like the PIIX4), or we need to 60 simulate the SMBus commands using the i2c access routines. */ 67 simulate the SMBus commands using the i2c access routines. 68 We do all locking here, so you can ignore that in the adapter-specific 69 smbus_accesss routine. */ 61 70 s32 smbus_access (struct smbus_adapter * adapter, u8 addr, char read_write, 62 71 u8 command, int size, union smbus_data * data) 63 72 { 73 int res; 74 #ifdef SPINLOCK 75 spin_lock_irqsave(&adapter->lock,adapter->lockflags); 76 #else 77 down(&adapter->lock); 78 #endif 64 79 if (adapter->id & ALGO_SMBUS) 65 re turnadapter->smbus_access(addr,read_write,command,size,data);80 res = adapter->smbus_access(addr,read_write,command,size,data); 66 81 else 67 return smbus_access_i2c(adapter,addr,read_write,command,size,data); 82 res = smbus_access_i2c(adapter,addr,read_write,command,size,data); 83 #ifdef SPINLOCK 84 spin_unlock_irqrestore(&adapter->lock,adapter->lockflags); 85 #else 86 up(&adapter->lock); 87 #endif 88 return res; 68 89 } 69 90 -
lm-sensors/trunk/src/smbus.h
r8 r9 110 110 int retries; 111 111 112 /* Here ended i2c_a lgorithm*/113 s32 (* smbus_access) ( __u8 addr, char read_write,114 __u8 command, int size, union smbus_data * data);112 /* Here ended i2c_adapter */ 113 s32 (* smbus_access) (u8 addr, char read_write, 114 u8 command, int size, union smbus_data * data); 115 115 }; 116 116 … … 122 122 #define ALGO_SMBUS 0x40000 123 123 124 /* SMBus Adapter ids */ 125 #define SMBUS_PIIX4 1 126 124 127 /* This union is used within smbus_access routines */ 125 128 union smbus_data { 126 __u8 byte;127 __u16 word;128 __u8 block[32];129 u8 byte; 130 u16 word; 131 u8 block[32]; 129 132 }; 130 133
