]> git.hungrycats.org Git - linux/commitdiff
[PATCH] i2c sanity
authorChristoph Hellwig <hch@sgi.com>
Wed, 19 Feb 2003 09:07:11 +0000 (01:07 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 19 Feb 2003 09:07:11 +0000 (01:07 -0800)
small updates to bring us nearer the lm_Sensors CVS (docs, comments,
missing statics, named initializers).  I still need to review their
actual code changes before submitting those..

21 files changed:
Documentation/i2c/i2c-protocol
Documentation/i2c/smbus-protocol
Documentation/i2c/summary
Documentation/i2c/writing-clients
drivers/i2c/chips/adm1021.c
drivers/i2c/chips/lm75.c
drivers/i2c/i2c-algo-bit.c
drivers/i2c/i2c-algo-pcf.c
drivers/i2c/i2c-dev.c
drivers/i2c/i2c-elv.c
drivers/i2c/i2c-frodo.c
drivers/i2c/i2c-philips-par.c
drivers/i2c/i2c-proc.c
drivers/i2c/i2c-rpx.c
drivers/i2c/i2c-velleman.c
include/linux/i2c-algo-bit.h
include/linux/i2c-algo-pcf.h
include/linux/i2c-dev.h
include/linux/i2c-id.h
include/linux/i2c-proc.h
include/linux/i2c.h

index 40c686d6585d86a2694b13829a70c8466dfaf011..b4022c914210ef10a5a0acf79405dc369c20df0e 100644 (file)
@@ -52,10 +52,10 @@ Modified transactions
 We have found some I2C devices that needs the following modifications:
 
   Flag I2C_M_NOSTART: 
-    In a combined transaction, no 'S Addr' is generated at some point.
-    For example, setting I2C_M_NOSTART on the second partial message
+    In a combined transaction, no 'S Addr Wr/Rd [A]' is generated at some
+    point. For example, setting I2C_M_NOSTART on the second partial message
     generates something like:
-      S Addr Rd [A] [Data] NA Wr [A] Data [A] P
+      S Addr Rd [A] [Data] NA Data [A] P
     If you set the I2C_M_NOSTART variable for the first partial message,
     we do not generate Addr, but we do generate the startbit S. This will
     probably confuse all other clients on your bus, so don't try this.
@@ -65,4 +65,12 @@ We have found some I2C devices that needs the following modifications:
     need to emit an Rd instead of a Wr, or vice versa, you set this
     flag. For example:
       S Addr Rd [A] Data [A] Data [A] ... [A] Data [A] P
-                      
+
+  Flags I2C_M_IGNORE_NAK
+    Normally message is interrupted immediately if there is [NA] from the
+    client. Setting this flag treats any [NA] as [A], and all of
+    message is sent.
+    These messages may still fail to SCL lo->hi timeout.
+
+  Flags I2C_M_NO_RD_ACK
+    In a read message, master A/NA bit is skipped.
index 2e15a04838447cccf2324dd4ed3b1ccdad28ae21..09f5e5ca49272544002b862d0b61af21bc66ce70 100644 (file)
@@ -61,7 +61,7 @@ SMBus Write Byte
 This is the reverse of Read Byte: it sends a single byte to a device.
 See Read Byte for more information.
 
-S Addr Wr [A] Data NA P
+S Addr Wr [A] Data [A] P
 
 
 SMBus Read Byte Data
index 6755f2d94c945d1df58454fdadd201a81fb05b6e..c0288bb8dc40081378df8dea2ef7a49c8dea1910 100644 (file)
@@ -4,7 +4,7 @@ I2C and SMBus
 =============
 
 I2C (pronounce: I squared C) is a protocol developed by Philips. It is a 
-slow two-wire protocol (10-100 kHz), but it suffices for many types of 
+slow two-wire protocol (10-400 kHz), but it suffices for many types of 
 devices.
 
 SMBus (System Management Bus) is a subset of the I2C protocol. Many
@@ -43,15 +43,15 @@ for device drivers.
 
 Included Bus Drivers
 ====================
-Note that not only stable drivers are patched into the kernel by 'mkpatch'.
+Note that only stable drivers are patched into the kernel by 'mkpatch'.
 
 
 Base modules
 ------------
 
-i2c-core: The basic I2C code, including the /proc interface
-i2c-dev:  The /dev interface
-i2c-proc: The /proc interface for device (client) drivers
+i2c-core: The basic I2C code, including the /proc/bus/i2c* interface
+i2c-dev:  The /dev/i2c-* interface
+i2c-proc: The /proc/sys/dev/sensors interface for device (client) drivers
 
 Algorithm drivers
 -----------------
@@ -59,7 +59,7 @@ Algorithm drivers
 i2c-algo-8xx:    An algorithm for CPM's I2C device in Motorola 8xx processors (NOT BUILT BY DEFAULT)
 i2c-algo-bit:    A bit-banging algorithm
 i2c-algo-pcf:    A PCF 8584 style algorithm
-i2c-algo-ibmocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT)
+i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT)
 
 Adapter drivers
 ---------------
@@ -68,7 +68,7 @@ i2c-elektor:     Elektor ISA card (uses i2c-algo-pcf)
 i2c-elv:         ELV parallel port adapter (uses i2c-algo-bit)
 i2c-pcf-epp:     PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (NOT mkpatched)
 i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit)
-i2c-adap_ibmocp:      IBM 4xx processor I2C device (uses i2c-algo-ibmocp) (NOT BUILT BY DEFAULT)
+i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT)
 i2c-pport:       Primitive parallel port adapter (uses i2c-algo-bit)
 i2c-rpx:         RPX board Motorola 8xx I2C device (uses i2c-algo-8xx) (NOT BUILT BY DEFAULT)
 i2c-velleman:    Velleman K9000 parallel port adapter (uses i2c-algo-bit)
index 1a1ed14b523585b6725459dc6add0c6448d92e04..8b310eae51ee0667481e8642f9682ec999f83da5 100644 (file)
@@ -448,9 +448,9 @@ For now, you can ignore the `flags' parameter. It is there for future use.
     /* Note that we reserve some space for foo_data too. If you don't
        need it, remove it. We do it here to help to lessen memory
        fragmentation. */
-    if (! (new_client = kmalloc(sizeof(struct i2c_client)) + 
+    if (! (new_client = kmalloc(sizeof(struct i2c_client) + 
                                 sizeof(struct foo_data),
-                                GFP_KERNEL)) {
+                                GFP_KERNEL))) {
       err = -ENOMEM;
       goto ERROR0;
     }
index 19c4fed60425a71a0cc3475e1078c68ec6f391e9..44bd127e5efe3433a31c02a828b2f7e44a190ff4 100644 (file)
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/version.h>
 #include <linux/module.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/i2c-proc.h>
-#include <linux/init.h>
+
 
 /* Registers */
 #define ADM1021_SYSCTL_TEMP            1200
@@ -123,8 +123,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address,
                          unsigned short flags, int kind);
 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 int adm1021_read_value(struct i2c_client *client, u8 reg);
 static int adm1021_write_value(struct i2c_client *client, u8 reg,
                               u16 value);
@@ -151,7 +149,6 @@ static struct i2c_driver adm1021_driver = {
        .flags          = I2C_DF_NOTIFY,
        .attach_adapter = adm1021_attach_adapter,
        .detach_client  = adm1021_detach_client,
-       .command        = adm1021_command,
 };
 
 /* These files are created for each detected adm1021. This is just a template;
@@ -186,7 +183,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);
 }
@@ -339,7 +336,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,
@@ -356,7 +353,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;
@@ -376,28 +373,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)
-{
-       return 0;
-}
-
 /* 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);
 }
 
-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;
-
-       return i2c_smbus_write_byte_data(client, reg, value);
+       if (!read_only)
+               return i2c_smbus_write_byte_data(client, reg, value);
+       return 0;
 }
 
-void adm1021_update_client(struct i2c_client *client)
+static void adm1021_update_client(struct i2c_client *client)
 {
        struct adm1021_data *data = client->data;
 
@@ -447,10 +436,11 @@ void adm1021_update_client(struct i2c_client *client)
 }
 
 
-void adm1021_temp(struct i2c_client *client, int operation, int ctl_name,
-                 int *nrels_mag, long *results)
+static void adm1021_temp(struct i2c_client *client, int operation,
+                        int ctl_name, int *nrels_mag, long *results)
 {
        struct adm1021_data *data = client->data;
+
        if (operation == SENSORS_PROC_REAL_INFO)
                *nrels_mag = 0;
        else if (operation == SENSORS_PROC_REAL_READ) {
@@ -473,8 +463,8 @@ void adm1021_temp(struct i2c_client *client, int operation, int ctl_name,
        }
 }
 
-void adm1021_remote_temp(struct i2c_client *client, int operation,
-                        int ctl_name, int *nrels_mag, long *results)
+static void adm1021_remote_temp(struct i2c_client *client, int operation,
+                               int ctl_name, int *nrels_mag, long *results)
 {
        struct adm1021_data *data = client->data;
        int prec = 0;
@@ -546,10 +536,11 @@ void adm1021_remote_temp(struct i2c_client *client, int operation,
        }
 }
 
-void adm1021_die_code(struct i2c_client *client, int operation,
-                     int ctl_name, int *nrels_mag, long *results)
+static void adm1021_die_code(struct i2c_client *client, int operation,
+                            int ctl_name, int *nrels_mag, long *results)
 {
        struct adm1021_data *data = client->data;
+
        if (operation == SENSORS_PROC_REAL_INFO)
                *nrels_mag = 0;
        else if (operation == SENSORS_PROC_REAL_READ) {
@@ -561,8 +552,8 @@ void adm1021_die_code(struct i2c_client *client, int operation,
        }
 }
 
-void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name,
-                   int *nrels_mag, long *results)
+static void adm1021_alarms(struct i2c_client *client, int operation,
+                          int ctl_name, int *nrels_mag, long *results)
 {
        struct adm1021_data *data = client->data;
        if (operation == SENSORS_PROC_REAL_INFO)
@@ -578,7 +569,6 @@ void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name,
 
 static int __init sensors_adm1021_init(void)
 {
-
        return i2c_add_driver(&adm1021_driver);
 }
 
index e628f4418420910369eae466aec49adb22c34032..0ab250105a5a48f314617950267a428bf5bfbefb 100644 (file)
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/version.h>
 #include <linux/module.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/i2c-proc.h>
-#include <linux/init.h>
 
 
 #define LM75_SYSCTL_TEMP 1200  /* Degrees Celcius * 10 */
@@ -72,8 +71,6 @@ static int lm75_detect(struct i2c_adapter *adapter, int address,
                       unsigned short flags, int kind);
 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 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);
@@ -84,12 +81,12 @@ 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,
 };
 
 /* These files are created for each detected LM75. This is just a template;
@@ -105,14 +102,14 @@ 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);
 }
 
 /* This function is called by i2c_detect */
-int lm75_detect(struct i2c_adapter *adapter, int address,
-               unsigned short flags, int kind)
+static int lm75_detect(struct i2c_adapter *adapter, int address,
+                      unsigned short flags, int kind)
 {
        int i, cur, conf, hyst, os;
        struct i2c_client *new_client;
@@ -217,7 +214,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;
 
@@ -227,12 +224,7 @@ int lm75_detach_client(struct i2c_client *client)
        return 0;
 }
 
-int lm75_command(struct i2c_client *client, unsigned int cmd, void *arg)
-{
-       return 0;
-}
-
-u16 swap_bytes(u16 val)
+static u16 swap_bytes(u16 val)
 {
        return (val >> 8) | (val << 8);
 }
@@ -240,7 +232,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);
@@ -251,7 +243,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);
@@ -260,7 +252,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,
@@ -270,7 +262,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;
 
@@ -292,8 +284,8 @@ void lm75_update_client(struct i2c_client *client)
 }
 
 
-void lm75_temp(struct i2c_client *client, int operation, int ctl_name,
-              int *nrels_mag, long *results)
+static void lm75_temp(struct i2c_client *client, int operation, int ctl_name,
+                     int *nrels_mag, long *results)
 {
        struct lm75_data *data = client->data;
        if (operation == SENSORS_PROC_REAL_INFO)
@@ -318,7 +310,7 @@ void lm75_temp(struct i2c_client *client, int operation, int ctl_name,
        }
 }
 
-int __init sensors_lm75_init(void)
+static int __init sensors_lm75_init(void)
 {
        return i2c_add_driver(&lm75_driver);
 }
index 73b9f304493c38a426e370f2988e6406e03e719b..6be618f5a14141c8e29190fa815266b8ebc35660 100644 (file)
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-algo-bit.c,v 1.37 2002/07/08 00:41:49 mds Exp $ */
+/* $Id: i2c-algo-bit.c,v 1.44 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/version.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
-#include <linux/ioport.h>
 #include <linux/errno.h>
-
+#include <linux/sched.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
 
+
 /* ----- global defines ----------------------------------------------- */
 #define DEB(x) if (i2c_debug>=1) x;
 #define DEB2(x) if (i2c_debug>=2) x;
index ffa237cfa2f4e20bebfc54471a4cabd89463bb64..429dad07a52379793d993143bc0911d14f9ee25d 100644 (file)
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/version.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
-#include <linux/ioport.h>
 #include <linux/errno.h>
-
 #include <linux/i2c.h>
 #include <linux/i2c-algo-pcf.h>
 #include "i2c-pcf8584.h"
 
+
 /* ----- global defines ----------------------------------------------- */
 #define DEB(x) if (i2c_debug>=1) x
 #define DEB2(x) if (i2c_debug>=2) x
index 14d0081b98fe0c28a973370fd7c8715ce893601a..da7934d2f97807ed967dc37bb359d3bad0417b50 100644 (file)
 /* The devfs code is contributed by Philipp Matthias Hahn 
    <pmhahn@titan.lahn.de> */
 
-/* $Id: i2c-dev.c,v 1.48 2002/10/01 14:10:04 ac9410 Exp $ */
+/* $Id: i2c-dev.c,v 1.53 2003/01/21 08:08:16 kmalkki Exp $ */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/slab.h>
-#include <linux/version.h>
 #include <linux/smp_lock.h>
 #include <linux/devfs_fs_kernel.h>
-
+#include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
+#include <asm/uaccess.h>
 
 /* If you want debugging uncomment: */
 /* #define DEBUG */
 
-#include <linux/init.h>
-#include <asm/uaccess.h>
-#include <linux/i2c.h>
-#include <linux/i2c-dev.h>
 
 /* struct file_operations changed too often in the 2.1 series for nice code */
 
@@ -107,9 +104,9 @@ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
 
        struct i2c_client *client = (struct i2c_client *)file->private_data;
 
-       if(count > 8192)
+       if (count > 8192)
                count = 8192;
-               
+
        /* copy user space data to kernel space. */
        tmp = kmalloc(count,GFP_KERNEL);
        if (tmp==NULL)
index b4c74e564813cace0ee6f77f41690bde213fe2d4..54626a0e57fdf5f7e1e621cde6b94ea177aa8887 100644 (file)
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-elv.c,v 1.21 2001/11/19 18:45:02 mds Exp $ */
+/* $Id: i2c-elv.c,v 1.27 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/version.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
 #include <linux/ioport.h>
-#include <asm/io.h>
 #include <linux/errno.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
+#include <asm/io.h>
 
 #define DEFAULT_BASE 0x378
 static int base=0;
@@ -120,12 +118,13 @@ fail:
  * This is only done when more than one hardware adapter is supported.
  */
 static struct i2c_algo_bit_data bit_elv_data = {
-       NULL,
-       bit_elv_setsda,
-       bit_elv_setscl,
-       bit_elv_getsda,
-       bit_elv_getscl,
-       80, 80, 100,            /*      waits, timeout */
+       .setsda         = bit_elv_setsda,
+       .setscl         = bit_elv_setscl,
+       .getsda         = bit_elv_getsda,
+       .getscl         = bit_elv_getscl,
+       .udelay         = 80,
+       .mdelay         = 80,
+       .timeout        = HZ
 };
 
 static struct i2c_adapter bit_elv_ops = {
index 80f6cffcc13fd1039ff54a04e44badb61e343c13..fa4f3bec85b1f7afaa442c206ba79cafa1340d0a 100644 (file)
  * version 2 as published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
-#include <linux/version.h>
 #include <linux/module.h>
-
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-
-#include <asm/hardware.h>
-
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
+#include <asm/hardware.h>
+
 
 static void frodo_setsda (void *data,int state)
 {
@@ -58,7 +54,7 @@ static struct i2c_algo_bit_data bit_frodo_data = {
        .getscl         = frodo_getscl,
        .udelay         = 80,
        .mdelay         = 80,
-       .timeout        = 100
+       .timeout        = HZ
 };
 
 static struct i2c_adapter frodo_ops = {
index b489b5f37114e79f1fb9cb5dc8e65d82554adf8c..e4965c320271a5f07073ff5a870b3be4012503e5 100644 (file)
@@ -21,7 +21,7 @@
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-philips-par.c,v 1.23 2002/02/06 08:50:58 simon Exp $ */
+/* $Id: i2c-philips-par.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
 
-#ifndef __exit
-#define __exit __init
-#endif
-
 static int type;
 
 struct i2c_par
@@ -135,21 +131,22 @@ static int bit_lp_getsda2(void *data)
  */
  
 static struct i2c_algo_bit_data bit_lp_data = {
-       NULL,
-       bit_lp_setsda,
-       bit_lp_setscl,
-       bit_lp_getsda,
-       bit_lp_getscl,
-       80, 80, 100,            /*      waits, timeout */
+       .setsda         = bit_lp_setsda,
+       .setscl         = bit_lp_setscl,
+       .getsda         = bit_lp_getsda,
+       .getscl         = bit_lp_getscl,
+       .udelay         = 80,
+       .mdelay         = 80,
+       .timeout        = HZ
 }; 
 
 static struct i2c_algo_bit_data bit_lp_data2 = {
-       NULL,
-       bit_lp_setsda2,
-       bit_lp_setscl2,
-       bit_lp_getsda2,
-       NULL,
-       80, 80, 100,            /*      waits, timeout */
+       .setsda         = bit_lp_setsda2,
+       .setscl         = bit_lp_setscl2,
+       .getsda         = bit_lp_getsda2,
+       .udelay         = 80,
+       .mdelay         = 80,
+       .timeout        = HZ
 }; 
 
 static struct i2c_adapter bit_lp_ops = {
index ab462d034e228c1e383e58263270efe2b53f54f8..a109bf62fdcd04b37fd158288c891653c2dc8d39 100644 (file)
 #include <linux/ctype.h>
 #include <linux/sysctl.h>
 #include <linux/proc_fs.h>
+#include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/i2c.h>
 #include <linux/i2c-proc.h>
-#include <linux/init.h>
 #include <asm/uaccess.h>
 
 static int i2c_create_name(char **name, const char *prefix,
@@ -87,7 +87,7 @@ static struct ctl_table_header *i2c_proc_header;
    (for a LM78 chip on the ISA bus at port 0x310), or lm75-i2c-3-4e (for
    a LM75 chip on the third i2c bus at address 0x4e).  
    name is allocated first. */
-int i2c_create_name(char **name, const char *prefix,
+static int i2c_create_name(char **name, const char *prefix,
                        struct i2c_adapter *adapter, int addr)
 {
        char name_buffer[50];
@@ -200,7 +200,8 @@ void i2c_deregister_entry(int id)
 {
        ctl_table *table;
        char *temp;
-       id -= 256;
+
+       id -= 256;      
        if (i2c_entries[id]) {
                table = i2c_entries[id]->ctl_table;
                unregister_sysctl_table(i2c_entries[id]);
@@ -213,7 +214,7 @@ void i2c_deregister_entry(int id)
        }
 }
 
-int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
+static int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
                       void *buffer, size_t * lenp)
 {
        char BUF[SENSORS_PREFIX_MAX + 30];
@@ -251,7 +252,7 @@ int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
        return 0;
 }
 
-int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
+static int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
                         void *oldval, size_t * oldlenp, void *newval,
                         size_t newlen, void **context)
 {
@@ -413,7 +414,7 @@ int i2c_sysctl_real(ctl_table * table, int *name, int nlen,
    WARNING! This is tricky code. I have tested it, but there may still be
             hidden bugs in it, even leading to crashes and things!
 */
-int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
+static int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
                         long *results, int magnitude)
 {
        int maxels, min, mag;
@@ -822,11 +823,11 @@ static void __exit i2c_proc_exit(void)
        unregister_sysctl_table(i2c_proc_header);
 }
 
+EXPORT_SYMBOL(i2c_register_entry);
 EXPORT_SYMBOL(i2c_deregister_entry);
-EXPORT_SYMBOL(i2c_detect);
 EXPORT_SYMBOL(i2c_proc_real);
-EXPORT_SYMBOL(i2c_register_entry);
 EXPORT_SYMBOL(i2c_sysctl_real);
+EXPORT_SYMBOL(i2c_detect);
 
 MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
 MODULE_DESCRIPTION("i2c-proc driver");
index 389b738641c80cb8dc3686ffb13047575fb47055..8db56630b86a214bbbfa85168451b7b852bc5ec1 100644 (file)
 #include <linux/init.h>
 #include <linux/stddef.h>
 #include <linux/parport.h>
-
+#include <linux/i2c.h>
+#include <linux/i2c-algo-8xx.h>
 #include <asm/mpc8xx.h>
 #include <asm/commproc.h>
 
-#include <linux/i2c.h>
-#include <linux/i2c-algo-8xx.h>
 
 static void
 rpx_iic_init(struct i2c_algo_8xx_data *data)
index b158fc59a656623a63bcd258479b57febd24b2d0..807c190412c846a70da9b3aa9459c8683cda8295 100644 (file)
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.               */
 /* ------------------------------------------------------------------------- */
 
-/* $Id: i2c-velleman.c,v 1.23 2001/11/19 18:45:02 mds Exp $ */
+/* $Id: i2c-velleman.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/string.h>  /* for 2.0 kernels to get NULL   */
-#include <asm/errno.h>     /* for 2.0 kernels to get ENODEV */
-#include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
+#include <asm/io.h>
 
 /* ----- global defines -----------------------------------------------        */
 #define DEB(x)         /* should be reasonable open, close &c.         */
@@ -104,12 +103,13 @@ static int bit_velle_init(void)
  */
 
 static struct i2c_algo_bit_data bit_velle_data = {
-       NULL,
-       bit_velle_setsda,
-       bit_velle_setscl,
-       bit_velle_getsda,
-       bit_velle_getscl,
-       10, 10, 100,            /*      waits, timeout */
+       .setsda         = bit_velle_setsda,
+       .setscl         = bit_velle_setscl,
+       .getsda         = bit_velle_getsda,
+       .getscl         = bit_velle_getscl,
+       .udelay         = 10,
+       .mdelay         = 10,
+       .timeout        = HZ
 };
 
 static struct i2c_adapter bit_velle_ops = {
index fea550f163d9c393a08b89bae0ac5dac80ab50b8..1109044812383870f9565aeec428bfaf2294ba6b 100644 (file)
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-algo-bit.h,v 1.7 1999/12/21 23:45:58 frodo Exp $ */
+/* $Id: i2c-algo-bit.h,v 1.10 2003/01/21 08:08:16 kmalkki Exp $ */
 
-#ifndef I2C_ALGO_BIT_H
-#define I2C_ALGO_BIT_H 1
-
-#include <linux/i2c.h>
+#ifndef _LINUX_I2C_ALGO_BIT_H
+#define _LINUX_I2C_ALGO_BIT_H
 
 /* --- Defines for bit-adapters ---------------------------------------        */
 /*
@@ -53,4 +51,4 @@ struct i2c_algo_bit_data {
 int i2c_bit_add_bus(struct i2c_adapter *);
 int i2c_bit_del_bus(struct i2c_adapter *);
 
-#endif /* I2C_ALGO_BIT_H */
+#endif /* _LINUX_I2C_ALGO_BIT_H */
index 892d737ca96c6479566267001270413e4dfda904..2a508562255f7fecbdd03dc26e90d4d0a16a1edb 100644 (file)
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c-algo-pcf.h,v 1.7 2000/02/27 23:02:45 frodo Exp $ */
+/* $Id: i2c-algo-pcf.h,v 1.8 2003/01/21 08:08:16 kmalkki Exp $ */
 
-#ifndef I2C_ALGO_PCF_H
-#define I2C_ALGO_PCF_H 1
-
-/* --- Defines for pcf-adapters ---------------------------------------        */
-#include <linux/i2c.h>
+#ifndef _LINUX_I2C_ALGO_PCF_H
+#define _LINUX_I2C_ALGO_PCF_H
 
 struct i2c_algo_pcf_data {
        void *data;             /* private data for lolevel routines    */
@@ -49,4 +46,4 @@ struct i2c_algo_pcf_data {
 int i2c_pcf_add_bus(struct i2c_adapter *);
 int i2c_pcf_del_bus(struct i2c_adapter *);
 
-#endif /* I2C_ALGO_PCF_H */
+#endif /* _LINUX_I2C_ALGO_PCF_H */
index 84bede1ed6aca28b974567129b9091c2c119a5dd..3803c36293a898d88301f53c91cdddad8f410509 100644 (file)
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* $Id: i2c-dev.h,v 1.11 2002/07/07 15:42:47 mds Exp $ */
+/* $Id: i2c-dev.h,v 1.13 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #ifndef _LINUX_I2C_DEV_H
 #define _LINUX_I2C_DEV_H
 
 #include <linux/types.h>
-#include <linux/i2c.h>
 
 /* Some IOCTL commands are defined in <linux/i2c.h> */
 /* Note: 10-bit addresses are NOT supported! */
index 0061776f040203e069ceafe8c84c9270883dda8a..fbdb019dcc2bf1436d59c3316f52d39ea756b7b0 100644 (file)
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.               */
 /* ------------------------------------------------------------------------- */
 
-/* $Id: i2c-id.h,v 1.56 2002/10/13 15:50:02 mds Exp $ */
+/* $Id: i2c-id.h,v 1.63 2003/01/21 08:08:16 kmalkki Exp $ */
+
+#ifndef LINUX_I2C_ID_H
+#define LINUX_I2C_ID_H
 
-#ifndef I2C_ID_H
-#define I2C_ID_H
 /*
  * This file is part of the i2c-bus package and contains the identifier
  * values for drivers, adapters and other folk populating these serial
@@ -95,7 +96,8 @@
 #define I2C_DRIVERID_ADV717x   48     /* ADV 7175/7176 video encoder   */
 #define I2C_DRIVERID_ZR36067   49     /* Zoran 36067 video encoder     */
 #define I2C_DRIVERID_ZR36120   50     /* Zoran 36120 video encoder     */
-#define I2C_DRIVERID_24LC32A   51              /* Microchip 24LC32A 32k EEPROM */
+#define I2C_DRIVERID_24LC32A   51      /* Microchip 24LC32A 32k EEPROM */
+#define I2C_DRIVERID_STM41T00  52      /* real time clock              */
 
 
 
 #define I2C_DRIVERID_SMARTBATT 1035
 #define I2C_DRIVERID_BMCSENSORS 1036
 #define I2C_DRIVERID_FS451 1037
+#define I2C_DRIVERID_W83627HF 1038
 
 /*
  * ---- Adapter types ----------------------------------------------------
 
 #define I2C_ALGO_MPC8XX 0x110000       /* MPC8xx PowerPC I2C algorithm */
 #define I2C_ALGO_OCP    0x120000       /* IBM or otherwise On-chip I2C algorithm */
+#define I2C_ALGO_BITHS 0x130000        /* enhanced bit style adapters  */
 
 #define I2C_ALGO_EXP   0x800000        /* experimental                 */
 
 /* --- IPMB adapter                                            */
 #define I2C_HW_IPMB 0x00
 
-#endif /* I2C_ID_H */
+#endif /* LINUX_I2C_ID_H */
index ccdd2a95b1d1cf50d2da45cd356502c1cc6725ca..c1433e5f916b71608061e28175e658e3ffe93024 100644 (file)
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#ifndef SENSORS_SENSORS_H
-#define SENSORS_SENSORS_H
+#ifndef _LINUX_I2C_PROC_H
+#define _LINUX_I2C_PROC_H
 
-#ifdef __KERNEL__
-
-/* Next two must be included before sysctl.h can be included, in 2.0 kernels */
-#include <linux/types.h>
-#include <linux/fs.h>
 #include <linux/sysctl.h>
 
 /* The type of callback functions used in sensors_{proc,sysctl}_real */
@@ -388,7 +383,7 @@ extern int i2c_detect(struct i2c_adapter *adapter,
 
 /* This macro is used to scale user-input to sensible values in almost all
    chip drivers. */
-extern inline int SENSORS_LIMIT(long value, long low, long high)
+static inline int SENSORS_LIMIT(long value, long low, long high)
 {
        if (value < low)
                return low;
@@ -398,8 +393,6 @@ extern inline int SENSORS_LIMIT(long value, long low, long high)
                return value;
 }
 
-#endif                         /* def __KERNEL__ */
-
 
 /* The maximum length of the prefix */
 #define SENSORS_PREFIX_MAX 20
@@ -418,5 +411,5 @@ struct i2c_chips_data {
        char name[SENSORS_PREFIX_MAX + 13];
 };
 
-#endif                         /* def SENSORS_SENSORS_H */
+#endif                         /* def _LINUX_I2C_PROC_H */
 
index de3dc122f0591a5e945d24f9dafcd2c2d3eb6eba..083081de5020787ff8fc02ea57e2bd19bf9f6584 100644 (file)
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
    Frodo Looijaard <frodol@dds.nl> */
 
-/* $Id: i2c.h,v 1.59 2002/07/19 20:53:45 phil Exp $ */
+/* $Id: i2c.h,v 1.68 2003/01/21 08:08:16 kmalkki Exp $ */
 
 #ifndef _LINUX_I2C_H
 #define _LINUX_I2C_H
 
-#define I2C_DATE "20020719"
-#define I2C_VERSION "2.6.4"
+#define I2C_DATE "20021208"
+#define I2C_VERSION "2.7.0"
 
-#include <linux/i2c-id.h>      /* id values of adapters et. al.        */
+#include <linux/module.h>
 #include <linux/types.h>
-#include <linux/config.h>
+#include <linux/i2c-id.h>
 #include <asm/semaphore.h>
 
-
 /* --- General options ------------------------------------------------        */
 
 #define I2C_ALGO_MAX   4               /* control memory consumption   */