Changeset 1344

Show
Ignore:
Timestamp:
04/02/02 03:54:05 (11 years ago)
Author:
mds
Message:

voodoo3 -> savage4 global replace

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/busses/i2c-savage4.c

    r1343 r1344  
    11/* 
    2     voodoo3.c - Part of lm_sensors, Linux kernel modules for hardware 
     2    i2c-savage4.c - Part of lm_sensors, Linux kernel modules for hardware 
    33              monitoring 
    44    Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl>, 
     
    2525*/ 
    2626 
    27 /* This interfaces to the I2C bus of the Voodoo3 to gain access to 
    28     the BT869 and possibly other I2C devices. */ 
     27/* This interfaces to the I2C bus of the Savage4 to gain access to 
     28   the BT869 and possibly other I2C devices. The DDC bus is not 
     29   yet supported because its register is not memory-mapped. 
     30   However we leave the DDC code here, commented out, to make 
     31   it easier to add later. */ 
    2932 
    3033#include <linux/version.h> 
     
    8487extern 
    8588#endif 
    86 int __init i2c_voodoo3_init(void); 
    87 static int __init voodoo3_cleanup(void); 
    88 static int voodoo3_setup(void); 
    89 static void config_v3(struct pci_dev *dev); 
    90 static void voodoo3_inc(struct i2c_adapter *adapter); 
    91 static void voodoo3_dec(struct i2c_adapter *adapter); 
     89int __init i2c_savage4_init(void); 
     90static int __init savage4_cleanup(void); 
     91static int savage4_setup(void); 
     92static void config_s4(struct pci_dev *dev); 
     93static void savage4_inc(struct i2c_adapter *adapter); 
     94static void savage4_dec(struct i2c_adapter *adapter); 
    9295 
    9396#ifdef MODULE 
     
    97100 
    98101 
    99 static int __initdata voodoo3_initialized; 
     102static int __initdata savage4_initialized; 
    100103static unsigned char *mem; 
    101104 
     
    110113} 
    111114 
    112 /* The voo GPIO registers don't have individual masks for each bit 
     115/* The sav GPIO registers don't have individual masks for each bit 
    113116   so we always have to read before writing. */ 
    114117 
    115 static void bit_vooi2c_setscl(void *data, int val) 
     118static void bit_savi2c_setscl(void *data, int val) 
    116119{ 
    117120        unsigned int r; 
     
    124127} 
    125128 
    126 static void bit_vooi2c_setsda(void *data, int val) 
     129static void bit_savi2c_setsda(void *data, int val) 
    127130{ 
    128131        unsigned int r; 
     
    139142   reading the input from other chips. */ 
    140143 
    141 static int bit_vooi2c_getscl(void *data) 
     144static int bit_savi2c_getscl(void *data) 
    142145{ 
    143146        return (0 != (readlong() & I2C_SCL_IN)); 
    144147} 
    145148 
    146 static int bit_vooi2c_getsda(void *data) 
     149static int bit_savi2c_getsda(void *data) 
    147150{ 
    148151        return (0 != (readlong() & I2C_SDA_IN)); 
    149152} 
    150153 
    151 /*static void bit_vooddc_setscl(void *data, int val) 
     154/*static void bit_savddc_setscl(void *data, int val) 
    152155{ 
    153156        unsigned int r; 
     
    160163} 
    161164 
    162 static void bit_vooddc_setsda(void *data, int val) 
     165static void bit_savddc_setsda(void *data, int val) 
    163166{ 
    164167        unsigned int r; 
     
    171174} 
    172175 
    173 static int bit_vooddc_getscl(void *data) 
     176static int bit_savddc_getscl(void *data) 
    174177{ 
    175178        return (0 != (readlong() & DDC_SCL_IN)); 
    176179} 
    177180 
    178 static int bit_vooddc_getsda(void *data) 
     181static int bit_savddc_getsda(void *data) 
    179182{ 
    180183        return (0 != (readlong() & DDC_SDA_IN)); 
    181184} 
    182185*/ 
    183 static struct i2c_algo_bit_data voo_i2c_bit_data = { 
    184         NULL, 
    185         bit_vooi2c_setsda, 
    186         bit_vooi2c_setscl, 
    187         bit_vooi2c_getsda, 
    188         bit_vooi2c_getscl, 
     186static struct i2c_algo_bit_data sav_i2c_bit_data = { 
     187        NULL, 
     188        bit_savi2c_setsda, 
     189        bit_savi2c_setscl, 
     190        bit_savi2c_getsda, 
     191        bit_savi2c_getscl, 
    189192        CYCLE_DELAY, CYCLE_DELAY, TIMEOUT 
    190193}; 
    191194 
    192 static struct i2c_adapter voodoo3_i2c_adapter = { 
    193         "I2C Voodoo3/Banshee adapter", 
     195static struct i2c_adapter savage4_i2c_adapter = { 
     196        "I2C Savage4 adapter", 
    194197        I2C_HW_B_VOO, 
    195198        NULL, 
    196         &voo_i2c_bit_data, 
    197         voodoo3_inc, 
    198         voodoo3_dec, 
     199        &sav_i2c_bit_data, 
     200        savage4_inc, 
     201        savage4_dec, 
    199202        NULL, 
    200203        NULL, 
    201204}; 
    202205/* 
    203 static struct i2c_algo_bit_data voo_ddc_bit_data = { 
    204         NULL, 
    205         bit_vooddc_setsda, 
    206         bit_vooddc_setscl, 
    207         bit_vooddc_getsda, 
    208         bit_vooddc_getscl, 
     206static struct i2c_algo_bit_data sav_ddc_bit_data = { 
     207        NULL, 
     208        bit_savddc_setsda, 
     209        bit_savddc_setscl, 
     210        bit_savddc_getsda, 
     211        bit_savddc_getscl, 
    209212        CYCLE_DELAY, CYCLE_DELAY, TIMEOUT 
    210213}; 
    211214 
    212 static struct i2c_adapter voodoo3_ddc_adapter = { 
     215static struct i2c_adapter savage4_ddc_adapter = { 
    213216        "DDC Voodoo3/Banshee adapter", 
    214217        I2C_HW_B_VOO, 
    215218        NULL, 
    216         &voo_ddc_bit_data, 
    217         voodoo3_inc, 
    218         voodoo3_dec, 
     219        &sav_ddc_bit_data, 
     220        savage4_inc, 
     221        savage4_dec, 
    219222        NULL, 
    220223        NULL, 
     
    223226/* Configures the chip */ 
    224227 
    225 void config_v3(struct pci_dev *dev) 
     228void config_s4(struct pci_dev *dev) 
    226229{ 
    227230        unsigned int cadr; 
    228231 
    229         /* map Voodoo3 memory */ 
     232        /* map memory */ 
    230233#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) 
    231234        cadr = dev->resource[0].start; 
     
    238241//      *((unsigned int *) (mem + REG2)) = 0x8160; 
    239242        *((unsigned int *) (mem + REG)) = 0x00000020; 
    240         printk("i2c-voodoo3: Using Banshee/Voodoo3 at 0x%p\n", mem); 
    241 } 
    242  
    243 /* Detect whether a Voodoo3 or a Banshee can be found, 
    244    and initialize it. */ 
    245 static int voodoo3_setup(void) 
     243        printk("i2c-savage4: Using Savage4 at 0x%p\n", mem); 
     244} 
     245 
     246/* Detect chip and initialize it. */ 
     247static int savage4_setup(void) 
    246248{ 
    247249        struct pci_dev *dev; 
    248         int v3_num; 
    249  
    250         v3_num = 0; 
     250        int s4_num; 
     251 
     252        s4_num = 0; 
    251253 
    252254        dev = NULL; 
     
    255257                                           PCI_CHIP_SAVAGE4, 
    256258                                           dev))) { 
    257                         if (!v3_num) 
    258                                 config_v3(dev); 
    259                         v3_num++; 
     259                        if (!s4_num) 
     260                                config_s4(dev); 
     261                        s4_num++; 
    260262                } 
    261263        } while (dev); 
     
    266268                                           PCI_CHIP_SAVAGE2000, 
    267269                                           dev))) { 
    268                         if (!v3_num) 
    269                                 config_v3(dev); 
    270                         v3_num++; 
     270                        if (!s4_num) 
     271                                config_s4(dev); 
     272                        s4_num++; 
    271273                } 
    272274        } while (dev); 
    273275 
    274         if (v3_num > 0) { 
    275                 printk("i2c-voodoo3: %d Banshee/Voodoo3 found.\n", v3_num); 
    276                 if (v3_num > 1) 
    277                         printk("i2c-voodoo3: warning: only 1 supported.\n"); 
     276        if (s4_num > 0) { 
     277                printk("i2c-savage4: %d Savage4 found.\n", s4_num); 
     278                if (s4_num > 1) 
     279                        printk("i2c-savage4: warning: only 1 supported.\n"); 
    278280                return 0; 
    279281        } else { 
    280                 printk("i2c-voodoo3: No Voodoo3 found.\n"); 
     282                printk("i2c-savage4: No Savage4 found.\n"); 
    281283                return -ENODEV; 
    282284        } 
    283285} 
    284286 
    285 void voodoo3_inc(struct i2c_adapter *adapter) 
     287void savage4_inc(struct i2c_adapter *adapter) 
    286288{ 
    287289        MOD_INC_USE_COUNT; 
    288290} 
    289291 
    290 void voodoo3_dec(struct i2c_adapter *adapter) 
     292void savage4_dec(struct i2c_adapter *adapter) 
    291293{ 
    292294        MOD_DEC_USE_COUNT; 
    293295} 
    294296 
    295 int __init i2c_voodoo3_init(void) 
     297int __init i2c_savage4_init(void) 
    296298{ 
    297299        int res; 
    298         printk("i2c-voodoo3.o version %s (%s)\n", LM_VERSION, LM_DATE); 
    299         voodoo3_initialized = 0; 
    300         if ((res = voodoo3_setup())) { 
     300        printk("i2c-savage4.o version %s (%s)\n", LM_VERSION, LM_DATE); 
     301        savage4_initialized = 0; 
     302        if ((res = savage4_setup())) { 
    301303                printk 
    302                     ("i2c-voodoo3.o: Voodoo3 not detected, module not inserted.\n"); 
    303                 voodoo3_cleanup(); 
     304                    ("i2c-savage4.o: Savage4 not detected, module not inserted.\n"); 
     305                savage4_cleanup(); 
    304306                return res; 
    305307        } 
    306         if ((res = i2c_bit_add_bus(&voodoo3_i2c_adapter))) { 
    307                 printk("i2c-voodoo3.o: I2C adapter registration failed\n"); 
     308        if ((res = i2c_bit_add_bus(&savage4_i2c_adapter))) { 
     309                printk("i2c-savage4.o: I2C adapter registration failed\n"); 
    308310        } else { 
    309                 printk("i2c-voodoo3.o: I2C bus initialized\n"); 
    310                 voodoo3_initialized |= INIT2; 
     311                printk("i2c-savage4.o: I2C bus initialized\n"); 
     312                savage4_initialized |= INIT2; 
    311313        } 
    312314/* 
    313         if ((res = i2c_bit_add_bus(&voodoo3_ddc_adapter))) { 
    314                 printk("i2c-voodoo3.o: DDC adapter registration failed\n"); 
     315        if ((res = i2c_bit_add_bus(&savage4_ddc_adapter))) { 
     316                printk("i2c-savage4.o: DDC adapter registration failed\n"); 
    315317        } else { 
    316                 printk("i2c-voodoo3.o: DDC bus initialized\n"); 
    317                 voodoo3_initialized |= INIT3; 
    318         } 
    319 */ 
    320         if(!(voodoo3_initialized & (INIT2 /* | INIT3 */ ))) { 
    321                 printk("i2c-voodoo3.o: Both registrations failed, module not inserted\n"); 
    322                 voodoo3_cleanup(); 
     318                printk("i2c-savage4.o: DDC bus initialized\n"); 
     319                savage4_initialized |= INIT3; 
     320        } 
     321*/ 
     322        if(!(savage4_initialized & (INIT2 /* | INIT3 */ ))) { 
     323                printk("i2c-savage4.o: Both registrations failed, module not inserted\n"); 
     324                savage4_cleanup(); 
    323325                return res; 
    324326        } 
     
    326328} 
    327329 
    328 int __init voodoo3_cleanup(void) 
     330int __init savage4_cleanup(void) 
    329331{ 
    330332        int res; 
     
    332334        iounmap(mem); 
    333335/* 
    334         if (voodoo3_initialized & INIT3) { 
    335                 if ((res = i2c_bit_del_bus(&voodoo3_ddc_adapter))) { 
     336        if (savage4_initialized & INIT3) { 
     337                if ((res = i2c_bit_del_bus(&savage4_ddc_adapter))) { 
    336338                        printk 
    337                             ("i2c-voodoo3.o: i2c_bit_del_bus failed, module not removed\n"); 
     339                            ("i2c-savage4.o: i2c_bit_del_bus failed, module not removed\n"); 
    338340                        return res; 
    339341                } 
    340342        } 
    341343*/ 
    342         if (voodoo3_initialized & INIT2) { 
    343                 if ((res = i2c_bit_del_bus(&voodoo3_i2c_adapter))) { 
     344        if (savage4_initialized & INIT2) { 
     345                if ((res = i2c_bit_del_bus(&savage4_i2c_adapter))) { 
    344346                        printk 
    345                             ("i2c-voodoo3.o: i2c_bit_del_bus failed, module not removed\n"); 
     347                            ("i2c-savage4.o: i2c_bit_del_bus failed, module not removed\n"); 
    346348                        return res; 
    347349                } 
     
    356358MODULE_AUTHOR 
    357359    ("Frodo Looijaard <frodol@dds.nl>, Philip Edelbrock <phil@netroedge.com>, Ralph Metzler <rjkm@thp.uni-koeln.de>, and Mark D. Studebaker <mdsxyz123@yahoo.com>"); 
    358 MODULE_DESCRIPTION("Voodoo3 I2C/SMBus driver"); 
     360MODULE_DESCRIPTION("Savage4 I2C/SMBus driver"); 
    359361 
    360362 
    361363int init_module(void) 
    362364{ 
    363         return i2c_voodoo3_init(); 
     365        return i2c_savage4_init(); 
    364366} 
    365367 
    366368int cleanup_module(void) 
    367369{ 
    368         return voodoo3_cleanup(); 
     370        return savage4_cleanup(); 
    369371} 
    370372