Commit 555e8cee authored by Albert Cranford's avatar Albert Cranford Committed by Linus Torvalds

[PATCH] 2.5.23 i2c updates 2/4

i2c-core.c:Leave LINUX_VERSION in kernel.  Leave i2c_debug=1.  Leave
  CONFIG names as in the kernel.  Remove #ifdef MODULE_LICENSE around
  MODULE_LICENSE.
i2c-dev.c:Remove #ifdef MODULE_LICENSE around MODULE_LICENSE.
  Remove compatibality code for < 2.4.0
i2c-proc.c: Print message on kmalloc failure.  Leave ENOMEM as in kernel.
  Remove #ifdef MODULE_LICENSE around MODULE_LICENSE.  Remove 2.2.19 compat
  code.
parent 3fc6e4a7
This diff is collapsed.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/* The devfs code is contributed by Philipp Matthias Hahn /* The devfs code is contributed by Philipp Matthias Hahn
<pmhahn@titan.lahn.de> */ <pmhahn@titan.lahn.de> */
/* $Id: i2c-dev.c,v 1.40 2001/08/25 01:28:01 mds Exp $ */ /* $Id: i2c-dev.c,v 1.44 2001/11/19 18:45:02 mds Exp $ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-dev.h> #include <linux/i2c-dev.h>
...@@ -140,7 +139,7 @@ loff_t i2cdev_lseek (struct file *file, loff_t offset, int origin) ...@@ -140,7 +139,7 @@ loff_t i2cdev_lseek (struct file *file, loff_t offset, int origin)
{ {
#ifdef DEBUG #ifdef DEBUG
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
printk("i2c-dev.o: i2c-%d lseek to %ld bytes relative to %d.\n", printk(KERN_DEBUG "i2c-dev.o: i2c-%d lseek to %ld bytes relative to %d.\n",
minor(inode->i_rdev),(long) offset,origin); minor(inode->i_rdev),(long) offset,origin);
#endif /* DEBUG */ #endif /* DEBUG */
return -ESPIPE; return -ESPIPE;
...@@ -165,7 +164,7 @@ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count, ...@@ -165,7 +164,7 @@ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
return -ENOMEM; return -ENOMEM;
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: i2c-%d reading %d bytes.\n",minor(inode->i_rdev), printk(KERN_DEBUG "i2c-dev.o: i2c-%d reading %d bytes.\n",minor(inode->i_rdev),
count); count);
#endif #endif
...@@ -197,7 +196,7 @@ static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count, ...@@ -197,7 +196,7 @@ static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,
} }
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: i2c-%d writing %d bytes.\n",minor(inode->i_rdev), printk(KERN_DEBUG "i2c-dev.o: i2c-%d writing %d bytes.\n",minor(inode->i_rdev),
count); count);
#endif #endif
ret = i2c_master_send(client,tmp,count); ret = i2c_master_send(client,tmp,count);
...@@ -217,7 +216,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, ...@@ -217,7 +216,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
unsigned long funcs; unsigned long funcs;
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: i2c-%d ioctl, cmd: 0x%x, arg: %lx.\n", printk(KERN_DEBUG "i2c-dev.o: i2c-%d ioctl, cmd: 0x%x, arg: %lx.\n",
minor(inode->i_rdev),cmd, arg); minor(inode->i_rdev),cmd, arg);
#endif /* DEBUG */ #endif /* DEBUG */
...@@ -315,7 +314,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, ...@@ -315,7 +314,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
(data_arg.size != I2C_SMBUS_BLOCK_DATA) && (data_arg.size != I2C_SMBUS_BLOCK_DATA) &&
(data_arg.size != I2C_SMBUS_I2C_BLOCK_DATA)) { (data_arg.size != I2C_SMBUS_I2C_BLOCK_DATA)) {
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: size out of range (%x) in ioctl I2C_SMBUS.\n", printk(KERN_DEBUG "i2c-dev.o: size out of range (%x) in ioctl I2C_SMBUS.\n",
data_arg.size); data_arg.size);
#endif #endif
return -EINVAL; return -EINVAL;
...@@ -325,7 +324,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, ...@@ -325,7 +324,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
if ((data_arg.read_write != I2C_SMBUS_READ) && if ((data_arg.read_write != I2C_SMBUS_READ) &&
(data_arg.read_write != I2C_SMBUS_WRITE)) { (data_arg.read_write != I2C_SMBUS_WRITE)) {
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: read_write out of range (%x) in ioctl I2C_SMBUS.\n", printk(KERN_DEBUG "i2c-dev.o: read_write out of range (%x) in ioctl I2C_SMBUS.\n",
data_arg.read_write); data_arg.read_write);
#endif #endif
return -EINVAL; return -EINVAL;
...@@ -345,7 +344,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, ...@@ -345,7 +344,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
if (data_arg.data == NULL) { if (data_arg.data == NULL) {
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: data is NULL pointer in ioctl I2C_SMBUS.\n"); printk(KERN_DEBUG "i2c-dev.o: data is NULL pointer in ioctl I2C_SMBUS.\n");
#endif #endif
return -EINVAL; return -EINVAL;
} }
...@@ -387,7 +386,7 @@ int i2cdev_open (struct inode *inode, struct file *file) ...@@ -387,7 +386,7 @@ int i2cdev_open (struct inode *inode, struct file *file)
if ((minor >= I2CDEV_ADAPS_MAX) || ! (i2cdev_adaps[minor])) { if ((minor >= I2CDEV_ADAPS_MAX) || ! (i2cdev_adaps[minor])) {
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: Trying to open unattached adapter i2c-%d\n", printk(KERN_DEBUG "i2c-dev.o: Trying to open unattached adapter i2c-%d\n",
minor); minor);
#endif #endif
return -ENODEV; return -ENODEV;
...@@ -408,7 +407,7 @@ int i2cdev_open (struct inode *inode, struct file *file) ...@@ -408,7 +407,7 @@ int i2cdev_open (struct inode *inode, struct file *file)
#endif /* LINUX_KERNEL_VERSION < KERNEL_VERSION(2,4,0) */ #endif /* LINUX_KERNEL_VERSION < KERNEL_VERSION(2,4,0) */
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: opened i2c-%d\n",minor); printk(KERN_DEBUG "i2c-dev.o: opened i2c-%d\n",minor);
#endif #endif
return 0; return 0;
} }
...@@ -419,13 +418,18 @@ static int i2cdev_release (struct inode *inode, struct file *file) ...@@ -419,13 +418,18 @@ static int i2cdev_release (struct inode *inode, struct file *file)
kfree(file->private_data); kfree(file->private_data);
file->private_data=NULL; file->private_data=NULL;
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: Closed: i2c-%d\n", minor); printk(KERN_DEBUG "i2c-dev.o: Closed: i2c-%d\n", minor);
#endif #endif
#if LINUX_KERNEL_VERSION < KERNEL_VERSION(2,4,0) #if LINUX_KERNEL_VERSION < KERNEL_VERSION(2,4,0)
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
#else /* LINUX_KERNEL_VERSION >= KERNEL_VERSION(2,4,0) */
lock_kernel();
#endif /* LINUX_KERNEL_VERSION < KERNEL_VERSION(2,4,0) */ #endif /* LINUX_KERNEL_VERSION < KERNEL_VERSION(2,4,0) */
if (i2cdev_adaps[minor]->dec_use) if (i2cdev_adaps[minor]->dec_use)
i2cdev_adaps[minor]->dec_use(i2cdev_adaps[minor]); i2cdev_adaps[minor]->dec_use(i2cdev_adaps[minor]);
#if LINUX_KERNEL_VERSION >= KERNEL_VERSION(2,4,0)
unlock_kernel();
#endif /* LINUX_KERNEL_VERSION >= KERNEL_VERSION(2,4,0) */
return 0; return 0;
} }
...@@ -435,11 +439,11 @@ int i2cdev_attach_adapter(struct i2c_adapter *adap) ...@@ -435,11 +439,11 @@ int i2cdev_attach_adapter(struct i2c_adapter *adap)
char name[8]; char name[8];
if ((i = i2c_adapter_id(adap)) < 0) { if ((i = i2c_adapter_id(adap)) < 0) {
printk("i2c-dev.o: Unknown adapter ?!?\n"); printk(KERN_DEBUG "i2c-dev.o: Unknown adapter ?!?\n");
return -ENODEV; return -ENODEV;
} }
if (i >= I2CDEV_ADAPS_MAX) { if (i >= I2CDEV_ADAPS_MAX) {
printk("i2c-dev.o: Adapter number too large?!? (%d)\n",i); printk(KERN_DEBUG "i2c-dev.o: Adapter number too large?!? (%d)\n",i);
return -ENODEV; return -ENODEV;
} }
...@@ -452,7 +456,7 @@ int i2cdev_attach_adapter(struct i2c_adapter *adap) ...@@ -452,7 +456,7 @@ int i2cdev_attach_adapter(struct i2c_adapter *adap)
S_IFCHR | S_IRUSR | S_IWUSR, S_IFCHR | S_IRUSR | S_IWUSR,
&i2cdev_fops, NULL); &i2cdev_fops, NULL);
#endif #endif
printk("i2c-dev.o: Registered '%s' as minor %d\n",adap->name,i); printk(KERN_DEBUG "i2c-dev.o: Registered '%s' as minor %d\n",adap->name,i);
} else { } else {
/* This is actually a detach_adapter call! */ /* This is actually a detach_adapter call! */
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
...@@ -460,7 +464,7 @@ int i2cdev_attach_adapter(struct i2c_adapter *adap) ...@@ -460,7 +464,7 @@ int i2cdev_attach_adapter(struct i2c_adapter *adap)
#endif #endif
i2cdev_adaps[i] = NULL; i2cdev_adaps[i] = NULL;
#ifdef DEBUG #ifdef DEBUG
printk("i2c-dev.o: Adapter unregistered: %s\n",adap->name); printk(KERN_DEBUG "i2c-dev.o: Adapter unregistered: %s\n",adap->name);
#endif #endif
} }
...@@ -482,7 +486,7 @@ int __init i2c_dev_init(void) ...@@ -482,7 +486,7 @@ int __init i2c_dev_init(void)
{ {
int res; int res;
printk("i2c-dev.o: i2c /dev entries driver module\n"); printk(KERN_INFO "i2c-dev.o: i2c /dev entries driver module version %s (%s)\n", I2C_VERSION, I2C_DATE);
i2cdev_initialized = 0; i2cdev_initialized = 0;
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
...@@ -490,7 +494,7 @@ int __init i2c_dev_init(void) ...@@ -490,7 +494,7 @@ int __init i2c_dev_init(void)
#else #else
if (register_chrdev(I2C_MAJOR,"i2c",&i2cdev_fops)) { if (register_chrdev(I2C_MAJOR,"i2c",&i2cdev_fops)) {
#endif #endif
printk("i2c-dev.o: unable to get major %d for i2c bus\n", printk(KERN_ERR "i2c-dev.o: unable to get major %d for i2c bus\n",
I2C_MAJOR); I2C_MAJOR);
return -EIO; return -EIO;
} }
...@@ -500,7 +504,7 @@ int __init i2c_dev_init(void) ...@@ -500,7 +504,7 @@ int __init i2c_dev_init(void)
i2cdev_initialized ++; i2cdev_initialized ++;
if ((res = i2c_add_driver(&i2cdev_driver))) { if ((res = i2c_add_driver(&i2cdev_driver))) {
printk("i2c-dev.o: Driver registration failed, module not inserted.\n"); printk(KERN_ERR "i2c-dev.o: Driver registration failed, module not inserted.\n");
i2cdev_cleanup(); i2cdev_cleanup();
return res; return res;
} }
...@@ -514,7 +518,7 @@ int i2cdev_cleanup(void) ...@@ -514,7 +518,7 @@ int i2cdev_cleanup(void)
if (i2cdev_initialized >= 2) { if (i2cdev_initialized >= 2) {
if ((res = i2c_del_driver(&i2cdev_driver))) { if ((res = i2c_del_driver(&i2cdev_driver))) {
printk("i2c-dev.o: Driver deregistration failed, " printk(KERN_ERR "i2c-dev.o: Driver deregistration failed, "
"module not removed.\n"); "module not removed.\n");
return res; return res;
} }
...@@ -528,7 +532,7 @@ int i2cdev_cleanup(void) ...@@ -528,7 +532,7 @@ int i2cdev_cleanup(void)
#else #else
if ((res = unregister_chrdev(I2C_MAJOR,"i2c"))) { if ((res = unregister_chrdev(I2C_MAJOR,"i2c"))) {
#endif #endif
printk("i2c-dev.o: unable to release major %d for i2c bus\n", printk(KERN_ERR "i2c-dev.o: unable to release major %d for i2c bus\n",
I2C_MAJOR); I2C_MAJOR);
return res; return res;
} }
......
...@@ -32,16 +32,10 @@ ...@@ -32,16 +32,10 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-proc.h> #include <linux/i2c-proc.h>
#include <linux/init.h> #include <linux/init.h>
/* FIXME need i2c versioning */
#define LM_DATE "20010825"
#define LM_VERSION "2.6.1"
#ifndef THIS_MODULE #ifndef THIS_MODULE
#define THIS_MODULE NULL #define THIS_MODULE NULL
#endif #endif
...@@ -175,6 +169,7 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix, ...@@ -175,6 +169,7 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
new_table[i].extra2 = client; new_table[i].extra2 = client;
if (!(new_header = register_sysctl_table(new_table, 0))) { if (!(new_header = register_sysctl_table(new_table, 0))) {
printk(KERN_ERR "i2c-proc.o: error: sysctl interface not supported by kernel!\n");
kfree(new_table); kfree(new_table);
kfree(name); kfree(name);
return -ENOMEM; return -ENOMEM;
...@@ -189,7 +184,7 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix, ...@@ -189,7 +184,7 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
!new_header->ctl_table->child->child || !new_header->ctl_table->child->child ||
!new_header->ctl_table->child->child->de) { !new_header->ctl_table->child->child->de) {
printk printk
("i2c-proc.o: NULL pointer when trying to install fill_inode fix!\n"); (KERN_ERR "i2c-proc.o: NULL pointer when trying to install fill_inode fix!\n");
return id; return id;
} }
#endif /* DEBUG */ #endif /* DEBUG */
...@@ -629,7 +624,7 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -629,7 +624,7 @@ int i2c_detect(struct i2c_adapter *adapter,
&& (addr == this_force->force[j + 1])) { && (addr == this_force->force[j + 1])) {
#ifdef DEBUG #ifdef DEBUG
printk printk
("i2c-proc.o: found force parameter for adapter %d, addr %04x\n", (KERN_DEBUG "i2c-proc.o: found force parameter for adapter %d, addr %04x\n",
adapter_id, addr); adapter_id, addr);
#endif #endif
if ( if (
...@@ -659,7 +654,7 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -659,7 +654,7 @@ int i2c_detect(struct i2c_adapter *adapter,
&& (addr == address_data->ignore[i + 1])) { && (addr == address_data->ignore[i + 1])) {
#ifdef DEBUG #ifdef DEBUG
printk printk
("i2c-proc.o: found ignore parameter for adapter %d, " (KERN_DEBUG "i2c-proc.o: found ignore parameter for adapter %d, "
"addr %04x\n", adapter_id, addr); "addr %04x\n", adapter_id, addr);
#endif #endif
found = 1; found = 1;
...@@ -679,7 +674,7 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -679,7 +674,7 @@ int i2c_detect(struct i2c_adapter *adapter,
&& (addr <= address_data->ignore_range[i + 2])) { && (addr <= address_data->ignore_range[i + 2])) {
#ifdef DEBUG #ifdef DEBUG
printk printk
("i2c-proc.o: found ignore_range parameter for adapter %d, " (KERN_DEBUG "i2c-proc.o: found ignore_range parameter for adapter %d, "
"addr %04x\n", adapter_id, addr); "addr %04x\n", adapter_id, addr);
#endif #endif
found = 1; found = 1;
...@@ -698,7 +693,7 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -698,7 +693,7 @@ int i2c_detect(struct i2c_adapter *adapter,
if (addr == address_data->normal_isa[i]) { if (addr == address_data->normal_isa[i]) {
#ifdef DEBUG #ifdef DEBUG
printk printk
("i2c-proc.o: found normal isa entry for adapter %d, " (KERN_DEBUG "i2c-proc.o: found normal isa entry for adapter %d, "
"addr %04x\n", adapter_id, "addr %04x\n", adapter_id,
addr); addr);
#endif #endif
...@@ -720,7 +715,7 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -720,7 +715,7 @@ int i2c_detect(struct i2c_adapter *adapter,
0)) { 0)) {
#ifdef DEBUG #ifdef DEBUG
printk printk
("i2c-proc.o: found normal isa_range entry for adapter %d, " (KERN_DEBUG "i2c-proc.o: found normal isa_range entry for adapter %d, "
"addr %04x", adapter_id, addr); "addr %04x", adapter_id, addr);
#endif #endif
found = 1; found = 1;
...@@ -734,7 +729,7 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -734,7 +729,7 @@ int i2c_detect(struct i2c_adapter *adapter,
found = 1; found = 1;
#ifdef DEBUG #ifdef DEBUG
printk printk
("i2c-proc.o: found normal i2c entry for adapter %d, " (KERN_DEBUG "i2c-proc.o: found normal i2c entry for adapter %d, "
"addr %02x", adapter_id, addr); "addr %02x", adapter_id, addr);
#endif #endif
} }
...@@ -750,7 +745,7 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -750,7 +745,7 @@ int i2c_detect(struct i2c_adapter *adapter,
{ {
#ifdef DEBUG #ifdef DEBUG
printk printk
("i2c-proc.o: found normal i2c_range entry for adapter %d, " (KERN_DEBUG "i2c-proc.o: found normal i2c_range entry for adapter %d, "
"addr %04x\n", adapter_id, addr); "addr %04x\n", adapter_id, addr);
#endif #endif
found = 1; found = 1;
...@@ -767,7 +762,7 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -767,7 +762,7 @@ int i2c_detect(struct i2c_adapter *adapter,
&& (addr == address_data->probe[i + 1])) { && (addr == address_data->probe[i + 1])) {
#ifdef DEBUG #ifdef DEBUG
printk printk
("i2c-proc.o: found probe parameter for adapter %d, " (KERN_DEBUG "i2c-proc.o: found probe parameter for adapter %d, "
"addr %04x\n", adapter_id, addr); "addr %04x\n", adapter_id, addr);
#endif #endif
found = 1; found = 1;
...@@ -786,7 +781,7 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -786,7 +781,7 @@ int i2c_detect(struct i2c_adapter *adapter,
found = 1; found = 1;
#ifdef DEBUG #ifdef DEBUG
printk printk
("i2c-proc.o: found probe_range parameter for adapter %d, " (KERN_DEBUG "i2c-proc.o: found probe_range parameter for adapter %d, "
"addr %04x\n", adapter_id, addr); "addr %04x\n", adapter_id, addr);
#endif #endif
} }
...@@ -807,11 +802,14 @@ int i2c_detect(struct i2c_adapter *adapter, ...@@ -807,11 +802,14 @@ int i2c_detect(struct i2c_adapter *adapter,
int __init sensors_init(void) int __init sensors_init(void)
{ {
printk("i2c-proc.o version %s (%s)\n", LM_VERSION, LM_DATE); printk(KERN_INFO "i2c-proc.o version %s (%s)\n", I2C_VERSION, I2C_DATE);
i2c_initialized = 0; i2c_initialized = 0;
if (! if (!
(i2c_proc_header = (i2c_proc_header =
register_sysctl_table(i2c_proc, 0))) return -ENOMEM; register_sysctl_table(i2c_proc, 0))) {
printk(KERN_ERR "i2c-proc.o: error: sysctl interface not supported by kernel!\n");
return -EPERM;
}
i2c_proc_header->ctl_table->child->de->owner = THIS_MODULE; i2c_proc_header->ctl_table->child->de->owner = THIS_MODULE;
i2c_initialized++; i2c_initialized++;
return 0; return 0;
...@@ -847,4 +845,5 @@ int cleanup_module(void) ...@@ -847,4 +845,5 @@ int cleanup_module(void)
{ {
return i2c_cleanup(); return i2c_cleanup();
} }
#endif /* MODULE */ #endif /* MODULE */
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: i2c-dev.h,v 1.9 2001/08/15 03:04:58 mds Exp $ */ /* $Id: i2c-dev.h,v 1.10 2001/11/19 19:01:46 mds Exp $ */
#ifndef I2C_DEV_H #ifndef I2C_DEV_H
#define I2C_DEV_H #define I2C_DEV_H
...@@ -162,6 +162,22 @@ static inline __s32 i2c_smbus_write_block_data(int file, __u8 command, ...@@ -162,6 +162,22 @@ static inline __s32 i2c_smbus_write_block_data(int file, __u8 command,
I2C_SMBUS_BLOCK_DATA, &data); I2C_SMBUS_BLOCK_DATA, &data);
} }
/* Returns the number of read bytes */
static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command,
__u8 *values)
{
union i2c_smbus_data data;
int i;
if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
I2C_SMBUS_I2C_BLOCK_DATA,&data))
return -1;
else {
for (i = 1; i <= data.block[0]; i++)
values[i-1] = data.block[i];
return data.block[0];
}
}
static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, static inline __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command,
__u8 length, __u8 *values) __u8 length, __u8 *values)
{ {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* $Id: i2c-id.h,v 1.35 2001/08/12 17:22:20 mds Exp $ */ /* $Id: i2c-id.h,v 1.41 2002/03/11 07:18:55 simon Exp $ */
#ifndef I2C_ID_H #ifndef I2C_ID_H
#define I2C_ID_H #define I2C_ID_H
...@@ -90,6 +90,10 @@ ...@@ -90,6 +90,10 @@
#define I2C_DRIVERID_DRP3510 43 /* ADR decoder (Astra Radio) */ #define I2C_DRIVERID_DRP3510 43 /* ADR decoder (Astra Radio) */
#define I2C_DRIVERID_SP5055 44 /* Satellite tuner */ #define I2C_DRIVERID_SP5055 44 /* Satellite tuner */
#define I2C_DRIVERID_STV0030 45 /* Multipurpose switch */ #define I2C_DRIVERID_STV0030 45 /* Multipurpose switch */
#define I2C_DRIVERID_SAA7108 46 /* video decoder, image scaler */
#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */
#define I2C_DRIVERID_EXP1 0xF1 #define I2C_DRIVERID_EXP1 0xF1
...@@ -127,6 +131,9 @@ ...@@ -127,6 +131,9 @@
#define I2C_DRIVERID_ADM1024 1025 #define I2C_DRIVERID_ADM1024 1025
#define I2C_DRIVERID_IT87 1026 #define I2C_DRIVERID_IT87 1026
#define I2C_DRIVERID_CH700X 1027 /* single driver for CH7003-7009 digital pc to tv encoders */ #define I2C_DRIVERID_CH700X 1027 /* single driver for CH7003-7009 digital pc to tv encoders */
#define I2C_DRIVERID_FSCPOS 1028
#define I2C_DRIVERID_FSCSCY 1029
#define I2C_DRIVERID_PCF8591 1030
/* /*
* ---- Adapter types ---------------------------------------------------- * ---- Adapter types ----------------------------------------------------
...@@ -143,7 +150,8 @@ ...@@ -143,7 +150,8 @@
#define I2C_ALGO_ISA 0x050000 /* lm_sensors ISA pseudo-adapter */ #define I2C_ALGO_ISA 0x050000 /* lm_sensors ISA pseudo-adapter */
#define I2C_ALGO_SAA7146 0x060000 /* SAA 7146 video decoder bus */ #define I2C_ALGO_SAA7146 0x060000 /* SAA 7146 video decoder bus */
#define I2C_ALGO_ACB 0x070000 /* ACCESS.bus algorithm */ #define I2C_ALGO_ACB 0x070000 /* ACCESS.bus algorithm */
#define I2C_ALGO_IIC 0x080000 /* ITE IIC bus */
#define I2C_ALGO_SAA7134 0x090000
#define I2C_ALGO_EC 0x100000 /* ACPI embedded controller */ #define I2C_ALGO_EC 0x100000 /* ACPI embedded controller */
#define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */ #define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */
...@@ -189,6 +197,9 @@ ...@@ -189,6 +197,9 @@
/* --- MPC8xx PowerPC adapters */ /* --- MPC8xx PowerPC adapters */
#define I2C_HW_MPC8XX_EPON 0x00 /* Eponymous MPC8xx I2C adapter */ #define I2C_HW_MPC8XX_EPON 0x00 /* Eponymous MPC8xx I2C adapter */
/* --- ITE based algorithms */
#define I2C_HW_I_IIC 0x00 /* controller on the ITE */
/* --- SMBus only adapters */ /* --- SMBus only adapters */
#define I2C_HW_SMBUS_PIIX4 0x00 #define I2C_HW_SMBUS_PIIX4 0x00
#define I2C_HW_SMBUS_ALI15X3 0x01 #define I2C_HW_SMBUS_ALI15X3 0x01
......
/* /*
sensors.h - Part of lm_sensors, Linux kernel modules for hardware i2c-proc.h - Part of the i2c package
monitoring was originally sensors.h - Part of lm_sensors, Linux kernel modules
for hardware monitoring
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
......
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
Frodo Looijaard <frodol@dds.nl> */ Frodo Looijaard <frodol@dds.nl> */
/* $Id: i2c.h,v 1.46 2001/08/31 00:04:07 phil Exp $ */ /* $Id: i2c.h,v 1.50 2002/03/23 00:53:38 phil Exp $ */
#ifndef I2C_H #ifndef I2C_H
#define I2C_H #define I2C_H
#define I2C_DATE "20010830" #define I2C_DATE "20020322"
#define I2C_VERSION "2.6.1" #define I2C_VERSION "2.6.3"
#include <linux/i2c-id.h> /* id values of adapters et. al. */ #include <linux/i2c-id.h> /* id values of adapters et. al. */
#include <linux/types.h> #include <linux/types.h>
...@@ -48,11 +48,8 @@ struct i2c_msg; ...@@ -48,11 +48,8 @@ struct i2c_msg;
#endif #endif
#include <asm/page.h> /* for 2.2.xx */ #include <asm/page.h> /* for 2.2.xx */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,0,25)
#include <linux/sched.h> #include <linux/sched.h>
#else
#include <asm/semaphore.h> #include <asm/semaphore.h>
#endif
#include <linux/config.h> #include <linux/config.h>
/* --- General options ------------------------------------------------ */ /* --- General options ------------------------------------------------ */
...@@ -123,6 +120,8 @@ extern s32 i2c_smbus_read_block_data(struct i2c_client * client, ...@@ -123,6 +120,8 @@ extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
extern s32 i2c_smbus_write_block_data(struct i2c_client * client, extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
u8 command, u8 length, u8 command, u8 length,
u8 *values); u8 *values);
extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
u8 command, u8 *values);
extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
u8 command, u8 length, u8 command, u8 length,
u8 *values); u8 *values);
...@@ -406,8 +405,10 @@ struct i2c_msg { ...@@ -406,8 +405,10 @@ struct i2c_msg {
#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* New I2C-like block */ #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* transfer */ #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
#define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */
#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */
#define I2C_FUNC_SMBUS_BYTE I2C_FUNC_SMBUS_READ_BYTE | \ #define I2C_FUNC_SMBUS_BYTE I2C_FUNC_SMBUS_READ_BYTE | \
I2C_FUNC_SMBUS_WRITE_BYTE I2C_FUNC_SMBUS_WRITE_BYTE
...@@ -419,13 +420,17 @@ struct i2c_msg { ...@@ -419,13 +420,17 @@ struct i2c_msg {
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
#define I2C_FUNC_SMBUS_I2C_BLOCK I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ #define I2C_FUNC_SMBUS_I2C_BLOCK I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK I2C_FUNC_SMBUS_WRITE_I2C_BLOCK
#define I2C_FUNC_SMBUS_I2C_BLOCK_2 I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \
I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2
#define I2C_FUNC_SMBUS_EMUL I2C_FUNC_SMBUS_QUICK | \ #define I2C_FUNC_SMBUS_EMUL I2C_FUNC_SMBUS_QUICK | \
I2C_FUNC_SMBUS_BYTE | \ I2C_FUNC_SMBUS_BYTE | \
I2C_FUNC_SMBUS_BYTE_DATA | \ I2C_FUNC_SMBUS_BYTE_DATA | \
I2C_FUNC_SMBUS_WORD_DATA | \ I2C_FUNC_SMBUS_WORD_DATA | \
I2C_FUNC_SMBUS_PROC_CALL | \ I2C_FUNC_SMBUS_PROC_CALL | \
I2C_FUNC_SMBUS_WRITE_BLOCK_DATA I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
I2C_FUNC_SMBUS_I2C_BLOCK | \
I2C_FUNC_SMBUS_I2C_BLOCK_2
/* /*
* Data for SMBus Messages * Data for SMBus Messages
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment