Commit 204e654e authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] i2c sanity

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..
parent b76a852b
...@@ -52,10 +52,10 @@ Modified transactions ...@@ -52,10 +52,10 @@ Modified transactions
We have found some I2C devices that needs the following modifications: We have found some I2C devices that needs the following modifications:
Flag I2C_M_NOSTART: Flag I2C_M_NOSTART:
In a combined transaction, no 'S Addr' is generated at some point. In a combined transaction, no 'S Addr Wr/Rd [A]' is generated at some
For example, setting I2C_M_NOSTART on the second partial message point. For example, setting I2C_M_NOSTART on the second partial message
generates something like: 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, 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 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. 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: ...@@ -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 need to emit an Rd instead of a Wr, or vice versa, you set this
flag. For example: flag. For example:
S Addr Rd [A] Data [A] Data [A] ... [A] Data [A] P 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.
...@@ -61,7 +61,7 @@ SMBus Write Byte ...@@ -61,7 +61,7 @@ SMBus Write Byte
This is the reverse of Read Byte: it sends a single byte to a device. This is the reverse of Read Byte: it sends a single byte to a device.
See Read Byte for more information. See Read Byte for more information.
S Addr Wr [A] Data NA P S Addr Wr [A] Data [A] P
SMBus Read Byte Data SMBus Read Byte Data
......
...@@ -4,7 +4,7 @@ I2C and SMBus ...@@ -4,7 +4,7 @@ I2C and SMBus
============= =============
I2C (pronounce: I squared C) is a protocol developed by Philips. It is a 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. devices.
SMBus (System Management Bus) is a subset of the I2C protocol. Many SMBus (System Management Bus) is a subset of the I2C protocol. Many
...@@ -43,15 +43,15 @@ for device drivers. ...@@ -43,15 +43,15 @@ for device drivers.
Included Bus 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 Base modules
------------ ------------
i2c-core: The basic I2C code, including the /proc interface i2c-core: The basic I2C code, including the /proc/bus/i2c* interface
i2c-dev: The /dev interface i2c-dev: The /dev/i2c-* interface
i2c-proc: The /proc interface for device (client) drivers i2c-proc: The /proc/sys/dev/sensors interface for device (client) drivers
Algorithm drivers Algorithm drivers
----------------- -----------------
...@@ -59,7 +59,7 @@ 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-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-bit: A bit-banging algorithm
i2c-algo-pcf: A PCF 8584 style 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 Adapter drivers
--------------- ---------------
...@@ -68,7 +68,7 @@ i2c-elektor: Elektor ISA card (uses i2c-algo-pcf) ...@@ -68,7 +68,7 @@ i2c-elektor: Elektor ISA card (uses i2c-algo-pcf)
i2c-elv: ELV parallel port adapter (uses i2c-algo-bit) 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-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-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-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-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) i2c-velleman: Velleman K9000 parallel port adapter (uses i2c-algo-bit)
......
...@@ -448,9 +448,9 @@ For now, you can ignore the `flags' parameter. It is there for future use. ...@@ -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 /* 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 need it, remove it. We do it here to help to lessen memory
fragmentation. */ fragmentation. */
if (! (new_client = kmalloc(sizeof(struct i2c_client)) + if (! (new_client = kmalloc(sizeof(struct i2c_client) +
sizeof(struct foo_data), sizeof(struct foo_data),
GFP_KERNEL)) { GFP_KERNEL))) {
err = -ENOMEM; err = -ENOMEM;
goto ERROR0; goto ERROR0;
} }
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-proc.h> #include <linux/i2c-proc.h>
#include <linux/init.h>
/* Registers */ /* Registers */
#define ADM1021_SYSCTL_TEMP 1200 #define ADM1021_SYSCTL_TEMP 1200
...@@ -123,8 +123,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, ...@@ -123,8 +123,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind); unsigned short flags, int kind);
static void adm1021_init_client(struct i2c_client *client); static void adm1021_init_client(struct i2c_client *client);
static int adm1021_detach_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_read_value(struct i2c_client *client, u8 reg);
static int adm1021_write_value(struct i2c_client *client, u8 reg, static int adm1021_write_value(struct i2c_client *client, u8 reg,
u16 value); u16 value);
...@@ -151,7 +149,6 @@ static struct i2c_driver adm1021_driver = { ...@@ -151,7 +149,6 @@ static struct i2c_driver adm1021_driver = {
.flags = I2C_DF_NOTIFY, .flags = I2C_DF_NOTIFY,
.attach_adapter = adm1021_attach_adapter, .attach_adapter = adm1021_attach_adapter,
.detach_client = adm1021_detach_client, .detach_client = adm1021_detach_client,
.command = adm1021_command,
}; };
/* These files are created for each detected adm1021. This is just a template; /* 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[] = { ...@@ -186,7 +183,7 @@ static ctl_table adm1021_max_dir_table_template[] = {
take more memory than the datastructure takes now. */ take more memory than the datastructure takes now. */
static int adm1021_id = 0; 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); return i2c_detect(adapter, &addr_data, adm1021_detect);
} }
...@@ -339,7 +336,7 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, ...@@ -339,7 +336,7 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address,
return err; return err;
} }
void adm1021_init_client(struct i2c_client *client) static void adm1021_init_client(struct i2c_client *client)
{ {
/* Initialize the adm1021 chip */ /* Initialize the adm1021 chip */
adm1021_write_value(client, ADM1021_REG_TOS_W, adm1021_write_value(client, ADM1021_REG_TOS_W,
...@@ -356,7 +353,7 @@ void adm1021_init_client(struct i2c_client *client) ...@@ -356,7 +353,7 @@ void adm1021_init_client(struct i2c_client *client)
adm1021_write_value(client, ADM1021_REG_CONV_RATE_W, 0x04); 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; int err;
...@@ -376,28 +373,20 @@ int adm1021_detach_client(struct i2c_client *client) ...@@ -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 */ /* 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); 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) if (!read_only)
return 0; return i2c_smbus_write_byte_data(client, reg, value);
return 0;
return i2c_smbus_write_byte_data(client, reg, value);
} }
void adm1021_update_client(struct i2c_client *client) static void adm1021_update_client(struct i2c_client *client)
{ {
struct adm1021_data *data = client->data; struct adm1021_data *data = client->data;
...@@ -447,10 +436,11 @@ void adm1021_update_client(struct i2c_client *client) ...@@ -447,10 +436,11 @@ void adm1021_update_client(struct i2c_client *client)
} }
void adm1021_temp(struct i2c_client *client, int operation, int ctl_name, static void adm1021_temp(struct i2c_client *client, int operation,
int *nrels_mag, long *results) int ctl_name, int *nrels_mag, long *results)
{ {
struct adm1021_data *data = client->data; struct adm1021_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO) if (operation == SENSORS_PROC_REAL_INFO)
*nrels_mag = 0; *nrels_mag = 0;
else if (operation == SENSORS_PROC_REAL_READ) { else if (operation == SENSORS_PROC_REAL_READ) {
...@@ -473,8 +463,8 @@ void adm1021_temp(struct i2c_client *client, int operation, int ctl_name, ...@@ -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, static void adm1021_remote_temp(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results) int ctl_name, int *nrels_mag, long *results)
{ {
struct adm1021_data *data = client->data; struct adm1021_data *data = client->data;
int prec = 0; int prec = 0;
...@@ -546,10 +536,11 @@ void adm1021_remote_temp(struct i2c_client *client, int operation, ...@@ -546,10 +536,11 @@ void adm1021_remote_temp(struct i2c_client *client, int operation,
} }
} }
void adm1021_die_code(struct i2c_client *client, int operation, static void adm1021_die_code(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results) int ctl_name, int *nrels_mag, long *results)
{ {
struct adm1021_data *data = client->data; struct adm1021_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO) if (operation == SENSORS_PROC_REAL_INFO)
*nrels_mag = 0; *nrels_mag = 0;
else if (operation == SENSORS_PROC_REAL_READ) { else if (operation == SENSORS_PROC_REAL_READ) {
...@@ -561,8 +552,8 @@ void adm1021_die_code(struct i2c_client *client, int operation, ...@@ -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, static void adm1021_alarms(struct i2c_client *client, int operation,
int *nrels_mag, long *results) int ctl_name, int *nrels_mag, long *results)
{ {
struct adm1021_data *data = client->data; struct adm1021_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO) if (operation == SENSORS_PROC_REAL_INFO)
...@@ -578,7 +569,6 @@ void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name, ...@@ -578,7 +569,6 @@ void adm1021_alarms(struct i2c_client *client, int operation, int ctl_name,
static int __init sensors_adm1021_init(void) static int __init sensors_adm1021_init(void)
{ {
return i2c_add_driver(&adm1021_driver); return i2c_add_driver(&adm1021_driver);
} }
......
...@@ -18,12 +18,11 @@ ...@@ -18,12 +18,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-proc.h> #include <linux/i2c-proc.h>
#include <linux/init.h>
#define LM75_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */ #define LM75_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
...@@ -72,8 +71,6 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, ...@@ -72,8 +71,6 @@ static int lm75_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind); unsigned short flags, int kind);
static void lm75_init_client(struct i2c_client *client); static void lm75_init_client(struct i2c_client *client);
static int lm75_detach_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 u16 swap_bytes(u16 val);
static int lm75_read_value(struct i2c_client *client, u8 reg); static int lm75_read_value(struct i2c_client *client, u8 reg);
static 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);
...@@ -84,12 +81,12 @@ static void lm75_update_client(struct i2c_client *client); ...@@ -84,12 +81,12 @@ static void lm75_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */ /* This is the driver that will be inserted */
static struct i2c_driver lm75_driver = { static struct i2c_driver lm75_driver = {
.owner = THIS_MODULE,
.name = "LM75 sensor chip driver", .name = "LM75 sensor chip driver",
.id = I2C_DRIVERID_LM75, .id = I2C_DRIVERID_LM75,
.flags = I2C_DF_NOTIFY, .flags = I2C_DF_NOTIFY,
.attach_adapter = lm75_attach_adapter, .attach_adapter = lm75_attach_adapter,
.detach_client = lm75_detach_client, .detach_client = lm75_detach_client,
.command = lm75_command,
}; };
/* These files are created for each detected LM75. This is just a template; /* These files are created for each detected LM75. This is just a template;
...@@ -105,14 +102,14 @@ static ctl_table lm75_dir_table_template[] = { ...@@ -105,14 +102,14 @@ static ctl_table lm75_dir_table_template[] = {
static int lm75_id = 0; 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); return i2c_detect(adapter, &addr_data, lm75_detect);
} }
/* This function is called by i2c_detect */ /* This function is called by i2c_detect */
int lm75_detect(struct i2c_adapter *adapter, int address, static int lm75_detect(struct i2c_adapter *adapter, int address,
unsigned short flags, int kind) unsigned short flags, int kind)
{ {
int i, cur, conf, hyst, os; int i, cur, conf, hyst, os;
struct i2c_client *new_client; struct i2c_client *new_client;
...@@ -217,7 +214,7 @@ int lm75_detect(struct i2c_adapter *adapter, int address, ...@@ -217,7 +214,7 @@ int lm75_detect(struct i2c_adapter *adapter, int address,
return err; 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; struct lm75_data *data = client->data;
...@@ -227,12 +224,7 @@ int lm75_detach_client(struct i2c_client *client) ...@@ -227,12 +224,7 @@ int lm75_detach_client(struct i2c_client *client)
return 0; return 0;
} }
int lm75_command(struct i2c_client *client, unsigned int cmd, void *arg) static u16 swap_bytes(u16 val)
{
return 0;
}
u16 swap_bytes(u16 val)
{ {
return (val >> 8) | (val << 8); return (val >> 8) | (val << 8);
} }
...@@ -240,7 +232,7 @@ u16 swap_bytes(u16 val) ...@@ -240,7 +232,7 @@ u16 swap_bytes(u16 val)
/* All registers are word-sized, except for the configuration register. /* All registers are word-sized, except for the configuration register.
LM75 uses a high-byte first convention, which is exactly opposite to LM75 uses a high-byte first convention, which is exactly opposite to
the usual practice. */ 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) if (reg == LM75_REG_CONF)
return i2c_smbus_read_byte_data(client, reg); return i2c_smbus_read_byte_data(client, reg);
...@@ -251,7 +243,7 @@ int lm75_read_value(struct i2c_client *client, u8 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. /* All registers are word-sized, except for the configuration register.
LM75 uses a high-byte first convention, which is exactly opposite to LM75 uses a high-byte first convention, which is exactly opposite to
the usual practice. */ 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) if (reg == LM75_REG_CONF)
return i2c_smbus_write_byte_data(client, reg, value); 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) ...@@ -260,7 +252,7 @@ int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
swap_bytes(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 */ /* Initialize the LM75 chip */
lm75_write_value(client, LM75_REG_TEMP_OS, lm75_write_value(client, LM75_REG_TEMP_OS,
...@@ -270,7 +262,7 @@ void lm75_init_client(struct i2c_client *client) ...@@ -270,7 +262,7 @@ void lm75_init_client(struct i2c_client *client)
lm75_write_value(client, LM75_REG_CONF, 0); 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; struct lm75_data *data = client->data;
...@@ -292,8 +284,8 @@ void lm75_update_client(struct i2c_client *client) ...@@ -292,8 +284,8 @@ void lm75_update_client(struct i2c_client *client)
} }
void lm75_temp(struct i2c_client *client, int operation, int ctl_name, static void lm75_temp(struct i2c_client *client, int operation, int ctl_name,
int *nrels_mag, long *results) int *nrels_mag, long *results)
{ {
struct lm75_data *data = client->data; struct lm75_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO) if (operation == SENSORS_PROC_REAL_INFO)
...@@ -318,7 +310,7 @@ void lm75_temp(struct i2c_client *client, int operation, int ctl_name, ...@@ -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); return i2c_add_driver(&lm75_driver);
} }
......
...@@ -21,21 +21,19 @@ ...@@ -21,21 +21,19 @@
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even /* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */ 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/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/version.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/uaccess.h>
#include <linux/ioport.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/sched.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
/* ----- global defines ----------------------------------------------- */ /* ----- global defines ----------------------------------------------- */
#define DEB(x) if (i2c_debug>=1) x; #define DEB(x) if (i2c_debug>=1) x;
#define DEB2(x) if (i2c_debug>=2) x; #define DEB2(x) if (i2c_debug>=2) x;
......
...@@ -31,16 +31,13 @@ ...@@ -31,16 +31,13 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/version.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/uaccess.h>
#include <linux/ioport.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-pcf.h> #include <linux/i2c-algo-pcf.h>
#include "i2c-pcf8584.h" #include "i2c-pcf8584.h"
/* ----- global defines ----------------------------------------------- */ /* ----- global defines ----------------------------------------------- */
#define DEB(x) if (i2c_debug>=1) x #define DEB(x) if (i2c_debug>=1) x
#define DEB2(x) if (i2c_debug>=2) x #define DEB2(x) if (i2c_debug>=2) x
......
...@@ -28,25 +28,22 @@ ...@@ -28,25 +28,22 @@
/* 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.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/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/version.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.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: */ /* If you want debugging uncomment: */
/* #define DEBUG */ /* #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 */ /* 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, ...@@ -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; struct i2c_client *client = (struct i2c_client *)file->private_data;
if(count > 8192) if (count > 8192)
count = 8192; count = 8192;
/* copy user space data to kernel space. */ /* copy user space data to kernel space. */
tmp = kmalloc(count,GFP_KERNEL); tmp = kmalloc(count,GFP_KERNEL);
if (tmp==NULL) if (tmp==NULL)
......
...@@ -21,20 +21,18 @@ ...@@ -21,20 +21,18 @@
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even /* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */ 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/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/version.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/uaccess.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <asm/io.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
#include <asm/io.h>
#define DEFAULT_BASE 0x378 #define DEFAULT_BASE 0x378
static int base=0; static int base=0;
...@@ -120,12 +118,13 @@ static int bit_elv_init(void) ...@@ -120,12 +118,13 @@ static int bit_elv_init(void)
* This is only done when more than one hardware adapter is supported. * This is only done when more than one hardware adapter is supported.
*/ */
static struct i2c_algo_bit_data bit_elv_data = { static struct i2c_algo_bit_data bit_elv_data = {
NULL, .setsda = bit_elv_setsda,
bit_elv_setsda, .setscl = bit_elv_setscl,
bit_elv_setscl, .getsda = bit_elv_getsda,
bit_elv_getsda, .getscl = bit_elv_getscl,
bit_elv_getscl, .udelay = 80,
80, 80, 100, /* waits, timeout */ .mdelay = 80,
.timeout = HZ
}; };
static struct i2c_adapter bit_elv_ops = { static struct i2c_adapter bit_elv_ops = {
......
...@@ -12,18 +12,14 @@ ...@@ -12,18 +12,14 @@
* version 2 as published by the Free Software Foundation. * version 2 as published by the Free Software Foundation.
*/ */
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <asm/hardware.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
#include <asm/hardware.h>
static void frodo_setsda (void *data,int state) static void frodo_setsda (void *data,int state)
{ {
...@@ -58,7 +54,7 @@ static struct i2c_algo_bit_data bit_frodo_data = { ...@@ -58,7 +54,7 @@ static struct i2c_algo_bit_data bit_frodo_data = {
.getscl = frodo_getscl, .getscl = frodo_getscl,
.udelay = 80, .udelay = 80,
.mdelay = 80, .mdelay = 80,
.timeout = 100 .timeout = HZ
}; };
static struct i2c_adapter frodo_ops = { static struct i2c_adapter frodo_ops = {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even /* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */ 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/kernel.h>
#include <linux/ioport.h> #include <linux/ioport.h>
...@@ -32,10 +32,6 @@ ...@@ -32,10 +32,6 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
#ifndef __exit
#define __exit __init
#endif
static int type; static int type;
struct i2c_par struct i2c_par
...@@ -135,21 +131,22 @@ static int bit_lp_getsda2(void *data) ...@@ -135,21 +131,22 @@ static int bit_lp_getsda2(void *data)
*/ */
static struct i2c_algo_bit_data bit_lp_data = { static struct i2c_algo_bit_data bit_lp_data = {
NULL, .setsda = bit_lp_setsda,
bit_lp_setsda, .setscl = bit_lp_setscl,
bit_lp_setscl, .getsda = bit_lp_getsda,
bit_lp_getsda, .getscl = bit_lp_getscl,
bit_lp_getscl, .udelay = 80,
80, 80, 100, /* waits, timeout */ .mdelay = 80,
.timeout = HZ
}; };
static struct i2c_algo_bit_data bit_lp_data2 = { static struct i2c_algo_bit_data bit_lp_data2 = {
NULL, .setsda = bit_lp_setsda2,
bit_lp_setsda2, .setscl = bit_lp_setscl2,
bit_lp_setscl2, .getsda = bit_lp_getsda2,
bit_lp_getsda2, .udelay = 80,
NULL, .mdelay = 80,
80, 80, 100, /* waits, timeout */ .timeout = HZ
}; };
static struct i2c_adapter bit_lp_ops = { static struct i2c_adapter bit_lp_ops = {
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-proc.h> #include <linux/i2c-proc.h>
#include <linux/init.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
static int i2c_create_name(char **name, const char *prefix, static int i2c_create_name(char **name, const char *prefix,
...@@ -87,7 +87,7 @@ static struct ctl_table_header *i2c_proc_header; ...@@ -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 (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). a LM75 chip on the third i2c bus at address 0x4e).
name is allocated first. */ 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) struct i2c_adapter *adapter, int addr)
{ {
char name_buffer[50]; char name_buffer[50];
...@@ -200,7 +200,8 @@ void i2c_deregister_entry(int id) ...@@ -200,7 +200,8 @@ void i2c_deregister_entry(int id)
{ {
ctl_table *table; ctl_table *table;
char *temp; char *temp;
id -= 256;
id -= 256;
if (i2c_entries[id]) { if (i2c_entries[id]) {
table = i2c_entries[id]->ctl_table; table = i2c_entries[id]->ctl_table;
unregister_sysctl_table(i2c_entries[id]); unregister_sysctl_table(i2c_entries[id]);
...@@ -213,7 +214,7 @@ void i2c_deregister_entry(int 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) void *buffer, size_t * lenp)
{ {
char BUF[SENSORS_PREFIX_MAX + 30]; char BUF[SENSORS_PREFIX_MAX + 30];
...@@ -251,7 +252,7 @@ int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp, ...@@ -251,7 +252,7 @@ int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
return 0; 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, void *oldval, size_t * oldlenp, void *newval,
size_t newlen, void **context) size_t newlen, void **context)
{ {
...@@ -413,7 +414,7 @@ int i2c_sysctl_real(ctl_table * table, int *name, int nlen, ...@@ -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 WARNING! This is tricky code. I have tested it, but there may still be
hidden bugs in it, even leading to crashes and things! 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) long *results, int magnitude)
{ {
int maxels, min, mag; int maxels, min, mag;
...@@ -822,11 +823,11 @@ static void __exit i2c_proc_exit(void) ...@@ -822,11 +823,11 @@ static void __exit i2c_proc_exit(void)
unregister_sysctl_table(i2c_proc_header); unregister_sysctl_table(i2c_proc_header);
} }
EXPORT_SYMBOL(i2c_register_entry);
EXPORT_SYMBOL(i2c_deregister_entry); EXPORT_SYMBOL(i2c_deregister_entry);
EXPORT_SYMBOL(i2c_detect);
EXPORT_SYMBOL(i2c_proc_real); EXPORT_SYMBOL(i2c_proc_real);
EXPORT_SYMBOL(i2c_register_entry);
EXPORT_SYMBOL(i2c_sysctl_real); EXPORT_SYMBOL(i2c_sysctl_real);
EXPORT_SYMBOL(i2c_detect);
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>"); MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
MODULE_DESCRIPTION("i2c-proc driver"); MODULE_DESCRIPTION("i2c-proc driver");
......
...@@ -17,12 +17,11 @@ ...@@ -17,12 +17,11 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/parport.h> #include <linux/parport.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-8xx.h>
#include <asm/mpc8xx.h> #include <asm/mpc8xx.h>
#include <asm/commproc.h> #include <asm/commproc.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-8xx.h>
static void static void
rpx_iic_init(struct i2c_algo_8xx_data *data) rpx_iic_init(struct i2c_algo_8xx_data *data)
......
...@@ -18,17 +18,16 @@ ...@@ -18,17 +18,16 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 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/kernel.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/string.h> /* for 2.0 kernels to get NULL */ #include <linux/delay.h>
#include <asm/errno.h> /* for 2.0 kernels to get ENODEV */
#include <asm/io.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
#include <asm/io.h>
/* ----- global defines ----------------------------------------------- */ /* ----- global defines ----------------------------------------------- */
#define DEB(x) /* should be reasonable open, close &c. */ #define DEB(x) /* should be reasonable open, close &c. */
...@@ -104,12 +103,13 @@ static int bit_velle_init(void) ...@@ -104,12 +103,13 @@ static int bit_velle_init(void)
*/ */
static struct i2c_algo_bit_data bit_velle_data = { static struct i2c_algo_bit_data bit_velle_data = {
NULL, .setsda = bit_velle_setsda,
bit_velle_setsda, .setscl = bit_velle_setscl,
bit_velle_setscl, .getsda = bit_velle_getsda,
bit_velle_getsda, .getscl = bit_velle_getscl,
bit_velle_getscl, .udelay = 10,
10, 10, 100, /* waits, timeout */ .mdelay = 10,
.timeout = HZ
}; };
static struct i2c_adapter bit_velle_ops = { static struct i2c_adapter bit_velle_ops = {
......
...@@ -21,12 +21,10 @@ ...@@ -21,12 +21,10 @@
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */ 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 #ifndef _LINUX_I2C_ALGO_BIT_H
#define I2C_ALGO_BIT_H 1 #define _LINUX_I2C_ALGO_BIT_H
#include <linux/i2c.h>
/* --- Defines for bit-adapters --------------------------------------- */ /* --- Defines for bit-adapters --------------------------------------- */
/* /*
...@@ -53,4 +51,4 @@ struct i2c_algo_bit_data { ...@@ -53,4 +51,4 @@ struct i2c_algo_bit_data {
int i2c_bit_add_bus(struct i2c_adapter *); int i2c_bit_add_bus(struct i2c_adapter *);
int i2c_bit_del_bus(struct i2c_adapter *); int i2c_bit_del_bus(struct i2c_adapter *);
#endif /* I2C_ALGO_BIT_H */ #endif /* _LINUX_I2C_ALGO_BIT_H */
...@@ -22,13 +22,10 @@ ...@@ -22,13 +22,10 @@
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even /* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */ 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 #ifndef _LINUX_I2C_ALGO_PCF_H
#define I2C_ALGO_PCF_H 1 #define _LINUX_I2C_ALGO_PCF_H
/* --- Defines for pcf-adapters --------------------------------------- */
#include <linux/i2c.h>
struct i2c_algo_pcf_data { struct i2c_algo_pcf_data {
void *data; /* private data for lolevel routines */ void *data; /* private data for lolevel routines */
...@@ -49,4 +46,4 @@ struct i2c_algo_pcf_data { ...@@ -49,4 +46,4 @@ struct i2c_algo_pcf_data {
int i2c_pcf_add_bus(struct i2c_adapter *); int i2c_pcf_add_bus(struct i2c_adapter *);
int i2c_pcf_del_bus(struct i2c_adapter *); int i2c_pcf_del_bus(struct i2c_adapter *);
#endif /* I2C_ALGO_PCF_H */ #endif /* _LINUX_I2C_ALGO_PCF_H */
...@@ -19,13 +19,12 @@ ...@@ -19,13 +19,12 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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 #ifndef _LINUX_I2C_DEV_H
#define _LINUX_I2C_DEV_H #define _LINUX_I2C_DEV_H
#include <linux/types.h> #include <linux/types.h>
#include <linux/i2c.h>
/* Some IOCTL commands are defined in <linux/i2c.h> */ /* Some IOCTL commands are defined in <linux/i2c.h> */
/* Note: 10-bit addresses are NOT supported! */ /* Note: 10-bit addresses are NOT supported! */
......
...@@ -20,10 +20,11 @@ ...@@ -20,10 +20,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 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 * This file is part of the i2c-bus package and contains the identifier
* values for drivers, adapters and other folk populating these serial * values for drivers, adapters and other folk populating these serial
...@@ -95,7 +96,8 @@ ...@@ -95,7 +96,8 @@
#define I2C_DRIVERID_ADV717x 48 /* ADV 7175/7176 video encoder */ #define I2C_DRIVERID_ADV717x 48 /* ADV 7175/7176 video encoder */
#define I2C_DRIVERID_ZR36067 49 /* Zoran 36067 video encoder */ #define I2C_DRIVERID_ZR36067 49 /* Zoran 36067 video encoder */
#define I2C_DRIVERID_ZR36120 50 /* Zoran 36120 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 */
...@@ -147,6 +149,7 @@ ...@@ -147,6 +149,7 @@
#define I2C_DRIVERID_SMARTBATT 1035 #define I2C_DRIVERID_SMARTBATT 1035
#define I2C_DRIVERID_BMCSENSORS 1036 #define I2C_DRIVERID_BMCSENSORS 1036
#define I2C_DRIVERID_FS451 1037 #define I2C_DRIVERID_FS451 1037
#define I2C_DRIVERID_W83627HF 1038
/* /*
* ---- Adapter types ---------------------------------------------------- * ---- Adapter types ----------------------------------------------------
...@@ -172,6 +175,7 @@ ...@@ -172,6 +175,7 @@
#define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */ #define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */
#define I2C_ALGO_OCP 0x120000 /* IBM or otherwise On-chip 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 */ #define I2C_ALGO_EXP 0x800000 /* experimental */
...@@ -250,4 +254,4 @@ ...@@ -250,4 +254,4 @@
/* --- IPMB adapter */ /* --- IPMB adapter */
#define I2C_HW_IPMB 0x00 #define I2C_HW_IPMB 0x00
#endif /* I2C_ID_H */ #endif /* LINUX_I2C_ID_H */
...@@ -19,14 +19,9 @@ ...@@ -19,14 +19,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef SENSORS_SENSORS_H #ifndef _LINUX_I2C_PROC_H
#define SENSORS_SENSORS_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> #include <linux/sysctl.h>
/* The type of callback functions used in sensors_{proc,sysctl}_real */ /* The type of callback functions used in sensors_{proc,sysctl}_real */
...@@ -388,7 +383,7 @@ extern int i2c_detect(struct i2c_adapter *adapter, ...@@ -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 /* This macro is used to scale user-input to sensible values in almost all
chip drivers. */ 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) if (value < low)
return low; return low;
...@@ -398,8 +393,6 @@ extern inline int SENSORS_LIMIT(long value, long low, long high) ...@@ -398,8 +393,6 @@ extern inline int SENSORS_LIMIT(long value, long low, long high)
return value; return value;
} }
#endif /* def __KERNEL__ */
/* The maximum length of the prefix */ /* The maximum length of the prefix */
#define SENSORS_PREFIX_MAX 20 #define SENSORS_PREFIX_MAX 20
...@@ -418,5 +411,5 @@ struct i2c_chips_data { ...@@ -418,5 +411,5 @@ struct i2c_chips_data {
char name[SENSORS_PREFIX_MAX + 13]; char name[SENSORS_PREFIX_MAX + 13];
}; };
#endif /* def SENSORS_SENSORS_H */ #endif /* def _LINUX_I2C_PROC_H */
...@@ -23,20 +23,19 @@ ...@@ -23,20 +23,19 @@
/* 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.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 #ifndef _LINUX_I2C_H
#define _LINUX_I2C_H #define _LINUX_I2C_H
#define I2C_DATE "20020719" #define I2C_DATE "20021208"
#define I2C_VERSION "2.6.4" #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/types.h>
#include <linux/config.h> #include <linux/i2c-id.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
/* --- General options ------------------------------------------------ */ /* --- General options ------------------------------------------------ */
#define I2C_ALGO_MAX 4 /* control memory consumption */ #define I2C_ALGO_MAX 4 /* control memory consumption */
......
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