Show
Ignore:
Timestamp:
11/26/98 11:16:08 (16 years ago)
Author:
frodo
Message:

Example lm_sensors-2 driver

Though it is called the LM78 driver, there is not too much LM78 specific
code in it; it can better be seen as an example code skeleton for other
drivers. Right now, it creats a file /proc/sensors-test, which contains
a list of busses it registered itself on. Stupid, but very useful for
testing purposes!

You need a 2.0 kernel for lm78.o to insert (or hack the /proc system
specific parts; see lm78.c of lm_sensors version 1 how to do this).
Other parts of lm_sensors-2 are not tested for 2.1 kernels either, but
I am certain it won't work in this case :-).

See the TODO list to get some idea what is left to do, choose something
and implement it. Or not :-). But please, send a note to the mailing
list when you start on something, to avoid duplicate work...

Other notable changes:

the smbus_access routines now use (the more logical) i2c_adapter
structure, instead of smbus_adapter.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/include/smbus.h

    r12 r13  
    131131#define i2c_is_smbus_client(clientptr) \ 
    132132        ((clientptr)->adapter->algo->id == ALGO_SMBUS) 
     133#define i2c_is_smbus_adapter(adapptr) \ 
     134        ((adapptr)->algo->id == ALGO_SMBUS) 
    133135 
    134136/* This union is used within smbus_access routines */ 
     
    158160/* This is the very generalized SMBus access routine. You probably do not 
    159161   want to use this, though; one of the functions below may be much easier, 
    160    and probably just as fast. */ 
    161 extern s32 smbus_access (struct smbus_adapter * adapter, u8 addr,  
     162   and probably just as fast.  
     163   Note that we use i2c_adapter here, because you do not need a specific 
     164   smbus adapter to call this function. */ 
     165extern s32 smbus_access (struct i2c_adapter * adapter, u8 addr,  
    162166                         char read_write, u8 command, int size, 
    163167                         union smbus_data * data); 
     
    166170   conventions of smbus_access. */ 
    167171 
    168 extern inline s32 smbus_write_quick(struct smbus_adapter * adapter, u8 addr,  
     172extern inline s32 smbus_write_quick(struct i2c_adapter * adapter, u8 addr,  
    169173                                    u8 value) 
    170174{ 
     
    172176} 
    173177 
    174 extern inline s32 smbus_read_byte(struct smbus_adapter * adapter,u8 addr) 
     178extern inline s32 smbus_read_byte(struct i2c_adapter * adapter,u8 addr) 
    175179{ 
    176180  union smbus_data data; 
     
    181185} 
    182186 
    183 extern inline s32 smbus_write_byte(struct smbus_adapter * adapter, u8 addr,  
     187extern inline s32 smbus_write_byte(struct i2c_adapter * adapter, u8 addr,  
    184188                                   u8 value) 
    185189{ 
     
    187191} 
    188192 
    189 extern inline s32 smbus_read_byte_data(struct smbus_adapter * adapter, 
     193extern inline s32 smbus_read_byte_data(struct i2c_adapter * adapter, 
    190194                                       u8 addr, u8 command) 
    191195{ 
     
    197201} 
    198202 
    199 extern inline s32 smbus_write_byte_data(struct smbus_adapter * adapter, 
     203extern inline s32 smbus_write_byte_data(struct i2c_adapter * adapter, 
    200204                                        u8 addr, u8 command, u8 value) 
    201205{ 
     
    205209} 
    206210 
    207 extern inline s32 smbus_read_word_data(struct smbus_adapter * adapter, 
     211extern inline s32 smbus_read_word_data(struct i2c_adapter * adapter, 
    208212                                       u8 addr, u8 command) 
    209213{ 
     
    215219} 
    216220 
    217 extern inline s32 smbus_write_word_data(struct smbus_adapter * adapter, 
     221extern inline s32 smbus_write_word_data(struct i2c_adapter * adapter, 
    218222                                        u8 addr, u8 command, u16 value) 
    219223{ 
     
    223227} 
    224228 
    225 extern inline s32 smbus_process_call(struct smbus_adapter * adapter, 
     229extern inline s32 smbus_process_call(struct i2c_adapter * adapter, 
    226230                                     u8 addr, u8 command, u16 value) 
    227231{ 
     
    235239 
    236240/* Returns the number of read bytes */ 
    237 extern inline s32 smbus_read_block_data(struct smbus_adapter * adapter, 
     241extern inline s32 smbus_read_block_data(struct i2c_adapter * adapter, 
    238242                                        u8 addr, u8 command, u8 *values) 
    239243{ 
     
    249253} 
    250254 
    251 extern inline int smbus_write_block_data(struct smbus_adapter * adapter, 
     255extern inline int smbus_write_block_data(struct i2c_adapter * adapter, 
    252256                                         u8 addr, u8 command, u8 length, 
    253257                                         u8 *values)